@mdfriday/foundry 26.2.10 → 26.2.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
1
  /* @mdfriday/foundry - bundled */
2
- var LTR_LANGUAGES,RTL_LANGUAGES,ALL_LANGUAGES,LANGUAGE_MAP,CODE_NAME_MAP,DefaultLanguageService,serviceInstance,__create=Object.create,__defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty,__esm=(e,t)=>function(){return e&&(t=(0,e[__getOwnPropNames(e)[0]])(e=0)),t},__export=(e,t)=>{for(var n in t)__defProp(e,n,{get:t[n],enumerable:!0})},__copyProps=(e,t,n,r)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let s of __getOwnPropNames(t))__hasOwnProp.call(e,s)||s===n||__defProp(e,s,{get:()=>t[s],enumerable:!(r=__getOwnPropDesc(t,s))||r.enumerable});return e},__toESM=(e,t,n)=>(n=null!=e?__create(__getProtoOf(e)):{},__copyProps(!t&&e&&e.__esModule?n:__defProp(n,"default",{value:e,enumerable:!0}),e)),__toCommonJS=e=>__copyProps(__defProp({},"__esModule",{value:!0}),e),init_data=__esm({"pkg/lang/data.ts"(){LTR_LANGUAGES=[{code:"en",name:"English",direction:"ltr",englishName:"English"},{code:"zh",name:"中文",direction:"ltr",englishName:"Chinese"},{code:"ja",name:"日本語",direction:"ltr",englishName:"Japanese"},{code:"ko",name:"한국어",direction:"ltr",englishName:"Korean"},{code:"fr",name:"Français",direction:"ltr",englishName:"French"},{code:"de",name:"Deutsch",direction:"ltr",englishName:"German"},{code:"es",name:"Español",direction:"ltr",englishName:"Spanish"},{code:"pt",name:"Português",direction:"ltr",englishName:"Portuguese"},{code:"ru",name:"Русский",direction:"ltr",englishName:"Russian"},{code:"hi",name:"हिंदी",direction:"ltr",englishName:"Hindi"},{code:"it",name:"Italiano",direction:"ltr",englishName:"Italian"},{code:"nl",name:"Nederlands",direction:"ltr",englishName:"Dutch"},{code:"tr",name:"Türkçe",direction:"ltr",englishName:"Turkish"},{code:"vi",name:"Tiếng Việt",direction:"ltr",englishName:"Vietnamese"},{code:"th",name:"ไทย",direction:"ltr",englishName:"Thai"}],RTL_LANGUAGES=[],ALL_LANGUAGES=[...LTR_LANGUAGES,...RTL_LANGUAGES],LANGUAGE_MAP=ALL_LANGUAGES.reduce((e,t)=>(e[t.code]=t,e),{}),CODE_NAME_MAP=ALL_LANGUAGES.reduce((e,t)=>(e[t.code]=t.name,e),{})}});function getLanguageService(){return serviceInstance||(serviceInstance=new DefaultLanguageService),serviceInstance}function createLanguageService(){return new DefaultLanguageService}var lang,languages,init_service=__esm({"pkg/lang/service.ts"(){init_data(),DefaultLanguageService=class{getAllCodes(){return ALL_LANGUAGES.map(e=>e.code)}getAllNames(){return ALL_LANGUAGES.map(e=>e.name)}getCodesByDirection(e){return("ltr"===e?LTR_LANGUAGES:RTL_LANGUAGES).map(e=>e.code)}getNamesByDirection(e){return("ltr"===e?LTR_LANGUAGES:RTL_LANGUAGES).map(e=>e.name)}getCodeNameMap(){return{...CODE_NAME_MAP}}getCodeNameMapByDirection(e){return("ltr"===e?LTR_LANGUAGES:RTL_LANGUAGES).reduce((e,t)=>(e[t.code]=t.name,e),{})}getNameByCode(e){return LANGUAGE_MAP[e]?.name}getLanguageInfo(e){const t=LANGUAGE_MAP[e];return t?{...t}:void 0}isSupported(e){return e in LANGUAGE_MAP}getDirection(e){return LANGUAGE_MAP[e]?.direction}isLTR(e){return"ltr"===LANGUAGE_MAP[e]?.direction}isRTL(e){return"rtl"===LANGUAGE_MAP[e]?.direction}},serviceInstance=null}}),lang_exports={};__export(lang_exports,{ALL_LANGUAGES:()=>ALL_LANGUAGES,CODE_NAME_MAP:()=>CODE_NAME_MAP,DefaultLanguageService:()=>DefaultLanguageService,LANGUAGE_MAP:()=>LANGUAGE_MAP,LTR_LANGUAGES:()=>LTR_LANGUAGES,RTL_LANGUAGES:()=>RTL_LANGUAGES,createLanguageService:()=>createLanguageService,getLanguageService:()=>getLanguageService,lang:()=>lang,languages:()=>languages});var util,Logger,globalLoggerManager,init_lang=__esm({"pkg/lang/index.ts"(){init_data(),init_service(),init_service(),lang=getLanguageService(),languages={getAllCodes:()=>lang.getAllCodes(),getAllNames:()=>lang.getAllNames(),getCodesByDirection:e=>lang.getCodesByDirection(e),getNamesByDirection:e=>lang.getNamesByDirection(e),getCodeNameMap:()=>lang.getCodeNameMap(),getCodeNameMapByDirection:e=>lang.getCodeNameMapByDirection(e),getNameByCode:e=>lang.getNameByCode(e),getLanguageInfo:e=>lang.getLanguageInfo(e),isSupported:e=>lang.isSupported(e),getDirection:e=>lang.getDirection(e),isLTR:e=>lang.isLTR(e),isRTL:e=>lang.isRTL(e)}}}),init_types=__esm({"pkg/log/types.ts"(){}}),init_logger=__esm({"pkg/log/logger.ts"(){util=__toESM(require("util")),init_types(),Logger=class e{config;fields;constructor(e){this.config={enableCaller:!0,jsonFormat:!0,...e},this.fields={}}shouldLog(e){const t=["debug","info","warn","error","fatal"],n=t.indexOf(this.config.level);return t.indexOf(e)>=n}getCaller(){if(!this.config.enableCaller)return;const e=(new Error).stack;if(!e)return;const t=e.split("\n")[4];if(!t)return;const n=t.match(/at .* \((.+):(\d+):(\d+)\)/);if(n){const[,e,t]=n;return`${e.split("/").pop()}:${t}`}const r=t.match(/at (.+):(\d+):(\d+)/);if(r){const[,e,t]=r;return`${e.split("/").pop()}:${t}`}}formatMessage(e,t){return 0===t.length?e:util.format(e,...t)}writeLog(e,t){if(!this.shouldLog(e))return;const n={level:e,timestamp:(new Date).toISOString(),message:t,...this.fields},r=this.getCaller();r&&(n.caller=r);const s=this.config.jsonFormat?JSON.stringify(n):this.formatPlainText(n);console.log(s),"error"===e||"fatal"===e?process.stderr.write(s+"\n"):process.stdout.write(s+"\n"),"fatal"===e&&process.exit(1)}formatPlainText(e){const t=[e.timestamp,e.level.toUpperCase()];e.caller&&t.push(`[${e.caller}]`),t.push(e.message);const n=Object.keys(e).filter(e=>!["level","timestamp","message","caller"].includes(e)).map(t=>`${t}=${JSON.stringify(e[t])}`).join(" ");return n&&t.push(n),t.join(" ")}debug(e,...t){this.writeLog("debug",this.formatMessage(e,t))}info(e,...t){this.writeLog("info",this.formatMessage(e,t))}warn(e,...t){this.writeLog("warn",this.formatMessage(e,t))}error(e,...t){this.writeLog("error",this.formatMessage(e,t))}fatal(e,...t){this.writeLog("fatal",this.formatMessage(e,t))}debugf(e,...t){this.writeLog("debug",this.formatMessage(e,t))}infof(e,...t){this.writeLog("info",this.formatMessage(e,t))}warnf(e,...t){this.writeLog("warn",this.formatMessage(e,t))}errorf(e,...t){this.writeLog("error",this.formatMessage(e,t))}fatalf(e,...t){this.writeLog("fatal",this.formatMessage(e,t))}with(t){const n=new e(this.config);return n.fields={...this.fields,...t},n}}}}),init_http=__esm({"pkg/log/http.ts"(){}});function getDomainLogger(e,t){return globalLoggerManager.getLogger(e,t)}var log39,WeightedPage,WeightedPages,Taxonomy3,OrderedTaxonomyEntry,OrderedTaxonomy,TaxonomyList,TaxonomiesBuilder,init_manager=__esm({"pkg/log/manager.ts"(){init_logger(),init_types(),globalLoggerManager=class e{static instance;globalConfig;loggers;constructor(){this.globalConfig={level:"debug",enableCaller:!0,jsonFormat:!0},this.loggers=new Map}static getInstance(){return e.instance||(e.instance=new e),e.instance}setGlobalConfig(e){this.globalConfig={...this.globalConfig,...e},this.loggers.clear()}getGlobalConfig(){return{...this.globalConfig}}getLogger(e,t){const n=e+(t?JSON.stringify(t):"");if(!this.loggers.has(n)){const s=(r=this.globalConfig,new Logger(r)),a={domain:e,...t},i=s.with(a);this.loggers.set(n,i)}var r;return this.loggers.get(n)}getComponentLogger(e,t,n){const r={component:t,...n};return this.getLogger(e,r)}clearCache(){this.loggers.clear()}getCachedDomains(){return Array.from(this.loggers.keys())}setLogLevel(e){this.setGlobalConfig({level:e})}setCallerEnabled(e){this.setGlobalConfig({enableCaller:e})}setJsonFormat(e){this.setGlobalConfig({jsonFormat:e})}}.getInstance()}}),init_log=__esm({"pkg/log/index.ts"(){init_types(),init_logger(),init_http(),init_manager(),init_logger(),init_types(),function(e="info"){new Logger({level:e})}("info")}}),taxonomies_builder_exports={};__export(taxonomies_builder_exports,{OrderedTaxonomy:()=>OrderedTaxonomy,OrderedTaxonomyEntry:()=>OrderedTaxonomyEntry,TaxonomiesBuilder:()=>TaxonomiesBuilder,Taxonomy:()=>Taxonomy3,TaxonomyList:()=>TaxonomyList,WeightedPage:()=>WeightedPage,WeightedPages:()=>WeightedPages});var cb,mod,init_taxonomies_builder=__esm({"internal/domain/site/entity/taxonomies-builder.ts"(){init_log(),log39=getDomainLogger("site",{component:"taxonomies-builder"}),WeightedPage=class{page;ordinalWeightPage;constructor(e,t){this.page=e,this.ordinalWeightPage=t}get Page(){return this.page}weight(){return this.ordinalWeightPage.weight()}ordinal(){return this.ordinalWeightPage.ordinal()}owner(){return this.ordinalWeightPage.owner()}get Permalink(){return this.page.Permalink}get RelPermalink(){return this.page.RelPermalink}get Title(){return this.page.Title}},WeightedPages=class extends Array{page(){return 0===this.length?(log39.error("Page called on empty WeightedPages"),null):this[0]}get Page(){return this.page()}pages(){return Array.from(this)}sortByWeight(){this.stableSort((e,t)=>e.weight()-t.weight())}count(){return this.length}get Count(){return this.count()}stableSort(e){const t=this.map((e,t)=>({item:e,index:t}));t.sort((t,n)=>{const r=e(t.item,n.item);return 0!==r?r:t.index-n.index}),this.splice(0,this.length,...t.map(e=>e.item))}},Taxonomy3=class{terms=new Map;get(e){return this.terms.get(e)}set(e,t){this.terms.set(e,t)}has(e){return this.terms.has(e)}keys(){return Array.from(this.terms.keys())}values(){return Array.from(this.terms.values())}get Values(){return this.terms}entries(){return Array.from(this.terms.entries())}size(){return this.terms.size}byCount(){const e=this.taxonomyArray();return e.sort((e,t)=>{const n=e.weightedPages.length,r=t.weightedPages.length;return n===r?e.name.localeCompare(t.name):r-n}),new OrderedTaxonomy(e)}taxonomyArray(){const e=[];for(const[t,n]of this.terms.entries())e.push(new OrderedTaxonomyEntry(t,n));return e}},OrderedTaxonomyEntry=class{name;weightedPages;constructor(e,t){this.name=e,this.weightedPages=t}count(){return this.weightedPages.count()}term(){return this.name}},OrderedTaxonomy=class extends Array{constructor(e){super(),e&&this.push(...e)}getOneOPage(){return 0===this.length?null:this[0].weightedPages.page()}},TaxonomyList=class{taxonomies=new Map;get(e){return this.taxonomies.get(e)}set(e,t){this.taxonomies.set(e,t)}has(e){return this.taxonomies.has(e)}keys(){return Array.from(this.taxonomies.keys())}values(){return Array.from(this.taxonomies.values())}get Values(){return this.taxonomies}entries(){return Array.from(this.taxonomies.entries())}size(){return this.taxonomies.size}},TaxonomiesBuilder=class{contentService;constructor(e){this.contentService=e}async buildTaxonomiesForLanguage(e,t){const n=new TaxonomyList;try{return await this.contentService.walkTaxonomies(e,async(e,r,s)=>{n.has(e)||n.set(e,new Taxonomy3);const a=n.get(e);a.has(r)||a.set(r,new WeightedPages);const i=await t.siteWeightedPage(s);a.get(r).push(i)}),n}catch(e){throw log39.error(`Failed to create taxonomies: ${e}`),e}}}}}),require_extend=(cb={"node_modules/extend/index.js"(e,t){var n=Object.prototype.hasOwnProperty,r=Object.prototype.toString,s=Object.defineProperty,a=Object.getOwnPropertyDescriptor,i=function(e){return"function"==typeof Array.isArray?Array.isArray(e):"[object Array]"===r.call(e)},o=function(e){if(!e||"[object Object]"!==r.call(e))return!1;var t,s=n.call(e,"constructor"),a=e.constructor&&e.constructor.prototype&&n.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!s&&!a)return!1;for(t in e);return void 0===t||n.call(e,t)},l=function(e,t){s&&"__proto__"===t.name?s(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},c=function(e,t){if("__proto__"===t){if(!n.call(e,t))return;if(a)return a(e,t).value}return e[t]};t.exports=function e(){var t,n,r,s,a,u,h=arguments[0],d=1,p=arguments.length,g=!1;for("boolean"==typeof h&&(g=h,h=arguments[1]||{},d=2),(null==h||"object"!=typeof h&&"function"!=typeof h)&&(h={});d<p;++d)if(null!=(t=arguments[d]))for(n in t)r=c(h,n),h!==(s=c(t,n))&&(g&&s&&(o(s)||(a=i(s)))?(a?(a=!1,u=r&&i(r)?r:[]):u=r&&o(r)?r:{},l(h,{name:n,newValue:e(g,u,s)})):void 0!==s&&l(h,{name:n,newValue:s}));return h}}},function(){return mod||(0,cb[__getOwnPropNames(cb)[0]])((mod={exports:{}}).exports,mod),mod.exports}),foundry_exports={};__export(foundry_exports,{AutoIDGenerator:()=>AutoIDGenerator,IncrementalBuildCoordinator:()=>IncrementalBuildCoordinator,generateStaticSite:()=>generateStaticSite,processSSG:()=>processSSG,processSSGParallel:()=>processSSGParallel,processSSGWithProgress:()=>processSSGWithProgress,startIncrementalBuild:()=>startIncrementalBuild}),module.exports=__toCommonJS(foundry_exports);var ConfigError=class extends Error{constructor(e,t){super(e),this.code=t,this.name="ConfigError"}},Config=(new ConfigError("configuration not found","CONFIG_NOT_FOUND"),new ConfigError("invalid configuration","INVALID_CONFIG"),new ConfigError("workspace not found","WORKSPACE_NOT_FOUND"),new ConfigError("configuration file not found","CONFIG_FILE_NOT_FOUND"),new ConfigError("invalid configuration format","INVALID_CONFIG_FORMAT"),class{configSourceFs;provider;root;dir;module;service;social;language;taxonomy;markdown;constructor(e,t,n,r,s,a,i,o,l,c){this.configSourceFs=e,this.provider=t,this.root=n,this.dir=r,this.module=s,this.service=a,this.social=i,this.language=o,this.taxonomy=l,this.markdown=c}fs(){return this.configSourceFs}getProvider(){return this.provider}theme(){return this.root.defaultTheme()}getDir(){return this.dir}getRoot(){return this.root}getModule(){return this.module}getService(){return this.service}getSocial(){return this.social}getLanguage(){return this.language}getTaxonomy(){return this.taxonomy}getMarkdown(){return this.markdown}setLanguage(e){this.language=e}setTaxonomy(e){this.taxonomy=e}setMarkdown(e){this.markdown=e}validate(){let e=!0;return this.language&&(e=e&&this.language.validate()),this.markdown&&(e=e&&this.markdown.validate()),e}}),DefaultRootConfig={baseURL:"",title:"",theme:[],timeout:"30s",contentDir:"content",dataDir:"data",layoutDir:"layouts",staticDir:"static",archetypeDir:"archetypes",assetDir:"assets",publishDir:"public",buildDrafts:!1,buildExpired:!1,buildFuture:!1,copyright:"",defaultContentLanguage:"en",defaultContentLanguageInSubdir:!1,disableAliases:!1,disablePathToLower:!1,disableKinds:[],disableLanguages:[],renderSegments:[],disableHugoGeneratorInject:!1,disableLiveReload:!1,enableEmoji:!1},Root=class{rootConfig;rootParams;constructor(e,t={}){this.rootConfig=e,this.rootParams=t}defaultTheme(){return this.rootConfig.theme.length>0?this.rootConfig.theme[0]:""}compiledTimeout(){const e=this.rootConfig.timeout;if(/^\d+$/.test(e))return 1e3*parseInt(e,10);const t=e.match(/^(\d+)([smh])$/);if(t){const e=parseInt(t[1],10);switch(t[2]){case"s":return 1e3*e;case"m":return 60*e*1e3;case"h":return 60*e*60*1e3}}return 3e4}baseUrl(){return this.rootConfig.baseURL}configParams(){return this.rootParams}siteTitle(){return this.rootConfig.title}getRootConfig(){return this.rootConfig}getThemes(){return this.rootConfig.theme}getDefaultContentLanguage(){return this.rootConfig.defaultContentLanguage}shouldBuildDrafts(){return this.rootConfig.buildDrafts}shouldBuildFuture(){return this.rootConfig.buildFuture}shouldBuildExpired(){return this.rootConfig.buildExpired}};var Module=class{moduleConfig;constructor(e){this.moduleConfig=e}importPaths(){return this.moduleConfig.imports.map(e=>e.path)}getModuleConfig(){return this.moduleConfig}getImports(){return this.moduleConfig.imports}getMounts(){return this.moduleConfig.mounts}importCount(){return this.moduleConfig.imports.length}mountCount(){return this.moduleConfig.mounts.length}hasImports(){return this.moduleConfig.imports.length>0}hasMounts(){return this.moduleConfig.mounts.length>0}findImport(e){return this.moduleConfig.imports.find(t=>t.path===e)}findMount(e){return this.moduleConfig.mounts.find(t=>t.source===e)}};var DefaultServiceConfig={disqus:{disable:!1,shortname:""},googleAnalytics:{disable:!1,respectDoNotTrack:!1,id:""},rss:{limit:0},x:{respectDoNotTrack:!1,disableInlineCSS:!1}},Service=class{serviceConfig;constructor(e){this.serviceConfig=e}isGoogleAnalyticsEnabled(){return!this.serviceConfig.googleAnalytics.disable}googleAnalyticsID(){return this.serviceConfig.googleAnalytics.id}isGoogleAnalyticsRespectDoNotTrack(){return this.serviceConfig.googleAnalytics.respectDoNotTrack}isDisqusEnabled(){return!this.serviceConfig.disqus.disable}disqusShortname(){return this.serviceConfig.disqus.shortname}isXRespectDoNotTrack(){return this.serviceConfig.x.respectDoNotTrack}isXDisableInlineCSS(){return this.serviceConfig.x.disableInlineCSS}rssLimit(){return this.serviceConfig.rss.limit}getServiceConfig(){return this.serviceConfig}getGoogleAnalytics(){return this.serviceConfig.googleAnalytics}getDisqus(){return this.serviceConfig.disqus}getRSS(){return this.serviceConfig.rss}hasEnabledServices(){return this.isGoogleAnalyticsEnabled()||this.isDisqusEnabled()}};init_lang();var DefaultLanguageConfig={languageCode:"en",languageName:"English",title:"",weight:0,contentDir:"content",disabled:!1,params:{}},Language=class{defaultLang;configs;indices;constructor(e){this.configs=e,this.defaultLang=this.calculateDefaultLanguage(),this.indices=[],this.setIndices()}calculateDefaultLanguage(){if(0===Object.keys(this.configs).length)return"en";let e="",t=Number.MAX_SAFE_INTEGER;for(const[n,r]of Object.entries(this.configs))r.weight<t&&(t=r.weight,e=n);return e||Object.keys(this.configs)[0]}languages(){return Object.values(this.configs)}defaultLanguage(){return this.defaultLang}isLanguageValid(e){return Object.prototype.hasOwnProperty.call(this.configs,e)}otherLanguageKeys(){return Object.keys(this.configs).filter(e=>e!==this.defaultLang)}getRelDir(e,t){const n=this.configs[t];if(!n)throw new Error(`Language "${t}" not found`);return n.contentDir||"content"}validate(){return e=this.configs,t=this.defaultLang,Object.prototype.hasOwnProperty.call(e,t);var e,t}setIndices(){const e=[];this.configs[this.defaultLang]&&e.push(this.defaultLang);for(const t of Object.keys(this.configs))t!==this.defaultLang&&e.push(t);this.indices=e}languageKeys(){return[...this.indices]}languageIndexes(){return this.indices.map((e,t)=>t)}getLanguageIndex(e){const t=this.indices.indexOf(e);if(-1===t)throw new Error("Language not found in indices");return t}getLanguageByIndex(e){if(e<0||e>=this.indices.length)throw new Error("Language index out of range");return this.indices[e]}getLanguageName(e){const t=this.configs[e];return t?t.languageName:""}getLanguageConfig(e){return this.configs[e]}getConfigs(){return this.configs}};var DefaultTaxonomies={tag:"tags",category:"categories"};function cleanTreeKey(...e){let t="";return e.length>0&&(t=e[0],e.length>1&&(t=e.join("/"))),t=t.replace(/^[.\s/]+|[.\s/]+$/g,""),t=t.toLowerCase(),t=t.replace(/\\/g,"/"),""===t||"/"===t?"":(t.startsWith("/")||(t="/"+t),t)}var Taxonomy=class{taxonomies;views;viewsByTreeKey;constructor(e){this.taxonomies=e,this.views=[],this.viewsByTreeKey={},this.setupViews()}getViews(){return[...this.views]}getTaxonomies(){return{...this.taxonomies}}getViewByTreeKey(e){return this.viewsByTreeKey[e]}hasTaxonomy(e){return Object.prototype.hasOwnProperty.call(this.taxonomies,e)}getPluralForm(e){return this.taxonomies[e]}getSingularForm(e){for(const[t,n]of Object.entries(this.taxonomies))if(n===e)return t}getSingularForms(){return Object.keys(this.taxonomies)}getPluralForms(){return Object.values(this.taxonomies)}setupViews(){this.views=function(e){const t=[];for(const[n,r]of Object.entries(e))t.push({singular:n,plural:r,pluralTreeKey:cleanTreeKey(r)});return t.sort((e,t)=>e.plural.localeCompare(t.plural)),t}(this.taxonomies),this.viewsByTreeKey={};for(const e of this.views)this.viewsByTreeKey[e.pluralTreeKey]=e}getViewCount(){return this.views.length}isEmpty(){return 0===Object.keys(this.taxonomies).length}};function newTaxonomy(e){const t=function(e){if(e.taxonomies&&"object"==typeof e.taxonomies){const t={};for(const[n,r]of Object.entries(e.taxonomies))"string"==typeof r&&(t[n]=r);return t}return{...DefaultTaxonomies}}(e);return new Taxonomy(t)}var DefaultSocialPlatformTemplates=[{id:"email",title:"Email me"},{id:"facebook",title:"Facebook"},{id:"github",title:"GitHub"},{id:"gitlab",title:"GitLab"},{id:"bitbucket",title:"Bitbucket"},{id:"twitter",title:"Twitter"},{id:"slack",title:"Slack"},{id:"reddit",title:"Reddit"},{id:"linkedin",title:"LinkedIn"},{id:"xing",title:"Xing"},{id:"stackoverflow",title:"StackOverflow"},{id:"snapchat",title:"Snapchat"},{id:"instagram",title:"Instagram"},{id:"youtube",title:"Youtube"},{id:"soundcloud",title:"SoundCloud"},{id:"spotify",title:"Spotify"},{id:"bandcamp",title:"Bandcamp"},{id:"itchio",title:"Itch.io"},{id:"keybase",title:"Keybase"},{id:"vk",title:"VK"},{id:"paypal",title:"PayPal"},{id:"telegram",title:"Telegram"},{id:"500px",title:"500px"},{id:"codepen",title:"CodePen"},{id:"kaggle",title:"kaggle"},{id:"mastodon",title:"Mastodon"},{id:"weibo",title:"Weibo"},{id:"medium",title:"Medium"},{id:"discord",title:"Discord"},{id:"strava",title:"Strava"},{id:"steam",title:"Steam"},{id:"quora",title:"Quora"},{id:"amazonwishlist",title:"Amazon Wishlist"},{id:"slideshare",title:"Slideshare"},{id:"angellist",title:"AngelList"},{id:"about",title:"About"},{id:"lastfm",title:"Last.fm"},{id:"bluesky",title:"Bluesky"},{id:"goodreads",title:"Goodreads"}],Social=class{socialConfig;constructor(e){this.socialConfig=e}getUserConfig(){return this.socialConfig.userConfig}getPlatformTemplates(){return this.socialConfig.platformTemplates}getPlatformTemplate(e){return t=e,DefaultSocialPlatformTemplates.find(e=>e.id===t);var t}isPlatformConfigured(e){return e in this.socialConfig.userConfig}getConfiguredPlatforms(){return Object.keys(this.socialConfig.userConfig)}getProcessedSocialLinks(){const e=[];for(const[t,n]of Object.entries(this.socialConfig.userConfig)){const r=this.getPlatformTemplate(t);r?e.push({id:t,title:r.title,url:n.link}):e.push({id:t,title:t.charAt(0).toUpperCase()+t.slice(1),url:n.link})}return e}getSocialLink(e){const t=this.socialConfig.userConfig[e];if(!t)return;const n=this.getPlatformTemplate(e);return n?{id:e,title:n.title,url:t.link}:{id:e,title:e.charAt(0).toUpperCase()+e.slice(1),url:t.link}}hasSocialLinks(){return Object.keys(this.socialConfig.userConfig).length>0}getSocialLinkCount(){return Object.keys(this.socialConfig.userConfig).length}getAvailablePlatforms(){return this.socialConfig.platformTemplates.map(e=>e.id)}getSocialConfig(){return this.socialConfig}};var DefaultMarkdownConfig={useInternalRenderer:!1,plugins:{wikilink:!0,tag:!0,callout:!0,latex:!0,mermaid:!0}},Markdown=class{markdownConfig;constructor(e){this.markdownConfig=e}useInternalRenderer(){return this.markdownConfig.useInternalRenderer}isWikilinkEnabled(){return this.markdownConfig.plugins.wikilink}isTagEnabled(){return this.markdownConfig.plugins.tag}isCalloutEnabled(){return this.markdownConfig.plugins.callout}isLatexEnabled(){return this.markdownConfig.plugins.latex}isMermaidEnabled(){return this.markdownConfig.plugins.mermaid}getMarkdownConfig(){return this.markdownConfig}getPlugins(){return this.markdownConfig.plugins}hasEnabledPlugins(){const e=this.markdownConfig.plugins;return e.wikilink||e.tag||e.callout||e.latex||e.mermaid}validate(){return!this.markdownConfig.useInternalRenderer||this.hasEnabledPlugins()}};var import_path=__toESM(require("path")),DEFAULT_PUBLISH_DIR="public",Dir=class{workingDir;themesDir;publishDir;constructor(e,t,n=DEFAULT_PUBLISH_DIR){this.workingDir=e,this.themesDir=t,this.publishDir=n}getWorkingDir(){return import_path.default.resolve(this.workingDir)}getThemesDir(){return import_path.default.resolve(this.themesDir)}getThemesCacheDir(){return import_path.default.resolve(this.themesDir,".cache")}getPublishDir(){return import_path.default.resolve(this.publishDir)}},DefaultConfigProvider=class{root;keyCache;constructor(e={}){this.root=this.prepareParams(e),this.keyCache=new Map}prepareParams(e){const t={};for(const[n,r]of Object.entries(e))t[n.toLowerCase()]=r;return t}getNestedKeyAndMap(e,t){let n;this.keyCache.has(e)?n=this.keyCache.get(e):(n=e.split("."),this.keyCache.set(e,n));let r=this.root;for(let e=0;e<n.length-1;e++){const s=n[e];if(!(s in r)){if(!t)return["",null];r[s]={}}const a=r[s];if("object"!=typeof a||null===a)return["",null];r=a}return[n[n.length-1],r]}getString(e){const t=this.get(e);return String(t||"")}getInt(e){const t=this.get(e),n=Number(t);return isNaN(n)?0:Math.floor(n)}getBool(e){const t=this.get(e);return"boolean"==typeof t?t:"string"==typeof t?"true"===t.toLowerCase():Boolean(t)}getParams(e){const t=this.get(e);return t&&"object"==typeof t?t:{}}getStringMap(e){const t=this.get(e);return t&&"object"==typeof t?t:{}}getStringMapString(e){const t=this.get(e);if(t&&"object"==typeof t){const e={};for(const[n,r]of Object.entries(t))e[n]=String(r);return e}return{}}getStringSlice(e){const t=this.get(e);return Array.isArray(t)?t.map(e=>String(e)):[]}get(e){if(""===e)return this.root;const[t,n]=this.getNestedKeyAndMap(e.toLowerCase(),!1);return null!==n?n[t]:void 0}set(e,t){const n=e.toLowerCase();if(""===n)return void(t&&"object"==typeof t?Object.assign(this.root,this.prepareParams(t)):this.root[n]=t);const[r,s]=this.getNestedKeyAndMap(n,!0);null!==s&&(r in s&&"object"==typeof s[r]&&"object"==typeof t&&null!==t?Object.assign(s[r],t):s[r]=t)}keys(){return Object.keys(this.root)}merge(e,t){const n=e.toLowerCase();if(""===n)return void(t&&"object"==typeof t&&Object.assign(this.root,this.prepareParams(t)));const[r,s]=this.getNestedKeyAndMap(n,!0);null!==s&&(r in s&&"object"==typeof s[r]&&"object"==typeof t&&null!==t?Object.assign(s[r],t):s[r]=t)}setDefaults(e){const t=this.prepareParams(e);for(const[e,n]of Object.entries(t))e in this.root||(this.root[e]=n)}setDefaultMergeStrategy(){}walkParams(e){const t=n=>{if(n&&"object"==typeof n&&!Array.isArray(n)){if(e(n))return!0;for(const e of Object.values(n))if(t(e))return!0}return!1};t(this.root)}isSet(e){const[t,n]=this.getNestedKeyAndMap(e.toLowerCase(),!1);return null!==n&&t in n}},path2=__toESM(require("path")),ConfigLoader=class{cfg;sourceDescriptor;baseDirs;constructor(e,t){this.cfg=new DefaultConfigProvider,this.sourceDescriptor=e,this.baseDirs=t}async loadConfigByDefault(){const e=this.sourceDescriptor.filename();if(await this.loadProvider(e),this.applyDefaultConfig(),this.cfg.setDefaultMergeStrategy(),!this.cfg.isSet("languages")){const e=this.cfg.getString("defaultContentLanguage");this.cfg.set("languages",{[e]:{}})}return this.cfg}deleteMergeStrategies(){this.cfg.walkParams(e=>!1)}async loadProvider(e){const t=this.baseDirs.workingDir;let n;n=path2.isAbsolute(e)?e:path2.join(t,e);let r="";if(""!==path2.extname(e)&&await this.fileExists(n)&&(r=n),""===r)throw new Error("Unable to locate config file or config directory.");const s=await this.loadConfigFromFile(r);this.cfg.set("",s)}applyDefaultConfig(){this.cfg.setDefaults({baseURL:"",cleanDestinationDir:!1,watch:!1,contentDir:"content",resourceDir:"resources",publishDir:"public",publishDirOrig:"public",themesDir:"themes",assetDir:"assets",layoutDir:"layouts",i18nDir:"i18n",dataDir:"data",archetypeDir:"archetypes",configDir:"config",staticDir:"static",buildDrafts:!1,buildFuture:!1,buildExpired:!1,params:{},environment:"production",uglyURLs:!1,verbose:!1,ignoreCache:!1,canonifyURLs:!1,relativeURLs:!1,removePathAccents:!1,titleCaseStyle:"AP",taxonomies:{tag:"tags",category:"categories"},permalinks:{},sitemap:{priority:-1,filename:"sitemap.xml"},menus:{},disableLiveReload:!1,pluralizeListTitles:!0,capitalizeListTitles:!0,forceSyncStatic:!1,footnoteAnchorPrefix:"",footnoteReturnLinkContents:"",newContentEditor:"",paginate:10,paginatePath:"page",summaryLength:70,rssLimit:-1,sectionPagesMenu:"",disablePathToLower:!1,hasCJKLanguage:!1,enableEmoji:!1,defaultContentLanguage:"en",defaultContentLanguageInSubdir:!1,enableMissingTranslationPlaceholders:!1,enableGitInfo:!1,ignoreFiles:[],disableAliases:!1,debug:!1,disableFastRender:!1,timeout:"30s",timeZone:"",enableInlineShortcodes:!1})}async fileExists(e){try{const t=this.sourceDescriptor.fs();return!(await t.stat(e)).isDir()}catch{return!1}}async loadConfigFromFile(e){const t=this.sourceDescriptor.fs(),n=await t.open(e);try{const e=new Uint8Array(1048576),{bytesRead:t}=await n.read(e),r=(new TextDecoder).decode(e.slice(0,t));try{return JSON.parse(r)}catch{return{}}}finally{await n.close()}}},ConfigSourceDescriptor=class{fileSystem;configFilename;constructor(e,t){this.fileSystem=e,this.configFilename=t}fs(){return this.fileSystem}filename(){return this.configFilename}},path3=__toESM(require("path"));async function loadConfigWithParams(e,t,n,r,s={}){const a={workingDir:path3.resolve(n),modulesDir:path3.resolve(r),publishDir:path3.resolve(DEFAULT_PUBLISH_DIR),cacheDir:""};a.cacheDir=await async function(e,t){if(""!==t)return t;const n=process.env.HOME||process.env.USERPROFILE||"",r=path3.join(n,".cache","mdf");try{return await e.mkdirAll(r,493),r}catch{return path3.join("/tmp","hugo-cache")}}(e,a.cacheDir);const i=new ConfigLoader(function(e,t){return new ConfigSourceDescriptor(e,t)}(e,t),a);try{const t=await i.loadConfigByDefault();for(const[e,n]of Object.entries(s))t.set(e,n);const n=path3.resolve(t.get("publishDir")||DEFAULT_PUBLISH_DIR);return await e.mkdirAll(n,511),function(e,t,n,r,s,a,i,o,l,c){return new Config(e,t,n,r,s,a,i,o,l,c)}(e,t,function(e,t={}){const n=function(e){return{baseURL:e.baseurl||DefaultRootConfig.baseURL,title:e.title||DefaultRootConfig.title,theme:e.theme||DefaultRootConfig.theme,timeout:e.timeout||DefaultRootConfig.timeout,contentDir:e.contentDir||DefaultRootConfig.contentDir,dataDir:e.dataDir||DefaultRootConfig.dataDir,layoutDir:e.layoutDir||DefaultRootConfig.layoutDir,staticDir:e.staticDir||DefaultRootConfig.staticDir,archetypeDir:e.archetypeDir||DefaultRootConfig.archetypeDir,assetDir:e.assetDir||DefaultRootConfig.assetDir,publishDir:e.publishDir||DefaultRootConfig.publishDir,buildDrafts:void 0!==e.buildDrafts?e.buildDrafts:DefaultRootConfig.buildDrafts,buildExpired:void 0!==e.buildExpired?e.buildExpired:DefaultRootConfig.buildExpired,buildFuture:void 0!==e.buildFuture?e.buildFuture:DefaultRootConfig.buildFuture,copyright:e.copyright||DefaultRootConfig.copyright,defaultContentLanguage:e.defaultContentLanguage||DefaultRootConfig.defaultContentLanguage,defaultContentLanguageInSubdir:void 0!==e.defaultContentLanguageInSubdir?e.defaultContentLanguageInSubdir:DefaultRootConfig.defaultContentLanguageInSubdir,disableAliases:void 0!==e.disableAliases?e.disableAliases:DefaultRootConfig.disableAliases,disablePathToLower:void 0!==e.disablePathToLower?e.disablePathToLower:DefaultRootConfig.disablePathToLower,disableKinds:e.disableKinds||DefaultRootConfig.disableKinds,disableLanguages:e.disableLanguages||DefaultRootConfig.disableLanguages,renderSegments:e.renderSegments||DefaultRootConfig.renderSegments,disableHugoGeneratorInject:void 0!==e.disableHugoGeneratorInject?e.disableHugoGeneratorInject:DefaultRootConfig.disableHugoGeneratorInject,disableLiveReload:void 0!==e.disableLiveReload?e.disableLiveReload:DefaultRootConfig.disableLiveReload,enableEmoji:void 0!==e.enableEmoji?e.enableEmoji:DefaultRootConfig.enableEmoji}}(e);return new Root(n,t)}(t.get(""),t.getParams("params")),function(e,t,n){return new Dir(e,t,n)}(a.workingDir,a.modulesDir,n),function(e){const t=function(e){const t={mounts:[],imports:[]};return e.mounts&&Array.isArray(e.mounts)&&(t.mounts=e.mounts.map(e=>({source:e.source||"",target:e.target||"",lang:e.lang}))),e.imports&&Array.isArray(e.imports)&&(t.imports=e.imports.map(e=>({path:e.path||"",url:e.url,version:e.version,mounts:e.mounts||[]}))),t}(e);return new Module(t)}(t.get("module")||{}),function(e){const t=function(e){const t={disqus:{...DefaultServiceConfig.disqus},googleAnalytics:{...DefaultServiceConfig.googleAnalytics},rss:{...DefaultServiceConfig.rss},x:{...DefaultServiceConfig.x}};return e&&(e.disqus&&(t.disqus.shortname=e.disqus.shortname||t.disqus.shortname),e.googleAnalytics&&(t.googleAnalytics.id=e.googleAnalytics.id||t.googleAnalytics.id),e.rss&&(t.rss.limit=void 0!==e.rss.limit?e.rss.limit:t.rss.limit)),t}(e);return new Service(t)}(t.get("services")),function(e){const t=function(e){const t={userConfig:{},platformTemplates:[...DefaultSocialPlatformTemplates]};if(e&&"object"==typeof e)for(const[n,r]of Object.entries(e))if(r&&"object"==typeof r){const e=r;e.link&&(t.userConfig[n]={link:e.link})}return t}(e);return new Social(t)}(t.get("social")),function(e){const t=function(e){const t={};if(!e||0===Object.keys(e).length)return t.en={...DefaultLanguageConfig,title:e?.title||DefaultLanguageConfig.title,params:e?.params||DefaultLanguageConfig.params},t;for(const[n,r]of Object.entries(e)){const s=r,a=languages.getNameByCode(n)||n;t[n]={languageCode:n,languageName:a,title:s.title||e.title||"",weight:void 0!==s.weight?s.weight:0,contentDir:s.contentDir||"content",disabled:void 0!==s.disabled&&s.disabled,params:s.params||e.params||{}}}return t}(e);return new Language(t)}(t.get("languages")),t.isSet("taxonomies")?newTaxonomy(t.get("taxonomies")):newTaxonomy(t.get("")),function(e){const t=function(e){const t={useInternalRenderer:DefaultMarkdownConfig.useInternalRenderer,plugins:{...DefaultMarkdownConfig.plugins}};return e&&(void 0!==e.useInternalRenderer&&(t.useInternalRenderer=Boolean(e.useInternalRenderer)),e.plugins&&(void 0!==e.plugins.wikilink&&(t.plugins.wikilink=Boolean(e.plugins.wikilink)),void 0!==e.plugins.tag&&(t.plugins.tag=Boolean(e.plugins.tag)),void 0!==e.plugins.callout&&(t.plugins.callout=Boolean(e.plugins.callout)),void 0!==e.plugins.latex&&(t.plugins.latex=Boolean(e.plugins.latex)),void 0!==e.plugins.mermaid&&(t.plugins.mermaid=Boolean(e.plugins.mermaid)))),t}(e);return new Markdown(t)}(t.get("markdown")))}finally{i.deleteMergeStrategies()}}var ComponentFolders=["workflows","prompts","content","layouts","static","assets","i18n"],ModuleError=class extends Error{constructor(e,t){super(e),this.code=t,this.name="ModuleError"}},path4=(new ModuleError("module not found","MODULE_NOT_FOUND"),new ModuleError("download failed","DOWNLOAD_FAILED"),new ModuleError("invalid zip file","INVALID_ZIP"),new ModuleError("mount failed","MOUNT_FAILED"),__toESM(require("path"))),Mount=class e{constructor(e,t,n=""){this.sourcePath=e,this.targetPath=t,this.language=n}source(){return this.sourcePath}target(){return this.targetPath}lang(){return this.language}setLanguage(e){this.language=e}component(){return this.targetPath.split(path4.sep)[0]||""}componentAndName(){const e=this.targetPath.split(path4.sep);return{component:e[0]||"",name:e.slice(1).join(path4.sep)}}copy(){return new e(this.sourcePath,this.targetPath,this.language)}equals(e){return this.sourcePath===e.sourcePath&&this.targetPath===e.targetPath&&this.language===e.language}toConfig(){const e={sourcePath:this.sourcePath,targetPath:this.targetPath};return this.language&&(e.language=this.language),e}toString(){return`${this.sourcePath} -> ${this.targetPath} (${this.language})`}},path5=__toESM(require("path")),http=__toESM(require("http")),https=__toESM(require("https"));init_log();var log=getDomainLogger("module",{component:"httpclient"}),NodeHttpClient=class{constructor(e,t=3e4,n={}){this.fs=e,this.timeout=t,this.headers=n}defaultTimeout=3e4;defaultHeaders={"User-Agent":"MDFriday-CLI/1.0.0"};async download(e,t,n){return new Promise((r,s)=>{try{const a=new URL(e),i="https:"===a.protocol,o=i?https:http,l={...this.defaultHeaders,...this.headers,...n?.headers},c={hostname:a.hostname,port:a.port||(i?443:80),path:a.pathname+a.search,method:"GET",headers:l,timeout:n?.timeout||this.timeout},u=o.request(c,async e=>{if(!e.statusCode||e.statusCode<200||e.statusCode>=300)return void s(new ModuleError(`HTTP ${e.statusCode}: ${e.statusMessage}`,"HTTP_ERROR"));const a=parseInt(e.headers["content-length"]||"0",10);let i=0,o=Date.now(),l=-1;try{const c=path5.dirname(t);await this.fs.mkdirAll(c,493);const u=await this.fs.create(t),h=[];e.on("data",e=>{if(h.push(e),i+=e.length,n?.onProgress&&a>0){const e=Date.now(),t=Math.round(i/a*100);if(e-o>=100&&t!==l||t-l>=5){const r={loaded:i,total:a,percentage:t};try{n.onProgress(r),l=t}catch(e){log.error(`Progress callback error: ${e}`)}o=e}}}),e.on("end",async()=>{try{const e=Buffer.concat(h),t=new Uint8Array(e);if(await u.write(t),await u.sync(),await u.close(),n?.onProgress&&a>0){const e={loaded:a,total:a,percentage:100};try{n.onProgress(e)}catch(e){log.warn(`Progress callback error: ${e}`)}}r()}catch(e){const t=e instanceof Error?e.message:String(e);s(new ModuleError(`File write failed: ${t}`,"WRITE_FAILED"))}}),e.on("error",e=>{log.error(`Response error: ${e.message}`),s(new ModuleError(`Download failed: ${e.message}`,"DOWNLOAD_FAILED"))})}catch(e){const t=e instanceof Error?e.message:String(e);s(new ModuleError(`File system error: ${t}`,"FS_ERROR"))}});u.on("error",e=>{log.error("Request error:",e),s(new ModuleError(`Request failed: ${e.message}`,"REQUEST_FAILED"))}),u.on("timeout",()=>{u.destroy(),log.error(`Request timeout for ${e}`),s(new ModuleError("Request timeout","TIMEOUT"))}),u.end()}catch(e){const t=e instanceof Error?e.message:String(e);s(new ModuleError(`Download failed: ${t}`,"DOWNLOAD_FAILED"))}})}async get(e,t){return new Promise((n,r)=>{try{const s=new URL(e),a="https:"===s.protocol,i=a?https:http,o={...this.defaultHeaders,...this.headers,...t?.headers},l={hostname:s.hostname,port:s.port||(a?443:80),path:s.pathname+s.search,method:"GET",headers:o,timeout:t?.timeout||this.timeout},c=i.request(l,e=>{const t=[],s={};Object.entries(e.headers).forEach(([e,t])=>{s[e]=Array.isArray(t)?t.join(", "):t||""}),e.on("data",e=>{t.push(e)}),e.on("end",()=>{const r=Buffer.concat(t),a=r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength);n({data:a,headers:s,status:e.statusCode||0})}),e.on("error",e=>{r(new ModuleError(`Response error: ${e.message}`,"RESPONSE_ERROR"))})});c.on("error",e=>{r(new ModuleError(`GET request failed: ${e.message}`,"REQUEST_FAILED"))}),c.on("timeout",()=>{c.destroy(),r(new ModuleError("GET request timeout","TIMEOUT"))}),c.end()}catch(e){const t=e instanceof Error?e.message:String(e);r(new ModuleError(`GET request failed: ${t}`,"REQUEST_FAILED"))}})}};function newHttpClient(e,t,n,r){return r||new NodeHttpClient(e,t,n)}init_log();var import_jszip=__toESM(require("jszip")),path6=__toESM(require("path")),log2=getDomainLogger("module",{component:"zipextractor"}),JsZipExtractor=class{constructor(e){this.fs=e}async extract(e,t){try{const n=await this.fs.open(e),r=(await n.stat()).size(),s=new Uint8Array(r),a=await n.read(s);await n.close(),await this.extractZipData(a.buffer,t)}catch(t){const n=t instanceof Error?t.message:String(t);throw log2.error(`ZIP extraction failed for ${e}: ${n}`),new ModuleError(`ZIP extraction failed: ${n}`,"EXTRACTION_FAILED")}}async list(e){try{const t=await this.fs.open(e),n=await t.stat(),r=new Uint8Array(n.size()),s=await t.read(r);return await t.close(),await this.listZipContents(s.buffer)}catch(e){const t=e instanceof Error?e.message:String(e);throw new ModuleError(`ZIP listing failed: ${t}`,"LIST_FAILED")}}async extractZipData(e,t){try{await this.fs.mkdirAll(t,493);const n=new import_jszip.default,r=await n.loadAsync(e),s=[];r.forEach((e,t)=>{t.dir||s.push(e)});const a=[];let i=0;r.forEach((e,n)=>{a.push(this.extractSingleEntry(e,n,t).then(()=>{i++}))}),await Promise.all(a)}catch(e){const t=e instanceof Error?e.message:String(e);throw log2.error(`Failed to extract ZIP data: ${t}`),new ModuleError(`Failed to extract ZIP data: ${t}`,"EXTRACTION_FAILED")}}async extractSingleEntry(e,t,n){const r=path6.join(n,e);if(t.dir)await this.fs.mkdirAll(r,493);else{const e=path6.dirname(r);e!==n&&await this.fs.mkdirAll(e,493);const s=await t.async("uint8array"),a=await this.fs.create(r);await a.write(s),await a.close()}}async listZipContents(e){try{const t=new import_jszip.default,n=await t.loadAsync(e),r=[];return n.forEach(e=>{r.push(e)}),r}catch(e){const t=e instanceof Error?e.message:String(e);throw new ModuleError(`Failed to list ZIP contents: ${t}`,"LIST_FAILED")}}},WebZipExtractor=class{constructor(e){this.fs=e}async extract(e,t){try{throw new ModuleError("Web ZIP extraction not implemented","NOT_IMPLEMENTED")}catch(e){const t=e instanceof Error?e.message:String(e);throw new ModuleError(`Web ZIP extraction failed: ${t}`,"WEB_EXTRACTION_FAILED")}}async list(e){try{throw new ModuleError("Web ZIP listing not implemented","NOT_IMPLEMENTED")}catch(e){const t=e instanceof Error?e.message:String(e);throw new ModuleError(`Web ZIP listing failed: ${t}`,"WEB_LIST_FAILED")}}};function newZipExtractor(e,t="node"){switch(t){case"node":return new JsZipExtractor(e);case"browser":return new WebZipExtractor(e);default:throw new Error(`Unsupported environment: ${t}`)}}init_log();var path7=__toESM(require("path")),log3=getDomainLogger("module",{component:"cache"}),FsModuleCache=class{constructor(e,t="./module/cache"){this.fs=e,this.cacheDir=t}cacheDir;async get(e){try{const t=this.getCacheFilePath(e),n=await this.fs.open(t),r=await n.stat(),s=new Uint8Array(r.size());await n.read(s),await n.close();const a=(new TextDecoder).decode(s);return JSON.parse(a)}catch(t){if(t.message?.includes("ENOENT")||t.message?.includes("no such file"))return log3.error(`Cache miss: ${e}`,t),null;const n=t instanceof Error?t.message:String(t);throw log3.error(`Cache read error for ${e}: ${n}`),new ModuleError(`Failed to read cache: ${n}`,"CACHE_READ_FAILED")}}async set(e,t){try{await this.fs.mkdirAll(this.cacheDir,493);const n=this.getCacheFilePath(e),r=JSON.stringify(t,null,2),s=(new TextEncoder).encode(r),a=await this.fs.create(n);await a.write(s),await a.sync(),await a.close()}catch(t){const n=t instanceof Error?t.message:String(t);throw log3.error(`Cache write error for ${e}: ${n}`),new ModuleError(`Failed to write cache: ${n}`,"CACHE_WRITE_FAILED")}}async has(e){try{const t=this.getCacheFilePath(e);return await this.fs.stat(t),!0}catch(e){return!1}}async delete(e){try{const t=this.getCacheFilePath(e);await this.fs.remove(t)}catch(t){if(!t.message?.includes("ENOENT")&&!t.message?.includes("no such file")){const n=t instanceof Error?t.message:String(t);throw log3.error(`Cache delete error for ${e}: ${n}`),new ModuleError(`Failed to delete cache: ${n}`,"CACHE_DELETE_FAILED")}}}async clear(){try{await this.fs.removeAll(this.cacheDir)}catch(e){if(!e.message?.includes("ENOENT")&&!e.message?.includes("no such file")){const t=e instanceof Error?e.message:String(e);throw log3.error(`Cache clear error: ${t}`),new ModuleError(`Failed to clear cache: ${t}`,"CACHE_CLEAR_FAILED")}}}getCacheFilePath(e){const t=e.replace(/[/\\:*?"<>|]/g,"_").replace(/^_+|_+$/g,"")+".json";return path7.join(this.cacheDir,t)}getCacheDir(){return this.cacheDir}async getStats(){try{const e=await this.listCacheFiles();let t=0;for(const n of e)try{const e=path7.join(this.cacheDir,n);t+=(await this.fs.stat(e)).size()}catch(e){}return{totalEntries:e.length,totalSize:t}}catch(e){return{totalEntries:0,totalSize:0}}}async listCached(){try{return(await this.listCacheFiles()).map(e=>path7.basename(e,".json").replace(/_/g,"/"))}catch(e){return[]}}async listCacheFiles(){try{const e=await this.fs.open(this.cacheDir),t=await e.readdirnames(-1);return await e.close(),t.filter(e=>e.endsWith(".json"))}catch(e){return[]}}};function newModuleCache(e,t){return new FsModuleCache(e,t)}var path8=__toESM(require("path")),Module2=class e{constructor(e,t,n,r=null,s=!1){this.fs=e,this.absoluteDir=t,this.modulePath=n,this.parentModule=r,this.mountDirs=[],this.metadata=null,this.isProject=s}absoluteDir;modulePath;parentModule;mountDirs;metadata;isProject=!1;isProjectModule(){return this.isProject}owner(){return this.parentModule}mounts(){return this.mountDirs.map(e=>e)}dir(){return this.absoluteDir}path(){return this.modulePath}setMetadata(e){this.metadata=e}getMetadata(){return this.metadata}async applyMounts(e){try{let t=e.mounts||[];if(0===t.length)for(const e of ComponentFolders){const n=path8.join(this.absoluteDir,e);try{(await this.fs.stat(n)).isDir()&&t.push({sourcePath:e,targetPath:e})}catch(e){}}this.mountDirs=t.map(e=>{return t=e.sourcePath,n=e.targetPath,new Mount(t,n);var t,n})}catch(e){const t=e instanceof Error?e.message:String(e);throw new ModuleError(`Failed to apply mounts: ${t}`,"MOUNT_FAILED")}}appendMount(e){this.mountDirs.push(e)}removeMount(e){const t=this.mountDirs.findIndex(t=>t.equals(e));return t>=0&&(this.mountDirs.splice(t,1),!0)}getMountByTarget(e){return this.mountDirs.find(t=>t.target()===e)||null}getMountsByComponent(e){return this.mountDirs.filter(t=>t.component()===e)}isDownloaded(){return"completed"===this.metadata?.downloadStatus}isDownloading(){return"downloading"===this.metadata?.downloadStatus}isDownloadFailed(){return"failed"===this.metadata?.downloadStatus}async exists(){try{return(await this.fs.stat(this.absoluteDir)).isDir()}catch(e){return!1}}copy(){const t=new e(this.fs,this.absoluteDir,this.modulePath,this.parentModule,this.isProject);return t.mountDirs=this.mountDirs.map(e=>e.copy()),t.metadata=this.metadata?{...this.metadata}:null,t}toString(){return`Module{path: ${this.modulePath}, dir: ${this.absoluteDir}, mounts: ${this.mountDirs.length}}`}},ProjectModule=class{constructor(e){this.module=e}getModule(){return this.module}appendMount(e){this.module.appendMount(e)}setDefaultLanguage(e){const t=this.module.mounts();for(const n of t)n instanceof Mount&&n.setLanguage(e)}applyDefaultMounts(){const e=ComponentFolders.map(e=>new Mount(e,e));for(const t of e)this.module.appendMount(t)}owner(){return this.module.owner()}mounts(){return this.module.mounts()}dir(){return this.module.dir()}path(){return this.module.path()}};function newModule2(e,t,n,r){return new Module2(e,t,n,r||null,!1)}var import_path2=__toESM(require("path")),Lang=class{sourceLangMap;constructor(e){this.sourceLangMap=new Map;for(const t of e)for(const e of t.mounts())this.sourceLangMap.set(e.source(),e.lang())}getSourceLang(e){const t=this.sourceLangMap.get(import_path2.default.basename(e));return void 0!==t?[t,!0]:["",!1]}},Themes=class e{themes;constructor(e){this.themes=e}static fromJson(t){return new e(t)}findThemeByUrl(e){const t=this.extractBaseUrl(e);for(const e of this.themes)if(t===this.extractBaseUrl(e.download_url))return e;return null}resolveLatestVersion(e){const t=this.findThemeByUrl(e);return t?t.download_url:e}extractBaseUrl(e){try{const t=new URL(e);return t.searchParams.delete("version"),t.toString()}catch(t){const n=e.indexOf("?");if(-1===n)return e;const r=e.substring(0,n),s=new URLSearchParams(e.substring(n+1));s.delete("version");const a=s.toString();return a?`${r}?${a}`:r}}getAllThemes(){return[...this.themes]}getThemeByName(e){return this.themes.find(t=>t.name.toLowerCase()===e.toLowerCase())||null}getThemesByTag(e){return this.themes.filter(t=>t.tags.some(t=>t.toLowerCase()===e.toLowerCase()))}};init_log();var import_smol_toml=require("smol-toml"),path10=__toESM(require("path")),log4=getDomainLogger("module",{component:"modules"}),Modules=class{constructor(e,t,n,r){var s;this.info=e,this.httpClient=t,this.zipExtractor=n,this.moduleCache=r,this.projectModule=function(e){const t=e.osFs(),n=e.projDir(),r=e.defaultLanguageKey(),s=new Module2(t,n,"project-root",null,!0),a=new ProjectModule(s);a.applyDefaultMounts(),r&&a.setDefaultLanguage(r);const i=e.otherLanguageKeys();for(const t of i)try{const n=e.getRelDir("content",t);if(n&&""!==n){const e=new Mount(n,"content",t);a.appendMount(e)}}catch(e){console.warn(`Failed to get relative directory for language ${t}:`,e)}return a}(this.info),this.lang=(s=this.all(),new Lang(s))}projectModule;modules=[];downloadedModules=new Set;lang;themesCache=new Map;proj(){return this.projectModule.getModule()}all(){const e=[this.projectModule.getModule()];return e.push(...this.modules),e}isProjMod(e){return e===this.projectModule.getModule()}async load(e){const t=this.info.importPaths();if(0!==t.length)for(let n=0;n<t.length;n++){const r=t[n],{cleanUrl:s,version:a}=this.parseVersionFromImportPath(r);let i=r;"latest"===a&&(i=await this.resolveLatestVersion(r)),this.downloadedModules.has(i)?log4.info(`Module already downloaded: ${i}`):await this.addModule(this.projectModule.getModule(),i,t=>{e?.({modulePath:i,downloadPercentage:t.percentage})})}else log4.warn("No import paths configured - no modules will be downloaded")}parseVersionFromImportPath(e){try{const t=new URL(e),n=t.searchParams.get("version")||"latest";return t.searchParams.delete("version"),{cleanUrl:t.toString(),version:n}}catch(t){return log4.warn(`Failed to parse import path ${e}:`,t),{cleanUrl:e,version:"latest"}}}getThemeRegistryUrl(e){try{const t=new URL(e).hostname;return"sunwei.xyz"===t||"www.sunwei.xyz"===t?"https://sunwei.xyz/mdf/themes-zh.json":"https://gohugo.net/themes.json"}catch(t){return log4.warn(`Failed to parse import path ${e}, using default theme registry`),"https://gohugo.net/themes.json"}}async resolveLatestVersion(e){const{version:t}=this.parseVersionFromImportPath(e);if("latest"!==t)return e;try{const t=this.getThemeRegistryUrl(e);log4.info(`Fetching latest theme versions from ${t}...`);let n=this.themesCache.get(t);if(!n){const e=await this.httpClient.get(t),r=(new TextDecoder).decode(e.data),s=JSON.parse(r);n=Themes.fromJson(s),this.themesCache.set(t,n)}const r=n.resolveLatestVersion(e);return r!==e?log4.info(`Resolved latest version: ${e} -> ${r}`):log4.warn(`Could not resolve latest version for ${e}, using original path`),r}catch(t){return log4.error(`Failed to resolve latest version for ${e}:`,t),e}}async downloadModule(e,t){try{let n=e.version;if("latest"===e.version){const t=await this.resolveLatestVersion(e.path),{version:r}=this.parseVersionFromImportPath(t);n=r}const r=await this.moduleCache.get(e.path);if(r&&"completed"===r.downloadStatus&&this.isCacheValidForVersion(r.version,n)){const t=await this.createModuleFromCache(e,r);if(await t.exists())return log4.info(`Using cached module ${e.path} version ${r.version}`),t}r&&"completed"===r.downloadStatus&&!this.isCacheValidForVersion(r.version,n)&&log4.info(`Cache version mismatch for ${e.path}: cached=${r.version}, requested=${n||"latest"}`);const s=this.getModuleDir(e.path),a=path10.join(s,"module.zip"),i={path:e.path,version:e.version||"latest",url:e.url,dir:s,downloadStatus:"downloading",downloadedAt:new Date};await this.moduleCache.set(e.path,i);try{const n=this.addTimestampToUrl(e.url);await this.httpClient.download(n,a,{onProgress:e=>{t?.({percentage:e.percentage})}}),await this.zipExtractor.extract(a,s),i.downloadStatus="completed",i.downloadedAt=new Date;try{const e=await this.info.osFs().stat(a);i.size=e.size()}catch(e){}try{await this.info.osFs().remove(a)}catch(e){}await this.moduleCache.set(e.path,i);const r=newModule2(this.info.osFs(),s,e.path);return r.setMetadata(i),await r.applyMounts(e),r}catch(t){i.downloadStatus="failed",await this.moduleCache.set(e.path,i);const n=t instanceof Error?t.message:String(t);throw new ModuleError(`Failed to download module ${e.path}: ${n}`,"DOWNLOAD_FAILED")}}catch(e){if(e instanceof ModuleError)throw e;const t=e instanceof Error?e.message:String(e);throw new ModuleError(`Module download failed: ${t}`,"DOWNLOAD_FAILED")}}async addModule(e,t,n){try{if(this.downloadedModules.has(t))return;const{cleanUrl:e,version:r}=this.parseVersionFromImportPath(t),s={path:t,url:this.getDownloadUrl(e),...r&&{version:r}},a=await this.downloadModule(s,n);this.modules.push(a),this.downloadedModules.add(t);try{const e=await this.parseThemeToml(a);for(const t of e){if(this.downloadedModules.has(t)){log4.info(`Module ${t} already downloaded, skipping`);continue}log4.info(`Recursively downloading module dependency: ${t}`);const e=t,{cleanUrl:r,version:s}=this.parseVersionFromImportPath(e);let i=e;"latest"===s&&(i=await this.resolveLatestVersion(e)),await this.addModule(a,i,e=>{n?.({percentage:.5*e.percentage})})}}catch(e){const n=e instanceof Error?e.message:String(e);log4.warn(`Failed to process recursive imports for module ${t}: ${n}`)}}catch(e){const n=e instanceof Error?e.message:String(e);throw new ModuleError(`Failed to add module ${t}: ${n}`,"ADD_MODULE_FAILED")}}async createModuleFromCache(e,t){const n=newModule2(this.info.osFs(),t.dir,e.path);return n.setMetadata(t),await n.applyMounts(e),n}getModuleDir(e){const t=e.replace(/[/\\:*?"<>|]/g,"_").replace(/^_+|_+$/g,"");return path10.join(this.info.moduleDir(),t)}getDownloadUrl(e){return e}isCacheValidForVersion(e,t){return!t||e===t}addTimestampToUrl(e){try{const t=new URL(e),n=Date.now().toString();return t.searchParams.set("_t",n),t.toString()}catch(t){const n=e.includes("?")?"&":"?";return`${e}${n}_t=${Date.now()}`}}getModuleByPath(e){return this.modules.find(t=>t.path()===e)||null}isModuleDownloaded(e){return this.downloadedModules.has(e)}async getModuleStatus(e){const t=await this.moduleCache.get(e);return t?.downloadStatus||"pending"}async removeModule(e){try{const t=this.modules.findIndex(t=>t.path()===e);if(t>=0){const n=this.modules[t];try{await this.info.osFs().removeAll(n.dir())}catch(e){}this.modules.splice(t,1),this.downloadedModules.delete(e),await this.moduleCache.delete(e)}}catch(t){const n=t instanceof Error?t.message:String(t);throw new ModuleError(`Failed to remove module ${e}: ${n}`,"REMOVE_MODULE_FAILED")}}async clearAll(){try{for(const e of this.modules)try{await this.info.osFs().removeAll(e.dir())}catch(e){}this.modules=[],this.downloadedModules.clear(),await this.moduleCache.clear()}catch(e){const t=e instanceof Error?e.message:String(e);throw new ModuleError(`Failed to clear modules: ${t}`,"CLEAR_MODULES_FAILED")}}getSourceLang(e){return this.lang.getSourceLang(e)}async parseThemeToml(e){try{const t=path10.join(e.dir(),"theme.toml");try{if((await this.info.osFs().stat(t)).isDir())return[]}catch(e){return[]}let n;try{const e=await this.info.osFs().open(t);try{const t=[],r=new Uint8Array(4096);for(;;){const n=await e.read(r);if(0===n.bytesRead)break;t.push(r.slice(0,n.bytesRead))}const s=t.reduce((e,t)=>e+t.length,0),a=new Uint8Array(s);let i=0;for(const e of t)a.set(e,i),i+=e.length;n=new TextDecoder("utf-8").decode(a)}finally{await e.close()}}catch(t){const n=t instanceof Error?t.message:String(t);return log4.warn(`Failed to read theme.toml for module ${e.path()}: ${n}`),[]}const r=(0,import_smol_toml.parse)(n);return r.module?.imports?(log4.info(`Found ${r.module.imports.length} module imports in ${e.path()}/theme.toml`),r.module.imports.map(e=>e.path)):[]}catch(t){const n=t instanceof Error?t.message:String(t);return log4.warn(`Failed to parse theme.toml for module ${e.path()}: ${n}`),[]}}};function newModules(e,t,n,r){return new Modules(e,t,n,r)}init_log();var log5=getDomainLogger("module",{component:"factory"}),FsError=class extends Error{constructor(e,t){super(e),this.code=t,this.name="FsError"}},ErrFileClosed=new FsError("File is closed","FILE_CLOSED"),ErrFileNotFound=(new FsError("out of range","OUT_OF_RANGE"),new FsError("too large","TOO_LARGE"),new FsError("file not found","FILE_NOT_FOUND")),ErrSkipDir=(new FsError("file exists","FILE_EXISTS"),new FsError("destination exists","DESTINATION_EXISTS"),new Error("skip directory")),OverlayFsError=(new FsError("walkway already walked","ALREADY_WALKED"),class extends FsError{constructor(e,t){super(e,t),this.name="OverlayFsError"}}),ErrNoFilesystems=new OverlayFsError("no filesystems to write to","NO_FILESYSTEMS"),OriginFs=(new OverlayFsError("operation not supported","OPERATION_NOT_SUPPORTED"),class{source;origin;publishDir;constructor(e,t,n){this.source=e,this.origin=t,this.publishDir=n}getSource(){return this.source}getOrigin(){return this.origin}publish(){return this.publishDir}});init_log(),getDomainLogger("fs",{component:"filemeta"});var FileMeta=class{filename;componentRoot;componentDir;openFunc;constructor(e="",t=null){this.filename=e,this.componentRoot="",this.componentDir="",this.openFunc=t}fileName(){return this.filename}relativeFilename(){if(""===this.componentRoot)return this.filename;const e=this.filename.indexOf(this.componentRoot);if(-1===e)throw new Error(`filename ${this.filename} has no root ${this.componentRoot}`);let t=this.filename.substring(e+this.componentRoot.length);return t.startsWith("/")||(t="/"+t),t}component(){return this.componentDir}root(){return this.componentRoot}async open(){if(null===this.openFunc)throw new Error("OpenFunc not set");return await this.openFunc()}setFileName(e){this.filename=e}setComponentRoot(e){this.componentRoot=e}setComponentDir(e){this.componentDir=e}setOpenFunc(e){this.openFunc=e}merge(e){e&&(e.filename&&!this.filename&&(this.filename=e.filename),e.componentRoot&&!this.componentRoot&&(this.componentRoot=e.componentRoot),e.componentDir&&!this.componentDir&&(this.componentDir=e.componentDir),e.openFunc&&!this.openFunc&&(this.openFunc=e.openFunc))}};function newFileMeta(e,t){return new FileMeta(e,t)}var FileInfo=class{fileInfo;_fileMeta;constructor(e,t){this.fileInfo=e,this._fileMeta=t}meta(){return this._fileMeta}type(){return this.fileInfo.mode()}info(){return this.fileInfo}setMeta(e){this._fileMeta=e}name(){return this.fileInfo.name()}size(){return this.fileInfo.size()}mode(){return this.fileInfo.mode()}modTime(){return this.fileInfo.modTime()}isDir(){return this.fileInfo.isDir()}sys(){return this.fileInfo.sys()}fileName(){return this._fileMeta.fileName()}relativeFilename(){return this._fileMeta.relativeFilename()}component(){return this._fileMeta.component()}root(){return this._fileMeta.root()}async open(){return await this._fileMeta.open()}};function newFileInfo(e,t){const n=newFileMeta(t),r=new FileInfo(e,n);return isMetaProvider(e)&&r.meta().merge(e.meta()),r}function newFileInfoWithMeta(e,t){const n=new FileInfo(e,t);return isMetaProvider(e)&&n.meta().merge(e.meta()),n}function isMetaProvider(e){return e&&"function"==typeof e.meta}var path11=__toESM(require("path")),File=class{file;fileMeta;fs;_isDir;constructor(e,t,n,r=!1){this.file=e,this.fileMeta=t,this.fs=n,this._isDir=r}isNop(){return null===this.file}async close(){if(null!==this.file)return await this.file.close()}async readDir(e){const t=[];if(this._isDir&&this.file){const n=await this.file.readdir(e);for(const e of n){const n=this.joinPath(this.fileMeta.fileName(),e.name()),r=newFileMeta(n,async()=>await this.fs.open(n));r.merge(this.fileMeta);const s=newFileInfo(e,n);s.setMeta(r),t.push(s)}}return t}meta(){return this.fileMeta}joinPath(e,t){return e.endsWith("/")?e+t:e+"/"+t}async read(e){if(null===this.file)throw new Error("File is null");return await this.file.read(e)}async readAt(e,t){if(null===this.file)throw new Error("File is null");return await this.file.readAt(e,t)}async seek(e,t){if(null===this.file)throw new Error("File is null");return await this.file.seek(e,t)}async write(e){if(null===this.file)throw new Error("File is null");return await this.file.write(e)}async writeAt(e,t){if(null===this.file)throw new Error("File is null");return await this.file.writeAt(e,t)}name(){return path11.basename(this.fileMeta.fileName())}async readdir(e){if(null===this.file)throw new Error("File is null");return await this.readDir(e)}async readdirnames(e){if(null===this.file)throw new Error("File is null");return await this.file.readdirnames(e)}async stat(){if(null===this.file)throw new Error("File is null");return await this.file.stat()}async sync(){if(null!==this.file)return await this.file.sync()}async truncate(e){if(null===this.file)throw new Error("File is null");return await this.file.truncate(e)}async writeString(e){if(null===this.file)throw new Error("File is null");return await this.file.writeString(e)}},DirFile=class extends File{virtualOpener;filter;constructor(e,t=null,n=null){super(e.isNop()?null:e,e.meta(),e.fs,!0),this.virtualOpener=t,this.filter=n}async readDir(e){if(!this.isNop()){let t=await super.readDir(e);return null!==this.filter&&(t=await this.filter(t)),t}return await this.readVirtualDir()}async readVirtualDir(){if(null!==this.virtualOpener)return await this.virtualOpener();throw new Error("virtual dir opener not found")}setFilter(e){this.filter=e}setVirtualOpener(e){this.virtualOpener=e}getFilter(){return this.filter}getVirtualOpener(){return this.virtualOpener}},path12=__toESM(require("path"));init_log(),getDomainLogger("fs",{component:"basefs"});var BaseFs=class{fs;roots;constructor(e,t){this.fs=e,this.roots=t}toAbsolutePath(e){if(0===this.roots.length)return e;const t=this.roots[0];return""===e?t:path12.isAbsolute(e)?e.startsWith(t)?e:path12.join(t,e.substring(1)):path12.join(t,e)}isSameRootedPath(e){const t=this.roots[0];return e.startsWith(path12.join(t,path12.sep))||e===t}async stat(e){const t=this.toAbsolutePath(e);if(!this.isSameRootedPath(t))throw new Error(`path ${e} is outside of the BaseFs root`);try{const n=await this.fs.stat(t);if(n.isDir()){const r=newFileInfo(n,t);return r.meta().setOpenFunc(async()=>await this.openDir(e)),r}const r=newFileInfo(n,t),s=this.getRoot(t);return r.meta().setComponentRoot(s),r.meta().setOpenFunc(async()=>await this.openInternal(e)),r}catch(e){throw e}}async open(e){const t=this.toAbsolutePath(e);return(await this.fs.stat(t)).isDir()?await this.openDir(e):await this.openInternal(e)}async openInternal(e,t=!1){const n=this.toAbsolutePath(e),r=await this.fs.open(n),s=this.getRoot(n),a=newFileMeta(n);return a.setComponentRoot(s),t?function(e,t,n){return new File(e,t,n,!0)}(r,a,this.fs):function(e,t,n){return new File(e,t,n)}(r,a,this.fs)}getRoot(e){for(const t of this.roots)if(e.startsWith(t))return t;return""}async openDir(e){const t=await this.openInternal(e,!0),n=this.toAbsolutePath(e),r=this.getRoot(n),s=newFileMeta(n);return s.setComponentRoot(r),function(e,t,n){const r=new File(e,t,n,!0);return new DirFile(r)}(t,s,this.fs)}async create(e){const t=this.toAbsolutePath(e);return await this.fs.create(t)}async mkdir(e,t){const n=this.toAbsolutePath(e);return await this.fs.mkdir(n,t)}async mkdirAll(e,t){const n=this.toAbsolutePath(e);return await this.fs.mkdirAll(n,t)}async openFile(e,t,n){const r=this.toAbsolutePath(e);return await this.fs.openFile(r,t,n)}async remove(e){const t=this.toAbsolutePath(e);return await this.fs.remove(t)}async removeAll(e){const t=this.toAbsolutePath(e);return await this.fs.removeAll(t)}async rename(e,t){const n=this.toAbsolutePath(e),r=this.toAbsolutePath(t);return await this.fs.rename(n,r)}name(){return`BaseFs(${this.fs.name()})`}async chmod(e,t){const n=this.toAbsolutePath(e);return await this.fs.chmod(n,t)}async chown(e,t,n){const r=this.toAbsolutePath(e);return await this.fs.chown(r,t,n)}async chtimes(e,t,n){const r=this.toAbsolutePath(e);return await this.fs.chtimes(r,t,n)}};function newBaseFs(e,t){return new BaseFs(e,t)}var path13=__toESM(require("path"));init_log();var log8=getDomainLogger("fs",{component:"walkway"}),Walkway=class{fs;root;cb;cfg;walked=!1;constructor(e,t){if(!e)throw new Error("fs must be set");if(!t.walkFn)throw new Error("walkFn must be set");this.fs=e,this.cb=t,this.root="",this.cfg={}}async walkWith(e,t){return this.cfg=t,this.root=e,await this.walk()}async walk(){if(this.walked)throw new Error("this walkway is already walked");return this.walked=!0,await this.walkRecursive(this.root,this.cfg.info,this.cfg.dirEntries)}checkErr(e,t){return!(!this.isNotExistError(t)||this.cfg.failOnNotExist||(log8.warn(`File "${e}" not found, skipping.`),0))}isNotExistError(e){return e.message.includes("ENOENT")||e.message.includes("no such file")||"ENOENT"===e.code}async walkRecursive(e,t,n){if(!t)try{const n=await this.fs.stat(e),r=newFileMeta(e);r.setOpenFunc(async()=>await this.fs.open(e)),t=newFileInfoWithMeta(n,r)}catch(t){if(e===this.root&&this.isNotExistError(t)){if(this.cfg.failOnNotExist)throw new FsError(`walk: root not found: ${t.message}`,"WALK_ROOT_NOT_FOUND");return}if(this.checkErr(e,t))return;throw new FsError(`walk: stat: ${t.message}`,"WALK_STAT_FAILED")}try{const n=await this.cb.walkFn(e,t);if(n instanceof Error)throw n}catch(e){if(t.isDir()&&e===ErrSkipDir)return;throw e}if(t.isDir()){if(!n)try{const t=await this.fs.open(e),r=await t.readdir(-1);await t.close(),n=r.map(e=>e),this.cfg.sortDirEntries&&n.sort((e,t)=>e.name().localeCompare(t.name()))}catch(t){if(this.checkErr(e,t))return;throw new FsError(`walk: readdir: ${t.message}`,"WALK_READDIR_FAILED")}if(this.cfg.ignoreFile&&(n=n.filter(e=>!this.cfg.ignoreFile(e.fileName()))),this.cb.hookPre)try{n=await this.cb.hookPre(t,e,n)}catch(e){if(e===ErrSkipDir)return;throw e}for(const t of n){const n=path13.join(e,t.name());try{await this.walkRecursive(n,t)}catch(e){if(!t.isDir()||e!==ErrSkipDir)throw e}}if(this.cb.hookPost)try{await this.cb.hookPost(t,e,n)}catch(e){if(e===ErrSkipDir)return;throw e}}}};init_log();var log9=getDomainLogger("fs",{component:"static-copier"}),StaticCopier=class{fromFss;toFs;constructor(e,t){this.fromFss=e,this.toFs=t}async copy(){this.fromFss&&0!==this.fromFss.length?this.toFs?await this.doWithPublishDirs(this.toFs,async e=>{for(const t of this.fromFss)await this.copyStaticTo(t,e)}):log9.error("No publish filesystem found"):log9.error("No static filesystems found")}async doWithPublishDirs(e,t){try{await t("/")}catch(e){throw log9.error("Error in doWithPublishDirs:",e),e}}async copyStaticTo(e,t){try{return await this.walkSourceFiles(e,t)}catch(e){throw log9.error(`Error copying static files to ${t}:`,e),e}}async walkSourceFiles(e,t){let n=0;try{await this.walkFileSystem(e,"/",async(r,s)=>{s||(await this.copyFile(e,r,this.toFs,t),n++)})}catch(e){throw log9.error("Error walking source files:",e),e}return n}async walkFileSystem(e,t,n){try{const r=await e.open(t);if(!(await r.stat()).isDir())return await r.close(),void await n(t,!1);const s=await r.readdir(-1);await r.close();for(const r of s){const s=this.joinPath(t,r.name());r.isDir()?(await n(s,!0),await this.walkFileSystem(e,s,n)):await n(s,!1)}}catch(e){log9.error(`Could not read directory ${t}:`,e)}}async copyFile(e,t,n,r){let s=null,a=null;try{const i=t.startsWith("/")?t.slice(1):t,o=this.joinPath(r,i),l=this.dirname(o);"/"!==l&&await n.mkdirAll(l,493),s=await e.open(t);const c=await s.stat(),u=new Uint8Array(c.size());await s.read(u),a=await n.create(o),await a.write(u)}catch(e){log9.warn(`Failed to copy static file ${t}:`,e)}finally{if(a)try{await a.close()}catch(e){log9.warn(`Failed to close target file: ${e}`)}if(s)try{await s.close()}catch(e){log9.warn(`Failed to close source file: ${e}`)}}}joinPath(...e){return e.map(e=>e.replace(/^\/+|\/+$/g,"")).filter(e=>e.length>0).join("/").replace(/^/,"/")}dirname(e){const t=e.split("/").filter(e=>e.length>0);return t.length<=1?"/":"/"+t.slice(0,-1).join("/")}};init_log();var log10=getDomainLogger("fs",{component:"incremental-file-collector"});async function createFileMetaInfo(e,t){try{const n=await t.stat(e),r=newFileMeta(e);return r.setOpenFunc(async()=>await t.open(e)),newFileInfoWithMeta(n,r)}catch(t){throw new Error(`Failed to stat file ${e}: ${t.message}`)}}var Fs2=class{originFs;prompts;workflows;content;layouts;statics;assets;i18n;work;service;constructor(e,t,n,r,s,a,i,o,l){this.originFs=e,this.prompts=t,this.workflows=n,this.content=r,this.layouts=s,this.statics=a,this.assets=i,this.i18n=o,this.work=l,this.service=new Service3}os(){return this.originFs.getOrigin()}workFs(){return this.work}workflowFs(){return this.workflows}promptFs(){return this.prompts}contentFs(){return this.content}layoutsFs(){return this.layouts}staticFs(){return this.statics}assetsFs(){return this.assets}publishFs(){return this.originFs.publish()}copyStatic(e,t){return new StaticCopier(e,t).copy()}newFileMetaInfo(e){return this.service.newFileMetaInfo(e)}newFileMetaInfoWithContent(e){return this.service.newFileMetaInfoWithContent(e)}async getFileMetaInfos(e){return async function(e,t){const n=new Map;let r=!1;for(const s of e)for(const e of t)try{const t=await createFileMetaInfo(s,e);if(n.set(s,t),r=!0,r)break}catch(t){log10.error(`Failed to create FileMetaInfo for ${s} with fs=${e}:`,t)}return n}(e,this.content)}newBasePathFs(e,t){return newBaseFs(e,[t])}async walkPrompts(e,t,n){return await this.walk(this.prompts,e,t,n)}async walkWorkflows(e,t,n){return await this.walk(this.workflows,e,t,n)}async walkLayouts(e,t,n){return await this.walk(this.layouts,e,t,n)}async walkContent(e,t,n,r){await this.walk(e,t,n,r)}async walkStatics(e,t,n){return await this.walk(this.statics,e,t,n)}async walkI18n(e,t,n){return await this.walk(this.i18n,e,t,n)}async walk(e,t,n,r){const s=function(e,t){return new Walkway(e,t)}(e,n);return""===t&&(t="/"),await s.walkWith(t,r)}},defaultDirMerger=(e,t)=>{const n=[...e];for(const r of t){let t=!1;for(const n of e)if(r.name()===n.name()){t=!0;break}t||n.push(r)}return n},OverlayOptions=class e{fss;firstWritable;dirsMerger;constructor(e){this.fss=[...e.fss],this.firstWritable=e.firstWritable??!1,this.dirsMerger=e.dirsMerger??defaultDirMerger}withFilesystems(...t){return new e({fss:[...this.fss,...t],firstWritable:this.firstWritable,dirsMerger:this.dirsMerger})}withFirstWritable(t){return new e({fss:this.fss,firstWritable:t,dirsMerger:this.dirsMerger})}withDirsMerger(t){return new e({fss:this.fss,firstWritable:this.firstWritable,dirsMerger:t})}getWritableFs(){return this.firstWritable&&0!==this.fss.length?this.fss[0]:null}isValid(){return void 0!==this.dirsMerger}getFilesystemCount(){return this.fss.length}getFilesystem(e){return e<0||e>=this.fss.length?null:this.fss[e]}hasFilesystem(e){return this.fss.includes(e)}getFilesystems(){return this.fss}};function newOverlayOptions(e,t=!1,n){const r={fss:e,firstWritable:t};return void 0!==n&&(r.dirsMerger=n),new OverlayOptions(r)}function createDefaultOverlayOptions(e){return newOverlayOptions(e,!1,defaultDirMerger)}var OverlayDir=class{_name;fss;dirOpeners;info;merge;err;offset;fis;closed;constructor(e={}){this._name=e.name||"",this.fss=e.fss?[...e.fss]:[],this.dirOpeners=e.dirOpeners?[...e.dirOpeners]:[],void 0!==e.info&&(this.info=e.info),this.merge=e.merge||defaultDirMerger,this.offset=0,this.fis=[],this.closed=!1}name(){return this._name}isClosed(){return this.closed||0===this.fss.length&&0===this.dirOpeners.length}async readdir(e){if(this.isClosed())throw ErrFileClosed;if(this.err)throw this.err;0===this.offset&&await this.loadDirectoryEntries();const t=this.fis.slice(this.offset);if(e<=0){if(this.err=new Error("EOF"),this.offset>0&&0===t.length)throw this.err;return[...t]}if(0===t.length)throw this.err=new Error("EOF"),this.err;const n=t.slice(0,e);return this.offset+=n.length,n}async readdirnames(e){if(this.isClosed())throw ErrFileClosed;return(await this.readdir(e)).map(e=>e.name())}async loadDirectoryEntries(){for(let e=0;e<this.fss.length;e++){const t=this.fss[e];await this.readFromFilesystem(t,null)}for(let e=0;e<this.dirOpeners.length;e++){const t=await this.dirOpeners[e]();await this.readFromFilesystem(null,t)}}async readFromFilesystem(e,t){let n=t;try{if(!n&&e){const t="/"===this._name?"":this._name;n=await e.open(t)}if(!n)return;const t=await n.readdir(-1);this.fis=this.merge(this.fis,t)}catch(e){}finally{n&&!t&&await n.close()}}async stat(){if(this.isClosed())throw ErrFileClosed;if(this.info)return await this.info();if(this.fss.length>0)return await this.fss[0].stat(this._name);throw new OverlayFsError("no filesystem available for stat","NO_FILESYSTEM")}async close(){this.closed=!0,this.fss=[],this.dirOpeners=[],this.fis=[],delete this.info,this.offset=0,delete this.err}notSupported(e){throw new OverlayFsError(`operation ${e} not supported on directory "${this._name}"`,"OPERATION_NOT_SUPPORTED")}async read(e){this.notSupported("read")}async readAt(e,t){this.notSupported("readAt")}async seek(e,t){this.notSupported("seek")}async write(e){this.notSupported("write")}async writeAt(e,t){this.notSupported("writeAt")}async sync(){this.notSupported("sync")}async truncate(e){this.notSupported("truncate")}async writeString(e){this.notSupported("writeString")}},dirPool=new class{pool=[];get(){return this.pool.length>0?this.pool.pop():new OverlayDir}release(e){e.fss=[],e.dirOpeners=[],e.fis=[],delete e.info,e.offset=0,e._name="",delete e.err,e.closed=!1,this.pool.push(e)}};init_log(),getDomainLogger("fs",{component:"overlayfs"});var OverlayFs=class e{fss;mergeDirs;firstWritable;constructor(e){this.fss=[...e.fss],this.mergeDirs=e.dirsMerger,this.firstWritable=e.firstWritable}name(){return"overlayfs"}filesystem(e){return e<0||e>=this.fss.length?null:this.fss[e]}numFilesystems(){return this.fss.length}append(...t){const n=new OverlayOptions({fss:[...this.fss,...t],firstWritable:this.firstWritable,dirsMerger:this.mergeDirs});return new e(n)}withDirsMerger(t){const n=new OverlayOptions({fss:this.fss,firstWritable:this.firstWritable,dirsMerger:t});return new e(n)}writeFs(){if(0===this.fss.length)throw ErrNoFilesystems;return this.fss[0]}async collectDirs(e,t){for(const n of this.fss)await this.collectDirsRecursive(n,e,t)}async collectDirsRecursive(e,t,n){try{(await e.stat(t)).isDir()&&n(e)}catch(e){}const r=e;if(r.filesystem&&r.numFilesystems)for(let e=0;e<r.numFilesystems();e++){const s=r.filesystem(e);s&&await this.collectDirsRecursive(s,t,n)}}async statInternal(e,t){for(let n=0;n<this.fss.length;n++){const r=this.fss[n],[s,a,i,o]=await this.statRecursive(r,e,t);if(null===o||!this.isNotExistError(o))return[s,a,i,o]}return[null,null,!1,ErrFileNotFound]}async statRecursive(e,t,n){try{const n=await e.stat(t);return[e,n,!1,null]}catch(t){if(!this.isNotExistError(t))return[e,null,!1,t]}const r=e;if(r.filesystem&&r.numFilesystems)for(let e=0;e<r.numFilesystems();e++){const s=r.filesystem(e);if(s){const[e,r,a,i]=await this.statRecursive(s,t,n);if(null===i||!this.isNotExistError(i))return[e,r,a,i]}}return[null,null,!1,ErrFileNotFound]}isNotExistError(e){return e.message.includes("ENOENT")||e.message.includes("no such file")||e===ErrFileNotFound}async create(e){if(!this.firstWritable)throw new OverlayFsError("filesystem is read-only","READ_ONLY");return await this.writeFs().create(e)}async mkdir(e,t){if(!this.firstWritable)throw new OverlayFsError("filesystem is read-only","READ_ONLY");return await this.writeFs().mkdir(e,t)}async mkdirAll(e,t){if(!this.firstWritable)throw new OverlayFsError("filesystem is read-only","READ_ONLY");return await this.writeFs().mkdirAll(e,t)}async open(e){if(0===this.fss.length)throw ErrFileNotFound;const[t,n,,r]=await this.statInternal(e,!1);if(r)throw r;if(n.isDir()){const t=[];if(await this.collectDirs(e,e=>{t.push(e)}),0===t.length)throw ErrFileNotFound;return 1===t.length?await t[0].open(e):await async function(e,t,n,r){if(!n)throw new OverlayFsError("info function must not be null","INFO_REQUIRED");const s=dirPool.get(),a={name:e,fss:[...r],info:n,merge:t||defaultDirMerger};return Object.assign(s,new OverlayDir(a)),s}(e,this.mergeDirs,async()=>n,t)}return await t.open(e)}async openFile(e,t,n){const r=!!(1&t)||!!(2&t);if(r&&!this.firstWritable)throw new OverlayFsError("filesystem is read-only","READ_ONLY");return r?await this.writeFs().openFile(e,t,n):await this.open(e)}async remove(e){if(!this.firstWritable)throw new OverlayFsError("filesystem is read-only","READ_ONLY");return await this.writeFs().remove(e)}async removeAll(e){if(!this.firstWritable)throw new OverlayFsError("filesystem is read-only","READ_ONLY");return await this.writeFs().removeAll(e)}async rename(e,t){if(!this.firstWritable)throw new OverlayFsError("filesystem is read-only","READ_ONLY");return await this.writeFs().rename(e,t)}async stat(e){const t="/"===e?"":e,[,n,,r]=await this.statInternal(t,!1);if(r)throw r;return n}async chmod(e,t){if(!this.firstWritable)throw new OverlayFsError("filesystem is read-only","READ_ONLY");return await this.writeFs().chmod(e,t)}async chown(e,t,n){if(!this.firstWritable)throw new OverlayFsError("filesystem is read-only","READ_ONLY");return await this.writeFs().chown(e,t,n)}async chtimes(e,t,n){if(!this.firstWritable)throw new OverlayFsError("filesystem is read-only","READ_ONLY");return await this.writeFs().chtimes(e,t,n)}};function newOverlayFs(e){return new OverlayFs(e)}var VirtualFileInfo=class{_name;_content;_modTime;constructor(e,t="This is a virtual file."){this._name=e,this._content=t,this._modTime=new Date}name(){return this._name}size(){return Buffer.byteLength(this._content,"utf8")}mode(){return 420}modTime(){return this._modTime}isDir(){return!1}sys(){return null}getContent(){return this._content}},VirtualFile=class{_fileName;_fileContent;_fileInfo=null;constructor(e,t){this._fileName=e,this._fileContent=t}fullName(){return this._fileName}async open(){return{name:()=>this._fileName,close:async()=>{},read:async e=>{const t=Buffer.from(this._fileContent,"utf8"),n=Math.min(e.length,t.length);return t.copy(e,0,0,n),{bytesRead:n,buffer:e}},readAt:async(e,t)=>{const n=Buffer.from(this._fileContent,"utf8"),r=Math.min(t,n.length),s=Math.min(e.length,n.length-r);return s>0&&n.copy(e,0,r,r+s),{bytesRead:s,buffer:e}},seek:async(e,t)=>e,write:async e=>({bytesWritten:e.length,buffer:e}),writeAt:async(e,t)=>({bytesWritten:e.length,buffer:e}),readdir:async e=>[],readdirnames:async e=>[],stat:async()=>this.getFileInfo(),sync:async()=>{},truncate:async e=>{},writeString:async e=>({bytesWritten:Buffer.byteLength(e,"utf8")})}}getFileInfo(){return this._fileInfo||(this._fileInfo=new VirtualFileInfo(this._fileName,this._fileContent)),this._fileInfo}},globalVirtualFile=null;var Service3=class{newFileMetaInfo(e){return function(e){const t=(globalVirtualFile||(globalVirtualFile=new VirtualFile("/content/file.txt","This is a virtual file.")),globalVirtualFile.getFileInfo()),n=newFileMeta(e);return new FileInfo(t,n)}(e)}newFileMetaInfoWithContent(e){return function(e){const t=function(e){const t=Math.floor(1e6*Math.random()).toString().padStart(6,"0");return new VirtualFile(`/content/file_${t}.md`,e)}(e),n=t.getFileInfo(),r=newFileMeta(t.fullName(),()=>t.open());return r.setComponentRoot("content"),r.setComponentDir("content"),new FileInfo(n,r)}(e)}},Factory=class{create(e){return newOverlayFs(createDefaultOverlayOptions(e))}createWithOptions(e){return function(e){const t=new OverlayOptions(e);return new OverlayFs(t)}(e)}createReadOnly(e){return newOverlayFs(createDefaultOverlayOptions(e))}createWritable(e){const t=function(e){return newOverlayOptions(e,!0,void 0)}(e);return newOverlayFs(t)}createWithMerger(e,t){return newOverlayFs(createDefaultOverlayOptions(e).withDirsMerger(t))}};function createReadOnlyOverlayFs(e){return(new Factory).createReadOnly(e)}var path14=__toESM(require("path"));init_log(),getDomainLogger("fs",{component:"filesystemscollector"});var RootMapping=class{from;to;toBase;constructor(e,t,n=""){this.from=e,this.to=t,this.toBase=n}fs(e){return newBaseFs(e,[this.to])}},FilesystemsCollector=class{sourceProject;overlayMountsPrompt;overlayMountsWorkflow;overlayMountsContent;overlayMountsLayouts;overlayMountsStatics;overlayMountsAssets;overlayMountsI18n;constructor(e){this.sourceProject=e,this.overlayMountsPrompt=createReadOnlyOverlayFs([]),this.overlayMountsWorkflow=createReadOnlyOverlayFs([]),this.overlayMountsContent=[],this.overlayMountsLayouts=createReadOnlyOverlayFs([]),this.overlayMountsStatics=createReadOnlyOverlayFs([]),this.overlayMountsAssets=createReadOnlyOverlayFs([]),this.overlayMountsI18n=createReadOnlyOverlayFs([])}async collect(e){const t=e.all();for(const e of t){const t=[],n=[],r=[],s=[],a=[],i=[],o=[],l=t=>path14.isAbsolute(t)?["",t]:[e.dir(),this.absPathify(e.dir(),t)],c=e.mounts();for(const e of c){const[c,u]=l(e.source()),h=new RootMapping(e.target(),u,c).fs(this.sourceProject);this.isPrompts(e.target())?n.push(h):this.isWorkflows(e.target())?t.push(h):this.isContent(e.target())?r.push(h):this.isLayouts(e.target())?s.push(h):this.isStatics(e.target())?a.push(h):this.isAssets(e.target())?i.push(h):this.isI18n(e.target())&&o.push(h)}if(t.length>0&&(this.overlayMountsWorkflow=this.overlayMountsWorkflow.append(...t)),n.length>0&&(this.overlayMountsPrompt=this.overlayMountsPrompt.append(...n)),e.isProjectModule())for(const e of r){let t=createReadOnlyOverlayFs([]);t=t.append(e),this.overlayMountsContent.push(t)}s.length>0&&(this.overlayMountsLayouts=this.overlayMountsLayouts.append(...s)),a.length>0&&(this.overlayMountsStatics=this.overlayMountsStatics.append(...a)),i.length>0&&(this.overlayMountsAssets=this.overlayMountsAssets.append(...i)),o.length>0&&(this.overlayMountsI18n=this.overlayMountsI18n.append(...o))}}isPrompts(e){return"prompts"===e||e.startsWith("prompts/")||e.startsWith("/prompts/")}isWorkflows(e){return"workflows"===e||e.startsWith("workflows/")||e.startsWith("/workflows/")}isContent(e){return"content"===e||e.startsWith("content/")||e.startsWith("/content/")}isLayouts(e){return"layouts"===e||e.startsWith("layouts/")||e.startsWith("/layouts/")}isStatics(e){return"static"===e||e.startsWith("static/")||e.startsWith("/static/")}isAssets(e){return"assets"===e||e.startsWith("assets/")||e.startsWith("/assets/")}isI18n(e){return"i18n"===e||e.startsWith("i18n/")||e.startsWith("/i18n/")}absPathify(e,t){return path14.resolve(e,t)}},fs=__toESM(require("fs/promises")),path15=__toESM(require("path"));init_log();var log13=getDomainLogger("fs",{component:"osfs"}),OsFileInfo=class{constructor(e,t){this.stats=e,this._name=t}name(){return this._name}size(){return this.stats.size}mode(){return this.stats.mode}modTime(){return this.stats.mtime}isDir(){return this.stats.isDirectory()}sys(){return this.stats}},OsFile=class{constructor(e,t="r"){this.filePath=e,this.flags=t}handle=null;closed=!1;position=0;async ensureOpen(){this.handle||this.closed||(this.handle=await fs.open(this.filePath,this.flags))}async close(){if(this.handle){try{await this.handle.close()}catch(e){throw log13.error(`❌ Error closing file handle for ${this.filePath}:`,e),e}this.handle=null}this.closed=!0}async read(e){if(this.closed)throw new Error("File is closed");if(await this.ensureOpen(),!this.handle)throw new Error("Failed to open file");const t=await this.handle.read(e,0,e.length,this.position);return this.position+=t.bytesRead,{bytesRead:t.bytesRead,buffer:e}}async readAt(e,t){if(this.closed)throw new Error("File is closed");if(await this.ensureOpen(),!this.handle)throw new Error("Failed to open file");return{bytesRead:(await this.handle.read(e,0,e.length,t)).bytesRead,buffer:e}}async seek(e,t){if(this.closed)throw new Error("File is closed");switch(t){case 0:default:this.position=e;break;case 1:this.position+=e;break;case 2:if(await this.ensureOpen(),this.handle){const t=await this.handle.stat();this.position=t.size+e}}return this.position}async write(e){if(this.closed)throw new Error("File is closed");if(await this.ensureOpen(),!this.handle)throw new Error("Failed to open file");const t=await this.handle.write(e,0,e.length,this.position);return this.position+=t.bytesWritten,{bytesWritten:t.bytesWritten,buffer:e}}async writeAt(e,t){if(this.closed)throw new Error("File is closed");if(await this.ensureOpen(),!this.handle)throw new Error("Failed to open file");return{bytesWritten:(await this.handle.write(e,0,e.length,t)).bytesWritten,buffer:e}}name(){return this.filePath}async readdir(e){if(this.closed)throw new Error("File is closed");const t=await fs.readdir(this.filePath,{withFileTypes:!0}),n=[],r=e>0?Math.min(e,t.length):t.length;for(let e=0;e<r;e++){const r=t[e],s=path15.join(this.filePath,r.name),a=await fs.stat(s);n.push(new OsFileInfo(a,r.name))}return n}async readdirnames(e){if(this.closed)throw new Error("File is closed");const t=await fs.readdir(this.filePath);return e>0?t.slice(0,e):t}async stat(){if(this.closed)throw new Error("File is closed");const e=await fs.stat(this.filePath);return new OsFileInfo(e,path15.basename(this.filePath))}async sync(){if(this.closed)throw new Error("File is closed");await this.ensureOpen(),this.handle&&await this.handle.sync()}async truncate(e){if(this.closed)throw new Error("File is closed");await this.ensureOpen(),this.handle&&(await this.handle.truncate(e),this.position>e&&(this.position=e))}async writeString(e){const t=Buffer.from(e,"utf8");return{bytesWritten:(await this.write(t)).bytesWritten}}},OsFs=class{async create(e){return await fs.writeFile(e,""),new OsFile(e,"w+")}async mkdir(e,t){await fs.mkdir(e,{mode:t})}async mkdirAll(e,t){await fs.mkdir(e,{mode:t,recursive:!0})}async open(e){return await fs.access(e),(await fs.stat(e)).isDirectory(),new OsFile(e,"r")}async openFile(e,t,n){let r="r";return 1&t&&(r="w"),2&t&&(r="r+"),64&t&&(r="w"),512&t&&(r="w"),1024&t&&(r="a"),new OsFile(e,r)}async remove(e){(await fs.stat(e)).isDirectory()?await fs.rmdir(e):await fs.unlink(e)}async removeAll(e){await fs.rm(e,{recursive:!0,force:!0})}async rename(e,t){await fs.rename(e,t)}async stat(e){const t=await fs.stat(e);return new OsFileInfo(t,path15.basename(e))}name(){return"OsFs"}async chmod(e,t){await fs.chmod(e,t)}async chown(e,t,n){await fs.chown(e,t,n)}async chtimes(e,t,n){await fs.utimes(e,t,n)}};async function createFs(e,t){const n=function(e){const t=e.osFs,n=e.osFs,r=newBaseFs(e.osFs,[e.publish]);return new OriginFs(t,n,r)}(e),r=await async function(e,t){const n=(r=e.getSource(),new FilesystemsCollector(r));var r;return await n.collect(t),n}(n,t),s=newBaseFs(e.osFs,[e.path]);return new Fs2(n,r.overlayMountsPrompt,r.overlayMountsWorkflow,r.overlayMountsContent,r.overlayMountsLayouts,r.overlayMountsStatics,r.overlayMountsAssets,r.overlayMountsI18n,s)}var PageKind_PAGE="page",PageKind_HOME="home",PageKind_SECTION="section",PageKind_TAXONOMY="taxonomy",PageKind_TERM="term",PageKind_SITEMAP="sitemap",PageKind_STATUS_404="404",BufWriter=class{buffer;position;capacity;constructor(e=1024){this.capacity=e,this.buffer=new Uint8Array(this.capacity),this.position=0}async write(e){this.ensureCapacity(e.length),this.buffer.set(e,this.position),this.position+=e.length}async writeString(e){const t=(new TextEncoder).encode(e);await this.write(t)}async writeByte(e){this.ensureCapacity(1),this.buffer[this.position]=e,this.position++}bytes(){return this.buffer.slice(0,this.position)}length(){return this.position}truncate(e){if(e<0||e>this.position)throw new Error("Invalid truncate size");this.position=e}ensureCapacity(e){const t=this.position+e;if(t<=this.capacity)return;const n=Math.max(2*this.capacity,t),r=new Uint8Array(n);r.set(this.buffer),this.buffer=r,this.capacity=n}},TableOfContentsImpl=class{constructor(e=[]){this.fragments=e}toHTML(e,t,n){if(0===this.fragments.length)return"";const r=this.filterByLevel(this.fragments,e,t);if(0===r.length)return"";const s=n?"ol":"ul";return`<${s}>\n${this.renderFragments(r,n)}</${s}>\n`}filterByLevel(e,t,n){return e.filter(e=>e.level>=t&&e.level<=n).map(e=>{const r={id:e.id,text:e.text,level:e.level};return e.children&&(r.children=this.filterByLevel(e.children,t,n)),r})}renderFragments(e,t){const n=t?"ol":"ul";return e.map(e=>{let r=` <li><a href="#${e.id}">${this.escapeHTML(e.text)}</a>`;return e.children&&e.children.length>0&&(r+=`\n <${n}>\n${this.renderFragments(e.children,t)} </${n}>`),r+="</li>",r}).join("\n")}escapeHTML(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}addFragment(e){this.fragments.push(e)}getFragments(){return[...this.fragments]}},HeaderImpl=class{constructor(e,t,n=[],r=[],s=[]){this._name=e,this._level=t,this._links=n,this._paragraphs=r,this._listParagraphs=s}name(){return this._name}level(){return this._level}links(){return[...this._links]}paragraphs(){return[...this._paragraphs]}listParagraphs(){return[...this._listParagraphs]}addLink(e){this._links.push(e)}addParagraph(e){this._paragraphs.push(e)}addListParagraph(e){this._listParagraphs.push(e)}},TOCBuilder=class{fragments=[];stack=[];addHeading(e,t,n){for(;this.stack.length>0&&this.stack[this.stack.length-1].level>=t;)this.stack.pop();const r={id:n,text:e,level:t,children:[]};if(0===this.stack.length)this.fragments.push(r);else{const e=this.stack[this.stack.length-1];e.children||(e.children=[]),e.children.push(r)}this.stack.push(r)}build(){return new TableOfContentsImpl(this.fragments)}reset(){this.fragments=[],this.stack=[]}},AutoIDGenerator=class{usedIds=new Set;generateID(e,t="github"){let n;switch(t){case"github":default:n=this.githubStyle(e);break;case"github-ascii":n=this.githubAsciiStyle(e);break;case"blackfriday":n=this.blackfridayStyle(e)}if(this.usedIds.has(n)){let e=1,t=`${n}-${e}`;for(;this.usedIds.has(t);)e++,t=`${n}-${e}`;n=t}return this.usedIds.add(n),n}githubStyle(e){return e.toLowerCase().replace(/[^\w\u4e00-\u9fff\s-]/g,"").replace(/\s+/g,"-").replace(/^-+|-+$/g,"")}githubAsciiStyle(e){return e.toLowerCase().replace(/[^\w\s-]/g,"").replace(/\s+/g,"-").replace(/^-+|-+$/g,"")}blackfridayStyle(e){return e.toLowerCase().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/^-+|-+$/g,"")}reset(){this.usedIds.clear()}},HighlightResultImpl=class{constructor(e,t){this.wrappedContent=e,this.innerContent=t}wrapped(){return this.wrappedContent}inner(){return this.innerContent}},DefaultHighlighter=class{constructor(e){this.config=e}async highlight(e,t,n){if(!t||"text"===t||"plain"===t)return this.escapeHTML(e);const r=this.escapeHTML(e),s=`language-${t}`;return this.config.lineNos?this.addLineNumbers(r,s):`<code class="${s}">${r}</code>`}async highlightCodeBlock(e,t){const n=e.type(),r=e.inner(),s=await this.highlight(r,n,t);return new HighlightResultImpl(`<pre>${s}</pre>`,s)}async renderCodeblock(e,t,n){const r=await this.highlightCodeBlock(n);await t.writeString(r.wrapped())}isDefaultCodeBlockRenderer(){return!0}escapeHTML(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}addLineNumbers(e,t){const n=e.split("\n").map((e,n)=>{const r=n+this.config.lineNoStart;return this.config.lineNumbersInTable?`<tr><td class="line-number">${r}</td><td class="line-code"><code class="${t}">${e}</code></td></tr>`:`<span class="line-number">${r}</span><code class="${t}">${e}</code>`});return this.config.lineNumbersInTable?`<table class="code-table"><tbody>${n.join("")}</tbody></table>`:n.join("\n")}};init_log();var Item=class{Type;Err;low;high;segments;firstByte;isString;content;bytes;constructor(){this.Type=0,this.Err=null,this.low=0,this.high=0,this.segments=[],this.firstByte=0,this.isString=!1,this.content="",this.bytes=[]}Pos(){return this.segments.length>0?this.segments[0].Low:this.low}Val(e){if(0===this.segments.length)return e.slice(this.low,this.high);if(1===this.segments.length)return e.slice(this.segments[0].Low,this.segments[0].High);const t=[];for(const n of this.segments)t.push(e.slice(n.Low,n.High));const n=t.reduce((e,t)=>e+t.length,0),r=new Uint8Array(n);let s=0;for(const e of t)r.set(e,s),s+=e.length;return r}ValStr(e){return(new TextDecoder).decode(this.Val(e))}ValTyped(e){const t=this.ValStr(e);if(this.isString)return t;if(boolRe.test(t))return"true"===t;if(intRe.test(t)){const e=parseInt(t,10);return isNaN(e)?t:e}if(floatRe.test(t)){const e=parseFloat(t);return isNaN(e)?t:e}return t}IsText(){return 18===this.Type||17===this.Type}IsIndentation(){return 17===this.Type}IsNonWhitespace(e){return this.ValStr(e).trim().length>0}IsShortcodeName(){return 13===this.Type}IsInlineShortcodeName(){return 14===this.Type}IsLeftShortcodeDelim(){return 10===this.Type||8===this.Type}IsRightShortcodeDelim(){return 11===this.Type||9===this.Type}IsShortcodeClose(){return 12===this.Type}IsShortcodeParam(){return 15===this.Type}IsShortcodeParamVal(){return 16===this.Type}IsShortcodeMarkupDelimiter(){return 10===this.Type||11===this.Type}IsFrontMatter(){return this.Type>=3&&this.Type<=6}IsDone(){return 0===this.Type||1===this.Type}IsEOF(){return 1===this.Type}IsError(){return 0===this.Type}ToString(e){const t=this.Val(e),n=this.ValStr(e),r=function(e){const t=e;return t<0||t>=_ItemType_index.length-1?`ItemType(${t})`:_ItemType_name.slice(_ItemType_index[t],_ItemType_index[t+1])}(this.Type);switch(!0){case 1===this.Type:return"EOF";case 0===this.Type:return n;case 17===this.Type:return`${r}:[${s=n,s.replace(/ /g,"␣").replace(/\t/g,"→")}]`;case this.Type>19:return`<${n}>`;case t.length>50:return`${r}:${n.substring(0,20)}...`;default:return`${r}:[${n}]`}var s}},boolRe=/^(true|false)$/,intRe=/^[-+]?\d+$/,floatRe=/^[-+]?\d*\.\d+$/,_ItemType_name="tErrortEOFTypeLeadSummaryDividerTypeFrontMatterYAMLTypeFrontMatterTOMLTypeFrontMatterJSONTypeFrontMatterORGTypeIgnoretLeftDelimScNoMarkuptRightDelimScNoMarkuptLeftDelimScWithMarkuptRightDelimScWithMarkuptScClosetScNametScNameInlinetScParamtScParamValtIndentationtTexttKeywordMarker",_ItemType_index=[0,6,10,32,51,70,89,107,117,137,158,180,203,211,218,231,239,250,262,267,281];new Uint8Array([239,187,191]);var summaryDivider=(new TextEncoder).encode("\x3c!--more--\x3e"),summaryDividerOrg=(new TextEncoder).encode("# more"),delimTOML=(new TextEncoder).encode("+++"),delimYAML=(new TextEncoder).encode("---"),delimOrg=(new TextEncoder).encode("#+"),leftDelimSc=(new TextEncoder).encode("{{"),leftDelimScNoMarkup=(new TextEncoder).encode("{{<"),rightDelimScNoMarkup=(new TextEncoder).encode(">}}"),leftDelimScWithMarkup=(new TextEncoder).encode("{{%"),rightDelimScWithMarkup=(new TextEncoder).encode("%}}"),leftComment=(new TextEncoder).encode("/*"),rightComment=(new TextEncoder).encode("*/"),inlineIdentifier=(new TextEncoder).encode("inline "),sectionHandlers=class{l;skipAll;handlers;skipIndexes;constructor(e){this.l=e,this.skipAll=!1,this.handlers=[],this.skipIndexes=[]}skip(){if(this.skipAll)return-1;this.skipIndexes=[];let e=!1;for(const t of this.handlers){if(t.skipAll)continue;const n=t.skip();-1!==n&&(e=!0,this.skipIndexes.push(n))}return e?function(...e){let t=-1;for(const n of e)n<0||(-1===t||n<t)&&(t=n);return t}(...this.skipIndexes):(this.skipAll=!0,-1)}lex(e){if(this.skipAll)return null;this.l.pos>this.l.start&&this.l.emit(18);for(const t of this.handlers){if(t.skipAll)continue;const[n,r]=t.lexFunc(e,t.l);if(null===n||r)return n}return this.l.pos++,e}},sectionHandler=class{l;skipAll;skipFunc;lexFunc;constructor(e,t,n){this.l=e,this.skipAll=!1,this.skipFunc=t,this.lexFunc=n}skip(){if(this.skipAll)return-1;const e=this.skipFunc(this.l);return-1===e&&(this.skipAll=!0),e}};function isSpace(e){return 32===e||9===e}function isAlphaNumericOrHyphen(e){return isAlphaNumeric(e)||45===e}function isEndOfLine(e){return 13===e||10===e}function isAlphaNumeric(e){return 95===e||e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57}var Iterator=class{items;lastPos;constructor(e){this.items=e,this.lastPos=-1}Next(){return this.lastPos++,this.Current()}Current(){if(this.lastPos>=this.items.length){const e=new Item;return e.Type=0,e.Err=new Error("no more tokens"),e}return this.items[this.lastPos]}Backup(){if(this.lastPos<0)throw new Error("need to go forward before going back");this.lastPos--}Pos(){return this.lastPos}IsValueNext(){const e=this.Peek();return 0!==e.Type&&1!==e.Type}Peek(){return this.items[this.lastPos+1]}PeekWalk(e){for(let t=this.lastPos+1;t<this.items.length&&e(this.items[t]);t++);}Consume(e){for(let t=0;t<e;t++){const e=this.Next();if(0===e.Type||1===e.Type){this.Backup();break}}}LineNumber(e){const t=new Uint8Array([10]),n=e.slice(0,this.Current().low);let r=0;for(let e=0;e<n.length;e++)n[e]===t[0]&&r++;return r+1}},pageLexer=class{input;stateStart;state;pos;start;width;sectionHandlers;cfg;summaryDivider;summaryDividerChecked;lexerShortcodeState;items;err;inFrontMatter;parenDepth;constructor(e,t,n){this.input=e,this.stateStart=t,this.state=null,this.pos=0,this.start=0,this.width=0,this.cfg=n,this.summaryDivider=null,this.summaryDividerChecked=!1,this.err=null,this.items=[],this.inFrontMatter=!1,this.parenDepth=0,this.lexerShortcodeState={currLeftDelimItem:8,currRightDelimItem:9,isInline:!1,currShortcodeName:"",closingState:0,elementStepNum:0,paramElements:0,paramState:0,openShortcodes:{}},this.lexSummaryDivider=this.lexSummaryDivider.bind(this),this.lexMainSection=this.lexMainSection.bind(this),this.lexIdentifierInShortcode=this.lexIdentifierInShortcode.bind(this),this.lexEndOfShortcode=this.lexEndOfShortcode.bind(this),this.lexShortcodeLeftDelim=this.lexShortcodeLeftDelim.bind(this),this.lexShortcodeRightDelim=this.lexShortcodeRightDelim.bind(this),this.lexShortcodeParam=this.lexShortcodeParam.bind(this),this.lexShortcodeValue=this.lexShortcodeValue.bind(this),this.lexShortcodeValueQuoted=this.lexShortcodeValueQuoted.bind(this),this.lexShortcodeValueUnquoted=this.lexShortcodeValueUnquoted.bind(this),this.lexInsideShortcode=this.lexInsideShortcode.bind(this),this.lexDone=this.lexDone.bind(this),this.sectionHandlers=function(e){const t=new sectionHandlers(e),n=new sectionHandler(e,e=>e.index(leftDelimSc),(e,t)=>{if(!t.isShortCodeStart())return[e,!1];if(t.lexerShortcodeState.isInline){const e=t.input.slice(t.pos+3),n=function(e){for(let t=0;t<e.length;t++)if(!isSpace(e[t])){if(47===e[t])return t;break}return-1}(e);if(n!==t.input.length-1){const r=(new TextDecoder).decode(e.slice(n+1)).trim();if(-1===n||!r.startsWith(t.lexerShortcodeState.currShortcodeName+" "))return[t.errorf("inline shortcodes do not support nesting"),!0]}}return t.hasPrefix(leftDelimScWithMarkup)?(t.lexerShortcodeState.currLeftDelimItem=10,t.lexerShortcodeState.currRightDelimItem=11):(t.lexerShortcodeState.currLeftDelimItem=8,t.lexerShortcodeState.currRightDelimItem=9),[t.lexShortcodeLeftDelim,!0]}),r=new sectionHandler(e,e=>e.summaryDividerChecked||!e.summaryDivider?-1:e.index(e.summaryDivider),(e,t)=>t.summaryDivider&&t.hasPrefix(t.summaryDivider)?(t.summaryDividerChecked=!0,t.pos+=t.summaryDivider.length,t.consumeSpace(),t.emit(2),[e,!0]):[e,!1]);return t.handlers=[n,r],t.skipIndexes=new Array(t.handlers.length),t}(this)}Iterator(){return e=this.items,new Iterator(e);var e}Input(){return this.input}run(){for(this.state=this.stateStart;null!==this.state;)this.state=this.state(this);return this}next(){if(this.pos>=this.input.length)return this.width=0,-1;const e=this.input[this.pos];return this.width=1,this.pos+=this.width,e}peek(){const e=this.next();return this.backup(),e}backup(){this.pos-=this.width}append(e){e.Pos()<this.input.length&&(7===e.Type&&239===this.input[e.Pos()]?e.firstByte=239:e.firstByte=this.input[e.Pos()]),this.items.push(e)}emit(e){const t=()=>{this.start=this.pos};if(18===e)for(let n=this.pos-1;n>=this.start;n--){const r=this.input[n];if(32!==r&&9!==r&&13!==r&&10!==r)break;if(n===this.start&&10!==r){const e=new Item;return e.Type=17,e.low=this.start,e.high=this.pos,this.append(e),void t()}if(10===r&&n<this.pos-1){const r=new Item;r.Type=e,r.low=this.start,r.high=n+1,this.append(r);const s=new Item;return s.Type=17,s.low=n+1,s.high=this.pos,this.append(s),void t()}if(10===r&&n===this.pos-1)break}const n=new Item;n.Type=e,n.low=this.start,n.high=this.pos,n.low<this.input.length&&(7===e&&239===this.input[n.low]?n.firstByte=239:n.firstByte=this.input[n.low]),this.append(n),t()}emitString(e){const t=new Item;t.Type=e,t.low=this.start,t.high=this.pos,t.isString=!0,this.pos>this.start&&(t.firstByte=this.input[this.start]),this.items.push(t),this.start=this.pos}isEOF(){return this.pos>=this.input.length}ignoreEscapesAndEmit(e,t){let n=this.start,r=n;const s=[];for(;n<this.pos;){const e=1;92===this.input[n]&&(n>r&&s.push({Low:r,High:n}),r=n+e),n+=e}if(r<this.pos&&s.push({Low:r,High:this.pos}),s.length>0){const t=new Item;t.Type=e,t.segments=s,s[0].High>s[0].Low&&(t.firstByte=this.input[s[0].Low]),this.items.push(t),this.start=this.pos}this.start=this.pos}current(){return this.input.slice(this.start,this.pos)}ignore(){this.start=this.pos}errorf(e,...t){const n=new Error(e.replace(/%[a-z]/g,()=>String(t.shift()))),r=new Item;return r.Type=0,r.Err=n,r.low=this.start,r.high=this.pos,this.append(r),null}consumeCRLF(){let e=!1;const t=this.peek();return 13===t?(this.next(),10===this.peek()&&(this.next(),e=!0)):10===t&&(this.next(),e=!0),e}consumeToSpace(){for(;;){const e=this.next();if(-1===e||isSpace(e))return void this.backup()}}consumeSpace(){for(;;){const e=this.next();if(-1===e||!this.isUnicodeSpace(e))return void this.backup()}}isUnicodeSpace(e){return 32===e||9===e||10===e||12===e||13===e||133===e||160===e||8192===e||8193===e||8194===e||8195===e||8196===e||8197===e||8198===e||8199===e||8200===e||8201===e||8202===e||8232===e||8233===e||8239===e||8287===e||12288===e}index(e){const t=this.input.slice(this.pos),n=e.length,r=t.length;if(n>r)return-1;e:for(let s=0;s<=r-n;s++){for(let r=0;r<n;r++)if(t[s+r]!==e[r])continue e;return s}return-1}hasPrefix(e){if(this.pos+e.length>this.input.length)return!1;for(let t=0;t<e.length;t++)if(this.input[this.pos+t]!==e[t])return!1;return!0}isShortCodeStart(){return this.hasPrefix(leftDelimScWithMarkup)||this.hasPrefix(leftDelimScNoMarkup)}lexFrontMatterSection(e,t,n,r){for(let e=0;e<2;e++)if(this.next()!==t)return this.errorf(`invalid ${n} delimiter`);let s,a=this.consumeCRLF();for(this.ignore();;){if(!a&&(s=this.next(),-1===s))return this.errorf(`EOF looking for end ${n} front matter delimiter`);if((a||isEndOfLine(s))&&this.hasPrefix(r)){this.emit(e),this.pos+=3,this.consumeCRLF(),this.ignore();break}a=!1}return()=>this.lexMainSection()}currentLeftShortcodeDelimItem(){return this.lexerShortcodeState.currLeftDelimItem}currentRightShortcodeDelimItem(){return this.lexerShortcodeState.currRightDelimItem}currentLeftShortcodeDelim(){return 10===this.lexerShortcodeState.currLeftDelimItem?leftDelimScWithMarkup:leftDelimScNoMarkup}currentRightShortcodeDelim(){return 11===this.lexerShortcodeState.currRightDelimItem?rightDelimScWithMarkup:rightDelimScNoMarkup}lexIdentifier(){for(;;)if(!isAlphaNumericOrHyphen(this.next()))return this.backup(),0===(new TextDecoder).decode(this.input.slice(this.start,this.pos)).length||this.emit(15),null}lexMainSection(){if(this.isEOF())return()=>this.lexDone();const e=this.sectionHandlers.skip();if(-1===e)return this.pos=this.input.length,()=>this.lexDone();e>0&&(this.pos+=e);const t=this.sectionHandlers.lex(this.lexMainSection);return null!==t?t:(this.pos=this.input.length,this.lexDone)}lexInlineShortcodeContent(){for(;;){if(this.pos>=this.input.length)return this.errorf("unclosed inline shortcode");if(this.hasPrefix(leftDelimScWithMarkup)||this.hasPrefix(leftDelimScNoMarkup))return this.errorf("inline shortcodes do not support nesting");if(this.hasPrefix(this.currentRightShortcodeDelim()))return this.backup(),this.pos>this.start&&this.emit(18),()=>this.lexShortcodeRightDelim();this.next()}}lexIdentifierInShortcode(){let e=!1;for(;;){const t=this.next();switch(!0){case isAlphaNumericOrHyphen(t):case 47===t:break;case 46===t:if(this.lexerShortcodeState.isInline=this.hasPrefix(inlineIdentifier),!this.lexerShortcodeState.isInline)return this.errorf("period in shortcode name only allowed for inline identifiers");break;default:this.backup();const n=(new TextDecoder).decode(this.input.slice(this.start,this.pos));return this.lexerShortcodeState.closingState>0&&!this.lexerShortcodeState.openShortcodes[n]?this.errorf(`closing tag for shortcode '${n}' does not match start tag`):(this.lexerShortcodeState.closingState>0&&(this.lexerShortcodeState.openShortcodes[n]=!1,e=!0),this.lexerShortcodeState.closingState=0,this.lexerShortcodeState.currShortcodeName=n,this.lexerShortcodeState.openShortcodes[n]=!0,this.lexerShortcodeState.elementStepNum++,this.lexerShortcodeState.isInline?this.emit(14):this.emit(13),e?()=>this.lexEndOfShortcode():this.lexInsideShortcode)}}}lexEndOfShortcode(){return this.lexerShortcodeState.isInline=!1,this.hasPrefix(this.currentRightShortcodeDelim())?()=>this.lexShortcodeRightDelim():!0!==isSpace(this.next())?this.errorf("unclosed shortcode"):(this.ignore(),()=>this.lexEndOfShortcode())}lexShortcodeLeftDelim(){return this.pos+=this.currentLeftShortcodeDelim().length,this.isComment()?()=>this.lexComment():(this.emit(this.lexerShortcodeState.currLeftDelimItem),this.lexerShortcodeState.elementStepNum=0,this.lexerShortcodeState.paramElements=0,this.lexerShortcodeState.paramState=0,this.start=this.pos,this.lexInsideShortcode)}peekString(e){const t=(Uint8Array,e.length);if(this.pos+t>this.input.length)return null;const n=this.input.slice(this.pos,this.pos+t);if(e instanceof Uint8Array){for(let r=0;r<t;r++)if(n[r]!==e[r])return null;return(new TextDecoder).decode(n)}{const t=(new TextDecoder).decode(n);return t===e?t:null}}lexSummaryDivider(){if(!this.hasPrefix(summaryDivider))return null;if(this.start<this.pos){const e=new Item;e.Type=18,e.low=this.start,e.high=this.pos,e.low<this.input.length&&(e.firstByte=this.input[e.low]),this.append(e)}const e=new Item;return e.Type=2,e.low=this.pos,e.high=this.pos+summaryDivider.length,e.low<this.input.length&&(e.firstByte=this.input[e.low]),this.append(e),this.pos+=summaryDivider.length,this.start=this.pos,()=>this.lexMainSection()}handleBOM(){if(this.pos+3<=this.input.length){const e=this.input.slice(this.pos,this.pos+3);if(239===e[0]&&187===e[1]&&191===e[2]){const e=new Item;return e.Type=7,e.low=this.pos,e.high=this.pos+3,e.firstByte=239,this.append(e),this.pos+=3,this.start=this.pos,!0}}return!1}lexIntroSection(){this.summaryDivider=summaryDivider,0===this.pos&&this.handleBOM();e:for(;;){const e=this.next();if(-1===e)break;switch(!0){case 43===e:if(this.hasPrefix(delimTOML.slice(1)))return()=>this.lexFrontMatterSection(4,e,"TOML",delimTOML);this.backup();break e;case 45===e:if(this.hasPrefix(delimYAML.slice(1)))return()=>this.lexFrontMatterSection(3,e,"YAML",delimYAML);this.backup();break e;case 123===e:return lexFrontMatterJSON;case 35===e:return lexFrontMatterOrgMode;case 65279===e:this.emit(7);break;case!isSpace(e)&&!isEndOfLine(e):break e}}return()=>this.lexMainSection()}lexInsideShortcode(){if(this.hasPrefix(this.currentRightShortcodeDelim()))return this.lexShortcodeRightDelim;const e=this.next();if(-1===e)return this.errorf("unclosed shortcode action");if(isSpace(e)||isEndOfLine(e))this.ignore();else{if(61===e){this.consumeSpace(),this.ignore();const e=this.peek();return 34===e||92===e?this.lexShortcodeQuotedParamVal(92!==e,16):96===e?this.lexShortCodeParamRawStringVal(16):this.lexShortcodeParamVal}if(47===e){if(""===this.lexerShortcodeState.currShortcodeName)return this.errorf("got closing shortcode, but none is open");this.lexerShortcodeState.closingState++,this.lexerShortcodeState.isInline=!1,this.emit(12)}else{if(92!==e)return this.lexerShortcodeState.elementStepNum>0&&(isAlphaNumericOrHyphen(e)||34===e||96===e)?(this.backup(),this.lexShortcodeParam(!1)):isAlphaNumeric(e)?(this.backup(),this.lexIdentifierInShortcode):this.errorf(`unrecognized character in shortcode action: U+${e.toString(16).toUpperCase()} '${String.fromCharCode(e)}'. Note: Parameters with non-alphanumeric args must be quoted`);if(this.ignore(),34===this.peek()||96===this.peek())return this.lexShortcodeParam(!0)}}return this.lexInsideShortcode}lexShortcodeParam(e){let t,n=!0,r=!1;for(;;){if(t=this.next(),n){if(34===t||96===t&&!e)return 2===this.lexerShortcodeState.paramElements?this.errorf("got quoted positional parameter. Cannot mix named and positional parameters"):(this.lexerShortcodeState.paramElements=1,this.backup(),34===t?()=>this.lexShortcodeQuotedParamVal(!e,15):()=>this.lexShortCodeParamRawStringVal(15));if(96===t&&e)return this.errorf("unrecognized escape character");n=!1}else if(61===t){this.backup(),r=!0;break}if(!isAlphaNumericOrHyphen(t)&&46!==t){this.backup();break}}if(0===this.lexerShortcodeState.paramElements)this.lexerShortcodeState.paramElements++,r&&this.lexerShortcodeState.paramElements++;else{if(r&&1===this.lexerShortcodeState.paramElements)return this.errorf(`got named parameter '${(new TextDecoder).decode(this.current())}'. Cannot mix named and positional parameters`);if(!r&&2===this.lexerShortcodeState.paramElements)return this.errorf(`got positional parameter '${(new TextDecoder).decode(this.current())}'. Cannot mix named and positional parameters`)}return this.emit(15),this.lexInsideShortcode}lexShortcodeParamVal(){const e=this.next();if(isSpace(e))return this.ignore(),()=>this.lexShortcodeParamVal();switch(this.backup(),e){case 34:return this.next(),this.ignore(),()=>this.lexShortcodeQuotedParamVal(!1,16);case 96:return this.next(),this.ignore(),()=>this.lexShortCodeParamRawStringVal(16);default:return()=>this.lexShortcodeValueUnquoted()}}lexShortcodeValueUnquoted(){for(;;){const e=this.next();if(-1===e||isSpace(e)||this.isRightShortcodeDelim())return this.backup(),this.pos>this.start&&this.emit(16),this.lexInsideShortcode}}lexShortcodeQuotedParamVal(e,t){let n=!1,r=!1,s=0;e:for(;;){const t=this.next();switch(!0){case 92===t:if(34===this.peek()){if(n&&!e){this.backup();break e}n&&(r=!0,s=1)}else if(96===this.peek())return this.errorf("unrecognized escape character");break;case-1===t:case 10===t:return this.errorf(`unterminated quoted string in shortcode parameter-argument: '${(new TextDecoder).decode(this.current())}'`);case 34===t:if(0===s){if(n){this.backup();break e}n=!0,this.ignore()}else s=0}}r?this.ignoreEscapesAndEmit(t,!0):this.emitString(t);const a=this.next();return 92===a?34===this.peek()&&(this.ignore(),this.next(),this.ignore()):34===a?this.ignore():this.backup(),this.lexInsideShortcode}lexShortCodeParamRawStringVal(e){let t=!1;e:for(;;)switch(this.next()){case 96:if(t){this.backup();break e}t=!0,this.ignore();break;case-1:return this.errorf(`unterminated raw string in shortcode parameter-argument: '${(new TextDecoder).decode(this.input.slice(this.start,this.pos))}'`)}return this.emitString(e),this.next(),this.ignore(),this.lexInsideShortcode}lexDone(){return this.pos>this.start&&this.emit(18),this.emit(1),null}lexShortcodeRightDelim(){return this.pos+=this.currentRightShortcodeDelim().length,this.emit(this.lexerShortcodeState.currRightDelimItem),this.lexerShortcodeState.closingState=0,()=>this.lexMainSection()}lexShortcodeValue(){switch(this.next()){case-1:return this.errorf("unterminated quoted string in shortcode parameter");case 32:case 9:return this.ignore(),()=>this.lexShortcodeValue();case 34:return this.ignore(),()=>this.lexShortcodeValueQuoted();default:return this.backup(),()=>this.lexShortcodeValueUnquoted()}}lexShortcodeValueQuoted(){for(;;)switch(this.next()){case-1:return this.errorf("unterminated quoted string in shortcode parameter");case 92:34===this.peek()&&this.next();break;case 34:return this.backup(),this.emitString(16),this.next(),this.ignore(),this.lexInsideShortcode}}isRightShortcodeDelim(){return this.hasPrefix(this.currentRightShortcodeDelim())}lexComment(){const e=this.index(new Uint8Array([...rightComment,...this.currentRightShortcodeDelim()]));return e<=1?this.errorf("comment must be closed"):(this.emit(18),this.pos+=leftComment.length,this.ignore(),this.pos+=e-leftComment.length,this.emit(18),this.pos+=rightComment.length,this.ignore(),this.pos+=this.currentRightShortcodeDelim().length,this.emit(18),this.lexMainSection)}isComment(){return!(this.pos+2>this.input.length)&&47===this.input[this.pos]&&42===this.input[this.pos+1]}};function lexFrontMatterJSON(e){e.backup();let t=!1,n=0;for(;;){const r=e.next();switch(!0){case-1===r:return e.errorf("unexpected EOF parsing JSON front matter");case 123===r:t||n++;break;case 125===r:t||n--;break;case 34===r:t=!t;break;case 92===r:e.next()}if(0===n)break}return e.consumeCRLF(),e.emit(5),()=>e.lexMainSection()}function lexFrontMatterOrgMode(e){if(e.summaryDivider=summaryDividerOrg,e.backup(),!e.hasPrefix(delimOrg))return()=>e.lexMainSection();e:for(;;){const t=e.next();switch(!0){case 10===t:if(!e.hasPrefix(delimOrg))break e;break;case-1===t:break e}}return e.emit(6),()=>e.lexMainSection()}function lexIntroSection(e){return e.lexIntroSection()}var log14=getDomainLogger("markdown",{component:"pageparser"});init_log();var log15=getDomainLogger("markdown",{component:"parseinfo"}),SourceParseInfo=class{source;posMainContent=-1;itemsStep1=[];handlers;constructor(e,t){this.source=e,this.handlers=t,this.validateHandlers()}validateHandlers(){if(!this.handlers.frontMatterHandler())throw new Error("no front matter handler");if(!this.handlers.summaryHandler())throw new Error("no summary handler");if(!this.handlers.shortcodeHandler())throw new Error("no shortcode handler");if(!this.handlers.bytesHandler())throw new Error("no bytes handler")}isEmpty(){return 0===this.itemsStep1.length}async parse(){const e=function(e,t={}){const[n,r]=function(e,t){const[n,r]=function(e,t){const n=function(e,t,n){return new pageLexer(e,lexIntroSection,n)}(e,0,t);return n.run(),[n,null]}(e,t);return r?[[],r]:[n.items,n.err]}(e,t);if(r)throw log14.error("Error parsing bytes:",r),r;return n}(this.source,{});this.itemsStep1=e}async handle(){if(this.isEmpty())return;const e=new Iterator(this.itemsStep1);for(;;){const t=e.Next();try{if(7===t.Type)log15.info(`Ignoring item at position ${t.Pos()}: ${t.ValStr(this.source)}`);else if(t.IsFrontMatter()){await this.handlers.frontMatterHandler()(t);const n=e.Peek();n.IsDone()||(this.posMainContent=n.Pos())}else if(2===t.Type)await this.handlers.summaryHandler()(t,e);else if(t.IsLeftShortcodeDelim()){e.Backup();const t=e.Current();await this.handlers.shortcodeHandler()(t,e)}else{if(t.IsEOF())break;if(t.IsError())throw log15.error(`Error parsing item at position ${t.Pos()}: ${t.Err}`),this.createError(t.Err||new Error("Unknown parsing error"),t);await this.handlers.bytesHandler()(t)}}catch(e){throw this.createError(e,t)}}}getMainContentPosition(){return this.posMainContent}getItems(){return this.itemsStep1}getSource(){return this.source}createError(e,t){const n=function(e,t,n){const r="string"==typeof t?(s=t,(new TextEncoder).encode(s)):t;var s;if(n<0)return{filename:e,line:1,column:1,offset:0};let a=1,i=1;for(let e=0;e<Math.min(n,r.length);e++)10===r[e]?(a++,i=1):i++;return{filename:e,line:a,column:i,offset:n}}("",this.source,t.Pos()),r=new Error(`${e.message} at line ${n.line}, column ${n.column}`);return r.position=n,r}};init_log();var log16=getDomainLogger("markdown",{component:"vo/shortcode"}),ShortcodeImpl=class{name;params;pos;length;rawContent;placeholder;inline;closed;inner;ordinal;indentation;doMarkup;isClosing;info;templs;constructor(e=0,t="",n=null,r=0,s=0,a=!1,i=!1){this.ordinal=e,this.name=t,this.params=n,this.pos=r,this.length=s,this.rawContent="",this.inline=a,this.closed=i,this.doMarkup=!1,this.isClosing=!1,this.placeholder="",this.inner=[]}needsInner(){return!this.inline}},ShortcodeParser=class{shortcodes=[];nameSet=new Set;source;ordinal=0;pid;openShortcodes=new Map;paramElements=0;constructor(e,t=Date.now()){this.source=e,this.pid=t}parseItem(e,t){const n=this.extractShortcode(this.ordinal,0,t);if(!n)throw new Error("Failed to extract shortcode");n.pos=e.Pos()+e.ValStr(this.source).length,n.length=t.Current().Pos()+t.Current().ValStr(this.source).length-n.pos;const r=this.source.slice(n.pos,n.pos+n.length);return n.rawContent=(new TextDecoder).decode(r),n.name&&this.nameSet.add(n.name),n.params??=[],n.placeholder=createShortcodePlaceholder("s",this.pid,this.ordinal),this.ordinal++,this.shortcodes.push(n),n}extractShortcode(e,t,n){const r=new ShortcodeImpl(e);if(n.Pos()>0){n.Backup();const e=n.Next();e.IsIndentation()&&(r.indentation=e.ValStr(this.source))}let s=0,a=0;const i=t+1;let o=!1;const l="failed to extract shortcode";let c=0;for(;;){const e=n.Next();if(e.IsLeftShortcodeDelim()){const t=n.Peek();if(t.IsRightShortcodeDelim())throw new Error("shortcode has no name");if(t.IsShortcodeClose())continue;if(s>0){n.Backup();const e=this.extractShortcode(a,i,n);a++,e&&e.name&&(this.nameSet.add(e.name),Array.isArray(r.inner)||(r.inner=[]),r.inner.push(e))}else r.doMarkup=e.IsShortcodeMarkupDelimiter();s++}else if(e.IsRightShortcodeDelim()){if(!r.inline&&!r.needsInner())return this.openShortcodes.set(r.name,!1),r}else{if(e.IsShortcodeClose()){o=!0;const e=n.Peek();if(!r.inline&&!r.needsInner()){if(e.IsError())continue;throw new Error(`${l}: shortcode "${r.name}" does not evaluate .Inner or .InnerDeindent, yet a closing tag was provided`)}return e.IsRightShortcodeDelim()?n.Consume(1):(r.isClosing=!0,n.Consume(2)),r.inline||this.openShortcodes.set(r.name,!1),r}if(e.IsText()){Array.isArray(r.inner)||(r.inner=[]);const t=e.ValStr(this.source);r.inner.push(t)}else if(e.IsShortcodeName()||e.IsInlineShortcodeName()){if(r.name=e.ValStr(this.source).trim(),r.inline=e.IsInlineShortcodeName(),this.openShortcodes.has(r.name)&&this.openShortcodes.get(r.name))throw new Error(`shortcode ${r.name} nested in itself`);if(r.inline||this.openShortcodes.set(r.name,!0),r.inline){const e=this.source.slice(n.Pos()+3),t=indexNonWhiteSpace2(e,"/");if(t!==this.source.length-1){const n=(new TextDecoder).decode(e.slice(t+1));if(-1===t||!n.startsWith(r.name+" "))throw new Error("inline shortcodes do not support nesting")}}}else if(e.IsShortcodeParam()){if(!n.IsValueNext()){log16.warn(`${l}: shortcode "${r.name}" has a parameter without a value`);continue}if(n.Peek().IsShortcodeParamVal())if(null===r.params||void 0===r.params){const t={},s=e.ValStr(this.source);n.Next(),t[s]=n.Current().ValTyped(this.source),r.params=t}else{if(Array.isArray(r.params))throw new Error(`${l}: invalid state: invalid param type Array for shortcode "${r.name}", expected a map`);{const t=e.ValStr(this.source);n.Next(),r.params[t]=n.Current().ValTyped(this.source)}}else if(null===r.params||void 0===r.params){const t=[];t.push(e.ValTyped(this.source)),r.params=t}else{if(!Array.isArray(r.params))throw new Error(`${l}: invalid state: invalid param type Object for shortcode "${r.name}", expected an array`);r.params.push(e.ValTyped(this.source))}}else if(e.IsShortcodeParamVal()){if(0===c&&(c=1),Array.isArray(r.params))r.params.push(e.ValTyped(this.source));else if(null===r.params||void 0===r.params){const t=[];t.push(e.ValTyped(this.source)),r.params=t}}else if(e.IsDone()){if(!e.IsError()&&!o&&r.needsInner())throw new Error(`${l}: shortcode "${r.name}" must be closed or self-closed`);n.Backup();break}}}return r.inline||this.openShortcodes.set(r.name,!1),r}getShortcodes(){return this.shortcodes}getNames(){return Array.from(this.nameSet)}},SHORTCODE_PLACEHOLDER_PREFIX=(createShortcodePlaceholder("TOC",0,0),"HAHAHUGOSHORTCODE");function createShortcodePlaceholder(e,t,n){return`${SHORTCODE_PLACEHOLDER_PREFIX}${e}${t}${n}HBHB`}function indexNonWhiteSpace2(e,t){const n=t.charCodeAt(0);for(let t=0;t<e.length;t++)if(!isSpace2(e[t])&&e[t]===n)return t;return-1}function isSpace2(e){return 32===e||9===e||13===e||10===e}var MediaType=class{type;mainType;subType;delimiter;firstSuffix;mimeSuffix;suffixesCSV;constructor(e){this.type=e.type,this.mainType=e.mainType,this.subType=e.subType,this.delimiter=e.delimiter,this.firstSuffix=e.firstSuffix,this.mimeSuffix=e.mimeSuffix,this.suffixesCSV=e.suffixesCSV}sub(){if(this.subType)return this.subType;const e=this.type.split("/");return 2===e.length?e[1].split("+")[0]:""}getMimeSuffix(){if(this.mimeSuffix)return this.mimeSuffix;const e=this.type.indexOf("+");return-1!==e?this.type.substring(e+1):void 0}getSuffixList(){return this.suffixesCSV?this.suffixesCSV.split(","):[]}};init_log(),getDomainLogger("markdown",{component:"content"});var INTERNAL_SUMMARY_DIVIDER_PRE=(new TextEncoder).encode("\n\nHUGOMORE42\n\n"),Content=class{hasSummaryDivider=!1;summaryTruncated=!1;rawSource;items=[];renderer;constructor(e,t){this.rawSource=e,this.renderer=t}isEmpty(){return!this.rawSource||0===this.rawSource.length}setSummaryDivider(){this.hasSummaryDivider=!0}getHasSummaryDivider(){return this.hasSummaryDivider}setSummaryTruncated(){this.summaryTruncated=!0}getTruncated(){return this.summaryTruncated}addReplacement(e,t){const n={val:e,source:t};this.items.push(n)}addShortcode(e){this.items.push(e)}addItem(e){this.items.push(e)}addItems(...e){this.items.push(...e)}rawContent(){return(new TextDecoder).decode(this.rawSource)}pureContent(){const e=[],t=new TextDecoder,n=new TextEncoder;for(const t of this.items)if(this.isItem(t)){const n=this.rawSource.slice(t.Pos(),t.Pos()+t.Val(this.rawSource).length);e.push(n)}else this.isContentReplacement(t)?e.push(t.val):this.isShortcode(t)&&e.push(n.encode(t.placeholder));const r=e.reduce((e,t)=>e+t.length,0),s=new Uint8Array(r);let a=0;for(const t of e)s.set(t,a),a+=t.length;return t.decode(s)}pureContentWithoutPlaceholder(){const e=[],t=new TextDecoder;for(const t of this.items)if(this.isItem(t)){const n=this.rawSource.slice(t.Pos(),t.Pos()+t.Val(this.rawSource).length);e.push(n)}else this.isContentReplacement(t)?e.push(t.val):this.isShortcode(t);const n=e.reduce((e,t)=>e+t.length,0),r=new Uint8Array(n);let s=0;for(const t of e)r.set(t,s),s+=t.length;return t.decode(r)}renderedContent(e){let t=this.pureContent();if(e)for(const n of this.items)if(this.isShortcode(n)){const r=e(n);t=t.replace(n.placeholder,r)}return t}async renderedContentAsync(e){let t=await this.renderer.render(this.pureContent());if(e)for(const n of this.items)if(this.isShortcode(n))try{const r=await e(n);t=t.replace(n.placeholder,r)}catch(e){}return t}getItems(){return[...this.items]}getShortcodes(){return this.items.filter(this.isShortcode)}getTextItems(){return this.items.filter(this.isItem)}getReplacements(){return this.items.filter(this.isContentReplacement)}extractSummary(e,t){const n=(new TextDecoder).decode(e),r=this.extractSummaryFromHTML(t,n,70,this.containsCJK(n)),s=r.summaryLowHigh.high>r.summaryLowHigh.low?n.substring(r.summaryLowHigh.low,r.summaryLowHigh.high).trim():"";if(s)return this.summaryTruncated=r.truncated,{summary:s,truncated:r.truncated};const a=this.trimShortHTML(e);return this.summaryTruncated=a.length<e.length,{summary:(new TextDecoder).decode(e),truncated:this.summaryTruncated}}extractSummaryFromHTML(e,t,n,r){const s={source:t,summaryLowHigh:{low:0,high:t.length},truncated:!1};if(n<=0)return s;let a=0;const i=t.split(/\s+/);for(let e=0;e<i.length&&a<n;e++){const o=i[e].trim();if(0!==o.length&&!this.isProbablyHTMLToken(o)){if(r){const e=this.stripHTML(o),t=[...e].length;a+=e.length===e.replace(/[^\u0000-\u007F]/g,"").length?1:t}else a+=1;if(a>=n){const n=i.slice(0,e+1).join(" "),r=t.indexOf(n)+n.length;s.summaryLowHigh={low:0,high:Math.min(r,t.length)},s.truncated=!0;break}}}return s}containsCJK(e){return/[\u4e00-\u9fff\u3400-\u4dbf\u3040-\u309f\u30a0-\u30ff\uac00-\ud7af]/.test(e)}isProbablyHTMLToken(e){return">"===e||/^<\/?[A-Za-z]+>?$/.test(e)||/^[A-Za-z]+=["']/.test(e)}stripHTML(e){return e.replace(/<[^>]*>/g,"").replace(/\s+/g," ").trim()}trimShortHTML(e){const t=new TextDecoder,n=new TextEncoder;let r=t.decode(e);return 1===(r.match(/<p>/g)||[]).length&&(r=r.trim(),r.startsWith("<p>")&&r.endsWith("</p>")&&(r=r.slice(3,-4).trim())),n.encode(r)}cleanDividerPlaceholders(e){return this.hasSummaryDivider?e.replace(new RegExp("HUGOMORE42","g"),""):e}getDividedSummary(e){const t=e;if(this.hasSummaryDivider){const e=t.indexOf("HUGOMORE42");if(-1!==e)return t.substring(0,e).trim()}return""}async getRenderedSummary(e,t){if(this.hasSummaryDivider&&e)return this.getDividedSummary(e);const n=this.pureContentWithoutPlaceholder(),r=(new TextEncoder).encode(n),s=new MediaType({type:"text/html",mainType:"text",subType:"html",delimiter:".",firstSuffix:{suffix:"html",fullSuffix:".html"},mimeSuffix:"",suffixesCSV:"html"}),a=this.extractSummary(r,s);let i=a.summary;return a.truncated&&(i+="..."),t&&i.length>t&&(i=i.substring(0,t).trim()+"..."),await this.renderer.render(i)}getWordCount(){return this.pureContent().trim().split(/\s+/).filter(e=>e.length>0).length}getReadingTime(e=200){const t=this.getWordCount();return Math.ceil(t/e)}isItem(e){return"Type"in e&&"firstByte"in e&&"low"in e&&"high"in e}isShortcode(e){return"name"in e&&"placeholder"in e&&"params"in e}isContentReplacement(e){return"val"in e&&"source"in e}},yaml=__toESM(require("js-yaml")),import_smol_toml2=require("smol-toml"),RenderingResultImpl=class{constructor(e){this.buffer=e}bytes(){return this.buffer.bytes()}toString(){return(new TextDecoder).decode(this.bytes())}},ResultImpl=class{constructor(e,t){this.parsingResult=e,this.renderingResult=t}headers(){return this.parsingResult.headers()}tableOfContents(){return this.parsingResult.tableOfContents()}bytes(){return this.renderingResult.bytes()}};init_log();var log18=getDomainLogger("markdown",{component:"MarkdownImpl"}),MarkdownImpl=class{constructor(e,t){this.renderer=e,this.highlighter=t}async render(e,t){const n=await this.parse(e),r=await this.renderToBytes(e,t,n);return new ResultImpl(n,r)}async highlight(e,t,n){return this.highlighter.highlight(e,t,n)}async highlightCodeBlock(e,t){return this.highlighter.highlightCodeBlock(e,t)}async renderCodeblock(e,t,n){return this.highlighter.renderCodeblock(e,t,n)}isDefaultCodeBlockRenderer(){return this.highlighter.isDefaultCodeBlockRenderer()}async prepareRender(e){const t=await this.parseContent(e),n=t.frontMatter?.params,r=await this.renderer.parse(t.content.pureContent());return{frontMatter:()=>n||{},toc:()=>r.tableOfContents(),render:async e=>{const r=await t.content.renderedContentAsync(e.shortcodeRenderer),s=await t.content.getRenderedSummary(r,e.maxSummaryLength),a=t.content.getWordCount(),i=t.content.getReadingTime(e.wordsPerMinute),o={renderedContent:t.content.cleanDividerPlaceholders(r),wordCount:a,readingTime:i};return n&&(o.frontMatter=n),s&&(o.summary=s),o}}}async parseAndRenderContent(e,t={}){const n=await this.parseContent(e),r=n.frontMatter?.params;let s;s=t.shortcodeRenderer&&n.shortcodes.length>0?await n.content.renderedContentAsync(t.shortcodeRenderer):n.content.pureContent();const a=await this.renderer.render(s);if(this.hasCollectedTagsSupport()){const e=this.getCollectedTags();if(e.length>0){const t=r||{},s=Array.isArray(t.tags)?t.tags:t.tags?[t.tags]:[],a=[...new Set([...s,...e])];t.tags=a,n.frontMatter&&(n.frontMatter.params=t),log18.debug(`Merged tags: YAML [${s.join(", ")}] + inline [${e.join(", ")}] = [${a.join(", ")}]`)}}const i=n.content.getDividedSummary(a),o={renderedContent:a,wordCount:n.content.getWordCount(),readingTime:n.content.getReadingTime(t.wordsPerMinute)};return r&&(o.frontMatter=r),i&&(o.summary=i),o}hasCollectedTagsSupport(){return"function"==typeof this.renderer.getCollectedTags}getCollectedTags(){return this.hasCollectedTagsSupport()?this.renderer.getCollectedTags():[]}async parseContent(e){let t;const n=new Content(e,this.renderer),r=new ShortcodeParser(e),s=[],a=function(e,t){return new SourceParseInfo(e,t)}(e,{frontMatterHandler:()=>n=>{t=this.parseFrontMatter(n,e)},summaryHandler:()=>(t,r)=>{let s=-1;r.PeekWalk(t=>(-1!==s||t.IsDone()||(s=t.Pos()),!t.IsNonWhitespace(e)||(n.setSummaryTruncated(),!1))),n.setSummaryDivider(),n.addReplacement(INTERNAL_SUMMARY_DIVIDER_PRE,t)},shortcodeHandler:()=>(e,t)=>{const a=r.parseItem(e,t);s.push(a),n.addShortcode(a)},bytesHandler:()=>e=>{n.addItem(e)}});return await a.parse(),await a.handle(),{frontMatter:t,content:n,shortcodes:s,summary:await n.getRenderedSummary(),wordCount:n.getWordCount(),readingTime:n.getReadingTime()}}parseFrontMatter(e,t){const n=e.ValStr(t);let r,s={};switch(e.Type){case 3:r="yaml",s=this.parseYAML(n);break;case 4:r="toml",s=this.parseTOML(n);break;case 5:r="json",s=this.parseJSON(n);break;case 6:r="org",s=this.parseOrg(n);break;default:r="yaml"}return{params:s,format:r}}parseYAML(e){try{const t=yaml.load(e);return t&&"object"==typeof t&&!Array.isArray(t)?t:{}}catch(e){return{}}}parseTOML(e){try{const t=(0,import_smol_toml2.parse)(e);return t&&"object"==typeof t&&!Array.isArray(t)?t:{}}catch(e){return{}}}parseJSON(e){try{return JSON.parse(e)}catch(e){return{}}}parseOrg(e){const t={},n=e.split("\n");for(const e of n){const n=e.trim();if(!n.startsWith("#+"))continue;const r=n.match(/^#\+([^:]+):\s*(.*)$/);if(r){const e=r[1].trim().toLowerCase(),n=r[2].trim();t[e]=this.parseValue(n)}}return t}parseValue(e){if(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))return e.slice(1,-1);if("true"===e)return!0;if("false"===e)return!1;if(/^-?\d+$/.test(e))return parseInt(e,10);if(/^-?\d*\.\d+$/.test(e))return parseFloat(e);if(e.startsWith("[")&&e.endsWith("]")){const t=e.slice(1,-1).trim();return t?t.split(",").map(e=>this.parseValue(e.trim())):[]}return e}async parse(e){const t=(new TextDecoder).decode(e.src);return await this.renderer.parse(t)}async renderToBytes(e,t,n){const r=(new TextDecoder).decode(e.src),s=await this.renderer.render(r),a=new BufWriter;return await a.writeString(s),new RenderingResultImpl(a)}},import_markdown_it=__toESM(require("markdown-it")),ParserResult=class{_headers=[];_toc;tokens;source;idGenerator;constructor(e,t,n){this.tokens=e,this.source=t,this.idGenerator=n||new AutoIDGenerator,this._toc=this.buildTableOfContents(),this._headers=this.extractHeaders()}headers(){return[...this._headers]}tableOfContents(){return this._toc}getTokens(){return[...this.tokens]}getSource(){return this.source}buildTableOfContents(){const e=new TOCBuilder;for(const t of this.tokens)if("heading_open"===t.type){const n=parseInt(t.tag.substring(1)),r=this.findNextTextToken(t);if(r){const t=r.content,s=this.idGenerator.generateID(t);e.addHeading(t,n,s)}}return e.build()}extractHeaders(){const e=[];for(let t=0;t<this.tokens.length;t++){const n=this.tokens[t];if("heading_open"===n.type){const r=parseInt(n.tag.substring(1)),s=this.findNextTextToken(n,t);if(s){const t=new HeaderImpl(s.content,r);e.push(t)}}}return e}findNextTextToken(e,t){for(let n=void 0!==t?t+1:this.tokens.indexOf(e)+1;n<this.tokens.length;n++){const e=this.tokens[n];if("inline"===e.type)return e;if("heading_close"===e.type)break}return null}};function slugifyFilePath(e,t){e=function(e){return e.startsWith("/")&&(e=e.substring(1)),e.endsWith("/")&&(e=e.slice(0,-1)),e}(e);let n=(r=e,r.match(/\.[A-Za-z0-9]+$/)?.[0]);var r;const s=e.replace(new RegExp(n+"$"),"");(t||[".md",".html",void 0].includes(n))&&(n="");let a=function(e){return e.split("/").map(e=>e.replace(/\s/g,"-").replace(/&/g,"-and-").replace(/%/g,"-percent").replace(/\?/g,"").replace(/#/g,"")).join("/").replace(/\/$/,"")}(s);return function(e,t){return e===t||e.endsWith("/"+t)}(a,"_index")&&(a=a.replace(/_index$/,"index")),a+n}function splitAnchor(e){let[t,n]=e.split("#",2);return t.endsWith(".pdf")?[t,void 0===n?"":`#${n}`]:(n=void 0===n?"":"#"+n.toLowerCase().trim().replace(/\s+/g,"-").replace(/[^\w\u4e00-\u9fa5\-]+/g,"").replace(/\-+/g,"-").replace(/^-+|-+$/g,""),[t,n])}var externalLinkRegex=/^https?:\/\//i,wikilinkRegex=new RegExp(/!?\[\[([^\[\]\|\#\\]+)?(#+[^\[\]\|\#\\]+)?(\\?\|[^\[\]\#]*)?\]\]/g),tableRegex=new RegExp(/^\|([^\n])+\|\n(\|)( ?:?-{3,}:? ?\|)+\n(\|([^\n])+\|\n?)+/gm),tableWikilinkRegex=new RegExp(/(!?\[\[[^\]]*?\]\]|\[\^[^\]]*?\])/g);function wikilinkInlineRule(e,t){const n=e.pos,r=e.posMax;if(n+5>r)return!1;const s=33===e.src.charCodeAt(n),a=s?1:0;if(91!==e.src.charCodeAt(n+a)||91!==e.src.charCodeAt(n+a+1))return!1;let i=n+a+2,o=!1;for(;i<r-1;){if(93===e.src.charCodeAt(i)&&93===e.src.charCodeAt(i+1)){o=!0;break}i++}if(!o)return!1;const l=e.src.slice(n+a+2,i);if(0===l.trim().length)return!1;const c=l.indexOf("|"),u=l.indexOf("#");let h,d="",p="";if(-1!==c){const e=l.slice(0,c);h=l.slice(c+1).trim();const t=e.indexOf("#");-1!==t?(d=e.slice(0,t).trim(),p=e.slice(t).trim()):d=e.trim()}else-1!==u?(d=l.slice(0,u).trim(),p=l.slice(u).trim()):d=l.trim();if(!t){const t=s?"wikilink_embed":"wikilink_link",n=e.push(t,"",0),r={isEmbed:s,filepath:d,anchor:p,alias:h,url:d+p};n.meta=r,n.content=h||d}return e.pos=i+2,!0}function renderWikilinkLink(e,t){const n=e[t].meta,[r,s]=splitAnchor(n.url),a=slugifyFilePath(r),i=escapeHtml(n.alias??n.filepath);return`<a class="internal" data-slug="${a}" data-wikilink="${escapeHtml(n.url)}">${i}</a>`}var wikilinkImageEmbedRegex=new RegExp(/^(?<alt>(?!^\d*x?\d*$).*?)?(\|?\s*?(?<width>\d+)(x(?<height>\d+))?)?$/);function renderWikilinkEmbed(e,t){const n=e[t].meta,{filepath:r,anchor:s,alias:a}=n,i=slugifyFilePath(r),o=function(e){const t=e.toLowerCase().match(/\.[a-z0-9]+$/);return t?t[0]:""}(r);if([".png",".jpg",".jpeg",".gif",".bmp",".svg",".webp"].includes(o)){const{alt:e,width:t,height:n}=function(e){if(!e)return{alt:"",width:"auto",height:"auto"};const t=wikilinkImageEmbedRegex.exec(e);return t&&t.groups?{alt:t.groups.alt||"",width:t.groups.width||"auto",height:t.groups.height||"auto"}:{alt:e,width:"auto",height:"auto"}}(a);return`<img src="${i}" alt="${escapeHtml(e)}" width="${t}" height="${n}" />`}return[".mp4",".webm",".ogv",".mov",".mkv"].includes(o)?`<video src="${i}" controls></video>`:[".mp3",".webm",".wav",".m4a",".ogg",".3gp",".flac"].includes(o)?`<audio src="${i}" controls></audio>`:[".pdf"].includes(o)?`<iframe src="${i}" class="pdf"></iframe>`:`<blockquote class="transclude" data-url="${i}" data-block="${s}"><a href="${i+s}" class="transclude-inner">Transclude of ${i}</a></blockquote>`}function escapeHtml(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function wikilinkPlugin(e,t){!1!==t?.enable&&(e.inline.ruler.before("link","wikilink",wikilinkInlineRule),e.renderer.rules.wikilink_link=renderWikilinkLink,e.renderer.rules.wikilink_embed=renderWikilinkEmbed)}function tagInlineRule(e,t){const n=e.pos;if(n+2>e.posMax)return!1;if(35!==e.src.charCodeAt(n))return!1;if(n>0){const t=e.src.charCodeAt(n-1);if(32!==t&&10!==t&&9!==t)return!1}const r=e.src.slice(n),s=/^#((?:[-_\p{L}\p{Emoji}\p{M}\d])+(?:\/[-_\p{L}\p{Emoji}\p{M}\d]+)*)/u.exec(r);if(!s)return!1;const a=s[0],i=s[1];if(/^[\/\d]+$/.test(i))return!1;if(!t){const t=e.push("tag","",0),n=i.split("/").map(e=>e.trim().toLowerCase().replace(/\s+/g,"-").replace(/[^\p{L}\p{Emoji}\p{M}\d\-_]/gu,"")).join("/"),r=e.md.__tagPluginState,s={rawTag:i,slugTag:n,url:`${r?.tagBaseURL||"tags/"}${n}`};t.meta=s,t.content=i,r?.onTagFound&&r.onTagFound(n)}return e.pos=n+a.length,!0}function renderTag(e,t){const n=e[t].meta,r=n.rawTag.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;");return`<a href="${n.url}" class="internal tag-link">${r}</a>`}function tagPlugin(e,t){const n={enable:!0,tagBaseURL:"tags/",...t};!1!==n.enable&&(e.__tagPluginState={tagBaseURL:n.tagBaseURL,onTagFound:n.onTagFound},e.inline.ruler.before("emphasis","tag",tagInlineRule),e.renderer.rules.tag=renderTag)}new RegExp(/(?<=^| )#((?:[-_\p{L}\p{Emoji}\p{M}\d])+(?:\/[-_\p{L}\p{Emoji}\p{M}\d]+)*)/gu);var import_token=__toESM(require("markdown-it/lib/token.mjs")),calloutMapping={note:"note",abstract:"abstract",summary:"abstract",tldr:"abstract",info:"info",todo:"todo",tip:"tip",hint:"tip",important:"tip",success:"success",check:"success",done:"success",question:"question",help:"question",faq:"question",warning:"warning",caution:"warning",attention:"warning",failure:"failure",fail:"failure",missing:"failure",danger:"danger",error:"danger",bug:"bug",example:"example",quote:"quote",cite:"quote"},calloutRegex=/^\[\!([\w-]+)\|?(.+?)?\]([+-]?)/;function parseCallout(e,t){if("blockquote_open"!==e[t].type)return null;let n=t+1;for(;n<e.length&&"paragraph_open"!==e[n].type;){if("blockquote_close"===e[n].type)return null;n++}if(n>=e.length)return null;const r=n+1;if("inline"!==e[r].type)return null;const s=e[r].content,a=s.match(calloutRegex);if(!a)return null;const[i,o,l="",c]=a;var u;return{type:function(e){const t=e.toLowerCase();return calloutMapping[t]??e}(o.toLowerCase()),title:s.split("\n")[0].slice(i.length).trim()||(u=o.replace(/-/g," ")).charAt(0).toUpperCase()+u.slice(1),collapse:c,metadata:l,firstLineIdx:r}}function transformCalloutTokens(e,t,n){const r=parseCallout(e,t);if(!r)return t;const{type:s,title:a,collapse:i,metadata:o,firstLineIdx:l}=r;let c=t+1,u=1;for(;c<e.length&&u>0;)"blockquote_open"===e[c].type&&u++,"blockquote_close"===e[c].type&&u--,c++;c--,e[t].type="callout_open",e[t].tag="div",e[t].attrSet("class",`callout ${s}${i?" is-collapsible":""}${"-"===i?" is-collapsed":""}`),e[t].attrSet("data-callout",s),i&&e[t].attrSet("data-callout-fold",i),o&&e[t].attrSet("data-callout-metadata",o);const h=e[l],d=h.content.split("\n"),p=d[0],g=p.match(calloutRegex);if(g){const t=g[0],n=p.slice(t.length).trim(),r=d.slice(1);if(h.content=n,r.length>0&&r.join("\n").trim()){const t=l+1,n=new import_token.default("paragraph_open","p",1),s=new import_token.default("inline","",0);s.content=r.join("\n").trim(),s.children=[];const a=new import_token.default("paragraph_close","p",-1);e.splice(t+1,0,n,s,a),c+=3}}let m=t+1;for(;m<c&&"paragraph_open"!==e[m].type;)m++;let f=m+1;for(;f<c&&"paragraph_close"!==e[f].type;)f++;const T=[],E=new import_token.default("callout_title_open","div",1);E.attrSet("class","callout-title"),T.push(E);const S=new import_token.default("callout_icon","div",0);S.attrSet("class","callout-icon"),T.push(S);const _=new import_token.default("callout_title_inner_open","div",1);_.attrSet("class","callout-title-inner"),T.push(_);const A=new import_token.default("inline","",0);A.content=a,A.children=[],T.push(A);const I=new import_token.default("callout_title_inner_close","div",-1);if(T.push(I),i){const e=new import_token.default("callout_fold_icon","div",0);e.attrSet("class","fold-callout-icon"),T.push(e)}const y=new import_token.default("callout_title_close","div",-1);T.push(y),e.splice(m,f-m+1),c-=f-m+1,e.splice(t+1,0,...T),c+=T.length;const D=t+1+T.length;if(D<c){const t=new import_token.default("callout_content_open","div",1);t.attrSet("class","callout-content"),e.splice(D,0,t),c++;const n=new import_token.default("callout_content_close","div",-1);e.splice(c,0,n),c++}return e[c].type="callout_close",e[c].tag="div",c}function calloutRule(e){let t=0,n=0;for(;t<e.tokens.length;)"blockquote_open"===e.tokens[t].type&&parseCallout(e.tokens,t)?(transformCalloutTokens(e.tokens,t,e.md),n++,t++):t++;return n>0}function calloutPlugin(e,t){!1!=={enable:!0,...t}.enable&&(e.core.ruler.after("block","callout",calloutRule),function(e){e.renderer.rules.callout_open=(e,t)=>{const n=e[t];return`<div${n.attrs?n.attrs.map(e=>{return` ${e[0]}="${t=e[1],t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}"`;var t}).join(""):""}>`},e.renderer.rules.callout_close=()=>"</div>\n",e.renderer.rules.callout_title_open=(e,t)=>'<div class="callout-title">',e.renderer.rules.callout_title_close=()=>"</div>",e.renderer.rules.callout_title_inner_open=()=>'<div class="callout-title-inner">',e.renderer.rules.callout_title_inner_close=()=>"</div>",e.renderer.rules.callout_icon=()=>'<div class="callout-icon"></div>',e.renderer.rules.callout_fold_icon=()=>'<div class="fold-callout-icon"></div>',e.renderer.rules.callout_content_open=()=>'<div class="callout-content">',e.renderer.rules.callout_content_close=()=>"</div>"}(e))}function escapeHtml4(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function mathInlineRule(e,t){const n=e.pos,r=e.posMax;if(36!==e.src.charCodeAt(n))return!1;if(n>0&&92===e.src.charCodeAt(n-1))return!1;if(36===e.src.charCodeAt(n+1))return!1;let s=n+1,a=!1;for(;s<r;){const t=e.src.charCodeAt(s);if(10===t)return!1;if(36===t&&92!==e.src.charCodeAt(s-1)){a=!0;break}s++}if(!a)return!1;const i=e.src.slice(n+1,s);if(0===i.trim().length)return!1;if(!t){const t=e.push("math_inline","math",0);t.content=i,t.markup="$"}return e.pos=s+1,!0}function mathBlockRule(e,t,n,r){let s=e.bMarks[t]+e.tShift[t],a=e.eMarks[t];if(s+2>a)return!1;if(36!==e.src.charCodeAt(s)||36!==e.src.charCodeAt(s+1))return!1;if("$$"!==e.src.slice(s,a).trim())return!1;let i=t+1,o=!1;for(;i<n;){if(s=e.bMarks[i]+e.tShift[i],a=e.eMarks[i],"$$"===e.src.slice(s,a).trim()){o=!0;break}i++}if(!o)return!1;const l=[];for(let n=t+1;n<i;n++){const t=e.bMarks[n]+e.tShift[n],r=e.eMarks[n];l.push(e.src.slice(t,r))}const c=l.join("\n");if(!r){const n=e.push("math_block","math",0);n.content=c,n.markup="$$",n.block=!0,n.map=[t,i+1]}return e.line=i+1,!0}function renderMathInline(e,t){return`<span class="math math-inline" data-math="inline">${escapeHtml4(e[t].content)}</span>`}function renderMathBlock(e,t){return`<div class="math math-display" data-math="block">${escapeHtml4(e[t].content)}</div>\n`}function latexPlugin(e,t){!1!==t?.enable&&(e.inline.ruler.before("escape","math_inline",mathInlineRule),e.block.ruler.before("fence","math_block",mathBlockRule,{alt:["paragraph","reference","blockquote","list"]}),e.renderer.rules.math_inline=renderMathInline,e.renderer.rules.math_block=renderMathBlock)}function mermaidPlugin(e,t){if(!1===t?.enable)return;const n=e.renderer.rules.fence||function(e,t,n,r,s){return s.renderToken(e,t,n)};e.renderer.rules.fence=function(t,r,s,a,i){const o=t[r],l=o.info?e.utils.unescapeAll(o.info).trim():"";if("mermaid"===(l?l.split(/\s+/g)[0]:"")){const t=o.content;return`<pre class="mermaid-wrapper"><code class="language-mermaid mermaid">${e.utils.escapeHtml(t)}</code><button class="expand-button" aria-label="Expand diagram"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M15 3h6v6M9 21H3v-6M21 3l-7 7M3 21l7-7"/></svg></button><div id="mermaid-container"><div id="mermaid-space"><div class="mermaid-content"></div></div></div></pre>\n`}return n(t,r,s,a,i)}}var MarkdownItRenderer=class{md;config;idGenerator;collectedTags=new Set;constructor(e,t){this.config=e,this.idGenerator=new AutoIDGenerator,t?(this.md=t,this.config.extensions.wikilink?.enable&&this.md.use(wikilinkPlugin,{enable:!0}),this.config.extensions.parseTags&&this.md.use(tagPlugin,{enable:!0,tagBaseURL:"tags/",onTagFound:e=>this.collectedTags.add(e)}),this.config.extensions.callouts&&this.md.use(calloutPlugin,{enable:!0}),this.config.extensions.latex?.enable&&this.md.use(latexPlugin,{enable:!0}),this.config.extensions.mermaid?.enable&&this.md.use(mermaidPlugin,{enable:!0})):this.md=this.createMarkdownItInstance(),this.setupRendererRules()}setupRendererRules(){const e=this.idGenerator;this.md.renderer.rules.heading_open=function(t,n){const r=t[n+1].content,s=e.generateID(r);return t[n].attrPush(["id",s]),`<${t[n].tag} id="${s}">`}}async render(e){return this.idGenerator.reset(),this.collectedTags.clear(),this.config.extensions.wikilink?.enable&&(e=e.replace(tableRegex,e=>e.replace(tableWikilinkRegex,(e,t)=>{let n=t??"";return n=n.replace("#","\\#"),n=n.replace(/((^|[^\\])(\\\\)*)\|/g,"$1\\|"),n})).replace(wikilinkRegex,(e,...t)=>{const[n,r,s]=t,[a,i]=splitAnchor(`${n??""}${r??""}`),o=Boolean(r?.startsWith("#^"))?"^":"",l=i?`#${o}${i.trim().replace(/^#+/,"")}`:"",c=s??r?.replace("#","|")??"",u=e.startsWith("!")?"!":"";return n?.match(externalLinkRegex)?`${u}[${c.replace(/^\|/,"")}](${n})`:`${u}[[${a}${l}${c}]]`})),this.md.render(e)}getCollectedTags(){return Array.from(this.collectedTags)}async parse(e){this.idGenerator.reset();const t=await this._parse(e);return new ParserResult(t,(new TextEncoder).encode(e),this.idGenerator)}async _parse(e){return this.md.parse(e,{})}getMarkdownIt(){return this.md}addPlugin(e,t){this.md.use(e,t)}createMarkdownItInstance(){const e=new import_markdown_it.default({html:this.config.renderer.unsafe,breaks:!1,linkify:this.config.extensions.linkify,typographer:!this.config.extensions.typographer.disable});return this.config.extensions.typographer.disable||(e.options.quotes=[this.config.extensions.typographer.leftDoubleQuote,this.config.extensions.typographer.rightDoubleQuote,this.config.extensions.typographer.leftSingleQuote,this.config.extensions.typographer.rightSingleQuote]),this.configureBasicPlugins(e),this.config.extensions.wikilink?.enable&&e.use(wikilinkPlugin,{enable:!0}),this.config.extensions.parseTags&&e.use(tagPlugin,{enable:!0,tagBaseURL:"tags/",onTagFound:e=>this.collectedTags.add(e)}),this.config.extensions.callouts&&e.use(calloutPlugin,{enable:!0}),this.config.extensions.latex?.enable&&e.use(latexPlugin,{enable:!0}),this.config.extensions.mermaid?.enable&&e.use(mermaidPlugin,{enable:!0}),e}configureBasicPlugins(e){this.config.extensions.table&&e.enable(["table"]),this.config.extensions.strikethrough&&e.enable(["strikethrough"])}};init_log();var yaml2=__toESM(require("js-yaml")),PathType=(e=>(e[e.File=0]="File",e[e.ContentResource=1]="ContentResource",e[e.ContentSingle=2]="ContentSingle",e[e.Leaf=3]="Leaf",e[e.Branch=4]="Branch",e))(PathType||{}),PATH_CONSTANTS={CONTENT_EXTENSIONS:[".md",".markdown",".mdown",".mkd",".mkdn",".html",".htm",".xml"],HTML_EXTENSIONS:[".html",".htm"],INDEX_NAMES:["index","_index"],PATH_SEPARATOR:"/",EXTENSION_SEPARATOR:".",LANGUAGE_SEPARATOR:".",SYSTEM_PATH_SEPARATOR:(()=>{try{return require("path").sep}catch{return"/"}})(),COMPONENT_FOLDER_CONTENT:"content",COMPONENT_FOLDER_STATIC:"static",COMPONENT_FOLDER_LAYOUTS:"layouts",COMPONENT_FOLDER_ARCHETYPES:"archetypes",COMPONENT_FOLDER_DATA:"data",COMPONENT_FOLDER_ASSETS:"assets",COMPONENT_FOLDER_I18N:"i18n",normalizePath:e=>{let t=e.replace(/\\/g,"/");return t.startsWith("//")&&(t=t.substring(1)),t}},PathComponentsImpl=class e{constructor(e,t,n,r,s,a=!1,i){this.original=e,this.normalized=t,this.positions=n,this.identifiers=r,this.bundleType=s,this.disabled=a,this.component=i}withBundleType(t){return new e(this.original,this.normalized,this.positions,this.identifiers,t,this.disabled)}withDisabled(t){return new e(this.original,this.normalized,this.positions,this.identifiers,this.bundleType,t)}hasIdentifiers(){return this.identifiers.length>0}firstIdentifier(){return this.identifiers.length>0?this.identifiers[0]:null}lastIdentifier(){return this.identifiers.length>0?this.identifiers[this.identifiers.length-1]:null}getIdentifier(e){return e>=0&&e<this.identifiers.length?this.identifiers[e]:null}isContentComponent(e){return"content"===e||"archetypes"===e}clone(){return new e(this.original,this.normalized,{...this.positions},[...this.identifiers],this.bundleType,this.disabled,this.component)}toString(){return`PathComponents{original="${this.original}", normalized="${this.normalized}", bundleType=${PathType[this.bundleType]}, identifiers=${this.identifiers.length}}`}},PathPositionsImpl=class e{constructor(e=-1,t=-1,n=-1,r=-1){this.containerLow=e,this.containerHigh=t,this.sectionHigh=n,this.identifierLanguage=r}reset(){this.containerLow=-1,this.containerHigh=-1,this.sectionHigh=-1,this.identifierLanguage=-1}hasContainer(){return-1!==this.containerLow&&-1!==this.containerHigh}hasSection(){return this.sectionHigh>0}hasLanguageIdentifier(){return-1!==this.identifierLanguage}clone(){return new e(this.containerLow,this.containerHigh,this.sectionHigh,this.identifierLanguage)}},LowHighImpl=class{constructor(e,t){if(this.low=e,this.high=t,e>t)throw new Error(`Invalid range: low (${e}) must be <= high (${t})`)}length(){return this.high-this.low}isEmpty(){return this.low===this.high}contains(e){return e>=this.low&&e<this.high}substring(e){return e.substring(this.low,this.high)}toString(){return`[${this.low}, ${this.high})`}},PathComponentsFactory=class{static createEmpty(e="",t=0){return new PathComponentsImpl(e,e,new PathPositionsImpl,[],t,!1)}static create(e,t,n=0){return new PathComponentsImpl(e,t||e,new PathPositionsImpl,[],n,!1)}static createFull(e,t,n,r,s,a=!1){return new PathComponentsImpl(e,t,n,r,s,a)}},Path=class e{constructor(e){this.components=e}_unnormalized;shouldTrimLeadingSlash=!1;component(){if(this.components.component)return this.components.component;const e=this.components.normalized.split("/").filter(e=>e.length>0);return 0===e.length?"content":{static:"static",layouts:"layouts",themes:"themes",archetypes:"archetypes",data:"data",i18n:"i18n",assets:"assets"}[e[0]]||"content"}path(){return this.norm(this.components.normalized)}name(){return this.components.positions.containerHigh>0?this.components.normalized.substring(this.components.positions.containerHigh):this.components.normalized}originalNameNoExt(){const e=this.components.firstIdentifier();return e?this.components.original.substring(this.components.positions.containerHigh,e.low-1):this.components.original.substring(this.components.positions.containerHigh)}nameNoExt(){const e=this.components.firstIdentifier();return e?this.components.normalized.substring(this.components.positions.containerHigh,e.low-1):this.components.normalized.substring(this.components.positions.containerHigh)}nameNoLang(){if(this.components.identifiers.length>=2){const e=this.components.identifiers[this.components.identifiers.length-1],t=this.components.identifiers[this.components.identifiers.length-2],n=this.components.normalized.substring(t.low,t.high);if(["en","fr","es","de","zh","ja","ko","pt","it","ru","ar"].includes(n)){const n=this.components.positions.containerHigh;return this.components.normalized.substring(n,t.low-1)+this.components.normalized.substring(e.low-1)}}return this.name()}dir(){let e="";return this.components.positions.containerHigh>0&&(e=this.components.normalized.substring(0,this.components.positions.containerHigh-1)),""===e&&(e="/"),this.norm(e)}ext(){if(0===this.components.identifiers.length)return"";const e=this.components.identifiers[this.components.identifiers.length-1],t=this.components.normalized.substring(e.low,e.high);return t?"."+t:""}lang(){if(this.components.identifiers.length>=2){const e=this.components.identifiers[this.components.identifiers.length-2],t=this.components.normalized.substring(e.low,e.high);if(["en","fr","es","de","zh","ja","ko","pt","it","ru","ar"].includes(t))return"."+t}return""}section(){if(this.components.positions.sectionHigh<=0)return"";const e=this.components.normalized.substring(1,this.components.positions.sectionHigh);return"_index.md"===e||"index.md"===e||e.endsWith("/_index.md")||e.endsWith("/index.md")?"":this.norm(e)}sections(){const e=this.dir();if("/"===e||""===e)return[];const t=[],n=(e.startsWith("/")?e.substring(1):e).split("/").filter(e=>e.length>0);let r="";for(const e of n)""===r?r=e:r+="/"+e,t.push(this.norm(r));return t}container(){return-1===this.components.positions.containerLow?"":this.norm(this.components.normalized.substring(this.components.positions.containerLow,this.components.positions.containerHigh-1))}containerDir(){return this.isLeafBundle()||this.isBranchBundle(),this.dir()}base(){return this.isBranchBundle()&&"/_index.md"===this.components.normalized?"/":this.isLeafBundle()?this.baseInternal(!1,!0):this.isContent()&&!this.isBundle()?this.pathNoIdentifier():this.isContent()?this.isBundle()?this.baseInternal(!1,!0):this.baseInternal(!this.isContentPage(),this.isBundle()):this.path()}baseNoLeadingSlash(){return this.base().substring(1)}baseNameNoIdentifier(){return this.isBundle()?this.container():this.nameNoIdentifier()}nameNoIdentifier(){if(0===this.components.identifiers.length)return this.name();const e=this.components.identifiers[0],t=this.components.positions.containerHigh;return this.components.normalized.substring(t,e.low-1)}pathNoLang(){return this.baseInternal(!0,!1)}pathNoIdentifier(){if(0===this.components.identifiers.length)return this.path();const e=this.components.identifiers[0],t=this.components.normalized.substring(0,e.low-1);return this.norm(t)}pathRel(e){let t=e.base();return t.endsWith("/")||(t+="/"),this.path().replace(new RegExp("^"+this.escapeRegExp(t)),"")}baseRel(e){let t=e.base();return"/"===t&&(t=""),this.base().substring(t.length+1)}trimLeadingSlash(){const t=this.components.clone(),n=new e(t);return n.setShouldTrimLeadingSlash(!0),n}identifier(e){const t=this.components.identifiers.length;if(0===t||e<0||e>=t)return"";let n;n=1===t?0:0===e?t-1:t-1-e;const r=this.identifierAsString(n);return r?"."+r:""}identifiers(){const e=[],t=this.components.identifiers.length;for(let n=0;n<t;n++){const t=this.identifier(n);t&&e.push(t)}return e}bundleType(){return this.components.bundleType}isContent(){return this.bundleType()>=1}isBundle(){return this.bundleType()>3}isBranchBundle(){return 4===this.bundleType()}isLeafBundle(){return 3===this.bundleType()}isHTML(){const e=this.ext().toLowerCase();return PATH_CONSTANTS.HTML_EXTENSIONS.some(t=>t===e)}disabled(){return this.components.disabled}forBundleType(t){const n=this.components.withBundleType(t);return new e(n)}unnormalized(){if(!this._unnormalized)if(this.components.original===this.components.normalized)this._unnormalized=this;else{const t=new PathComponentsImpl(this.components.original,this.components.original,this.components.positions,this.components.identifiers,this.components.bundleType,this.components.disabled);this._unnormalized=new e(t)}return this._unnormalized}setShouldTrimLeadingSlash(e){this.shouldTrimLeadingSlash=e}norm(e){return this.shouldTrimLeadingSlash&&e.startsWith("/")?e.substring(1):e}isContentPage(){return this.bundleType()>=2}baseInternal(e,t){if(0===this.components.identifiers.length)return this.norm(this.components.normalized);if(e&&1===this.components.identifiers.length)return this.norm(this.components.normalized);let n=this.components.identifiers[this.components.identifiers.length-1].low-1;if(t&&(n=this.components.positions.containerHigh-1),0===n&&n++,!e)return this.norm(this.components.normalized.substring(0,n));const r=this.components.identifiers[0];return this.norm(this.components.normalized.substring(0,n)+this.components.normalized.substring(r.low-1,r.high))}identifierAsString(e){const t=this.identifierIndex(e);if(-1===t)return"";const n=this.components.identifiers[t];return this.components.normalized.substring(n.low,n.high)}identifierIndex(e){return e<0||e>=this.components.identifiers.length?-1:e}escapeRegExp(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}toString(){return`Path{path="${this.path()}", component="${this.component()}", bundleType=${PathType[this.bundleType()]}}`}equals(e){return this.path()===e.path()&&this.component()===e.component()&&this.bundleType()===e.bundleType()}hashCode(){return`${this.component()}:${this.path()}:${this.bundleType()}`}},PathUtils=class{static fromString(e,t){const n=new PathComponentsImpl(t,t,{containerLow:-1,containerHigh:-1,sectionHigh:-1,identifierLanguage:-1},[],0,!1);return new Path(n)}static hasExtension(e,t){const n=e.ext(),r=t.startsWith(".")?t:"."+t;return n.toLowerCase()===r.toLowerCase()}static isUnder(e,t){const n=e.path();let r;r=t.isBranchBundle()?t.dir():t.path();const s="/"===r?"/":r+"/";return n!==r&&n.startsWith(s)}static relativeTo(e,t){return t.pathRel(e)}static compare(e,t){const n=e.path().localeCompare(t.path());if(0!==n)return n;const r=e.component().localeCompare(t.component());return 0!==r?r:e.bundleType()-t.bundleType()}},PathProcessorImpl=class{normalizer;extChecker;constructor(e,t){this.normalizer=e||new PathParsingNormalizer,this.extChecker=t||new DefaultFileExtensionChecker}parse(e,t){let n=t;n&&""!==n||(n="/");const r=this.normalizer.normalize(n),s=this.createPathComponents(e,r,t);return new Path(s)}parseIdentity(e,t){const n=this.parse(e,t);return{identifierBase:()=>n.base()}}parseBaseAndBaseNameNoIdentifier(e,t){const n=this.parse(e,t);return[n.base(),n.baseNameNoIdentifier()]}createPathComponents(e,t,n){let r=e,s=t;if(t.startsWith("/")){const n=t.split("/").filter(e=>e.length>0);if(n.length>0){const t=n[0];["static","layouts","themes","archetypes","data","i18n","assets"].includes(t)&&"content"===e&&(r=t),["images","assets","static","css","js","fonts"].includes(t)&&"content"===e&&(r="static")}}const a=s.lastIndexOf("/"),i=a>=0?s.substring(a+1):s;a>=0&&s.substring(0,a);let o=this.detectBundleType(i,r);const l=this.calculatePathPositions(s),c=this.extractIdentifiers(s,i);return new PathComponentsImpl(n,s,l,c,o,!1,r)}detectBundleType(e,t){if("content"!==t&&"archetypes"!==t)return 0;let n=e.split(".")[0];return"index"===n&&this.isContentFile(e)?3:"_index"===n&&this.isContentFile(e)?4:this.isContentFile(e)?2:0}isContentFile(e){const t=this.getFileExtension(e);return["md","html","markdown","mdown","mkd","mkdn","htm"].includes(t.toLowerCase())}getFileExtension(e){const t=e.lastIndexOf(".");return t>0&&t<e.length-1?e.substring(t+1):""}calculatePathPositions(e){let t=-1,n=-1,r=-1;for(let s=e.length-1;s>=0;s--)"/"===e[s]&&(-1===r?r=s+1:-1===n&&(n=s+1),s>0&&(t=s));return new PathPositionsImpl(n,r,t,-1)}extractIdentifiers(e,t){const n=[],r=e.substring(0,e.length-t.length).length,s=t.split(".");if(s.length<=1)return n;let a=r+s[0].length;for(let e=1;e<s.length;e++){const t=a+1,r=t+s[e].length;n.push(new LowHighImpl(t,r)),a=r}return n}},PathParsingNormalizer=class{constructor(e=!0,t=!0){this.toLowerCase=e,this.replaceSpaces=t}normalize(e){let t=e;return t=t.replace(/\\/g,"/"),this.toLowerCase&&(t=t.toLowerCase()),this.replaceSpaces&&(t=t.replace(/\s/g,"-")),t}},BasicPathNormalizer=class{constructor(e=!0,t=!0){this.toLowerCase=e,this.replaceSpaces=t}normalize(e){let t=e;return t=t.replace(/\\/g,"/"),this.toLowerCase&&(t=t.toLowerCase()),this.replaceSpaces&&(t=t.replace(/\s+/g,"-")),t}},DefaultFileExtensionChecker=class{isContentExt(e){return PATH_CONSTANTS.CONTENT_EXTENSIONS.includes(e.toLowerCase())}isHTML(e){return PATH_CONSTANTS.HTML_EXTENSIONS.includes(e.toLowerCase())}hasExt(e){for(let t=e.length-1;t>=0;t--){if("."===e[t])return!0;if("/"===e[t])return!1}return!1}},PathParserUtils=class e{static parseBasic(e){const t=e.lastIndexOf("/"),n=t>=0?e.substring(0,t):"",r=t>=0?e.substring(t+1):e,s=r.lastIndexOf("."),a=s>=0?r.substring(s):"",i=s>=0?r.substring(0,s):r;return{dir:n,name:r,ext:a,nameWithoutExt:i}}static join(...e){return e.filter(e=>e.length>0).map(e=>e.replace(/^\/+|\/+$/g,"")).join("/").replace(/\/+/g,"/")}static normalizeBasic(e){return(new BasicPathNormalizer).normalize(e)}static isBundle(t){const n=e.parseBasic(t);return PATH_CONSTANTS.INDEX_NAMES.includes(n.nameWithoutExt)}static extractSection(e){const t=e.startsWith("/")?e.substring(1):e,n=t.indexOf("/");return n>=0?t.substring(0,n):t}static removeExtension(e){const t=e.lastIndexOf(".");return t>e.lastIndexOf("/")?e.substring(0,t):e}static hasExtension(e){return(new DefaultFileExtensionChecker).hasExt(e)}},PathFactoryImpl=class{processor;pool;constructor(e,t){const n=e?.normalizer?{normalize:e.normalizer}:new BasicPathNormalizer(!1!==e?.normalize,!1!==e?.replaceSpaces),r=new DefaultFileExtensionChecker;this.processor=new PathProcessorImpl(n,r),t&&(this.pool=t)}create(e,t,n){return this.pool&&this.pool.get(),this.processor.parse(e,t)}createFromComponents(e){return new Path(e)}createMany(e,t,n){return t.map(t=>this.create(e,t,n))}createWithConfig(e,t,n){const r={};return void 0!==n?.toLowerCase&&(r.normalize=n.toLowerCase),void 0!==n?.replaceSpaces&&(r.replaceSpaces=n.replaceSpaces),void 0!==n?.customNormalizer&&(r.normalizer=n.customNormalizer),this.create(e,t,r)}},DefaultPathFactory=class extends PathFactoryImpl{constructor(){super({normalize:!0,replaceSpaces:!0})}},SimplePathPool=class{pool=[];maxSize;constructor(e=100){this.maxSize=e}get(){if(this.pool.length>0)return this.pool.pop();const e=PathComponentsFactory.createEmpty();return new Path(e)}put(e){this.pool.length<this.maxSize&&this.pool.push(e)}clear(){this.pool=[]}size(){return this.pool.length}},PathBuilder=class{component="";path="";config={};factory;constructor(e){this.factory=e||new DefaultPathFactory}withComponent(e){return this.component=e,this}withPath(e){return this.path=e,this}withNormalization(e){return this.config.normalize=e,this}withSpaceReplacement(e){return this.config.replaceSpaces=e,this}withNormalizer(e){return this.config.normalizer=e,this}build(){if(!this.component||!this.path)throw new Error("Component and path must be set");return this.factory.create(this.component,this.path,this.config)}reset(){return this.component="",this.path="",this.config={},this}},PathFactoryUtils=class e{static defaultFactory=new DefaultPathFactory;static createContentPath(t){return e.defaultFactory.create("content",t)}static createStaticPath(t){return e.defaultFactory.create("static",t)}static createLayoutPath(t){return e.defaultFactory.create("layouts",t)}static createArchetypePath(t){return e.defaultFactory.create("archetypes",t)}static createDataPath(t){return e.defaultFactory.create("data",t)}static createThemePath(t){return e.defaultFactory.create("themes",t)}static createFromConfig(e){const t={};void 0!==e.normalize&&(t.normalize=e.normalize),void 0!==e.replaceSpaces&&(t.replaceSpaces=e.replaceSpaces);const n=new PathFactoryImpl(t);return e.paths.map(t=>n.create(e.component,t))}static builder(){return new PathBuilder}static createWithPool(e,t,n){return new PathFactoryImpl(void 0,n).create(e,t)}},PathDomain={createContentPath:PathFactoryUtils.createContentPath,createStaticPath:PathFactoryUtils.createStaticPath,createLayoutPath:PathFactoryUtils.createLayoutPath,createArchetypePath:PathFactoryUtils.createArchetypePath,createDataPath:PathFactoryUtils.createDataPath,createThemePath:PathFactoryUtils.createThemePath,builder:PathFactoryUtils.builder,parseBasic:PathParserUtils.parseBasic,join:PathParserUtils.join,normalizeBasic:PathParserUtils.normalizeBasic,isBundle:PathParserUtils.isBundle,extractSection:PathParserUtils.extractSection,removeExtension:PathParserUtils.removeExtension,checkExtension:PathParserUtils.hasExtension,hasSpecificExtension:PathUtils.hasExtension,isUnder:PathUtils.isUnder,relativeTo:PathUtils.relativeTo,compare:PathUtils.compare,createProcessor:()=>new PathProcessorImpl,createFactory:()=>new DefaultPathFactory,createPool:e=>new SimplePathPool(e),createNormalizer:e=>new BasicPathNormalizer(e?.toLowerCase,e?.replaceSpaces)},log19=getDomainLogger("content",{component:"translator"}),Translator=class{contentLanguage;translateFuncs=new Map;constructor(e){this.contentLanguage=e}translate(e,t){const n=e.toLowerCase(),r=this.translateFuncs.get(n);if(r){const e=r(t);if(e)return e}log19.info(`Translation func for language ${e} not found, use default.`);const s=this.translateFuncs.get(this.contentLanguage.toLowerCase());if(s){const e=s(t);if(e)return e}return log19.info("i18n not initialized; if you need string translations, check that you have a bundle in /i18n that matches the site language or the default language."),`[i18n] ${t}`}async setupTranslateFuncs(e){try{await e.walkI18n("",{walkFn:async(e,t)=>{if(e.endsWith(".yaml")||e.endsWith(".yml"))try{const n=(PATH_CONSTANTS.normalizePath(e).split("/").pop()||"").replace(/\.(yaml|yml)$/,"").toLowerCase(),r=await this.readI18nFile(t),s=this.parseI18nContent(r),a=new Map;s.forEach(e=>{a.set(e.id,e.translation)});const i=e=>a.get(e)||(log19.warn(`i18n|MISSING_TRANSLATION|${n}|${e}`),"");this.translateFuncs.set(n,i),log19.info(`✅ Loaded i18n translations for language: ${n} (${s.length} items)`)}catch(t){log19.error(`❌ Failed to load i18n file ${e}:`,t)}}},{}),log19.info(`🌍 Translation setup complete. Loaded ${this.translateFuncs.size} languages: [${Array.from(this.translateFuncs.keys()).join(", ")}]`)}catch(e){throw e}}async readI18nFile(e){let t=null;try{t=await e.open();const n=await t.stat(),r=new Uint8Array(n.size()),s=await t.read(r),a=new TextDecoder("utf-8").decode(s.buffer);return 65279===a.charCodeAt(0)?a.slice(1):a}catch(e){throw log19.error("❌ Failed to read i18n file:",e),e}finally{if(t)try{await t.close()}catch(e){log19.warn(`Failed to close i18n file: ${e}`)}}}parseI18nContent(e){try{const t=yaml2.load(e);return Array.isArray(t)?t.filter(e=>e&&"object"==typeof e&&e.id&&e.translation).map(e=>({id:String(e.id),translation:String(e.translation)})):(log19.warn("i18n YAML content is not an array"),[])}catch(e){return log19.error("❌ Failed to parse i18n YAML content:",e),[]}}getAvailableLanguages(){return Array.from(this.translateFuncs.keys())}hasLanguage(e){return this.translateFuncs.has(e.toLowerCase())}};init_log();var log20=getDomainLogger("content",{component:"content"});async function createContent(e){const t=new MDConverter(function(e,t){const n=new DefaultHighlighter({style:"github",lineNos:!1,lineNoStart:1,anchorLineNos:!1,lineAnchors:"",lineNumbersInTable:!0,noClasses:!0,codeFences:!0,guessSyntax:!1,tabWidth:4});return new MarkdownImpl(t||!e?new MarkdownItRenderer({extensions:{typographer:{disable:!1,leftSingleQuote:"&lsquo;",rightSingleQuote:"&rsquo;",leftDoubleQuote:"&ldquo;",rightDoubleQuote:"&rdquo;",enDash:"&ndash;",emDash:"&mdash;",ellipsis:"&hellip;",leftAngleQuote:"&laquo;",rightAngleQuote:"&raquo;",apostrophe:"&rsquo;"},footnote:!0,definitionList:!0,table:!0,strikethrough:!0,linkify:!0,linkifyProtocol:"https",taskList:!0,cjk:{enable:!1,eastAsianLineBreaks:!1,eastAsianLineBreaksStyle:"simple",escapedSpace:!1},passthrough:{enable:!1,delimiters:{inline:[],block:[]}},highlight:{style:"github",lineNos:!1,lineNoStart:1,anchorLineNos:!1,lineAnchors:"",lineNumbersInTable:!0,noClasses:!0,codeFences:!0,guessSyntax:!1,tabWidth:4},wikilink:{enable:!0,disableBrokenWikilinks:!1,markdownLinkResolution:"shortest",prettyLinks:!0},parseTags:!0,callouts:!0,latex:{enable:!0},mermaid:{enable:!0}},renderer:{unsafe:!0},parser:{autoHeadingID:!0,autoHeadingIDType:"github",wrapStandAloneImageWithinParagraph:!0,attribute:{title:!0,block:!1}},duplicateResourceFiles:!1,renderHooks:{image:{enableDefault:!0},link:{enableDefault:!0}}},void 0):e,n)}(e.markdown(),e.useInternalRenderer())),n=await async function(e){const t=new Translator(e.defaultLanguage());try{await t.setupTranslateFuncs(e)}catch(e){log20.warn("Failed to setup translator, continuing without i18n support:",e)}return t}(e),r=new PageBuilder(e,e,e,null,null,new Taxonomy2(e.views(),e),new Term(e),new Section(e),new Standalone(e),t,null),s=new PageMap(r);r.pageMapper=s,s.setupReverseIndex();const a=new Content2(e,t,s,n);return r.contentHub=a,a}var kindMapMain={[PageKind_PAGE]:"page",[PageKind_HOME]:"home",[PageKind_SECTION]:"section",[PageKind_TAXONOMY]:"taxonomy",[PageKind_TERM]:"term",[PageKind_STATUS_404]:"404",[PageKind_SITEMAP]:"sitemap",taxonomyterm:"taxonomy"};function getKindMain(e){return kindMapMain[e.toLowerCase()]||""}init_log(),getDomainLogger("content",{component:"identity"});var Identity=class{id;lang;langIdx;stale=!0;constructor(e,t="",n=0){this.id=e,this.lang=t,this.langIdx=n}ID(){return this.id}identifierBase(){return`${this.id}-${this.lang}`}pageLanguage(){return this.lang}pageLanguageIndex(){return this.langIdx}pageIdentity(){return this}markStale(){this.stale||(this.stale=!0)}isStale(){return this.stale}clearStale(){this.stale&&(this.stale=!1)}},crypto=__toESM(require("crypto")),path16=__toESM(require("path"));init_log(),getDomainLogger("content",{component:"FileInfo"});var contentFileExtensionsSet=new Set([".md"]),FileInfo7=class e{fileMetaInfo;pathInfo;bundleType;uniqueIDCache;lazyInitDone=!1;constructor(e,t){this.fileMetaInfo=e;const n=PathDomain.createProcessor();this.pathInfo=n.parse(PATH_CONSTANTS.COMPONENT_FOLDER_CONTENT,t),this.bundleType=0,this.determineBundleType()}static newFileInfo(t){const n=PATH_CONSTANTS.normalizePath(t.relativeFilename());return new e(t,n)}pageFile(){return this}shiftToResource(){this.isContent()&&(this.bundleType=1)}relPath(){const e=this.pathInfo.dir(),t=e.startsWith("/")?e.substring(1):e;return path16.join(t,this.pathInfo.name())}section(){return this.pathInfo.section()}isZero(){return null==this.fileMetaInfo}filename(){return this.fileMetaInfo.fileName()}dir(){return this.pathToDir(this.pathInfo.dir())}ext(){return this.pathInfo.ext()}logicalName(){return this.pathInfo.name()}originalBaseFileName(){return this.pathInfo.originalNameNoExt()}baseFileName(){return this.pathInfo.nameNoExt()}translationBaseName(){return this.pathInfo.nameNoIdentifier()}contentBaseName(){return this.pathInfo.baseNameNoIdentifier()}baseNameNoIdentifier(){return this.pathInfo.baseNameNoIdentifier()}root(){return this.pathInfo.dir()||"/"}uniqueID(){return this.init(),this.uniqueIDCache}fileInfo(){return this.fileMetaInfo}type(){const e=this.section();return""!==e?e:"page"}async open(){return await this.fileMetaInfo.open()}paths(){return this.pathInfo}path(){return this.pathInfo.path()}toString(){return this.baseFileName()}getBundleType(){return this.bundleType}isBundle(){return this.bundleType>=3}isLeafBundle(){return 3===this.bundleType}isBranchBundle(){return 4===this.bundleType}isContentResource(){return 1===this.bundleType}isContent(){return this.bundleType>=1}init(){if(!this.lazyInitDone){this.lazyInitDone=!0;const e=this.relPath().replace(/\\/g,"/");this.uniqueIDCache=crypto.createHash("md5").update(e).digest("hex")}}pathToDir(e){return""===e?e:path16.normalize(e.substring(1)+"/")}determineBundleType(){var e;if(e=this.pathInfo.ext(),contentFileExtensionsSet.has(e))switch(this.pathInfo.nameNoIdentifier()){case"index":this.bundleType=3;break;case"_index":this.bundleType=4;break;default:this.bundleType=2}}};function newFileInfo2(e){return FileInfo7.newFileInfo(e)}function sortByDefault(e){pageBy(lessPageTitle).sort(e)}function pageBy(e){return new PageByWrapper(e)}var PageByWrapper=class{constructor(e){this.by=e}sort(e){!function(e,t){const n=Array.from({length:t.len()},(e,t)=>t);n.sort((e,n)=>t.less(e,n)?-1:t.less(n,e)?1:e-n);const r=[...e];for(let t=0;t<n.length;t++)e[t]=r[n[t]]}(e,new PageSorterImpl(e,this.by))}},lessPageTitle=(e,t)=>collatorStringCompare(e=>e.title(),e,t)<0,language=(e,t)=>collatorStringCompare(e=>e.pageIdentity().pageLanguage(),e,t)<0,weight=(e,t)=>e.pageWeight()<t.pageWeight(),collatorStringCompare=(e,t,n)=>{const r=e(t),s=e(n);return r<s?-1:r>s?1:0},PageSorterImpl=class{constructor(e,t){this.pages=e,this.by=t}len(){return this.pages.length}swap(e,t){[this.pages[e],this.pages[t]]=[this.pages[t],this.pages[e]]}less(e,t){return this.by(this.pages[e],this.pages[t])}},Cast=class{static toString(e){return null==e?"":"string"==typeof e?e:"number"==typeof e||"boolean"==typeof e?e.toString():String(e)}static toInt(e){if(null==e)return 0;if("number"==typeof e)return Math.floor(e);if("string"==typeof e){const t=parseInt(e,10);return isNaN(t)?0:t}return 0}static toTime(e){if(null==e)return new Date;if(e instanceof Date)return e;if("string"==typeof e){const t=new Date(e);return isNaN(t.getTime())?new Date:t}return"number"==typeof e?new Date(e):new Date}},Strings=class{static sliceToLower(e){return e.map(e=>e.toLowerCase())}},Types=class{static toStringSlicePreserveString(e){return null==e?null:Array.isArray(e)?e.map(e=>Cast.toString(e)):"string"==typeof e?[e]:[Cast.toString(e)]}},import_path9=__toESM(require("path")),FrontMatterParserImpl=class{params;langSvc;taxonomySvc;constructor(e,t,n){this.params=e,this.langSvc=t,this.taxonomySvc=n}async parse(e){const t={terms:{},params:this.params,path:"",lang:"",kind:"",title:"",description:"",weight:0};try{await this.parseCustomized(t)}catch(e){throw e}try{await this.parseTerms(t)}catch(e){throw e}try{await this.parseTitle(t)}catch(e){throw e}try{await this.parseDescription(t)}catch(e){throw e}try{await this.parseWeight(t)}catch(e){throw e}try{await this.parseDate(t)}catch(e){throw e}try{await this.parseOrganization(t,e)}catch(e){throw e}try{await this.parseAuthor(t,e)}catch(e){throw e}try{await this.parseMenu(t)}catch(e){throw e}return t}async parseDate(e){if(this.params){const t=this.params.date;null!=t&&(e.date=Cast.toTime(t))}}async parseWeight(e){if(e.weight=1e4,this.params){const t=this.params.weight;null!=t&&(e.weight=Cast.toInt(t))}}async parseTitle(e){if(this.params){const t=this.params.title;null!=t&&(e.title=Cast.toString(t))}}async parseDescription(e){if(this.params){const t=this.params.description;null!=t&&(e.description=Cast.toString(t))}}async parseCustomized(e){if(!this.params)return;const t=this.params.path;null!=t&&(e.path=this.toSlashPreserveLeading(Cast.toString(t)));const n=this.params.lang;if(null!=n){const t=Cast.toString(n).toLowerCase();this.langSvc.isLanguageValid(t)&&(e.lang=t)}const r=this.params.kind;if(null!=r){const t=Cast.toString(r);if(""!==t){const n=getKindMain(t);if(""===n)throw new Error(`unknown kind "${t}" in front matter`);e.kind=n}}}async parseTerms(e){const t=this.taxonomySvc.views();for(const n of t){const t=Types.toStringSlicePreserveString(getParam(this.params||{},n.plural(),!1));null!==t&&(e.terms[n.plural()]=t)}}async parseOrganization(e,t){if(!this.params)return;const n=this.params.organization;if(!n||"object"!=typeof n)return;const r={};void 0!==n.name&&null!==n.name&&(r.name=Cast.toString(n.name)),void 0!==n.description&&null!==n.description&&(r.description=Cast.toString(n.description)),void 0!==n.vision&&null!==n.vision&&(r.vision=Cast.toString(n.vision)),void 0!==n.website&&null!==n.website&&(r.website=Cast.toString(n.website)),void 0!==n.logo&&null!==n.logo&&(r.logo=import_path9.default.join(t,Cast.toString(n.logo)));const s=this.parseContact(n.contact);s&&(r.contact=s);const a=this.parseSocial(n.social);a&&(r.social=a),Object.keys(r).length>0&&(e.organization=r)}async parseMenu(e){if(!this.params)return;const t=this.params.menu;if(!t||"object"!=typeof t)return;const n={};for(const[e,r]of Object.entries(t))if(!1!==r){if(Array.isArray(r)){const t=this.parseMenuItems(r);t.length>0&&(n[e]=t)}else if(r&&"object"==typeof r){const t={};for(const[e,n]of Object.entries(r))if(!1===n)t[e]=!1;else if(Array.isArray(n)){const r=this.parseMenuItems(n);r.length>0&&(t[e]=r)}Object.keys(t).length>0&&(n[e]=t)}}else n[e]=!1;Object.keys(n).length>0&&(e.menu=n)}parseMenuItems(e){const t=[];for(const n of e){if(!n||"object"!=typeof n)continue;const e={title:"",url:""};if(void 0!==n.title&&null!==n.title&&(e.title=Cast.toString(n.title),void 0!==n.url&&null!==n.url)){{const t=Cast.toString(n.url);e.url=""===t?"":t}if(void 0!==n.weight&&null!==n.weight&&(e.weight=Cast.toInt(n.weight)),Array.isArray(n.children)){const t=this.parseMenuItems(n.children);t.length>0&&(e.children=t)}t.push(e)}}return t}async parseAuthor(e,t){if(!this.params)return;const n=this.params.author;if(!n||"object"!=typeof n)return;const r={};void 0!==n.name&&null!==n.name&&(r.name=Cast.toString(n.name)),void 0!==n.description&&null!==n.description&&(r.description=Cast.toString(n.description)),void 0!==n.website&&null!==n.website&&(r.website=Cast.toString(n.website)),void 0!==n.avatar&&null!==n.avatar&&(r.avatar=import_path9.default.join(t,Cast.toString(n.avatar)));const s=this.parseContact(n.contact);s&&(r.contact=s);const a=this.parseSocial(n.social);a&&(r.social=a),Object.keys(r).length>0&&(e.author=r)}parseContact(e){if(!e||"object"!=typeof e)return null;const t={};return void 0!==e.email&&null!==e.email&&(t.email=Cast.toString(e.email)),void 0!==e.address&&null!==e.address&&(t.address=Cast.toString(e.address)),void 0!==e.phone&&null!==e.phone&&(t.phone=Cast.toString(e.phone)),Object.keys(t).length>0?t:null}parseSocial(e){if(!e||"object"!=typeof e)return null;const t={},n=["github","twitter","linkedin"];for(const r of n)void 0!==e[r]&&null!==e[r]&&(t[r]=Cast.toString(e[r]));for(const[r,s]of Object.entries(e))n.includes(r)||null==s||(t[r]=Cast.toString(s));return Object.keys(t).length>0?t:null}toSlashPreserveLeading(e){return e.replace(/\\/g,"/")}};function getParamToLower(e,t){return getParam(e,t,!0)}function getParam(e,t,n){const r=e[t.toLowerCase()];if(null==r)return null;switch(typeof r){case"boolean":return r;case"string":return n?r.toLowerCase():r;case"number":return Number.isInteger(r)?Cast.toInt(r):r;default:return r instanceof Date?r:Array.isArray(r)&&r.every(e=>"string"==typeof e)&&n?Strings.sliceToLower(r):r}}var dimensionFlag_index=e=>{if(0===e)throw new Error("dimension flag not set");return e-1},LeafNode=class{key;val;constructor(e,t){this.key=e,this.val=t}},Edge=class{label;node;constructor(e,t){this.label=e,this.node=t}},Node=class{leaf=null;prefix="";edges=[];isLeaf(){return null!==this.leaf}addEdge(e){const t=this.edges.length;let n=0;for(;n<t&&this.edges[n].label<e.label;)n++;this.edges.splice(n,0,e)}updateEdge(e,t){const n=this.edges.length;let r=0;for(;r<n&&this.edges[r].label<e;)r++;if(!(r<n&&this.edges[r].label===e))throw new Error("replacing missing edge");this.edges[r].node=t}getEdge(e){const t=this.edges.length;let n=0;for(;n<t&&this.edges[n].label<e;)n++;return n<t&&this.edges[n].label===e?this.edges[n].node:null}delEdge(e){const t=this.edges.length;let n=0;for(;n<t&&this.edges[n].label<e;)n++;n<t&&this.edges[n].label===e&&this.edges.splice(n,1)}mergeChild(){const e=this.edges[0].node;this.prefix=this.prefix+e.prefix,this.leaf=e.leaf,this.edges=e.edges}};function longestPrefix(e,t){const n=Math.min(e.length,t.length);let r=0;for(r=0;r<n&&e[r]===t[r];r++);return r}var Tree=class e{root;size;constructor(){this.root=new Node,this.size=0}static newFromMap(t){const n=new e;if(t)if(t instanceof Map)t.forEach((e,t)=>{n.insert(t,e)});else for(const[e,r]of Object.entries(t))n.insert(e,r);return n}len(){return this.size}insert(e,t){let n=null,r=this.root,s=e;for(;;){if(0===s.length){if(r.isLeaf()){const e=r.leaf.val;return r.leaf.val=t,[e,!0]}return r.leaf=new LeafNode(e,t),this.size++,[void 0,!1]}if(n=r,r=r.getEdge(s.charCodeAt(0)),null===r){const r=new Edge(s.charCodeAt(0),new Node);return r.node.leaf=new LeafNode(e,t),r.node.prefix=s,n.addEdge(r),this.size++,[void 0,!1]}const a=longestPrefix(s,r.prefix);if(a===r.prefix.length){s=s.substring(a);continue}this.size++;const i=new Node;i.prefix=s.substring(0,a),n.updateEdge(s.charCodeAt(0),i),i.addEdge(new Edge(r.prefix.charCodeAt(a),r)),r.prefix=r.prefix.substring(a);const o=new LeafNode(e,t);if(s=s.substring(a),0===s.length)return i.leaf=o,[void 0,!1];const l=new Node;return l.leaf=o,l.prefix=s,i.addEdge(new Edge(s.charCodeAt(0),l)),[void 0,!1]}}delete(e){let t=null,n=0,r=this.root,s=e;for(;;){if(0===s.length){if(!r.isLeaf())break;const e=r.leaf;return r.leaf=null,this.size--,null!==t&&0===r.edges.length&&t.delEdge(n),r!==this.root&&1===r.edges.length&&r.mergeChild(),null===t||t===this.root||1!==t.edges.length||t.isLeaf()||t.mergeChild(),[e.val,!0]}if(t=r,n=s.charCodeAt(0),r=r.getEdge(n),null===r)break;if(!s.startsWith(r.prefix))break;s=s.substring(r.prefix.length)}return[void 0,!1]}async deletePrefix(e){return await this._deletePrefix(null,this.root,e)}async _deletePrefix(e,t,n){if(0===n.length){let n=0;return await recursiveWalk(t,(e,t)=>(n++,Promise.resolve(!1))),t.isLeaf()&&(t.leaf=null),t.edges=[],null===e||e===this.root||1!==e.edges.length||e.isLeaf()||e.mergeChild(),this.size-=n,n}const r=n.charCodeAt(0),s=t.getEdge(r);return null===s||!s.prefix.startsWith(n)&&!n.startsWith(s.prefix)?0:(n=s.prefix.length>n.length?n.substring(n.length):n.substring(s.prefix.length),this._deletePrefix(t,s,n))}get(e){let t=this.root,n=e;for(;;){if(0===n.length){if(t.isLeaf())return[t.leaf.val,!0];break}if(t=t.getEdge(n.charCodeAt(0)),null===t)break;if(!n.startsWith(t.prefix))break;n=n.substring(t.prefix.length)}return[void 0,!1]}longestPrefix(e){let t=null,n=this.root,r=e;for(;n.isLeaf()&&(t=n.leaf),0!==r.length&&(n=n.getEdge(r.charCodeAt(0)),null!==n)&&r.startsWith(n.prefix);)r=r.substring(n.prefix.length);return null!==t?[t.key,t.val,!0]:["",void 0,!1]}minimum(){let e=this.root;for(;;){if(e.isLeaf())return[e.leaf.key,e.leaf.val,!0];if(!(e.edges.length>0))break;e=e.edges[0].node}return["",void 0,!1]}maximum(){let e=this.root;for(;;){const t=e.edges.length;if(!(t>0)){if(e.isLeaf())return[e.leaf.key,e.leaf.val,!0];break}e=e.edges[t-1].node}return["",void 0,!1]}async walk(e){await recursiveWalk(this.root,e)}async walkPrefix(e,t){let n=this.root,r=e;for(;;){if(0===r.length)return void await recursiveWalk(n,t);if(n=n.getEdge(r.charCodeAt(0)),null===n)return;if(!r.startsWith(n.prefix))return void(n.prefix.startsWith(r)&&await recursiveWalk(n,t));r=r.substring(n.prefix.length)}}async walkPath(e,t){let n=this.root,r=e;for(;;){if(null!==n.leaf&&await t(n.leaf.key,n.leaf.val))return;if(0===r.length)return;if(n=n.getEdge(r.charCodeAt(0)),null===n)return;if(!r.startsWith(n.prefix))break;r=r.substring(n.prefix.length)}}async toMap(){const e={};return await this.walk((t,n)=>(e[t]=n,Promise.resolve(!1))),e}};async function recursiveWalk(e,t){if(null!==e.leaf&&await t(e.leaf.key,e.leaf.val))return!0;let n=0,r=e.edges.length;for(;n<r;){const s=e.edges[n];if(await recursiveWalk(s.node,t))return!0;if(0===e.edges.length)return recursiveWalk(e,t);e.edges.length>=r&&n++,r=e.edges.length}return!1}var WalkableTrees=class{trees;constructor(e){this.trees=e}walkPrefixRaw(e,t){for(const n of this.trees)n.walkPrefixRaw(e,t)}},MutableTrees=class{trees;constructor(e){this.trees=e}delete(e){for(const t of this.trees)t.delete(e)}deleteAll(e){for(const t of this.trees)t.deleteAll(e)}async deletePrefix(e){let t=0;for(const n of this.trees)t+=await n.deletePrefix(e);return Promise.resolve(t)}async deletePrefixAll(e){let t=0;for(const n of this.trees)t+=await n.deletePrefixAll(e);return t}lock(e){const t=this.trees.map(t=>t.lock(e));return()=>{for(const e of t)e()}}canLock(){for(const e of this.trees)if(!e.canLock())return!1;return!0}};function cleanKey(e){return"/"===e?"":e}function mustValidateKey(e){const t=function(e){return""===e?null:e.length<2?new Error(`too short key: "${e}"`):"/"!==e[0]?new Error(`key must start with '/': "${e}"`):"/"===e[e.length-1]?new Error(`key must not end with '/': "${e}"`):null}(e);if(t)throw t;return e}function newSimpleTree(){return new SimpleTree}var SimpleTree=class{mu;tree;zero;constructor(){this.tree=new Tree,this.zero=void 0;let e=!1,t=0;this.mu={lock:()=>{for(;e||t>0;);e=!0},unlock:()=>{e=!1},rLock:()=>{for(;e;);t++},rUnlock:()=>{t--}}}get(e){this.mu.rLock();try{const[t,n]=this.tree.get(e);return n?t:this.zero}finally{this.mu.rUnlock()}}longestPrefix(e){this.mu.rLock();try{const[t,n,r]=this.tree.longestPrefix(e);return r?[t,n]:["",this.zero]}finally{this.mu.rUnlock()}}insert(e,t){this.mu.lock();try{return this.tree.insert(e,t),t}finally{this.mu.unlock()}}async walkPrefix(e,t,n){switch(e){case 0:break;case 1:this.mu.rLock();break;case 2:this.mu.lock()}try{let e=null;return await this.tree.walkPrefix(t,async(t,r)=>{const[s,a]=n(t,r);return a?(e=a,Promise.resolve(!0)):s}),e}finally{switch(e){case 0:break;case 1:this.mu.rUnlock();break;case 2:this.mu.unlock()}}}},TreeShiftTree=class e{d;v;trees;constructor(e,t){if(t<=0)throw new Error("length must be > 0");this.d=e,this.v=0,this.trees=[];for(let e=0;e<t;e++)this.trees.push(newSimpleTree())}static newTreeShiftTree(t,n){return new e(t,n)}shape(t,n){if(t!==this.d)throw new Error("dimension mismatch");if(n>=this.trees.length)throw new Error("value out of range");const r=Object.create(e.prototype);return Object.assign(r,this),r.v=n,r}get(e){return this.trees[this.v].get(e)}longestPrefix(e){return this.trees[this.v].longestPrefix(e)}insert(e,t){return this.trees[this.v].insert(e,t)}async walkPrefix(e,t,n){return await this.trees[this.v].walkPrefix(e,t,n)}delete(e){for(const t of this.trees)t.tree.delete(e)}async deletePrefix(e){let t=0;for(const n of this.trees)t+=await n.tree.deletePrefix(e);return t}lock(e){if(e){for(const e of this.trees)e.mu.lock();return()=>{for(const e of this.trees)e.mu.unlock()}}for(const e of this.trees)e.mu.rLock();return()=>{for(const e of this.trees)e.mu.rUnlock()}}},NodeShiftTree=class e{tree;dims;shifter;mu;constructor(e){if(!e.shifter)throw new Error("Shifter is required");this.shifter=e.shifter,this.tree=new Tree,this.dims=[0];let t=!1,n=0;this.mu={lock:()=>{for(;t||n>0;);t=!0},unlock:()=>{t=!1},rLock:()=>{for(;t;);n++},rUnlock:()=>{n--},tryLock:()=>!(t||n>0||(t=!0,0))}}static new(t){return new e(t)}delete(e){this.deleteInternal(e)}async deleteAll(e){await this.tree.walkPrefix(e,(e,t)=>{const[n,r]=this.tree.delete(e);return Promise.resolve(!1)})}async deletePrefix(e){let t=0;const n=[];await this.tree.walkPrefix(e,(e,t)=>(n.push(e),Promise.resolve(!1)));for(const e of n)this.deleteInternal(e)&&t++;return t}deleteInternal(e){let t=!1;const[n,r]=this.tree.get(e);if(r){const[r,s]=this.shifter.delete(n,this.dims);t=r,s&&this.tree.delete(e)}return t}async deletePrefixAll(e){let t=0;return await this.tree.walkPrefix(e,(e,n)=>{const[r,s]=this.tree.delete(e);return s&&t++,Promise.resolve(!1)}),t}increment(e){return this.shape(e,this.dims[e]+1)}insertIntoCurrentDimension(e,t){e=mustValidateKey(cleanKey(e));const[n,r]=this.tree.get(e);return r&&(t=this.shifter.insertInto(n,t,this.dims)),this.tree.insert(e,t),[t,!0]}insertIntoValuesDimension(e,t){e=mustValidateKey(cleanKey(e));const[n,r]=this.tree.get(e);return r&&(t=this.shifter.insert(n,t)),this.tree.insert(e,t),[t,!0]}insertRawWithLock(e,t){this.mu.lock();try{return this.tree.insert(e,t)}finally{this.mu.unlock()}}insertWithLock(e,t){this.mu.lock();try{return this.insertIntoValuesDimension(e,t)}finally{this.mu.unlock()}}len(){return this.tree.len()}canLock(){const e=this.mu.tryLock();return e&&this.mu.unlock(),e}lock(e){return e?this.mu.lock():this.mu.rLock(),()=>{e?this.mu.unlock():this.mu.rUnlock()}}longestPrefix(e,t,n){let r=e;for(;;){const[e,s,a]=this.tree.longestPrefix(r);if(a){const[r,a]=this.shift(s,t);if(a&&(!n||n(r)))return[e,r]}if(""===r||"/"===r)return["",void 0];const i=r.lastIndexOf("/");if(0===i)r="";else{if(!(i>0))break;r=r.substring(0,i)}}return["",void 0]}longestPrefixAll(e){const[t,,n]=this.tree.longestPrefix(e);return[t,n]}getRaw(e){const[t,n]=this.tree.get(e);return n?[t,!0]:[void 0,!1]}async walkPrefixRaw(e,t){await this.tree.walkPrefix(e,(e,n)=>t(e,n))}shape(e,t){const n=this.clone();return n.dims[e]=t,n}toString(){return`Root{${this.dims}}`}get(e){const[t]=this.getInternal(e);return t}forEachInDimension(e,t,n){e=cleanKey(e);const[r,s]=this.tree.get(e);s&&this.shifter.forEachInDimension(r,t,n)}has(e){const[,t]=this.getInternal(e);return t}clone(){const t=Object.create(e.prototype);return Object.assign(t,this),t.dims=[...this.dims],t}shift(e,t){const[n,r]=this.shifter.shift(e,this.dims,t);return[n,r]}getInternal(e){e=cleanKey(e);const[t,n]=this.tree.get(e);if(!n)return[void 0,!1];const[r,s]=this.shift(t,!0);return[r,s]}},NodeShiftTreeWalker=class e{tree;handle;prefix;lockType;noShift;exact;debug;walkContext;skipPrefixes=[];constructor(e){if(!e.tree)throw new Error("Tree is required");this.tree=e.tree,this.handle=e.handle,this.prefix=e.prefix||"",this.lockType=e.lockType||0,this.noShift=e.noShift||!1,this.exact=e.exact||!1,this.debug=e.debug||!1,this.walkContext=e.walkContext}extend(){const t=new e({tree:this.tree,handle:this.handle,prefix:this.prefix,lockType:this.lockType,noShift:this.noShift,exact:this.exact,debug:this.debug,walkContext:this.walkContext});return t.resetLocalState(),t}skipPrefix(...e){this.skipPrefixes.push(...e)}shouldSkip(e){for(const t of this.skipPrefixes)if(e.startsWith(t))return!0;return!1}async walk(){this.resetLocalState();let e=null;this.lockType>0&&(e=this.tree.lock(2===this.lockType));try{let e=null;const t=async(t,n)=>{if(this.shouldSkip(t))return!1;const[r,s,a]=this.toT(this.tree,n);if(!s)return!1;const[i,o]=await this.handle(t,r,a);return!(!i&&!o||(e=o,0))};return""!==this.prefix?await this.tree.tree.walkPrefix(this.prefix,t):await this.tree.tree.walk(t),e}finally{e&&e()}}resetLocalState(){this.skipPrefixes=[]}toT(e,t){if(this.noShift)return[t,!0,2];{const[n,r,s]=e.shifter.shift(t,e.dims,this.exact);return[n,r,s]}}},Shifter2=class{delete(e,t){return[e.delete(t[dimensionFlag_index(1)]),e.isEmpty()]}shift(e,t,n){const[r,s]=e.shift(t[dimensionFlag_index(1)],n);return null!==r?s?[r,!0,1]:[r,!0,2]:[new PageTreesNode,!1,2]}forEachInDimension(e,t,n){if(t!==dimensionFlag_index(1))throw new Error("only language dimension supported");n(e)}insertInto(e,t,n){return e.mergeWithLang(t,n[dimensionFlag_index(1)])}insert(e,t){return e.merge(t)}},PageShifter=class extends Shifter2{shift(e,t,n){const[r,s]=e.shift(t[dimensionFlag_index(1)],n);return null!==r&&s?[r,!0,1]:[new PageTreesNode,!1,2]}},SourceShifter=class extends Shifter2{shift(e,t,n){const[r,s]=e.shift(t[dimensionFlag_index(1)],n);return null!==r?s?[r,!0,1]:[r,!0,2]:[new PageTreesNode,!1,2]}},WeightedTermTreeNode=class{pageTreesNodeInstance;term;constructor(e,t){this.pageTreesNodeInstance=e,this.term=t}getPage(){return this.pageTreesNodeInstance.getPage()}getPages(){return this.pageTreesNodeInstance.getPages()}getResource(){return this.pageTreesNodeInstance.getResource()}isEmpty(){return this.pageTreesNodeInstance.isEmpty()}shift(e,t){return this.pageTreesNodeInstance.shift(e,t)}},PageTreesNode=class{nodes;constructor(){this.nodes=new Map}setNode(e,t){this.nodes.set(e,t)}merge(e){const t=new Map;for(const e of this.nodes.keys())t.set(e.pageLanguage(),e);for(const[n,r]of e.nodes.entries()){const e=t.get(n.pageLanguage());e?this.nodes.set(e,r):this.nodes.set(n,r)}return this}mergeWithLang(e,t){const n=new Map;for(const e of this.nodes.keys())n.set(e.pageLanguage(),e);for(const[r,s]of e.nodes.entries()){const e=n.get(r.pageLanguage());if(e){const n=this.nodes.get(e);n&&n.pageIdentity().pageLanguageIndex()===t&&this.remove(e)}this.nodes.set(r,s)}return this}remove(e){const t=this.nodes.get(e);return!!t&&(this.markStale(t),this.nodes.delete(e),!0)}delete(e){for(const[t,n]of this.nodes.entries())if(n.pageIdentity().pageLanguageIndex()===e)return this.remove(t);return!1}isEmpty(){return 0===this.nodes.size}shift(e,t){let n=null;for(const[t,r]of this.nodes.entries())if(null===n&&(n=r),r.pageIdentity().pageLanguageIndex()===e)return[newPageTreesNode2(r),!0];return null===n||t?[null,!1]:[newPageTreesNode2(n),!1]}getPage(){for(const e of this.nodes.values())if(e&&"function"==typeof e.kind)return[e,!0];return[null,!1]}getPages(){const e=[];for(const t of this.nodes.values())t&&"function"==typeof t.kind&&e.push(t);return e}getResource(){for(const e of this.nodes.values())return[e,!0];return[null,!1]}markStale(e){"staleVersions"in e&&e.staleVersions}},PageTrees=class{treePages;treeResources;treePagesResources;treeTaxonomyEntries;resourceTrees;constructor(){this.treePages=new NodeShiftTree({shifter:new PageShifter}),this.treeResources=new NodeShiftTree({shifter:new SourceShifter}),this.treeTaxonomyEntries=TreeShiftTree.newTreeShiftTree(0,10),this.treePagesResources=new WalkableTrees([]),this.resourceTrees=new MutableTrees([]),this.treePagesResources=new WalkableTrees([this.treePages,this.treeResources]),this.resourceTrees=new MutableTrees([this.treeResources])}createMutableTrees(){this.treePagesResources=new WalkableTrees([this.treePages,this.treeResources]),this.resourceTrees=new MutableTrees([this.treeResources])}get TreePages(){return this.treePages}get TreeResources(){return this.treeResources}get TreePagesResources(){return this.treePagesResources}get TreeTaxonomyEntries(){return this.treeTaxonomyEntries}get ResourceTrees(){return this.resourceTrees}};function newPageTreesNode2(e){const t=new PageTreesNode;return e&&t.setNode(e.pageIdentity(),e),t}init_log();var pageIDCounter=0,log23=getDomainLogger("content",{component:"pagesource"}),Source=class{id;identity;file;constructor(e){this.id=(++pageIDCounter).toString(),this.identity=new Identity(pageIDCounter),this.file=e}sourceKey(){return`${this.identity.lang}/${this.file.filename()}`.replace(/\\/g,"/")}async contentSource(){return await this.readSourceAll()}async readSourceAll(){try{const e=await this.file.open(),t=await e.stat(),n=new Uint8Array(t.size()),r=await e.read(n);return await e.close(),r.buffer}catch(e){const t=e instanceof Error?e.message:String(e);throw new Error(`Failed to read file content: ${t}`)}}async posOffset(e){try{const t=await this.contentSource();return function(e,t,n){if(n<0)return{filename:e,lineNumber:0,columnNumber:0,offset:0};const r=t.slice(0,n);let s=1;for(let e=0;e<r.length;e++)10===r[e]&&s++;let a=-1;for(let e=r.length-1;e>=0;e--)if(10===r[e]){a=e;break}return{filename:e,lineNumber:s,columnNumber:n-a,offset:n}}(this.file.filename(),t,e)}catch(e){throw new Error(`failed to read content source for "${this.file.filename()}": ${e}`)}}pageIdentity(){return this.identity}pageFile(){return this.file}staleVersions(){return[]}section(){return this.file.section()}paths(){return this.file.paths()}path(){return this.file.paths().path()}slug(){return this.pathToSlug(this.path())}pathToSlug(e){let t=e.replace(/^\//,"");return t=t.replace(/\.md$/,""),t.endsWith("/index")&&(t=t.replace(/\/index$/,"")),"index"!==t&&""!==t||(t="index"),t.endsWith("/_index")&&(t=t.replace(/\/_index$/,"")),t}opener(){return()=>this.file.open()}openReader(){return{read:async()=>new Uint8Array(0)}}async content(){try{return log23.error(`Reading content not implemented from: ${this.file.filename()}`),new Uint8Array(0)}catch(e){const t=`failed to read content source for "${this.file.filename()}": ${e}`;throw log23.error(t),new Error(t)}}};function newPageSource(e){return new Source(e)}init_log();var log24=getDomainLogger("content",{component:"pagemap"});function addTrailingSlash(e){return e.endsWith("/")||(e+="/"),e}var ambiguousContentNode=new PageTreesNode,ContentTreeReverseIndexMap=class{initOnce=!1;m=new Map;constructor(){}},ContentTreeReverseIndex=class{initFn;contentTreeReverseIndexMap;constructor(e){this.initFn=e,this.contentTreeReverseIndexMap=new ContentTreeReverseIndexMap}reset(){this.contentTreeReverseIndexMap=new ContentTreeReverseIndexMap}get(e){return this.contentTreeReverseIndexMap.initOnce||(this.contentTreeReverseIndexMap.m=new Map,this.initFn(this.contentTreeReverseIndexMap.m),this.contentTreeReverseIndexMap.initOnce=!0),this.contentTreeReverseIndexMap.m.get(e)||null}},pagePredicates_kindPage=e=>"page"===e.kind(),pagePredicates_shouldListLocal=e=>!e.shouldList||e.shouldList(!1),pagePredicates_shouldListGlobal=e=>!e.shouldList||e.shouldList(!0),PageMapQueryPagesBelowPathImpl=class{path;keyPart;include;constructor(e,t,n=pagePredicates_shouldListLocal){this.path=e,this.keyPart=t,this.include=n}key(){return this.path+"/"+this.keyPart}},PageMapQueryPagesInSectionImpl=class extends PageMapQueryPagesBelowPathImpl{recursive;includeSelf;index;constructor(e,t,n,r,s,a){super(e,t,a),this.recursive=n,this.includeSelf=r,this.index=s}key(){return"gagesInSection/"+super.key()+"/"+this.recursive.toString()+"/"+this.index.toString()+"/"+this.includeSelf.toString()}},PageMap=class extends PageTrees{pageReverseIndex=null;pageBuilder;constructor(e){super(),this.pageBuilder=e}setupReverseIndex(){this.pageReverseIndex=new ContentTreeReverseIndex(async e=>{const t=new NodeShiftTreeWalker({tree:this.treePages,lockType:1,handle:async(t,n,r)=>{if(n){const[t,r]=n.getPage();if(!r)return[!1,null];t.pageFile&&t.pageFile()&&((t,n)=>{const r=e.get(t);r&&r!==ambiguousContentNode?e.set(t,ambiguousContentNode):r||e.set(t,n)})(t.paths().baseNameNoIdentifier(),n)}return[!1,null]}});try{await t.walk()}catch(e){log24.error(`setupReverseIndex error: ${e}`)}})}insertResourceNode(e,t){const n=this.treeResources,r=n.lock(!0);try{n.insertIntoValuesDimension(e,t)}finally{r()}}async addFi(e){if(e.fileInfo().isDir())return;const t=newPageSource(e),n=t.paths().base();switch(t.file.getBundleType()){case 0:this.insertResourceNode(n,newPageTreesNode2(t));break;case 1:const e=await this.pageBuilder.withSource(t).build();if(!e)return;this.insertResourceNode(n,newPageTreesNode2(e));break;default:const r=await this.pageBuilder.withSource(t).build();this.treePages.insertWithLock(t.paths().base(),newPageTreesNode2(r))}}async assemble(){await this.assembleStructurePages(),await this.applyAggregates(),await this.cleanPages(),await this.assembleTerms()}async assembleTerms(){for(const e of this.pageBuilder.langSvc.languageIndexes()){const t=this.treePages.shape(0,e),n=this.treeTaxonomyEntries.shape(0,e);await this.pageBuilder.term.assemble(t,n,this.pageBuilder,e)}}async cleanPages(){}async applyAggregates(){}async assembleStructurePages(){await this.addMissingTaxonomies();for(const e of this.pageBuilder.langSvc.languageIndexes()){const t=this.treePages.shape(0,e);await this.pageBuilder.section.assemble(t,this.pageBuilder,e)}await this.addMissingStandalone()}async addMissingTaxonomies(){const e=this.treePages.lock(!0);try{for(const e of this.pageBuilder.langSvc.languageIndexes()){const t=this.treePages.shape(0,e);await this.pageBuilder.taxonomy.assemble(t,this.pageBuilder,e)}}finally{e()}}async addMissingStandalone(){const e=this.treePages,t=e.lock(!0);try{await this.pageBuilder.standalone.assemble(e,this.pageBuilder)}finally{t()}}async getResourcesForPage(e){const t=[];return await this.forEachResourceInPage(e,0,!1,(e,n,r)=>{const[s,a]=n.getResource();return a&&t.push(s),[!1,null]}),t}async forEachResourceInPage(e,t,n,r){let s=e.paths().base();"/"===s&&(s="");const a=addTrailingSlash(s),i="page"!==e.kind(),o=new NodeShiftTreeWalker({tree:this.treeResources.shape(0,e.pageIdentity().pageLanguageIndex()),prefix:a,lockType:t,exact:n,handle:async(e,t,n)=>{if(i){const[t]=this.treePages.longestPrefixAll(e);if(t!==s&&this.pathDir(t)!==this.pathDir(e))return o.skipPrefix(t+"/"),[!1,null]}return r(e,t,n)}});try{await o.walk()}catch(e){log24.error(`forEachResourceInPage error: ${e}`)}}async getPagesInSection(e,t){const n=t.key(),r=this.treePages.shape(0,e);return this.getOrCreatePagesFromCacheSync(null,n,async e=>{const n=addTrailingSlash(t.path),s=[];let a="";const i=t.include,o=new NodeShiftTreeWalker({tree:r,prefix:n,handle:async(e,n,r)=>{if(t.recursive){const[e,t]=n.getPage();return t&&i(e)&&s.push(e),[!1,null]}const[l,c]=n.getPage();if(c&&i(l)&&s.push(l),!l.isPage||!l.isPage()){const t=e+"/";""!==a&&a===t||o.skipPrefix(t),a=t}return[!1,null]}});try{if(await o.walk(),t.includeSelf){const e=r.get(t.path);if(e){const[t,n]=e.getPage();n&&i(t)&&s.push(t)}}const e=s;return function(e){pageBy(weight).sort(e)}(e),Promise.resolve(e)}catch(e){log24.error(`getPagesInSection error: ${e}`)}return Promise.resolve(s)})}async getOrCreatePagesFromCacheSync(e,t,n){return await n(t)}async getPagesWithTerm(e,t){const n=t.key(),r=this.treeTaxonomyEntries.shape(0,e);return await this.getOrCreatePagesFromCacheSync(null,n,async e=>{const n=[],s=t.include;try{await r.walkPrefix(0,addTrailingSlash(t.path),(e,t)=>{const[r,a]=t.getPage();return a&&s(r)&&n.push(r),[!1,null]});const e=n;return sortByDefault(e),e}catch(e){log24.error(`getPagesWithTerm error: ${e}`)}return n})}getTermsForPageInTaxonomy(e,t,n){const r=((s=n).startsWith("/")||(s="/"+s),s);var s;const a=this.treeTaxonomyEntries.shape(0,e);return this.getOrCreatePagesFromCacheSync(null,r+t,async e=>{const n=[];try{await a.walkPrefix(0,addTrailingSlash(r),(e,r)=>(e.endsWith(t)&&n.push(r.term.page),[!1,null]));const e=n;return sortByDefault(e),e}catch(e){log24.error(`getTermsForPageInTaxonomy error: ${e}`)}return n})}async getSections(e,t){const n=[];let r="";const s=this.treePages.shape(0,e),a=new NodeShiftTreeWalker({tree:s,prefix:t,handle:async(e,t,s)=>{const[i,o]=t.getPage();return o?(i.isPage&&i.isPage()||(""!==r&&e.startsWith(r)||(i.isSection&&i.isSection()&&i.shouldList&&i.shouldList(!1)&&i.parent&&i.parent()===i?n.push(i):a.skipPrefix(e+"/")),r=e+"/"),[!1,null]):[!1,null]}});try{await a.walk();const e=n;return sortByDefault(e),e}catch(e){log24.error(`getSections error: ${e}`)}return n}pathDir(e){const t=e.lastIndexOf("/");return-1===t?"":e.substring(0,t)}};init_log();var log25=getDomainLogger("content",{component:"pagecollector"}),PagesCollector=class{m;fs;processedPaths=new Set;constructor(e,t){this.m=e,this.fs=t}async collect(){try{const e="",t=this.fs.contentFs();for(const n of t){this.processedPaths.clear();const t=await n.stat(e);await this.collectDir(n,e,t)}}catch(e){log25.error(`Failed to collect directory: ${e}, continuing...`)}}async collectDir(e,t,n){try{await this.fs.walkContent(e,t,{hookPre:async(e,t,n)=>{const r=t;if(this.processedPaths.has(r))return log25.warn("Path already processed!",{path:r,dirName:e.name(),dirIsDir:e.isDir(),readdirLength:n.length}),[];if(this.processedPaths.add(r),0===n.length)return[];for(const e of n){if(e.isDir&&e.isDir())continue;const t=newFileInfo2(e);await this.m.addFi(t)}return n},walkFn:async(e,t)=>{}},{info:n})}catch(e){throw log25.error(`Failed to collect directory: ${e}`,{path:t,rootName:n.name(),rootIsDir:n.isDir(),stack:e.stack||"No stack trace available"}),new Error(`Failed to collect directory: ${e}`)}}async handleBundleLeaf(e,t,n,r){const s=t.paths(),a=async(e,n)=>{if(n.isDir())return;const r=newFileInfo2(n);n!==t.fileInfo()&&(r.isLeafBundle()&&r.paths().dir()===s.dir()||r.shiftToResource()),await this.m.addFi(r)},i=this.fs.contentFs();for(const t of i)await this.fs.walkContent(t,n,{walkFn:a},{info:e,dirEntries:r})}};init_log();var log26=getDomainLogger("content",{component:"content"}),Content2=class{fs;converter;pageMap;translator;pageCollected=!1;constructor(e,t,n,r){this.fs=e,this.converter=t,this.pageMap=n,this.translator=r}setTemplateSvc(e){this.pageMap.pageBuilder.templateSvc=e}async renderString(e,...t){if(t.length<1||t.length>2)throw new Error("RenderString want 1 or 2 arguments");let n=1;if(1!==t.length){const e=t[0];if("object"!=typeof e||null===e)throw new Error("first argument must be a map");throw new Error("RenderString not implemented yet")}n=0;const r=t[0],s=String(r);return newFileInfo2(this.fs.newFileMetaInfoWithContent(s)),s}async collectPages(){if(this.pageCollected)log26.info("Pages have already been collected, skipping.");else try{await this.process(),await this.assemble(),this.pageCollected=!0}catch(e){throw new Error(`process/assemble: ${e}`)}}async process(){try{const e=new PagesCollector(this.pageMap,this.fs);await e.collect()}catch(e){throw e}}async assemble(){try{await this.pageMap.assemble()}catch(e){throw e}}async getPageSources(e){let t=e.paths().base();return"/"===t&&(t=""),await this.pageMap.getResourcesForPage(e)}async globalPages(e){return await this.pageMap.getPagesInSection(e,new PageMapQueryPagesInSectionImpl("","global",!0,!0,0,pagePredicates_shouldListGlobal))}async globalRegularPages(){return await this.pageMap.getPagesInSection(0,new PageMapQueryPagesInSectionImpl("","global",!0,!0,0,e=>pagePredicates_shouldListGlobal(e)&&pagePredicates_kindPage(e)))}async walkPages(e,t){const n=this.pageMap.treePages.shape(0,e),r=new NodeShiftTreeWalker({tree:n,handle:async(e,n,r)=>{const[s,a]=n.getPage();if(!a)return[!1,null];try{await t(s)}catch(e){return[!1,e instanceof Error?e:new Error(String(e))]}return[!1,null]}});try{await r.walk()}catch(t){throw log26.error(`WalkPages failed for langIndex ${e}:`,t),t}}async walkTaxonomies(e,t){try{const n=this.pageMap.treePages.shape(0,e),r=this.pageMap.pageBuilder.taxonomy;for(const s of r.views){const a=r.pluralTreeKey(s.plural()),i=new NodeShiftTreeWalker({tree:n,prefix:addTrailingSlash(a),lockType:1,handle:async(n,r,a)=>{const[i,o]=r.getPage();if(!o)return[!1,null];if("term"===i.kind()){const r=i;if(!r.term)return[!0,new Error("term is empty")];const a=r.term.toLowerCase();try{const i=this.pageMap.treeTaxonomyEntries.shape(0,e);return await i.walkPrefix(1,addTrailingSlash(n),(e,n)=>{const[i,o]=n.getPage();return o?(t(s.plural(),a,{weight:()=>n.term.Weight(),ordinal:()=>n.term.Ordinal(),page:()=>i,owner:()=>r}).catch(e=>{log26.error("Error in taxonomy walker:",e)}),[!1,null]):[!1,null]}),[!1,null]}catch(e){return[!0,e]}}return[!1,null]}});await i.walk()}}catch(e){throw e}}getPageFromPath(e,t){try{const n=PathDomain.createProcessor().parse(PATH_CONSTANTS.COMPONENT_FOLDER_CONTENT,t);let r=this.pageMap.treePages.shape(0,e).get(n.base());if(r){const[e,t]=r.getPage();if(t)return e}return null}catch(e){return log26.error(`❌ Content.getPageFromPath error for path "${t}":`,e),null}}getPageFromFile(e,t){try{let n=this.pageMap.treePages.shape(0,e).get(t.paths().base());if(n){const[e,t]=n.getPage();if(t)return e}return null}catch(e){return log26.error(`❌ Content.getPageFromPath error for path "${t.path()}":`,e),null}}async handleChangeFiles(e){const t=[];for(const[n,r]of e)try{await this.addOrUpdateFile(r,t)}catch(e){log26.error(`Failed to process file change for ${n}:`,e)}return t}async addOrUpdateFile(e,t){if(!e.isDir())try{const n=newFileInfo2(e),r=n.paths().base();r&&t.push(r),await this.pageMap.addFi(n);const s=this.getPageFromFile(0,n);s&&s.pageIdentity&&s.pageIdentity().markStale()}catch(t){throw log26.error(`Failed to add/update file in PageMap: ${e.fileName()}`,t),t}}translate(e,t){return this.translator?this.translator.translate(e,t):(log26.warn("Translator not initialized, returning fallback translation"),`[i18n] ${t}`)}getAvailableLanguages(){return this.translator?this.translator.getAvailableLanguages():[]}hasLanguageSupport(e){return!!this.translator&&this.translator.hasLanguage(e)}},MDConverter=class{md;constructor(e){this.md=e}async convert(e,t){return this.md.render(t,e)}async parseContent(e){return this.md.parseContent(e)}async parseAndRenderContent(e,t){return this.md.parseAndRenderContent(e,t)}async prepareRender(e){return this.md.prepareRender(e)}},Content3=class{rawSource;frontMatter;renderedContent="";summary="";wordCount=0;readingTime=0;toc;lazyRendered=!0;lazyRender;constructor(e){this.rawSource=e}updateWithContentResult(e){e.frontMatter&&(this.frontMatter=e.frontMatter),this.renderedContent=e.renderedContent||"",this.summary=e.summary,this.wordCount=e.wordCount||0,this.readingTime=e.readingTime||0}getRawSource(){return this.rawSource}async RenderedContent(){return await this.render(),this.renderedContent}async Summary(){return await this.render(),this.summary}async WordCount(){return await this.render(),this.wordCount}async ReadingTime(){return await this.render(),this.readingTime}async render(){return this.lazyRendered&&this.lazyRender&&(await this.lazyRender(),this.lazyRendered=!1),Promise.resolve()}isEmpty(){return!this.rawSource||0===this.rawSource.length}};function newContent(e){return new Content3(e)}init_log();var log27=getDomainLogger("content",{component:"section"}),Section=class{home;seen;fsSvc;constructor(e){this.home=null,this.seen={},this.fsSvc=e}isHome(e){return""===e}isSectionExist(e){return!(""!==e&&!this.seen[e]&&(this.seen[e]=!0,1))}async assemble(e,t,n){this.seen={};const r=new NodeShiftTreeWalker({tree:e,lockType:2,handle:async(e,s,a)=>{if(!s)throw new Error("n is null");const[i,o]=s.getPage();if(!o)return[!1,null];if(this.isHome(e))return this.home=i,[!1,null];const l=i.kind();if(l!==getKindMain("page")&&l!==getKindMain("section"))return[!1,null];const c=i.paths().sections();for(const e of c)if(!this.isSectionExist(e))try{const s=newPageSource(newFileInfo2(this.fsSvc.newFileMetaInfo("/"+e+"/_index.md"))),a=s.paths().base();if(!r.tree.get(a)){const e=await t.withSource(s).withLangIdx(n).kindBuild();r.tree.insertIntoValuesDimension(a,newPageTreesNode2(e))}}catch(e){return[!1,e]}return[!1,null]}});try{await r.walk()}catch(e){throw log27.error("Error walking pages:",e),e}if(!this.home&&(await this.createHome(t),this.home)){const t=this.home;e.insertWithLock(t.paths().base(),newPageTreesNode2(t))}}async createHome(e){const t=newPageSource(newFileInfo2(this.fsSvc.newFileMetaInfo("/_index.md"))),n=await e.withSource(t).kindBuild();this.home=n}},Standalone=class{fsSvc;constructor(e){this.fsSvc=e}async assemble(e,t){const n="/404",r=await this.addStandalone(n,t);e.insertIntoValuesDimension(n,newPageTreesNode2(r));const s="/_sitemap",a=await this.addStandalone(s,t);e.insertIntoValuesDimension(s,newPageTreesNode2(a))}async addStandalone(e,t){const n=newPageSource(newFileInfo2(this.fsSvc.newFileMetaInfo(e+".md")));return await t.withSource(n).kindBuild()}};init_log();var Output=class{source;pageKind;baseName;target=null;constructor(e,t){this.source=e,this.pageKind=t,this.baseName="",this.setBasename(),this.buildTarget()}setBasename(){switch(this.pageKind){case getKindMain("404"):this.baseName="404";break;case getKindMain("sitemap"):this.baseName="sitemap";break;default:this.baseName=this.source.paths().baseNameNoIdentifier()||"index"}}buildTarget(){let e="",t="";const n="index";switch(this.pageKind){case getKindMain("home"):e=`${n}.html`,t="";break;case getKindMain("page"):const r=this.source.paths().containerDir();e=r&&"/"!==r?`${r}/${this.baseName}.html`:`/${this.baseName}.html`,t=r||"";break;case getKindMain("section"):case getKindMain("taxonomy"):case getKindMain("term"):const s=this.source.paths().dir();e=s?`${s}/${n}.html`:`${n}.html`,t=s||"";break;case getKindMain("404"):const a=this.source.paths().dir();e=a?`${a}/${this.baseName}.html`:`${this.baseName}.html`,t=a||"";break;case getKindMain("sitemap"):const i=this.source.paths().dir();e=i?`${i}/${this.baseName}.xml`:`${this.baseName}.xml`,t=i||"";break;default:e=`${n}.html`,t=""}this.target={prefix:this.source.identity.pageLanguage(),filePath:e,subResourceBaseTarget:t}}createBasicResult(){return{bytes:()=>new Uint8Array,headers:()=>[],tableOfContents:()=>({toHTML:(e,t,n)=>""})}}output(e){return{targetFileBase:()=>{if(!this.target)return"index.html";const e=this.target.filePath,t=e.lastIndexOf("/");return t>=0?e.substring(t+1):e},targetFilePath:()=>this.target.filePath,targetSubResourceDir:()=>this.target.subResourceBaseTarget,targetPrefix:()=>this.target.prefix,content:async()=>e.content?e.content.RenderedContent():"",summary:async()=>e.content?e.content.Summary():"",tableOfContents:()=>e.content&&e.content.toc?e.content.toc.toHTML(1,6,!1):"",result:()=>this.createBasicResult(),readingTime:async()=>e.content?e.content.ReadingTime():0,wordCount:async()=>e.content?e.content.WordCount():0}}};init_log(),getDomainLogger("content",{component:"paginator"});var PaginatorImpl=class{paginatedElements;_pagers;base;total;size;constructor(e,t,n,r){if(this.paginatedElements=e,this.base=r,this.total=t,this.size=n,this._pagers=[],e.length>0)for(let t=0;t<e.length;t++)this._pagers.push(new PagerImpl(t+1,this));else this._pagers.push(new PagerImpl(1,this))}totalPages(){return this.paginatedElements.length}pagers(){return[...this._pagers]}getElement(e){return 0===this.paginatedElements.length?[]:this.paginatedElements[e-1]||[]}getBase(){return this.base}getPagers(){return this._pagers}getAllPages(){const e=[];for(const t of this.paginatedElements)e.push(...t);return e}},PagerImpl=class{number;paginator;constructor(e,t){this.number=e,this.paginator=t}pageNumber(){return this.number}totalPages(){return this.paginator.totalPages()}url(){const e=this.pageNumber();if(e>1){const t=`/page/${e}/`;return this.pathJoin(this.paginator.getBase(),t)}return this.paginator.getBase()}pages(){return this.element()}allPages(){return this.paginator.getAllPages()}pagers(){return this.paginator.pagers()}first(){return this.paginator.getPagers()[0]}last(){const e=this.paginator.getPagers();return e[e.length-1]}hasPrev(){return this.pageNumber()>1}prev(){return this.hasPrev()?this.paginator.getPagers()[this.pageNumber()-2]:null}hasNext(){return this.pageNumber()<this.paginator.totalPages()}next(){return this.hasNext()?this.paginator.getPagers()[this.pageNumber()]:null}element(){return this.paginator.getElement(this.pageNumber())}pathJoin(e,t){return e.endsWith("/")&&(e=e.slice(0,-1)),t.startsWith("/")||(t="/"+t),e+t}},PaginatorManagerImpl=class{currentPager=null;initialized=!1;svc;page;constructor(e,t){this.svc=e,this.page=t}async current(){return this.initialized||await this.initializePaginator(),this.currentPager?this.currentPager:new PaginatorImpl([],0,10,this.page.paths().base()).pagers()[0]}setCurrent(e){this.currentPager=e}async paginate(e){if(!this.initialized){const t=this.svc.pageSize();let n;n=Array.isArray(e)&&e.length>0&&"key"in e[0]?this.newPaginatorFromPageGroups(e,t,this.page.paths().base()):this.newPaginatorFromPages(e,t,this.page.paths().base()),this.currentPager=n.pagers()[0],this.initialized=!0}return this.currentPager||this.current()}async paginator(){return this.initialized||await this.initializePaginator(),this.currentPager||this.current()}async initializePaginator(){try{const e=this.svc.pageSize();let t=[];switch(this.page.kind()){case"home":t=await this.svc.globalRegularPages();break;case"term":case"taxonomy":const e=await this.page.pages();t=e?.length?Array.from({length:e.length},(t,n)=>e[n]):[];break;default:const n=await this.page.regularPages();t=n&&n.length>0?Array.from({length:n.length},(e,t)=>n[t]):await this.svc.globalRegularPages()}const n=this.page.paths().base(),r=this.newPaginatorFromPages(t,e,n);this.currentPager=r.pagers()[0],this.initialized=!0}catch(e){const t=this.page.paths().base(),n=new PaginatorImpl([],0,10,t);this.currentPager=n.pagers()[0],this.initialized=!0}}newPaginatorFromPages(e,t,n){if(t<=0)throw new Error("paginator size must be positive");const r=this.splitPages(e,t);return new PaginatorImpl(r,e.length,t,n)}newPaginatorFromPageGroups(e,t,n){if(t<=0)throw new Error("paginator size must be positive");const r=[];if(e&&e.length>0)for(let t=0;t<e.length;t++){const n=e[t];if(n&&n.pages){const e=n.pages();if(e)for(let t=0;t<e.length;t++)r.push(e[t])}}const s=this.splitPages(r,t);return new PaginatorImpl(s,r.length,t,n)}splitPages(e,t){const n=[];for(let r=0;r<e.length;r+=t){const s=Math.min(r+t,e.length);n.push(e.slice(r,s))}return n}},Scratch=class{values;constructor(){this.values=new Map}add(e,t){const n=this.values.get(e);let r;return r=void 0!==n?Array.isArray(n)?[...n,t]:"number"==typeof n&&"number"==typeof t||"string"==typeof n&&"string"==typeof t?n+t:t:t,this.values.set(e,r),""}Add(e,t){return this.add(e,t)}set(e,t){return this.values.set(e,t),""}Set(e,t){return this.set(e,t)}delete(e){return this.values.delete(e),""}get(e){return this.values.get(e)}Get(e){return this.get(e)}getValues(){return this.values}setInMap(e,t,n){let r=this.values.get(e);return r&&"object"==typeof r||(r={},this.values.set(e,r)),r[t]=n,""}};function dir(e){const t=e.lastIndexOf("/");if(-1===t)return"";let n=e.slice(0,t+1);return n.length>1&&n.endsWith("/")&&(n=n.slice(0,-1)),n}var import_path10=__toESM(require("path"));init_log(),getDomainLogger("content",{component:"page"});var PageImpl=class{source;content;meta;layout;pagerManager;title_;description_="";kind_;pageMap;output_=null;store_=null;constructor(e,t,n,r,s="",a="page",i=null){this.source=e,this.content=t,this.meta=n,this.layout=r,this.title_=s,this.kind_=a,this.pageMap=i,this.pagerManager=new PaginatorManagerImpl({pageSize:()=>10,globalRegularPages:async()=>[]},this)}rawContent(){if(!this.content)return"";const e=this.content.getRawSource();return(new TextDecoder).decode(e)}pageIdentity(){return this.source.identity}pageFile(){return this.source.file}staleVersions(){return[]}section(){return this.source.file.section()}paths(){return this.source.file.paths()}path(){return this.source.file.paths().path()}slug(){return this.pathToSlug(this.path())}pathToSlug(e){let t=e.replace(/^\//,"");return t=t.replace(/\.md$/,""),t.endsWith("/index")&&(t=t.replace(/\/index$/,"")),"index"!==t&&""!==t||(t="index"),t.endsWith("/_index")&&(t=t.replace(/\/_index$/,"")),t}posOffset(e){return this.source.posOffset(e)}description(){return this.description_}get Description(){return this.description()}StaticURL(e){return/^(https?:)?\/\//.test(e)?e:((e=(e=import_path10.default.normalize(e)).replace(/\\/g,"/")).startsWith("/")&&(e=e.slice(1)),`${this.meta.pageBaseUrl().replace(/\/+$/,"")}/${e}`)}params(){return this.meta.params()}get Params(){return this.params()}store(){return this.store_||(this.store_=new Scratch),this.store_}get Store(){return this.store()}scratch(){return this.store()}get Scratch(){return this.scratch()}pageBaseUrl(){return this.meta.pageBaseUrl()}pageWeight(){return this.meta.pageWeight()}pageDate(){return this.meta.pageDate()}publishDate(){return this.meta.publishDate()}async relatedKeywords(e){return this.meta.relatedKeywords(e)}shouldList(e){return this.meta.shouldList(e)}shouldListAny(){return this.meta.shouldListAny()}noLink(){return this.meta.noLink()}organization(){return this.meta.organization()}author(){return this.meta.author()}menu(){return this.meta.menu()}async current(){return await this.pagerManager.current()}setCurrent(e){this.pagerManager.setCurrent(e)}async paginator(){return await this.pagerManager.paginator()}async paginate(e){return this.pagerManager.paginate(e)}file(){return this.source.file}get Type(){return this.file().type()}name(){return this.source.file.baseFileName()}title(){return this.title_}get Title(){return this.title()}kind(){return this.kind_}isHome(){return this.kind()===getKindMain("home")}isPage(){return this.kind()===getKindMain("page")}isSection(){return this.kind()===getKindMain("section")}isAncestor(e){return e.path()!==this.path()&&e.paths().base().startsWith(this.paths().base())}eq(e){return this.pageIdentity().identifierBase()===e.pageIdentity().identifierBase()}layouts(){switch(this.kind_){case getKindMain("home"):return this.source.file.isBranchBundle()?this.layout.homeList():this.layout.home();case getKindMain("page"):return this.layout.page(this.source.file.section(),this.source.file.baseFileName());case getKindMain("section"):return this.layout.section(this.source.file.section());case getKindMain("taxonomy"):return this.layout.taxonomy();case getKindMain("term"):return this.layout.term();case getKindMain("404"):return this.layout.standalone404();case getKindMain("sitemap"):return this.layout.standaloneSitemap();default:return[]}}output(){return this.output_||(this.output_=new Output(this.source,this.kind())),this.output_.output(this)}get TargetPath(){return this.output().targetFilePath()}get Summary(){return this.output().summary()}truncated(){return!0}parent(){if(this.isHome())return null;let e=this.paths().containerDir();if(""===e)return null;for(;;){const t=this.pageMap?.treePages.longestPrefix(e,!0);if(!t)return null;const[n,r]=t;if(!r)return null;const[s,a]=r.getPage();if(!s)return null;if(this.isBundled())return a?s:null;if(!s.isPage())return a?s:null;e=dir(e)}}async Pages(){return await this.pages()}async pages(){const e=this.pageIdentity().pageLanguageIndex();switch(this.kind()){case"page":case"section":case"home":return await this.pageMap.getPagesInSection(e,new PageMapQueryPagesInSectionImpl(this.paths().base(),"page-section",!1,!1,e,e=>pagePredicates_shouldListLocal(e)&&(pagePredicates_kindPage(e)||(e=>"section"===e.kind())(e))));case"term":return await this.pageMap.getPagesWithTerm(e,new PageMapQueryPagesBelowPathImpl(this.paths().base(),"term"));case"taxonomy":return await this.pageMap.getPagesInSection(e,new PageMapQueryPagesInSectionImpl(this.paths().base(),"term",!0,!1,e,e=>pagePredicates_shouldListLocal(e)&&(e=>"term"===e.kind())(e)));default:return Promise.resolve([])}}prevInSection(){return null}nextInSection(){return null}sections(e){return[]}async regularPages(){const e=this.pageIdentity().pageLanguageIndex();switch(this.kind()){case"page":case"section":case"home":case"taxonomy":return this.pageMap?await this.pageMap.getPagesInSection(e,new PageMapQueryPagesInSectionImpl(this.paths().base(),"",!1,!1,e,e=>pagePredicates_shouldListLocal(e)&&pagePredicates_kindPage(e))):[];case"term":return this.pageMap?await this.pageMap.getPagesWithTerm(e,new PageMapQueryPagesBelowPathImpl(this.paths().base(),"",e=>pagePredicates_shouldListLocal(e)&&pagePredicates_kindPage(e))):[];default:return[]}}regularPagesRecursive(){return[]}async terms(e,t){return this.pageMap?this.pageMap?.getTermsForPageInTaxonomy(e,this.paths().base(),t):null}async isTranslated(){return(await this.translations()).length>0}async translations(){const e=this.path()+"/"+this.pageIdentity().pageLanguage()+"/translations";if(!this.pageMap)return[];try{return await this.pageMap.getOrCreatePagesFromCacheSync(null,e,async e=>{const t=await this.allTranslations(),n=[];for(let e=0;e<t.length;e++){const r=t.at(e);r&&!r.eq(this)&&n.push(r)}return n})}catch(e){throw e}}async allTranslations(){const e=this.path()+"/translations-all";if(!this.pageMap)return[];try{return await this.pageMap.getOrCreatePagesFromCacheSync(null,e,async e=>{const t=[];var n;return this.pageMap.treePages.forEachInDimension(this.paths().base(),dimensionFlag_index(1),e=>{if(null!=e){const n=e.getPages();t.push(...n)}return!1}),n=t,pageBy(language).sort(n),t})}catch(e){throw e}}isBundled(){return this.source.file.isBundle()}},TaxonomyPageImpl=class extends PageImpl{singular;constructor(e,t,n,r,s,a="",i="taxonomy",o=null){super(e,t,n,r,a,i,o),this.singular=s}params(){const e=super.params();return e.Singular=this.singular,e}},TermPageImpl=class extends TaxonomyPageImpl{term;constructor(e,t,n,r,s,a,i="",o="term",l=null){super(e,t,n,r,s,i,o,l),this.term=a}params(){const e=super.params();return e.Term=this.term,e}},Meta=class{baseURL;list;parameters;weight;date;org;authorInfo;menuConfig;constructor(e,t="always",n={},r=0,s=new Date,a,i,o){this.baseURL=e,this.list=t,this.parameters=n,this.weight=r,this.date=s,this.org=a,this.authorInfo=i,this.menuConfig=o}description(){return""}params(){return this.parameters}pageBaseUrl(){return this.baseURL}pageWeight(){return this.weight}pageDate(){return this.date}publishDate(){return this.pageDate()}async relatedKeywords(e){return[]}shouldList(e){switch(this.list){case"always":default:return!0;case"never":return!1;case"local":return!e}}shouldListAny(){return this.shouldList(!0)||this.shouldList(!1)}noLink(){return!1}organization(){return this.org}author(){return this.authorInfo}menu(){return this.menuConfig}},Layout=class{home(){return["index.html","_default/index.html","_default/single.html"]}homeList(){return["index.html","_default/index.html","_default/list.html"]}section(e){return[`${e}/section.html`,`${e}/list.html`,"_default/section.html","_default/list.html","_default/index.html"]}page(e,t){const n=e?`${e}/${t}`:t,r=e?`${e}/single.html`:"single.html",s=[];return"index"!==n&&s.push(`${n}.html`),s.push(r),"index"!==t&&s.push(`_default/${t}.html`),s.push("_default/single.html"),s.push("index.html"),s.push("_default/index.html"),s}taxonomy(){return["taxonomy/taxonomy.html","taxonomy/list.html","_default/list.html","_default/taxonomy.html"]}term(){return["taxonomy/tag.html","term/term.html","taxonomy/list.html","_default/list.html","_default/term.html"]}standalone404(){return["404.html"]}standaloneSitemap(){return["sitemap.xml","_default/sitemap.xml"]}},ShortcodeWithPage=class{_params;_inner;_page;_parent;_name;_isNamedParams;_ordinal;_indentation;_innerDeindent=null;_posOffset;_pos=null;_scratch=null;constructor(e,t,n,r,s,a,i,o="",l=0){this._params=e,this._inner=t,this._page=n,this._parent=r,this._name=s,this._isNamedParams=a,this._ordinal=i,this._indentation=o,this._posOffset=l}get params(){return this._params}get Params(){return this._params}get IsNamedParams(){return this._isNamedParams}get inner(){return this._inner}get Inner(){return this._inner}get page(){return this._page}get Page(){return this._page}get parent(){return this._parent}get Parent(){return this._parent}get name(){return this._name}get isNamedParams(){return this._isNamedParams}get ordinal(){return this._ordinal}get Ordinal(){return this._ordinal}innerDeindent(){if(""===this._indentation)return this._inner;if(null===this._innerDeindent){const e=this._inner.split("\n");this._innerDeindent=e.map(e=>e.startsWith(this._indentation)?e.substring(this._indentation.length):e).join("\n")}return this._innerDeindent}get InnerDeindent(){return this.innerDeindent()}async position(){return this._pos||(this._pos=await this._page.posOffset(this._posOffset)),this._pos}scratch(){return this._scratch||(this._scratch=new Scratch),this._scratch}get(e){return this._params?Array.isArray(this._params)?"number"==typeof e?e>=this._params.length?"":this._params[e]:null:"object"==typeof this._params&&"string"==typeof e?this._params[e]||"":null:null}Get(e){return this.get(e)}},TemplateError=class extends Error{constructor(e,t){super(e),this.code=t,this.name="TemplateError"}},path19=(new TemplateError("template not found","TEMPLATE_NOT_FOUND"),new TemplateError("template parse failed","PARSE_FAILED"),new TemplateError("template execute failed","EXECUTE_FAILED"),new TemplateError("invalid template","INVALID_TEMPLATE"),__toESM(require("path"))),BaseOf=class{baseof=new Map;needsBaseof=new Map;getTemplateSearchOrder(e){const t=[];return t.push("_default/baseof.html"),t}getBaseOf(e){return this.baseof.get(e)||null}getNeedsBaseOf(e){return this.needsBaseof.get(e)||null}addBaseOf(e,t){this.baseof.set(e,t)}addNeedsBaseOf(e,t){this.needsBaseof.set(e,t)}isBaseTemplatePath(e){return path19.basename(e).includes("baseof")}needsBaseOf(e,t){return!this.noBaseNeeded(e)&&this.needsBaseTemplate(t)}noBaseNeeded(e){return!!e.startsWith("partials/")}needsBaseTemplate(e){let t=-1,n=!1;for(let r=0;r<e.length;)if(!n&&e.substring(r).startsWith("{{/*"))n=!0,r+=4;else if(!n&&e.substring(r).startsWith("{{- /*"))n=!0,r+=6;else if(n&&e.substring(r).startsWith("*/}}"))n=!1,r+=4;else if(n&&e.substring(r).startsWith("*/ -}}"))n=!1,r+=6;else{const s=e[r];if(!n){if(e.substring(r).startsWith("{{")){t=r;break}if(!/\s/.test(s))break}r++}return-1!==t&&/^{{-?\s*define/.test(e.substring(t))}getAllBaseOf(){return new Map(this.baseof)}getAllNeedsBaseOf(){return new Map(this.needsBaseof)}clear(){this.baseof.clear(),this.needsBaseof.clear()}getStats(){return{baseOfCount:this.baseof.size,needsBaseOfCount:this.needsBaseof.size}}},TemplateInfo2=class e{constructor(e,t,n){this.name=e,this.template=t,this.fi=n}identifierBase(){return this.name}errWithFileContext(e,t){const n=`${e}: ${t.message}`,r=new TemplateError(n,"TEMPLATE_FILE_ERROR");return Object.defineProperty(r,"fileName",{value:this.name,enumerable:!0}),Object.defineProperty(r,"fileContent",{value:this.template,enumerable:!0}),r}isZero(){return""===this.name}copy(){return new e(this.name,this.template,this.fi)}getCleanContent(){return removeLeadingBOM(this.template)}};function removeLeadingBOM(e){for(let t=0;t<e.length;t++){const n=e[t];if(0===t&&"\ufeff"!==n)return e;if(t>0)return e.substring(t)}return e}function resolveTemplateType(e){return function(e){return e.includes("_shortcodes/")}(e)?1:e.includes("_partials/")?2:0}init_log(),getDomainLogger("template",{component:"namespace"});var BaseNamespace=class{templates=new Map;mutex=new Set;addTemplate(e,t){this.withLock(()=>{this.templates.set(e,t)})}findTemplate(e){return this.withReadLock(()=>{if(this.templates.has(e))return this.templates.get(e)||null;if(!e.endsWith(".html")){const t=e+".html";if(this.templates.has(t))return this.templates.get(t)||null}for(const[t,n]of this.templates.entries())if(t.includes(e))return n;return null})}getTemplates(){return this.withReadLock(()=>new Map(this.templates))}hasTemplate(e){return this.withReadLock(()=>this.templates.has(e))}getTemplateNames(){return this.withReadLock(()=>Array.from(this.templates.keys()))}removeTemplate(e){return this.withLock(()=>this.templates.delete(e))}clear(){this.withLock(()=>{this.templates.clear()})}size(){return this.withReadLock(()=>this.templates.size)}getTemplatesByPattern(e){return this.withReadLock(()=>{const t=[];for(const[n,r]of this.templates)e.test(n)&&t.push(r);return t})}withLock(e){const t="write";for(;this.mutex.has(t););this.mutex.add(t);try{return e()}finally{this.mutex.delete(t)}}withReadLock(e){const t="read";this.mutex.add(t);try{return e()}finally{this.mutex.delete(t)}}},RegularTemplateNamespace=class extends BaseNamespace{lookup(e){const t=this.findTemplate(e);return t?t.template:null}findTemplateWithDependencies(e){return this.findTemplate(e)}getTemplatesNeedingBase(){return this.withReadLock(()=>Array.from(this.templates.values()).filter(e=>e.baseInfo))}},PartialTemplateNamespace=class extends BaseNamespace{lookup(e){const t=this.findTemplate(e);return t?t.template:null}addPartialTemplate(e,t){const n={...t,type:2};this.addTemplate(e,n)}},ShortcodeTemplateNamespace=class extends BaseNamespace{lookup(e){const t=this.findTemplate(e);return t?t.template:null}addShortcodeTemplate(e,t){const n={...t,type:1};this.addTemplate(e,n)}getShortcode(e){return this.lookup("_shortcodes/"+e)}hasShortcode(e){return this.hasTemplate(e)}getShortcodeNames(){return this.getTemplateNames()}},Executor=class{async execute(e,t){try{const[n,r]=await e.Execute(t);if(r)throw new TemplateError(`Template execution failed: ${r.message}`,"EXECUTION_FAILED");return n}catch(e){if(e instanceof TemplateError)throw e;const t=e instanceof Error?e.message:String(e);throw new TemplateError(`Template execution failed: ${t}`,"EXECUTION_FAILED")}}async executeWithTimeout(e,t,n){return new Promise(async(r,s)=>{const a=setTimeout(()=>{s(new TemplateError("Template execution timeout","EXECUTION_TIMEOUT"))},n);await this.execute(e,t).then(e=>{clearTimeout(a),r(e)}).catch(e=>{clearTimeout(a),s(e)})})}async executeSafely(e,t){try{return{result:await this.execute(e,t),error:null}}catch(e){if(e instanceof TemplateError)return{result:null,error:e};const t=e instanceof Error?e.message:String(e);return{result:null,error:new TemplateError(`Execution failed: ${t}`,"EXECUTION_ERROR")}}}async executeBatch(e){return(await Promise.allSettled(e.map(async({name:e,template:t,data:n})=>{try{return{name:e,result:await this.execute(t,n),error:null}}catch(t){return{name:e,result:null,error:t instanceof TemplateError?t:new TemplateError(`Batch execution failed: ${t.message}`,"BATCH_EXECUTION_FAILED")}}}))).map(e=>"fulfilled"===e.status?e.value:{name:"unknown",result:null,error:new TemplateError(`Batch execution failed: ${e.reason}`,"BATCH_EXECUTION_FAILED")})}async executeWithContext(e,t,n){if(n.signal?.aborted)throw new TemplateError("Template execution was cancelled","EXECUTION_CANCELLED");const r=new Promise((e,t)=>{n.signal&&n.signal.addEventListener("abort",()=>{t(new TemplateError("Template execution was cancelled","EXECUTION_CANCELLED"))})}),s=n.timeout?new Promise((e,t)=>{setTimeout(()=>{t(new TemplateError("Template execution timeout","EXECUTION_TIMEOUT"))},n.timeout)}):new Promise(()=>{});try{return await Promise.race([this.execute(e,t),r,s])}catch(e){if(e instanceof TemplateError)throw e;throw new TemplateError(`Context execution failed: ${e.message}`,"CONTEXT_EXECUTION_FAILED")}}},import_text_template=require("@mdfriday/text-template"),import_text_template2=require("@mdfriday/text-template");init_log(),init_log();var log31=getDomainLogger("content",{component:"cache"}),ConcurrentCache=class{cache=new Map;pendingPromises=new Map;deletedKeys=new Set;constructor(){}get(e){return this.cache.get(e)}set(e,t){this.deletedKeys.has(e)||this.cache.set(e,t),this.pendingPromises.delete(e),this.deletedKeys.delete(e)}has(e){return this.cache.has(e)}isPending(e){return this.pendingPromises.has(e)}delete(e){return this.deletedKeys.add(e),this.pendingPromises.delete(e),this.cache.delete(e)}clear(){this.cache.clear(),this.pendingPromises.clear(),this.deletedKeys.clear()}size(){return this.cache.size}pendingCount(){return this.pendingPromises.size}async getOrCreate(e,t){const n=this.cache.get(e);if(void 0!==n)return n;const r=this.pendingPromises.get(e);return r?await r:this.createAndCache(e,t)}async createAndCache(e,t){const n=this.executeCreate(e,t);this.pendingPromises.set(e,n);try{const t=await n;return this.deletedKeys.has(e)?(this.deletedKeys.delete(e),this.pendingPromises.delete(e),t):(this.set(e,t),t)}catch(t){throw this.pendingPromises.delete(e),log31.error(`Failed to create value for key ${String(e)} : ${t}`),t}}async executeCreate(e,t){try{return await t(e)}catch(t){const n=t instanceof Error?t.message:String(t),r=new Error(`Cache creation failed for key ${String(e)}: ${n}`);throw t instanceof Error&&t.stack&&(r.stack=t.stack,r.originalError=t),r}}getStats(){return{size:this.cache.size,pendingCount:this.pendingPromises.size,keys:Array.from(this.cache.keys()),pendingKeys:Array.from(this.pendingPromises.keys())}}async preload(e){const t=e.filter(({key:e})=>!this.has(e)&&!this.isPending(e)).map(({key:e,create:t})=>this.getOrCreate(e,t));t.length>0&&await Promise.allSettled(t)}},log32=(new ConcurrentCache,getDomainLogger("template",{component:"parser"})),Parser=class{prototypeText;prototypeTextClone;readyInit=!1;funcMap;parseOverlapCache;constructor(e=new Map){this.funcMap=e,this.prototypeText=(0,import_text_template.New)(""),this.parseOverlapCache=new ConcurrentCache,this.funcMap.size>0&&this.prototypeText.Funcs(this.funcMap)}async markReady(){this.readyInit||(this.prototypeTextClone=this.prototypeText,this.readyInit=!0)}async parse(e){try{const t=(0,import_text_template.New)(e.name);this.funcMap&&this.funcMap.size>0&&t.Funcs(this.funcMap);const[n,r]=t.Parse(e.template);if(r)throw new TemplateError(`Parse failed: ${r.message}`,"PARSE_FAILED");return{template:n,info:e,type:resolveTemplateType(e.name)}}catch(e){if(e instanceof TemplateError)throw e;const t=e instanceof Error?e.message:String(e);throw new TemplateError(`Parse failed: ${t}`,"PARSE_FAILED")}}async parseWithLock(e,t){try{this.prototypeTextClone||await this.markReady();const n=(0,import_text_template.New)(e);this.funcMap&&this.funcMap.size>0&&n.Funcs(this.funcMap);const[r,s]=n.Parse(t);if(s)throw new TemplateError(`Parse with lock failed: ${s.message}`,"PARSE_LOCK_FAILED");return r}catch(e){if(e instanceof TemplateError)throw e;const t=e instanceof Error?e.message:String(e);throw new TemplateError(`Parse with lock failed: ${t}`,"PARSE_LOCK_FAILED")}}async parseOverlap(e,t,n){const r=`${e.name}::${t.name||"empty"}`;return this.parseOverlapCache.getOrCreate(r,async()=>{try{const r={template:await this.applyBaseTemplate(e,t,n),info:e,type:resolveTemplateType(e.name)};return t.isZero&&!t.name||(r.baseInfo=t),[r,!0,null]}catch(e){const t=e instanceof TemplateError?e:new TemplateError(`Parse overlap failed: ${e.message}`,"PARSE_OVERLAP_FAILED");return log32.error(`Failed to parse template overlap for key: ${r}: ${t.message}`),[null,!1,t]}})}async applyBaseTemplate(e,t,n){try{const r=(0,import_text_template.New)(e.name);if(this.funcMap&&this.funcMap.size>0&&r.Funcs(this.funcMap),!t.isZero||t.name){const[e,n]=r.Parse(t.template);if(n)throw new TemplateError(`Base template parse failed: ${n.message}`,"BASE_PARSE_FAILED")}const[s,a]=r.Clone();if(a)throw new TemplateError(`Template clone failed: ${a.message}`,"CLONE_FAILED");const[i,o]=s.Parse(e.template);if(o)throw new TemplateError(`Overlay template parse failed: ${o.message}`,"OVERLAY_PARSE_FAILED");const l=await this.getDependencies(i,new Map,n);for(const[t,n]of l)if(t!==e.name)try{if(n.template.Tree){const[,e]=i.AddParseTree(t,n.template.Tree);if(e)throw log32.error(`AddParseTree failed: ${e.message} with name ${t}`),new TemplateError(`AddParseTree failed: ${e.message}`,"ADD_PARSE_TREE_FAILED")}}catch(n){throw log32.error(`Error adding dependency ${t} to template ${e.name}:`,n),new TemplateError(`Failed to add dependency ${t}: ${n.message}`,"DEPENDENCY_ADD_FAILED")}return i}catch(e){if(e instanceof TemplateError)throw e;const t=e instanceof Error?e.message:String(e);throw new TemplateError(`Apply base template failed: ${t}`,"APPLY_BASE_FAILED")}}async getDependencies(e,t,n){const r=new Map;if(t.has(e.Name()))return r;t.set(e.Name(),e);try{const s=new Set,a=e=>{if(!e)return;const t=e.Type();if(t===import_text_template2.NodeType.NodeTemplate){const t=e.Name;t&&s.add(t)}else if(t===import_text_template2.NodeType.NodeList){const t=e;if(t.Nodes)for(const e of t.Nodes)a(e)}if(t===import_text_template2.NodeType.NodeAction){const t=e;t.Pipe&&a(t.Pipe)}else if(t===import_text_template2.NodeType.NodePipe){const t=e;if(t.Cmds)for(const e of t.Cmds)a(e)}else if(t===import_text_template2.NodeType.NodeCommand){const t=e;if(t.Args)for(const e of t.Args)a(e)}else if(t===import_text_template2.NodeType.NodeIf||t===import_text_template2.NodeType.NodeRange||t===import_text_template2.NodeType.NodeWith){const t=e;t.Pipe&&a(t.Pipe),t.List&&a(t.List),t.ElseList&&a(t.ElseList)}};e.Tree&&e.Tree.Root&&a(e.Tree.Root);for(const e of s){const s=n(e);if(s&&(r.set(e,s),!t.has(s.template.Name()))){const e=await this.getDependencies(s.template,t,n);for(const[t,n]of e)r.has(t)||r.set(t,n)}}}catch(t){log32.error(`Error getting dependencies for template ${e.Name()}:`,t)}return r}setFuncMap(e){this.funcMap=new Map([...this.funcMap,...e]),this.funcMap.size>0&&this.prototypeText.Funcs(this.funcMap)}getFuncMap(){return new Map(this.funcMap)}async parseMultiple(e){const t=await Promise.allSettled(e.map(e=>this.parse(e))),n=[],r=[];for(const e of t)"fulfilled"===e.status?n.push(e.value):r.push(e.reason);if(r.length>0)throw new TemplateError(`Failed to parse ${r.length} templates: ${r.map(e=>e.message).join(", ")}`,"MULTIPLE_PARSE_FAILED");return n}clearCache(){this.parseOverlapCache.clear()}getCacheStats(){return this.parseOverlapCache.getStats()}},Lookup=class{baseOf;funcsv;constructor(e,t){if(this.baseOf=e||new BaseOf,this.funcsv=new Map,t)for(const[e,n]of t)this.funcsv.set(e,n)}findNoDependence(e,t){try{const n=t.lookup(e);return n?[n,!0,null]:[null,!1,null]}catch(e){return[null,!1,e]}}findTemplate(e,t){try{const n=t.lookup(e);if(n)return[n,!0,null];const r=t.findTemplateWithDependencies(e);return r&&r.baseInfo?[r.template,!0,null]:[null,!1,null]}catch(e){return[null,!1,e]}}findPartial(e,t){try{const n=t.lookup(e);return n?[n,!0,null]:[null,!1,null]}catch(e){return[null,!1,e]}}findShortcode(e,t){try{const n=t.getShortcode(e);return n?[n,!0,null]:[null,!1,null]}catch(e){return[null,!1,e]}}findDependentInfo(e){const t=this.baseOf.getNeedsBaseOf(e);if(!t)return[null,null,!1];let n=null,r=!1;for(const t of this.baseOf.getTemplateSearchOrder(e))if(n=this.baseOf.getBaseOf(t),n){r=!0;break}return[t,n,r]}getFunc(e){return this.funcsv.get(e)}setFunc(e,t){this.funcsv.set(e,t)}setFuncMap(e){this.funcsv.clear();for(const[t,n]of e)this.funcsv.set(t,n)}getFuncMap(){return new Map(this.funcsv)}newTemplateLookup(e){return t=>e.findTemplate(t)}getBaseOf(){return this.baseOf}setBaseOf(e){this.baseOf=e}hasDependencies(e){const[t,n,r]=this.findDependentInfo(e);return r&&(null!==t||null!==n)}getAllFunctions(){return Array.from(this.funcsv.keys())}clearFunctions(){this.funcsv.clear()}getStats(){const e=this.baseOf.getStats();return{functionCount:this.funcsv.size,baseTemplateCount:e.baseOfCount,dependentTemplateCount:e.needsBaseOfCount}}};init_log();var log33=getDomainLogger("template",{component:"template-engine"}),TemplateEngine=class{executor;lookup;parser;templateNamespace;partialNamespace;shortcodeNamespace;fs;constructor(e,t,n,r,s,a,i){this.executor=e,this.lookup=t,this.parser=n,this.templateNamespace=r,this.partialNamespace=s,this.shortcodeNamespace=a,this.fs=i}async markReady(){try{await this.parser.markReady()}catch(e){throw new TemplateError(`Failed to mark template engine ready: ${e.message}`,"TEMPLATE_ENGINE_READY_FAILED")}}async getTemplate(e){const[t,n,r]=this.lookup.findTemplate(e,this.templateNamespace);if(r)return[null,!1,r];if(n&&t)return[t,!0,null];const[s,a,i]=this.lookup.findDependentInfo(e);if(i&&s)try{const[e,t,n]=await this.parser.parseOverlap(s,a||s,this.lookup.newTemplateLookup(this.templateNamespace));if(n)return[null,!1,n];if(t&&e)return[e.template,!0,null]}catch(e){return[null,!1,e]}return[null,!1,null]}async getPartial(e){let t=e.startsWith("partials/")?e:`partials/${e}`;return t=e.endsWith(".html")?t:`${t}.html`,this.lookup.findPartial(t,this.partialNamespace)}async getShortcode(e){return this.lookup.findShortcode(e,this.shortcodeNamespace)}async get(e){switch(resolveTemplateType(e)){case 1:return this.getShortcode(e);case 2:return this.getPartial(e);default:return this.getTemplate(e)}}async findFirst(e){if(!e||0===e.length)return[null,null,!1,null];for(const t of e)try{const[e,n,r]=await this.get(t);if(r)continue;if(n&&e)return[e,t,!0,null]}catch(e){log33.error("Error finding template:",e)}return[null,null,!1,null]}hasShortcode(e){return this.shortcodeNamespace.hasShortcode(e)}getShortcodeNames(){return this.shortcodeNamespace.getShortcodeNames()}getShortcodeCount(){return this.getShortcodeNames().length}async loadTemplates(){const e=async(e,t)=>{if(t.isDir())return;const n=e.startsWith(PATH_CONSTANTS.SYSTEM_PATH_SEPARATOR)?e.substring(1):e,r=PATH_CONSTANTS.normalizePath(n);try{await this.addTemplateFileInfo(r,t)}catch(e){log33.error("Error adding template:",new TemplateError(`Failed to add template ${r}: ${e.message}`,"LOAD_TEMPLATE_FAILED"))}};try{await this.fs.walk("",{walkFn:e},{})}catch(e){if(!e.message?.includes("ENOENT")&&!e.message?.includes("no such file"))throw e}}async addTemplateFileInfo(e,t){try{const n=await async function(e,t){let n=null;try{n=await t.open();const r=await n.stat(),s=new Uint8Array(r.size()),a=await n.read(s),i=removeLeadingBOM(new TextDecoder("utf-8").decode(a.buffer));return new TemplateInfo2(e,i,t)}catch(n){throw new TemplateInfo2(e,"",t).errWithFileContext("failed to load template",n)}finally{if(n)try{await n.close()}catch(e){console.warn(`Failed to close template file: ${e}`)}}}(e,t);await this.addTemplate(n.name,n)}catch(t){throw new TemplateError(`Failed to load template info for ${e}: ${t.message}`,"LOAD_TEMPLATE_INFO_FAILED")}}async addTemplate(e,t){try{if(this.lookup.getBaseOf().isBaseTemplatePath(e))return void this.lookup.getBaseOf().addBaseOf(e,t);if(this.lookup.getBaseOf().needsBaseOf(e,t.template))return void this.lookup.getBaseOf().addNeedsBaseOf(e,t);const n=resolveTemplateType(e),r=await this.parser.parse(t);switch(n){case 1:this.shortcodeNamespace.addShortcodeTemplate(e,r);break;case 2:this.partialNamespace.addPartialTemplate(e,r);break;default:this.templateNamespace.addTemplate(e,r)}}catch(t){throw new TemplateError(`Failed to add template ${e}: ${t.message}`,"ADD_TEMPLATE_FAILED")}}async execute(e,t){const[n,r,s]=await this.get(e);if(s)throw s;if(!r||!n)throw new TemplateError(`Template not found: ${e}`,"TEMPLATE_NOT_FOUND");return await this.executor.execute(n,t)}async executeRaw(e,t,n){const r=await this.parser.parseWithLock(e,t);if(!r)throw new TemplateError(`Raw Template parse error: ${e}`,"TEMPLATE_PARSE_ERROR");return await this.executor.execute(r,n)}async executeShortcode(e,t){const n=this.shortcodeNamespace.getShortcode(e);if(!n)throw new TemplateError(`Shortcode template '${e}' not found`,"SHORTCODE_NOT_FOUND");try{return await this.executor.execute(n,t)}catch(t){throw new TemplateError(`Error executing shortcode template '${e}': ${t.message}`,"SHORTCODE_EXECUTION_FAILED")}}async executeSafely(e,t){try{return{result:await this.execute(e,t),error:null}}catch(e){return e instanceof TemplateError?{result:null,error:e}:{result:null,error:new TemplateError(`Execute safely failed: ${e.message}`,"EXECUTE_SAFELY_FAILED")}}}async executeShortcodeSafely(e,t){try{return{result:await this.executeShortcode(e,t),error:null}}catch(e){return e instanceof TemplateError?{result:null,error:e}:{result:null,error:new TemplateError(`Execute shortcode safely failed: ${e.message}`,"EXECUTE_SHORTCODE_SAFELY_FAILED")}}}async hasTemplate(e){const[,t]=await this.get(e);return t}getTemplateNames(){return this.templateNamespace.getTemplateNames()}getPartialTemplateNames(){return this.partialNamespace.getTemplateNames()}getAllTemplateNames(){return[...this.templateNamespace.getTemplateNames(),...this.partialNamespace.getTemplateNames(),...this.shortcodeNamespace.getTemplateNames()]}getPartialNamespace(){return this.partialNamespace}getShortcodeNamespace(){return this.shortcodeNamespace}getTemplateNamespace(){return this.templateNamespace}clear(){this.templateNamespace.clear(),this.lookup.getBaseOf().clear()}getTemplatesByPattern(e){return this.templateNamespace.getTemplatesByPattern(e).map(e=>e.info.name)}};init_log();var crypto2=__toESM(require("crypto")),log34=getDomainLogger("template",{component:"registry"}),engineDependentFunctions=[],PartialFunction=class{engine=null;getFunctionName(){return"partial"}updateEngine(e){this.engine=e}execute=async(e,t)=>{if(!this.engine)return log34.error(`Partial function called but engine not set: ${e}`),`\x3c!-- Partial function called but engine not ready: ${e} --\x3e`;try{const n=e.startsWith("partials/")?e:`partials/${e}`;return await this.executePartial(n,t)}catch(t){return log34.error(`Partial execution failed for "${e}":`,t),`\x3c!-- Partial execution failed: ${e} - ${t.message} --\x3e`}};async executePartial(e,t){if(!this.engine)return`\x3c!-- Template engine not available: ${e} --\x3e`;try{const[n,r,s]=await this.engine.getPartial(e);if(s)return log34.error("Error getting partial template:",s),`\x3c!-- Error getting partial template: ${e} - ${s.message} --\x3e`;if(!r||!n)return log34.warn(`Template not found: ${e}`),`\x3c!-- Template not found: ${e} --\x3e`;const[a,i]=await n.Execute(t);return i?(log34.error("Template execution error:",i),`\x3c!-- Template execution error: ${e} - ${i.message} --\x3e`):a}catch(t){return log34.error("Sync partial execution failed:",t),`\x3c!-- Partial sync execution failed: ${e} - ${t.message} --\x3e`}}},DefaultTemplateRegistry=class{registerCoreFunctions(e){this.registerCryptoFunctions(e),this.registerStringFunctions(e),this.registerMathFunctions(e),this.registerTimeFunctions(e),this.registerCollectionFunctions(e),this.registerSafeFunctions(e),this.registerReflectFunctions(e),this.registerFmtFunctions(e),this.registerPathFunctions(e),this.registerTransformFunctions(e)}registerCryptoFunctions(e){e.set("md5",e=>e?crypto2.createHash("md5").update(e).digest("hex"):""),e.set("encryptAESGCM",(e,t)=>{if(!e||!t)return"";const n=crypto2.randomBytes(16),r=crypto2.randomBytes(12),s=crypto2.pbkdf2Sync(e,n,1e5,32,"sha256"),a=crypto2.createCipheriv("aes-256-gcm",s,r),i=Buffer.concat([a.update(t,"utf8"),a.final()]),o=a.getAuthTag();return Buffer.concat([n,r,o,i]).toString("base64")})}registerExtendedFunctions(e,t){this.registerURLFunctions(e,t),this.registerSiteFunctions(e,t),this.registerResourcesFunctions(e,t),this.registerHugoFunctions(e,t),this.registerLanguageFunctions(e,t)}registerAllFunctions(e,t){this.registerCoreFunctions(e),this.registerStringFunctions(e),this.registerMathFunctions(e),this.registerTimeFunctions(e),this.registerCollectionFunctions(e),this.registerEngineDependentFunctions(e),t&&(this.registerURLFunctions(e,t),this.registerExtendedFunctions(e,t))}registerEngineDependentFunctions(e){const t=new PartialFunction;engineDependentFunctions.push(t),e.set(t.getFunctionName(),t.execute)}registerURLFunctions(e,t){e.set("urls",()=>({Parse:e=>{try{return{Host:new URL(e).host}}catch{return{Host:""}}},JoinPath:(...e)=>e.filter(e=>""!==e).map(e=>e.replace(/^\/+|\/+$/g,"")).join("/"),URLize:e=>t.urlize(e),Abs:e=>t.absURL(e),Rel:e=>t.relURL(e),AbsLangURL:e=>t.absURL(e),RelLangURL:e=>t.relURL(e),Sanitize:e=>{try{return new URL(e).toString()}catch{return e.replace(/[<>"'%{}|\\^`]/g,"")}},PathEscape:e=>encodeURIComponent(e).replace(/%2F/g,"/").replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`),QueryEscape:e=>encodeURIComponent(e),QueryUnescape:e=>{try{return decodeURIComponent(e)}catch{return e}},IsAbs:e=>{try{return""!==new URL(e).protocol}catch{return!1}},IsRelative:e=>{try{return new URL(e),!1}catch{return!0}}})),e.set("absURL",e=>t.absURL(e)),e.set("relURL",e=>t.relURL(e)),e.set("urlize",e=>t.urlize(e)),e.set("relref",(e,n)=>{if(/^https?:\/\//.test(n))return n;let r="";const s=n.indexOf("#");return-1!==s&&(r=n.slice(s),n=n.slice(0,s)),(n=n.replace(/^\/+|\/+$/g,"")).startsWith("./")||n.startsWith("../")||n.startsWith("/")?t.relURL(n+r):t.relURL("/"+n+r)}),e.set("ref",(e,n)=>{if(/^https?:\/\//.test(n))return n;let r="";const s=n.indexOf("#");return-1!==s&&(r=n.slice(s),n=n.slice(0,s)),(n=n.replace(/^\/+|\/+$/g,"")).startsWith("./")||n.startsWith("../")||n.startsWith("/")?t.absURL(n+r):t.absURL("/"+n+r)}),e.set("absLangURL",e=>t.absURL(e)),e.set("relLangURL",e=>t.relURL(e))}registerSiteFunctions(e,t){e.set("Site",()=>({Title:t.title(),BaseURL:t.baseURL(),Params:t.params(),Menus:t.menus(),IsMultiLingual:t.isMultiLanguage(),LanguageCode:t.defaultLanguage()}))}registerResourcesFunctions(e,t){e.set("resources",()=>({Get:async e=>await t.Get(e),GetRemote:async e=>await t.GetRemote(e),Minify:async e=>await t.Minify(e),Fingerprint:async e=>await t.Fingerprint(e),ExecuteAsTemplate:async(e,n,r)=>await t.ExecuteAsTemplate(e,n,r)}))}registerHugoFunctions(e,t){e.set("hugo",()=>({Version:t.version(),Environment:t.environment(),Generator:t.generator()}))}registerLanguageFunctions(e,t){const{lang:n}=(init_lang(),__toCommonJS(lang_exports));e.set("lang",()=>({getAllCodes:()=>n.getAllCodes(),getAllNames:()=>n.getAllNames(),getCodesByDirection:e=>n.getCodesByDirection(e),getNamesByDirection:e=>n.getNamesByDirection(e),getCodeNameMap:()=>n.getCodeNameMap(),getCodeNameMapByDirection:e=>n.getCodeNameMapByDirection(e),getNameByCode:e=>n.getNameByCode(e),getLanguageInfo:e=>n.getLanguageInfo(e),isSupported:e=>n.isSupported(e),getDirection:e=>n.getDirection(e),isLTR:e=>n.isLTR(e),isRTL:e=>n.isRTL(e)})),e.set("langName",e=>n.getNameByCode(e)||e),e.set("langDirection",e=>n.getDirection(e)||"ltr"),e.set("isLTR",e=>n.isLTR(e)),e.set("isRTL",e=>n.isRTL(e)),e.set("i18n",e=>t.translate(e))}registerStringFunctions(e){e.set("humanize",e=>e?(e=(e=(e=(e=e.replace(/([a-z])([A-Z])/g,"$1 $2")).replace(/[_-]+/g," ")).replace(/\.[^/.]+$/,"")).charAt(0).toUpperCase()+e.slice(1).toLowerCase()).trim():""),e.set("upper",e=>e.toUpperCase()),e.set("lower",e=>e.toLowerCase()),e.set("title",e=>e.replace(/\w\S*/g,e=>e.charAt(0).toUpperCase()+e.substr(1).toLowerCase())),e.set("trim",e=>e.trim()),e.set("replace",(...e)=>{if(e.length<3)throw new Error("replace requires at least 3 arguments: string, old, new");const t=String(e[0]),n=String(e[1]),r=String(e[2]);if(e.length>=4){const s=Number(e[3]);if(isNaN(s))throw new Error("replace limit must be a number");let a=t,i=0,o=0;for(;i<s&&o<a.length;){const e=a.indexOf(n,o);if(-1===e)break;a=a.substring(0,e)+r+a.substring(e+n.length),o=e+r.length,i++}return a}return t.split(n).join(r)}),e.set("replaceRE",(...t)=>{if(t.length<3)throw new Error("replaceRE requires at least 3 arguments: pattern, replacement, string");const n=t[0],r=t[1],s=t[2],a=t.length>=4?t[3]:void 0;return e.get("strings")().ReplaceRE(n,r,s,a)}),e.set("split",(e,t)=>null==e?(log34.warn("split function: first argument is null or undefined"),[]):"string"!=typeof e?(log34.warn("split function: first argument must be a string, got:",typeof e,"value:",e),Array.isArray(e)?e:String(e).split(t)):e.split(t)),e.set("splitRegex",(e,t)=>{if(null==e)return log34.warn("splitRegex function: first argument is null or undefined"),[];if("string"!=typeof e){if(log34.warn("splitRegex function: first argument must be a string, got:",typeof e,"value:",e),Array.isArray(e))return e;const n=String(e);try{const e=new RegExp(t);return n.split(e)}catch(e){return log34.warn("splitRegex function: invalid regex pattern:",t,"error:",e),[n]}}try{const n=new RegExp(t);return e.split(n)}catch(n){return log34.warn("splitRegex function: invalid regex pattern:",t,"error:",n),[e]}}),e.set("delimit",(e,t)=>Array.isArray(e)?e.join(t):String(e)),e.set("in",(e,t)=>(Array.isArray(e)||"string"==typeof e&&"string"==typeof t)&&e.includes(t)),e.set("hasPrefix",(e,t)=>e.startsWith(t)),e.set("hasSuffix",(e,t)=>e.endsWith(t)),e.set("strings",()=>({ToLower:e=>String(e).toLowerCase(),ToUpper:e=>String(e).toUpperCase(),Title:e=>String(e).replace(/\w\S*/g,e=>e.charAt(0).toUpperCase()+e.substr(1).toLowerCase()),Trim:(e,t)=>String(e).split("").filter(e=>!t.includes(e)).join(""),TrimSpace:e=>String(e).trim(),TrimLeft:(e,t)=>{const n=String(t);let r=0;for(;r<n.length&&e.includes(n[r]);)r++;return n.slice(r)},TrimRight:(e,t)=>{const n=String(t);let r=n.length-1;for(;r>=0&&e.includes(n[r]);)r--;return n.slice(0,r+1)},TrimPrefix:(e,t)=>{const n=String(t);return n.startsWith(e)?n.slice(e.length):n},TrimSuffix:(e,t)=>{const n=String(t);return n.endsWith(e)?n.slice(0,-e.length):n},Contains:(e,t)=>String(e).includes(t),ContainsAny:(e,t)=>{const n=String(e);return t.split("").some(e=>n.includes(e))},HasPrefix:(e,t)=>String(e).startsWith(t),HasSuffix:(e,t)=>String(e).endsWith(t),Replace:(e,t,n,r)=>{const s=String(e);if(void 0===r)return s.split(t).join(n);let a=s,i=0,o=0;for(;i<r&&o<a.length;){const e=a.indexOf(t,o);if(-1===e)break;a=a.substring(0,e)+n+a.substring(e+t.length),o=e+n.length,i++}return a},ReplaceRE:(e,t,n,r)=>{const s=String(e),a=String(t),i=String(n);let o,l=-1;if(void 0!==r){const e=parseInt(String(r),10);if(isNaN(e))throw new Error("limit argument must be integer");l=e}try{o=new RegExp(s,"g")}catch(e){throw new Error(`invalid regular expression: ${s}`)}let c=0;return i.replace(o,e=>l>=0&&c>=l?e:(c++,a))},Split:(e,t)=>String(e).split(t),SliceString:(e,t,n)=>{const r=String(e);return void 0!==n?r.slice(t,n):r.slice(t)},Substr:(e,t,n)=>{const r=String(e);return t<0&&(t=r.length+t),t<0&&(t=0),t>=r.length?"":void 0===n?r.slice(t):n<=0?"":r.slice(t,t+n)},Count:(e,t)=>{const n=String(t);return e?(n.match(new RegExp(e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"g"))||[]).length:n.length+1},CountWords:e=>{const t=String(e).trim();return t?t.split(/\s+/).length:0},CountRunes:e=>String(e).replace(/\s/g,"").length,RuneCount:e=>String(e).length,Repeat:(e,t)=>{if(e<0)throw new Error("strings: negative Repeat count");return String(t).repeat(e)},FirstUpper:e=>{const t=String(e);return t.charAt(0).toUpperCase()+t.slice(1)}})),e.set("substr",(e,...t)=>{const n=String(e),r=Array.from(n),s=r.length;let a,i;switch(t.length){case 0:throw new Error("too few arguments");case 1:const e=Number(t[0]);if(isNaN(e)||!Number.isInteger(e))throw new Error("start argument must be an integer");a=e,i=s;break;case 2:const n=Number(t[0]),r=Number(t[1]);if(isNaN(n)||!Number.isInteger(n))throw new Error("start argument must be an integer");if(isNaN(r)||!Number.isInteger(r))throw new Error("length argument must be an integer");a=n,i=r;break;default:throw new Error("too many arguments")}if(0===s)return"";if(a<0&&(a+=s),a<0&&(a=0),a>s-1)return"";let o=s;return 0===i?"":(i<0?o+=i:i>0&&(o=a+i),a>=o||o<0?"":(o>s&&(o=s),r.slice(a,o).join("")))}),e.set("truncate",(e,...t)=>{const n=Number(e);if(isNaN(n)||!Number.isInteger(n))throw new Error("truncate length must be an integer");let r,s=" …";switch(t.length){case 0:throw new Error("truncate requires a length and a string");case 1:r=t[0],s=" …";break;case 2:s=String(t[0]),r=t[1];break;default:throw new Error("too many arguments passed to truncate")}const a=String(r),i=/<[^>]+>/.test(a);return Array.from(a).length<=n?i?a:this.escapeHTML(a):i?this.truncateHTML(a,n,s):this.truncateText(a,n,s)})}escapeHTML(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}truncateText(e,t,n){const r=Array.from(e);if(r.length<=t)return this.escapeHTML(e);let s=0,a=0;for(let e=0;e<r.length&&a<t;e++){const t=r[e];a++,/\s/.test(t)&&(s=e),/[\u4e00-\u9fff\u3400-\u4dbf\u3040-\u309f\u30a0-\u30ff\uac00-\ud7af]/.test(t)&&(s=e)}let i=a>=t?s>0?s:t:r.length;const o=r.slice(0,i).join("");return this.escapeHTML(o)+n}truncateHTML(e,t,n){const r=/^<(\/)?([^ ]+?)(?:(\s*\/)| .*?)?>/,s=new Set(["br","col","link","base","img","param","area","hr","input"]),a=[];let i=0,o=0,l=0,c=0,u=0;const h=Array.from(e);for(;u<h.length;){const e=h[u];if("<"===e){const e=h.slice(u).join("").match(r);if(e){const t=e[0],n="/"===e[1],r=e[2].toLowerCase(),l="/"===e[3];u+=t.length,i=o,s.has(r)||l||a.push({name:r,pos:u-t.length,openTag:!n});continue}}if(l++,/\s/.test(e)?i=o:/[\u4e00-\u9fff\u3400-\u4dbf\u3040-\u309f\u30a0-\u30ff\uac00-\ud7af]/.test(e)?i=u:o=u+1,l>t){c=i>0?i:u;break}u++}if(l<=t)return e;let d=h.slice(0,c).join("")+n,p=null;for(let e=a.length-1;e>=0;e--){const t=a[e];t.pos>=c||null!==p?null!==p&&p.name===t.name&&(p=null):t.openTag?d+=`</${t.name}>`:p=t}return d}registerMathFunctions(e){e.set("add",(e,t)=>e+t),e.set("sub",(e,t)=>e-t),e.set("mul",(e,t)=>e*t),e.set("div",(e,t)=>0!==t?e/t:0),e.set("mod",(e,t)=>0!==t?e%t:0),e.set("math",()=>({Abs:e=>{const t=Number(e);if(isNaN(t))throw new Error("the math.Abs function requires a numeric argument");return Math.abs(t)},Add:(...e)=>{if(e.length<2)throw new Error("must provide at least two numbers");return e.reduce((e,t)=>{const n=Number(t);if(isNaN(n))throw new Error("Add operator can't be used with non-numeric values");return e+n},0)},Ceil:e=>{const t=Number(e);if(isNaN(t))throw new Error("Ceil operator can't be used with non-numeric value");return Math.ceil(t)},Div:(...e)=>{if(e.length<2)throw new Error("must provide at least two numbers");return e.reduce((e,t,n)=>{const r=Number(t);if(isNaN(r))throw new Error("Div operator can't be used with non-numeric values");if(0===n)return r;if(0===r)throw new Error("division by zero");return e/r})},Floor:e=>{const t=Number(e);if(isNaN(t))throw new Error("Floor operator can't be used with non-numeric value");return Math.floor(t)},Log:e=>{const t=Number(e);if(isNaN(t))throw new Error("Log operator can't be used with non-numeric value");return Math.log(t)},Max:(...e)=>{if(0===e.length)throw new Error("must provide at least one number");const t=e.flat().map(e=>{const t=Number(e);if(isNaN(t))throw new Error("Max operator can't be used with non-numeric values");return t});return Math.max(...t)},Min:(...e)=>{if(0===e.length)throw new Error("must provide at least one number");const t=e.flat().map(e=>{const t=Number(e);if(isNaN(t))throw new Error("Min operator can't be used with non-numeric values");return t});return Math.min(...t)},Mod:(e,t)=>{const n=Number(e),r=Number(t);if(isNaN(n)||isNaN(r))throw new Error("modulo operator can't be used with non-numeric value");if(0===r)throw new Error("the number can't be divided by zero at modulo operation");return n%r},ModBool:(e,t)=>{const n=Number(e),r=Number(t);if(isNaN(n)||isNaN(r))throw new Error("modulo operator can't be used with non-numeric value");if(0===r)throw new Error("the number can't be divided by zero at modulo operation");return n%r===0},Mul:(...e)=>{if(e.length<2)throw new Error("must provide at least two numbers");return e.reduce((e,t)=>{const n=Number(t);if(isNaN(n))throw new Error("Mul operator can't be used with non-numeric values");return e*n},1)},Pow:(e,t)=>{const n=Number(e),r=Number(t);if(isNaN(n)||isNaN(r))throw new Error("Pow operator can't be used with non-numeric value");return Math.pow(n,r)},Rand:()=>Math.random(),Round:e=>{const t=Number(e);if(isNaN(t))throw new Error("Round operator can't be used with non-numeric value");return Math.round(t)},Sqrt:e=>{const t=Number(e);if(isNaN(t))throw new Error("Sqrt operator can't be used with non-numeric value");return Math.sqrt(t)},Sub:(...e)=>{if(e.length<2)throw new Error("must provide at least two numbers");return e.reduce((e,t,n)=>{const r=Number(t);if(isNaN(r))throw new Error("Sub operator can't be used with non-numeric values");return 0===n?r:e-r})},Sum:(...e)=>{if(0===e.length)throw new Error("must provide at least one number");return e.flat().map(e=>{const t=Number(e);if(isNaN(t))throw new Error("Sum operator can't be used with non-numeric values");return t}).reduce((e,t)=>e+t,0)},Product:(...e)=>{if(0===e.length)throw new Error("must provide at least one number");return e.flat().map(e=>{const t=Number(e);if(isNaN(t))throw new Error("Product operator can't be used with non-numeric values");return t}).reduce((e,t)=>e*t,1)}}))}registerTimeFunctions(e){e.set("time",()=>({AsTime:e=>{if(!e)return null;if(e instanceof Date)return e;if("string"==typeof e){const t=new Date(e);return isNaN(t.getTime())?null:t}if("number"==typeof e){const t=new Date(e<1e10?1e3*e:e);return isNaN(t.getTime())?null:t}return null},Format:(e,t)=>{const n=t instanceof Date?t:new Date(t);if(isNaN(n.getTime()))return"";const r=n.getFullYear(),s=n.getMonth()+1,a=n.getDate(),i=n.getHours(),o=n.getMinutes(),l=n.getSeconds(),c=n.toLocaleString("en-US",{weekday:"short"}),u=n.toLocaleString("en-US",{month:"short"}),h=[{pattern:"2006",placeholder:"{{YEAR_FULL}}",value:r.toString()},{pattern:"January",placeholder:"{{MONTH_FULL}}",value:n.toLocaleString("en-US",{month:"long"})},{pattern:"Monday",placeholder:"{{WEEKDAY_FULL}}",value:n.toLocaleString("en-US",{weekday:"long"})},{pattern:"MST",placeholder:"{{TIMEZONE}}",value:n.toLocaleString("en-US",{timeZoneName:"short"})},{pattern:"Jan",placeholder:"{{MONTH_SHORT}}",value:u},{pattern:"Mon",placeholder:"{{WEEKDAY_SHORT}}",value:c},{pattern:"06",placeholder:"{{YEAR_SHORT}}",value:r.toString().slice(-2)},{pattern:"15",placeholder:"{{HOUR_24}}",value:i.toString().padStart(2,"0")},{pattern:"01",placeholder:"{{MONTH_ZERO}}",value:s.toString().padStart(2,"0")},{pattern:"02",placeholder:"{{DAY_ZERO}}",value:a.toString().padStart(2,"0")},{pattern:"04",placeholder:"{{MINUTE_ZERO}}",value:o.toString().padStart(2,"0")},{pattern:"05",placeholder:"{{SECOND_ZERO}}",value:l.toString().padStart(2,"0")},{pattern:"PM",placeholder:"{{AMPM_UPPER}}",value:i>=12?"PM":"AM"},{pattern:"pm",placeholder:"{{AMPM_LOWER}}",value:i>=12?"pm":"am"},{pattern:"3",placeholder:"{{HOUR_12}}",value:((i+11)%12+1).toString()},{pattern:"1",placeholder:"{{MONTH_NUM}}",value:s.toString()},{pattern:"2",placeholder:"{{DAY_NUM}}",value:a.toString()},{pattern:"4",placeholder:"{{MINUTE_NUM}}",value:o.toString()},{pattern:"5",placeholder:"{{SECOND_NUM}}",value:l.toString()}];let d=e;for(const{pattern:e,placeholder:t}of h){const n=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");d=d.replace(new RegExp(n,"g"),t)}for(const{placeholder:e,value:t}of h)d=d.replace(new RegExp(e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"g"),t);return d},Now:()=>new Date,Parse:(e,t)=>{try{const e=new Date(t);return isNaN(e.getTime())?null:e}catch{return null}},Unix:e=>{const t=e instanceof Date?e:new Date(e);return Math.floor(t.getTime()/1e3)},UnixNano:e=>1e6*(e instanceof Date?e:new Date(e)).getTime()})),e.set("now",()=>{const e=new Date;return{Format:t=>{const n=e.getFullYear(),r=e.getMonth()+1,s=e.getDate(),a=e.getHours(),i=e.getMinutes(),o=e.getSeconds(),l=[{pattern:"2006",value:n.toString()},{pattern:"06",value:n.toString().slice(-2)},{pattern:"01",value:r.toString().padStart(2,"0")},{pattern:"1",value:r.toString()},{pattern:"02",value:s.toString().padStart(2,"0")},{pattern:"2",value:s.toString()},{pattern:"15",value:a.toString().padStart(2,"0")},{pattern:"3",value:(a%12||12).toString()},{pattern:"04",value:i.toString().padStart(2,"0")},{pattern:"4",value:i.toString()},{pattern:"05",value:o.toString().padStart(2,"0")},{pattern:"5",value:o.toString()}];let c=t;for(const{pattern:e,value:t}of l){const n=new RegExp(`\\b${e}\\b`,"g");c=c.replace(n,t)}return"2006"===t?n.toString():"06"===t?n.toString().slice(-2):"01"===t?r.toString().padStart(2,"0"):"02"===t?s.toString().padStart(2,"0"):"15"===t?a.toString().padStart(2,"0"):"04"===t?i.toString().padStart(2,"0"):"05"===t?o.toString().padStart(2,"0"):c},getTime:()=>e.getTime(),toString:()=>e.toString(),toISOString:()=>e.toISOString()}}),e.set("dateFormat",(e,t)=>t.toLocaleDateString())}registerCollectionFunctions(e){e.set("len",e=>Array.isArray(e)||"string"==typeof e?e.length:e&&"object"==typeof e?Object.keys(e).length:0),e.set("first",(e,t)=>Array.isArray(e)?e.slice(0,1):Array.isArray(t)?t.slice(0,e):[]),e.set("last",(e,t)=>Array.isArray(e)?e.slice(-1):Array.isArray(t)?t.slice(-e):[]),e.set("merge",(...e)=>{const t={};for(const n of e)n&&"object"==typeof n&&!Array.isArray(n)&&Object.assign(t,n);return t}),e.set("index",(e,...t)=>{try{return this.doIndex(e,t)}catch(n){return log34.error(`Index of type ${typeof e} with args [${t.join(", ")}] failed:`,n),null}}),e.set("reverse",e=>Array.isArray(e)?[...e].reverse():e),e.set("append",(...e)=>{if(e.length<2)return e[0]||[];const t=Array.isArray(e[0])?[...e[0]]:[e[0]];for(let n=1;n<e.length;n++)Array.isArray(e[n])?t.push(...e[n]):t.push(e[n]);return t}),e.set("prepend",(e,...t)=>Array.isArray(e)?[...t,...e]:[...t,e]),e.set("seq",(...e)=>{if(e.length<1||e.length>3)throw new Error("invalid number of arguments to Seq");const t=e.map(e=>{const t=Number(e);if(isNaN(t))throw new Error("invalid arguments to Seq");return Math.floor(t)});let n,r=1,s=t[0];if(1===t.length){if(n=s,0===n)return[];n>0?s=1:(s=-1,r=-1)}else if(2===t.length)n=t[1],n<s&&(r=-1);else{if(r=t[1],n=t[2],0===r)throw new Error("'increment' must not be 0");if(s<n&&r<0)throw new Error("'increment' must be > 0");if(s>n&&r>0)throw new Error("'increment' must be < 0")}if(n<-1e5)throw new Error("size of result exceeds limit");const a=Math.floor((n-s)/r)+1;if(a<=0||a>2e3)throw new Error("size of result exceeds limit");const i=new Array(a);let o=s;for(let e=0;e<a&&(i[e]=o,o+=r,!(r<0&&o<n||r>0&&o>n));e++);return i}),e.set("sort",(e,...t)=>{if(null==e)throw new Error("sequence must be provided");let n;if(Array.isArray(e))n=[...e];else{if("object"!=typeof e||null===e)throw new Error("can't sort "+typeof e);n=Object.values(e)}if(0===n.length)return n;let r="",s=!0;for(let e=0;e<t.length;e++){const n=t[e];0===e?"string"==typeof n&&(r=n):1===e&&"string"==typeof n&&"desc"===n.toLowerCase()&&(s=!1)}const a=(e,t)=>{if(!t||"value"===t)return e;const n=t.split(".");let r=e;for(const e of n){if(null==r)return;if("object"!=typeof r)return;r=r[e]}return r};return n.sort((e,t)=>{let n=r?a(e,r):e,i=r?a(t,r):t;if(null==n)return null==i?0:s?-1:1;if(null==i)return s?1:-1;if("string"==typeof n&&"string"==typeof i){const e=n.localeCompare(i);return s?e:-e}if("number"==typeof n&&"number"==typeof i){const e=n-i;return s?e:-e}const o=String(n),l=String(i),c=o.localeCompare(l);return s?c:-c})}),e.set("where",(()=>(e,t,...n)=>{if(!e)return[];let r,s="==";if(1===n.length)r=n[0];else{if(2!==n.length)throw new Error("where function requires 2-4 arguments");s=n[0],r=n[1]}const a=[];if(Array.isArray(e))for(let n=0;n<e.length;n++){const i=e[n],o=this.getNestedValue(i,t);this.checkCondition(o,r,s)&&a.push(i)}else if("object"==typeof e)for(const[n,i]of Object.entries(e))if(Array.isArray(i)){const e=i.filter(e=>{const n=this.getNestedValue(e,t);return this.checkCondition(n,r,s)});e.length>0&&a.push({[n]:e})}return a})()),e.set("intersect",(e,t)=>Array.isArray(e)&&Array.isArray(t)?e.filter(e=>t.includes(e)):[]),e.set("querify",(...e)=>{let t=[];if(t=1===e.length&&Array.isArray(e[0])?e[0]:e,t.length%2!=0)throw new Error("querify requires an even number of arguments (key-value pairs)");const n=[];for(let e=0;e<t.length;e+=2){const r=String(t[e]),s=String(t[e+1]);n.push([r,s])}return n.sort((e,t)=>e[0].localeCompare(t[0])),n.map(([e,t])=>`${encodeURIComponent(e).replace(/%20/g,"+")}=${encodeURIComponent(t).replace(/%20/g,"+")}`).join("&")}),e.set("isset",(e,t)=>{if(null==e)return!1;if(Array.isArray(e)){const n=Number(t);return isNaN(n)||!Number.isInteger(n)?(console.warn(`isset unable to use key of type ${typeof t} as index`),!1):e.length>n&&n>=0}if("object"==typeof e)return t in e;if("string"==typeof e){const n=Number(t);return isNaN(n)||!Number.isInteger(n)?(console.warn(`isset unable to use key of type ${typeof t} as index`),!1):e.length>n&&n>=0}return console.warn(`calling isset with unsupported type "${typeof e}" (${e.constructor?.name||typeof e}) will always return false.`),!1})}doIndex(e,t){if(null==e)return null;if(0===t.length)return e;let n=e;for(const e of t){if(null==n)return null;if(Array.isArray(n))n=this.indexArray(n,e);else if("string"==typeof n)n=this.indexString(n,e);else{if("object"!=typeof n)throw new Error("can't index item of type "+typeof n);n=this.indexObject(n,e)}}return n}indexArray(e,t){const n=this.toInteger(t);if(null===n)throw new Error("cannot index slice/array with type "+typeof t);return n<0||n>=e.length?null:e[n]}indexString(e,t){const n=this.toInteger(t);if(null===n)throw new Error("cannot index string with type "+typeof t);return n<0||n>=e.length?null:e.charAt(n)}indexObject(e,t){const n=String(t);if(e.hasOwnProperty(n))return e[n];const r=Object.keys(e).find(e=>e.toLowerCase()===n.toLowerCase());if(r)return e[r];if(e instanceof Map){if(e.has(n))return e.get(n);for(const t of e.keys())if(String(t).toLowerCase()===n.toLowerCase())return e.get(t)}return null}toInteger(e){if("number"==typeof e)return Number.isInteger(e)?e:Math.floor(e);if("string"==typeof e){const t=parseInt(e,10);if(!isNaN(t))return t}return null}checkCondition(e,t,n){const r=n.toLowerCase().trim();if(null==e&&null==t)return["==","=","eq",""].includes(r);if(null==e||null==t)return["!=","<>","ne"].includes(r);if("in"===r)return(Array.isArray(t)||"string"==typeof t&&"string"==typeof e)&&t.includes(e);if("intersect"===r)return!(!Array.isArray(e)||!Array.isArray(t))&&e.some(e=>t.includes(e));const[s,a]=this.normalizeForComparison(e,t);switch(r){case"":case"=":case"==":case"eq":return s===a;case"!=":case"<>":case"ne":return s!==a;case"<":case"lt":return s<a;case"<=":case"le":return s<=a;case">":case"gt":return s>a;case">=":case"ge":return s>=a;default:return!1}}normalizeForComparison(e,t){if("number"==typeof e&&"number"==typeof t)return[e,t];if("number"==typeof e&&"string"==typeof t){const n=parseFloat(t);if(!isNaN(n))return[e,n]}if("string"==typeof e&&"number"==typeof t){const n=parseFloat(e);if(!isNaN(n))return[n,t]}return"string"==typeof e&&"string"==typeof t||"boolean"==typeof e&&"boolean"==typeof t?[e,t]:[String(e),String(t)]}registerSafeFunctions(e){e.set("return",(...e)=>0===e.length?"":1===e.length?e[0]:e),e.set("cond",(...e)=>{if(e.length<2)throw new Error("cond requires at least 2 arguments");const t=e[0],n=e[1],r=e.length>2?e[2]:"";let s=!1;return!0===t||1===t?s=!0:"string"==typeof t?s=t.length>0&&"false"!==t&&"0"!==t:"number"==typeof t?s=0!==t:Array.isArray(t)?s=t.length>0:t&&"object"==typeof t&&(s=Object.keys(t).length>0),s?n:r}),e.set("safeHTML",e=>e),e.set("safeCSS",e=>e),e.set("safeJS",e=>e),e.set("safeURL",e=>e),e.set("dict",(...e)=>{if(e.length%2!=0)throw new Error("dict requires an even number of arguments");const t={};for(let n=0;n<e.length;n+=2)t[String(e[n])]=e[n+1];return t}),e.set("slice",(...e)=>e),e.set("default",(e,t)=>null!=t&&""!==t&&0!==t?t:e),e.set("jsonify",(...e)=>{if(0===e.length)return"";let t,n={};if(1===e.length)t=e[0];else{if(2!==e.length)throw new Error("too many arguments to jsonify");{const r=e[0];t=e[1],r&&"object"==typeof r&&(n.prefix=r.prefix||"",n.indent=r.indent||"",n.noHTMLEscape=r.noHTMLEscape||!1)}}try{let e;return n.indent?(e=JSON.stringify(t,null,n.indent),n.prefix&&(e=e.split("\n").map(e=>n.prefix+e).join("\n"))):e=JSON.stringify(t),n.noHTMLEscape||(e=e.replace(/&/g,"\\u0026").replace(/</g,"\\u003c").replace(/>/g,"\\u003e")),e}catch(e){throw new Error(`failed to jsonify object: ${e.message}`)}})}registerFmtFunctions(e){e.set("printf",(e,...t)=>{let n=e,r=0;return n=n.replace(/%[vsdft%]/g,e=>{if("%%"===e)return"%";if(r>=t.length)return e;const n=t[r++];switch(e){case"%v":case"%s":default:return String(n);case"%d":return String(Math.floor(Number(n)||0));case"%f":return String(Number(n)||0);case"%t":return String(Boolean(n))}}),n}),e.set("print",(...e)=>e.map(e=>String(e)).join(" ")),e.set("println",(...e)=>e.map(e=>String(e)).join(" ")+"\n"),e.set("errorf",(e,...t)=>{let n=e;for(let e=0;e<t.length;e++)n=n.replace(/%[sd%]/,String(t[e]));return log34.error("Template Error:",n),""}),e.set("warnf",(e,...t)=>{let n=e;for(let e=0;e<t.length;e++)n=n.replace(/%[sd%]/,String(t[e]));return log34.warn("Template Warning:",n),""}),e.set("fmt",()=>({Print:(...e)=>e.map(e=>String(e)).join(" "),Printf:(e,...t)=>{let n=e;for(let e=0;e<t.length;e++)n=n.replace(/%[sd%]/,String(t[e]));return n},Println:(...e)=>e.map(e=>String(e)).join(" ")+"\n",Errorf:(e,...t)=>{let n=e;for(let e=0;e<t.length;e++)n=n.replace(/%[sd%]/,String(t[e]));return log34.error("Template Error:",n),""},Erroridf:(e,t,...n)=>{let r=t;for(let e=0;e<n.length;e++)r=r.replace(/%[sd%]/,String(n[e]));return log34.error("Template Error:",r),""},Warnf:(e,...t)=>{let n=e;for(let e=0;e<t.length;e++)n=n.replace(/%[sd%]/,String(t[e]));return log34.error("Template Warning:",n),""},Warnidf:(e,t,...n)=>{let r=t;for(let e=0;e<n.length;e++)r=r.replace(/%[sd%]/,String(n[e]));return log34.error("Template Warning:",r),""}}))}registerReflectFunctions(e){e.set("reflect",()=>({IsMap:e=>{if(null==e)return!1;if("object"!=typeof e||Array.isArray(e))return!1;if(e instanceof Map)return!0;if(e.constructor===Object)return!0;const t=Object.getPrototypeOf(e);return t===Object.prototype||null===t},IsSlice:e=>Array.isArray(e)}))}registerPathFunctions(e){e.set("path",()=>({Base:e=>{if(!e)return".";if(!(e=(e=e.replace(/\\/g,"/")).replace(/\/+$/,"")))return"/";const t=e.split("/");return t[t.length-1]||"/"},Clean:e=>{if(!e)return".";const t=(e=e.replace(/\\/g,"/")).startsWith("/"),n=e.split("/").filter(e=>e&&"."!==e),r=[];for(const e of n)".."===e?r.length>0&&".."!==r[r.length-1]?r.pop():t||r.push(".."):r.push(e);return e=r.join("/"),t&&(e="/"+e),e||(t?"/":".")},Dir:e=>{if(!e)return".";if(!(e=e.replace(/\/+$/,"")))return"/";const t=e.split("/");return t.pop(),t.join("/")||"."},Ext:e=>{const t=e.split("/").pop()||"",n=t.lastIndexOf(".");return-1===n||0===n?"":t.substring(n)},IsAbs:e=>e.startsWith("/"),Join:(...e)=>{if(0===e.length)return".";let t=e.filter(e=>e).map(e=>e.replace(/^\/+|\/+$/g,"")).join("/");return e[0]&&e[0].startsWith("/")&&(t="/"+t),t||"."},Split:e=>{if(!e)return[".",""];const t=e.lastIndexOf("/");return-1===t?["",e]:[e.substring(0,t),e.substring(t+1)]}}))}registerTransformFunctions(e){e.set("transform",()=>({Unmarshal:(...e)=>{if(e.length<1||e.length>2)throw new Error("unmarshal takes 1 or 2 arguments");let t,n,r={};if(1===e.length)t=e[0];else{const n=e[0];if(!n||"object"!=typeof n)throw new Error("first argument must be a map");r=n,t=e[1]}if(t&&"object"==typeof t&&"function"==typeof t.Content)try{const e=t.Content();return this.unmarshalContent(e,r)}catch(e){throw new Error(`failed to get content from resource: ${e.message}`)}if("string"==typeof t)n=t;else{if(!t||"function"!=typeof t.toString)throw new Error(`type ${typeof t} not supported`);n=t.toString()}return n&&""!==n.trim()?this.unmarshalContent(n,r):null},Plainify:e=>{const t=String(e);return this.stripHTML(t)}})),e.set("unmarshal",(...t)=>e.get("transform")().Unmarshal(...t)),e.set("plainify",e=>{const t=String(e);return this.stripHTML(t)})}stripHTML(e){if(!e.includes("<")&&!e.includes(">"))return e;let t=e.replace(/\n/g," ").replace(/<\/p>/gi,"\n").replace(/<br\s*\/?>/gi,"\n").replace(/<\/div>/gi,"\n").replace(/<\/h[1-6]>/gi,"\n").replace(/<\/li>/gi,"\n").replace(/<\/tr>/gi,"\n").replace(/<\/blockquote>/gi,"\n");t=t.replace(/<[^>]*>/g,"");const n=t.split("\n");return t=n.map(e=>e.trim().replace(/\s+/g," ")).filter(e=>e.length>0).join("\n").trim(),t=t.replace(/\n\s*\n/g,"\n"),t}unmarshalContent(e,t={}){const n=e.trim();if(!n)return null;let r=t.format;r||(r=this.detectFormat(n));try{switch(r.toLowerCase()){case"json":return JSON.parse(n);case"yaml":case"yml":return this.parseYAML(n);case"toml":return this.parseTOML(n);case"csv":return this.parseCSV(n);default:throw new Error(`format "${r}" not supported`)}}catch(e){throw new Error(`failed to unmarshal ${r}: ${e.message}`)}}detectFormat(e){const t=e.trim();if(t.startsWith("{")&&t.endsWith("}")||t.startsWith("[")&&t.endsWith("]"))try{return JSON.parse(t),"json"}catch{}return t.startsWith("---")||/^[a-zA-Z_][a-zA-Z0-9_]*\s*:\s*.+/m.test(t)?"yaml":/^\[.*\]$/m.test(t)||/^[a-zA-Z_][a-zA-Z0-9_]*\s*=\s*.+/m.test(t)?"toml":/^[^,\n]*,[^,\n]*/.test(t)?"csv":"json"}parseYAML(e){const t=e.split("\n"),n={};for(const e of t){const t=e.trim();if(!t||t.startsWith("#")||"---"===t)continue;const r=t.indexOf(":");if(r>0){const e=t.substring(0,r).trim();let s=t.substring(r+1).trim();(s.startsWith('"')&&s.endsWith('"')||s.startsWith("'")&&s.endsWith("'"))&&(s=s.slice(1,-1)),"true"===s?n[e]=!0:"false"===s?n[e]=!1:/^\d+$/.test(s)?n[e]=parseInt(s,10):/^\d*\.\d+$/.test(s)?n[e]=parseFloat(s):n[e]=s}}return n}parseTOML(e){const t=e.split("\n"),n={};let r="";for(const e of t){const t=e.trim();if(!t||t.startsWith("#"))continue;if(t.startsWith("[")&&t.endsWith("]")){r=t.slice(1,-1),n[r]||(n[r]={});continue}const s=t.indexOf("=");if(s>0){const e=t.substring(0,s).trim();let a,i=t.substring(s+1).trim();(i.startsWith('"')&&i.endsWith('"')||i.startsWith("'")&&i.endsWith("'"))&&(i=i.slice(1,-1)),a="true"===i||"false"!==i&&(/^\d+$/.test(i)?parseInt(i,10):/^\d*\.\d+$/.test(i)?parseFloat(i):i),r?n[r][e]=a:n[e]=a}}return n}parseCSV(e){const t=e.trim().split("\n");if(0===t.length)return[];const n=this.parseCSVLine(t[0]),r=[];for(let e=1;e<t.length;e++){const s=this.parseCSVLine(t[e]),a={};for(let e=0;e<n.length;e++){const t=n[e],r=e<s.length?s[e]:"";/^\d+$/.test(r)?a[t]=parseInt(r,10):/^\d*\.\d+$/.test(r)?a[t]=parseFloat(r):a[t]="true"===r||"false"!==r&&r}r.push(a)}return r}parseCSVLine(e){const t=[];let n="",r=!1;for(let s=0;s<e.length;s++){const a=e[s];'"'===a?r&&'"'===e[s+1]?(n+='"',s++):r=!r:","!==a||r?n+=a:(t.push(n.trim()),n="")}return t.push(n.trim()),t}getNestedValue(e,t){if(!e||!t)return;const n=t.replace(/^\\.+/,"").split(".");let r=e;for(let e=0;e<n.length;e++){const t=n[e];if(null==r)return;if("object"==typeof r){if(r.hasOwnProperty(t)){r=r[t];continue}const e=Object.keys(r).find(e=>e.toLowerCase()===t.toLowerCase());if(e){r=r[e];continue}const n=t.toLowerCase();if("function"==typeof r[n])try{r=r[n]();continue}catch(e){return}return}return}return r}};function newTemplateRegistry(){return new DefaultTemplateRegistry}var Factory2=class{async create(e){return this.createWithConfig(e,{})}async createWithConfig(e,t){try{const n=(new Builder).withFs(e).withNamespaces(new RegularTemplateNamespace,new PartialTemplateNamespace,new ShortcodeTemplateNamespace);t.services?n.withServices(t.services):t.funcMap?n.withFuncMap(t.funcMap):n.withFuncMap(function(){const e=new Map;return newTemplateRegistry().registerCoreFunctions(e),e}());const r=await n.buildLookup().buildParser().buildExecutor().build();return await r.markReady(),r}catch(e){const t=e instanceof Error?e.message:String(e);throw new TemplateError(`Failed to create template engine: ${t}`,"FACTORY_CREATE_FAILED")}}async createWithServices(e,t){return this.createWithConfig(e,{services:t})}},Builder=class{funcMap=new Map;services;fs;templateNamespace;partialNamespace;shortcodeNamespace;lookup;parser;executor;withFs(e){return this.fs=e,this}withNamespaces(e,t,n){return this.templateNamespace=e,this.partialNamespace=t,this.shortcodeNamespace=n,this}withFuncMap(e){return this.funcMap=new Map([...this.funcMap,...e]),this}withServices(e){return this.services=e,this.funcMap=function(e){const t=new Map;return newTemplateRegistry().registerAllFunctions(t,e),t}(e),this}buildLookup(){const e=new BaseOf;return this.lookup=function(e,t){return new Lookup(e,t)}(e,this.funcMap),this}buildParser(){return this.parser=function(e=new Map){return new Parser(e)}(this.funcMap),this}buildExecutor(){return this.executor=new Executor,this}async build(){if(!this.fs)throw new TemplateError("File system is required","BUILDER_FS_REQUIRED");if(!this.templateNamespace)throw new TemplateError("Template namespace is required","BUILDER_TEMPLATE_NAMESPACE_REQUIRED");if(!this.partialNamespace)throw new TemplateError("Partial namespace is required","BUILDER_PARTIAL_NAMESPACE_REQUIRED");if(!this.shortcodeNamespace)throw new TemplateError("Shortcode namespace is required","BUILDER_SHORTCODE_NAMESPACE_REQUIRED");if(!this.lookup)throw new TemplateError("Lookup is required","BUILDER_LOOKUP_REQUIRED");if(!this.parser)throw new TemplateError("Parser is required","BUILDER_PARSER_REQUIRED");if(!this.executor)throw new TemplateError("Executor is required","BUILDER_EXECUTOR_REQUIRED");const e=(t=this.executor,n=this.lookup,r=this.parser,s=this.templateNamespace,a=this.partialNamespace,i=this.shortcodeNamespace,o=this.fs,new TemplateEngine(t,n,r,s,a,i,o));var t,n,r,s,a,i,o;!function(e){for(const t of engineDependentFunctions)try{t.updateEngine(e)}catch(e){log34.error(`❌ Failed to update function ${t.getFunctionName()}:`,e)}}(e);try{await e.loadTemplates()}catch(e){const t=e instanceof Error?e.message:String(e);throw new TemplateError(`Failed to load templates: ${t}`,"BUILDER_LOAD_TEMPLATES_FAILED")}return e}};var log35=getDomainLogger("content",{component:"pagebuilder"}),PageBuilder=class{urlSvc;langSvc;taxonomySvc;templateSvc;pageMapper;taxonomy;term;section;standalone;converter;contentHub;source;sourceByte;kind;singular;term_;langIdx;fm;fmParser;c;renderableDocument=null;constructor(e,t,n,r,s,a,i,o,l,c,u){this.urlSvc=e,this.langSvc=t,this.taxonomySvc=n,this.templateSvc=r,this.pageMapper=null,this.taxonomy=a,this.term=i,this.section=o,this.standalone=l,this.converter=c,this.contentHub=u,this.source=null,this.sourceByte=new Uint8Array,this.kind="",this.singular="",this.term_="",this.langIdx=-1,this.fm=null,this.fmParser=null,this.c=null}withSource(e){const t=Object.assign(Object.create(Object.getPrototypeOf(this)),this);return t.reset(),t.source=e,t}withLangIdx(e){return this.langIdx=e,this}reset(){this.c=null,this.kind="",this.langIdx=-1}async build(){if(!this.source)throw new Error("source for page builder is nil");const e=await this.source.contentSource();this.sourceByte=e,await this.parse(e);const t=await this.buildInternal();return await this.render(t),t}async kindBuild(){if(!this.source)throw new Error("source for page builder is nil");return await this.parseKind(),-1===this.langIdx?await this.parseLanguageByDefault():await this.parseLanguageByIdx(this.langIdx),this.fm={path:"",lang:"",kind:"",title:"",description:"",weight:999,terms:{},params:{}},this.c=newContent(new Uint8Array),await this.buildInternal()}async buildInternal(){switch(this.kind){case getKindMain("home"):return await this.buildHome();case getKindMain("section"):return await this.buildSection();case getKindMain("page"):return await this.buildPage();case getKindMain("taxonomy"):return await this.buildTaxonomy();case getKindMain("term"):return await this.buildTerm();case getKindMain("404"):return await this.build404();case getKindMain("sitemap"):return await this.buildSitemap();default:throw new Error(`unknown kind "${this.kind}"`)}}async buildPage(){const e=await this.newPage(this.source,this.c);return await this.applyFrontMatter(e),e.pageMap=this.pageMapper,await this.buildOutput(e),await this.adaptPagination(e),e}async buildPageWithKind(e){const t=await this.newPage(this.source,this.c);if(await this.applyFrontMatter(t),t.pageMap=this.pageMapper,t.kind_=e,e===getKindMain("sitemap")||e===getKindMain("404")){const e=t.meta;e&&(e.list="never")}return await this.buildOutput(t),t}async applyFrontMatter(e){if(this.fm){e.title_=this.fm.title,e.description_=this.fm.description;const t=e.meta;t&&(t.weight=this.fm.weight,t.parameters=this.fm.params||{},this.fm.date&&(t.date=this.fm.date),void 0!==this.fm.organization&&(t.org=this.fm.organization),void 0!==this.fm.author&&(t.authorInfo=this.fm.author),void 0!==this.fm.menu&&(t.menuConfig=this.fm.menu))}}async buildHome(){const e=await this.buildPageWithKind(getKindMain("home"));return await this.buildPagination(e),e}async buildSection(){const e=await this.buildPageWithKind(getKindMain("section"));return await this.buildPagination(e),e}async build404(){const e=await this.buildPageWithKind(getKindMain("404"));return await this.adaptPagination(e),e}async buildSitemap(){const e=await this.buildPageWithKind(getKindMain("sitemap"));return await this.adaptPagination(e),e}async buildTaxonomy(){const e=this.taxonomy.getTaxonomy(this.source.file.paths().path()),t=e?e.singular():"",n=await this.newTaxonomy(this.source,this.c,t);return n.pageMap=this.pageMapper,await this.buildOutput(n),await this.buildPagination(n),n}async buildTerm(){const e=this.source.file.paths(),t=this.taxonomy.getTaxonomy(e.path()),n=t?t.singular():"",r=e.unnormalized().baseNameNoIdentifier(),s=await this.newTerm(this.source,this.c,n,r);return s.pageMap=this.pageMapper,await this.buildOutput(s),await this.buildPagination(s),s}async render(e){if(this.c?.lazyRendered)return void(this.c.lazyRender=async()=>{const t=await(this.renderableDocument?.render({maxSummaryLength:300,wordsPerMinute:200,shortcodeRenderer:this.createShortcodeRenderer(e)}));this.c?.updateWithContentResult(t)});log35.info(`Lazy rendering not enabled, rendering immediately for page: ${e.path()}`);const t=await(this.renderableDocument?.render({maxSummaryLength:300,wordsPerMinute:200,shortcodeRenderer:this.createShortcodeRenderer(e)}));this.c?.updateWithContentResult(t)}async parse(e){this.renderableDocument=await this.converter.prepareRender(e),this.c=newContent(e),this.c.toc=this.renderableDocument.toc(),this.fmParser=new FrontMatterParserImpl(this.renderableDocument.frontMatter(),this.langSvc,this.taxonomySvc),await this.parseFrontMatter(),await this.parseLanguage(),await this.parseKind(),await this.parseTerms()}async parseTerms(){this.fm&&this.fm.terms&&(this.term.terms=this.fm.terms)}async parseKind(){const e=this.source.file.paths();let t="";if(this.fm&&(t=this.fm.kind||""),""===t)switch(t=getKindMain("page"),e.baseNoLeadingSlash()){case"/":case"":t=getKindMain("home");break;case"404":t=getKindMain("404");break;case"_sitemap":t=getKindMain("sitemap");break;default:if(this.source.file.isBranchBundle()){t=getKindMain("section");const n=this.taxonomy.getTaxonomy(e.path());this.taxonomy.isZero(n)||(t=this.taxonomy.isTaxonomyPath(e.path())?getKindMain("taxonomy"):getKindMain("term"))}}this.kind=t}async parseLanguageByDefault(){const e=this.langSvc.defaultLanguage(),t=await this.langSvc.getLanguageIndex(e);this.source.identity.lang=e,this.source.identity.langIdx=t}async parseLanguageByIdx(e){const t=this.langSvc.getLanguageByIndex(e);this.source.identity.lang=t,this.source.identity.langIdx=e}async parseLanguage(){const[e,t]=this.langSvc.getSourceLang(this.source.file.fileInfo().root());if(t){const t=this.langSvc.getLanguageIndex(e);return this.source.identity.lang=e,void(this.source.identity.langIdx=t)}await this.parseLanguageByDefault()}async parseFrontMatter(){this.fmParser?this.fm=await this.fmParser.parse(this.urlSvc.baseUrl()):this.fm={path:"",lang:"",kind:"",title:"",description:"",weight:999,terms:{},params:{}}}createShortcodeRenderer(e){return async t=>{if(!this.templateSvc)return log35.warn(`Template service not available for shortcode: ${t.name}`),"";try{return t.name?await this.doRenderShortcode(t,null,0,e):(log35.warn("Shortcode missing name"),"")}catch(e){return log35.error(`Error rendering shortcode "${t.name}":`,e),""}}}async doRenderShortcode(e,t,n,r){if(e.inline)return log35.warn("Inline shortcodes are not supported yet."),"";let s=new ShortcodeWithPage(e.params||{},"",r,t,e.name,"object"==typeof e.params&&!Array.isArray(e.params),e.ordinal||0,e.indentation||"",e.pos||0);if(e.inner&&e.inner.length>0){let a="";for(const t of e.inner)if("string"==typeof t)a+=t;else{if("object"!=typeof t||!("name"in t))return log35.error(`Illegal state on shortcode rendering of "${e.name}". Illegal type in inner data: ${typeof t}`),"";a+=await this.doRenderShortcode(t,s,n+1,r)}if(e.doMarkup)try{const n=await this.renderShortcodeMarkdown(r,a);s=new ShortcodeWithPage(e.params||{},n,r,t,e.name,"object"==typeof e.params&&!Array.isArray(e.params),e.ordinal||0,e.indentation||"",e.pos||0)}catch(e){throw new Error(`Failed to process inner content: ${e}`)}else s=new ShortcodeWithPage(e.params||{},a,r,t,e.name,"object"==typeof e.params&&!Array.isArray(e.params),e.ordinal||0,e.indentation||"",e.pos||0)}try{let t=await(this.templateSvc?.execute(e.name,s));if(!e.inner?.length&&e.indentation){const n=t?.split("\n");t=n?.map((t,n)=>0===n?t:e.indentation+t).join("\n")}return t||""}catch(t){if(t instanceof TemplateError&&"SHORTCODE_NOT_FOUND"===t.code)return e.rawContent;throw new Error(`Failed to process shortcode: ${t instanceof Error?t.message:String(t)}`)}}async renderShortcodeMarkdown(e,t){try{const n={document:e,documentID:e.path(),documentName:e.name(),filename:e.pageFile().filename()},r={ctx:{},src:(new TextEncoder).encode(t),renderTOC:!1,getRenderer:()=>null},s=await this.converter.convert(n,r);let a=(new TextDecoder).decode(s.bytes());return a.includes("\n")||(a=a.replace(/^<p>(.*)<\/p>\n$/,"$1")),a}catch(e){return log35.error("Error rendering shortcode markdown:",e),""}}async buildPagination(e){const t=new PaginatorManagerImpl({pageSize:()=>10,globalRegularPages:async()=>this.contentHub?await this.contentHub.globalRegularPages():[]},e);e.pagerManager=t}async adaptPagination(e){const t={current:()=>new PaginatorImpl([],0,10,e.path()).pagers()[0],setCurrent:t=>{throw new Error(`pagination not supported for this page: ${e.path()}`)},paginator:async()=>{throw new Error(`pagination not supported for this page: ${e.path()}`)},paginate:async t=>{throw new Error(`pagination not supported for this page: ${e.path()}`)}};e.pagerManager=t}async buildOutput(e){}async newPage(e,t){const n=new Meta(this.urlSvc.baseUrl(),"always",{},0,e.file.fileInfo().modTime()),r=new Layout;return new PageImpl(e,t,n,r,"",getKindMain("page"),this.pageMapper)}async newTaxonomy(e,t,n){const r=new Meta(this.urlSvc.baseUrl(),"always",{},0,e.file.fileInfo().modTime()),s=new Layout;return new TaxonomyPageImpl(e,t,r,s,n,n,getKindMain("taxonomy"),this.pageMapper)}async newTerm(e,t,n,r){const s=new Meta(this.urlSvc.baseUrl(),"always",{},0,e.file.fileInfo().modTime()),a=new Layout;return new TermPageImpl(e,t,s,a,n,r,r,getKindMain("term"),this.pageMapper)}},path20=__toESM(require("path")),filepath=__toESM(require("path")),Taxonomy2=class{views;fsSvc;constructor(e,t){this.views=e,this.fsSvc=t}async assemble(e,t,n){for(const r of this.views){const s=this.pluralTreeKey(r.plural()),a=(e.get(s),newPageSource(newFileInfo2(this.fsSvc.newFileMetaInfo(s+"/_index.md")))),i=await t.withSource(a).withLangIdx(n).kindBuild();e.insertIntoValuesDimension(s,newPageTreesNode2(i))}}isTaxonomyPath(e){const t=this.getTaxonomy(e);return!!t&&e===path20.join(this.pluralTreeKey(t.plural()),"_index.md")}pluralTreeKey(e){return function(...e){let t="";return e.length>0&&(t=e[0],e.length>1&&(t=path20.join(...e))),t=t.replace(/^[\.\/ \s]+|[\.\/ \s]+$/g,""),t=filepath.posix.normalize(t.toLowerCase().replace(/[^\w\-_\/]/g,"")),""===t||"/"===t?"":("/"!==t[0]&&(t="/"+t),t)}(e)}getTaxonomy(e){for(const t of this.views)if(e.startsWith(this.pluralTreeKey(t.plural())))return t;return null}isZero(e){return!e||""===e.singular()}};init_log();var log36=getDomainLogger("content",{component:"term"});function toStringSlicePreserveString(e){return e?Array.isArray(e)?e.map(e=>String(e)):"string"==typeof e?[e]:[String(e)]:null}function toInt(e){if("number"==typeof e)return Math.floor(e);if("string"==typeof e){const t=parseInt(e,10);if(isNaN(t))throw new Error(`cannot convert "${e}" to int`);return t}throw new Error(`cannot convert ${typeof e} to int`)}var Term=class{terms;fsSvc;constructor(e){this.terms={},this.fsSvc=e}async assemble(e,t,n,r){const s=new NodeShiftTreeWalker({tree:e,lockType:2,handle:async(s,a,i)=>{const[o,l]=a.getPage();if(!l)return[!1,null];for(const a of n.taxonomy.views){const i=toStringSlicePreserveString(getParam(o.params(),a.plural(),!1));if(!i)continue;const l=getParamToLower(o.params(),a.plural()+"_weight");let c=0;if(null==l||""===l)c=0;else try{c=toInt(l)}catch(e){log36.warn(`Unable to convert taxonomy weight ${l} to int for "${o.paths().path()}"`)}for(let l=0;l<i.length;l++){const u=i[l];if(""===u)continue;const h="/"+a.plural()+"/"+u;try{const i=newFileInfo2(this.fsSvc.newFileMetaInfo(h+"/_index.md")),d=i.paths(),p=newPageSource(i),g=await n.withSource(p).withLangIdx(r).kindBuild();e.insertIntoValuesDimension(d.base(),newPageTreesNode2(g));const m=e.get(d.base());if(m){const[e,t]=m.getPage();if(!t)return[!1,null];const n=e;n.term=u,n.singular=a.singular()}let f=s;""===f&&(f="/");const T=d.base()+f,[E,S]=m.getPage();if(!S)return[!1,null];t.insert(T,new WeightedTermTreeNode(newPageTreesNode2(o),{page:E,ordinal:l,weight:c,Weight:()=>c,Ordinal:()=>l}))}catch(e){return[!1,e]}}}return[!1,null]}});try{return await s.walk(),null}catch(e){return e}}},import_path11=__toESM(require("path"));init_log(),init_log(),getDomainLogger("site",{component:"pager"});var SitePager=class e{page;pager;constructor(e,t){this.page=e,this.pager=t}pageNumber(){return this.pager.pageNumber()}totalPages(){return this.pager.totalPages()}url(){return this.pager.url()}pages(){return this.pager.pages()}allPages(){return this.pager.allPages()}pagers(){return this.pager.pagers()}first(){return this.pager.first()}last(){return this.pager.last()}hasPrev(){return this.pager.hasPrev()}prev(){return this.pager.prev()}hasNext(){return this.pager.hasNext()}next(){return this.pager.next()}get PageNumber(){return this.pageNumber()}get TotalPages(){return this.totalPages()}get URL(){let e=this.url();return e.startsWith("/")&&(e=e.slice(1)),this.page.Site.getURL().relURL(e)}get HasPrev(){return this.hasPrev()}get HasNext(){return this.hasNext()}get First(){const t=this.first();return t?new e(this.page,t):null}get Last(){const t=this.last();return t?new e(this.page,t):null}get Prev(){const t=this.prev();return t?new e(this.page,t):null}get Next(){const t=this.next();return t?new e(this.page,t):null}get Pagers(){return this.pagers().map(t=>new e(this.page,t))}get Pages(){const e=this.pages();return this.page.sitePages(e)}get AllPages(){const e=this.pager.allPages();return this.page.sitePages(e)}},log38=getDomainLogger("site",{component:"page"}),Page2=class e{tmplSvc;langSvc;publisher;contentPage;pageOutput=null;site;resources=[];_paginator=null;_processedContent=null;constructor(e,t,n,r,s){this.tmplSvc=e,this.langSvc=t,this.publisher=n,this.contentPage=r,this.site=s}async processResources(e){this.resources=e}async render(){try{await this.renderResources(),await this.renderPage()}catch(e){log38.error(`Failed to render page ${this.paths().path()}: ${e}`)}}getPageOutput(){return this.pageOutput||(this.pageOutput=this.output()),this.pageOutput}async renderPage(){const e=this.layouts(),{preparer:t,found:n}=await this.tmplSvc.lookupLayout(e);if(!n)return void log38.warn(`Failed to find layout: ${e.join(",")} for page ${this.paths().path()}`);const r=[];let s=this.getPageOutput().targetPrefix();s=this.site.getLanguage().getCurrentLanguage()===s&&s===this.langSvc.defaultLanguage()?"":this.site.getLanguage().getCurrentLanguage(),r.push(import_path11.default.join(s,this.getPageOutput().targetFilePath())),await this.renderAndWritePage(t,r);const a=await this.current();if(a){let e=a.next();for(;e;){this.setCurrent(e);const n=[import_path11.default.join(s,e.url(),this.getPageOutput().targetFileBase())];await this.renderAndWritePage(t,n),e=e.next()}}}async renderAndWritePage(e,t){try{const n=await this.tmplSvc.executeWithContext(e,this);await this.publisher.publishSource(n,...t)}catch(e){throw this.errorf(e,"failed to publish page")}}async renderResources(){for(const e of this.resources){const t=[];let n=this.getPageOutput().targetPrefix();n=this.site.getLanguage().getCurrentLanguage()===n&&n===this.langSvc.defaultLanguage()?"":this.site.getLanguage().getCurrentLanguage();let r=e.path();t.push(import_path11.default.join(n,r));let s=null;try{const n=()=>e.pageFile().open();if(s=await n(),!s)throw new Error("Failed to open resource stream");let r;r="function"==typeof s.read?new ReadableStream({async start(e){try{const t=new Uint8Array(8192);for(;;){const n=await s.read(t);if(0===n.bytesRead)break;e.enqueue(t.slice(0,n.bytesRead))}e.close()}catch(t){e.error(t)}}}):new ReadableStream({start(e){e.close()}}),await this.publisher.publishFiles(r,...t)}catch(e){throw this.errorf(e,"failed to publish page resources")}finally{if(s)try{await s.close()}catch(e){log38.warn(`Failed to close resource stream: ${e}`)}}}}errorf(e,t,...n){const r=[this.pageIdentity().pageLanguage(),this.paths().path(),...n],s=`[%s] page "%s": ${t}: %s`,a=this.sprintf(s,...r,e.message||e);return new Error(a)}sprintf(e,...t){let n=0;return e.replace(/%s/g,()=>t[n++]||"")}clone(){const t=new e(this.tmplSvc,this.langSvc,this.publisher,this.contentPage,this.site);return t.resources=[...this.resources],t.pageOutput=this.pageOutput,t}pageIdentity(){return this.contentPage.pageIdentity()}pageFile(){return this.contentPage.pageFile()}staleVersions(){return this.contentPage.staleVersions()}section(){return this.contentPage.section()}paths(){return this.contentPage.paths()}path(){return this.contentPage.path()}slug(){return this.contentPage.slug()}file(){return this.contentPage.file()}name(){return this.contentPage.name()}title(){return this.contentPage.title()}kind(){return this.contentPage.kind()}scratch(){return this.contentPage.scratch()}get Scratch(){return this.contentPage.scratch()}IsAncestor(e){return this.contentPage.isAncestor(e.contentPage)}get Title(){return this.title()}get Section(){return this.contentPage.section()}get LinkTitle(){return this.title()}get IsSection(){return this.contentPage.isSection()}get IsPage(){return this.contentPage.isPage()}get Content(){return this.getPageOutput().content()}async WikilinkContent(){if(null!==this._processedContent)return this._processedContent;const e=await this.getPageOutput().content();return e?(this._processedContent=await this.site.ProcessWikilinks(this.slug(),e),this._processedContent):e}async Summary(){return this.contentPage.output().summary()}async ReadingTime(){return await this.getPageOutput().readingTime()}async WordCount(){return await this.getPageOutput().wordCount()}async Backlinks(){const e=this.site.GetBacklinks(this.slug()),t=[],n=await this.site.RegularPages();for(const r of e){const e=n.find(e=>e.slug()===r);e&&t.push(e)}return t}OutgoingLinks(){const e=this.site.getPageGraph();return e?e.getOutgoingLinks(this.slug()):[]}get Description(){return this.description()}get Date(){return this.pageDate()}get LocalDate(){return this.pageDate().toLocaleDateString()}get RelPermalink(){let e;if(this.pageIdentity().pageLanguage()===this.langSvc.defaultLanguage())e=this.getPageOutput().targetFilePath();else{const t=this.getPageOutput().targetPrefix(),n=this.getPageOutput().targetFilePath();e=this.pathJoin(t,n)}return e.startsWith("/")&&(e=e.slice(1)),this.site.getURL().relURL(e)}get GitInfo(){return{}}get File(){return{BaseFileName:this.contentPage.file().baseFileName(),OriginalBaseName:this.contentPage.file().originalBaseFileName(),Dir:this.contentPage.file().dir()}}isHome(){return this.contentPage.isHome()}get IsHome(){return this.isHome()}isPage(){return this.contentPage.isPage()}isSection(){return this.contentPage.isSection()}isAncestor(e){return this.contentPage.isAncestor(e)}eq(e){return this.contentPage.eq(e)}isBundled(){return this.contentPage.isBundled()}layouts(){return this.contentPage.layouts()}output(){return this.contentPage.output()}pageOutputs(){return[this.contentPage.output()]}truncated(){return this.contentPage.truncated()}get Truncated(){return this.contentPage.truncated()}parent(){return this.contentPage.parent()}pages(){return this.contentPage.pages()}isStale(){return this.contentPage.pageIdentity().isStale()}clearStale(){this.contentPage.pageIdentity().clearStale()}prevInSection(){return this.contentPage.prevInSection()}nextInSection(){return this.contentPage.nextInSection()}sections(e){return this.contentPage.sections(e)}regularPages(){return this.contentPage.regularPages()}regularPagesRecursive(){return this.contentPage.regularPagesRecursive()}terms(e,t){return this.contentPage.terms(e,t)}isTranslated(){return this.contentPage.isTranslated()}translations(){return this.contentPage.translations()}rawContent(){return this.contentPage.rawContent()}description(){return this.contentPage.description?this.contentPage.description():""}params(){return this.contentPage.params?this.contentPage.params():{}}pageBaseUrl(){return this.contentPage.pageBaseUrl()?this.contentPage.pageBaseUrl():""}pageWeight(){return this.contentPage.pageWeight?this.contentPage.pageWeight():0}pageDate(){return this.contentPage.pageDate?this.contentPage.pageDate():new Date}publishDate(){return this.contentPage.publishDate?this.contentPage.publishDate():new Date}get PublishDate(){return this.publishDate()}async relatedKeywords(e){return this.contentPage.relatedKeywords?await this.contentPage.relatedKeywords(e):[]}shouldList(e){return!this.contentPage.shouldList||this.contentPage.shouldList(e)}shouldListAny(){return!this.contentPage.shouldListAny||this.contentPage.shouldListAny()}noLink(){return!!this.contentPage.noLink&&this.contentPage.noLink()}organization(){return this.contentPage.organization?this.contentPage.organization():void 0}author(){return this.contentPage.author?this.contentPage.author():void 0}menu(){return this.contentPage.menu?this.contentPage.menu():void 0}current(){return this.contentPage.current()}setCurrent(e){this.contentPage.setCurrent(e)}posOffset(e){return this.contentPage.posOffset(e)}paginator(){return this.contentPage.paginator()}async paginate(e){return this.contentPage.paginate(e)}get Plain(){return this.rawContent()}get TableOfContents(){return this.getPageOutput().tableOfContents()}get Params(){return this.params()}get Site(){return this.site}get Sites(){return{First:this.site,Default:this.site}}get Lastmod(){return this.contentPage.pageDate?this.contentPage.pageDate():null}get Sitemap(){return{ChangeFreq:"weekly",Priority:.5,Filename:"sitemap.xml"}}get IsTranslated(){return this.isTranslated()}async Paginator(){return this._paginator||await this.setupCurrentPaginator(),this._paginator}async Paginate(e){try{const t=e.map(e=>e.contentPage),n=await this.contentPage.paginate(t);return n&&(this._paginator=new SitePager(this,n)),this._paginator}catch(e){return log38.error("Error during pagination:",e),null}}async setupCurrentPaginator(){try{const e=await this.contentPage.paginator();this._paginator=e?new SitePager(this,e):null}catch(e){log38.error("Error initializing Paginator:",e),this._paginator=null}}get Language(){return{Lang:this.pageIdentity().pageLanguage(),LanguageName:this.langSvc.getLanguageName(this.pageIdentity().pageLanguage()),Title:this.title(),Weight:this.pageWeight()}}get Permalink(){return this.RelPermalink}sitePages(e){const t=[];for(const n of e){const e=this.sitePage(n);e&&t.push(e)}return t}sitePage(t){try{return null===t?(log38.warn(`Invalid content page provided: ${t}`),null):new e(this.tmplSvc,this.langSvc,this.publisher,t,this.site)}catch(e){return log38.error(`Error creating site page: ${e}`),null}}pathJoin(...e){return e.filter(e=>e&&e.length>0).map(e=>e.replace(/^\/+|\/+$/g,"")).filter(e=>e.length>0).join("/")}joinURL(e,t){return e?t?(e.endsWith("/")&&(e=e.slice(0,-1)),t.startsWith("/")||(t="/"+t),e+t):e:t}async Translations(){const e=await this.translations();return Array.isArray(e)?e.map(e=>this.sitePage(e)).filter(e=>null!==e):[]}async GetTerms(e){const t=await this.terms(this.site.getLanguage().currentLanguageIndex(),e);return Array.isArray(t)?t.map(e=>this.sitePage(e)).filter(e=>null!==e):[]}async Pages(){return await this.getSitePages()}get Page(){return this.contentPage}get Kind(){return this.kind()}get Type(){if("home"===this.kind())return"page";if("page"===this.kind()){const e=this.section();if(e&&e.length>0)return e}return"page"}get Parent(){return this.sitePage(this.contentPage.parent())}async getSitePages(){const e=await this.contentPage.pages();return!e||Array.isArray(e)&&0===e.length?[]:this.sitePages(e)}},BaseURL=class e{url;withPath;withPathNoTrailingSlash;withoutPath;basePath;basePathNoTrailingSlash;isRelative;constructor(e,t=!1){if(this.url=e,this.isRelative=t,this.withPath=e.toString(),this.withPathNoTrailingSlash=this.withPath.replace(/\/$/,""),t)this.withoutPath="/";else{const t=new URL(e.toString());t.pathname="",this.withoutPath=t.toString().replace(/\/$/,"")}this.basePath=e.pathname,this.basePathNoTrailingSlash=this.basePath.replace(/\/$/,"")}static fromString(t){try{t&&"/"!==t||(t="/");const n=t.trim();if(n.startsWith("/")&&!n.startsWith("//")){const t=new URL(n,"http://localhost");return t.pathname.endsWith("/")||(t.pathname+="/"),new e(t,!0)}if(n.startsWith("//")){const t=new URL("https:"+n);return t.pathname.endsWith("/")||(t.pathname+="/"),new e(t)}if(n.includes("://")){const t=new URL(n);if(!["http:","https:"].includes(t.protocol))throw new Error(`Unsupported protocol: ${t.protocol}. Only http and https are supported.`);return t.pathname.endsWith("/")||(t.pathname+="/"),new e(t)}if(n.includes(":")&&!n.includes("/")){const e=n.indexOf(":"),t=n.substring(0,e+1);throw new Error(`Unsupported protocol: ${t}. Only http and https are supported.`)}const r=new URL("https://"+n);return r.pathname.endsWith("/")||(r.pathname+="/"),new e(r)}catch(e){throw new Error(`Invalid URL: ${e?.message||"Unknown error"}`)}}getRoot(e){return this.isRelative?this.basePath:e.startsWith("/")?this.withoutPath:this.withPath}toString(){return this.isRelative?this.basePath:this.withPath}path(){return this.url.pathname}port(){return this.url.port?parseInt(this.url.port):0}hostURL(){return this.isRelative?"/":this.toString().replace(this.path(),"")}protocol(){return this.url.protocol}host(){return this.url.host}hostname(){return this.url.hostname}getURL(){return new URL(this.url.toString())}withProtocol(t){if(this.isRelative)throw new Error("Cannot change protocol of relative URL");const n=this.getURL();let r=t;const s=r.endsWith("://"),a=r.endsWith(":");if(s?r=r.slice(0,-3):a&&(r=r.slice(0,-1)),a&&!n.pathname)throw new Error(`cannot determine BaseURL for protocol ${t}`);return n.protocol=r,e.fromString(n.toString())}withPort(t){if(this.isRelative)throw new Error("Cannot set port on relative URL");const n=this.getURL();return n.port=t.toString(),e.fromString(n.toString())}isRelativeURL(){return this.isRelative}isAbsoluteURL(){return!this.isRelative}},URL2=class e{base;canonical;baseURL=null;constructor(e,t=!1){this.base=e,this.canonical=t,this.setup()}setup(){try{this.baseURL=BaseURL.fromString(this.base)}catch(e){throw new Error(e?.message||"Failed to setup URL")}}isAbsURL(e){return e.startsWith("http://")||e.startsWith("https://")?[!0,null]:[/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(e),null]}startWithBaseUrlRoot(e){return!!this.baseURL&&e.startsWith(this.baseURL.getRoot(e))}isProtocolRelPath(e){return e.startsWith("//")}trimBaseUrlRoot(e){if(!this.baseURL)return e;const t=this.baseURL.getRoot(e);return e.endsWith(t)?e.slice(0,-t.length):e}addContextRoot(e){if(!this.baseURL)return e;let t=e;return this.canonical||(n=this.baseURL.getRoot(e),r=e,t=!n||r.startsWith(n)?r:function(...e){return e.filter(Boolean).join("/").replace(/\/+/g,"/").replace(/\/$/,"")}(n,r)),t;var n,r}handleRootSuffix(e,t){return this.baseURL?(""===e&&this.baseURL.getRoot(e).endsWith("/")&&(t+="/"),t):t}handlePrefix(e){return e.startsWith("/")||(e="/"+e),e}relURL(e){if(!e)return this.baseURL?this.baseURL.basePath:"";const[t,n]=this.isAbsURL(e);if(n)return e;if(t||this.isProtocolRelPath(e))return e;if(!this.baseURL)return e;let r=e;if(e.startsWith("/"))return this.baseURL.isRelativeURL()?e:this.baseURL.withoutPath+e;if(r=this.baseURL.isRelativeURL()?(this.baseURL.basePath.endsWith("/")?this.baseURL.basePath:this.baseURL.basePath+"/")+e:(this.baseURL.withPath.endsWith("/")?this.baseURL.withPath:this.baseURL.withPath+"/")+e,r.includes("://")){const e=r.indexOf("://"),t=r.substring(0,e+3),n=r.substring(e+3);r=t+n.replace(/\/+/g,"/")}else r=r.replace(/\/+/g,"/");return r}absURL(e,t=!1,n=""){const[r,s]=this.isAbsURL(e);if(s)return e;if(r||this.isProtocolRelPath(e))return e;if(!this.baseURL)return e;const a=this.baseURL.getRoot(e);if(t&&n){let t=!1,r=e;if(e.startsWith("/")&&(r=e.slice(1)),t=r===n||r.startsWith(n+"/"),!t){const t=""===e||e.endsWith("/");e=this.joinPaths(n,e),t&&(e+="/")}}return function(e,t){const n=`${e.replace(/\/$/,"")}/${t.replace(/^\//,"")}`;try{return new URL(n)}catch{return new URL("http://"+n)}}(a,e).toString()}urlize(e){return this.urlEscape(this.makePathSanitized(e))}makePathSanitized(e){return this.makePath(e).toLowerCase()}urlEscape(t){try{if(/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(t))return new e(t).toString();const n=t.match(/^([^?#]*)(\?[^#]*)?(#.*)?$/);if(!n)return encodeURI(t);const[,r="",s="",a=""]=n;return encodeURI(r)+(s||"")+(a||"")}catch{return encodeURI(t)}}makePath(e){let t=function(e){return e.replace(/[\s\t\n\r]+/g,"-").replace(/[^\w\-_]/g,"").replace(/-+/g,"-").replace(/^-|-$/g,"")}(e);return t=t.normalize("NFD").replace(/[\u0300-\u036f]/g,""),t}basePathNoSlash(){return this.baseURL?this.baseURL.basePathNoTrailingSlash:""}joinPaths(...e){return e.filter(Boolean).join("/").replace(/\/+/g,"/").replace(/\/$/,"")}};init_log(),init_taxonomies_builder(),init_log(),getDomainLogger("site",{component:"menu"});var Menu2=class e{_title;_url;_children;_weight;_identifier;constructor(e){this._title=e.title,this._url=e.url,this._children=e.children||[],this._weight=e.weight||0,this._identifier=e.identifier||this._url}title(){return this._title}get Title(){return this.title()}url(){return this._url}get URL(){return this.url()}children(){return[...this._children]}get Children(){return this.children()}weight(){return this._weight}identifier(){return this._identifier}hasChildren(){return this._children.length>0}get HasChildren(){return this.hasChildren()}addChild(t){const n=[...this._children,t];return new e({title:this._title,url:this._url,children:n,weight:this._weight,identifier:this._identifier})}toJSON(){return{title:this._title,url:this._url,weight:this._weight,children:this._children.map(e=>e.toJSON())}}withChildren(t){return new e({title:this._title,url:this._url,children:t,weight:this._weight,identifier:this._identifier})}},Menus=class{_nav;_footer;constructor(e={}){this._nav=e.nav?this.sortMenus([...e.nav]):[],this._footer=e.footer?this.sortMenus([...e.footer]):[]}nav(){return[...this._nav]}get Nav(){return this.nav()}footer(){return[...this._footer]}get Footer(){return this.footer()}sortMenus(e){return e.sort((e,t)=>{if(e.weight()!==t.weight())return 0===t.weight()?-1:0===e.weight()?1:e.weight()-t.weight();const n=e.title().localeCompare(t.title());return 0!==n?n:e.identifier().localeCompare(t.identifier())})}toJSON(){return{nav:this._nav.map(e=>e.toJSON()),footer:this._footer.map(e=>e.toJSON())}}};function newEmptyMenus(){return new Menus({})}var import_github_slugger=require("github-slugger");function splitAnchor2(e){let[t,n]=e.split("#",2);return t.endsWith(".pdf")?[t,void 0===n?"":`#${n}`]:(n=void 0===n?"":"#"+(0,import_github_slugger.slug)(n),[t,n])}function simplifySlug(e){const t=stripSlashes2((endsWith2(n=e,"index")&&(n=n.slice(0,-5)),n),!0);var n;return 0===t.length?"/":t}function pathToRoot(e){let t=e.split("/").filter(e=>""!==e).slice(0,-1).map(e=>"..").join("/");return 0===t.length&&(t="."),t}function joinSegments(...e){if(0===e.length)return"";let t=e.filter(e=>""!==e&&"/"!==e).map(e=>stripSlashes2(e)).join("/");return e[0].startsWith("/")&&(t="/"+t),e[e.length-1].endsWith("/")&&(t+="/"),t}function transformLink(e,t,n){let r=function(e){let[t,n]=splitAnchor2(decodeURI(e));const r=isFolderPath(t);let s=t.split("/").filter(e=>e.length>0),a=s.filter(isRelativeSegment).join("/");const i=simplifySlug(function(e){let t=(n=e=stripSlashes2(e),n.match(/\.[A-Za-z0-9]+$/)?.[0]);var n;const r=e.replace(new RegExp(t+"$"),"");[".md",".html",void 0].includes(t)&&(t="");let s=function(e){return e.split("/").map(e=>e.replace(/\s/g,"-").replace(/&/g,"-and-").replace(/%/g,"-percent").replace(/\?/g,"").replace(/#/g,"")).join("/").replace(/\/$/,"")}(r);return endsWith2(s,"_index")&&(s=s.replace(/_index$/,"index")),s+t}(s.filter(e=>!isRelativeSegment(e)&&""!==e).join("/"))),o=r?"/":"";return""===(l=joinSegments(stripSlashes2(a),stripSlashes2(i)))&&(l="."),l.startsWith(".")||(l=joinSegments(".",l)),l+o+n;var l}(t);if("relative"===n.strategy)return r;{const t=isFolderPath(r)?"/":"",s=stripSlashes2(r.slice(1));let[a,i]=splitAnchor2(s);if("shortest"===n.strategy){const t=n.allSlugs.filter(e=>{const t=e.split("/").at(-1);return a.toLowerCase()===t?.toLowerCase()});if(1===t.length)return function(e,t){return joinSegments(pathToRoot(e),simplifySlug(t))}(e,t[0])+i}return joinSegments(pathToRoot(e),s)+t}}function isFolderPath(e){return e.endsWith("/")||endsWith2(e,"index")||endsWith2(e,"index.md")||endsWith2(e,"index.html")}function endsWith2(e,t){return e===t||e.endsWith("/"+t)}function isRelativeSegment(e){return/^\.{0,2}$/.test(e)}function stripSlashes2(e,t){return e.startsWith("/")&&(e=e.substring(1)),!t&&e.endsWith("/")&&(e=e.slice(0,-1)),e}init_log();var log41=getDomainLogger("site",{component:"PageGraph"}),PageGraph=class{allSlugs;outgoingLinks=new Map;constructor(e){this.allSlugs=[...e],log41.info(`PageGraph initialized with ${e.length} items (pages + resources)`)}registerOutgoingLinks(e,t){const n=simplifySlug(e);this.outgoingLinks.set(n,t)}getBacklinks(e){const t=simplifySlug(e),n=[];for(const[e,r]of this.outgoingLinks.entries())r.includes(t)&&n.push(e);return n}getAllSlugs(){return[...this.allSlugs]}hasSlug(e){return this.allSlugs.includes(e)}resolveLink(e,t,n){return transformLink(e,t,{strategy:n,allSlugs:this.allSlugs})}getOutgoingLinks(e){const t=simplifySlug(e);return this.outgoingLinks.get(t)||[]}getAllOutgoingLinks(){return new Map(this.outgoingLinks)}getStats(){return{totalPages:this.allSlugs.length,slugs:[...this.allSlugs]}}};function bail(e){if(e)throw e}var import_extend=__toESM(require_extend(),1);function isPlainObject(e){if("object"!=typeof e||null===e)return!1;const t=Object.getPrototypeOf(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)}function point(e){return index(e&&e.line)+":"+index(e&&e.column)}function position(e){return point(e&&e.start)+"-"+point(e&&e.end)}function index(e){return e&&"number"==typeof e?e:1}var VFileMessage=class extends Error{constructor(e,t,n){super(),"string"==typeof t&&(n=t,t=void 0);let r="",s={},a=!1;if(t&&(s="line"in t&&"column"in t||"start"in t&&"end"in t?{place:t}:"type"in t?{ancestors:[t],place:t.position}:{...t}),"string"==typeof e?r=e:!s.cause&&e&&(a=!0,r=e.message,s.cause=e),!s.ruleId&&!s.source&&"string"==typeof n){const e=n.indexOf(":");-1===e?s.ruleId=n:(s.source=n.slice(0,e),s.ruleId=n.slice(e+1))}if(!s.place&&s.ancestors&&s.ancestors){const e=s.ancestors[s.ancestors.length-1];e&&(s.place=e.position)}const i=s.place&&"start"in s.place?s.place.start:s.place;var o;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=i?i.column:void 0,this.fatal=void 0,this.file="",this.message=r,this.line=i?i.line:void 0,this.name=((o=s.place)&&"object"==typeof o?"position"in o||"type"in o?position(o.position):"start"in o||"end"in o?position(o):"line"in o||"column"in o?point(o):"":"")||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=a&&s.cause&&"string"==typeof s.cause.stack?s.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};VFileMessage.prototype.file="",VFileMessage.prototype.name="",VFileMessage.prototype.reason="",VFileMessage.prototype.message="",VFileMessage.prototype.stack="",VFileMessage.prototype.column=void 0,VFileMessage.prototype.line=void 0,VFileMessage.prototype.ancestors=void 0,VFileMessage.prototype.cause=void 0,VFileMessage.prototype.fatal=void 0,VFileMessage.prototype.place=void 0,VFileMessage.prototype.ruleId=void 0,VFileMessage.prototype.source=void 0;var import_node_path=__toESM(require("path"),1),import_node_process=__toESM(require("process"),1),import_node_url=require("url");function isUrl(e){return Boolean(null!==e&&"object"==typeof e&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&void 0===e.auth)}var order=["history","path","basename","stem","extname","dirname"],VFile=class{constructor(e){let t;t=e?isUrl(e)?{path:e}:"string"==typeof e||function(e){return Boolean(e&&"object"==typeof e&&"byteLength"in e&&"byteOffset"in e)}(e)?{value:e}:e:{},this.cwd="cwd"in t?"":import_node_process.default.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n,r=-1;for(;++r<order.length;){const e=order[r];e in t&&void 0!==t[e]&&null!==t[e]&&(this[e]="history"===e?[...t[e]]:t[e])}for(n in t)order.includes(n)||(this[n]=t[n])}get basename(){return"string"==typeof this.path?import_node_path.default.basename(this.path):void 0}set basename(e){assertNonEmpty(e,"basename"),assertPart(e,"basename"),this.path=import_node_path.default.join(this.dirname||"",e)}get dirname(){return"string"==typeof this.path?import_node_path.default.dirname(this.path):void 0}set dirname(e){assertPath(this.basename,"dirname"),this.path=import_node_path.default.join(e||"",this.basename)}get extname(){return"string"==typeof this.path?import_node_path.default.extname(this.path):void 0}set extname(e){if(assertPart(e,"extname"),assertPath(this.dirname,"extname"),e){if(46!==e.codePointAt(0))throw new Error("`extname` must start with `.`");if(e.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=import_node_path.default.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){isUrl(e)&&(e=(0,import_node_url.fileURLToPath)(e)),assertNonEmpty(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return"string"==typeof this.path?import_node_path.default.basename(this.path,this.extname):void 0}set stem(e){assertNonEmpty(e,"stem"),assertPart(e,"stem"),this.path=import_node_path.default.join(this.dirname||"",e+(this.extname||""))}fail(e,t,n){const r=this.message(e,t,n);throw r.fatal=!0,r}info(e,t,n){const r=this.message(e,t,n);return r.fatal=void 0,r}message(e,t,n){const r=new VFileMessage(e,t,n);return this.path&&(r.name=this.path+":"+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(e){return void 0===this.value?"":"string"==typeof this.value?this.value:new TextDecoder(e||void 0).decode(this.value)}};function assertPart(e,t){if(e&&e.includes(import_node_path.default.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+import_node_path.default.sep+"`")}function assertNonEmpty(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function assertPath(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}var CallableInstance=function(e){const t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r},own={}.hasOwnProperty,unified=(new class e extends CallableInstance{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=function(){const e=[],t={run:function(...t){let n=-1;const r=t.pop();if("function"!=typeof r)throw new TypeError("Expected function as last argument, not "+r);!function s(a,...i){const o=e[++n];let l=-1;if(a)r(a);else{for(;++l<t.length;)null!==i[l]&&void 0!==i[l]||(i[l]=t[l]);t=i,o?function(e,t){let n;return function(...t){const a=e.length>t.length;let i;a&&t.push(r);try{i=e.apply(this,t)}catch(e){if(a&&n)throw e;return r(e)}a||(i&&i.then&&"function"==typeof i.then?i.then(s,r):i instanceof Error?r(i):s(i))};function r(e,...r){n||(n=!0,t(e,...r))}function s(e){r(null,e)}}(o,s)(...i):r(null,...i)}}(null,...t)},use:function(n){if("function"!=typeof n)throw new TypeError("Expected `middelware` to be a function, not "+n);return e.push(n),t}};return t}()}copy(){const t=new e;let n=-1;for(;++n<this.attachers.length;){const e=this.attachers[n];t.use(...e)}return t.data((0,import_extend.default)(!0,{},this.namespace)),t}data(e,t){return"string"==typeof e?2===arguments.length?(assertUnfrozen("data",this.frozen),this.namespace[e]=t,this):own.call(this.namespace,e)&&this.namespace[e]||void 0:e?(assertUnfrozen("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;const e=this;for(;++this.freezeIndex<this.attachers.length;){const[t,...n]=this.attachers[this.freezeIndex];if(!1===n[0])continue;!0===n[0]&&(n[0]=void 0);const r=t.call(e,...n);"function"==typeof r&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(e){this.freeze();const t=vfile(e),n=this.parser||this.Parser;return assertParser("parse",n),n(String(t),t)}process(e,t){const n=this;return this.freeze(),assertParser("process",this.parser||this.Parser),assertCompiler("process",this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,s){const a=vfile(e),i=n.parse(a);function o(e,n){e||!n?s(e):r?r(n):t(void 0,n)}n.run(i,a,function(e,t,r){if(e||!t||!r)return o(e);const s=t,a=n.stringify(s,r);var i;"string"==typeof(i=a)||function(e){return Boolean(e&&"object"==typeof e&&"byteLength"in e&&"byteOffset"in e)}(i)?r.value=a:r.result=a,o(e,r)})}}processSync(e){let t,n=!1;return this.freeze(),assertParser("processSync",this.parser||this.Parser),assertCompiler("processSync",this.compiler||this.Compiler),this.process(e,function(e,r){n=!0,bail(e),t=r}),assertDone("processSync","process",n),t}run(e,t,n){assertNode(e),this.freeze();const r=this.transformers;return n||"function"!=typeof t||(n=t,t=void 0),n?s(void 0,n):new Promise(s);function s(s,a){const i=vfile(t);r.run(e,i,function(t,r,i){const o=r||e;t?a(t):s?s(o):n(void 0,o,i)})}}runSync(e,t){let n,r=!1;return this.run(e,t,function(e,t){bail(e),n=t,r=!0}),assertDone("runSync","run",r),n}stringify(e,t){this.freeze();const n=vfile(t),r=this.compiler||this.Compiler;return assertCompiler("stringify",r),assertNode(e),r(e,n)}use(e,...t){const n=this.attachers,r=this.namespace;if(assertUnfrozen("use",this.frozen),null==e);else if("function"==typeof e)o(e,t);else{if("object"!=typeof e)throw new TypeError("Expected usable value, not `"+e+"`");Array.isArray(e)?i(e):a(e)}return this;function s(e){if("function"==typeof e)o(e,[]);else{if("object"!=typeof e)throw new TypeError("Expected usable value, not `"+e+"`");if(Array.isArray(e)){const[t,...n]=e;o(t,n)}else a(e)}}function a(e){if(!("plugins"in e)&&!("settings"in e))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");i(e.plugins),e.settings&&(r.settings=(0,import_extend.default)(!0,r.settings,e.settings))}function i(e){let t=-1;if(null==e);else{if(!Array.isArray(e))throw new TypeError("Expected a list of plugins, not `"+e+"`");for(;++t<e.length;)s(e[t])}}function o(e,t){let r=-1,s=-1;for(;++r<n.length;)if(n[r][0]===e){s=r;break}if(-1===s)n.push([e,...t]);else if(t.length>0){let[r,...a]=t;const i=n[s][1];isPlainObject(i)&&isPlainObject(r)&&(r=(0,import_extend.default)(!0,i,r)),n[s]=[e,r,...a]}}}}).freeze();function assertParser(e,t){if("function"!=typeof t)throw new TypeError("Cannot `"+e+"` without `parser`")}function assertCompiler(e,t){if("function"!=typeof t)throw new TypeError("Cannot `"+e+"` without `compiler`")}function assertUnfrozen(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function assertNode(e){if(!isPlainObject(e)||"string"!=typeof e.type)throw new TypeError("Expected node, got `"+e+"`")}function assertDone(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function vfile(e){return function(e){return Boolean(e&&"object"==typeof e&&"message"in e&&"messages"in e)}(e)?e:new VFile(e)}var Schema=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};function merge(e,t){const n={},r={};for(const t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new Schema(n,r,t)}function normalize2(e){return e.toLowerCase()}Schema.prototype.normal={},Schema.prototype.property={},Schema.prototype.space=void 0;var Info4=class{constructor(e,t){this.attribute=t,this.property=e}};Info4.prototype.attribute="",Info4.prototype.booleanish=!1,Info4.prototype.boolean=!1,Info4.prototype.commaOrSpaceSeparated=!1,Info4.prototype.commaSeparated=!1,Info4.prototype.defined=!1,Info4.prototype.mustUseProperty=!1,Info4.prototype.number=!1,Info4.prototype.overloadedBoolean=!1,Info4.prototype.property="",Info4.prototype.spaceSeparated=!1,Info4.prototype.space=void 0;var types_exports={};__export(types_exports,{boolean:()=>boolean,booleanish:()=>booleanish,commaOrSpaceSeparated:()=>commaOrSpaceSeparated,commaSeparated:()=>commaSeparated,number:()=>number,overloadedBoolean:()=>overloadedBoolean,spaceSeparated:()=>spaceSeparated});var powers=0,boolean=increment(),booleanish=increment(),overloadedBoolean=increment(),number=increment(),spaceSeparated=increment(),commaSeparated=increment(),commaOrSpaceSeparated=increment();function increment(){return 2**++powers}var checks=Object.keys(types_exports),DefinedInfo=class extends Info4{constructor(e,t,n,r){let s=-1;if(super(e,t),mark(this,"space",r),"number"==typeof n)for(;++s<checks.length;){const e=checks[s];mark(this,checks[s],(n&types_exports[e])===types_exports[e])}}};function mark(e,t,n){n&&(e[t]=n)}function create(e){const t={},n={};for(const[r,s]of Object.entries(e.properties)){const a=new DefinedInfo(r,e.transform(e.attributes||{},r),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[normalize2(r)]=r,n[normalize2(a.attribute)]=r}return new Schema(t,n,e.space)}DefinedInfo.prototype.defined=!0;var aria=create({properties:{ariaActiveDescendant:null,ariaAtomic:booleanish,ariaAutoComplete:null,ariaBusy:booleanish,ariaChecked:booleanish,ariaColCount:number,ariaColIndex:number,ariaColSpan:number,ariaControls:spaceSeparated,ariaCurrent:null,ariaDescribedBy:spaceSeparated,ariaDetails:null,ariaDisabled:booleanish,ariaDropEffect:spaceSeparated,ariaErrorMessage:null,ariaExpanded:booleanish,ariaFlowTo:spaceSeparated,ariaGrabbed:booleanish,ariaHasPopup:null,ariaHidden:booleanish,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:spaceSeparated,ariaLevel:number,ariaLive:null,ariaModal:booleanish,ariaMultiLine:booleanish,ariaMultiSelectable:booleanish,ariaOrientation:null,ariaOwns:spaceSeparated,ariaPlaceholder:null,ariaPosInSet:number,ariaPressed:booleanish,ariaReadOnly:booleanish,ariaRelevant:null,ariaRequired:booleanish,ariaRoleDescription:spaceSeparated,ariaRowCount:number,ariaRowIndex:number,ariaRowSpan:number,ariaSelected:booleanish,ariaSetSize:number,ariaSort:null,ariaValueMax:number,ariaValueMin:number,ariaValueNow:number,ariaValueText:null,role:null},transform:(e,t)=>"role"===t?t:"aria-"+t.slice(4).toLowerCase()});function caseSensitiveTransform(e,t){return t in e?e[t]:t}function caseInsensitiveTransform(e,t){return caseSensitiveTransform(e,t.toLowerCase())}var html=create({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:commaSeparated,acceptCharset:spaceSeparated,accessKey:spaceSeparated,action:null,allow:null,allowFullScreen:boolean,allowPaymentRequest:boolean,allowUserMedia:boolean,alt:null,as:null,async:boolean,autoCapitalize:null,autoComplete:spaceSeparated,autoFocus:boolean,autoPlay:boolean,blocking:spaceSeparated,capture:null,charSet:null,checked:boolean,cite:null,className:spaceSeparated,cols:number,colSpan:null,content:null,contentEditable:booleanish,controls:boolean,controlsList:spaceSeparated,coords:number|commaSeparated,crossOrigin:null,data:null,dateTime:null,decoding:null,default:boolean,defer:boolean,dir:null,dirName:null,disabled:boolean,download:overloadedBoolean,draggable:booleanish,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:boolean,formTarget:null,headers:spaceSeparated,height:number,hidden:overloadedBoolean,high:number,href:null,hrefLang:null,htmlFor:spaceSeparated,httpEquiv:spaceSeparated,id:null,imageSizes:null,imageSrcSet:null,inert:boolean,inputMode:null,integrity:null,is:null,isMap:boolean,itemId:null,itemProp:spaceSeparated,itemRef:spaceSeparated,itemScope:boolean,itemType:spaceSeparated,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:boolean,low:number,manifest:null,max:null,maxLength:number,media:null,method:null,min:null,minLength:number,multiple:boolean,muted:boolean,name:null,nonce:null,noModule:boolean,noValidate:boolean,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:boolean,optimum:number,pattern:null,ping:spaceSeparated,placeholder:null,playsInline:boolean,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:boolean,referrerPolicy:null,rel:spaceSeparated,required:boolean,reversed:boolean,rows:number,rowSpan:number,sandbox:spaceSeparated,scope:null,scoped:boolean,seamless:boolean,selected:boolean,shadowRootClonable:boolean,shadowRootDelegatesFocus:boolean,shadowRootMode:null,shape:null,size:number,sizes:null,slot:null,span:number,spellCheck:booleanish,src:null,srcDoc:null,srcLang:null,srcSet:null,start:number,step:null,style:null,tabIndex:number,target:null,title:null,translate:null,type:null,typeMustMatch:boolean,useMap:null,value:booleanish,width:number,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:spaceSeparated,axis:null,background:null,bgColor:null,border:number,borderColor:null,bottomMargin:number,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:boolean,declare:boolean,event:null,face:null,frame:null,frameBorder:null,hSpace:number,leftMargin:number,link:null,longDesc:null,lowSrc:null,marginHeight:number,marginWidth:number,noResize:boolean,noHref:boolean,noShade:boolean,noWrap:boolean,object:null,profile:null,prompt:null,rev:null,rightMargin:number,rules:null,scheme:null,scrolling:booleanish,standby:null,summary:null,text:null,topMargin:number,valueType:null,version:null,vAlign:null,vLink:null,vSpace:number,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:boolean,disableRemotePlayback:boolean,prefix:null,property:null,results:number,security:null,unselectable:null},space:"html",transform:caseInsensitiveTransform}),svg=create({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:commaOrSpaceSeparated,accentHeight:number,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:number,amplitude:number,arabicForm:null,ascent:number,attributeName:null,attributeType:null,azimuth:number,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:number,by:null,calcMode:null,capHeight:number,className:spaceSeparated,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:number,diffuseConstant:number,direction:null,display:null,dur:null,divisor:number,dominantBaseline:null,download:boolean,dx:null,dy:null,edgeMode:null,editable:null,elevation:number,enableBackground:null,end:null,event:null,exponent:number,externalResourcesRequired:null,fill:null,fillOpacity:number,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:commaSeparated,g2:commaSeparated,glyphName:commaSeparated,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:number,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:number,horizOriginX:number,horizOriginY:number,id:null,ideographic:number,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:number,k:number,k1:number,k2:number,k3:number,k4:number,kernelMatrix:commaOrSpaceSeparated,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:number,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:number,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:number,overlineThickness:number,paintOrder:null,panose1:null,path:null,pathLength:number,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:spaceSeparated,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:number,pointsAtY:number,pointsAtZ:number,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:commaOrSpaceSeparated,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:commaOrSpaceSeparated,rev:commaOrSpaceSeparated,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:commaOrSpaceSeparated,requiredFeatures:commaOrSpaceSeparated,requiredFonts:commaOrSpaceSeparated,requiredFormats:commaOrSpaceSeparated,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:number,specularExponent:number,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:number,strikethroughThickness:number,string:null,stroke:null,strokeDashArray:commaOrSpaceSeparated,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:number,strokeOpacity:number,strokeWidth:null,style:null,surfaceScale:number,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:commaOrSpaceSeparated,tabIndex:number,tableValues:null,target:null,targetX:number,targetY:number,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:commaOrSpaceSeparated,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:number,underlineThickness:number,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:number,values:null,vAlphabetic:number,vMathematical:number,vectorEffect:null,vHanging:number,vIdeographic:number,version:null,vertAdvY:number,vertOriginX:number,vertOriginY:number,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:number,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:caseSensitiveTransform}),xlink=create({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform:(e,t)=>"xlink:"+t.slice(5).toLowerCase()}),xmlns=create({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:caseInsensitiveTransform}),xml=create({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform:(e,t)=>"xml:"+t.slice(3).toLowerCase()}),cap=/[A-Z]/g,dash=/-[a-z]/g,valid=/^data[-\w.:]+$/i;function kebab(e){return"-"+e.toLowerCase()}function camelcase(e){return e.charAt(1).toUpperCase()}var html2=merge([aria,html,xlink,xmlns,xml],"html"),svg2=merge([aria,svg,xlink,xmlns,xml],"svg");function parse(e){const t=[],n=String(e||"");let r=n.indexOf(","),s=0,a=!1;for(;!a;){-1===r&&(r=n.length,a=!0);const e=n.slice(s,r).trim();!e&&a||t.push(e),s=r+1,r=n.indexOf(",",s)}return t}function stringify(e,t){const n=t||{};return(""===e[e.length-1]?[...e,""]:e).join((n.padRight?" ":"")+","+(!1===n.padLeft?"":" ")).trim()}var search=/[#.]/g;function parse2(e){const t=String(e||"").trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function stringify2(e){return e.join(" ").trim()}function createH(e,t,n){const r=n?function(e){const t=new Map;for(const n of e)t.set(n.toLowerCase(),n);return t}(n):void 0;return function(n,s,...a){let i;if(null==n){i={type:"root",children:[]};const e=s;a.unshift(e)}else{i=function(e,t){const n=e||"",r={};let s,a,i=0;for(;i<n.length;){search.lastIndex=i;const e=search.exec(n),t=n.slice(i,e?e.index:n.length);t&&(s?"#"===s?r.id=t:Array.isArray(r.className)?r.className.push(t):r.className=[t]:a=t,i+=t.length),e&&(s=e[0],i++)}return{type:"element",tagName:a||t||"div",properties:r,children:[]}}(n,t);const o=i.tagName.toLowerCase(),l=r?r.get(o):void 0;if(i.tagName=l||o,function(e){if(null===e||"object"!=typeof e||Array.isArray(e))return!0;if("string"!=typeof e.type)return!1;const t=e,n=Object.keys(e);for(const e of n){const n=t[e];if(n&&"object"==typeof n){if(!Array.isArray(n))return!0;const e=n;for(const t of e)if("number"!=typeof t&&"string"!=typeof t)return!0}}return!(!("children"in e)||!Array.isArray(e.children))}(s))a.unshift(s);else for(const[t,n]of Object.entries(s))addProperty(e,i.properties,t,n)}for(const e of a)addChild(i.children,e);return"element"===i.type&&"template"===i.tagName&&(i.content={type:"root",children:i.children},i.children=[]),i}}function addProperty(e,t,n,r){const s=function(e,t){const n=normalize2(t);let r=t,s=Info4;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&"data"===n.slice(0,4)&&valid.test(t)){if("-"===t.charAt(4)){const e=t.slice(5).replace(dash,camelcase);r="data"+e.charAt(0).toUpperCase()+e.slice(1)}else{const e=t.slice(4);if(!dash.test(e)){let n=e.replace(cap,kebab);"-"!==n.charAt(0)&&(n="-"+n),t="data"+n}}s=DefinedInfo}return new s(r,t)}(e,n);let a;if(null!=r){if("number"==typeof r){if(Number.isNaN(r))return;a=r}else a="boolean"==typeof r?r:"string"==typeof r?s.spaceSeparated?parse2(r):s.commaSeparated?parse(r):s.commaOrSpaceSeparated?parse2(parse(r).join(" ")):parsePrimitive(s,s.property,r):Array.isArray(r)?[...r]:"style"===s.property?function(e){const t=[];for(const[n,r]of Object.entries(e))t.push([n,r].join(": "));return t.join("; ")}(r):String(r);if(Array.isArray(a)){const e=[];for(const t of a)e.push(parsePrimitive(s,s.property,t));a=e}"className"===s.property&&Array.isArray(t.className)&&(a=t.className.concat(a)),t[s.property]=a}}function addChild(e,t){if(null==t);else if("number"==typeof t||"string"==typeof t)e.push({type:"text",value:String(t)});else if(Array.isArray(t))for(const n of t)addChild(e,n);else{if("object"!=typeof t||!("type"in t))throw new Error("Expected node, nodes, or string, got `"+t+"`");"root"===t.type?addChild(e,t.children):e.push(t)}}function parsePrimitive(e,t,n){if("string"==typeof n){if(e.number&&n&&!Number.isNaN(Number(n)))return Number(n);if((e.boolean||e.overloadedBoolean)&&(""===n||normalize2(n)===normalize2(t)))return!0}return n}var h=createH(html2,"div"),s=createH(svg2,"g",["altGlyph","altGlyphDef","altGlyphItem","animateColor","animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","glyphRef","linearGradient","radialGradient","solidColor","textArea","textPath"]),Schema2=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};function merge2(e,t){const n={},r={};for(const t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new Schema2(n,r,t)}function normalize3(e){return e.toLowerCase()}Schema2.prototype.normal={},Schema2.prototype.property={},Schema2.prototype.space=void 0;var Info5=class{constructor(e,t){this.attribute=t,this.property=e}};Info5.prototype.attribute="",Info5.prototype.booleanish=!1,Info5.prototype.boolean=!1,Info5.prototype.commaOrSpaceSeparated=!1,Info5.prototype.commaSeparated=!1,Info5.prototype.defined=!1,Info5.prototype.mustUseProperty=!1,Info5.prototype.number=!1,Info5.prototype.overloadedBoolean=!1,Info5.prototype.property="",Info5.prototype.spaceSeparated=!1,Info5.prototype.space=void 0;var types_exports2={};__export(types_exports2,{boolean:()=>boolean2,booleanish:()=>booleanish2,commaOrSpaceSeparated:()=>commaOrSpaceSeparated2,commaSeparated:()=>commaSeparated2,number:()=>number2,overloadedBoolean:()=>overloadedBoolean2,spaceSeparated:()=>spaceSeparated2});var powers2=0,boolean2=increment2(),booleanish2=increment2(),overloadedBoolean2=increment2(),number2=increment2(),spaceSeparated2=increment2(),commaSeparated2=increment2(),commaOrSpaceSeparated2=increment2();function increment2(){return 2**++powers2}var checks2=Object.keys(types_exports2),DefinedInfo2=class extends Info5{constructor(e,t,n,r){let s=-1;if(super(e,t),mark2(this,"space",r),"number"==typeof n)for(;++s<checks2.length;){const e=checks2[s];mark2(this,checks2[s],(n&types_exports2[e])===types_exports2[e])}}};function mark2(e,t,n){n&&(e[t]=n)}function create2(e){const t={},n={};for(const[r,s]of Object.entries(e.properties)){const a=new DefinedInfo2(r,e.transform(e.attributes||{},r),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[normalize3(r)]=r,n[normalize3(a.attribute)]=r}return new Schema2(t,n,e.space)}DefinedInfo2.prototype.defined=!0;var aria2=create2({properties:{ariaActiveDescendant:null,ariaAtomic:booleanish2,ariaAutoComplete:null,ariaBusy:booleanish2,ariaChecked:booleanish2,ariaColCount:number2,ariaColIndex:number2,ariaColSpan:number2,ariaControls:spaceSeparated2,ariaCurrent:null,ariaDescribedBy:spaceSeparated2,ariaDetails:null,ariaDisabled:booleanish2,ariaDropEffect:spaceSeparated2,ariaErrorMessage:null,ariaExpanded:booleanish2,ariaFlowTo:spaceSeparated2,ariaGrabbed:booleanish2,ariaHasPopup:null,ariaHidden:booleanish2,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:spaceSeparated2,ariaLevel:number2,ariaLive:null,ariaModal:booleanish2,ariaMultiLine:booleanish2,ariaMultiSelectable:booleanish2,ariaOrientation:null,ariaOwns:spaceSeparated2,ariaPlaceholder:null,ariaPosInSet:number2,ariaPressed:booleanish2,ariaReadOnly:booleanish2,ariaRelevant:null,ariaRequired:booleanish2,ariaRoleDescription:spaceSeparated2,ariaRowCount:number2,ariaRowIndex:number2,ariaRowSpan:number2,ariaSelected:booleanish2,ariaSetSize:number2,ariaSort:null,ariaValueMax:number2,ariaValueMin:number2,ariaValueNow:number2,ariaValueText:null,role:null},transform:(e,t)=>"role"===t?t:"aria-"+t.slice(4).toLowerCase()});function caseSensitiveTransform2(e,t){return t in e?e[t]:t}function caseInsensitiveTransform2(e,t){return caseSensitiveTransform2(e,t.toLowerCase())}var html3=create2({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:commaSeparated2,acceptCharset:spaceSeparated2,accessKey:spaceSeparated2,action:null,allow:null,allowFullScreen:boolean2,allowPaymentRequest:boolean2,allowUserMedia:boolean2,alt:null,as:null,async:boolean2,autoCapitalize:null,autoComplete:spaceSeparated2,autoFocus:boolean2,autoPlay:boolean2,blocking:spaceSeparated2,capture:null,charSet:null,checked:boolean2,cite:null,className:spaceSeparated2,cols:number2,colSpan:null,content:null,contentEditable:booleanish2,controls:boolean2,controlsList:spaceSeparated2,coords:number2|commaSeparated2,crossOrigin:null,data:null,dateTime:null,decoding:null,default:boolean2,defer:boolean2,dir:null,dirName:null,disabled:boolean2,download:overloadedBoolean2,draggable:booleanish2,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:boolean2,formTarget:null,headers:spaceSeparated2,height:number2,hidden:overloadedBoolean2,high:number2,href:null,hrefLang:null,htmlFor:spaceSeparated2,httpEquiv:spaceSeparated2,id:null,imageSizes:null,imageSrcSet:null,inert:boolean2,inputMode:null,integrity:null,is:null,isMap:boolean2,itemId:null,itemProp:spaceSeparated2,itemRef:spaceSeparated2,itemScope:boolean2,itemType:spaceSeparated2,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:boolean2,low:number2,manifest:null,max:null,maxLength:number2,media:null,method:null,min:null,minLength:number2,multiple:boolean2,muted:boolean2,name:null,nonce:null,noModule:boolean2,noValidate:boolean2,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:boolean2,optimum:number2,pattern:null,ping:spaceSeparated2,placeholder:null,playsInline:boolean2,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:boolean2,referrerPolicy:null,rel:spaceSeparated2,required:boolean2,reversed:boolean2,rows:number2,rowSpan:number2,sandbox:spaceSeparated2,scope:null,scoped:boolean2,seamless:boolean2,selected:boolean2,shadowRootClonable:boolean2,shadowRootDelegatesFocus:boolean2,shadowRootMode:null,shape:null,size:number2,sizes:null,slot:null,span:number2,spellCheck:booleanish2,src:null,srcDoc:null,srcLang:null,srcSet:null,start:number2,step:null,style:null,tabIndex:number2,target:null,title:null,translate:null,type:null,typeMustMatch:boolean2,useMap:null,value:booleanish2,width:number2,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:spaceSeparated2,axis:null,background:null,bgColor:null,border:number2,borderColor:null,bottomMargin:number2,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:boolean2,declare:boolean2,event:null,face:null,frame:null,frameBorder:null,hSpace:number2,leftMargin:number2,link:null,longDesc:null,lowSrc:null,marginHeight:number2,marginWidth:number2,noResize:boolean2,noHref:boolean2,noShade:boolean2,noWrap:boolean2,object:null,profile:null,prompt:null,rev:null,rightMargin:number2,rules:null,scheme:null,scrolling:booleanish2,standby:null,summary:null,text:null,topMargin:number2,valueType:null,version:null,vAlign:null,vLink:null,vSpace:number2,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:boolean2,disableRemotePlayback:boolean2,prefix:null,property:null,results:number2,security:null,unselectable:null},space:"html",transform:caseInsensitiveTransform2}),svg3=create2({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:commaOrSpaceSeparated2,accentHeight:number2,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:number2,amplitude:number2,arabicForm:null,ascent:number2,attributeName:null,attributeType:null,azimuth:number2,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:number2,by:null,calcMode:null,capHeight:number2,className:spaceSeparated2,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:number2,diffuseConstant:number2,direction:null,display:null,dur:null,divisor:number2,dominantBaseline:null,download:boolean2,dx:null,dy:null,edgeMode:null,editable:null,elevation:number2,enableBackground:null,end:null,event:null,exponent:number2,externalResourcesRequired:null,fill:null,fillOpacity:number2,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:commaSeparated2,g2:commaSeparated2,glyphName:commaSeparated2,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:number2,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:number2,horizOriginX:number2,horizOriginY:number2,id:null,ideographic:number2,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:number2,k:number2,k1:number2,k2:number2,k3:number2,k4:number2,kernelMatrix:commaOrSpaceSeparated2,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:number2,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:number2,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:number2,overlineThickness:number2,paintOrder:null,panose1:null,path:null,pathLength:number2,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:spaceSeparated2,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:number2,pointsAtY:number2,pointsAtZ:number2,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:commaOrSpaceSeparated2,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:commaOrSpaceSeparated2,rev:commaOrSpaceSeparated2,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:commaOrSpaceSeparated2,requiredFeatures:commaOrSpaceSeparated2,requiredFonts:commaOrSpaceSeparated2,requiredFormats:commaOrSpaceSeparated2,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:number2,specularExponent:number2,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:number2,strikethroughThickness:number2,string:null,stroke:null,strokeDashArray:commaOrSpaceSeparated2,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:number2,strokeOpacity:number2,strokeWidth:null,style:null,surfaceScale:number2,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:commaOrSpaceSeparated2,tabIndex:number2,tableValues:null,target:null,targetX:number2,targetY:number2,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:commaOrSpaceSeparated2,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:number2,underlineThickness:number2,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:number2,values:null,vAlphabetic:number2,vMathematical:number2,vectorEffect:null,vHanging:number2,vIdeographic:number2,version:null,vertAdvY:number2,vertOriginX:number2,vertOriginY:number2,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:number2,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:caseSensitiveTransform2}),xlink2=create2({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform:(e,t)=>"xlink:"+t.slice(5).toLowerCase()}),xmlns2=create2({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:caseInsensitiveTransform2}),xml2=create2({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform:(e,t)=>"xml:"+t.slice(3).toLowerCase()}),cap2=/[A-Z]/g,dash2=/-[a-z]/g,valid2=/^data[-\w.:]+$/i;function find2(e,t){const n=normalize3(t);let r=t,s=Info5;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&"data"===n.slice(0,4)&&valid2.test(t)){if("-"===t.charAt(4)){const e=t.slice(5).replace(dash2,camelcase2);r="data"+e.charAt(0).toUpperCase()+e.slice(1)}else{const e=t.slice(4);if(!dash2.test(e)){let n=e.replace(cap2,kebab2);"-"!==n.charAt(0)&&(n="-"+n),t="data"+n}}s=DefinedInfo2}return new s(r,t)}function kebab2(e){return"-"+e.toLowerCase()}function camelcase2(e){return e.charAt(1).toUpperCase()}var html4=merge2([aria2,html3,xlink2,xmlns2,xml2],"html"),svg4=merge2([aria2,svg3,xlink2,xmlns2,xml2],"svg");function next(e,t){const n=e.indexOf("\r",t),r=e.indexOf("\n",t);return-1===r?n:-1===n||n+1===r?r:n<r?n:r}var own2={}.hasOwnProperty,proto=Object.prototype;function one(e,t){let n;switch(t.nodeName){case"#comment":{const r=t;return n={type:"comment",value:r.data},patch(e,r,n),n}case"#document":case"#document-fragment":{const r=t,s="mode"in r&&("quirks"===r.mode||"limited-quirks"===r.mode);if(n={type:"root",children:all(e,t.childNodes),data:{quirksMode:s}},e.file&&e.location){const t=String(e.file),r=function(e){const t=String(e),n=[];return{toOffset:function(e){if(e&&"number"==typeof e.line&&"number"==typeof e.column&&!Number.isNaN(e.line)&&!Number.isNaN(e.column)){for(;n.length<e.line;){const e=n[n.length-1],r=next(t,e),s=-1===r?t.length+1:r+1;if(e===s)break;n.push(s)}const r=(e.line>1?n[e.line-2]:0)+e.column-1;if(r<n[e.line-1])return r}},toPoint:function(e){if("number"==typeof e&&e>-1&&e<=t.length){let r=0;for(;;){let s=n[r];if(void 0===s){const e=next(t,n[r-1]);s=-1===e?t.length+1:e+1,n[r]=s}if(s>e)return{line:r+1,column:e-(r>0?n[r-1]:0)+1,offset:e};r++}}}}}(t),s=r.toPoint(0),a=r.toPoint(t.length);n.position={start:s,end:a}}return n}case"#documentType":return n={type:"doctype"},patch(e,t,n),n;case"#text":{const r=t;return n={type:"text",value:r.value},patch(e,r,n),n}default:return n=function(e,t){const n=e.schema;e.schema="http://www.w3.org/2000/svg"===t.namespaceURI?svg4:html4;let r=-1;const a={};for(;++r<t.attrs.length;){const e=t.attrs[r],n=(e.prefix?e.prefix+":":"")+e.name;own2.call(proto,n)||(a[n]=e.value)}const i=("svg"===e.schema.space?s:h)(t.tagName,a,all(e,t.childNodes));if(patch(e,t,i),"template"===i.tagName){const n=t,r=n.sourceCodeLocation,s=r&&r.startTag&&position2(r.startTag),a=r&&r.endTag&&position2(r.endTag),o=one(e,n.content);s&&a&&e.file&&(o.position={start:s.end,end:a.start}),i.content=o}return e.schema=n,i}(e,t),n}}function all(e,t){let n=-1;const r=[];for(;++n<t.length;){const s=one(e,t[n]);r.push(s)}return r}function patch(e,t,n){if("sourceCodeLocation"in t&&t.sourceCodeLocation&&e.file){const r=function(e,t,n){const r=position2(n);if("element"===t.type){const s=t.children[t.children.length-1];if(r&&!n.endTag&&s&&s.position&&s.position.end&&(r.end=Object.assign({},s.position.end)),e.verbose){const r={};let s;if(n.attrs)for(s in n.attrs)own2.call(n.attrs,s)&&(r[find2(e.schema,s).property]=position2(n.attrs[s]));n.startTag;const a=position2(n.startTag),i=n.endTag?position2(n.endTag):void 0,o={opening:a};i&&(o.closing=i),o.properties=r,t.data={position:o}}}return r}(e,n,t.sourceCodeLocation);r&&(e.location=!0,n.position=r)}}function position2(e){const t=point2({line:e.startLine,column:e.startCol,offset:e.startOffset}),n=point2({line:e.endLine,column:e.endCol,offset:e.endOffset});return t||n?{start:t,end:n}:void 0}function point2(e){return e.line&&e.column?e:void 0}var CODE_POINTS,CODE_POINTS2,UNDEFINED_CODE_POINTS=new Set([65534,65535,131070,131071,196606,196607,262142,262143,327678,327679,393214,393215,458750,458751,524286,524287,589822,589823,655358,655359,720894,720895,786430,786431,851966,851967,917502,917503,983038,983039,1048574,1048575,1114110,1114111]);(CODE_POINTS2=CODE_POINTS||(CODE_POINTS={}))[CODE_POINTS2.EOF=-1]="EOF",CODE_POINTS2[CODE_POINTS2.NULL=0]="NULL",CODE_POINTS2[CODE_POINTS2.TABULATION=9]="TABULATION",CODE_POINTS2[CODE_POINTS2.CARRIAGE_RETURN=13]="CARRIAGE_RETURN",CODE_POINTS2[CODE_POINTS2.LINE_FEED=10]="LINE_FEED",CODE_POINTS2[CODE_POINTS2.FORM_FEED=12]="FORM_FEED",CODE_POINTS2[CODE_POINTS2.SPACE=32]="SPACE",CODE_POINTS2[CODE_POINTS2.EXCLAMATION_MARK=33]="EXCLAMATION_MARK",CODE_POINTS2[CODE_POINTS2.QUOTATION_MARK=34]="QUOTATION_MARK",CODE_POINTS2[CODE_POINTS2.AMPERSAND=38]="AMPERSAND",CODE_POINTS2[CODE_POINTS2.APOSTROPHE=39]="APOSTROPHE",CODE_POINTS2[CODE_POINTS2.HYPHEN_MINUS=45]="HYPHEN_MINUS",CODE_POINTS2[CODE_POINTS2.SOLIDUS=47]="SOLIDUS",CODE_POINTS2[CODE_POINTS2.DIGIT_0=48]="DIGIT_0",CODE_POINTS2[CODE_POINTS2.DIGIT_9=57]="DIGIT_9",CODE_POINTS2[CODE_POINTS2.SEMICOLON=59]="SEMICOLON",CODE_POINTS2[CODE_POINTS2.LESS_THAN_SIGN=60]="LESS_THAN_SIGN",CODE_POINTS2[CODE_POINTS2.EQUALS_SIGN=61]="EQUALS_SIGN",CODE_POINTS2[CODE_POINTS2.GREATER_THAN_SIGN=62]="GREATER_THAN_SIGN",CODE_POINTS2[CODE_POINTS2.QUESTION_MARK=63]="QUESTION_MARK",CODE_POINTS2[CODE_POINTS2.LATIN_CAPITAL_A=65]="LATIN_CAPITAL_A",CODE_POINTS2[CODE_POINTS2.LATIN_CAPITAL_Z=90]="LATIN_CAPITAL_Z",CODE_POINTS2[CODE_POINTS2.RIGHT_SQUARE_BRACKET=93]="RIGHT_SQUARE_BRACKET",CODE_POINTS2[CODE_POINTS2.GRAVE_ACCENT=96]="GRAVE_ACCENT",CODE_POINTS2[CODE_POINTS2.LATIN_SMALL_A=97]="LATIN_SMALL_A",CODE_POINTS2[CODE_POINTS2.LATIN_SMALL_Z=122]="LATIN_SMALL_Z";var ERR,ERR2;function isSurrogate(e){return e>=55296&&e<=57343}function isControlCodePoint(e){return 32!==e&&10!==e&&13!==e&&9!==e&&12!==e&&e>=1&&e<=31||e>=127&&e<=159}function isUndefinedCodePoint(e){return e>=64976&&e<=65007||UNDEFINED_CODE_POINTS.has(e)}(ERR2=ERR||(ERR={})).controlCharacterInInputStream="control-character-in-input-stream",ERR2.noncharacterInInputStream="noncharacter-in-input-stream",ERR2.surrogateInInputStream="surrogate-in-input-stream",ERR2.nonVoidHtmlElementStartTagWithTrailingSolidus="non-void-html-element-start-tag-with-trailing-solidus",ERR2.endTagWithAttributes="end-tag-with-attributes",ERR2.endTagWithTrailingSolidus="end-tag-with-trailing-solidus",ERR2.unexpectedSolidusInTag="unexpected-solidus-in-tag",ERR2.unexpectedNullCharacter="unexpected-null-character",ERR2.unexpectedQuestionMarkInsteadOfTagName="unexpected-question-mark-instead-of-tag-name",ERR2.invalidFirstCharacterOfTagName="invalid-first-character-of-tag-name",ERR2.unexpectedEqualsSignBeforeAttributeName="unexpected-equals-sign-before-attribute-name",ERR2.missingEndTagName="missing-end-tag-name",ERR2.unexpectedCharacterInAttributeName="unexpected-character-in-attribute-name",ERR2.unknownNamedCharacterReference="unknown-named-character-reference",ERR2.missingSemicolonAfterCharacterReference="missing-semicolon-after-character-reference",ERR2.unexpectedCharacterAfterDoctypeSystemIdentifier="unexpected-character-after-doctype-system-identifier",ERR2.unexpectedCharacterInUnquotedAttributeValue="unexpected-character-in-unquoted-attribute-value",ERR2.eofBeforeTagName="eof-before-tag-name",ERR2.eofInTag="eof-in-tag",ERR2.missingAttributeValue="missing-attribute-value",ERR2.missingWhitespaceBetweenAttributes="missing-whitespace-between-attributes",ERR2.missingWhitespaceAfterDoctypePublicKeyword="missing-whitespace-after-doctype-public-keyword",ERR2.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers="missing-whitespace-between-doctype-public-and-system-identifiers",ERR2.missingWhitespaceAfterDoctypeSystemKeyword="missing-whitespace-after-doctype-system-keyword",ERR2.missingQuoteBeforeDoctypePublicIdentifier="missing-quote-before-doctype-public-identifier",ERR2.missingQuoteBeforeDoctypeSystemIdentifier="missing-quote-before-doctype-system-identifier",ERR2.missingDoctypePublicIdentifier="missing-doctype-public-identifier",ERR2.missingDoctypeSystemIdentifier="missing-doctype-system-identifier",ERR2.abruptDoctypePublicIdentifier="abrupt-doctype-public-identifier",ERR2.abruptDoctypeSystemIdentifier="abrupt-doctype-system-identifier",ERR2.cdataInHtmlContent="cdata-in-html-content",ERR2.incorrectlyOpenedComment="incorrectly-opened-comment",ERR2.eofInScriptHtmlCommentLikeText="eof-in-script-html-comment-like-text",ERR2.eofInDoctype="eof-in-doctype",ERR2.nestedComment="nested-comment",ERR2.abruptClosingOfEmptyComment="abrupt-closing-of-empty-comment",ERR2.eofInComment="eof-in-comment",ERR2.incorrectlyClosedComment="incorrectly-closed-comment",ERR2.eofInCdata="eof-in-cdata",ERR2.absenceOfDigitsInNumericCharacterReference="absence-of-digits-in-numeric-character-reference",ERR2.nullCharacterReference="null-character-reference",ERR2.surrogateCharacterReference="surrogate-character-reference",ERR2.characterReferenceOutsideUnicodeRange="character-reference-outside-unicode-range",ERR2.controlCharacterReference="control-character-reference",ERR2.noncharacterCharacterReference="noncharacter-character-reference",ERR2.missingWhitespaceBeforeDoctypeName="missing-whitespace-before-doctype-name",ERR2.missingDoctypeName="missing-doctype-name",ERR2.invalidCharacterSequenceAfterDoctypeName="invalid-character-sequence-after-doctype-name",ERR2.duplicateAttribute="duplicate-attribute",ERR2.nonConformingDoctype="non-conforming-doctype",ERR2.missingDoctype="missing-doctype",ERR2.misplacedDoctype="misplaced-doctype",ERR2.endTagWithoutMatchingOpenElement="end-tag-without-matching-open-element",ERR2.closingOfElementWithOpenChildElements="closing-of-element-with-open-child-elements",ERR2.disallowedContentInNoscriptInHead="disallowed-content-in-noscript-in-head",ERR2.openElementsLeftAfterEof="open-elements-left-after-eof",ERR2.abandonedHeadElementChild="abandoned-head-element-child",ERR2.misplacedStartTagForHeadElement="misplaced-start-tag-for-head-element",ERR2.nestedNoscriptInHead="nested-noscript-in-head",ERR2.eofInElementThatCanContainOnlyText="eof-in-element-that-can-contain-only-text";var TokenType,TokenType2,Preprocessor=class{constructor(e){this.handler=e,this.html="",this.pos=-1,this.lastGapPos=-2,this.gapStack=[],this.skipNextNewLine=!1,this.lastChunkWritten=!1,this.endOfChunkHit=!1,this.bufferWaterline=65536,this.isEol=!1,this.lineStartPos=0,this.droppedBufferSize=0,this.line=1,this.lastErrOffset=-1}get col(){return this.pos-this.lineStartPos+Number(this.lastGapPos!==this.pos)}get offset(){return this.droppedBufferSize+this.pos}getError(e,t){const{line:n,col:r,offset:s}=this,a=r+t,i=s+t;return{code:e,startLine:n,endLine:n,startCol:a,endCol:a,startOffset:i,endOffset:i}}_err(e){this.handler.onParseError&&this.lastErrOffset!==this.offset&&(this.lastErrOffset=this.offset,this.handler.onParseError(this.getError(e,0)))}_addGap(){this.gapStack.push(this.lastGapPos),this.lastGapPos=this.pos}_processSurrogate(e){if(this.pos!==this.html.length-1){const t=this.html.charCodeAt(this.pos+1);if(function(e){return e>=56320&&e<=57343}(t))return this.pos++,this._addGap(),1024*(e-55296)+9216+t}else if(!this.lastChunkWritten)return this.endOfChunkHit=!0,CODE_POINTS.EOF;return this._err(ERR.surrogateInInputStream),e}willDropParsedChunk(){return this.pos>this.bufferWaterline}dropParsedChunk(){this.willDropParsedChunk()&&(this.html=this.html.substring(this.pos),this.lineStartPos-=this.pos,this.droppedBufferSize+=this.pos,this.pos=0,this.lastGapPos=-2,this.gapStack.length=0)}write(e,t){this.html.length>0?this.html+=e:this.html=e,this.endOfChunkHit=!1,this.lastChunkWritten=t}insertHtmlAtCurrentPos(e){this.html=this.html.substring(0,this.pos+1)+e+this.html.substring(this.pos+1),this.endOfChunkHit=!1}startsWith(e,t){if(this.pos+e.length>this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,!1;if(t)return this.html.startsWith(e,this.pos);for(let t=0;t<e.length;t++)if((32|this.html.charCodeAt(this.pos+t))!==e.charCodeAt(t))return!1;return!0}peek(e){const t=this.pos+e;if(t>=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,CODE_POINTS.EOF;const n=this.html.charCodeAt(t);return n===CODE_POINTS.CARRIAGE_RETURN?CODE_POINTS.LINE_FEED:n}advance(){if(this.pos++,this.isEol&&(this.isEol=!1,this.line++,this.lineStartPos=this.pos),this.pos>=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,CODE_POINTS.EOF;let e=this.html.charCodeAt(this.pos);return e===CODE_POINTS.CARRIAGE_RETURN?(this.isEol=!0,this.skipNextNewLine=!0,CODE_POINTS.LINE_FEED):e===CODE_POINTS.LINE_FEED&&(this.isEol=!0,this.skipNextNewLine)?(this.line--,this.skipNextNewLine=!1,this._addGap(),this.advance()):(this.skipNextNewLine=!1,isSurrogate(e)&&(e=this._processSurrogate(e)),null===this.handler.onParseError||e>31&&e<127||e===CODE_POINTS.LINE_FEED||e===CODE_POINTS.CARRIAGE_RETURN||e>159&&e<64976||this._checkForProblematicCharacters(e),e)}_checkForProblematicCharacters(e){isControlCodePoint(e)?this._err(ERR.controlCharacterInInputStream):isUndefinedCodePoint(e)&&this._err(ERR.noncharacterInInputStream)}retreat(e){for(this.pos-=e;this.pos<this.lastGapPos;)this.lastGapPos=this.gapStack.pop(),this.pos--;this.isEol=!1}};function getTokenAttr(e,t){for(let n=e.attrs.length-1;n>=0;n--)if(e.attrs[n].name===t)return e.attrs[n].value;return null}(TokenType2=TokenType||(TokenType={}))[TokenType2.CHARACTER=0]="CHARACTER",TokenType2[TokenType2.NULL_CHARACTER=1]="NULL_CHARACTER",TokenType2[TokenType2.WHITESPACE_CHARACTER=2]="WHITESPACE_CHARACTER",TokenType2[TokenType2.START_TAG=3]="START_TAG",TokenType2[TokenType2.END_TAG=4]="END_TAG",TokenType2[TokenType2.COMMENT=5]="COMMENT",TokenType2[TokenType2.DOCTYPE=6]="DOCTYPE",TokenType2[TokenType2.EOF=7]="EOF",TokenType2[TokenType2.HIBERNATION=8]="HIBERNATION";var CharCodes,CharCodes2,BinTrieFlags,BinTrieFlags2,EntityDecoderState,EntityDecoderState2,DecodingMode,DecodingMode2,htmlDecodeTree=new Uint16Array('ᵁ<Õıʊҝջאٵ۞ޢߖࠏ੊ઑඡ๭༉༦჊ረዡᐕᒝᓃᓟᔥ\0\0\0\0\0\0ᕫᛍᦍᰒᷝ὾⁠↰⊍⏀⏻⑂⠤⤒ⴈ⹈⿎〖㊺㘹㞬㣾㨨㩱㫠㬮ࠀEMabcfglmnoprstu\\bfms„‹•˜¦³¹ÈÏlig耻Æ䃆P耻&䀦cute耻Á䃁reve;䄂Āiyx}rc耻Â䃂;䐐r;쀀𝔄rave耻À䃀pha;䎑acr;䄀d;橓Āgp¡on;䄄f;쀀𝔸plyFunction;恡ing耻Å䃅Ācs¾Ãr;쀀𝒜ign;扔ilde耻Ã䃃ml耻Ä䃄ЀaceforsuåûþėĜĢħĪĀcrêòkslash;或Ŷöø;櫧ed;挆y;䐑ƀcrtąċĔause;戵noullis;愬a;䎒r;쀀𝔅pf;쀀𝔹eve;䋘còēmpeq;扎܀HOacdefhilorsuōőŖƀƞƢƵƷƺǜȕɳɸɾcy;䐧PY耻©䂩ƀcpyŝŢźute;䄆Ā;iŧŨ拒talDifferentialD;慅leys;愭ȀaeioƉƎƔƘron;䄌dil耻Ç䃇rc;䄈nint;戰ot;䄊ĀdnƧƭilla;䂸terDot;䂷òſi;䎧rcleȀDMPTLJNjǑǖot;抙inus;抖lus;投imes;抗oĀcsǢǸkwiseContourIntegral;戲eCurlyĀDQȃȏoubleQuote;思uote;怙ȀlnpuȞȨɇɕonĀ;eȥȦ户;橴ƀgitȯȶȺruent;扡nt;戯ourIntegral;戮ĀfrɌɎ;愂oduct;成nterClockwiseContourIntegral;戳oss;樯cr;쀀𝒞pĀ;Cʄʅ拓ap;才րDJSZacefiosʠʬʰʴʸˋ˗ˡ˦̳ҍĀ;oŹʥtrahd;椑cy;䐂cy;䐅cy;䐏ƀgrsʿ˄ˇger;怡r;憡hv;櫤Āayː˕ron;䄎;䐔lĀ;t˝˞戇a;䎔r;쀀𝔇Āaf˫̧Ācm˰̢riticalȀADGT̖̜̀̆cute;䂴oŴ̋̍;䋙bleAcute;䋝rave;䁠ilde;䋜ond;拄ferentialD;慆Ѱ̽\0\0\0͔͂\0Ѕf;쀀𝔻ƀ;DE͈͉͍䂨ot;惜qual;扐blèCDLRUVͣͲ΂ϏϢϸontourIntegraìȹoɴ͹\0\0ͻ»͉nArrow;懓Āeo·ΤftƀARTΐΖΡrrow;懐ightArrow;懔eåˊngĀLRΫτeftĀARγιrrow;柸ightArrow;柺ightArrow;柹ightĀATϘϞrrow;懒ee;抨pɁϩ\0\0ϯrrow;懑ownArrow;懕erticalBar;戥ǹABLRTaВЪаўѿͼrrowƀ;BUНОТ憓ar;椓pArrow;懵reve;䌑eft˒к\0ц\0ѐightVector;楐eeVector;楞ectorĀ;Bљњ憽ar;楖ightǔѧ\0ѱeeVector;楟ectorĀ;BѺѻ懁ar;楗eeĀ;A҆҇护rrow;憧ĀctҒҗr;쀀𝒟rok;䄐ࠀNTacdfglmopqstuxҽӀӄӋӞӢӧӮӵԡԯԶՒ՝ՠեG;䅊H耻Ð䃐cute耻É䃉ƀaiyӒӗӜron;䄚rc耻Ê䃊;䐭ot;䄖r;쀀𝔈rave耻È䃈ement;戈ĀapӺӾcr;䄒tyɓԆ\0\0ԒmallSquare;旻erySmallSquare;斫ĀgpԦԪon;䄘f;쀀𝔼silon;䎕uĀaiԼՉlĀ;TՂՃ橵ilde;扂librium;懌Āci՗՚r;愰m;橳a;䎗ml耻Ë䃋Āipժկsts;戃onentialE;慇ʀcfiosօֈ֍ֲ׌y;䐤r;쀀𝔉lledɓ֗\0\0֣mallSquare;旼erySmallSquare;斪Ͱֺ\0ֿ\0\0ׄf;쀀𝔽All;戀riertrf;愱cò׋؀JTabcdfgorstר׬ׯ׺؀ؒؖ؛؝أ٬ٲcy;䐃耻>䀾mmaĀ;d׷׸䎓;䏜reve;䄞ƀeiy؇،ؐdil;䄢rc;䄜;䐓ot;䄠r;쀀𝔊;拙pf;쀀𝔾eater̀EFGLSTصلَٖٛ٦qualĀ;Lؾؿ扥ess;招ullEqual;执reater;檢ess;扷lantEqual;橾ilde;扳cr;쀀𝒢;扫ЀAacfiosuڅڋږڛڞڪھۊRDcy;䐪Āctڐڔek;䋇;䁞irc;䄤r;愌lbertSpace;愋ǰگ\0ڲf;愍izontalLine;攀Āctۃۅòکrok;䄦mpńېۘownHumðįqual;扏܀EJOacdfgmnostuۺ۾܃܇܎ܚܞܡܨ݄ݸދޏޕcy;䐕lig;䄲cy;䐁cute耻Í䃍Āiyܓܘrc耻Î䃎;䐘ot;䄰r;愑rave耻Ì䃌ƀ;apܠܯܿĀcgܴܷr;䄪inaryI;慈lieóϝǴ݉\0ݢĀ;eݍݎ戬Āgrݓݘral;戫section;拂isibleĀCTݬݲomma;恣imes;恢ƀgptݿރވon;䄮f;쀀𝕀a;䎙cr;愐ilde;䄨ǫޚ\0ޞcy;䐆l耻Ï䃏ʀcfosuެ޷޼߂ߐĀiyޱ޵rc;䄴;䐙r;쀀𝔍pf;쀀𝕁ǣ߇\0ߌr;쀀𝒥rcy;䐈kcy;䐄΀HJacfosߤߨ߽߬߱ࠂࠈcy;䐥cy;䐌ppa;䎚Āey߶߻dil;䄶;䐚r;쀀𝔎pf;쀀𝕂cr;쀀𝒦րJTaceflmostࠥࠩࠬࡐࡣ঳সে্਷ੇcy;䐉耻<䀼ʀcmnpr࠷࠼ࡁࡄࡍute;䄹bda;䎛g;柪lacetrf;愒r;憞ƀaeyࡗ࡜ࡡron;䄽dil;䄻;䐛Āfsࡨ॰tԀACDFRTUVarࡾࢩࢱࣦ࣠ࣼयज़ΐ४Ānrࢃ࢏gleBracket;柨rowƀ;BR࢙࢚࢞憐ar;懤ightArrow;懆eiling;挈oǵࢷ\0ࣃbleBracket;柦nǔࣈ\0࣒eeVector;楡ectorĀ;Bࣛࣜ懃ar;楙loor;挊ightĀAV࣯ࣵrrow;憔ector;楎Āerँगeƀ;AVउऊऐ抣rrow;憤ector;楚iangleƀ;BEतथऩ抲ar;槏qual;抴pƀDTVषूौownVector;楑eeVector;楠ectorĀ;Bॖॗ憿ar;楘ectorĀ;B॥०憼ar;楒ightáΜs̀EFGLSTॾঋকঝঢভqualGreater;拚ullEqual;扦reater;扶ess;檡lantEqual;橽ilde;扲r;쀀𝔏Ā;eঽা拘ftarrow;懚idot;䄿ƀnpw৔ਖਛgȀLRlr৞৷ਂਐeftĀAR০৬rrow;柵ightArrow;柷ightArrow;柶eftĀarγਊightáοightáϊf;쀀𝕃erĀLRਢਬeftArrow;憙ightArrow;憘ƀchtਾੀੂòࡌ;憰rok;䅁;扪Ѐacefiosuਗ਼੝੠੷੼અઋ઎p;椅y;䐜Ādl੥੯iumSpace;恟lintrf;愳r;쀀𝔐nusPlus;戓pf;쀀𝕄cò੶;䎜ҀJacefostuણધભીଔଙඑ඗ඞcy;䐊cute;䅃ƀaey઴હાron;䅇dil;䅅;䐝ƀgswે૰଎ativeƀMTV૓૟૨ediumSpace;怋hiĀcn૦૘ë૙eryThiî૙tedĀGL૸ଆreaterGreateòٳessLesóੈLine;䀊r;쀀𝔑ȀBnptଢନଷ଺reak;恠BreakingSpace;䂠f;愕ڀ;CDEGHLNPRSTV୕ୖ୪୼஡௫ఄ౞಄ದ೘ൡඅ櫬Āou୛୤ngruent;扢pCap;扭oubleVerticalBar;戦ƀlqxஃஊ஛ement;戉ualĀ;Tஒஓ扠ilde;쀀≂̸ists;戄reater΀;EFGLSTஶஷ஽௉௓௘௥扯qual;扱ullEqual;쀀≧̸reater;쀀≫̸ess;批lantEqual;쀀⩾̸ilde;扵umpń௲௽ownHump;쀀≎̸qual;쀀≏̸eĀfsఊధtTriangleƀ;BEచఛడ拪ar;쀀⧏̸qual;括s̀;EGLSTవశ఼ౄోౘ扮qual;扰reater;扸ess;쀀≪̸lantEqual;쀀⩽̸ilde;扴estedĀGL౨౹reaterGreater;쀀⪢̸essLess;쀀⪡̸recedesƀ;ESಒಓಛ技qual;쀀⪯̸lantEqual;拠ĀeiಫಹverseElement;戌ghtTriangleƀ;BEೋೌ೒拫ar;쀀⧐̸qual;拭ĀquೝഌuareSuĀbp೨೹setĀ;E೰ೳ쀀⊏̸qual;拢ersetĀ;Eഃആ쀀⊐̸qual;拣ƀbcpഓതൎsetĀ;Eഛഞ쀀⊂⃒qual;抈ceedsȀ;ESTലള഻െ抁qual;쀀⪰̸lantEqual;拡ilde;쀀≿̸ersetĀ;E൘൛쀀⊃⃒qual;抉ildeȀ;EFT൮൯൵ൿ扁qual;扄ullEqual;扇ilde;扉erticalBar;戤cr;쀀𝒩ilde耻Ñ䃑;䎝܀Eacdfgmoprstuvලෂ෉෕ෛ෠෧෼ขภยา฿ไlig;䅒cute耻Ó䃓Āiy෎ීrc耻Ô䃔;䐞blac;䅐r;쀀𝔒rave耻Ò䃒ƀaei෮ෲ෶cr;䅌ga;䎩cron;䎟pf;쀀𝕆enCurlyĀDQฎบoubleQuote;怜uote;怘;橔Āclวฬr;쀀𝒪ash耻Ø䃘iŬื฼de耻Õ䃕es;樷ml耻Ö䃖erĀBP๋๠Āar๐๓r;怾acĀek๚๜;揞et;掴arenthesis;揜Ҁacfhilors๿ງຊຏຒດຝະ໼rtialD;戂y;䐟r;쀀𝔓i;䎦;䎠usMinus;䂱Āipຢອncareplanåڝf;愙Ȁ;eio຺ູ໠໤檻cedesȀ;EST່້໏໚扺qual;檯lantEqual;扼ilde;找me;怳Ādp໩໮uct;戏ortionĀ;aȥ໹l;戝Āci༁༆r;쀀𝒫;䎨ȀUfos༑༖༛༟OT耻"䀢r;쀀𝔔pf;愚cr;쀀𝒬؀BEacefhiorsu༾གྷཇའཱིྦྷྪྭ႖ႩႴႾarr;椐G耻®䂮ƀcnrཎནབute;䅔g;柫rĀ;tཛྷཝ憠l;椖ƀaeyཧཬཱron;䅘dil;䅖;䐠Ā;vླྀཹ愜erseĀEUྂྙĀlq྇ྎement;戋uilibrium;懋pEquilibrium;楯r»ཹo;䎡ghtЀACDFTUVa࿁࿫࿳ဢဨၛႇϘĀnr࿆࿒gleBracket;柩rowƀ;BL࿜࿝࿡憒ar;懥eftArrow;懄eiling;按oǵ࿹\0စbleBracket;柧nǔည\0နeeVector;楝ectorĀ;Bဝသ懂ar;楕loor;挋Āerိ၃eƀ;AVဵံြ抢rrow;憦ector;楛iangleƀ;BEၐၑၕ抳ar;槐qual;抵pƀDTVၣၮၸownVector;楏eeVector;楜ectorĀ;Bႂႃ憾ar;楔ectorĀ;B႑႒懀ar;楓Āpuႛ႞f;愝ndImplies;楰ightarrow;懛ĀchႹႼr;愛;憱leDelayed;槴ڀHOacfhimoqstuფჱჷჽᄙᄞᅑᅖᅡᅧᆵᆻᆿĀCcჩხHcy;䐩y;䐨FTcy;䐬cute;䅚ʀ;aeiyᄈᄉᄎᄓᄗ檼ron;䅠dil;䅞rc;䅜;䐡r;쀀𝔖ortȀDLRUᄪᄴᄾᅉownArrow»ОeftArrow»࢚ightArrow»࿝pArrow;憑gma;䎣allCircle;战pf;쀀𝕊ɲᅭ\0\0ᅰt;戚areȀ;ISUᅻᅼᆉᆯ斡ntersection;抓uĀbpᆏᆞsetĀ;Eᆗᆘ抏qual;抑ersetĀ;Eᆨᆩ抐qual;抒nion;抔cr;쀀𝒮ar;拆ȀbcmpᇈᇛሉላĀ;sᇍᇎ拐etĀ;Eᇍᇕqual;抆ĀchᇠህeedsȀ;ESTᇭᇮᇴᇿ扻qual;檰lantEqual;扽ilde;承Tháྌ;我ƀ;esሒሓሣ拑rsetĀ;Eሜም抃qual;抇et»ሓրHRSacfhiorsሾቄ቉ቕ቞ቱቶኟዂወዑORN耻Þ䃞ADE;愢ĀHc቎ቒcy;䐋y;䐦Ābuቚቜ;䀉;䎤ƀaeyብቪቯron;䅤dil;䅢;䐢r;쀀𝔗Āeiቻ኉Dzኀ\0ኇefore;戴a;䎘Ācn኎ኘkSpace;쀀  Space;怉ldeȀ;EFTካኬኲኼ戼qual;扃ullEqual;扅ilde;扈pf;쀀𝕋ipleDot;惛Āctዖዛr;쀀𝒯rok;䅦ૡዷጎጚጦ\0ጬጱ\0\0\0\0\0ጸጽ፷ᎅ\0᏿ᐄᐊᐐĀcrዻጁute耻Ú䃚rĀ;oጇገ憟cir;楉rǣጓ\0጖y;䐎ve;䅬Āiyጞጣrc耻Û䃛;䐣blac;䅰r;쀀𝔘rave耻Ù䃙acr;䅪Ādiፁ፩erĀBPፈ፝Āarፍፐr;䁟acĀekፗፙ;揟et;掵arenthesis;揝onĀ;P፰፱拃lus;抎Āgp፻፿on;䅲f;쀀𝕌ЀADETadps᎕ᎮᎸᏄϨᏒᏗᏳrrowƀ;BDᅐᎠᎤar;椒ownArrow;懅ownArrow;憕quilibrium;楮eeĀ;AᏋᏌ报rrow;憥ownáϳerĀLRᏞᏨeftArrow;憖ightArrow;憗iĀ;lᏹᏺ䏒on;䎥ing;䅮cr;쀀𝒰ilde;䅨ml耻Ü䃜ҀDbcdefosvᐧᐬᐰᐳᐾᒅᒊᒐᒖash;披ar;櫫y;䐒ashĀ;lᐻᐼ抩;櫦Āerᑃᑅ;拁ƀbtyᑌᑐᑺar;怖Ā;iᑏᑕcalȀBLSTᑡᑥᑪᑴar;戣ine;䁼eparator;杘ilde;所ThinSpace;怊r;쀀𝔙pf;쀀𝕍cr;쀀𝒱dash;抪ʀcefosᒧᒬᒱᒶᒼirc;䅴dge;拀r;쀀𝔚pf;쀀𝕎cr;쀀𝒲Ȁfiosᓋᓐᓒᓘr;쀀𝔛;䎞pf;쀀𝕏cr;쀀𝒳ҀAIUacfosuᓱᓵᓹᓽᔄᔏᔔᔚᔠcy;䐯cy;䐇cy;䐮cute耻Ý䃝Āiyᔉᔍrc;䅶;䐫r;쀀𝔜pf;쀀𝕐cr;쀀𝒴ml;䅸ЀHacdefosᔵᔹᔿᕋᕏᕝᕠᕤcy;䐖cute;䅹Āayᕄᕉron;䅽;䐗ot;䅻Dzᕔ\0ᕛoWidtè૙a;䎖r;愨pf;愤cr;쀀𝒵௡ᖃᖊᖐ\0ᖰᖶᖿ\0\0\0\0ᗆᗛᗫᙟ᙭\0ᚕ᚛ᚲᚹ\0ᚾcute耻á䃡reve;䄃̀;Ediuyᖜᖝᖡᖣᖨᖭ戾;쀀∾̳;房rc耻â䃢te肻´̆;䐰lig耻æ䃦Ā;r²ᖺ;쀀𝔞rave耻à䃠ĀepᗊᗖĀfpᗏᗔsym;愵èᗓha;䎱ĀapᗟcĀclᗤᗧr;䄁g;樿ɤᗰ\0\0ᘊʀ;adsvᗺᗻᗿᘁᘇ戧nd;橕;橜lope;橘;橚΀;elmrszᘘᘙᘛᘞᘿᙏᙙ戠;榤e»ᘙsdĀ;aᘥᘦ戡ѡᘰᘲᘴᘶᘸᘺᘼᘾ;榨;榩;榪;榫;榬;榭;榮;榯tĀ;vᙅᙆ戟bĀ;dᙌᙍ抾;榝Āptᙔᙗh;戢»¹arr;捼Āgpᙣᙧon;䄅f;쀀𝕒΀;Eaeiop዁ᙻᙽᚂᚄᚇᚊ;橰cir;橯;扊d;手s;䀧roxĀ;e዁ᚒñᚃing耻å䃥ƀctyᚡᚦᚨr;쀀𝒶;䀪mpĀ;e዁ᚯñʈilde耻ã䃣ml耻ä䃤Āciᛂᛈoninôɲnt;樑ࠀNabcdefiklnoprsu᛭ᛱᜰ᜼ᝃᝈ᝸᝽០៦ᠹᡐᜍ᤽᥈ᥰot;櫭Ācrᛶ᜞kȀcepsᜀᜅᜍᜓong;扌psilon;䏶rime;怵imĀ;e᜚᜛戽q;拍Ŷᜢᜦee;抽edĀ;gᜬᜭ挅e»ᜭrkĀ;t፜᜷brk;掶Āoyᜁᝁ;䐱quo;怞ʀcmprtᝓ᝛ᝡᝤᝨausĀ;eĊĉptyv;榰séᜌnoõēƀahwᝯ᝱ᝳ;䎲;愶een;扬r;쀀𝔟g΀costuvwឍឝឳេ៕៛៞ƀaiuបពរðݠrc;旯p»፱ƀdptឤឨឭot;樀lus;樁imes;樂ɱឹ\0\0ើcup;樆ar;昅riangleĀdu៍្own;施p;斳plus;樄eåᑄåᒭarow;植ƀako៭ᠦᠵĀcn៲ᠣkƀlst៺֫᠂ozenge;槫riangleȀ;dlr᠒᠓᠘᠝斴own;斾eft;旂ight;斸k;搣Ʊᠫ\0ᠳƲᠯ\0ᠱ;斒;斑4;斓ck;斈ĀeoᠾᡍĀ;qᡃᡆ쀀=⃥uiv;쀀≡⃥t;挐Ȁptwxᡙᡞᡧᡬf;쀀𝕓Ā;tᏋᡣom»Ꮜtie;拈؀DHUVbdhmptuvᢅᢖᢪᢻᣗᣛᣬ᣿ᤅᤊᤐᤡȀLRlrᢎᢐᢒᢔ;敗;敔;敖;敓ʀ;DUduᢡᢢᢤᢦᢨ敐;敦;敩;敤;敧ȀLRlrᢳᢵᢷᢹ;敝;敚;敜;教΀;HLRhlrᣊᣋᣍᣏᣑᣓᣕ救;敬;散;敠;敫;敢;敟ox;槉ȀLRlrᣤᣦᣨᣪ;敕;敒;攐;攌ʀ;DUduڽ᣷᣹᣻᣽;敥;敨;攬;攴inus;抟lus;択imes;抠ȀLRlrᤙᤛᤝ᤟;敛;敘;攘;攔΀;HLRhlrᤰᤱᤳᤵᤷ᤻᤹攂;敪;敡;敞;攼;攤;攜Āevģ᥂bar耻¦䂦Ȁceioᥑᥖᥚᥠr;쀀𝒷mi;恏mĀ;e᜚᜜lƀ;bhᥨᥩᥫ䁜;槅sub;柈Ŭᥴ᥾lĀ;e᥹᥺怢t»᥺pƀ;Eeįᦅᦇ;檮Ā;qۜۛೡᦧ\0᧨ᨑᨕᨲ\0ᨷᩐ\0\0᪴\0\0᫁\0\0ᬡᬮ᭍᭒\0᯽\0ᰌƀcpr᦭ᦲ᧝ute;䄇̀;abcdsᦿᧀᧄ᧊᧕᧙戩nd;橄rcup;橉Āau᧏᧒p;橋p;橇ot;橀;쀀∩︀Āeo᧢᧥t;恁îړȀaeiu᧰᧻ᨁᨅǰ᧵\0᧸s;橍on;䄍dil耻ç䃧rc;䄉psĀ;sᨌᨍ橌m;橐ot;䄋ƀdmnᨛᨠᨦil肻¸ƭptyv;榲t脀¢;eᨭᨮ䂢räƲr;쀀𝔠ƀceiᨽᩀᩍy;䑇ckĀ;mᩇᩈ朓ark»ᩈ;䏇r΀;Ecefms᩟᩠ᩢᩫ᪤᪪᪮旋;槃ƀ;elᩩᩪᩭ䋆q;扗eɡᩴ\0\0᪈rrowĀlr᩼᪁eft;憺ight;憻ʀRSacd᪒᪔᪖᪚᪟»ཇ;擈st;抛irc;抚ash;抝nint;樐id;櫯cir;槂ubsĀ;u᪻᪼晣it»᪼ˬ᫇᫔᫺\0ᬊonĀ;eᫍᫎ䀺Ā;qÇÆɭ᫙\0\0᫢aĀ;t᫞᫟䀬;䁀ƀ;fl᫨᫩᫫戁îᅠeĀmx᫱᫶ent»᫩eóɍǧ᫾\0ᬇĀ;dኻᬂot;橭nôɆƀfryᬐᬔᬗ;쀀𝕔oäɔ脀©;sŕᬝr;愗Āaoᬥᬩrr;憵ss;朗Ācuᬲᬷr;쀀𝒸Ābpᬼ᭄Ā;eᭁᭂ櫏;櫑Ā;eᭉᭊ櫐;櫒dot;拯΀delprvw᭠᭬᭷ᮂᮬᯔ᯹arrĀlr᭨᭪;椸;椵ɰ᭲\0\0᭵r;拞c;拟arrĀ;p᭿ᮀ憶;椽̀;bcdosᮏᮐᮖᮡᮥᮨ截rcap;橈Āauᮛᮞp;橆p;橊ot;抍r;橅;쀀∪︀Ȁalrv᮵ᮿᯞᯣrrĀ;mᮼᮽ憷;椼yƀevwᯇᯔᯘqɰᯎ\0\0ᯒreã᭳uã᭵ee;拎edge;拏en耻¤䂤earrowĀlrᯮ᯳eft»ᮀight»ᮽeäᯝĀciᰁᰇoninôǷnt;戱lcty;挭ঀAHabcdefhijlorstuwz᰸᰻᰿ᱝᱩᱵᲊᲞᲬᲷ᳻᳿ᴍᵻᶑᶫᶻ᷆᷍rò΁ar;楥Ȁglrs᱈ᱍ᱒᱔ger;怠eth;愸òᄳhĀ;vᱚᱛ怐»ऊūᱡᱧarow;椏aã̕Āayᱮᱳron;䄏;䐴ƀ;ao̲ᱼᲄĀgrʿᲁr;懊tseq;橷ƀglmᲑᲔᲘ耻°䂰ta;䎴ptyv;榱ĀirᲣᲨsht;楿;쀀𝔡arĀlrᲳᲵ»ࣜ»သʀaegsv᳂͸᳖᳜᳠mƀ;oș᳊᳔ndĀ;ș᳑uit;晦amma;䏝in;拲ƀ;io᳧᳨᳸䃷de脀÷;o᳧ᳰntimes;拇nø᳷cy;䑒cɯᴆ\0\0ᴊrn;挞op;挍ʀlptuwᴘᴝᴢᵉᵕlar;䀤f;쀀𝕕ʀ;emps̋ᴭᴷᴽᵂqĀ;d͒ᴳot;扑inus;戸lus;戔quare;抡blebarwedgåúnƀadhᄮᵝᵧownarrowóᲃarpoonĀlrᵲᵶefôᲴighôᲶŢᵿᶅkaro÷གɯᶊ\0\0ᶎrn;挟op;挌ƀcotᶘᶣᶦĀryᶝᶡ;쀀𝒹;䑕l;槶rok;䄑Ādrᶰᶴot;拱iĀ;fᶺ᠖斿Āah᷀᷃ròЩaòྦangle;榦Āci᷒ᷕy;䑟grarr;柿ऀDacdefglmnopqrstuxḁḉḙḸոḼṉṡṾấắẽỡἪἷὄ὎὚ĀDoḆᴴoôᲉĀcsḎḔute耻é䃩ter;橮ȀaioyḢḧḱḶron;䄛rĀ;cḭḮ扖耻ê䃪lon;払;䑍ot;䄗ĀDrṁṅot;扒;쀀𝔢ƀ;rsṐṑṗ檚ave耻è䃨Ā;dṜṝ檖ot;檘Ȁ;ilsṪṫṲṴ檙nters;揧;愓Ā;dṹṺ檕ot;檗ƀapsẅẉẗcr;䄓tyƀ;svẒẓẕ戅et»ẓpĀ1;ẝẤijạả;怄;怅怃ĀgsẪẬ;䅋p;怂ĀgpẴẸon;䄙f;쀀𝕖ƀalsỄỎỒrĀ;sỊị拕l;槣us;橱iƀ;lvỚớở䎵on»ớ;䏵ȀcsuvỪỳἋἣĀioữḱrc»Ḯɩỹ\0\0ỻíՈantĀglἂἆtr»ṝess»Ṻƀaeiἒ἖Ἒls;䀽st;扟vĀ;DȵἠD;橸parsl;槥ĀDaἯἳot;打rr;楱ƀcdiἾὁỸr;愯oô͒ĀahὉὋ;䎷耻ð䃰Āmrὓὗl耻ë䃫o;悬ƀcipὡὤὧl;䀡sôծĀeoὬὴctatioîՙnentialåչৡᾒ\0ᾞ\0ᾡᾧ\0\0ῆῌ\0ΐ\0ῦῪ \0 ⁚llingdotseñṄy;䑄male;晀ƀilrᾭᾳ῁lig;耀ffiɩᾹ\0\0᾽g;耀ffig;耀ffl;쀀𝔣lig;耀filig;쀀fjƀaltῙ῜ῡt;晭ig;耀flns;斱of;䆒ǰ΅\0ῳf;쀀𝕗ĀakֿῷĀ;vῼ´拔;櫙artint;樍Āao‌⁕Ācs‑⁒ႉ‸⁅⁈\0⁐β•‥‧‪‬\0‮耻½䂽;慓耻¼䂼;慕;慙;慛Ƴ‴\0‶;慔;慖ʴ‾⁁\0\0⁃耻¾䂾;慗;慜5;慘ƶ⁌\0⁎;慚;慝8;慞l;恄wn;挢cr;쀀𝒻ࢀEabcdefgijlnorstv₂₉₟₥₰₴⃰⃵⃺⃿℃ℒℸ̗ℾ⅒↞Ā;lٍ₇;檌ƀcmpₐₕ₝ute;䇵maĀ;dₜ᳚䎳;檆reve;䄟Āiy₪₮rc;䄝;䐳ot;䄡Ȁ;lqsؾق₽⃉ƀ;qsؾٌ⃄lanô٥Ȁ;cdl٥⃒⃥⃕c;檩otĀ;o⃜⃝檀Ā;l⃢⃣檂;檄Ā;e⃪⃭쀀⋛︀s;檔r;쀀𝔤Ā;gٳ؛mel;愷cy;䑓Ȁ;Eajٚℌℎℐ;檒;檥;檤ȀEaesℛℝ℩ℴ;扩pĀ;p℣ℤ檊rox»ℤĀ;q℮ℯ檈Ā;q℮ℛim;拧pf;쀀𝕘Āci⅃ⅆr;愊mƀ;el٫ⅎ⅐;檎;檐茀>;cdlqr׮ⅠⅪⅮⅳⅹĀciⅥⅧ;檧r;橺ot;拗Par;榕uest;橼ʀadelsↄⅪ←ٖ↛ǰ↉\0↎proø₞r;楸qĀlqؿ↖lesó₈ií٫Āen↣↭rtneqq;쀀≩︀Å↪ԀAabcefkosy⇄⇇⇱⇵⇺∘∝∯≨≽ròΠȀilmr⇐⇔⇗⇛rsðᒄf»․ilôکĀdr⇠⇤cy;䑊ƀ;cwࣴ⇫⇯ir;楈;憭ar;意irc;䄥ƀalr∁∎∓rtsĀ;u∉∊晥it»∊lip;怦con;抹r;쀀𝔥sĀew∣∩arow;椥arow;椦ʀamopr∺∾≃≞≣rr;懿tht;戻kĀlr≉≓eftarrow;憩ightarrow;憪f;쀀𝕙bar;怕ƀclt≯≴≸r;쀀𝒽asè⇴rok;䄧Ābp⊂⊇ull;恃hen»ᱛૡ⊣\0⊪\0⊸⋅⋎\0⋕⋳\0\0⋸⌢⍧⍢⍿\0⎆⎪⎴cute耻í䃭ƀ;iyݱ⊰⊵rc耻î䃮;䐸Ācx⊼⊿y;䐵cl耻¡䂡ĀfrΟ⋉;쀀𝔦rave耻ì䃬Ȁ;inoܾ⋝⋩⋮Āin⋢⋦nt;樌t;戭fin;槜ta;愩lig;䄳ƀaop⋾⌚⌝ƀcgt⌅⌈⌗r;䄫ƀelpܟ⌏⌓inåގarôܠh;䄱f;抷ed;䆵ʀ;cfotӴ⌬⌱⌽⍁are;愅inĀ;t⌸⌹戞ie;槝doô⌙ʀ;celpݗ⍌⍐⍛⍡al;抺Āgr⍕⍙eróᕣã⍍arhk;樗rod;樼Ȁcgpt⍯⍲⍶⍻y;䑑on;䄯f;쀀𝕚a;䎹uest耻¿䂿Āci⎊⎏r;쀀𝒾nʀ;EdsvӴ⎛⎝⎡ӳ;拹ot;拵Ā;v⎦⎧拴;拳Ā;iݷ⎮lde;䄩ǫ⎸\0⎼cy;䑖l耻ï䃯̀cfmosu⏌⏗⏜⏡⏧⏵Āiy⏑⏕rc;䄵;䐹r;쀀𝔧ath;䈷pf;쀀𝕛ǣ⏬\0⏱r;쀀𝒿rcy;䑘kcy;䑔Ѐacfghjos␋␖␢␧␭␱␵␻ppaĀ;v␓␔䎺;䏰Āey␛␠dil;䄷;䐺r;쀀𝔨reen;䄸cy;䑅cy;䑜pf;쀀𝕜cr;쀀𝓀஀ABEHabcdefghjlmnoprstuv⑰⒁⒆⒍⒑┎┽╚▀♎♞♥♹♽⚚⚲⛘❝❨➋⟀⠁⠒ƀart⑷⑺⑼rò৆òΕail;椛arr;椎Ā;gঔ⒋;檋ar;楢ॣ⒥\0⒪\0⒱\0\0\0\0\0⒵Ⓔ\0ⓆⓈⓍ\0⓹ute;䄺mptyv;榴raîࡌbda;䎻gƀ;dlࢎⓁⓃ;榑åࢎ;檅uo耻«䂫rЀ;bfhlpst࢙ⓞⓦⓩ⓫⓮⓱⓵Ā;f࢝ⓣs;椟s;椝ë≒p;憫l;椹im;楳l;憢ƀ;ae⓿─┄檫il;椙Ā;s┉┊檭;쀀⪭︀ƀabr┕┙┝rr;椌rk;杲Āak┢┬cĀek┨┪;䁻;䁛Āes┱┳;榋lĀdu┹┻;榏;榍Ȁaeuy╆╋╖╘ron;䄾Ādi═╔il;䄼ìࢰâ┩;䐻Ȁcqrs╣╦╭╽a;椶uoĀ;rนᝆĀdu╲╷har;楧shar;楋h;憲ʀ;fgqs▋▌উ◳◿扤tʀahlrt▘▤▷◂◨rrowĀ;t࢙□aé⓶arpoonĀdu▯▴own»њp»०eftarrows;懇ightƀahs◍◖◞rrowĀ;sࣴࢧarpoonó྘quigarro÷⇰hreetimes;拋ƀ;qs▋ও◺lanôবʀ;cdgsব☊☍☝☨c;檨otĀ;o☔☕橿Ā;r☚☛檁;檃Ā;e☢☥쀀⋚︀s;檓ʀadegs☳☹☽♉♋pproøⓆot;拖qĀgq♃♅ôউgtò⒌ôছiíলƀilr♕࣡♚sht;楼;쀀𝔩Ā;Eজ♣;檑š♩♶rĀdu▲♮Ā;l॥♳;楪lk;斄cy;䑙ʀ;achtੈ⚈⚋⚑⚖rò◁orneòᴈard;楫ri;旺Āio⚟⚤dot;䅀ustĀ;a⚬⚭掰che»⚭ȀEaes⚻⚽⛉⛔;扨pĀ;p⛃⛄檉rox»⛄Ā;q⛎⛏檇Ā;q⛎⚻im;拦Ѐabnoptwz⛩⛴⛷✚✯❁❇❐Ānr⛮⛱g;柬r;懽rëࣁgƀlmr⛿✍✔eftĀar০✇ightá৲apsto;柼ightá৽parrowĀlr✥✩efô⓭ight;憬ƀafl✶✹✽r;榅;쀀𝕝us;樭imes;樴š❋❏st;戗áፎƀ;ef❗❘᠀旊nge»❘arĀ;l❤❥䀨t;榓ʀachmt❳❶❼➅➇ròࢨorneòᶌarĀ;d྘➃;業;怎ri;抿̀achiqt➘➝ੀ➢➮➻quo;怹r;쀀𝓁mƀ;egল➪➬;檍;檏Ābu┪➳oĀ;rฟ➹;怚rok;䅂萀<;cdhilqrࠫ⟒☹⟜⟠⟥⟪⟰Āci⟗⟙;檦r;橹reå◲mes;拉arr;楶uest;橻ĀPi⟵⟹ar;榖ƀ;ef⠀भ᠛旃rĀdu⠇⠍shar;楊har;楦Āen⠗⠡rtneqq;쀀≨︀Å⠞܀Dacdefhilnopsu⡀⡅⢂⢎⢓⢠⢥⢨⣚⣢⣤ઃ⣳⤂Dot;戺Ȁclpr⡎⡒⡣⡽r耻¯䂯Āet⡗⡙;時Ā;e⡞⡟朠se»⡟Ā;sျ⡨toȀ;dluျ⡳⡷⡻owîҌefôएðᏑker;斮Āoy⢇⢌mma;権;䐼ash;怔asuredangle»ᘦr;쀀𝔪o;愧ƀcdn⢯⢴⣉ro耻µ䂵Ȁ;acdᑤ⢽⣀⣄sôᚧir;櫰ot肻·Ƶusƀ;bd⣒ᤃ⣓戒Ā;uᴼ⣘;横ţ⣞⣡p;櫛ò−ðઁĀdp⣩⣮els;抧f;쀀𝕞Āct⣸⣽r;쀀𝓂pos»ᖝƀ;lm⤉⤊⤍䎼timap;抸ఀGLRVabcdefghijlmoprstuvw⥂⥓⥾⦉⦘⧚⧩⨕⨚⩘⩝⪃⪕⪤⪨⬄⬇⭄⭿⮮ⰴⱧⱼ⳩Āgt⥇⥋;쀀⋙̸Ā;v⥐௏쀀≫⃒ƀelt⥚⥲⥶ftĀar⥡⥧rrow;懍ightarrow;懎;쀀⋘̸Ā;v⥻ే쀀≪⃒ightarrow;懏ĀDd⦎⦓ash;抯ash;抮ʀbcnpt⦣⦧⦬⦱⧌la»˞ute;䅄g;쀀∠⃒ʀ;Eiop඄⦼⧀⧅⧈;쀀⩰̸d;쀀≋̸s;䅉roø඄urĀ;a⧓⧔普lĀ;s⧓ସdz⧟\0⧣p肻 ଷmpĀ;e௹ఀʀaeouy⧴⧾⨃⨐⨓ǰ⧹\0⧻;橃on;䅈dil;䅆ngĀ;dൾ⨊ot;쀀⩭̸p;橂;䐽ash;怓΀;Aadqsxஒ⨩⨭⨻⩁⩅⩐rr;懗rĀhr⨳⨶k;椤Ā;oᏲᏰot;쀀≐̸uiöୣĀei⩊⩎ar;椨í஘istĀ;s஠டr;쀀𝔫ȀEest௅⩦⩹⩼ƀ;qs஼⩭௡ƀ;qs஼௅⩴lanô௢ií௪Ā;rஶ⪁»ஷƀAap⪊⪍⪑rò⥱rr;憮ar;櫲ƀ;svྍ⪜ྌĀ;d⪡⪢拼;拺cy;䑚΀AEadest⪷⪺⪾⫂⫅⫶⫹rò⥦;쀀≦̸rr;憚r;急Ȁ;fqs఻⫎⫣⫯tĀar⫔⫙rro÷⫁ightarro÷⪐ƀ;qs఻⪺⫪lanôౕĀ;sౕ⫴»శiíౝĀ;rవ⫾iĀ;eచథiäඐĀpt⬌⬑f;쀀𝕟膀¬;in⬙⬚⬶䂬nȀ;Edvஉ⬤⬨⬮;쀀⋹̸ot;쀀⋵̸ǡஉ⬳⬵;拷;拶iĀ;vಸ⬼ǡಸ⭁⭃;拾;拽ƀaor⭋⭣⭩rȀ;ast୻⭕⭚⭟lleì୻l;쀀⫽⃥;쀀∂̸lint;樔ƀ;ceಒ⭰⭳uåಥĀ;cಘ⭸Ā;eಒ⭽ñಘȀAait⮈⮋⮝⮧rò⦈rrƀ;cw⮔⮕⮙憛;쀀⤳̸;쀀↝̸ghtarrow»⮕riĀ;eೋೖ΀chimpqu⮽⯍⯙⬄୸⯤⯯Ȁ;cerല⯆ഷ⯉uå൅;쀀𝓃ortɭ⬅\0\0⯖ará⭖mĀ;e൮⯟Ā;q൴൳suĀbp⯫⯭å೸åഋƀbcp⯶ⰑⰙȀ;Ees⯿ⰀഢⰄ抄;쀀⫅̸etĀ;eഛⰋqĀ;qണⰀcĀ;eലⰗñസȀ;EesⰢⰣൟⰧ抅;쀀⫆̸etĀ;e൘ⰮqĀ;qൠⰣȀgilrⰽⰿⱅⱇìௗlde耻ñ䃱çృiangleĀlrⱒⱜeftĀ;eచⱚñదightĀ;eೋⱥñ೗Ā;mⱬⱭ䎽ƀ;esⱴⱵⱹ䀣ro;愖p;怇ҀDHadgilrsⲏⲔⲙⲞⲣⲰⲶⳓⳣash;抭arr;椄p;쀀≍⃒ash;抬ĀetⲨⲬ;쀀≥⃒;쀀>⃒nfin;槞ƀAetⲽⳁⳅrr;椂;쀀≤⃒Ā;rⳊⳍ쀀<⃒ie;쀀⊴⃒ĀAtⳘⳜrr;椃rie;쀀⊵⃒im;쀀∼⃒ƀAan⳰⳴ⴂrr;懖rĀhr⳺⳽k;椣Ā;oᏧᏥear;椧ቓ᪕\0\0\0\0\0\0\0\0\0\0\0\0\0ⴭ\0ⴸⵈⵠⵥ⵲ⶄᬇ\0\0ⶍⶫ\0ⷈⷎ\0ⷜ⸙⸫⸾⹃Ācsⴱ᪗ute耻ó䃳ĀiyⴼⵅrĀ;c᪞ⵂ耻ô䃴;䐾ʀabios᪠ⵒⵗLjⵚlac;䅑v;樸old;榼lig;䅓Ācr⵩⵭ir;榿;쀀𝔬ͯ⵹\0\0⵼\0ⶂn;䋛ave耻ò䃲;槁Ābmⶈ෴ar;榵Ȁacitⶕ⶘ⶥⶨrò᪀Āir⶝ⶠr;榾oss;榻nå๒;槀ƀaeiⶱⶵⶹcr;䅍ga;䏉ƀcdnⷀⷅǍron;䎿;榶pf;쀀𝕠ƀaelⷔ⷗ǒr;榷rp;榹΀;adiosvⷪⷫⷮ⸈⸍⸐⸖戨rò᪆Ȁ;efmⷷⷸ⸂⸅橝rĀ;oⷾⷿ愴f»ⷿ耻ª䂪耻º䂺gof;抶r;橖lope;橗;橛ƀclo⸟⸡⸧ò⸁ash耻ø䃸l;折iŬⸯ⸴de耻õ䃵esĀ;aǛ⸺s;樶ml耻ö䃶bar;挽ૡ⹞\0⹽\0⺀⺝\0⺢⺹\0\0⻋ຜ\0⼓\0\0⼫⾼\0⿈rȀ;astЃ⹧⹲຅脀¶;l⹭⹮䂶leìЃɩ⹸\0\0⹻m;櫳;櫽y;䐿rʀcimpt⺋⺏⺓ᡥ⺗nt;䀥od;䀮il;怰enk;怱r;쀀𝔭ƀimo⺨⺰⺴Ā;v⺭⺮䏆;䏕maô੶ne;明ƀ;tv⺿⻀⻈䏀chfork»´;䏖Āau⻏⻟nĀck⻕⻝kĀ;h⇴⻛;愎ö⇴sҀ;abcdemst⻳⻴ᤈ⻹⻽⼄⼆⼊⼎䀫cir;樣ir;樢Āouᵀ⼂;樥;橲n肻±ຝim;樦wo;樧ƀipu⼙⼠⼥ntint;樕f;쀀𝕡nd耻£䂣Ԁ;Eaceinosu່⼿⽁⽄⽇⾁⾉⾒⽾⾶;檳p;檷uå໙Ā;c໎⽌̀;acens່⽙⽟⽦⽨⽾pproø⽃urlyeñ໙ñ໎ƀaes⽯⽶⽺pprox;檹qq;檵im;拨iíໟmeĀ;s⾈ຮ怲ƀEas⽸⾐⽺ð⽵ƀdfp໬⾙⾯ƀals⾠⾥⾪lar;挮ine;挒urf;挓Ā;t໻⾴ï໻rel;抰Āci⿀⿅r;쀀𝓅;䏈ncsp;怈̀fiopsu⿚⋢⿟⿥⿫⿱r;쀀𝔮pf;쀀𝕢rime;恗cr;쀀𝓆ƀaeo⿸〉〓tĀei⿾々rnionóڰnt;樖stĀ;e【】䀿ñἙô༔઀ABHabcdefhilmnoprstux぀けさすムㄎㄫㅇㅢㅲㆎ㈆㈕㈤㈩㉘㉮㉲㊐㊰㊷ƀartぇおがròႳòϝail;検aròᱥar;楤΀cdenqrtとふへみわゔヌĀeuねぱ;쀀∽̱te;䅕iãᅮmptyv;榳gȀ;del࿑らるろ;榒;榥å࿑uo耻»䂻rր;abcfhlpstw࿜ガクシスゼゾダッデナp;極Ā;f࿠ゴs;椠;椳s;椞ë≝ð✮l;楅im;楴l;憣;憝Āaiパフil;椚oĀ;nホボ戶aló༞ƀabrョリヮrò៥rk;杳ĀakンヽcĀekヹ・;䁽;䁝Āes㄂㄄;榌lĀduㄊㄌ;榎;榐Ȁaeuyㄗㄜㄧㄩron;䅙Ādiㄡㄥil;䅗ì࿲âヺ;䑀Ȁclqsㄴㄷㄽㅄa;椷dhar;楩uoĀ;rȎȍh;憳ƀacgㅎㅟངlȀ;ipsླྀㅘㅛႜnåႻarôྩt;断ƀilrㅩဣㅮsht;楽;쀀𝔯ĀaoㅷㆆrĀduㅽㅿ»ѻĀ;l႑ㆄ;楬Ā;vㆋㆌ䏁;䏱ƀgns㆕ㇹㇼht̀ahlrstㆤㆰ㇂㇘㇤㇮rrowĀ;t࿜ㆭaéトarpoonĀduㆻㆿowîㅾp»႒eftĀah㇊㇐rrowó࿪arpoonóՑightarrows;應quigarro÷ニhreetimes;拌g;䋚ingdotseñἲƀahm㈍㈐㈓rò࿪aòՑ;怏oustĀ;a㈞㈟掱che»㈟mid;櫮Ȁabpt㈲㈽㉀㉒Ānr㈷㈺g;柭r;懾rëဃƀafl㉇㉊㉎r;榆;쀀𝕣us;樮imes;樵Āap㉝㉧rĀ;g㉣㉤䀩t;榔olint;樒arò㇣Ȁachq㉻㊀Ⴜ㊅quo;怺r;쀀𝓇Ābu・㊊oĀ;rȔȓƀhir㊗㊛㊠reåㇸmes;拊iȀ;efl㊪ၙᠡ㊫方tri;槎luhar;楨;愞ൡ㋕㋛㋟㌬㌸㍱\0㍺㎤\0\0㏬㏰\0㐨㑈㑚㒭㒱㓊㓱\0㘖\0\0㘳cute;䅛quï➺Ԁ;Eaceinpsyᇭ㋳㋵㋿㌂㌋㌏㌟㌦㌩;檴ǰ㋺\0㋼;檸on;䅡uåᇾĀ;dᇳ㌇il;䅟rc;䅝ƀEas㌖㌘㌛;檶p;檺im;择olint;樓iíሄ;䑁otƀ;be㌴ᵇ㌵担;橦΀Aacmstx㍆㍊㍗㍛㍞㍣㍭rr;懘rĀhr㍐㍒ë∨Ā;oਸ਼਴t耻§䂧i;䀻war;椩mĀin㍩ðnuóñt;朶rĀ;o㍶⁕쀀𝔰Ȁacoy㎂㎆㎑㎠rp;景Āhy㎋㎏cy;䑉;䑈rtɭ㎙\0\0㎜iäᑤaraì⹯耻­䂭Āgm㎨㎴maƀ;fv㎱㎲㎲䏃;䏂Ѐ;deglnprካ㏅㏉㏎㏖㏞㏡㏦ot;橪Ā;q኱ኰĀ;E㏓㏔檞;檠Ā;E㏛㏜檝;檟e;扆lus;樤arr;楲aròᄽȀaeit㏸㐈㐏㐗Āls㏽㐄lsetmé㍪hp;樳parsl;槤Ādlᑣ㐔e;挣Ā;e㐜㐝檪Ā;s㐢㐣檬;쀀⪬︀ƀflp㐮㐳㑂tcy;䑌Ā;b㐸㐹䀯Ā;a㐾㐿槄r;挿f;쀀𝕤aĀdr㑍ЂesĀ;u㑔㑕晠it»㑕ƀcsu㑠㑹㒟Āau㑥㑯pĀ;sᆈ㑫;쀀⊓︀pĀ;sᆴ㑵;쀀⊔︀uĀbp㑿㒏ƀ;esᆗᆜ㒆etĀ;eᆗ㒍ñᆝƀ;esᆨᆭ㒖etĀ;eᆨ㒝ñᆮƀ;afᅻ㒦ְrť㒫ֱ»ᅼaròᅈȀcemt㒹㒾㓂㓅r;쀀𝓈tmîñiì㐕aræᆾĀar㓎㓕rĀ;f㓔ឿ昆Āan㓚㓭ightĀep㓣㓪psiloîỠhé⺯s»⡒ʀbcmnp㓻㕞ሉ㖋㖎Ҁ;Edemnprs㔎㔏㔑㔕㔞㔣㔬㔱㔶抂;櫅ot;檽Ā;dᇚ㔚ot;櫃ult;櫁ĀEe㔨㔪;櫋;把lus;檿arr;楹ƀeiu㔽㕒㕕tƀ;en㔎㕅㕋qĀ;qᇚ㔏eqĀ;q㔫㔨m;櫇Ābp㕚㕜;櫕;櫓c̀;acensᇭ㕬㕲㕹㕻㌦pproø㋺urlyeñᇾñᇳƀaes㖂㖈㌛pproø㌚qñ㌗g;晪ڀ123;Edehlmnps㖩㖬㖯ሜ㖲㖴㗀㗉㗕㗚㗟㗨㗭耻¹䂹耻²䂲耻³䂳;櫆Āos㖹㖼t;檾ub;櫘Ā;dሢ㗅ot;櫄sĀou㗏㗒l;柉b;櫗arr;楻ult;櫂ĀEe㗤㗦;櫌;抋lus;櫀ƀeiu㗴㘉㘌tƀ;enሜ㗼㘂qĀ;qሢ㖲eqĀ;q㗧㗤m;櫈Ābp㘑㘓;櫔;櫖ƀAan㘜㘠㘭rr;懙rĀhr㘦㘨ë∮Ā;oਫ਩war;椪lig耻ß䃟௡㙑㙝㙠ዎ㙳㙹\0㙾㛂\0\0\0\0\0㛛㜃\0㜉㝬\0\0\0㞇ɲ㙖\0\0㙛get;挖;䏄rë๟ƀaey㙦㙫㙰ron;䅥dil;䅣;䑂lrec;挕r;쀀𝔱Ȁeiko㚆㚝㚵㚼Dz㚋\0㚑eĀ4fኄኁaƀ;sv㚘㚙㚛䎸ym;䏑Ācn㚢㚲kĀas㚨㚮pproø዁im»ኬsðኞĀas㚺㚮ð዁rn耻þ䃾Ǭ̟㛆⋧es膀×;bd㛏㛐㛘䃗Ā;aᤏ㛕r;樱;樰ƀeps㛡㛣㜀á⩍Ȁ;bcf҆㛬㛰㛴ot;挶ir;櫱Ā;o㛹㛼쀀𝕥rk;櫚á㍢rime;怴ƀaip㜏㜒㝤dåቈ΀adempst㜡㝍㝀㝑㝗㝜㝟ngleʀ;dlqr㜰㜱㜶㝀㝂斵own»ᶻeftĀ;e⠀㜾ñम;扜ightĀ;e㊪㝋ñၚot;旬inus;樺lus;樹b;槍ime;樻ezium;揢ƀcht㝲㝽㞁Āry㝷㝻;쀀𝓉;䑆cy;䑛rok;䅧Āio㞋㞎xô᝷headĀlr㞗㞠eftarro÷ࡏightarrow»ཝऀAHabcdfghlmoprstuw㟐㟓㟗㟤㟰㟼㠎㠜㠣㠴㡑㡝㡫㢩㣌㣒㣪㣶ròϭar;楣Ācr㟜㟢ute耻ú䃺òᅐrǣ㟪\0㟭y;䑞ve;䅭Āiy㟵㟺rc耻û䃻;䑃ƀabh㠃㠆㠋ròᎭlac;䅱aòᏃĀir㠓㠘sht;楾;쀀𝔲rave耻ù䃹š㠧㠱rĀlr㠬㠮»ॗ»ႃlk;斀Āct㠹㡍ɯ㠿\0\0㡊rnĀ;e㡅㡆挜r»㡆op;挏ri;旸Āal㡖㡚cr;䅫肻¨͉Āgp㡢㡦on;䅳f;쀀𝕦̀adhlsuᅋ㡸㡽፲㢑㢠ownáᎳarpoonĀlr㢈㢌efô㠭ighô㠯iƀ;hl㢙㢚㢜䏅»ᏺon»㢚parrows;懈ƀcit㢰㣄㣈ɯ㢶\0\0㣁rnĀ;e㢼㢽挝r»㢽op;挎ng;䅯ri;旹cr;쀀𝓊ƀdir㣙㣝㣢ot;拰lde;䅩iĀ;f㜰㣨»᠓Āam㣯㣲rò㢨l耻ü䃼angle;榧ހABDacdeflnoprsz㤜㤟㤩㤭㦵㦸㦽㧟㧤㧨㧳㧹㧽㨁㨠ròϷarĀ;v㤦㤧櫨;櫩asèϡĀnr㤲㤷grt;榜΀eknprst㓣㥆㥋㥒㥝㥤㦖appá␕othinçẖƀhir㓫⻈㥙opô⾵Ā;hᎷ㥢ïㆍĀiu㥩㥭gmá㎳Ābp㥲㦄setneqĀ;q㥽㦀쀀⊊︀;쀀⫋︀setneqĀ;q㦏㦒쀀⊋︀;쀀⫌︀Āhr㦛㦟etá㚜iangleĀlr㦪㦯eft»थight»ၑy;䐲ash»ံƀelr㧄㧒㧗ƀ;beⷪ㧋㧏ar;抻q;扚lip;拮Ābt㧜ᑨaòᑩr;쀀𝔳tré㦮suĀbp㧯㧱»ജ»൙pf;쀀𝕧roð໻tré㦴Ācu㨆㨋r;쀀𝓋Ābp㨐㨘nĀEe㦀㨖»㥾nĀEe㦒㨞»㦐igzag;榚΀cefoprs㨶㨻㩖㩛㩔㩡㩪irc;䅵Ādi㩀㩑Ābg㩅㩉ar;機eĀ;qᗺ㩏;扙erp;愘r;쀀𝔴pf;쀀𝕨Ā;eᑹ㩦atèᑹcr;쀀𝓌ૣណ㪇\0㪋\0㪐㪛\0\0㪝㪨㪫㪯\0\0㫃㫎\0㫘ៜ៟tré៑r;쀀𝔵ĀAa㪔㪗ròσrò৶;䎾ĀAa㪡㪤ròθrò৫að✓is;拻ƀdptឤ㪵㪾Āfl㪺ឩ;쀀𝕩imåឲĀAa㫇㫊ròώròਁĀcq㫒ីr;쀀𝓍Āpt៖㫜ré។Ѐacefiosu㫰㫽㬈㬌㬑㬕㬛㬡cĀuy㫶㫻te耻ý䃽;䑏Āiy㬂㬆rc;䅷;䑋n耻¥䂥r;쀀𝔶cy;䑗pf;쀀𝕪cr;쀀𝓎Ācm㬦㬩y;䑎l耻ÿ䃿Ԁacdefhiosw㭂㭈㭔㭘㭤㭩㭭㭴㭺㮀cute;䅺Āay㭍㭒ron;䅾;䐷ot;䅼Āet㭝㭡træᕟa;䎶r;쀀𝔷cy;䐶grarr;懝pf;쀀𝕫cr;쀀𝓏Ājn㮅㮇;怍j;怌'.split("").map(e=>e.charCodeAt(0))),decodeMap=new Map([[0,65533],[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]);function isNumber(e){return e>=CharCodes.ZERO&&e<=CharCodes.NINE}function isHexadecimalCharacter(e){return e>=CharCodes.UPPER_A&&e<=CharCodes.UPPER_F||e>=CharCodes.LOWER_A&&e<=CharCodes.LOWER_F}function isEntityInAttributeInvalidEnd(e){return e===CharCodes.EQUALS||function(e){return e>=CharCodes.UPPER_A&&e<=CharCodes.UPPER_Z||e>=CharCodes.LOWER_A&&e<=CharCodes.LOWER_Z||isNumber(e)}(e)}String.fromCodePoint,(CharCodes2=CharCodes||(CharCodes={}))[CharCodes2.NUM=35]="NUM",CharCodes2[CharCodes2.SEMI=59]="SEMI",CharCodes2[CharCodes2.EQUALS=61]="EQUALS",CharCodes2[CharCodes2.ZERO=48]="ZERO",CharCodes2[CharCodes2.NINE=57]="NINE",CharCodes2[CharCodes2.LOWER_A=97]="LOWER_A",CharCodes2[CharCodes2.LOWER_F=102]="LOWER_F",CharCodes2[CharCodes2.LOWER_X=120]="LOWER_X",CharCodes2[CharCodes2.LOWER_Z=122]="LOWER_Z",CharCodes2[CharCodes2.UPPER_A=65]="UPPER_A",CharCodes2[CharCodes2.UPPER_F=70]="UPPER_F",CharCodes2[CharCodes2.UPPER_Z=90]="UPPER_Z",(BinTrieFlags2=BinTrieFlags||(BinTrieFlags={}))[BinTrieFlags2.VALUE_LENGTH=49152]="VALUE_LENGTH",BinTrieFlags2[BinTrieFlags2.BRANCH_LENGTH=16256]="BRANCH_LENGTH",BinTrieFlags2[BinTrieFlags2.JUMP_TABLE=127]="JUMP_TABLE",(EntityDecoderState2=EntityDecoderState||(EntityDecoderState={}))[EntityDecoderState2.EntityStart=0]="EntityStart",EntityDecoderState2[EntityDecoderState2.NumericStart=1]="NumericStart",EntityDecoderState2[EntityDecoderState2.NumericDecimal=2]="NumericDecimal",EntityDecoderState2[EntityDecoderState2.NumericHex=3]="NumericHex",EntityDecoderState2[EntityDecoderState2.NamedEntity=4]="NamedEntity",(DecodingMode2=DecodingMode||(DecodingMode={}))[DecodingMode2.Legacy=0]="Legacy",DecodingMode2[DecodingMode2.Strict=1]="Strict",DecodingMode2[DecodingMode2.Attribute=2]="Attribute";var NS,NS2,ATTRS,ATTRS2,DOCUMENT_MODE,DOCUMENT_MODE2,TAG_NAMES,TAG_NAMES2,TAG_ID,TAG_ID2,EntityDecoder=class{constructor(e,t,n){this.decodeTree=e,this.emitCodePoint=t,this.errors=n,this.state=EntityDecoderState.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=DecodingMode.Strict}startEntity(e){this.decodeMode=e,this.state=EntityDecoderState.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(e,t){switch(this.state){case EntityDecoderState.EntityStart:return e.charCodeAt(t)===CharCodes.NUM?(this.state=EntityDecoderState.NumericStart,this.consumed+=1,this.stateNumericStart(e,t+1)):(this.state=EntityDecoderState.NamedEntity,this.stateNamedEntity(e,t));case EntityDecoderState.NumericStart:return this.stateNumericStart(e,t);case EntityDecoderState.NumericDecimal:return this.stateNumericDecimal(e,t);case EntityDecoderState.NumericHex:return this.stateNumericHex(e,t);case EntityDecoderState.NamedEntity:return this.stateNamedEntity(e,t)}}stateNumericStart(e,t){return t>=e.length?-1:(32|e.charCodeAt(t))===CharCodes.LOWER_X?(this.state=EntityDecoderState.NumericHex,this.consumed+=1,this.stateNumericHex(e,t+1)):(this.state=EntityDecoderState.NumericDecimal,this.stateNumericDecimal(e,t))}addToNumericResult(e,t,n,r){if(t!==n){const s=n-t;this.result=this.result*Math.pow(r,s)+Number.parseInt(e.substr(t,s),r),this.consumed+=s}}stateNumericHex(e,t){const n=t;for(;t<e.length;){const r=e.charCodeAt(t);if(!isNumber(r)&&!isHexadecimalCharacter(r))return this.addToNumericResult(e,n,t,16),this.emitNumericEntity(r,3);t+=1}return this.addToNumericResult(e,n,t,16),-1}stateNumericDecimal(e,t){const n=t;for(;t<e.length;){const r=e.charCodeAt(t);if(!isNumber(r))return this.addToNumericResult(e,n,t,10),this.emitNumericEntity(r,2);t+=1}return this.addToNumericResult(e,n,t,10),-1}emitNumericEntity(e,t){var n;if(this.consumed<=t)return null===(n=this.errors)||void 0===n||n.absenceOfDigitsInNumericCharacterReference(this.consumed),0;if(e===CharCodes.SEMI)this.consumed+=1;else if(this.decodeMode===DecodingMode.Strict)return 0;return this.emitCodePoint(function(e){var t;return e>=55296&&e<=57343||e>1114111?65533:null!==(t=decodeMap.get(e))&&void 0!==t?t:e}(this.result),this.consumed),this.errors&&(e!==CharCodes.SEMI&&this.errors.missingSemicolonAfterCharacterReference(),this.errors.validateNumericCharacterReference(this.result)),this.consumed}stateNamedEntity(e,t){const{decodeTree:n}=this;let r=n[this.treeIndex],s=(r&BinTrieFlags.VALUE_LENGTH)>>14;for(;t<e.length;t++,this.excess++){const a=e.charCodeAt(t);if(this.treeIndex=determineBranch(n,r,this.treeIndex+Math.max(1,s),a),this.treeIndex<0)return 0===this.result||this.decodeMode===DecodingMode.Attribute&&(0===s||isEntityInAttributeInvalidEnd(a))?0:this.emitNotTerminatedNamedEntity();if(r=n[this.treeIndex],s=(r&BinTrieFlags.VALUE_LENGTH)>>14,0!==s){if(a===CharCodes.SEMI)return this.emitNamedEntityData(this.treeIndex,s,this.consumed+this.excess);this.decodeMode!==DecodingMode.Strict&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}}return-1}emitNotTerminatedNamedEntity(){var e;const{result:t,decodeTree:n}=this,r=(n[t]&BinTrieFlags.VALUE_LENGTH)>>14;return this.emitNamedEntityData(t,r,this.consumed),null===(e=this.errors)||void 0===e||e.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(e,t,n){const{decodeTree:r}=this;return this.emitCodePoint(1===t?r[e]&~BinTrieFlags.VALUE_LENGTH:r[e+1],n),3===t&&this.emitCodePoint(r[e+2],n),n}end(){var e;switch(this.state){case EntityDecoderState.NamedEntity:return 0===this.result||this.decodeMode===DecodingMode.Attribute&&this.result!==this.treeIndex?0:this.emitNotTerminatedNamedEntity();case EntityDecoderState.NumericDecimal:return this.emitNumericEntity(0,2);case EntityDecoderState.NumericHex:return this.emitNumericEntity(0,3);case EntityDecoderState.NumericStart:return null===(e=this.errors)||void 0===e||e.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case EntityDecoderState.EntityStart:return 0}}};function determineBranch(e,t,n,r){const s=(t&BinTrieFlags.BRANCH_LENGTH)>>7,a=t&BinTrieFlags.JUMP_TABLE;if(0===s)return 0!==a&&r===a?n:-1;if(a){const t=r-a;return t<0||t>=s?-1:e[n+t]-1}let i=n,o=i+s-1;for(;i<=o;){const t=i+o>>>1,n=e[t];if(n<r)i=t+1;else{if(!(n>r))return e[t+s];o=t-1}}return-1}(NS2=NS||(NS={})).HTML="http://www.w3.org/1999/xhtml",NS2.MATHML="http://www.w3.org/1998/Math/MathML",NS2.SVG="http://www.w3.org/2000/svg",NS2.XLINK="http://www.w3.org/1999/xlink",NS2.XML="http://www.w3.org/XML/1998/namespace",NS2.XMLNS="http://www.w3.org/2000/xmlns/",(ATTRS2=ATTRS||(ATTRS={})).TYPE="type",ATTRS2.ACTION="action",ATTRS2.ENCODING="encoding",ATTRS2.PROMPT="prompt",ATTRS2.NAME="name",ATTRS2.COLOR="color",ATTRS2.FACE="face",ATTRS2.SIZE="size",(DOCUMENT_MODE2=DOCUMENT_MODE||(DOCUMENT_MODE={})).NO_QUIRKS="no-quirks",DOCUMENT_MODE2.QUIRKS="quirks",DOCUMENT_MODE2.LIMITED_QUIRKS="limited-quirks",(TAG_NAMES2=TAG_NAMES||(TAG_NAMES={})).A="a",TAG_NAMES2.ADDRESS="address",TAG_NAMES2.ANNOTATION_XML="annotation-xml",TAG_NAMES2.APPLET="applet",TAG_NAMES2.AREA="area",TAG_NAMES2.ARTICLE="article",TAG_NAMES2.ASIDE="aside",TAG_NAMES2.B="b",TAG_NAMES2.BASE="base",TAG_NAMES2.BASEFONT="basefont",TAG_NAMES2.BGSOUND="bgsound",TAG_NAMES2.BIG="big",TAG_NAMES2.BLOCKQUOTE="blockquote",TAG_NAMES2.BODY="body",TAG_NAMES2.BR="br",TAG_NAMES2.BUTTON="button",TAG_NAMES2.CAPTION="caption",TAG_NAMES2.CENTER="center",TAG_NAMES2.CODE="code",TAG_NAMES2.COL="col",TAG_NAMES2.COLGROUP="colgroup",TAG_NAMES2.DD="dd",TAG_NAMES2.DESC="desc",TAG_NAMES2.DETAILS="details",TAG_NAMES2.DIALOG="dialog",TAG_NAMES2.DIR="dir",TAG_NAMES2.DIV="div",TAG_NAMES2.DL="dl",TAG_NAMES2.DT="dt",TAG_NAMES2.EM="em",TAG_NAMES2.EMBED="embed",TAG_NAMES2.FIELDSET="fieldset",TAG_NAMES2.FIGCAPTION="figcaption",TAG_NAMES2.FIGURE="figure",TAG_NAMES2.FONT="font",TAG_NAMES2.FOOTER="footer",TAG_NAMES2.FOREIGN_OBJECT="foreignObject",TAG_NAMES2.FORM="form",TAG_NAMES2.FRAME="frame",TAG_NAMES2.FRAMESET="frameset",TAG_NAMES2.H1="h1",TAG_NAMES2.H2="h2",TAG_NAMES2.H3="h3",TAG_NAMES2.H4="h4",TAG_NAMES2.H5="h5",TAG_NAMES2.H6="h6",TAG_NAMES2.HEAD="head",TAG_NAMES2.HEADER="header",TAG_NAMES2.HGROUP="hgroup",TAG_NAMES2.HR="hr",TAG_NAMES2.HTML="html",TAG_NAMES2.I="i",TAG_NAMES2.IMG="img",TAG_NAMES2.IMAGE="image",TAG_NAMES2.INPUT="input",TAG_NAMES2.IFRAME="iframe",TAG_NAMES2.KEYGEN="keygen",TAG_NAMES2.LABEL="label",TAG_NAMES2.LI="li",TAG_NAMES2.LINK="link",TAG_NAMES2.LISTING="listing",TAG_NAMES2.MAIN="main",TAG_NAMES2.MALIGNMARK="malignmark",TAG_NAMES2.MARQUEE="marquee",TAG_NAMES2.MATH="math",TAG_NAMES2.MENU="menu",TAG_NAMES2.META="meta",TAG_NAMES2.MGLYPH="mglyph",TAG_NAMES2.MI="mi",TAG_NAMES2.MO="mo",TAG_NAMES2.MN="mn",TAG_NAMES2.MS="ms",TAG_NAMES2.MTEXT="mtext",TAG_NAMES2.NAV="nav",TAG_NAMES2.NOBR="nobr",TAG_NAMES2.NOFRAMES="noframes",TAG_NAMES2.NOEMBED="noembed",TAG_NAMES2.NOSCRIPT="noscript",TAG_NAMES2.OBJECT="object",TAG_NAMES2.OL="ol",TAG_NAMES2.OPTGROUP="optgroup",TAG_NAMES2.OPTION="option",TAG_NAMES2.P="p",TAG_NAMES2.PARAM="param",TAG_NAMES2.PLAINTEXT="plaintext",TAG_NAMES2.PRE="pre",TAG_NAMES2.RB="rb",TAG_NAMES2.RP="rp",TAG_NAMES2.RT="rt",TAG_NAMES2.RTC="rtc",TAG_NAMES2.RUBY="ruby",TAG_NAMES2.S="s",TAG_NAMES2.SCRIPT="script",TAG_NAMES2.SEARCH="search",TAG_NAMES2.SECTION="section",TAG_NAMES2.SELECT="select",TAG_NAMES2.SOURCE="source",TAG_NAMES2.SMALL="small",TAG_NAMES2.SPAN="span",TAG_NAMES2.STRIKE="strike",TAG_NAMES2.STRONG="strong",TAG_NAMES2.STYLE="style",TAG_NAMES2.SUB="sub",TAG_NAMES2.SUMMARY="summary",TAG_NAMES2.SUP="sup",TAG_NAMES2.TABLE="table",TAG_NAMES2.TBODY="tbody",TAG_NAMES2.TEMPLATE="template",TAG_NAMES2.TEXTAREA="textarea",TAG_NAMES2.TFOOT="tfoot",TAG_NAMES2.TD="td",TAG_NAMES2.TH="th",TAG_NAMES2.THEAD="thead",TAG_NAMES2.TITLE="title",TAG_NAMES2.TR="tr",TAG_NAMES2.TRACK="track",TAG_NAMES2.TT="tt",TAG_NAMES2.U="u",TAG_NAMES2.UL="ul",TAG_NAMES2.SVG="svg",TAG_NAMES2.VAR="var",TAG_NAMES2.WBR="wbr",TAG_NAMES2.XMP="xmp",(TAG_ID2=TAG_ID||(TAG_ID={}))[TAG_ID2.UNKNOWN=0]="UNKNOWN",TAG_ID2[TAG_ID2.A=1]="A",TAG_ID2[TAG_ID2.ADDRESS=2]="ADDRESS",TAG_ID2[TAG_ID2.ANNOTATION_XML=3]="ANNOTATION_XML",TAG_ID2[TAG_ID2.APPLET=4]="APPLET",TAG_ID2[TAG_ID2.AREA=5]="AREA",TAG_ID2[TAG_ID2.ARTICLE=6]="ARTICLE",TAG_ID2[TAG_ID2.ASIDE=7]="ASIDE",TAG_ID2[TAG_ID2.B=8]="B",TAG_ID2[TAG_ID2.BASE=9]="BASE",TAG_ID2[TAG_ID2.BASEFONT=10]="BASEFONT",TAG_ID2[TAG_ID2.BGSOUND=11]="BGSOUND",TAG_ID2[TAG_ID2.BIG=12]="BIG",TAG_ID2[TAG_ID2.BLOCKQUOTE=13]="BLOCKQUOTE",TAG_ID2[TAG_ID2.BODY=14]="BODY",TAG_ID2[TAG_ID2.BR=15]="BR",TAG_ID2[TAG_ID2.BUTTON=16]="BUTTON",TAG_ID2[TAG_ID2.CAPTION=17]="CAPTION",TAG_ID2[TAG_ID2.CENTER=18]="CENTER",TAG_ID2[TAG_ID2.CODE=19]="CODE",TAG_ID2[TAG_ID2.COL=20]="COL",TAG_ID2[TAG_ID2.COLGROUP=21]="COLGROUP",TAG_ID2[TAG_ID2.DD=22]="DD",TAG_ID2[TAG_ID2.DESC=23]="DESC",TAG_ID2[TAG_ID2.DETAILS=24]="DETAILS",TAG_ID2[TAG_ID2.DIALOG=25]="DIALOG",TAG_ID2[TAG_ID2.DIR=26]="DIR",TAG_ID2[TAG_ID2.DIV=27]="DIV",TAG_ID2[TAG_ID2.DL=28]="DL",TAG_ID2[TAG_ID2.DT=29]="DT",TAG_ID2[TAG_ID2.EM=30]="EM",TAG_ID2[TAG_ID2.EMBED=31]="EMBED",TAG_ID2[TAG_ID2.FIELDSET=32]="FIELDSET",TAG_ID2[TAG_ID2.FIGCAPTION=33]="FIGCAPTION",TAG_ID2[TAG_ID2.FIGURE=34]="FIGURE",TAG_ID2[TAG_ID2.FONT=35]="FONT",TAG_ID2[TAG_ID2.FOOTER=36]="FOOTER",TAG_ID2[TAG_ID2.FOREIGN_OBJECT=37]="FOREIGN_OBJECT",TAG_ID2[TAG_ID2.FORM=38]="FORM",TAG_ID2[TAG_ID2.FRAME=39]="FRAME",TAG_ID2[TAG_ID2.FRAMESET=40]="FRAMESET",TAG_ID2[TAG_ID2.H1=41]="H1",TAG_ID2[TAG_ID2.H2=42]="H2",TAG_ID2[TAG_ID2.H3=43]="H3",TAG_ID2[TAG_ID2.H4=44]="H4",TAG_ID2[TAG_ID2.H5=45]="H5",TAG_ID2[TAG_ID2.H6=46]="H6",TAG_ID2[TAG_ID2.HEAD=47]="HEAD",TAG_ID2[TAG_ID2.HEADER=48]="HEADER",TAG_ID2[TAG_ID2.HGROUP=49]="HGROUP",TAG_ID2[TAG_ID2.HR=50]="HR",TAG_ID2[TAG_ID2.HTML=51]="HTML",TAG_ID2[TAG_ID2.I=52]="I",TAG_ID2[TAG_ID2.IMG=53]="IMG",TAG_ID2[TAG_ID2.IMAGE=54]="IMAGE",TAG_ID2[TAG_ID2.INPUT=55]="INPUT",TAG_ID2[TAG_ID2.IFRAME=56]="IFRAME",TAG_ID2[TAG_ID2.KEYGEN=57]="KEYGEN",TAG_ID2[TAG_ID2.LABEL=58]="LABEL",TAG_ID2[TAG_ID2.LI=59]="LI",TAG_ID2[TAG_ID2.LINK=60]="LINK",TAG_ID2[TAG_ID2.LISTING=61]="LISTING",TAG_ID2[TAG_ID2.MAIN=62]="MAIN",TAG_ID2[TAG_ID2.MALIGNMARK=63]="MALIGNMARK",TAG_ID2[TAG_ID2.MARQUEE=64]="MARQUEE",TAG_ID2[TAG_ID2.MATH=65]="MATH",TAG_ID2[TAG_ID2.MENU=66]="MENU",TAG_ID2[TAG_ID2.META=67]="META",TAG_ID2[TAG_ID2.MGLYPH=68]="MGLYPH",TAG_ID2[TAG_ID2.MI=69]="MI",TAG_ID2[TAG_ID2.MO=70]="MO",TAG_ID2[TAG_ID2.MN=71]="MN",TAG_ID2[TAG_ID2.MS=72]="MS",TAG_ID2[TAG_ID2.MTEXT=73]="MTEXT",TAG_ID2[TAG_ID2.NAV=74]="NAV",TAG_ID2[TAG_ID2.NOBR=75]="NOBR",TAG_ID2[TAG_ID2.NOFRAMES=76]="NOFRAMES",TAG_ID2[TAG_ID2.NOEMBED=77]="NOEMBED",TAG_ID2[TAG_ID2.NOSCRIPT=78]="NOSCRIPT",TAG_ID2[TAG_ID2.OBJECT=79]="OBJECT",TAG_ID2[TAG_ID2.OL=80]="OL",TAG_ID2[TAG_ID2.OPTGROUP=81]="OPTGROUP",TAG_ID2[TAG_ID2.OPTION=82]="OPTION",TAG_ID2[TAG_ID2.P=83]="P",TAG_ID2[TAG_ID2.PARAM=84]="PARAM",TAG_ID2[TAG_ID2.PLAINTEXT=85]="PLAINTEXT",TAG_ID2[TAG_ID2.PRE=86]="PRE",TAG_ID2[TAG_ID2.RB=87]="RB",TAG_ID2[TAG_ID2.RP=88]="RP",TAG_ID2[TAG_ID2.RT=89]="RT",TAG_ID2[TAG_ID2.RTC=90]="RTC",TAG_ID2[TAG_ID2.RUBY=91]="RUBY",TAG_ID2[TAG_ID2.S=92]="S",TAG_ID2[TAG_ID2.SCRIPT=93]="SCRIPT",TAG_ID2[TAG_ID2.SEARCH=94]="SEARCH",TAG_ID2[TAG_ID2.SECTION=95]="SECTION",TAG_ID2[TAG_ID2.SELECT=96]="SELECT",TAG_ID2[TAG_ID2.SOURCE=97]="SOURCE",TAG_ID2[TAG_ID2.SMALL=98]="SMALL",TAG_ID2[TAG_ID2.SPAN=99]="SPAN",TAG_ID2[TAG_ID2.STRIKE=100]="STRIKE",TAG_ID2[TAG_ID2.STRONG=101]="STRONG",TAG_ID2[TAG_ID2.STYLE=102]="STYLE",TAG_ID2[TAG_ID2.SUB=103]="SUB",TAG_ID2[TAG_ID2.SUMMARY=104]="SUMMARY",TAG_ID2[TAG_ID2.SUP=105]="SUP",TAG_ID2[TAG_ID2.TABLE=106]="TABLE",TAG_ID2[TAG_ID2.TBODY=107]="TBODY",TAG_ID2[TAG_ID2.TEMPLATE=108]="TEMPLATE",TAG_ID2[TAG_ID2.TEXTAREA=109]="TEXTAREA",TAG_ID2[TAG_ID2.TFOOT=110]="TFOOT",TAG_ID2[TAG_ID2.TD=111]="TD",TAG_ID2[TAG_ID2.TH=112]="TH",TAG_ID2[TAG_ID2.THEAD=113]="THEAD",TAG_ID2[TAG_ID2.TITLE=114]="TITLE",TAG_ID2[TAG_ID2.TR=115]="TR",TAG_ID2[TAG_ID2.TRACK=116]="TRACK",TAG_ID2[TAG_ID2.TT=117]="TT",TAG_ID2[TAG_ID2.U=118]="U",TAG_ID2[TAG_ID2.UL=119]="UL",TAG_ID2[TAG_ID2.SVG=120]="SVG",TAG_ID2[TAG_ID2.VAR=121]="VAR",TAG_ID2[TAG_ID2.WBR=122]="WBR",TAG_ID2[TAG_ID2.XMP=123]="XMP";var TAG_NAME_TO_ID=new Map([[TAG_NAMES.A,TAG_ID.A],[TAG_NAMES.ADDRESS,TAG_ID.ADDRESS],[TAG_NAMES.ANNOTATION_XML,TAG_ID.ANNOTATION_XML],[TAG_NAMES.APPLET,TAG_ID.APPLET],[TAG_NAMES.AREA,TAG_ID.AREA],[TAG_NAMES.ARTICLE,TAG_ID.ARTICLE],[TAG_NAMES.ASIDE,TAG_ID.ASIDE],[TAG_NAMES.B,TAG_ID.B],[TAG_NAMES.BASE,TAG_ID.BASE],[TAG_NAMES.BASEFONT,TAG_ID.BASEFONT],[TAG_NAMES.BGSOUND,TAG_ID.BGSOUND],[TAG_NAMES.BIG,TAG_ID.BIG],[TAG_NAMES.BLOCKQUOTE,TAG_ID.BLOCKQUOTE],[TAG_NAMES.BODY,TAG_ID.BODY],[TAG_NAMES.BR,TAG_ID.BR],[TAG_NAMES.BUTTON,TAG_ID.BUTTON],[TAG_NAMES.CAPTION,TAG_ID.CAPTION],[TAG_NAMES.CENTER,TAG_ID.CENTER],[TAG_NAMES.CODE,TAG_ID.CODE],[TAG_NAMES.COL,TAG_ID.COL],[TAG_NAMES.COLGROUP,TAG_ID.COLGROUP],[TAG_NAMES.DD,TAG_ID.DD],[TAG_NAMES.DESC,TAG_ID.DESC],[TAG_NAMES.DETAILS,TAG_ID.DETAILS],[TAG_NAMES.DIALOG,TAG_ID.DIALOG],[TAG_NAMES.DIR,TAG_ID.DIR],[TAG_NAMES.DIV,TAG_ID.DIV],[TAG_NAMES.DL,TAG_ID.DL],[TAG_NAMES.DT,TAG_ID.DT],[TAG_NAMES.EM,TAG_ID.EM],[TAG_NAMES.EMBED,TAG_ID.EMBED],[TAG_NAMES.FIELDSET,TAG_ID.FIELDSET],[TAG_NAMES.FIGCAPTION,TAG_ID.FIGCAPTION],[TAG_NAMES.FIGURE,TAG_ID.FIGURE],[TAG_NAMES.FONT,TAG_ID.FONT],[TAG_NAMES.FOOTER,TAG_ID.FOOTER],[TAG_NAMES.FOREIGN_OBJECT,TAG_ID.FOREIGN_OBJECT],[TAG_NAMES.FORM,TAG_ID.FORM],[TAG_NAMES.FRAME,TAG_ID.FRAME],[TAG_NAMES.FRAMESET,TAG_ID.FRAMESET],[TAG_NAMES.H1,TAG_ID.H1],[TAG_NAMES.H2,TAG_ID.H2],[TAG_NAMES.H3,TAG_ID.H3],[TAG_NAMES.H4,TAG_ID.H4],[TAG_NAMES.H5,TAG_ID.H5],[TAG_NAMES.H6,TAG_ID.H6],[TAG_NAMES.HEAD,TAG_ID.HEAD],[TAG_NAMES.HEADER,TAG_ID.HEADER],[TAG_NAMES.HGROUP,TAG_ID.HGROUP],[TAG_NAMES.HR,TAG_ID.HR],[TAG_NAMES.HTML,TAG_ID.HTML],[TAG_NAMES.I,TAG_ID.I],[TAG_NAMES.IMG,TAG_ID.IMG],[TAG_NAMES.IMAGE,TAG_ID.IMAGE],[TAG_NAMES.INPUT,TAG_ID.INPUT],[TAG_NAMES.IFRAME,TAG_ID.IFRAME],[TAG_NAMES.KEYGEN,TAG_ID.KEYGEN],[TAG_NAMES.LABEL,TAG_ID.LABEL],[TAG_NAMES.LI,TAG_ID.LI],[TAG_NAMES.LINK,TAG_ID.LINK],[TAG_NAMES.LISTING,TAG_ID.LISTING],[TAG_NAMES.MAIN,TAG_ID.MAIN],[TAG_NAMES.MALIGNMARK,TAG_ID.MALIGNMARK],[TAG_NAMES.MARQUEE,TAG_ID.MARQUEE],[TAG_NAMES.MATH,TAG_ID.MATH],[TAG_NAMES.MENU,TAG_ID.MENU],[TAG_NAMES.META,TAG_ID.META],[TAG_NAMES.MGLYPH,TAG_ID.MGLYPH],[TAG_NAMES.MI,TAG_ID.MI],[TAG_NAMES.MO,TAG_ID.MO],[TAG_NAMES.MN,TAG_ID.MN],[TAG_NAMES.MS,TAG_ID.MS],[TAG_NAMES.MTEXT,TAG_ID.MTEXT],[TAG_NAMES.NAV,TAG_ID.NAV],[TAG_NAMES.NOBR,TAG_ID.NOBR],[TAG_NAMES.NOFRAMES,TAG_ID.NOFRAMES],[TAG_NAMES.NOEMBED,TAG_ID.NOEMBED],[TAG_NAMES.NOSCRIPT,TAG_ID.NOSCRIPT],[TAG_NAMES.OBJECT,TAG_ID.OBJECT],[TAG_NAMES.OL,TAG_ID.OL],[TAG_NAMES.OPTGROUP,TAG_ID.OPTGROUP],[TAG_NAMES.OPTION,TAG_ID.OPTION],[TAG_NAMES.P,TAG_ID.P],[TAG_NAMES.PARAM,TAG_ID.PARAM],[TAG_NAMES.PLAINTEXT,TAG_ID.PLAINTEXT],[TAG_NAMES.PRE,TAG_ID.PRE],[TAG_NAMES.RB,TAG_ID.RB],[TAG_NAMES.RP,TAG_ID.RP],[TAG_NAMES.RT,TAG_ID.RT],[TAG_NAMES.RTC,TAG_ID.RTC],[TAG_NAMES.RUBY,TAG_ID.RUBY],[TAG_NAMES.S,TAG_ID.S],[TAG_NAMES.SCRIPT,TAG_ID.SCRIPT],[TAG_NAMES.SEARCH,TAG_ID.SEARCH],[TAG_NAMES.SECTION,TAG_ID.SECTION],[TAG_NAMES.SELECT,TAG_ID.SELECT],[TAG_NAMES.SOURCE,TAG_ID.SOURCE],[TAG_NAMES.SMALL,TAG_ID.SMALL],[TAG_NAMES.SPAN,TAG_ID.SPAN],[TAG_NAMES.STRIKE,TAG_ID.STRIKE],[TAG_NAMES.STRONG,TAG_ID.STRONG],[TAG_NAMES.STYLE,TAG_ID.STYLE],[TAG_NAMES.SUB,TAG_ID.SUB],[TAG_NAMES.SUMMARY,TAG_ID.SUMMARY],[TAG_NAMES.SUP,TAG_ID.SUP],[TAG_NAMES.TABLE,TAG_ID.TABLE],[TAG_NAMES.TBODY,TAG_ID.TBODY],[TAG_NAMES.TEMPLATE,TAG_ID.TEMPLATE],[TAG_NAMES.TEXTAREA,TAG_ID.TEXTAREA],[TAG_NAMES.TFOOT,TAG_ID.TFOOT],[TAG_NAMES.TD,TAG_ID.TD],[TAG_NAMES.TH,TAG_ID.TH],[TAG_NAMES.THEAD,TAG_ID.THEAD],[TAG_NAMES.TITLE,TAG_ID.TITLE],[TAG_NAMES.TR,TAG_ID.TR],[TAG_NAMES.TRACK,TAG_ID.TRACK],[TAG_NAMES.TT,TAG_ID.TT],[TAG_NAMES.U,TAG_ID.U],[TAG_NAMES.UL,TAG_ID.UL],[TAG_NAMES.SVG,TAG_ID.SVG],[TAG_NAMES.VAR,TAG_ID.VAR],[TAG_NAMES.WBR,TAG_ID.WBR],[TAG_NAMES.XMP,TAG_ID.XMP]]);function getTagID(e){var t;return null!==(t=TAG_NAME_TO_ID.get(e))&&void 0!==t?t:TAG_ID.UNKNOWN}var State,State2,$=TAG_ID,SPECIAL_ELEMENTS={[NS.HTML]:new Set([$.ADDRESS,$.APPLET,$.AREA,$.ARTICLE,$.ASIDE,$.BASE,$.BASEFONT,$.BGSOUND,$.BLOCKQUOTE,$.BODY,$.BR,$.BUTTON,$.CAPTION,$.CENTER,$.COL,$.COLGROUP,$.DD,$.DETAILS,$.DIR,$.DIV,$.DL,$.DT,$.EMBED,$.FIELDSET,$.FIGCAPTION,$.FIGURE,$.FOOTER,$.FORM,$.FRAME,$.FRAMESET,$.H1,$.H2,$.H3,$.H4,$.H5,$.H6,$.HEAD,$.HEADER,$.HGROUP,$.HR,$.HTML,$.IFRAME,$.IMG,$.INPUT,$.LI,$.LINK,$.LISTING,$.MAIN,$.MARQUEE,$.MENU,$.META,$.NAV,$.NOEMBED,$.NOFRAMES,$.NOSCRIPT,$.OBJECT,$.OL,$.P,$.PARAM,$.PLAINTEXT,$.PRE,$.SCRIPT,$.SECTION,$.SELECT,$.SOURCE,$.STYLE,$.SUMMARY,$.TABLE,$.TBODY,$.TD,$.TEMPLATE,$.TEXTAREA,$.TFOOT,$.TH,$.THEAD,$.TITLE,$.TR,$.TRACK,$.UL,$.WBR,$.XMP]),[NS.MATHML]:new Set([$.MI,$.MO,$.MN,$.MS,$.MTEXT,$.ANNOTATION_XML]),[NS.SVG]:new Set([$.TITLE,$.FOREIGN_OBJECT,$.DESC]),[NS.XLINK]:new Set,[NS.XML]:new Set,[NS.XMLNS]:new Set},NUMBERED_HEADERS=new Set([$.H1,$.H2,$.H3,$.H4,$.H5,$.H6]);TAG_NAMES.STYLE,TAG_NAMES.SCRIPT,TAG_NAMES.XMP,TAG_NAMES.IFRAME,TAG_NAMES.NOEMBED,TAG_NAMES.NOFRAMES,TAG_NAMES.PLAINTEXT,(State2=State||(State={}))[State2.DATA=0]="DATA",State2[State2.RCDATA=1]="RCDATA",State2[State2.RAWTEXT=2]="RAWTEXT",State2[State2.SCRIPT_DATA=3]="SCRIPT_DATA",State2[State2.PLAINTEXT=4]="PLAINTEXT",State2[State2.TAG_OPEN=5]="TAG_OPEN",State2[State2.END_TAG_OPEN=6]="END_TAG_OPEN",State2[State2.TAG_NAME=7]="TAG_NAME",State2[State2.RCDATA_LESS_THAN_SIGN=8]="RCDATA_LESS_THAN_SIGN",State2[State2.RCDATA_END_TAG_OPEN=9]="RCDATA_END_TAG_OPEN",State2[State2.RCDATA_END_TAG_NAME=10]="RCDATA_END_TAG_NAME",State2[State2.RAWTEXT_LESS_THAN_SIGN=11]="RAWTEXT_LESS_THAN_SIGN",State2[State2.RAWTEXT_END_TAG_OPEN=12]="RAWTEXT_END_TAG_OPEN",State2[State2.RAWTEXT_END_TAG_NAME=13]="RAWTEXT_END_TAG_NAME",State2[State2.SCRIPT_DATA_LESS_THAN_SIGN=14]="SCRIPT_DATA_LESS_THAN_SIGN",State2[State2.SCRIPT_DATA_END_TAG_OPEN=15]="SCRIPT_DATA_END_TAG_OPEN",State2[State2.SCRIPT_DATA_END_TAG_NAME=16]="SCRIPT_DATA_END_TAG_NAME",State2[State2.SCRIPT_DATA_ESCAPE_START=17]="SCRIPT_DATA_ESCAPE_START",State2[State2.SCRIPT_DATA_ESCAPE_START_DASH=18]="SCRIPT_DATA_ESCAPE_START_DASH",State2[State2.SCRIPT_DATA_ESCAPED=19]="SCRIPT_DATA_ESCAPED",State2[State2.SCRIPT_DATA_ESCAPED_DASH=20]="SCRIPT_DATA_ESCAPED_DASH",State2[State2.SCRIPT_DATA_ESCAPED_DASH_DASH=21]="SCRIPT_DATA_ESCAPED_DASH_DASH",State2[State2.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN=22]="SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN",State2[State2.SCRIPT_DATA_ESCAPED_END_TAG_OPEN=23]="SCRIPT_DATA_ESCAPED_END_TAG_OPEN",State2[State2.SCRIPT_DATA_ESCAPED_END_TAG_NAME=24]="SCRIPT_DATA_ESCAPED_END_TAG_NAME",State2[State2.SCRIPT_DATA_DOUBLE_ESCAPE_START=25]="SCRIPT_DATA_DOUBLE_ESCAPE_START",State2[State2.SCRIPT_DATA_DOUBLE_ESCAPED=26]="SCRIPT_DATA_DOUBLE_ESCAPED",State2[State2.SCRIPT_DATA_DOUBLE_ESCAPED_DASH=27]="SCRIPT_DATA_DOUBLE_ESCAPED_DASH",State2[State2.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH=28]="SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH",State2[State2.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN=29]="SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN",State2[State2.SCRIPT_DATA_DOUBLE_ESCAPE_END=30]="SCRIPT_DATA_DOUBLE_ESCAPE_END",State2[State2.BEFORE_ATTRIBUTE_NAME=31]="BEFORE_ATTRIBUTE_NAME",State2[State2.ATTRIBUTE_NAME=32]="ATTRIBUTE_NAME",State2[State2.AFTER_ATTRIBUTE_NAME=33]="AFTER_ATTRIBUTE_NAME",State2[State2.BEFORE_ATTRIBUTE_VALUE=34]="BEFORE_ATTRIBUTE_VALUE",State2[State2.ATTRIBUTE_VALUE_DOUBLE_QUOTED=35]="ATTRIBUTE_VALUE_DOUBLE_QUOTED",State2[State2.ATTRIBUTE_VALUE_SINGLE_QUOTED=36]="ATTRIBUTE_VALUE_SINGLE_QUOTED",State2[State2.ATTRIBUTE_VALUE_UNQUOTED=37]="ATTRIBUTE_VALUE_UNQUOTED",State2[State2.AFTER_ATTRIBUTE_VALUE_QUOTED=38]="AFTER_ATTRIBUTE_VALUE_QUOTED",State2[State2.SELF_CLOSING_START_TAG=39]="SELF_CLOSING_START_TAG",State2[State2.BOGUS_COMMENT=40]="BOGUS_COMMENT",State2[State2.MARKUP_DECLARATION_OPEN=41]="MARKUP_DECLARATION_OPEN",State2[State2.COMMENT_START=42]="COMMENT_START",State2[State2.COMMENT_START_DASH=43]="COMMENT_START_DASH",State2[State2.COMMENT=44]="COMMENT",State2[State2.COMMENT_LESS_THAN_SIGN=45]="COMMENT_LESS_THAN_SIGN",State2[State2.COMMENT_LESS_THAN_SIGN_BANG=46]="COMMENT_LESS_THAN_SIGN_BANG",State2[State2.COMMENT_LESS_THAN_SIGN_BANG_DASH=47]="COMMENT_LESS_THAN_SIGN_BANG_DASH",State2[State2.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH=48]="COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH",State2[State2.COMMENT_END_DASH=49]="COMMENT_END_DASH",State2[State2.COMMENT_END=50]="COMMENT_END",State2[State2.COMMENT_END_BANG=51]="COMMENT_END_BANG",State2[State2.DOCTYPE=52]="DOCTYPE",State2[State2.BEFORE_DOCTYPE_NAME=53]="BEFORE_DOCTYPE_NAME",State2[State2.DOCTYPE_NAME=54]="DOCTYPE_NAME",State2[State2.AFTER_DOCTYPE_NAME=55]="AFTER_DOCTYPE_NAME",State2[State2.AFTER_DOCTYPE_PUBLIC_KEYWORD=56]="AFTER_DOCTYPE_PUBLIC_KEYWORD",State2[State2.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER=57]="BEFORE_DOCTYPE_PUBLIC_IDENTIFIER",State2[State2.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED=58]="DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED",State2[State2.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED=59]="DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED",State2[State2.AFTER_DOCTYPE_PUBLIC_IDENTIFIER=60]="AFTER_DOCTYPE_PUBLIC_IDENTIFIER",State2[State2.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS=61]="BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS",State2[State2.AFTER_DOCTYPE_SYSTEM_KEYWORD=62]="AFTER_DOCTYPE_SYSTEM_KEYWORD",State2[State2.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER=63]="BEFORE_DOCTYPE_SYSTEM_IDENTIFIER",State2[State2.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED=64]="DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED",State2[State2.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED=65]="DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED",State2[State2.AFTER_DOCTYPE_SYSTEM_IDENTIFIER=66]="AFTER_DOCTYPE_SYSTEM_IDENTIFIER",State2[State2.BOGUS_DOCTYPE=67]="BOGUS_DOCTYPE",State2[State2.CDATA_SECTION=68]="CDATA_SECTION",State2[State2.CDATA_SECTION_BRACKET=69]="CDATA_SECTION_BRACKET",State2[State2.CDATA_SECTION_END=70]="CDATA_SECTION_END",State2[State2.CHARACTER_REFERENCE=71]="CHARACTER_REFERENCE",State2[State2.AMBIGUOUS_AMPERSAND=72]="AMBIGUOUS_AMPERSAND";var TokenizerMode={DATA:State.DATA,RCDATA:State.RCDATA,RAWTEXT:State.RAWTEXT,SCRIPT_DATA:State.SCRIPT_DATA,PLAINTEXT:State.PLAINTEXT,CDATA_SECTION:State.CDATA_SECTION};function isAsciiUpper(e){return e>=CODE_POINTS.LATIN_CAPITAL_A&&e<=CODE_POINTS.LATIN_CAPITAL_Z}function isAsciiLetter(e){return function(e){return e>=CODE_POINTS.LATIN_SMALL_A&&e<=CODE_POINTS.LATIN_SMALL_Z}(e)||isAsciiUpper(e)}function isAsciiAlphaNumeric2(e){return isAsciiLetter(e)||function(e){return e>=CODE_POINTS.DIGIT_0&&e<=CODE_POINTS.DIGIT_9}(e)}function toAsciiLower(e){return e+32}function isWhitespace(e){return e===CODE_POINTS.SPACE||e===CODE_POINTS.LINE_FEED||e===CODE_POINTS.TABULATION||e===CODE_POINTS.FORM_FEED}function isScriptDataDoubleEscapeSequenceEnd(e){return isWhitespace(e)||e===CODE_POINTS.SOLIDUS||e===CODE_POINTS.GREATER_THAN_SIGN}var EntryType,EntryType2,Tokenizer=class{constructor(e,t){this.options=e,this.handler=t,this.paused=!1,this.inLoop=!1,this.inForeignNode=!1,this.lastStartTagName="",this.active=!1,this.state=State.DATA,this.returnState=State.DATA,this.entityStartPos=0,this.consumedAfterSnapshot=-1,this.currentCharacterToken=null,this.currentToken=null,this.currentAttr={name:"",value:""},this.preprocessor=new Preprocessor(t),this.currentLocation=this.getCurrentLocation(-1),this.entityDecoder=new EntityDecoder(htmlDecodeTree,(e,t)=>{this.preprocessor.pos=this.entityStartPos+t-1,this._flushCodePointConsumedAsCharacterReference(e)},t.onParseError?{missingSemicolonAfterCharacterReference:()=>{this._err(ERR.missingSemicolonAfterCharacterReference,1)},absenceOfDigitsInNumericCharacterReference:e=>{this._err(ERR.absenceOfDigitsInNumericCharacterReference,this.entityStartPos-this.preprocessor.pos+e)},validateNumericCharacterReference:e=>{const t=function(e){return e===CODE_POINTS.NULL?ERR.nullCharacterReference:e>1114111?ERR.characterReferenceOutsideUnicodeRange:isSurrogate(e)?ERR.surrogateCharacterReference:isUndefinedCodePoint(e)?ERR.noncharacterCharacterReference:isControlCodePoint(e)||e===CODE_POINTS.CARRIAGE_RETURN?ERR.controlCharacterReference:null}(e);t&&this._err(t,1)}}:void 0)}_err(e,t=0){var n,r;null===(r=(n=this.handler).onParseError)||void 0===r||r.call(n,this.preprocessor.getError(e,t))}getCurrentLocation(e){return this.options.sourceCodeLocationInfo?{startLine:this.preprocessor.line,startCol:this.preprocessor.col-e,startOffset:this.preprocessor.offset-e,endLine:-1,endCol:-1,endOffset:-1}:null}_runParsingLoop(){if(!this.inLoop){for(this.inLoop=!0;this.active&&!this.paused;){this.consumedAfterSnapshot=0;const e=this._consume();this._ensureHibernation()||this._callState(e)}this.inLoop=!1}}pause(){this.paused=!0}resume(e){if(!this.paused)throw new Error("Parser was already resumed");this.paused=!1,this.inLoop||(this._runParsingLoop(),this.paused||null==e||e())}write(e,t,n){this.active=!0,this.preprocessor.write(e,t),this._runParsingLoop(),this.paused||null==n||n()}insertHtmlAtCurrentPos(e){this.active=!0,this.preprocessor.insertHtmlAtCurrentPos(e),this._runParsingLoop()}_ensureHibernation(){return!!this.preprocessor.endOfChunkHit&&(this.preprocessor.retreat(this.consumedAfterSnapshot),this.consumedAfterSnapshot=0,this.active=!1,!0)}_consume(){return this.consumedAfterSnapshot++,this.preprocessor.advance()}_advanceBy(e){this.consumedAfterSnapshot+=e;for(let t=0;t<e;t++)this.preprocessor.advance()}_consumeSequenceIfMatch(e,t){return!!this.preprocessor.startsWith(e,t)&&(this._advanceBy(e.length-1),!0)}_createStartTagToken(){this.currentToken={type:TokenType.START_TAG,tagName:"",tagID:TAG_ID.UNKNOWN,selfClosing:!1,ackSelfClosing:!1,attrs:[],location:this.getCurrentLocation(1)}}_createEndTagToken(){this.currentToken={type:TokenType.END_TAG,tagName:"",tagID:TAG_ID.UNKNOWN,selfClosing:!1,ackSelfClosing:!1,attrs:[],location:this.getCurrentLocation(2)}}_createCommentToken(e){this.currentToken={type:TokenType.COMMENT,data:"",location:this.getCurrentLocation(e)}}_createDoctypeToken(e){this.currentToken={type:TokenType.DOCTYPE,name:e,forceQuirks:!1,publicId:null,systemId:null,location:this.currentLocation}}_createCharacterToken(e,t){this.currentCharacterToken={type:e,chars:t,location:this.currentLocation}}_createAttr(e){this.currentAttr={name:e,value:""},this.currentLocation=this.getCurrentLocation(0)}_leaveAttrName(){var e,t;const n=this.currentToken;null===getTokenAttr(n,this.currentAttr.name)?(n.attrs.push(this.currentAttr),n.location&&this.currentLocation&&((null!==(e=(t=n.location).attrs)&&void 0!==e?e:t.attrs=Object.create(null))[this.currentAttr.name]=this.currentLocation,this._leaveAttrValue())):this._err(ERR.duplicateAttribute)}_leaveAttrValue(){this.currentLocation&&(this.currentLocation.endLine=this.preprocessor.line,this.currentLocation.endCol=this.preprocessor.col,this.currentLocation.endOffset=this.preprocessor.offset)}prepareToken(e){this._emitCurrentCharacterToken(e.location),this.currentToken=null,e.location&&(e.location.endLine=this.preprocessor.line,e.location.endCol=this.preprocessor.col+1,e.location.endOffset=this.preprocessor.offset+1),this.currentLocation=this.getCurrentLocation(-1)}emitCurrentTagToken(){const e=this.currentToken;this.prepareToken(e),e.tagID=getTagID(e.tagName),e.type===TokenType.START_TAG?(this.lastStartTagName=e.tagName,this.handler.onStartTag(e)):(e.attrs.length>0&&this._err(ERR.endTagWithAttributes),e.selfClosing&&this._err(ERR.endTagWithTrailingSolidus),this.handler.onEndTag(e)),this.preprocessor.dropParsedChunk()}emitCurrentComment(e){this.prepareToken(e),this.handler.onComment(e),this.preprocessor.dropParsedChunk()}emitCurrentDoctype(e){this.prepareToken(e),this.handler.onDoctype(e),this.preprocessor.dropParsedChunk()}_emitCurrentCharacterToken(e){if(this.currentCharacterToken){switch(e&&this.currentCharacterToken.location&&(this.currentCharacterToken.location.endLine=e.startLine,this.currentCharacterToken.location.endCol=e.startCol,this.currentCharacterToken.location.endOffset=e.startOffset),this.currentCharacterToken.type){case TokenType.CHARACTER:this.handler.onCharacter(this.currentCharacterToken);break;case TokenType.NULL_CHARACTER:this.handler.onNullCharacter(this.currentCharacterToken);break;case TokenType.WHITESPACE_CHARACTER:this.handler.onWhitespaceCharacter(this.currentCharacterToken)}this.currentCharacterToken=null}}_emitEOFToken(){const e=this.getCurrentLocation(0);e&&(e.endLine=e.startLine,e.endCol=e.startCol,e.endOffset=e.startOffset),this._emitCurrentCharacterToken(e),this.handler.onEof({type:TokenType.EOF,location:e}),this.active=!1}_appendCharToCurrentCharacterToken(e,t){if(this.currentCharacterToken){if(this.currentCharacterToken.type===e)return void(this.currentCharacterToken.chars+=t);this.currentLocation=this.getCurrentLocation(0),this._emitCurrentCharacterToken(this.currentLocation),this.preprocessor.dropParsedChunk()}this._createCharacterToken(e,t)}_emitCodePoint(e){const t=isWhitespace(e)?TokenType.WHITESPACE_CHARACTER:e===CODE_POINTS.NULL?TokenType.NULL_CHARACTER:TokenType.CHARACTER;this._appendCharToCurrentCharacterToken(t,String.fromCodePoint(e))}_emitChars(e){this._appendCharToCurrentCharacterToken(TokenType.CHARACTER,e)}_startCharacterReference(){this.returnState=this.state,this.state=State.CHARACTER_REFERENCE,this.entityStartPos=this.preprocessor.pos,this.entityDecoder.startEntity(this._isCharacterReferenceInAttribute()?DecodingMode.Attribute:DecodingMode.Legacy)}_isCharacterReferenceInAttribute(){return this.returnState===State.ATTRIBUTE_VALUE_DOUBLE_QUOTED||this.returnState===State.ATTRIBUTE_VALUE_SINGLE_QUOTED||this.returnState===State.ATTRIBUTE_VALUE_UNQUOTED}_flushCodePointConsumedAsCharacterReference(e){this._isCharacterReferenceInAttribute()?this.currentAttr.value+=String.fromCodePoint(e):this._emitCodePoint(e)}_callState(e){switch(this.state){case State.DATA:this._stateData(e);break;case State.RCDATA:this._stateRcdata(e);break;case State.RAWTEXT:this._stateRawtext(e);break;case State.SCRIPT_DATA:this._stateScriptData(e);break;case State.PLAINTEXT:this._statePlaintext(e);break;case State.TAG_OPEN:this._stateTagOpen(e);break;case State.END_TAG_OPEN:this._stateEndTagOpen(e);break;case State.TAG_NAME:this._stateTagName(e);break;case State.RCDATA_LESS_THAN_SIGN:this._stateRcdataLessThanSign(e);break;case State.RCDATA_END_TAG_OPEN:this._stateRcdataEndTagOpen(e);break;case State.RCDATA_END_TAG_NAME:this._stateRcdataEndTagName(e);break;case State.RAWTEXT_LESS_THAN_SIGN:this._stateRawtextLessThanSign(e);break;case State.RAWTEXT_END_TAG_OPEN:this._stateRawtextEndTagOpen(e);break;case State.RAWTEXT_END_TAG_NAME:this._stateRawtextEndTagName(e);break;case State.SCRIPT_DATA_LESS_THAN_SIGN:this._stateScriptDataLessThanSign(e);break;case State.SCRIPT_DATA_END_TAG_OPEN:this._stateScriptDataEndTagOpen(e);break;case State.SCRIPT_DATA_END_TAG_NAME:this._stateScriptDataEndTagName(e);break;case State.SCRIPT_DATA_ESCAPE_START:this._stateScriptDataEscapeStart(e);break;case State.SCRIPT_DATA_ESCAPE_START_DASH:this._stateScriptDataEscapeStartDash(e);break;case State.SCRIPT_DATA_ESCAPED:this._stateScriptDataEscaped(e);break;case State.SCRIPT_DATA_ESCAPED_DASH:this._stateScriptDataEscapedDash(e);break;case State.SCRIPT_DATA_ESCAPED_DASH_DASH:this._stateScriptDataEscapedDashDash(e);break;case State.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN:this._stateScriptDataEscapedLessThanSign(e);break;case State.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:this._stateScriptDataEscapedEndTagOpen(e);break;case State.SCRIPT_DATA_ESCAPED_END_TAG_NAME:this._stateScriptDataEscapedEndTagName(e);break;case State.SCRIPT_DATA_DOUBLE_ESCAPE_START:this._stateScriptDataDoubleEscapeStart(e);break;case State.SCRIPT_DATA_DOUBLE_ESCAPED:this._stateScriptDataDoubleEscaped(e);break;case State.SCRIPT_DATA_DOUBLE_ESCAPED_DASH:this._stateScriptDataDoubleEscapedDash(e);break;case State.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH:this._stateScriptDataDoubleEscapedDashDash(e);break;case State.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN:this._stateScriptDataDoubleEscapedLessThanSign(e);break;case State.SCRIPT_DATA_DOUBLE_ESCAPE_END:this._stateScriptDataDoubleEscapeEnd(e);break;case State.BEFORE_ATTRIBUTE_NAME:this._stateBeforeAttributeName(e);break;case State.ATTRIBUTE_NAME:this._stateAttributeName(e);break;case State.AFTER_ATTRIBUTE_NAME:this._stateAfterAttributeName(e);break;case State.BEFORE_ATTRIBUTE_VALUE:this._stateBeforeAttributeValue(e);break;case State.ATTRIBUTE_VALUE_DOUBLE_QUOTED:this._stateAttributeValueDoubleQuoted(e);break;case State.ATTRIBUTE_VALUE_SINGLE_QUOTED:this._stateAttributeValueSingleQuoted(e);break;case State.ATTRIBUTE_VALUE_UNQUOTED:this._stateAttributeValueUnquoted(e);break;case State.AFTER_ATTRIBUTE_VALUE_QUOTED:this._stateAfterAttributeValueQuoted(e);break;case State.SELF_CLOSING_START_TAG:this._stateSelfClosingStartTag(e);break;case State.BOGUS_COMMENT:this._stateBogusComment(e);break;case State.MARKUP_DECLARATION_OPEN:this._stateMarkupDeclarationOpen(e);break;case State.COMMENT_START:this._stateCommentStart(e);break;case State.COMMENT_START_DASH:this._stateCommentStartDash(e);break;case State.COMMENT:this._stateComment(e);break;case State.COMMENT_LESS_THAN_SIGN:this._stateCommentLessThanSign(e);break;case State.COMMENT_LESS_THAN_SIGN_BANG:this._stateCommentLessThanSignBang(e);break;case State.COMMENT_LESS_THAN_SIGN_BANG_DASH:this._stateCommentLessThanSignBangDash(e);break;case State.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:this._stateCommentLessThanSignBangDashDash(e);break;case State.COMMENT_END_DASH:this._stateCommentEndDash(e);break;case State.COMMENT_END:this._stateCommentEnd(e);break;case State.COMMENT_END_BANG:this._stateCommentEndBang(e);break;case State.DOCTYPE:this._stateDoctype(e);break;case State.BEFORE_DOCTYPE_NAME:this._stateBeforeDoctypeName(e);break;case State.DOCTYPE_NAME:this._stateDoctypeName(e);break;case State.AFTER_DOCTYPE_NAME:this._stateAfterDoctypeName(e);break;case State.AFTER_DOCTYPE_PUBLIC_KEYWORD:this._stateAfterDoctypePublicKeyword(e);break;case State.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER:this._stateBeforeDoctypePublicIdentifier(e);break;case State.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED:this._stateDoctypePublicIdentifierDoubleQuoted(e);break;case State.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED:this._stateDoctypePublicIdentifierSingleQuoted(e);break;case State.AFTER_DOCTYPE_PUBLIC_IDENTIFIER:this._stateAfterDoctypePublicIdentifier(e);break;case State.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS:this._stateBetweenDoctypePublicAndSystemIdentifiers(e);break;case State.AFTER_DOCTYPE_SYSTEM_KEYWORD:this._stateAfterDoctypeSystemKeyword(e);break;case State.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER:this._stateBeforeDoctypeSystemIdentifier(e);break;case State.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED:this._stateDoctypeSystemIdentifierDoubleQuoted(e);break;case State.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED:this._stateDoctypeSystemIdentifierSingleQuoted(e);break;case State.AFTER_DOCTYPE_SYSTEM_IDENTIFIER:this._stateAfterDoctypeSystemIdentifier(e);break;case State.BOGUS_DOCTYPE:this._stateBogusDoctype(e);break;case State.CDATA_SECTION:this._stateCdataSection(e);break;case State.CDATA_SECTION_BRACKET:this._stateCdataSectionBracket(e);break;case State.CDATA_SECTION_END:this._stateCdataSectionEnd(e);break;case State.CHARACTER_REFERENCE:this._stateCharacterReference();break;case State.AMBIGUOUS_AMPERSAND:this._stateAmbiguousAmpersand(e);break;default:throw new Error("Unknown state")}}_stateData(e){switch(e){case CODE_POINTS.LESS_THAN_SIGN:this.state=State.TAG_OPEN;break;case CODE_POINTS.AMPERSAND:this._startCharacterReference();break;case CODE_POINTS.NULL:this._err(ERR.unexpectedNullCharacter),this._emitCodePoint(e);break;case CODE_POINTS.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateRcdata(e){switch(e){case CODE_POINTS.AMPERSAND:this._startCharacterReference();break;case CODE_POINTS.LESS_THAN_SIGN:this.state=State.RCDATA_LESS_THAN_SIGN;break;case CODE_POINTS.NULL:this._err(ERR.unexpectedNullCharacter),this._emitChars("�");break;case CODE_POINTS.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateRawtext(e){switch(e){case CODE_POINTS.LESS_THAN_SIGN:this.state=State.RAWTEXT_LESS_THAN_SIGN;break;case CODE_POINTS.NULL:this._err(ERR.unexpectedNullCharacter),this._emitChars("�");break;case CODE_POINTS.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateScriptData(e){switch(e){case CODE_POINTS.LESS_THAN_SIGN:this.state=State.SCRIPT_DATA_LESS_THAN_SIGN;break;case CODE_POINTS.NULL:this._err(ERR.unexpectedNullCharacter),this._emitChars("�");break;case CODE_POINTS.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_statePlaintext(e){switch(e){case CODE_POINTS.NULL:this._err(ERR.unexpectedNullCharacter),this._emitChars("�");break;case CODE_POINTS.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateTagOpen(e){if(isAsciiLetter(e))this._createStartTagToken(),this.state=State.TAG_NAME,this._stateTagName(e);else switch(e){case CODE_POINTS.EXCLAMATION_MARK:this.state=State.MARKUP_DECLARATION_OPEN;break;case CODE_POINTS.SOLIDUS:this.state=State.END_TAG_OPEN;break;case CODE_POINTS.QUESTION_MARK:this._err(ERR.unexpectedQuestionMarkInsteadOfTagName),this._createCommentToken(1),this.state=State.BOGUS_COMMENT,this._stateBogusComment(e);break;case CODE_POINTS.EOF:this._err(ERR.eofBeforeTagName),this._emitChars("<"),this._emitEOFToken();break;default:this._err(ERR.invalidFirstCharacterOfTagName),this._emitChars("<"),this.state=State.DATA,this._stateData(e)}}_stateEndTagOpen(e){if(isAsciiLetter(e))this._createEndTagToken(),this.state=State.TAG_NAME,this._stateTagName(e);else switch(e){case CODE_POINTS.GREATER_THAN_SIGN:this._err(ERR.missingEndTagName),this.state=State.DATA;break;case CODE_POINTS.EOF:this._err(ERR.eofBeforeTagName),this._emitChars("</"),this._emitEOFToken();break;default:this._err(ERR.invalidFirstCharacterOfTagName),this._createCommentToken(2),this.state=State.BOGUS_COMMENT,this._stateBogusComment(e)}}_stateTagName(e){const t=this.currentToken;switch(e){case CODE_POINTS.SPACE:case CODE_POINTS.LINE_FEED:case CODE_POINTS.TABULATION:case CODE_POINTS.FORM_FEED:this.state=State.BEFORE_ATTRIBUTE_NAME;break;case CODE_POINTS.SOLIDUS:this.state=State.SELF_CLOSING_START_TAG;break;case CODE_POINTS.GREATER_THAN_SIGN:this.state=State.DATA,this.emitCurrentTagToken();break;case CODE_POINTS.NULL:this._err(ERR.unexpectedNullCharacter),t.tagName+="�";break;case CODE_POINTS.EOF:this._err(ERR.eofInTag),this._emitEOFToken();break;default:t.tagName+=String.fromCodePoint(isAsciiUpper(e)?toAsciiLower(e):e)}}_stateRcdataLessThanSign(e){e===CODE_POINTS.SOLIDUS?this.state=State.RCDATA_END_TAG_OPEN:(this._emitChars("<"),this.state=State.RCDATA,this._stateRcdata(e))}_stateRcdataEndTagOpen(e){isAsciiLetter(e)?(this.state=State.RCDATA_END_TAG_NAME,this._stateRcdataEndTagName(e)):(this._emitChars("</"),this.state=State.RCDATA,this._stateRcdata(e))}handleSpecialEndTag(e){if(!this.preprocessor.startsWith(this.lastStartTagName,!1))return!this._ensureHibernation();switch(this._createEndTagToken(),this.currentToken.tagName=this.lastStartTagName,this.preprocessor.peek(this.lastStartTagName.length)){case CODE_POINTS.SPACE:case CODE_POINTS.LINE_FEED:case CODE_POINTS.TABULATION:case CODE_POINTS.FORM_FEED:return this._advanceBy(this.lastStartTagName.length),this.state=State.BEFORE_ATTRIBUTE_NAME,!1;case CODE_POINTS.SOLIDUS:return this._advanceBy(this.lastStartTagName.length),this.state=State.SELF_CLOSING_START_TAG,!1;case CODE_POINTS.GREATER_THAN_SIGN:return this._advanceBy(this.lastStartTagName.length),this.emitCurrentTagToken(),this.state=State.DATA,!1;default:return!this._ensureHibernation()}}_stateRcdataEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars("</"),this.state=State.RCDATA,this._stateRcdata(e))}_stateRawtextLessThanSign(e){e===CODE_POINTS.SOLIDUS?this.state=State.RAWTEXT_END_TAG_OPEN:(this._emitChars("<"),this.state=State.RAWTEXT,this._stateRawtext(e))}_stateRawtextEndTagOpen(e){isAsciiLetter(e)?(this.state=State.RAWTEXT_END_TAG_NAME,this._stateRawtextEndTagName(e)):(this._emitChars("</"),this.state=State.RAWTEXT,this._stateRawtext(e))}_stateRawtextEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars("</"),this.state=State.RAWTEXT,this._stateRawtext(e))}_stateScriptDataLessThanSign(e){switch(e){case CODE_POINTS.SOLIDUS:this.state=State.SCRIPT_DATA_END_TAG_OPEN;break;case CODE_POINTS.EXCLAMATION_MARK:this.state=State.SCRIPT_DATA_ESCAPE_START,this._emitChars("<!");break;default:this._emitChars("<"),this.state=State.SCRIPT_DATA,this._stateScriptData(e)}}_stateScriptDataEndTagOpen(e){isAsciiLetter(e)?(this.state=State.SCRIPT_DATA_END_TAG_NAME,this._stateScriptDataEndTagName(e)):(this._emitChars("</"),this.state=State.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars("</"),this.state=State.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEscapeStart(e){e===CODE_POINTS.HYPHEN_MINUS?(this.state=State.SCRIPT_DATA_ESCAPE_START_DASH,this._emitChars("-")):(this.state=State.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEscapeStartDash(e){e===CODE_POINTS.HYPHEN_MINUS?(this.state=State.SCRIPT_DATA_ESCAPED_DASH_DASH,this._emitChars("-")):(this.state=State.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEscaped(e){switch(e){case CODE_POINTS.HYPHEN_MINUS:this.state=State.SCRIPT_DATA_ESCAPED_DASH,this._emitChars("-");break;case CODE_POINTS.LESS_THAN_SIGN:this.state=State.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break;case CODE_POINTS.NULL:this._err(ERR.unexpectedNullCharacter),this._emitChars("�");break;case CODE_POINTS.EOF:this._err(ERR.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateScriptDataEscapedDash(e){switch(e){case CODE_POINTS.HYPHEN_MINUS:this.state=State.SCRIPT_DATA_ESCAPED_DASH_DASH,this._emitChars("-");break;case CODE_POINTS.LESS_THAN_SIGN:this.state=State.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break;case CODE_POINTS.NULL:this._err(ERR.unexpectedNullCharacter),this.state=State.SCRIPT_DATA_ESCAPED,this._emitChars("�");break;case CODE_POINTS.EOF:this._err(ERR.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this.state=State.SCRIPT_DATA_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataEscapedDashDash(e){switch(e){case CODE_POINTS.HYPHEN_MINUS:this._emitChars("-");break;case CODE_POINTS.LESS_THAN_SIGN:this.state=State.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break;case CODE_POINTS.GREATER_THAN_SIGN:this.state=State.SCRIPT_DATA,this._emitChars(">");break;case CODE_POINTS.NULL:this._err(ERR.unexpectedNullCharacter),this.state=State.SCRIPT_DATA_ESCAPED,this._emitChars("�");break;case CODE_POINTS.EOF:this._err(ERR.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this.state=State.SCRIPT_DATA_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataEscapedLessThanSign(e){e===CODE_POINTS.SOLIDUS?this.state=State.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:isAsciiLetter(e)?(this._emitChars("<"),this.state=State.SCRIPT_DATA_DOUBLE_ESCAPE_START,this._stateScriptDataDoubleEscapeStart(e)):(this._emitChars("<"),this.state=State.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataEscapedEndTagOpen(e){isAsciiLetter(e)?(this.state=State.SCRIPT_DATA_ESCAPED_END_TAG_NAME,this._stateScriptDataEscapedEndTagName(e)):(this._emitChars("</"),this.state=State.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataEscapedEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars("</"),this.state=State.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataDoubleEscapeStart(e){if(this.preprocessor.startsWith("script",!1)&&isScriptDataDoubleEscapeSequenceEnd(this.preprocessor.peek(6))){this._emitCodePoint(e);for(let e=0;e<6;e++)this._emitCodePoint(this._consume());this.state=State.SCRIPT_DATA_DOUBLE_ESCAPED}else this._ensureHibernation()||(this.state=State.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataDoubleEscaped(e){switch(e){case CODE_POINTS.HYPHEN_MINUS:this.state=State.SCRIPT_DATA_DOUBLE_ESCAPED_DASH,this._emitChars("-");break;case CODE_POINTS.LESS_THAN_SIGN:this.state=State.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break;case CODE_POINTS.NULL:this._err(ERR.unexpectedNullCharacter),this._emitChars("�");break;case CODE_POINTS.EOF:this._err(ERR.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateScriptDataDoubleEscapedDash(e){switch(e){case CODE_POINTS.HYPHEN_MINUS:this.state=State.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH,this._emitChars("-");break;case CODE_POINTS.LESS_THAN_SIGN:this.state=State.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break;case CODE_POINTS.NULL:this._err(ERR.unexpectedNullCharacter),this.state=State.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars("�");break;case CODE_POINTS.EOF:this._err(ERR.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this.state=State.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataDoubleEscapedDashDash(e){switch(e){case CODE_POINTS.HYPHEN_MINUS:this._emitChars("-");break;case CODE_POINTS.LESS_THAN_SIGN:this.state=State.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break;case CODE_POINTS.GREATER_THAN_SIGN:this.state=State.SCRIPT_DATA,this._emitChars(">");break;case CODE_POINTS.NULL:this._err(ERR.unexpectedNullCharacter),this.state=State.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars("�");break;case CODE_POINTS.EOF:this._err(ERR.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this.state=State.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataDoubleEscapedLessThanSign(e){e===CODE_POINTS.SOLIDUS?(this.state=State.SCRIPT_DATA_DOUBLE_ESCAPE_END,this._emitChars("/")):(this.state=State.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(e))}_stateScriptDataDoubleEscapeEnd(e){if(this.preprocessor.startsWith("script",!1)&&isScriptDataDoubleEscapeSequenceEnd(this.preprocessor.peek(6))){this._emitCodePoint(e);for(let e=0;e<6;e++)this._emitCodePoint(this._consume());this.state=State.SCRIPT_DATA_ESCAPED}else this._ensureHibernation()||(this.state=State.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(e))}_stateBeforeAttributeName(e){switch(e){case CODE_POINTS.SPACE:case CODE_POINTS.LINE_FEED:case CODE_POINTS.TABULATION:case CODE_POINTS.FORM_FEED:break;case CODE_POINTS.SOLIDUS:case CODE_POINTS.GREATER_THAN_SIGN:case CODE_POINTS.EOF:this.state=State.AFTER_ATTRIBUTE_NAME,this._stateAfterAttributeName(e);break;case CODE_POINTS.EQUALS_SIGN:this._err(ERR.unexpectedEqualsSignBeforeAttributeName),this._createAttr("="),this.state=State.ATTRIBUTE_NAME;break;default:this._createAttr(""),this.state=State.ATTRIBUTE_NAME,this._stateAttributeName(e)}}_stateAttributeName(e){switch(e){case CODE_POINTS.SPACE:case CODE_POINTS.LINE_FEED:case CODE_POINTS.TABULATION:case CODE_POINTS.FORM_FEED:case CODE_POINTS.SOLIDUS:case CODE_POINTS.GREATER_THAN_SIGN:case CODE_POINTS.EOF:this._leaveAttrName(),this.state=State.AFTER_ATTRIBUTE_NAME,this._stateAfterAttributeName(e);break;case CODE_POINTS.EQUALS_SIGN:this._leaveAttrName(),this.state=State.BEFORE_ATTRIBUTE_VALUE;break;case CODE_POINTS.QUOTATION_MARK:case CODE_POINTS.APOSTROPHE:case CODE_POINTS.LESS_THAN_SIGN:this._err(ERR.unexpectedCharacterInAttributeName),this.currentAttr.name+=String.fromCodePoint(e);break;case CODE_POINTS.NULL:this._err(ERR.unexpectedNullCharacter),this.currentAttr.name+="�";break;default:this.currentAttr.name+=String.fromCodePoint(isAsciiUpper(e)?toAsciiLower(e):e)}}_stateAfterAttributeName(e){switch(e){case CODE_POINTS.SPACE:case CODE_POINTS.LINE_FEED:case CODE_POINTS.TABULATION:case CODE_POINTS.FORM_FEED:break;case CODE_POINTS.SOLIDUS:this.state=State.SELF_CLOSING_START_TAG;break;case CODE_POINTS.EQUALS_SIGN:this.state=State.BEFORE_ATTRIBUTE_VALUE;break;case CODE_POINTS.GREATER_THAN_SIGN:this.state=State.DATA,this.emitCurrentTagToken();break;case CODE_POINTS.EOF:this._err(ERR.eofInTag),this._emitEOFToken();break;default:this._createAttr(""),this.state=State.ATTRIBUTE_NAME,this._stateAttributeName(e)}}_stateBeforeAttributeValue(e){switch(e){case CODE_POINTS.SPACE:case CODE_POINTS.LINE_FEED:case CODE_POINTS.TABULATION:case CODE_POINTS.FORM_FEED:break;case CODE_POINTS.QUOTATION_MARK:this.state=State.ATTRIBUTE_VALUE_DOUBLE_QUOTED;break;case CODE_POINTS.APOSTROPHE:this.state=State.ATTRIBUTE_VALUE_SINGLE_QUOTED;break;case CODE_POINTS.GREATER_THAN_SIGN:this._err(ERR.missingAttributeValue),this.state=State.DATA,this.emitCurrentTagToken();break;default:this.state=State.ATTRIBUTE_VALUE_UNQUOTED,this._stateAttributeValueUnquoted(e)}}_stateAttributeValueDoubleQuoted(e){switch(e){case CODE_POINTS.QUOTATION_MARK:this.state=State.AFTER_ATTRIBUTE_VALUE_QUOTED;break;case CODE_POINTS.AMPERSAND:this._startCharacterReference();break;case CODE_POINTS.NULL:this._err(ERR.unexpectedNullCharacter),this.currentAttr.value+="�";break;case CODE_POINTS.EOF:this._err(ERR.eofInTag),this._emitEOFToken();break;default:this.currentAttr.value+=String.fromCodePoint(e)}}_stateAttributeValueSingleQuoted(e){switch(e){case CODE_POINTS.APOSTROPHE:this.state=State.AFTER_ATTRIBUTE_VALUE_QUOTED;break;case CODE_POINTS.AMPERSAND:this._startCharacterReference();break;case CODE_POINTS.NULL:this._err(ERR.unexpectedNullCharacter),this.currentAttr.value+="�";break;case CODE_POINTS.EOF:this._err(ERR.eofInTag),this._emitEOFToken();break;default:this.currentAttr.value+=String.fromCodePoint(e)}}_stateAttributeValueUnquoted(e){switch(e){case CODE_POINTS.SPACE:case CODE_POINTS.LINE_FEED:case CODE_POINTS.TABULATION:case CODE_POINTS.FORM_FEED:this._leaveAttrValue(),this.state=State.BEFORE_ATTRIBUTE_NAME;break;case CODE_POINTS.AMPERSAND:this._startCharacterReference();break;case CODE_POINTS.GREATER_THAN_SIGN:this._leaveAttrValue(),this.state=State.DATA,this.emitCurrentTagToken();break;case CODE_POINTS.NULL:this._err(ERR.unexpectedNullCharacter),this.currentAttr.value+="�";break;case CODE_POINTS.QUOTATION_MARK:case CODE_POINTS.APOSTROPHE:case CODE_POINTS.LESS_THAN_SIGN:case CODE_POINTS.EQUALS_SIGN:case CODE_POINTS.GRAVE_ACCENT:this._err(ERR.unexpectedCharacterInUnquotedAttributeValue),this.currentAttr.value+=String.fromCodePoint(e);break;case CODE_POINTS.EOF:this._err(ERR.eofInTag),this._emitEOFToken();break;default:this.currentAttr.value+=String.fromCodePoint(e)}}_stateAfterAttributeValueQuoted(e){switch(e){case CODE_POINTS.SPACE:case CODE_POINTS.LINE_FEED:case CODE_POINTS.TABULATION:case CODE_POINTS.FORM_FEED:this._leaveAttrValue(),this.state=State.BEFORE_ATTRIBUTE_NAME;break;case CODE_POINTS.SOLIDUS:this._leaveAttrValue(),this.state=State.SELF_CLOSING_START_TAG;break;case CODE_POINTS.GREATER_THAN_SIGN:this._leaveAttrValue(),this.state=State.DATA,this.emitCurrentTagToken();break;case CODE_POINTS.EOF:this._err(ERR.eofInTag),this._emitEOFToken();break;default:this._err(ERR.missingWhitespaceBetweenAttributes),this.state=State.BEFORE_ATTRIBUTE_NAME,this._stateBeforeAttributeName(e)}}_stateSelfClosingStartTag(e){switch(e){case CODE_POINTS.GREATER_THAN_SIGN:this.currentToken.selfClosing=!0,this.state=State.DATA,this.emitCurrentTagToken();break;case CODE_POINTS.EOF:this._err(ERR.eofInTag),this._emitEOFToken();break;default:this._err(ERR.unexpectedSolidusInTag),this.state=State.BEFORE_ATTRIBUTE_NAME,this._stateBeforeAttributeName(e)}}_stateBogusComment(e){const t=this.currentToken;switch(e){case CODE_POINTS.GREATER_THAN_SIGN:this.state=State.DATA,this.emitCurrentComment(t);break;case CODE_POINTS.EOF:this.emitCurrentComment(t),this._emitEOFToken();break;case CODE_POINTS.NULL:this._err(ERR.unexpectedNullCharacter),t.data+="�";break;default:t.data+=String.fromCodePoint(e)}}_stateMarkupDeclarationOpen(e){this._consumeSequenceIfMatch("--",!0)?(this._createCommentToken(3),this.state=State.COMMENT_START):this._consumeSequenceIfMatch("doctype",!1)?(this.currentLocation=this.getCurrentLocation(8),this.state=State.DOCTYPE):this._consumeSequenceIfMatch("[CDATA[",!0)?this.inForeignNode?this.state=State.CDATA_SECTION:(this._err(ERR.cdataInHtmlContent),this._createCommentToken(8),this.currentToken.data="[CDATA[",this.state=State.BOGUS_COMMENT):this._ensureHibernation()||(this._err(ERR.incorrectlyOpenedComment),this._createCommentToken(2),this.state=State.BOGUS_COMMENT,this._stateBogusComment(e))}_stateCommentStart(e){switch(e){case CODE_POINTS.HYPHEN_MINUS:this.state=State.COMMENT_START_DASH;break;case CODE_POINTS.GREATER_THAN_SIGN:{this._err(ERR.abruptClosingOfEmptyComment),this.state=State.DATA;const e=this.currentToken;this.emitCurrentComment(e);break}default:this.state=State.COMMENT,this._stateComment(e)}}_stateCommentStartDash(e){const t=this.currentToken;switch(e){case CODE_POINTS.HYPHEN_MINUS:this.state=State.COMMENT_END;break;case CODE_POINTS.GREATER_THAN_SIGN:this._err(ERR.abruptClosingOfEmptyComment),this.state=State.DATA,this.emitCurrentComment(t);break;case CODE_POINTS.EOF:this._err(ERR.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break;default:t.data+="-",this.state=State.COMMENT,this._stateComment(e)}}_stateComment(e){const t=this.currentToken;switch(e){case CODE_POINTS.HYPHEN_MINUS:this.state=State.COMMENT_END_DASH;break;case CODE_POINTS.LESS_THAN_SIGN:t.data+="<",this.state=State.COMMENT_LESS_THAN_SIGN;break;case CODE_POINTS.NULL:this._err(ERR.unexpectedNullCharacter),t.data+="�";break;case CODE_POINTS.EOF:this._err(ERR.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break;default:t.data+=String.fromCodePoint(e)}}_stateCommentLessThanSign(e){const t=this.currentToken;switch(e){case CODE_POINTS.EXCLAMATION_MARK:t.data+="!",this.state=State.COMMENT_LESS_THAN_SIGN_BANG;break;case CODE_POINTS.LESS_THAN_SIGN:t.data+="<";break;default:this.state=State.COMMENT,this._stateComment(e)}}_stateCommentLessThanSignBang(e){e===CODE_POINTS.HYPHEN_MINUS?this.state=State.COMMENT_LESS_THAN_SIGN_BANG_DASH:(this.state=State.COMMENT,this._stateComment(e))}_stateCommentLessThanSignBangDash(e){e===CODE_POINTS.HYPHEN_MINUS?this.state=State.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:(this.state=State.COMMENT_END_DASH,this._stateCommentEndDash(e))}_stateCommentLessThanSignBangDashDash(e){e!==CODE_POINTS.GREATER_THAN_SIGN&&e!==CODE_POINTS.EOF&&this._err(ERR.nestedComment),this.state=State.COMMENT_END,this._stateCommentEnd(e)}_stateCommentEndDash(e){const t=this.currentToken;switch(e){case CODE_POINTS.HYPHEN_MINUS:this.state=State.COMMENT_END;break;case CODE_POINTS.EOF:this._err(ERR.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break;default:t.data+="-",this.state=State.COMMENT,this._stateComment(e)}}_stateCommentEnd(e){const t=this.currentToken;switch(e){case CODE_POINTS.GREATER_THAN_SIGN:this.state=State.DATA,this.emitCurrentComment(t);break;case CODE_POINTS.EXCLAMATION_MARK:this.state=State.COMMENT_END_BANG;break;case CODE_POINTS.HYPHEN_MINUS:t.data+="-";break;case CODE_POINTS.EOF:this._err(ERR.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break;default:t.data+="--",this.state=State.COMMENT,this._stateComment(e)}}_stateCommentEndBang(e){const t=this.currentToken;switch(e){case CODE_POINTS.HYPHEN_MINUS:t.data+="--!",this.state=State.COMMENT_END_DASH;break;case CODE_POINTS.GREATER_THAN_SIGN:this._err(ERR.incorrectlyClosedComment),this.state=State.DATA,this.emitCurrentComment(t);break;case CODE_POINTS.EOF:this._err(ERR.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break;default:t.data+="--!",this.state=State.COMMENT,this._stateComment(e)}}_stateDoctype(e){switch(e){case CODE_POINTS.SPACE:case CODE_POINTS.LINE_FEED:case CODE_POINTS.TABULATION:case CODE_POINTS.FORM_FEED:this.state=State.BEFORE_DOCTYPE_NAME;break;case CODE_POINTS.GREATER_THAN_SIGN:this.state=State.BEFORE_DOCTYPE_NAME,this._stateBeforeDoctypeName(e);break;case CODE_POINTS.EOF:{this._err(ERR.eofInDoctype),this._createDoctypeToken(null);const e=this.currentToken;e.forceQuirks=!0,this.emitCurrentDoctype(e),this._emitEOFToken();break}default:this._err(ERR.missingWhitespaceBeforeDoctypeName),this.state=State.BEFORE_DOCTYPE_NAME,this._stateBeforeDoctypeName(e)}}_stateBeforeDoctypeName(e){if(isAsciiUpper(e))this._createDoctypeToken(String.fromCharCode(toAsciiLower(e))),this.state=State.DOCTYPE_NAME;else switch(e){case CODE_POINTS.SPACE:case CODE_POINTS.LINE_FEED:case CODE_POINTS.TABULATION:case CODE_POINTS.FORM_FEED:break;case CODE_POINTS.NULL:this._err(ERR.unexpectedNullCharacter),this._createDoctypeToken("�"),this.state=State.DOCTYPE_NAME;break;case CODE_POINTS.GREATER_THAN_SIGN:{this._err(ERR.missingDoctypeName),this._createDoctypeToken(null);const e=this.currentToken;e.forceQuirks=!0,this.emitCurrentDoctype(e),this.state=State.DATA;break}case CODE_POINTS.EOF:{this._err(ERR.eofInDoctype),this._createDoctypeToken(null);const e=this.currentToken;e.forceQuirks=!0,this.emitCurrentDoctype(e),this._emitEOFToken();break}default:this._createDoctypeToken(String.fromCodePoint(e)),this.state=State.DOCTYPE_NAME}}_stateDoctypeName(e){const t=this.currentToken;switch(e){case CODE_POINTS.SPACE:case CODE_POINTS.LINE_FEED:case CODE_POINTS.TABULATION:case CODE_POINTS.FORM_FEED:this.state=State.AFTER_DOCTYPE_NAME;break;case CODE_POINTS.GREATER_THAN_SIGN:this.state=State.DATA,this.emitCurrentDoctype(t);break;case CODE_POINTS.NULL:this._err(ERR.unexpectedNullCharacter),t.name+="�";break;case CODE_POINTS.EOF:this._err(ERR.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:t.name+=String.fromCodePoint(isAsciiUpper(e)?toAsciiLower(e):e)}}_stateAfterDoctypeName(e){const t=this.currentToken;switch(e){case CODE_POINTS.SPACE:case CODE_POINTS.LINE_FEED:case CODE_POINTS.TABULATION:case CODE_POINTS.FORM_FEED:break;case CODE_POINTS.GREATER_THAN_SIGN:this.state=State.DATA,this.emitCurrentDoctype(t);break;case CODE_POINTS.EOF:this._err(ERR.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._consumeSequenceIfMatch("public",!1)?this.state=State.AFTER_DOCTYPE_PUBLIC_KEYWORD:this._consumeSequenceIfMatch("system",!1)?this.state=State.AFTER_DOCTYPE_SYSTEM_KEYWORD:this._ensureHibernation()||(this._err(ERR.invalidCharacterSequenceAfterDoctypeName),t.forceQuirks=!0,this.state=State.BOGUS_DOCTYPE,this._stateBogusDoctype(e))}}_stateAfterDoctypePublicKeyword(e){const t=this.currentToken;switch(e){case CODE_POINTS.SPACE:case CODE_POINTS.LINE_FEED:case CODE_POINTS.TABULATION:case CODE_POINTS.FORM_FEED:this.state=State.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER;break;case CODE_POINTS.QUOTATION_MARK:this._err(ERR.missingWhitespaceAfterDoctypePublicKeyword),t.publicId="",this.state=State.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;break;case CODE_POINTS.APOSTROPHE:this._err(ERR.missingWhitespaceAfterDoctypePublicKeyword),t.publicId="",this.state=State.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;break;case CODE_POINTS.GREATER_THAN_SIGN:this._err(ERR.missingDoctypePublicIdentifier),t.forceQuirks=!0,this.state=State.DATA,this.emitCurrentDoctype(t);break;case CODE_POINTS.EOF:this._err(ERR.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(ERR.missingQuoteBeforeDoctypePublicIdentifier),t.forceQuirks=!0,this.state=State.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBeforeDoctypePublicIdentifier(e){const t=this.currentToken;switch(e){case CODE_POINTS.SPACE:case CODE_POINTS.LINE_FEED:case CODE_POINTS.TABULATION:case CODE_POINTS.FORM_FEED:break;case CODE_POINTS.QUOTATION_MARK:t.publicId="",this.state=State.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;break;case CODE_POINTS.APOSTROPHE:t.publicId="",this.state=State.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;break;case CODE_POINTS.GREATER_THAN_SIGN:this._err(ERR.missingDoctypePublicIdentifier),t.forceQuirks=!0,this.state=State.DATA,this.emitCurrentDoctype(t);break;case CODE_POINTS.EOF:this._err(ERR.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(ERR.missingQuoteBeforeDoctypePublicIdentifier),t.forceQuirks=!0,this.state=State.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateDoctypePublicIdentifierDoubleQuoted(e){const t=this.currentToken;switch(e){case CODE_POINTS.QUOTATION_MARK:this.state=State.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;break;case CODE_POINTS.NULL:this._err(ERR.unexpectedNullCharacter),t.publicId+="�";break;case CODE_POINTS.GREATER_THAN_SIGN:this._err(ERR.abruptDoctypePublicIdentifier),t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=State.DATA;break;case CODE_POINTS.EOF:this._err(ERR.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:t.publicId+=String.fromCodePoint(e)}}_stateDoctypePublicIdentifierSingleQuoted(e){const t=this.currentToken;switch(e){case CODE_POINTS.APOSTROPHE:this.state=State.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;break;case CODE_POINTS.NULL:this._err(ERR.unexpectedNullCharacter),t.publicId+="�";break;case CODE_POINTS.GREATER_THAN_SIGN:this._err(ERR.abruptDoctypePublicIdentifier),t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=State.DATA;break;case CODE_POINTS.EOF:this._err(ERR.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:t.publicId+=String.fromCodePoint(e)}}_stateAfterDoctypePublicIdentifier(e){const t=this.currentToken;switch(e){case CODE_POINTS.SPACE:case CODE_POINTS.LINE_FEED:case CODE_POINTS.TABULATION:case CODE_POINTS.FORM_FEED:this.state=State.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS;break;case CODE_POINTS.GREATER_THAN_SIGN:this.state=State.DATA,this.emitCurrentDoctype(t);break;case CODE_POINTS.QUOTATION_MARK:this._err(ERR.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),t.systemId="",this.state=State.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break;case CODE_POINTS.APOSTROPHE:this._err(ERR.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),t.systemId="",this.state=State.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break;case CODE_POINTS.EOF:this._err(ERR.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(ERR.missingQuoteBeforeDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=State.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBetweenDoctypePublicAndSystemIdentifiers(e){const t=this.currentToken;switch(e){case CODE_POINTS.SPACE:case CODE_POINTS.LINE_FEED:case CODE_POINTS.TABULATION:case CODE_POINTS.FORM_FEED:break;case CODE_POINTS.GREATER_THAN_SIGN:this.emitCurrentDoctype(t),this.state=State.DATA;break;case CODE_POINTS.QUOTATION_MARK:t.systemId="",this.state=State.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break;case CODE_POINTS.APOSTROPHE:t.systemId="",this.state=State.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break;case CODE_POINTS.EOF:this._err(ERR.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(ERR.missingQuoteBeforeDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=State.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateAfterDoctypeSystemKeyword(e){const t=this.currentToken;switch(e){case CODE_POINTS.SPACE:case CODE_POINTS.LINE_FEED:case CODE_POINTS.TABULATION:case CODE_POINTS.FORM_FEED:this.state=State.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER;break;case CODE_POINTS.QUOTATION_MARK:this._err(ERR.missingWhitespaceAfterDoctypeSystemKeyword),t.systemId="",this.state=State.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break;case CODE_POINTS.APOSTROPHE:this._err(ERR.missingWhitespaceAfterDoctypeSystemKeyword),t.systemId="",this.state=State.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break;case CODE_POINTS.GREATER_THAN_SIGN:this._err(ERR.missingDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=State.DATA,this.emitCurrentDoctype(t);break;case CODE_POINTS.EOF:this._err(ERR.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(ERR.missingQuoteBeforeDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=State.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBeforeDoctypeSystemIdentifier(e){const t=this.currentToken;switch(e){case CODE_POINTS.SPACE:case CODE_POINTS.LINE_FEED:case CODE_POINTS.TABULATION:case CODE_POINTS.FORM_FEED:break;case CODE_POINTS.QUOTATION_MARK:t.systemId="",this.state=State.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break;case CODE_POINTS.APOSTROPHE:t.systemId="",this.state=State.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break;case CODE_POINTS.GREATER_THAN_SIGN:this._err(ERR.missingDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=State.DATA,this.emitCurrentDoctype(t);break;case CODE_POINTS.EOF:this._err(ERR.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(ERR.missingQuoteBeforeDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=State.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateDoctypeSystemIdentifierDoubleQuoted(e){const t=this.currentToken;switch(e){case CODE_POINTS.QUOTATION_MARK:this.state=State.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;break;case CODE_POINTS.NULL:this._err(ERR.unexpectedNullCharacter),t.systemId+="�";break;case CODE_POINTS.GREATER_THAN_SIGN:this._err(ERR.abruptDoctypeSystemIdentifier),t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=State.DATA;break;case CODE_POINTS.EOF:this._err(ERR.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:t.systemId+=String.fromCodePoint(e)}}_stateDoctypeSystemIdentifierSingleQuoted(e){const t=this.currentToken;switch(e){case CODE_POINTS.APOSTROPHE:this.state=State.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;break;case CODE_POINTS.NULL:this._err(ERR.unexpectedNullCharacter),t.systemId+="�";break;case CODE_POINTS.GREATER_THAN_SIGN:this._err(ERR.abruptDoctypeSystemIdentifier),t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=State.DATA;break;case CODE_POINTS.EOF:this._err(ERR.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:t.systemId+=String.fromCodePoint(e)}}_stateAfterDoctypeSystemIdentifier(e){const t=this.currentToken;switch(e){case CODE_POINTS.SPACE:case CODE_POINTS.LINE_FEED:case CODE_POINTS.TABULATION:case CODE_POINTS.FORM_FEED:break;case CODE_POINTS.GREATER_THAN_SIGN:this.emitCurrentDoctype(t),this.state=State.DATA;break;case CODE_POINTS.EOF:this._err(ERR.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(ERR.unexpectedCharacterAfterDoctypeSystemIdentifier),this.state=State.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBogusDoctype(e){const t=this.currentToken;switch(e){case CODE_POINTS.GREATER_THAN_SIGN:this.emitCurrentDoctype(t),this.state=State.DATA;break;case CODE_POINTS.NULL:this._err(ERR.unexpectedNullCharacter);break;case CODE_POINTS.EOF:this.emitCurrentDoctype(t),this._emitEOFToken()}}_stateCdataSection(e){switch(e){case CODE_POINTS.RIGHT_SQUARE_BRACKET:this.state=State.CDATA_SECTION_BRACKET;break;case CODE_POINTS.EOF:this._err(ERR.eofInCdata),this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateCdataSectionBracket(e){e===CODE_POINTS.RIGHT_SQUARE_BRACKET?this.state=State.CDATA_SECTION_END:(this._emitChars("]"),this.state=State.CDATA_SECTION,this._stateCdataSection(e))}_stateCdataSectionEnd(e){switch(e){case CODE_POINTS.GREATER_THAN_SIGN:this.state=State.DATA;break;case CODE_POINTS.RIGHT_SQUARE_BRACKET:this._emitChars("]");break;default:this._emitChars("]]"),this.state=State.CDATA_SECTION,this._stateCdataSection(e)}}_stateCharacterReference(){let e=this.entityDecoder.write(this.preprocessor.html,this.preprocessor.pos);if(e<0){if(!this.preprocessor.lastChunkWritten)return this.active=!1,this.preprocessor.pos=this.preprocessor.html.length-1,this.consumedAfterSnapshot=0,void(this.preprocessor.endOfChunkHit=!0);e=this.entityDecoder.end()}0===e?(this.preprocessor.pos=this.entityStartPos,this._flushCodePointConsumedAsCharacterReference(CODE_POINTS.AMPERSAND),this.state=!this._isCharacterReferenceInAttribute()&&isAsciiAlphaNumeric2(this.preprocessor.peek(1))?State.AMBIGUOUS_AMPERSAND:this.returnState):this.state=this.returnState}_stateAmbiguousAmpersand(e){isAsciiAlphaNumeric2(e)?this._flushCodePointConsumedAsCharacterReference(e):(e===CODE_POINTS.SEMICOLON&&this._err(ERR.unknownNamedCharacterReference),this.state=this.returnState,this._callState(e))}},IMPLICIT_END_TAG_REQUIRED=new Set([TAG_ID.DD,TAG_ID.DT,TAG_ID.LI,TAG_ID.OPTGROUP,TAG_ID.OPTION,TAG_ID.P,TAG_ID.RB,TAG_ID.RP,TAG_ID.RT,TAG_ID.RTC]),IMPLICIT_END_TAG_REQUIRED_THOROUGHLY=new Set([...IMPLICIT_END_TAG_REQUIRED,TAG_ID.CAPTION,TAG_ID.COLGROUP,TAG_ID.TBODY,TAG_ID.TD,TAG_ID.TFOOT,TAG_ID.TH,TAG_ID.THEAD,TAG_ID.TR]),SCOPING_ELEMENTS_HTML=new Set([TAG_ID.APPLET,TAG_ID.CAPTION,TAG_ID.HTML,TAG_ID.MARQUEE,TAG_ID.OBJECT,TAG_ID.TABLE,TAG_ID.TD,TAG_ID.TEMPLATE,TAG_ID.TH]),SCOPING_ELEMENTS_HTML_LIST=new Set([...SCOPING_ELEMENTS_HTML,TAG_ID.OL,TAG_ID.UL]),SCOPING_ELEMENTS_HTML_BUTTON=new Set([...SCOPING_ELEMENTS_HTML,TAG_ID.BUTTON]),SCOPING_ELEMENTS_MATHML=new Set([TAG_ID.ANNOTATION_XML,TAG_ID.MI,TAG_ID.MN,TAG_ID.MO,TAG_ID.MS,TAG_ID.MTEXT]),SCOPING_ELEMENTS_SVG=new Set([TAG_ID.DESC,TAG_ID.FOREIGN_OBJECT,TAG_ID.TITLE]),TABLE_ROW_CONTEXT=new Set([TAG_ID.TR,TAG_ID.TEMPLATE,TAG_ID.HTML]),TABLE_BODY_CONTEXT=new Set([TAG_ID.TBODY,TAG_ID.TFOOT,TAG_ID.THEAD,TAG_ID.TEMPLATE,TAG_ID.HTML]),TABLE_CONTEXT=new Set([TAG_ID.TABLE,TAG_ID.TEMPLATE,TAG_ID.HTML]),TABLE_CELLS=new Set([TAG_ID.TD,TAG_ID.TH]),OpenElementStack=class{get currentTmplContentOrNode(){return this._isInTemplate()?this.treeAdapter.getTemplateContent(this.current):this.current}constructor(e,t,n){this.treeAdapter=t,this.handler=n,this.items=[],this.tagIDs=[],this.stackTop=-1,this.tmplCount=0,this.currentTagId=TAG_ID.UNKNOWN,this.current=e}_indexOf(e){return this.items.lastIndexOf(e,this.stackTop)}_isInTemplate(){return this.currentTagId===TAG_ID.TEMPLATE&&this.treeAdapter.getNamespaceURI(this.current)===NS.HTML}_updateCurrentElement(){this.current=this.items[this.stackTop],this.currentTagId=this.tagIDs[this.stackTop]}push(e,t){this.stackTop++,this.items[this.stackTop]=e,this.current=e,this.tagIDs[this.stackTop]=t,this.currentTagId=t,this._isInTemplate()&&this.tmplCount++,this.handler.onItemPush(e,t,!0)}pop(){const e=this.current;this.tmplCount>0&&this._isInTemplate()&&this.tmplCount--,this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(e,!0)}replace(e,t){const n=this._indexOf(e);this.items[n]=t,n===this.stackTop&&(this.current=t)}insertAfter(e,t,n){const r=this._indexOf(e)+1;this.items.splice(r,0,t),this.tagIDs.splice(r,0,n),this.stackTop++,r===this.stackTop&&this._updateCurrentElement(),this.current&&void 0!==this.currentTagId&&this.handler.onItemPush(this.current,this.currentTagId,r===this.stackTop)}popUntilTagNamePopped(e){let t=this.stackTop+1;do{t=this.tagIDs.lastIndexOf(e,t-1)}while(t>0&&this.treeAdapter.getNamespaceURI(this.items[t])!==NS.HTML);this.shortenToLength(Math.max(t,0))}shortenToLength(e){for(;this.stackTop>=e;){const t=this.current;this.tmplCount>0&&this._isInTemplate()&&(this.tmplCount-=1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(t,this.stackTop<e)}}popUntilElementPopped(e){const t=this._indexOf(e);this.shortenToLength(Math.max(t,0))}popUntilPopped(e,t){const n=this._indexOfTagNames(e,t);this.shortenToLength(Math.max(n,0))}popUntilNumberedHeaderPopped(){this.popUntilPopped(NUMBERED_HEADERS,NS.HTML)}popUntilTableCellPopped(){this.popUntilPopped(TABLE_CELLS,NS.HTML)}popAllUpToHtmlElement(){this.tmplCount=0,this.shortenToLength(1)}_indexOfTagNames(e,t){for(let n=this.stackTop;n>=0;n--)if(e.has(this.tagIDs[n])&&this.treeAdapter.getNamespaceURI(this.items[n])===t)return n;return-1}clearBackTo(e,t){const n=this._indexOfTagNames(e,t);this.shortenToLength(n+1)}clearBackToTableContext(){this.clearBackTo(TABLE_CONTEXT,NS.HTML)}clearBackToTableBodyContext(){this.clearBackTo(TABLE_BODY_CONTEXT,NS.HTML)}clearBackToTableRowContext(){this.clearBackTo(TABLE_ROW_CONTEXT,NS.HTML)}remove(e){const t=this._indexOf(e);t>=0&&(t===this.stackTop?this.pop():(this.items.splice(t,1),this.tagIDs.splice(t,1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(e,!1)))}tryPeekProperlyNestedBodyElement(){return this.stackTop>=1&&this.tagIDs[1]===TAG_ID.BODY?this.items[1]:null}contains(e){return this._indexOf(e)>-1}getCommonAncestor(e){const t=this._indexOf(e)-1;return t>=0?this.items[t]:null}isRootHtmlElementCurrent(){return 0===this.stackTop&&this.tagIDs[0]===TAG_ID.HTML}hasInDynamicScope(e,t){for(let n=this.stackTop;n>=0;n--){const r=this.tagIDs[n];switch(this.treeAdapter.getNamespaceURI(this.items[n])){case NS.HTML:if(r===e)return!0;if(t.has(r))return!1;break;case NS.SVG:if(SCOPING_ELEMENTS_SVG.has(r))return!1;break;case NS.MATHML:if(SCOPING_ELEMENTS_MATHML.has(r))return!1}}return!0}hasInScope(e){return this.hasInDynamicScope(e,SCOPING_ELEMENTS_HTML)}hasInListItemScope(e){return this.hasInDynamicScope(e,SCOPING_ELEMENTS_HTML_LIST)}hasInButtonScope(e){return this.hasInDynamicScope(e,SCOPING_ELEMENTS_HTML_BUTTON)}hasNumberedHeaderInScope(){for(let e=this.stackTop;e>=0;e--){const t=this.tagIDs[e];switch(this.treeAdapter.getNamespaceURI(this.items[e])){case NS.HTML:if(NUMBERED_HEADERS.has(t))return!0;if(SCOPING_ELEMENTS_HTML.has(t))return!1;break;case NS.SVG:if(SCOPING_ELEMENTS_SVG.has(t))return!1;break;case NS.MATHML:if(SCOPING_ELEMENTS_MATHML.has(t))return!1}}return!0}hasInTableScope(e){for(let t=this.stackTop;t>=0;t--)if(this.treeAdapter.getNamespaceURI(this.items[t])===NS.HTML)switch(this.tagIDs[t]){case e:return!0;case TAG_ID.TABLE:case TAG_ID.HTML:return!1}return!0}hasTableBodyContextInTableScope(){for(let e=this.stackTop;e>=0;e--)if(this.treeAdapter.getNamespaceURI(this.items[e])===NS.HTML)switch(this.tagIDs[e]){case TAG_ID.TBODY:case TAG_ID.THEAD:case TAG_ID.TFOOT:return!0;case TAG_ID.TABLE:case TAG_ID.HTML:return!1}return!0}hasInSelectScope(e){for(let t=this.stackTop;t>=0;t--)if(this.treeAdapter.getNamespaceURI(this.items[t])===NS.HTML)switch(this.tagIDs[t]){case e:return!0;case TAG_ID.OPTION:case TAG_ID.OPTGROUP:break;default:return!1}return!0}generateImpliedEndTags(){for(;void 0!==this.currentTagId&&IMPLICIT_END_TAG_REQUIRED.has(this.currentTagId);)this.pop()}generateImpliedEndTagsThoroughly(){for(;void 0!==this.currentTagId&&IMPLICIT_END_TAG_REQUIRED_THOROUGHLY.has(this.currentTagId);)this.pop()}generateImpliedEndTagsWithExclusion(e){for(;void 0!==this.currentTagId&&this.currentTagId!==e&&IMPLICIT_END_TAG_REQUIRED_THOROUGHLY.has(this.currentTagId);)this.pop()}};(EntryType2=EntryType||(EntryType={}))[EntryType2.Marker=0]="Marker",EntryType2[EntryType2.Element=1]="Element";var MARKER={type:EntryType.Marker},FormattingElementList=class{constructor(e){this.treeAdapter=e,this.entries=[],this.bookmark=null}_getNoahArkConditionCandidates(e,t){const n=[],r=t.length,s=this.treeAdapter.getTagName(e),a=this.treeAdapter.getNamespaceURI(e);for(let e=0;e<this.entries.length;e++){const t=this.entries[e];if(t.type===EntryType.Marker)break;const{element:i}=t;if(this.treeAdapter.getTagName(i)===s&&this.treeAdapter.getNamespaceURI(i)===a){const t=this.treeAdapter.getAttrList(i);t.length===r&&n.push({idx:e,attrs:t})}}return n}_ensureNoahArkCondition(e){if(this.entries.length<3)return;const t=this.treeAdapter.getAttrList(e),n=this._getNoahArkConditionCandidates(e,t);if(n.length<3)return;const r=new Map(t.map(e=>[e.name,e.value]));let s=0;for(let e=0;e<n.length;e++){const t=n[e];t.attrs.every(e=>r.get(e.name)===e.value)&&(s+=1,s>=3&&this.entries.splice(t.idx,1))}}insertMarker(){this.entries.unshift(MARKER)}pushElement(e,t){this._ensureNoahArkCondition(e),this.entries.unshift({type:EntryType.Element,element:e,token:t})}insertElementAfterBookmark(e,t){const n=this.entries.indexOf(this.bookmark);this.entries.splice(n,0,{type:EntryType.Element,element:e,token:t})}removeEntry(e){const t=this.entries.indexOf(e);-1!==t&&this.entries.splice(t,1)}clearToLastMarker(){const e=this.entries.indexOf(MARKER);-1===e?this.entries.length=0:this.entries.splice(0,e+1)}getElementEntryInScopeWithTagName(e){const t=this.entries.find(t=>t.type===EntryType.Marker||this.treeAdapter.getTagName(t.element)===e);return t&&t.type===EntryType.Element?t:null}getElementEntry(e){return this.entries.find(t=>t.type===EntryType.Element&&t.element===e)}},defaultTreeAdapter={createDocument:()=>({nodeName:"#document",mode:DOCUMENT_MODE.NO_QUIRKS,childNodes:[]}),createDocumentFragment:()=>({nodeName:"#document-fragment",childNodes:[]}),createElement:(e,t,n)=>({nodeName:e,tagName:e,attrs:n,namespaceURI:t,childNodes:[],parentNode:null}),createCommentNode:e=>({nodeName:"#comment",data:e,parentNode:null}),createTextNode:e=>({nodeName:"#text",value:e,parentNode:null}),appendChild(e,t){e.childNodes.push(t),t.parentNode=e},insertBefore(e,t,n){const r=e.childNodes.indexOf(n);e.childNodes.splice(r,0,t),t.parentNode=e},setTemplateContent(e,t){e.content=t},getTemplateContent:e=>e.content,setDocumentType(e,t,n,r){const s=e.childNodes.find(e=>"#documentType"===e.nodeName);if(s)s.name=t,s.publicId=n,s.systemId=r;else{const s={nodeName:"#documentType",name:t,publicId:n,systemId:r,parentNode:null};defaultTreeAdapter.appendChild(e,s)}},setDocumentMode(e,t){e.mode=t},getDocumentMode:e=>e.mode,detachNode(e){if(e.parentNode){const t=e.parentNode.childNodes.indexOf(e);e.parentNode.childNodes.splice(t,1),e.parentNode=null}},insertText(e,t){if(e.childNodes.length>0){const n=e.childNodes[e.childNodes.length-1];if(defaultTreeAdapter.isTextNode(n))return void(n.value+=t)}defaultTreeAdapter.appendChild(e,defaultTreeAdapter.createTextNode(t))},insertTextBefore(e,t,n){const r=e.childNodes[e.childNodes.indexOf(n)-1];r&&defaultTreeAdapter.isTextNode(r)?r.value+=t:defaultTreeAdapter.insertBefore(e,defaultTreeAdapter.createTextNode(t),n)},adoptAttributes(e,t){const n=new Set(e.attrs.map(e=>e.name));for(let r=0;r<t.length;r++)n.has(t[r].name)||e.attrs.push(t[r])},getFirstChild:e=>e.childNodes[0],getChildNodes:e=>e.childNodes,getParentNode:e=>e.parentNode,getAttrList:e=>e.attrs,getTagName:e=>e.tagName,getNamespaceURI:e=>e.namespaceURI,getTextNodeContent:e=>e.value,getCommentNodeContent:e=>e.data,getDocumentTypeNodeName:e=>e.name,getDocumentTypeNodePublicId:e=>e.publicId,getDocumentTypeNodeSystemId:e=>e.systemId,isTextNode:e=>"#text"===e.nodeName,isCommentNode:e=>"#comment"===e.nodeName,isDocumentTypeNode:e=>"#documentType"===e.nodeName,isElementNode:e=>Object.prototype.hasOwnProperty.call(e,"tagName"),setNodeSourceCodeLocation(e,t){e.sourceCodeLocation=t},getNodeSourceCodeLocation:e=>e.sourceCodeLocation,updateNodeSourceCodeLocation(e,t){e.sourceCodeLocation={...e.sourceCodeLocation,...t}}},QUIRKS_MODE_PUBLIC_ID_PREFIXES=["+//silmaril//dtd html pro v0r11 19970101//","-//as//dtd html 3.0 aswedit + extensions//","-//advasoft ltd//dtd html 3.0 aswedit + extensions//","-//ietf//dtd html 2.0 level 1//","-//ietf//dtd html 2.0 level 2//","-//ietf//dtd html 2.0 strict level 1//","-//ietf//dtd html 2.0 strict level 2//","-//ietf//dtd html 2.0 strict//","-//ietf//dtd html 2.0//","-//ietf//dtd html 2.1e//","-//ietf//dtd html 3.0//","-//ietf//dtd html 3.2 final//","-//ietf//dtd html 3.2//","-//ietf//dtd html 3//","-//ietf//dtd html level 0//","-//ietf//dtd html level 1//","-//ietf//dtd html level 2//","-//ietf//dtd html level 3//","-//ietf//dtd html strict level 0//","-//ietf//dtd html strict level 1//","-//ietf//dtd html strict level 2//","-//ietf//dtd html strict level 3//","-//ietf//dtd html strict//","-//ietf//dtd html//","-//metrius//dtd metrius presentational//","-//microsoft//dtd internet explorer 2.0 html strict//","-//microsoft//dtd internet explorer 2.0 html//","-//microsoft//dtd internet explorer 2.0 tables//","-//microsoft//dtd internet explorer 3.0 html strict//","-//microsoft//dtd internet explorer 3.0 html//","-//microsoft//dtd internet explorer 3.0 tables//","-//netscape comm. corp.//dtd html//","-//netscape comm. corp.//dtd strict html//","-//o'reilly and associates//dtd html 2.0//","-//o'reilly and associates//dtd html extended 1.0//","-//o'reilly and associates//dtd html extended relaxed 1.0//","-//sq//dtd html 2.0 hotmetal + extensions//","-//softquad software//dtd hotmetal pro 6.0::19990601::extensions to html 4.0//","-//softquad//dtd hotmetal pro 4.0::19971010::extensions to html 4.0//","-//spyglass//dtd html 2.0 extended//","-//sun microsystems corp.//dtd hotjava html//","-//sun microsystems corp.//dtd hotjava strict html//","-//w3c//dtd html 3 1995-03-24//","-//w3c//dtd html 3.2 draft//","-//w3c//dtd html 3.2 final//","-//w3c//dtd html 3.2//","-//w3c//dtd html 3.2s draft//","-//w3c//dtd html 4.0 frameset//","-//w3c//dtd html 4.0 transitional//","-//w3c//dtd html experimental 19960712//","-//w3c//dtd html experimental 970421//","-//w3c//dtd w3 html//","-//w3o//dtd w3 html 3.0//","-//webtechs//dtd mozilla html 2.0//","-//webtechs//dtd mozilla html//"],QUIRKS_MODE_NO_SYSTEM_ID_PUBLIC_ID_PREFIXES=[...QUIRKS_MODE_PUBLIC_ID_PREFIXES,"-//w3c//dtd html 4.01 frameset//","-//w3c//dtd html 4.01 transitional//"],QUIRKS_MODE_PUBLIC_IDS=new Set(["-//w3o//dtd w3 html strict 3.0//en//","-/w3c/dtd html 4.0 transitional/en","html"]),LIMITED_QUIRKS_PUBLIC_ID_PREFIXES=["-//w3c//dtd xhtml 1.0 frameset//","-//w3c//dtd xhtml 1.0 transitional//"],LIMITED_QUIRKS_WITH_SYSTEM_ID_PUBLIC_ID_PREFIXES=[...LIMITED_QUIRKS_PUBLIC_ID_PREFIXES,"-//w3c//dtd html 4.01 frameset//","-//w3c//dtd html 4.01 transitional//"];function hasPrefix(e,t){return t.some(t=>e.startsWith(t))}var InsertionMode,InsertionMode2,SVG_ATTRS_ADJUSTMENT_MAP=new Map(["attributeName","attributeType","baseFrequency","baseProfile","calcMode","clipPathUnits","diffuseConstant","edgeMode","filterUnits","glyphRef","gradientTransform","gradientUnits","kernelMatrix","kernelUnitLength","keyPoints","keySplines","keyTimes","lengthAdjust","limitingConeAngle","markerHeight","markerUnits","markerWidth","maskContentUnits","maskUnits","numOctaves","pathLength","patternContentUnits","patternTransform","patternUnits","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","refX","refY","repeatCount","repeatDur","requiredExtensions","requiredFeatures","specularConstant","specularExponent","spreadMethod","startOffset","stdDeviation","stitchTiles","surfaceScale","systemLanguage","tableValues","targetX","targetY","textLength","viewBox","viewTarget","xChannelSelector","yChannelSelector","zoomAndPan"].map(e=>[e.toLowerCase(),e])),XML_ATTRS_ADJUSTMENT_MAP=new Map([["xlink:actuate",{prefix:"xlink",name:"actuate",namespace:NS.XLINK}],["xlink:arcrole",{prefix:"xlink",name:"arcrole",namespace:NS.XLINK}],["xlink:href",{prefix:"xlink",name:"href",namespace:NS.XLINK}],["xlink:role",{prefix:"xlink",name:"role",namespace:NS.XLINK}],["xlink:show",{prefix:"xlink",name:"show",namespace:NS.XLINK}],["xlink:title",{prefix:"xlink",name:"title",namespace:NS.XLINK}],["xlink:type",{prefix:"xlink",name:"type",namespace:NS.XLINK}],["xml:lang",{prefix:"xml",name:"lang",namespace:NS.XML}],["xml:space",{prefix:"xml",name:"space",namespace:NS.XML}],["xmlns",{prefix:"",name:"xmlns",namespace:NS.XMLNS}],["xmlns:xlink",{prefix:"xmlns",name:"xlink",namespace:NS.XMLNS}]]),SVG_TAG_NAMES_ADJUSTMENT_MAP=new Map(["altGlyph","altGlyphDef","altGlyphItem","animateColor","animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","glyphRef","linearGradient","radialGradient","textPath"].map(e=>[e.toLowerCase(),e])),EXITS_FOREIGN_CONTENT=new Set([TAG_ID.B,TAG_ID.BIG,TAG_ID.BLOCKQUOTE,TAG_ID.BODY,TAG_ID.BR,TAG_ID.CENTER,TAG_ID.CODE,TAG_ID.DD,TAG_ID.DIV,TAG_ID.DL,TAG_ID.DT,TAG_ID.EM,TAG_ID.EMBED,TAG_ID.H1,TAG_ID.H2,TAG_ID.H3,TAG_ID.H4,TAG_ID.H5,TAG_ID.H6,TAG_ID.HEAD,TAG_ID.HR,TAG_ID.I,TAG_ID.IMG,TAG_ID.LI,TAG_ID.LISTING,TAG_ID.MENU,TAG_ID.META,TAG_ID.NOBR,TAG_ID.OL,TAG_ID.P,TAG_ID.PRE,TAG_ID.RUBY,TAG_ID.S,TAG_ID.SMALL,TAG_ID.SPAN,TAG_ID.STRONG,TAG_ID.STRIKE,TAG_ID.SUB,TAG_ID.SUP,TAG_ID.TABLE,TAG_ID.TT,TAG_ID.U,TAG_ID.UL,TAG_ID.VAR]);function adjustTokenMathMLAttrs(e){for(let t=0;t<e.attrs.length;t++)if("definitionurl"===e.attrs[t].name){e.attrs[t].name="definitionURL";break}}function adjustTokenSVGAttrs(e){for(let t=0;t<e.attrs.length;t++){const n=SVG_ATTRS_ADJUSTMENT_MAP.get(e.attrs[t].name);null!=n&&(e.attrs[t].name=n)}}function adjustTokenXMLAttrs(e){for(let t=0;t<e.attrs.length;t++){const n=XML_ATTRS_ADJUSTMENT_MAP.get(e.attrs[t].name);n&&(e.attrs[t].prefix=n.prefix,e.attrs[t].name=n.name,e.attrs[t].namespace=n.namespace)}}(InsertionMode2=InsertionMode||(InsertionMode={}))[InsertionMode2.INITIAL=0]="INITIAL",InsertionMode2[InsertionMode2.BEFORE_HTML=1]="BEFORE_HTML",InsertionMode2[InsertionMode2.BEFORE_HEAD=2]="BEFORE_HEAD",InsertionMode2[InsertionMode2.IN_HEAD=3]="IN_HEAD",InsertionMode2[InsertionMode2.IN_HEAD_NO_SCRIPT=4]="IN_HEAD_NO_SCRIPT",InsertionMode2[InsertionMode2.AFTER_HEAD=5]="AFTER_HEAD",InsertionMode2[InsertionMode2.IN_BODY=6]="IN_BODY",InsertionMode2[InsertionMode2.TEXT=7]="TEXT",InsertionMode2[InsertionMode2.IN_TABLE=8]="IN_TABLE",InsertionMode2[InsertionMode2.IN_TABLE_TEXT=9]="IN_TABLE_TEXT",InsertionMode2[InsertionMode2.IN_CAPTION=10]="IN_CAPTION",InsertionMode2[InsertionMode2.IN_COLUMN_GROUP=11]="IN_COLUMN_GROUP",InsertionMode2[InsertionMode2.IN_TABLE_BODY=12]="IN_TABLE_BODY",InsertionMode2[InsertionMode2.IN_ROW=13]="IN_ROW",InsertionMode2[InsertionMode2.IN_CELL=14]="IN_CELL",InsertionMode2[InsertionMode2.IN_SELECT=15]="IN_SELECT",InsertionMode2[InsertionMode2.IN_SELECT_IN_TABLE=16]="IN_SELECT_IN_TABLE",InsertionMode2[InsertionMode2.IN_TEMPLATE=17]="IN_TEMPLATE",InsertionMode2[InsertionMode2.AFTER_BODY=18]="AFTER_BODY",InsertionMode2[InsertionMode2.IN_FRAMESET=19]="IN_FRAMESET",InsertionMode2[InsertionMode2.AFTER_FRAMESET=20]="AFTER_FRAMESET",InsertionMode2[InsertionMode2.AFTER_AFTER_BODY=21]="AFTER_AFTER_BODY",InsertionMode2[InsertionMode2.AFTER_AFTER_FRAMESET=22]="AFTER_AFTER_FRAMESET";var BASE_LOC={startLine:-1,startCol:-1,startOffset:-1,endLine:-1,endCol:-1,endOffset:-1},TABLE_STRUCTURE_TAGS=new Set([TAG_ID.TABLE,TAG_ID.TBODY,TAG_ID.TFOOT,TAG_ID.THEAD,TAG_ID.TR]),defaultParserOptions={scriptingEnabled:!0,sourceCodeLocationInfo:!1,treeAdapter:defaultTreeAdapter,onParseError:null},Parser3=class{constructor(e,t,n=null,r=null){this.fragmentContext=n,this.scriptHandler=r,this.currentToken=null,this.stopped=!1,this.insertionMode=InsertionMode.INITIAL,this.originalInsertionMode=InsertionMode.INITIAL,this.headElement=null,this.formElement=null,this.currentNotInHTML=!1,this.tmplInsertionModeStack=[],this.pendingCharacterTokens=[],this.hasNonWhitespacePendingCharacterToken=!1,this.framesetOk=!0,this.skipNextNewLine=!1,this.fosterParentingEnabled=!1,this.options={...defaultParserOptions,...e},this.treeAdapter=this.options.treeAdapter,this.onParseError=this.options.onParseError,this.onParseError&&(this.options.sourceCodeLocationInfo=!0),this.document=null!=t?t:this.treeAdapter.createDocument(),this.tokenizer=new Tokenizer(this.options,this),this.activeFormattingElements=new FormattingElementList(this.treeAdapter),this.fragmentContextID=n?getTagID(this.treeAdapter.getTagName(n)):TAG_ID.UNKNOWN,this._setContextModes(null!=n?n:this.document,this.fragmentContextID),this.openElements=new OpenElementStack(this.document,this.treeAdapter,this)}static parse(e,t){const n=new this(t);return n.tokenizer.write(e,!0),n.document}static getFragmentParser(e,t){const n={...defaultParserOptions,...t};null!=e||(e=n.treeAdapter.createElement(TAG_NAMES.TEMPLATE,NS.HTML,[]));const r=n.treeAdapter.createElement("documentmock",NS.HTML,[]),s=new this(n,r,e);return s.fragmentContextID===TAG_ID.TEMPLATE&&s.tmplInsertionModeStack.unshift(InsertionMode.IN_TEMPLATE),s._initTokenizerForFragmentParsing(),s._insertFakeRootElement(),s._resetInsertionMode(),s._findFormInFragmentContext(),s}getFragment(){const e=this.treeAdapter.getFirstChild(this.document),t=this.treeAdapter.createDocumentFragment();return this._adoptNodes(e,t),t}_err(e,t,n){var r;if(!this.onParseError)return;const s=null!==(r=e.location)&&void 0!==r?r:BASE_LOC,a={code:t,startLine:s.startLine,startCol:s.startCol,startOffset:s.startOffset,endLine:n?s.startLine:s.endLine,endCol:n?s.startCol:s.endCol,endOffset:n?s.startOffset:s.endOffset};this.onParseError(a)}onItemPush(e,t,n){var r,s;null===(s=(r=this.treeAdapter).onItemPush)||void 0===s||s.call(r,e),n&&this.openElements.stackTop>0&&this._setContextModes(e,t)}onItemPop(e,t){var n,r;if(this.options.sourceCodeLocationInfo&&this._setEndLocation(e,this.currentToken),null===(r=(n=this.treeAdapter).onItemPop)||void 0===r||r.call(n,e,this.openElements.current),t){let e,t;0===this.openElements.stackTop&&this.fragmentContext?(e=this.fragmentContext,t=this.fragmentContextID):({current:e,currentTagId:t}=this.openElements),this._setContextModes(e,t)}}_setContextModes(e,t){const n=e===this.document||e&&this.treeAdapter.getNamespaceURI(e)===NS.HTML;this.currentNotInHTML=!n,this.tokenizer.inForeignNode=!n&&void 0!==e&&void 0!==t&&!this._isIntegrationPoint(t,e)}_switchToTextParsing(e,t){this._insertElement(e,NS.HTML),this.tokenizer.state=t,this.originalInsertionMode=this.insertionMode,this.insertionMode=InsertionMode.TEXT}switchToPlaintextParsing(){this.insertionMode=InsertionMode.TEXT,this.originalInsertionMode=InsertionMode.IN_BODY,this.tokenizer.state=TokenizerMode.PLAINTEXT}_getAdjustedCurrentElement(){return 0===this.openElements.stackTop&&this.fragmentContext?this.fragmentContext:this.openElements.current}_findFormInFragmentContext(){let e=this.fragmentContext;for(;e;){if(this.treeAdapter.getTagName(e)===TAG_NAMES.FORM){this.formElement=e;break}e=this.treeAdapter.getParentNode(e)}}_initTokenizerForFragmentParsing(){if(this.fragmentContext&&this.treeAdapter.getNamespaceURI(this.fragmentContext)===NS.HTML)switch(this.fragmentContextID){case TAG_ID.TITLE:case TAG_ID.TEXTAREA:this.tokenizer.state=TokenizerMode.RCDATA;break;case TAG_ID.STYLE:case TAG_ID.XMP:case TAG_ID.IFRAME:case TAG_ID.NOEMBED:case TAG_ID.NOFRAMES:case TAG_ID.NOSCRIPT:this.tokenizer.state=TokenizerMode.RAWTEXT;break;case TAG_ID.SCRIPT:this.tokenizer.state=TokenizerMode.SCRIPT_DATA;break;case TAG_ID.PLAINTEXT:this.tokenizer.state=TokenizerMode.PLAINTEXT}}_setDocumentType(e){const t=e.name||"",n=e.publicId||"",r=e.systemId||"";if(this.treeAdapter.setDocumentType(this.document,t,n,r),e.location){const t=this.treeAdapter.getChildNodes(this.document).find(e=>this.treeAdapter.isDocumentTypeNode(e));t&&this.treeAdapter.setNodeSourceCodeLocation(t,e.location)}}_attachElementToTree(e,t){if(this.options.sourceCodeLocationInfo){const n=t&&{...t,startTag:t};this.treeAdapter.setNodeSourceCodeLocation(e,n)}if(this._shouldFosterParentOnInsertion())this._fosterParentElement(e);else{const t=this.openElements.currentTmplContentOrNode;this.treeAdapter.appendChild(null!=t?t:this.document,e)}}_appendElement(e,t){const n=this.treeAdapter.createElement(e.tagName,t,e.attrs);this._attachElementToTree(n,e.location)}_insertElement(e,t){const n=this.treeAdapter.createElement(e.tagName,t,e.attrs);this._attachElementToTree(n,e.location),this.openElements.push(n,e.tagID)}_insertFakeElement(e,t){const n=this.treeAdapter.createElement(e,NS.HTML,[]);this._attachElementToTree(n,null),this.openElements.push(n,t)}_insertTemplate(e){const t=this.treeAdapter.createElement(e.tagName,NS.HTML,e.attrs),n=this.treeAdapter.createDocumentFragment();this.treeAdapter.setTemplateContent(t,n),this._attachElementToTree(t,e.location),this.openElements.push(t,e.tagID),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(n,null)}_insertFakeRootElement(){const e=this.treeAdapter.createElement(TAG_NAMES.HTML,NS.HTML,[]);this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(e,null),this.treeAdapter.appendChild(this.openElements.current,e),this.openElements.push(e,TAG_ID.HTML)}_appendCommentNode(e,t){const n=this.treeAdapter.createCommentNode(e.data);this.treeAdapter.appendChild(t,n),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(n,e.location)}_insertCharacters(e){let t,n;if(this._shouldFosterParentOnInsertion()?(({parent:t,beforeElement:n}=this._findFosterParentingLocation()),n?this.treeAdapter.insertTextBefore(t,e.chars,n):this.treeAdapter.insertText(t,e.chars)):(t=this.openElements.currentTmplContentOrNode,this.treeAdapter.insertText(t,e.chars)),!e.location)return;const r=this.treeAdapter.getChildNodes(t),s=n?r.lastIndexOf(n):r.length,a=r[s-1];if(this.treeAdapter.getNodeSourceCodeLocation(a)){const{endLine:t,endCol:n,endOffset:r}=e.location;this.treeAdapter.updateNodeSourceCodeLocation(a,{endLine:t,endCol:n,endOffset:r})}else this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(a,e.location)}_adoptNodes(e,t){for(let n=this.treeAdapter.getFirstChild(e);n;n=this.treeAdapter.getFirstChild(e))this.treeAdapter.detachNode(n),this.treeAdapter.appendChild(t,n)}_setEndLocation(e,t){if(this.treeAdapter.getNodeSourceCodeLocation(e)&&t.location){const n=t.location,r=this.treeAdapter.getTagName(e),s=t.type===TokenType.END_TAG&&r===t.tagName?{endTag:{...n},endLine:n.endLine,endCol:n.endCol,endOffset:n.endOffset}:{endLine:n.startLine,endCol:n.startCol,endOffset:n.startOffset};this.treeAdapter.updateNodeSourceCodeLocation(e,s)}}shouldProcessStartTagTokenInForeignContent(e){if(!this.currentNotInHTML)return!1;let t,n;return 0===this.openElements.stackTop&&this.fragmentContext?(t=this.fragmentContext,n=this.fragmentContextID):({current:t,currentTagId:n}=this.openElements),(e.tagID!==TAG_ID.SVG||this.treeAdapter.getTagName(t)!==TAG_NAMES.ANNOTATION_XML||this.treeAdapter.getNamespaceURI(t)!==NS.MATHML)&&(this.tokenizer.inForeignNode||(e.tagID===TAG_ID.MGLYPH||e.tagID===TAG_ID.MALIGNMARK)&&void 0!==n&&!this._isIntegrationPoint(n,t,NS.HTML))}_processToken(e){switch(e.type){case TokenType.CHARACTER:this.onCharacter(e);break;case TokenType.NULL_CHARACTER:this.onNullCharacter(e);break;case TokenType.COMMENT:this.onComment(e);break;case TokenType.DOCTYPE:this.onDoctype(e);break;case TokenType.START_TAG:this._processStartTag(e);break;case TokenType.END_TAG:this.onEndTag(e);break;case TokenType.EOF:this.onEof(e);break;case TokenType.WHITESPACE_CHARACTER:this.onWhitespaceCharacter(e)}}_isIntegrationPoint(e,t,n){return function(e,t,n,r){return(!r||r===NS.HTML)&&function(e,t,n){if(t===NS.MATHML&&e===TAG_ID.ANNOTATION_XML)for(let e=0;e<n.length;e++)if(n[e].name===ATTRS.ENCODING){const t=n[e].value.toLowerCase();return"text/html"===t||"application/xhtml+xml"===t}return t===NS.SVG&&(e===TAG_ID.FOREIGN_OBJECT||e===TAG_ID.DESC||e===TAG_ID.TITLE)}(e,t,n)||(!r||r===NS.MATHML)&&function(e,t){return t===NS.MATHML&&(e===TAG_ID.MI||e===TAG_ID.MO||e===TAG_ID.MN||e===TAG_ID.MS||e===TAG_ID.MTEXT)}(e,t)}(e,this.treeAdapter.getNamespaceURI(t),this.treeAdapter.getAttrList(t),n)}_reconstructActiveFormattingElements(){const e=this.activeFormattingElements.entries.length;if(e){const t=this.activeFormattingElements.entries.findIndex(e=>e.type===EntryType.Marker||this.openElements.contains(e.element));for(let n=-1===t?e-1:t-1;n>=0;n--){const e=this.activeFormattingElements.entries[n];this._insertElement(e.token,this.treeAdapter.getNamespaceURI(e.element)),e.element=this.openElements.current}}}_closeTableCell(){this.openElements.generateImpliedEndTags(),this.openElements.popUntilTableCellPopped(),this.activeFormattingElements.clearToLastMarker(),this.insertionMode=InsertionMode.IN_ROW}_closePElement(){this.openElements.generateImpliedEndTagsWithExclusion(TAG_ID.P),this.openElements.popUntilTagNamePopped(TAG_ID.P)}_resetInsertionMode(){for(let e=this.openElements.stackTop;e>=0;e--)switch(0===e&&this.fragmentContext?this.fragmentContextID:this.openElements.tagIDs[e]){case TAG_ID.TR:return void(this.insertionMode=InsertionMode.IN_ROW);case TAG_ID.TBODY:case TAG_ID.THEAD:case TAG_ID.TFOOT:return void(this.insertionMode=InsertionMode.IN_TABLE_BODY);case TAG_ID.CAPTION:return void(this.insertionMode=InsertionMode.IN_CAPTION);case TAG_ID.COLGROUP:return void(this.insertionMode=InsertionMode.IN_COLUMN_GROUP);case TAG_ID.TABLE:return void(this.insertionMode=InsertionMode.IN_TABLE);case TAG_ID.BODY:return void(this.insertionMode=InsertionMode.IN_BODY);case TAG_ID.FRAMESET:return void(this.insertionMode=InsertionMode.IN_FRAMESET);case TAG_ID.SELECT:return void this._resetInsertionModeForSelect(e);case TAG_ID.TEMPLATE:return void(this.insertionMode=this.tmplInsertionModeStack[0]);case TAG_ID.HTML:return void(this.insertionMode=this.headElement?InsertionMode.AFTER_HEAD:InsertionMode.BEFORE_HEAD);case TAG_ID.TD:case TAG_ID.TH:if(e>0)return void(this.insertionMode=InsertionMode.IN_CELL);break;case TAG_ID.HEAD:if(e>0)return void(this.insertionMode=InsertionMode.IN_HEAD)}this.insertionMode=InsertionMode.IN_BODY}_resetInsertionModeForSelect(e){if(e>0)for(let t=e-1;t>0;t--){const e=this.openElements.tagIDs[t];if(e===TAG_ID.TEMPLATE)break;if(e===TAG_ID.TABLE)return void(this.insertionMode=InsertionMode.IN_SELECT_IN_TABLE)}this.insertionMode=InsertionMode.IN_SELECT}_isElementCausesFosterParenting(e){return TABLE_STRUCTURE_TAGS.has(e)}_shouldFosterParentOnInsertion(){return this.fosterParentingEnabled&&void 0!==this.openElements.currentTagId&&this._isElementCausesFosterParenting(this.openElements.currentTagId)}_findFosterParentingLocation(){for(let e=this.openElements.stackTop;e>=0;e--){const t=this.openElements.items[e];switch(this.openElements.tagIDs[e]){case TAG_ID.TEMPLATE:if(this.treeAdapter.getNamespaceURI(t)===NS.HTML)return{parent:this.treeAdapter.getTemplateContent(t),beforeElement:null};break;case TAG_ID.TABLE:{const n=this.treeAdapter.getParentNode(t);return n?{parent:n,beforeElement:t}:{parent:this.openElements.items[e-1],beforeElement:null}}}}return{parent:this.openElements.items[0],beforeElement:null}}_fosterParentElement(e){const t=this._findFosterParentingLocation();t.beforeElement?this.treeAdapter.insertBefore(t.parent,e,t.beforeElement):this.treeAdapter.appendChild(t.parent,e)}_isSpecialElement(e,t){const n=this.treeAdapter.getNamespaceURI(e);return SPECIAL_ELEMENTS[n].has(t)}onCharacter(e){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode)!function(e,t){e._insertCharacters(t),e.framesetOk=!1}(this,e);else switch(this.insertionMode){case InsertionMode.INITIAL:tokenInInitialMode(this,e);break;case InsertionMode.BEFORE_HTML:tokenBeforeHtml(this,e);break;case InsertionMode.BEFORE_HEAD:tokenBeforeHead(this,e);break;case InsertionMode.IN_HEAD:tokenInHead(this,e);break;case InsertionMode.IN_HEAD_NO_SCRIPT:tokenInHeadNoScript(this,e);break;case InsertionMode.AFTER_HEAD:tokenAfterHead(this,e);break;case InsertionMode.IN_BODY:case InsertionMode.IN_CAPTION:case InsertionMode.IN_CELL:case InsertionMode.IN_TEMPLATE:characterInBody(this,e);break;case InsertionMode.TEXT:case InsertionMode.IN_SELECT:case InsertionMode.IN_SELECT_IN_TABLE:this._insertCharacters(e);break;case InsertionMode.IN_TABLE:case InsertionMode.IN_TABLE_BODY:case InsertionMode.IN_ROW:characterInTable(this,e);break;case InsertionMode.IN_TABLE_TEXT:characterInTableText(this,e);break;case InsertionMode.IN_COLUMN_GROUP:tokenInColumnGroup(this,e);break;case InsertionMode.AFTER_BODY:tokenAfterBody(this,e);break;case InsertionMode.AFTER_AFTER_BODY:tokenAfterAfterBody(this,e)}}onNullCharacter(e){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode)!function(e,t){t.chars="�",e._insertCharacters(t)}(this,e);else switch(this.insertionMode){case InsertionMode.INITIAL:tokenInInitialMode(this,e);break;case InsertionMode.BEFORE_HTML:tokenBeforeHtml(this,e);break;case InsertionMode.BEFORE_HEAD:tokenBeforeHead(this,e);break;case InsertionMode.IN_HEAD:tokenInHead(this,e);break;case InsertionMode.IN_HEAD_NO_SCRIPT:tokenInHeadNoScript(this,e);break;case InsertionMode.AFTER_HEAD:tokenAfterHead(this,e);break;case InsertionMode.TEXT:this._insertCharacters(e);break;case InsertionMode.IN_TABLE:case InsertionMode.IN_TABLE_BODY:case InsertionMode.IN_ROW:characterInTable(this,e);break;case InsertionMode.IN_COLUMN_GROUP:tokenInColumnGroup(this,e);break;case InsertionMode.AFTER_BODY:tokenAfterBody(this,e);break;case InsertionMode.AFTER_AFTER_BODY:tokenAfterAfterBody(this,e)}}onComment(e){if(this.skipNextNewLine=!1,this.currentNotInHTML)appendComment(this,e);else switch(this.insertionMode){case InsertionMode.INITIAL:case InsertionMode.BEFORE_HTML:case InsertionMode.BEFORE_HEAD:case InsertionMode.IN_HEAD:case InsertionMode.IN_HEAD_NO_SCRIPT:case InsertionMode.AFTER_HEAD:case InsertionMode.IN_BODY:case InsertionMode.IN_TABLE:case InsertionMode.IN_CAPTION:case InsertionMode.IN_COLUMN_GROUP:case InsertionMode.IN_TABLE_BODY:case InsertionMode.IN_ROW:case InsertionMode.IN_CELL:case InsertionMode.IN_SELECT:case InsertionMode.IN_SELECT_IN_TABLE:case InsertionMode.IN_TEMPLATE:case InsertionMode.IN_FRAMESET:case InsertionMode.AFTER_FRAMESET:appendComment(this,e);break;case InsertionMode.IN_TABLE_TEXT:tokenInTableText(this,e);break;case InsertionMode.AFTER_BODY:!function(e,t){e._appendCommentNode(t,e.openElements.items[0])}(this,e);break;case InsertionMode.AFTER_AFTER_BODY:case InsertionMode.AFTER_AFTER_FRAMESET:!function(e,t){e._appendCommentNode(t,e.document)}(this,e)}}onDoctype(e){switch(this.skipNextNewLine=!1,this.insertionMode){case InsertionMode.INITIAL:!function(e,t){e._setDocumentType(t);const n=t.forceQuirks?DOCUMENT_MODE.QUIRKS:function(e){if("html"!==e.name)return DOCUMENT_MODE.QUIRKS;const{systemId:t}=e;if(t&&"http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd"===t.toLowerCase())return DOCUMENT_MODE.QUIRKS;let{publicId:n}=e;if(null!==n){if(n=n.toLowerCase(),QUIRKS_MODE_PUBLIC_IDS.has(n))return DOCUMENT_MODE.QUIRKS;let e=null===t?QUIRKS_MODE_NO_SYSTEM_ID_PUBLIC_ID_PREFIXES:QUIRKS_MODE_PUBLIC_ID_PREFIXES;if(hasPrefix(n,e))return DOCUMENT_MODE.QUIRKS;if(e=null===t?LIMITED_QUIRKS_PUBLIC_ID_PREFIXES:LIMITED_QUIRKS_WITH_SYSTEM_ID_PUBLIC_ID_PREFIXES,hasPrefix(n,e))return DOCUMENT_MODE.LIMITED_QUIRKS}return DOCUMENT_MODE.NO_QUIRKS}(t);(function(e){return"html"===e.name&&null===e.publicId&&(null===e.systemId||"about:legacy-compat"===e.systemId)})(t)||e._err(t,ERR.nonConformingDoctype),e.treeAdapter.setDocumentMode(e.document,n),e.insertionMode=InsertionMode.BEFORE_HTML}(this,e);break;case InsertionMode.BEFORE_HEAD:case InsertionMode.IN_HEAD:case InsertionMode.IN_HEAD_NO_SCRIPT:case InsertionMode.AFTER_HEAD:this._err(e,ERR.misplacedDoctype);break;case InsertionMode.IN_TABLE_TEXT:tokenInTableText(this,e)}}onStartTag(e){this.skipNextNewLine=!1,this.currentToken=e,this._processStartTag(e),e.selfClosing&&!e.ackSelfClosing&&this._err(e,ERR.nonVoidHtmlElementStartTagWithTrailingSolidus)}_processStartTag(e){this.shouldProcessStartTagTokenInForeignContent(e)?function(e,t){if(function(e){const t=e.tagID;return t===TAG_ID.FONT&&e.attrs.some(({name:e})=>e===ATTRS.COLOR||e===ATTRS.SIZE||e===ATTRS.FACE)||EXITS_FOREIGN_CONTENT.has(t)}(t))popUntilHtmlOrIntegrationPoint(e),e._startTagOutsideForeignContent(t);else{const n=e._getAdjustedCurrentElement(),r=e.treeAdapter.getNamespaceURI(n);r===NS.MATHML?adjustTokenMathMLAttrs(t):r===NS.SVG&&(function(e){const t=SVG_TAG_NAMES_ADJUSTMENT_MAP.get(e.tagName);null!=t&&(e.tagName=t,e.tagID=getTagID(e.tagName))}(t),adjustTokenSVGAttrs(t)),adjustTokenXMLAttrs(t),t.selfClosing?e._appendElement(t,r):e._insertElement(t,r),t.ackSelfClosing=!0}}(this,e):this._startTagOutsideForeignContent(e)}_startTagOutsideForeignContent(e){switch(this.insertionMode){case InsertionMode.INITIAL:tokenInInitialMode(this,e);break;case InsertionMode.BEFORE_HTML:!function(e,t){t.tagID===TAG_ID.HTML?(e._insertElement(t,NS.HTML),e.insertionMode=InsertionMode.BEFORE_HEAD):tokenBeforeHtml(e,t)}(this,e);break;case InsertionMode.BEFORE_HEAD:!function(e,t){switch(t.tagID){case TAG_ID.HTML:startTagInBody(e,t);break;case TAG_ID.HEAD:e._insertElement(t,NS.HTML),e.headElement=e.openElements.current,e.insertionMode=InsertionMode.IN_HEAD;break;default:tokenBeforeHead(e,t)}}(this,e);break;case InsertionMode.IN_HEAD:startTagInHead(this,e);break;case InsertionMode.IN_HEAD_NO_SCRIPT:!function(e,t){switch(t.tagID){case TAG_ID.HTML:startTagInBody(e,t);break;case TAG_ID.BASEFONT:case TAG_ID.BGSOUND:case TAG_ID.HEAD:case TAG_ID.LINK:case TAG_ID.META:case TAG_ID.NOFRAMES:case TAG_ID.STYLE:startTagInHead(e,t);break;case TAG_ID.NOSCRIPT:e._err(t,ERR.nestedNoscriptInHead);break;default:tokenInHeadNoScript(e,t)}}(this,e);break;case InsertionMode.AFTER_HEAD:!function(e,t){switch(t.tagID){case TAG_ID.HTML:startTagInBody(e,t);break;case TAG_ID.BODY:e._insertElement(t,NS.HTML),e.framesetOk=!1,e.insertionMode=InsertionMode.IN_BODY;break;case TAG_ID.FRAMESET:e._insertElement(t,NS.HTML),e.insertionMode=InsertionMode.IN_FRAMESET;break;case TAG_ID.BASE:case TAG_ID.BASEFONT:case TAG_ID.BGSOUND:case TAG_ID.LINK:case TAG_ID.META:case TAG_ID.NOFRAMES:case TAG_ID.SCRIPT:case TAG_ID.STYLE:case TAG_ID.TEMPLATE:case TAG_ID.TITLE:e._err(t,ERR.abandonedHeadElementChild),e.openElements.push(e.headElement,TAG_ID.HEAD),startTagInHead(e,t),e.openElements.remove(e.headElement);break;case TAG_ID.HEAD:e._err(t,ERR.misplacedStartTagForHeadElement);break;default:tokenAfterHead(e,t)}}(this,e);break;case InsertionMode.IN_BODY:startTagInBody(this,e);break;case InsertionMode.IN_TABLE:startTagInTable(this,e);break;case InsertionMode.IN_TABLE_TEXT:tokenInTableText(this,e);break;case InsertionMode.IN_CAPTION:!function(e,t){const n=t.tagID;TABLE_VOID_ELEMENTS.has(n)?e.openElements.hasInTableScope(TAG_ID.CAPTION)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(TAG_ID.CAPTION),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=InsertionMode.IN_TABLE,startTagInTable(e,t)):startTagInBody(e,t)}(this,e);break;case InsertionMode.IN_COLUMN_GROUP:startTagInColumnGroup(this,e);break;case InsertionMode.IN_TABLE_BODY:startTagInTableBody(this,e);break;case InsertionMode.IN_ROW:startTagInRow(this,e);break;case InsertionMode.IN_CELL:!function(e,t){const n=t.tagID;TABLE_VOID_ELEMENTS.has(n)?(e.openElements.hasInTableScope(TAG_ID.TD)||e.openElements.hasInTableScope(TAG_ID.TH))&&(e._closeTableCell(),startTagInRow(e,t)):startTagInBody(e,t)}(this,e);break;case InsertionMode.IN_SELECT:startTagInSelect(this,e);break;case InsertionMode.IN_SELECT_IN_TABLE:!function(e,t){const n=t.tagID;n===TAG_ID.CAPTION||n===TAG_ID.TABLE||n===TAG_ID.TBODY||n===TAG_ID.TFOOT||n===TAG_ID.THEAD||n===TAG_ID.TR||n===TAG_ID.TD||n===TAG_ID.TH?(e.openElements.popUntilTagNamePopped(TAG_ID.SELECT),e._resetInsertionMode(),e._processStartTag(t)):startTagInSelect(e,t)}(this,e);break;case InsertionMode.IN_TEMPLATE:!function(e,t){switch(t.tagID){case TAG_ID.BASE:case TAG_ID.BASEFONT:case TAG_ID.BGSOUND:case TAG_ID.LINK:case TAG_ID.META:case TAG_ID.NOFRAMES:case TAG_ID.SCRIPT:case TAG_ID.STYLE:case TAG_ID.TEMPLATE:case TAG_ID.TITLE:startTagInHead(e,t);break;case TAG_ID.CAPTION:case TAG_ID.COLGROUP:case TAG_ID.TBODY:case TAG_ID.TFOOT:case TAG_ID.THEAD:e.tmplInsertionModeStack[0]=InsertionMode.IN_TABLE,e.insertionMode=InsertionMode.IN_TABLE,startTagInTable(e,t);break;case TAG_ID.COL:e.tmplInsertionModeStack[0]=InsertionMode.IN_COLUMN_GROUP,e.insertionMode=InsertionMode.IN_COLUMN_GROUP,startTagInColumnGroup(e,t);break;case TAG_ID.TR:e.tmplInsertionModeStack[0]=InsertionMode.IN_TABLE_BODY,e.insertionMode=InsertionMode.IN_TABLE_BODY,startTagInTableBody(e,t);break;case TAG_ID.TD:case TAG_ID.TH:e.tmplInsertionModeStack[0]=InsertionMode.IN_ROW,e.insertionMode=InsertionMode.IN_ROW,startTagInRow(e,t);break;default:e.tmplInsertionModeStack[0]=InsertionMode.IN_BODY,e.insertionMode=InsertionMode.IN_BODY,startTagInBody(e,t)}}(this,e);break;case InsertionMode.AFTER_BODY:!function(e,t){t.tagID===TAG_ID.HTML?startTagInBody(e,t):tokenAfterBody(e,t)}(this,e);break;case InsertionMode.IN_FRAMESET:!function(e,t){switch(t.tagID){case TAG_ID.HTML:startTagInBody(e,t);break;case TAG_ID.FRAMESET:e._insertElement(t,NS.HTML);break;case TAG_ID.FRAME:e._appendElement(t,NS.HTML),t.ackSelfClosing=!0;break;case TAG_ID.NOFRAMES:startTagInHead(e,t)}}(this,e);break;case InsertionMode.AFTER_FRAMESET:!function(e,t){switch(t.tagID){case TAG_ID.HTML:startTagInBody(e,t);break;case TAG_ID.NOFRAMES:startTagInHead(e,t)}}(this,e);break;case InsertionMode.AFTER_AFTER_BODY:!function(e,t){t.tagID===TAG_ID.HTML?startTagInBody(e,t):tokenAfterAfterBody(e,t)}(this,e);break;case InsertionMode.AFTER_AFTER_FRAMESET:!function(e,t){switch(t.tagID){case TAG_ID.HTML:startTagInBody(e,t);break;case TAG_ID.NOFRAMES:startTagInHead(e,t)}}(this,e)}}onEndTag(e){this.skipNextNewLine=!1,this.currentToken=e,this.currentNotInHTML?function(e,t){if(t.tagID===TAG_ID.P||t.tagID===TAG_ID.BR)return popUntilHtmlOrIntegrationPoint(e),void e._endTagOutsideForeignContent(t);for(let n=e.openElements.stackTop;n>0;n--){const r=e.openElements.items[n];if(e.treeAdapter.getNamespaceURI(r)===NS.HTML){e._endTagOutsideForeignContent(t);break}const s=e.treeAdapter.getTagName(r);if(s.toLowerCase()===t.tagName){t.tagName=s,e.openElements.shortenToLength(n);break}}}(this,e):this._endTagOutsideForeignContent(e)}_endTagOutsideForeignContent(e){switch(this.insertionMode){case InsertionMode.INITIAL:tokenInInitialMode(this,e);break;case InsertionMode.BEFORE_HTML:!function(e,t){const n=t.tagID;n!==TAG_ID.HTML&&n!==TAG_ID.HEAD&&n!==TAG_ID.BODY&&n!==TAG_ID.BR||tokenBeforeHtml(e,t)}(this,e);break;case InsertionMode.BEFORE_HEAD:!function(e,t){const n=t.tagID;n===TAG_ID.HEAD||n===TAG_ID.BODY||n===TAG_ID.HTML||n===TAG_ID.BR?tokenBeforeHead(e,t):e._err(t,ERR.endTagWithoutMatchingOpenElement)}(this,e);break;case InsertionMode.IN_HEAD:!function(e,t){switch(t.tagID){case TAG_ID.HEAD:e.openElements.pop(),e.insertionMode=InsertionMode.AFTER_HEAD;break;case TAG_ID.BODY:case TAG_ID.BR:case TAG_ID.HTML:tokenInHead(e,t);break;case TAG_ID.TEMPLATE:templateEndTagInHead(e,t);break;default:e._err(t,ERR.endTagWithoutMatchingOpenElement)}}(this,e);break;case InsertionMode.IN_HEAD_NO_SCRIPT:!function(e,t){switch(t.tagID){case TAG_ID.NOSCRIPT:e.openElements.pop(),e.insertionMode=InsertionMode.IN_HEAD;break;case TAG_ID.BR:tokenInHeadNoScript(e,t);break;default:e._err(t,ERR.endTagWithoutMatchingOpenElement)}}(this,e);break;case InsertionMode.AFTER_HEAD:!function(e,t){switch(t.tagID){case TAG_ID.BODY:case TAG_ID.HTML:case TAG_ID.BR:tokenAfterHead(e,t);break;case TAG_ID.TEMPLATE:templateEndTagInHead(e,t);break;default:e._err(t,ERR.endTagWithoutMatchingOpenElement)}}(this,e);break;case InsertionMode.IN_BODY:endTagInBody(this,e);break;case InsertionMode.TEXT:!function(e,t){var n;t.tagID===TAG_ID.SCRIPT&&(null===(n=e.scriptHandler)||void 0===n||n.call(e,e.openElements.current)),e.openElements.pop(),e.insertionMode=e.originalInsertionMode}(this,e);break;case InsertionMode.IN_TABLE:endTagInTable(this,e);break;case InsertionMode.IN_TABLE_TEXT:tokenInTableText(this,e);break;case InsertionMode.IN_CAPTION:!function(e,t){const n=t.tagID;switch(n){case TAG_ID.CAPTION:case TAG_ID.TABLE:e.openElements.hasInTableScope(TAG_ID.CAPTION)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(TAG_ID.CAPTION),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=InsertionMode.IN_TABLE,n===TAG_ID.TABLE&&endTagInTable(e,t));break;case TAG_ID.BODY:case TAG_ID.COL:case TAG_ID.COLGROUP:case TAG_ID.HTML:case TAG_ID.TBODY:case TAG_ID.TD:case TAG_ID.TFOOT:case TAG_ID.TH:case TAG_ID.THEAD:case TAG_ID.TR:break;default:endTagInBody(e,t)}}(this,e);break;case InsertionMode.IN_COLUMN_GROUP:!function(e,t){switch(t.tagID){case TAG_ID.COLGROUP:e.openElements.currentTagId===TAG_ID.COLGROUP&&(e.openElements.pop(),e.insertionMode=InsertionMode.IN_TABLE);break;case TAG_ID.TEMPLATE:templateEndTagInHead(e,t);break;case TAG_ID.COL:break;default:tokenInColumnGroup(e,t)}}(this,e);break;case InsertionMode.IN_TABLE_BODY:endTagInTableBody(this,e);break;case InsertionMode.IN_ROW:endTagInRow(this,e);break;case InsertionMode.IN_CELL:!function(e,t){const n=t.tagID;switch(n){case TAG_ID.TD:case TAG_ID.TH:e.openElements.hasInTableScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=InsertionMode.IN_ROW);break;case TAG_ID.TABLE:case TAG_ID.TBODY:case TAG_ID.TFOOT:case TAG_ID.THEAD:case TAG_ID.TR:e.openElements.hasInTableScope(n)&&(e._closeTableCell(),endTagInRow(e,t));break;case TAG_ID.BODY:case TAG_ID.CAPTION:case TAG_ID.COL:case TAG_ID.COLGROUP:case TAG_ID.HTML:break;default:endTagInBody(e,t)}}(this,e);break;case InsertionMode.IN_SELECT:endTagInSelect(this,e);break;case InsertionMode.IN_SELECT_IN_TABLE:!function(e,t){const n=t.tagID;n===TAG_ID.CAPTION||n===TAG_ID.TABLE||n===TAG_ID.TBODY||n===TAG_ID.TFOOT||n===TAG_ID.THEAD||n===TAG_ID.TR||n===TAG_ID.TD||n===TAG_ID.TH?e.openElements.hasInTableScope(n)&&(e.openElements.popUntilTagNamePopped(TAG_ID.SELECT),e._resetInsertionMode(),e.onEndTag(t)):endTagInSelect(e,t)}(this,e);break;case InsertionMode.IN_TEMPLATE:!function(e,t){t.tagID===TAG_ID.TEMPLATE&&templateEndTagInHead(e,t)}(this,e);break;case InsertionMode.AFTER_BODY:endTagAfterBody(this,e);break;case InsertionMode.IN_FRAMESET:!function(e,t){t.tagID!==TAG_ID.FRAMESET||e.openElements.isRootHtmlElementCurrent()||(e.openElements.pop(),e.fragmentContext||e.openElements.currentTagId===TAG_ID.FRAMESET||(e.insertionMode=InsertionMode.AFTER_FRAMESET))}(this,e);break;case InsertionMode.AFTER_FRAMESET:!function(e,t){t.tagID===TAG_ID.HTML&&(e.insertionMode=InsertionMode.AFTER_AFTER_FRAMESET)}(this,e);break;case InsertionMode.AFTER_AFTER_BODY:tokenAfterAfterBody(this,e)}}onEof(e){switch(this.insertionMode){case InsertionMode.INITIAL:tokenInInitialMode(this,e);break;case InsertionMode.BEFORE_HTML:tokenBeforeHtml(this,e);break;case InsertionMode.BEFORE_HEAD:tokenBeforeHead(this,e);break;case InsertionMode.IN_HEAD:tokenInHead(this,e);break;case InsertionMode.IN_HEAD_NO_SCRIPT:tokenInHeadNoScript(this,e);break;case InsertionMode.AFTER_HEAD:tokenAfterHead(this,e);break;case InsertionMode.IN_BODY:case InsertionMode.IN_TABLE:case InsertionMode.IN_CAPTION:case InsertionMode.IN_COLUMN_GROUP:case InsertionMode.IN_TABLE_BODY:case InsertionMode.IN_ROW:case InsertionMode.IN_CELL:case InsertionMode.IN_SELECT:case InsertionMode.IN_SELECT_IN_TABLE:eofInBody(this,e);break;case InsertionMode.TEXT:!function(e,t){e._err(t,ERR.eofInElementThatCanContainOnlyText),e.openElements.pop(),e.insertionMode=e.originalInsertionMode,e.onEof(t)}(this,e);break;case InsertionMode.IN_TABLE_TEXT:tokenInTableText(this,e);break;case InsertionMode.IN_TEMPLATE:eofInTemplate(this,e);break;case InsertionMode.AFTER_BODY:case InsertionMode.IN_FRAMESET:case InsertionMode.AFTER_FRAMESET:case InsertionMode.AFTER_AFTER_BODY:case InsertionMode.AFTER_AFTER_FRAMESET:stopParsing(this,e)}}onWhitespaceCharacter(e){if(this.skipNextNewLine&&(this.skipNextNewLine=!1,e.chars.charCodeAt(0)===CODE_POINTS.LINE_FEED)){if(1===e.chars.length)return;e.chars=e.chars.substr(1)}if(this.tokenizer.inForeignNode)this._insertCharacters(e);else switch(this.insertionMode){case InsertionMode.IN_HEAD:case InsertionMode.IN_HEAD_NO_SCRIPT:case InsertionMode.AFTER_HEAD:case InsertionMode.TEXT:case InsertionMode.IN_COLUMN_GROUP:case InsertionMode.IN_SELECT:case InsertionMode.IN_SELECT_IN_TABLE:case InsertionMode.IN_FRAMESET:case InsertionMode.AFTER_FRAMESET:this._insertCharacters(e);break;case InsertionMode.IN_BODY:case InsertionMode.IN_CAPTION:case InsertionMode.IN_CELL:case InsertionMode.IN_TEMPLATE:case InsertionMode.AFTER_BODY:case InsertionMode.AFTER_AFTER_BODY:case InsertionMode.AFTER_AFTER_FRAMESET:whitespaceCharacterInBody(this,e);break;case InsertionMode.IN_TABLE:case InsertionMode.IN_TABLE_BODY:case InsertionMode.IN_ROW:characterInTable(this,e);break;case InsertionMode.IN_TABLE_TEXT:whitespaceCharacterInTableText(this,e)}}};function aaObtainFormattingElementEntry(e,t){let n=e.activeFormattingElements.getElementEntryInScopeWithTagName(t.tagName);return n?e.openElements.contains(n.element)?e.openElements.hasInScope(t.tagID)||(n=null):(e.activeFormattingElements.removeEntry(n),n=null):genericEndTagInBody(e,t),n}function aaObtainFurthestBlock(e,t){let n=null,r=e.openElements.stackTop;for(;r>=0;r--){const s=e.openElements.items[r];if(s===t.element)break;e._isSpecialElement(s,e.openElements.tagIDs[r])&&(n=s)}return n||(e.openElements.shortenToLength(Math.max(r,0)),e.activeFormattingElements.removeEntry(t)),n}function aaInnerLoop(e,t,n){let r=t,s=e.openElements.getCommonAncestor(t);for(let a=0,i=s;i!==n;a++,i=s){s=e.openElements.getCommonAncestor(i);const n=e.activeFormattingElements.getElementEntry(i),o=n&&a>=3;!n||o?(o&&e.activeFormattingElements.removeEntry(n),e.openElements.remove(i)):(i=aaRecreateElementFromEntry(e,n),r===t&&(e.activeFormattingElements.bookmark=n),e.treeAdapter.detachNode(r),e.treeAdapter.appendChild(i,r),r=i)}return r}function aaRecreateElementFromEntry(e,t){const n=e.treeAdapter.getNamespaceURI(t.element),r=e.treeAdapter.createElement(t.token.tagName,n,t.token.attrs);return e.openElements.replace(t.element,r),t.element=r,r}function aaInsertLastNodeInCommonAncestor(e,t,n){const r=getTagID(e.treeAdapter.getTagName(t));if(e._isElementCausesFosterParenting(r))e._fosterParentElement(n);else{const s=e.treeAdapter.getNamespaceURI(t);r===TAG_ID.TEMPLATE&&s===NS.HTML&&(t=e.treeAdapter.getTemplateContent(t)),e.treeAdapter.appendChild(t,n)}}function aaReplaceFormattingElement(e,t,n){const r=e.treeAdapter.getNamespaceURI(n.element),{token:s}=n,a=e.treeAdapter.createElement(s.tagName,r,s.attrs);e._adoptNodes(t,a),e.treeAdapter.appendChild(t,a),e.activeFormattingElements.insertElementAfterBookmark(a,s),e.activeFormattingElements.removeEntry(n),e.openElements.remove(n.element),e.openElements.insertAfter(t,a,s.tagID)}function callAdoptionAgency(e,t){for(let n=0;n<8;n++){const n=aaObtainFormattingElementEntry(e,t);if(!n)break;const r=aaObtainFurthestBlock(e,n);if(!r)break;e.activeFormattingElements.bookmark=n;const s=aaInnerLoop(e,r,n.element),a=e.openElements.getCommonAncestor(n.element);e.treeAdapter.detachNode(s),a&&aaInsertLastNodeInCommonAncestor(e,a,s),aaReplaceFormattingElement(e,r,n)}}function appendComment(e,t){e._appendCommentNode(t,e.openElements.currentTmplContentOrNode)}function stopParsing(e,t){if(e.stopped=!0,t.location){const n=e.fragmentContext?0:2;for(let r=e.openElements.stackTop;r>=n;r--)e._setEndLocation(e.openElements.items[r],t);if(!e.fragmentContext&&e.openElements.stackTop>=0){const n=e.openElements.items[0],r=e.treeAdapter.getNodeSourceCodeLocation(n);if(r&&!r.endTag&&(e._setEndLocation(n,t),e.openElements.stackTop>=1)){const n=e.openElements.items[1],r=e.treeAdapter.getNodeSourceCodeLocation(n);r&&!r.endTag&&e._setEndLocation(n,t)}}}}function tokenInInitialMode(e,t){e._err(t,ERR.missingDoctype,!0),e.treeAdapter.setDocumentMode(e.document,DOCUMENT_MODE.QUIRKS),e.insertionMode=InsertionMode.BEFORE_HTML,e._processToken(t)}function tokenBeforeHtml(e,t){e._insertFakeRootElement(),e.insertionMode=InsertionMode.BEFORE_HEAD,e._processToken(t)}function tokenBeforeHead(e,t){e._insertFakeElement(TAG_NAMES.HEAD,TAG_ID.HEAD),e.headElement=e.openElements.current,e.insertionMode=InsertionMode.IN_HEAD,e._processToken(t)}function startTagInHead(e,t){switch(t.tagID){case TAG_ID.HTML:startTagInBody(e,t);break;case TAG_ID.BASE:case TAG_ID.BASEFONT:case TAG_ID.BGSOUND:case TAG_ID.LINK:case TAG_ID.META:e._appendElement(t,NS.HTML),t.ackSelfClosing=!0;break;case TAG_ID.TITLE:e._switchToTextParsing(t,TokenizerMode.RCDATA);break;case TAG_ID.NOSCRIPT:e.options.scriptingEnabled?e._switchToTextParsing(t,TokenizerMode.RAWTEXT):(e._insertElement(t,NS.HTML),e.insertionMode=InsertionMode.IN_HEAD_NO_SCRIPT);break;case TAG_ID.NOFRAMES:case TAG_ID.STYLE:e._switchToTextParsing(t,TokenizerMode.RAWTEXT);break;case TAG_ID.SCRIPT:e._switchToTextParsing(t,TokenizerMode.SCRIPT_DATA);break;case TAG_ID.TEMPLATE:e._insertTemplate(t),e.activeFormattingElements.insertMarker(),e.framesetOk=!1,e.insertionMode=InsertionMode.IN_TEMPLATE,e.tmplInsertionModeStack.unshift(InsertionMode.IN_TEMPLATE);break;case TAG_ID.HEAD:e._err(t,ERR.misplacedStartTagForHeadElement);break;default:tokenInHead(e,t)}}function templateEndTagInHead(e,t){e.openElements.tmplCount>0?(e.openElements.generateImpliedEndTagsThoroughly(),e.openElements.currentTagId!==TAG_ID.TEMPLATE&&e._err(t,ERR.closingOfElementWithOpenChildElements),e.openElements.popUntilTagNamePopped(TAG_ID.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode()):e._err(t,ERR.endTagWithoutMatchingOpenElement)}function tokenInHead(e,t){e.openElements.pop(),e.insertionMode=InsertionMode.AFTER_HEAD,e._processToken(t)}function tokenInHeadNoScript(e,t){const n=t.type===TokenType.EOF?ERR.openElementsLeftAfterEof:ERR.disallowedContentInNoscriptInHead;e._err(t,n),e.openElements.pop(),e.insertionMode=InsertionMode.IN_HEAD,e._processToken(t)}function tokenAfterHead(e,t){e._insertFakeElement(TAG_NAMES.BODY,TAG_ID.BODY),e.insertionMode=InsertionMode.IN_BODY,modeInBody(e,t)}function modeInBody(e,t){switch(t.type){case TokenType.CHARACTER:characterInBody(e,t);break;case TokenType.WHITESPACE_CHARACTER:whitespaceCharacterInBody(e,t);break;case TokenType.COMMENT:appendComment(e,t);break;case TokenType.START_TAG:startTagInBody(e,t);break;case TokenType.END_TAG:endTagInBody(e,t);break;case TokenType.EOF:eofInBody(e,t)}}function whitespaceCharacterInBody(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t)}function characterInBody(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t),e.framesetOk=!1}function areaStartTagInBody(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,NS.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function isHiddenInput(e){const t=getTokenAttr(e,ATTRS.TYPE);return null!=t&&"hidden"===t.toLowerCase()}function rawTextStartTagInBody(e,t){e._switchToTextParsing(t,TokenizerMode.RAWTEXT)}function genericStartTagInBody(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,NS.HTML)}function startTagInBody(e,t){switch(t.tagID){case TAG_ID.I:case TAG_ID.S:case TAG_ID.B:case TAG_ID.U:case TAG_ID.EM:case TAG_ID.TT:case TAG_ID.BIG:case TAG_ID.CODE:case TAG_ID.FONT:case TAG_ID.SMALL:case TAG_ID.STRIKE:case TAG_ID.STRONG:!function(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,NS.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}(e,t);break;case TAG_ID.A:!function(e,t){const n=e.activeFormattingElements.getElementEntryInScopeWithTagName(TAG_NAMES.A);n&&(callAdoptionAgency(e,t),e.openElements.remove(n.element),e.activeFormattingElements.removeEntry(n)),e._reconstructActiveFormattingElements(),e._insertElement(t,NS.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}(e,t);break;case TAG_ID.H1:case TAG_ID.H2:case TAG_ID.H3:case TAG_ID.H4:case TAG_ID.H5:case TAG_ID.H6:!function(e,t){e.openElements.hasInButtonScope(TAG_ID.P)&&e._closePElement(),void 0!==e.openElements.currentTagId&&NUMBERED_HEADERS.has(e.openElements.currentTagId)&&e.openElements.pop(),e._insertElement(t,NS.HTML)}(e,t);break;case TAG_ID.P:case TAG_ID.DL:case TAG_ID.OL:case TAG_ID.UL:case TAG_ID.DIV:case TAG_ID.DIR:case TAG_ID.NAV:case TAG_ID.MAIN:case TAG_ID.MENU:case TAG_ID.ASIDE:case TAG_ID.CENTER:case TAG_ID.FIGURE:case TAG_ID.FOOTER:case TAG_ID.HEADER:case TAG_ID.HGROUP:case TAG_ID.DIALOG:case TAG_ID.DETAILS:case TAG_ID.ADDRESS:case TAG_ID.ARTICLE:case TAG_ID.SEARCH:case TAG_ID.SECTION:case TAG_ID.SUMMARY:case TAG_ID.FIELDSET:case TAG_ID.BLOCKQUOTE:case TAG_ID.FIGCAPTION:!function(e,t){e.openElements.hasInButtonScope(TAG_ID.P)&&e._closePElement(),e._insertElement(t,NS.HTML)}(e,t);break;case TAG_ID.LI:case TAG_ID.DD:case TAG_ID.DT:!function(e,t){e.framesetOk=!1;const n=t.tagID;for(let t=e.openElements.stackTop;t>=0;t--){const r=e.openElements.tagIDs[t];if(n===TAG_ID.LI&&r===TAG_ID.LI||(n===TAG_ID.DD||n===TAG_ID.DT)&&(r===TAG_ID.DD||r===TAG_ID.DT)){e.openElements.generateImpliedEndTagsWithExclusion(r),e.openElements.popUntilTagNamePopped(r);break}if(r!==TAG_ID.ADDRESS&&r!==TAG_ID.DIV&&r!==TAG_ID.P&&e._isSpecialElement(e.openElements.items[t],r))break}e.openElements.hasInButtonScope(TAG_ID.P)&&e._closePElement(),e._insertElement(t,NS.HTML)}(e,t);break;case TAG_ID.BR:case TAG_ID.IMG:case TAG_ID.WBR:case TAG_ID.AREA:case TAG_ID.EMBED:case TAG_ID.KEYGEN:areaStartTagInBody(e,t);break;case TAG_ID.HR:!function(e,t){e.openElements.hasInButtonScope(TAG_ID.P)&&e._closePElement(),e._appendElement(t,NS.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}(e,t);break;case TAG_ID.RB:case TAG_ID.RTC:!function(e,t){e.openElements.hasInScope(TAG_ID.RUBY)&&e.openElements.generateImpliedEndTags(),e._insertElement(t,NS.HTML)}(e,t);break;case TAG_ID.RT:case TAG_ID.RP:!function(e,t){e.openElements.hasInScope(TAG_ID.RUBY)&&e.openElements.generateImpliedEndTagsWithExclusion(TAG_ID.RTC),e._insertElement(t,NS.HTML)}(e,t);break;case TAG_ID.PRE:case TAG_ID.LISTING:!function(e,t){e.openElements.hasInButtonScope(TAG_ID.P)&&e._closePElement(),e._insertElement(t,NS.HTML),e.skipNextNewLine=!0,e.framesetOk=!1}(e,t);break;case TAG_ID.XMP:!function(e,t){e.openElements.hasInButtonScope(TAG_ID.P)&&e._closePElement(),e._reconstructActiveFormattingElements(),e.framesetOk=!1,e._switchToTextParsing(t,TokenizerMode.RAWTEXT)}(e,t);break;case TAG_ID.SVG:!function(e,t){e._reconstructActiveFormattingElements(),adjustTokenSVGAttrs(t),adjustTokenXMLAttrs(t),t.selfClosing?e._appendElement(t,NS.SVG):e._insertElement(t,NS.SVG),t.ackSelfClosing=!0}(e,t);break;case TAG_ID.HTML:!function(e,t){0===e.openElements.tmplCount&&e.treeAdapter.adoptAttributes(e.openElements.items[0],t.attrs)}(e,t);break;case TAG_ID.BASE:case TAG_ID.LINK:case TAG_ID.META:case TAG_ID.STYLE:case TAG_ID.TITLE:case TAG_ID.SCRIPT:case TAG_ID.BGSOUND:case TAG_ID.BASEFONT:case TAG_ID.TEMPLATE:startTagInHead(e,t);break;case TAG_ID.BODY:!function(e,t){const n=e.openElements.tryPeekProperlyNestedBodyElement();n&&0===e.openElements.tmplCount&&(e.framesetOk=!1,e.treeAdapter.adoptAttributes(n,t.attrs))}(e,t);break;case TAG_ID.FORM:!function(e,t){const n=e.openElements.tmplCount>0;e.formElement&&!n||(e.openElements.hasInButtonScope(TAG_ID.P)&&e._closePElement(),e._insertElement(t,NS.HTML),n||(e.formElement=e.openElements.current))}(e,t);break;case TAG_ID.NOBR:!function(e,t){e._reconstructActiveFormattingElements(),e.openElements.hasInScope(TAG_ID.NOBR)&&(callAdoptionAgency(e,t),e._reconstructActiveFormattingElements()),e._insertElement(t,NS.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}(e,t);break;case TAG_ID.MATH:!function(e,t){e._reconstructActiveFormattingElements(),adjustTokenMathMLAttrs(t),adjustTokenXMLAttrs(t),t.selfClosing?e._appendElement(t,NS.MATHML):e._insertElement(t,NS.MATHML),t.ackSelfClosing=!0}(e,t);break;case TAG_ID.TABLE:!function(e,t){e.treeAdapter.getDocumentMode(e.document)!==DOCUMENT_MODE.QUIRKS&&e.openElements.hasInButtonScope(TAG_ID.P)&&e._closePElement(),e._insertElement(t,NS.HTML),e.framesetOk=!1,e.insertionMode=InsertionMode.IN_TABLE}(e,t);break;case TAG_ID.INPUT:!function(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,NS.HTML),isHiddenInput(t)||(e.framesetOk=!1),t.ackSelfClosing=!0}(e,t);break;case TAG_ID.PARAM:case TAG_ID.TRACK:case TAG_ID.SOURCE:!function(e,t){e._appendElement(t,NS.HTML),t.ackSelfClosing=!0}(e,t);break;case TAG_ID.IMAGE:!function(e,t){t.tagName=TAG_NAMES.IMG,t.tagID=TAG_ID.IMG,areaStartTagInBody(e,t)}(e,t);break;case TAG_ID.BUTTON:!function(e,t){e.openElements.hasInScope(TAG_ID.BUTTON)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(TAG_ID.BUTTON)),e._reconstructActiveFormattingElements(),e._insertElement(t,NS.HTML),e.framesetOk=!1}(e,t);break;case TAG_ID.APPLET:case TAG_ID.OBJECT:case TAG_ID.MARQUEE:!function(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,NS.HTML),e.activeFormattingElements.insertMarker(),e.framesetOk=!1}(e,t);break;case TAG_ID.IFRAME:!function(e,t){e.framesetOk=!1,e._switchToTextParsing(t,TokenizerMode.RAWTEXT)}(e,t);break;case TAG_ID.SELECT:!function(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,NS.HTML),e.framesetOk=!1,e.insertionMode=e.insertionMode===InsertionMode.IN_TABLE||e.insertionMode===InsertionMode.IN_CAPTION||e.insertionMode===InsertionMode.IN_TABLE_BODY||e.insertionMode===InsertionMode.IN_ROW||e.insertionMode===InsertionMode.IN_CELL?InsertionMode.IN_SELECT_IN_TABLE:InsertionMode.IN_SELECT}(e,t);break;case TAG_ID.OPTION:case TAG_ID.OPTGROUP:!function(e,t){e.openElements.currentTagId===TAG_ID.OPTION&&e.openElements.pop(),e._reconstructActiveFormattingElements(),e._insertElement(t,NS.HTML)}(e,t);break;case TAG_ID.NOEMBED:case TAG_ID.NOFRAMES:rawTextStartTagInBody(e,t);break;case TAG_ID.FRAMESET:!function(e,t){const n=e.openElements.tryPeekProperlyNestedBodyElement();e.framesetOk&&n&&(e.treeAdapter.detachNode(n),e.openElements.popAllUpToHtmlElement(),e._insertElement(t,NS.HTML),e.insertionMode=InsertionMode.IN_FRAMESET)}(e,t);break;case TAG_ID.TEXTAREA:!function(e,t){e._insertElement(t,NS.HTML),e.skipNextNewLine=!0,e.tokenizer.state=TokenizerMode.RCDATA,e.originalInsertionMode=e.insertionMode,e.framesetOk=!1,e.insertionMode=InsertionMode.TEXT}(e,t);break;case TAG_ID.NOSCRIPT:e.options.scriptingEnabled?rawTextStartTagInBody(e,t):genericStartTagInBody(e,t);break;case TAG_ID.PLAINTEXT:!function(e,t){e.openElements.hasInButtonScope(TAG_ID.P)&&e._closePElement(),e._insertElement(t,NS.HTML),e.tokenizer.state=TokenizerMode.PLAINTEXT}(e,t);break;case TAG_ID.COL:case TAG_ID.TH:case TAG_ID.TD:case TAG_ID.TR:case TAG_ID.HEAD:case TAG_ID.FRAME:case TAG_ID.TBODY:case TAG_ID.TFOOT:case TAG_ID.THEAD:case TAG_ID.CAPTION:case TAG_ID.COLGROUP:break;default:genericStartTagInBody(e,t)}}function genericEndTagInBody(e,t){const n=t.tagName,r=t.tagID;for(let t=e.openElements.stackTop;t>0;t--){const s=e.openElements.items[t],a=e.openElements.tagIDs[t];if(r===a&&(r!==TAG_ID.UNKNOWN||e.treeAdapter.getTagName(s)===n)){e.openElements.generateImpliedEndTagsWithExclusion(r),e.openElements.stackTop>=t&&e.openElements.shortenToLength(t);break}if(e._isSpecialElement(s,a))break}}function endTagInBody(e,t){switch(t.tagID){case TAG_ID.A:case TAG_ID.B:case TAG_ID.I:case TAG_ID.S:case TAG_ID.U:case TAG_ID.EM:case TAG_ID.TT:case TAG_ID.BIG:case TAG_ID.CODE:case TAG_ID.FONT:case TAG_ID.NOBR:case TAG_ID.SMALL:case TAG_ID.STRIKE:case TAG_ID.STRONG:callAdoptionAgency(e,t);break;case TAG_ID.P:!function(e){e.openElements.hasInButtonScope(TAG_ID.P)||e._insertFakeElement(TAG_NAMES.P,TAG_ID.P),e._closePElement()}(e);break;case TAG_ID.DL:case TAG_ID.UL:case TAG_ID.OL:case TAG_ID.DIR:case TAG_ID.DIV:case TAG_ID.NAV:case TAG_ID.PRE:case TAG_ID.MAIN:case TAG_ID.MENU:case TAG_ID.ASIDE:case TAG_ID.BUTTON:case TAG_ID.CENTER:case TAG_ID.FIGURE:case TAG_ID.FOOTER:case TAG_ID.HEADER:case TAG_ID.HGROUP:case TAG_ID.DIALOG:case TAG_ID.ADDRESS:case TAG_ID.ARTICLE:case TAG_ID.DETAILS:case TAG_ID.SEARCH:case TAG_ID.SECTION:case TAG_ID.SUMMARY:case TAG_ID.LISTING:case TAG_ID.FIELDSET:case TAG_ID.BLOCKQUOTE:case TAG_ID.FIGCAPTION:!function(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n))}(e,t);break;case TAG_ID.LI:!function(e){e.openElements.hasInListItemScope(TAG_ID.LI)&&(e.openElements.generateImpliedEndTagsWithExclusion(TAG_ID.LI),e.openElements.popUntilTagNamePopped(TAG_ID.LI))}(e);break;case TAG_ID.DD:case TAG_ID.DT:!function(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTagsWithExclusion(n),e.openElements.popUntilTagNamePopped(n))}(e,t);break;case TAG_ID.H1:case TAG_ID.H2:case TAG_ID.H3:case TAG_ID.H4:case TAG_ID.H5:case TAG_ID.H6:!function(e){e.openElements.hasNumberedHeaderInScope()&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilNumberedHeaderPopped())}(e);break;case TAG_ID.BR:!function(e){e._reconstructActiveFormattingElements(),e._insertFakeElement(TAG_NAMES.BR,TAG_ID.BR),e.openElements.pop(),e.framesetOk=!1}(e);break;case TAG_ID.BODY:!function(e,t){if(e.openElements.hasInScope(TAG_ID.BODY)&&(e.insertionMode=InsertionMode.AFTER_BODY,e.options.sourceCodeLocationInfo)){const n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e._setEndLocation(n,t)}}(e,t);break;case TAG_ID.HTML:!function(e,t){e.openElements.hasInScope(TAG_ID.BODY)&&(e.insertionMode=InsertionMode.AFTER_BODY,endTagAfterBody(e,t))}(e,t);break;case TAG_ID.FORM:!function(e){const t=e.openElements.tmplCount>0,{formElement:n}=e;t||(e.formElement=null),(n||t)&&e.openElements.hasInScope(TAG_ID.FORM)&&(e.openElements.generateImpliedEndTags(),t?e.openElements.popUntilTagNamePopped(TAG_ID.FORM):n&&e.openElements.remove(n))}(e);break;case TAG_ID.APPLET:case TAG_ID.OBJECT:case TAG_ID.MARQUEE:!function(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n),e.activeFormattingElements.clearToLastMarker())}(e,t);break;case TAG_ID.TEMPLATE:templateEndTagInHead(e,t);break;default:genericEndTagInBody(e,t)}}function eofInBody(e,t){e.tmplInsertionModeStack.length>0?eofInTemplate(e,t):stopParsing(e,t)}function characterInTable(e,t){if(void 0!==e.openElements.currentTagId&&TABLE_STRUCTURE_TAGS.has(e.openElements.currentTagId))switch(e.pendingCharacterTokens.length=0,e.hasNonWhitespacePendingCharacterToken=!1,e.originalInsertionMode=e.insertionMode,e.insertionMode=InsertionMode.IN_TABLE_TEXT,t.type){case TokenType.CHARACTER:characterInTableText(e,t);break;case TokenType.WHITESPACE_CHARACTER:whitespaceCharacterInTableText(e,t)}else tokenInTable(e,t)}function startTagInTable(e,t){switch(t.tagID){case TAG_ID.TD:case TAG_ID.TH:case TAG_ID.TR:!function(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(TAG_NAMES.TBODY,TAG_ID.TBODY),e.insertionMode=InsertionMode.IN_TABLE_BODY,startTagInTableBody(e,t)}(e,t);break;case TAG_ID.STYLE:case TAG_ID.SCRIPT:case TAG_ID.TEMPLATE:startTagInHead(e,t);break;case TAG_ID.COL:!function(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(TAG_NAMES.COLGROUP,TAG_ID.COLGROUP),e.insertionMode=InsertionMode.IN_COLUMN_GROUP,startTagInColumnGroup(e,t)}(e,t);break;case TAG_ID.FORM:!function(e,t){e.formElement||0!==e.openElements.tmplCount||(e._insertElement(t,NS.HTML),e.formElement=e.openElements.current,e.openElements.pop())}(e,t);break;case TAG_ID.TABLE:!function(e,t){e.openElements.hasInTableScope(TAG_ID.TABLE)&&(e.openElements.popUntilTagNamePopped(TAG_ID.TABLE),e._resetInsertionMode(),e._processStartTag(t))}(e,t);break;case TAG_ID.TBODY:case TAG_ID.TFOOT:case TAG_ID.THEAD:!function(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,NS.HTML),e.insertionMode=InsertionMode.IN_TABLE_BODY}(e,t);break;case TAG_ID.INPUT:!function(e,t){isHiddenInput(t)?e._appendElement(t,NS.HTML):tokenInTable(e,t),t.ackSelfClosing=!0}(e,t);break;case TAG_ID.CAPTION:!function(e,t){e.openElements.clearBackToTableContext(),e.activeFormattingElements.insertMarker(),e._insertElement(t,NS.HTML),e.insertionMode=InsertionMode.IN_CAPTION}(e,t);break;case TAG_ID.COLGROUP:!function(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,NS.HTML),e.insertionMode=InsertionMode.IN_COLUMN_GROUP}(e,t);break;default:tokenInTable(e,t)}}function endTagInTable(e,t){switch(t.tagID){case TAG_ID.TABLE:e.openElements.hasInTableScope(TAG_ID.TABLE)&&(e.openElements.popUntilTagNamePopped(TAG_ID.TABLE),e._resetInsertionMode());break;case TAG_ID.TEMPLATE:templateEndTagInHead(e,t);break;case TAG_ID.BODY:case TAG_ID.CAPTION:case TAG_ID.COL:case TAG_ID.COLGROUP:case TAG_ID.HTML:case TAG_ID.TBODY:case TAG_ID.TD:case TAG_ID.TFOOT:case TAG_ID.TH:case TAG_ID.THEAD:case TAG_ID.TR:break;default:tokenInTable(e,t)}}function tokenInTable(e,t){const n=e.fosterParentingEnabled;e.fosterParentingEnabled=!0,modeInBody(e,t),e.fosterParentingEnabled=n}function whitespaceCharacterInTableText(e,t){e.pendingCharacterTokens.push(t)}function characterInTableText(e,t){e.pendingCharacterTokens.push(t),e.hasNonWhitespacePendingCharacterToken=!0}function tokenInTableText(e,t){let n=0;if(e.hasNonWhitespacePendingCharacterToken)for(;n<e.pendingCharacterTokens.length;n++)tokenInTable(e,e.pendingCharacterTokens[n]);else for(;n<e.pendingCharacterTokens.length;n++)e._insertCharacters(e.pendingCharacterTokens[n]);e.insertionMode=e.originalInsertionMode,e._processToken(t)}var TABLE_VOID_ELEMENTS=new Set([TAG_ID.CAPTION,TAG_ID.COL,TAG_ID.COLGROUP,TAG_ID.TBODY,TAG_ID.TD,TAG_ID.TFOOT,TAG_ID.TH,TAG_ID.THEAD,TAG_ID.TR]);function startTagInColumnGroup(e,t){switch(t.tagID){case TAG_ID.HTML:startTagInBody(e,t);break;case TAG_ID.COL:e._appendElement(t,NS.HTML),t.ackSelfClosing=!0;break;case TAG_ID.TEMPLATE:startTagInHead(e,t);break;default:tokenInColumnGroup(e,t)}}function tokenInColumnGroup(e,t){e.openElements.currentTagId===TAG_ID.COLGROUP&&(e.openElements.pop(),e.insertionMode=InsertionMode.IN_TABLE,e._processToken(t))}function startTagInTableBody(e,t){switch(t.tagID){case TAG_ID.TR:e.openElements.clearBackToTableBodyContext(),e._insertElement(t,NS.HTML),e.insertionMode=InsertionMode.IN_ROW;break;case TAG_ID.TH:case TAG_ID.TD:e.openElements.clearBackToTableBodyContext(),e._insertFakeElement(TAG_NAMES.TR,TAG_ID.TR),e.insertionMode=InsertionMode.IN_ROW,startTagInRow(e,t);break;case TAG_ID.CAPTION:case TAG_ID.COL:case TAG_ID.COLGROUP:case TAG_ID.TBODY:case TAG_ID.TFOOT:case TAG_ID.THEAD:e.openElements.hasTableBodyContextInTableScope()&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=InsertionMode.IN_TABLE,startTagInTable(e,t));break;default:startTagInTable(e,t)}}function endTagInTableBody(e,t){const n=t.tagID;switch(t.tagID){case TAG_ID.TBODY:case TAG_ID.TFOOT:case TAG_ID.THEAD:e.openElements.hasInTableScope(n)&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=InsertionMode.IN_TABLE);break;case TAG_ID.TABLE:e.openElements.hasTableBodyContextInTableScope()&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=InsertionMode.IN_TABLE,endTagInTable(e,t));break;case TAG_ID.BODY:case TAG_ID.CAPTION:case TAG_ID.COL:case TAG_ID.COLGROUP:case TAG_ID.HTML:case TAG_ID.TD:case TAG_ID.TH:case TAG_ID.TR:break;default:endTagInTable(e,t)}}function startTagInRow(e,t){switch(t.tagID){case TAG_ID.TH:case TAG_ID.TD:e.openElements.clearBackToTableRowContext(),e._insertElement(t,NS.HTML),e.insertionMode=InsertionMode.IN_CELL,e.activeFormattingElements.insertMarker();break;case TAG_ID.CAPTION:case TAG_ID.COL:case TAG_ID.COLGROUP:case TAG_ID.TBODY:case TAG_ID.TFOOT:case TAG_ID.THEAD:case TAG_ID.TR:e.openElements.hasInTableScope(TAG_ID.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=InsertionMode.IN_TABLE_BODY,startTagInTableBody(e,t));break;default:startTagInTable(e,t)}}function endTagInRow(e,t){switch(t.tagID){case TAG_ID.TR:e.openElements.hasInTableScope(TAG_ID.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=InsertionMode.IN_TABLE_BODY);break;case TAG_ID.TABLE:e.openElements.hasInTableScope(TAG_ID.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=InsertionMode.IN_TABLE_BODY,endTagInTableBody(e,t));break;case TAG_ID.TBODY:case TAG_ID.TFOOT:case TAG_ID.THEAD:(e.openElements.hasInTableScope(t.tagID)||e.openElements.hasInTableScope(TAG_ID.TR))&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=InsertionMode.IN_TABLE_BODY,endTagInTableBody(e,t));break;case TAG_ID.BODY:case TAG_ID.CAPTION:case TAG_ID.COL:case TAG_ID.COLGROUP:case TAG_ID.HTML:case TAG_ID.TD:case TAG_ID.TH:break;default:endTagInTable(e,t)}}function startTagInSelect(e,t){switch(t.tagID){case TAG_ID.HTML:startTagInBody(e,t);break;case TAG_ID.OPTION:e.openElements.currentTagId===TAG_ID.OPTION&&e.openElements.pop(),e._insertElement(t,NS.HTML);break;case TAG_ID.OPTGROUP:e.openElements.currentTagId===TAG_ID.OPTION&&e.openElements.pop(),e.openElements.currentTagId===TAG_ID.OPTGROUP&&e.openElements.pop(),e._insertElement(t,NS.HTML);break;case TAG_ID.HR:e.openElements.currentTagId===TAG_ID.OPTION&&e.openElements.pop(),e.openElements.currentTagId===TAG_ID.OPTGROUP&&e.openElements.pop(),e._appendElement(t,NS.HTML),t.ackSelfClosing=!0;break;case TAG_ID.INPUT:case TAG_ID.KEYGEN:case TAG_ID.TEXTAREA:case TAG_ID.SELECT:e.openElements.hasInSelectScope(TAG_ID.SELECT)&&(e.openElements.popUntilTagNamePopped(TAG_ID.SELECT),e._resetInsertionMode(),t.tagID!==TAG_ID.SELECT&&e._processStartTag(t));break;case TAG_ID.SCRIPT:case TAG_ID.TEMPLATE:startTagInHead(e,t)}}function endTagInSelect(e,t){switch(t.tagID){case TAG_ID.OPTGROUP:e.openElements.stackTop>0&&e.openElements.currentTagId===TAG_ID.OPTION&&e.openElements.tagIDs[e.openElements.stackTop-1]===TAG_ID.OPTGROUP&&e.openElements.pop(),e.openElements.currentTagId===TAG_ID.OPTGROUP&&e.openElements.pop();break;case TAG_ID.OPTION:e.openElements.currentTagId===TAG_ID.OPTION&&e.openElements.pop();break;case TAG_ID.SELECT:e.openElements.hasInSelectScope(TAG_ID.SELECT)&&(e.openElements.popUntilTagNamePopped(TAG_ID.SELECT),e._resetInsertionMode());break;case TAG_ID.TEMPLATE:templateEndTagInHead(e,t)}}function eofInTemplate(e,t){e.openElements.tmplCount>0?(e.openElements.popUntilTagNamePopped(TAG_ID.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode(),e.onEof(t)):stopParsing(e,t)}function endTagAfterBody(e,t){var n;if(t.tagID===TAG_ID.HTML){if(e.fragmentContext||(e.insertionMode=InsertionMode.AFTER_AFTER_BODY),e.options.sourceCodeLocationInfo&&e.openElements.tagIDs[0]===TAG_ID.HTML){e._setEndLocation(e.openElements.items[0],t);const r=e.openElements.items[1];r&&!(null===(n=e.treeAdapter.getNodeSourceCodeLocation(r))||void 0===n?void 0:n.endTag)&&e._setEndLocation(r,t)}}else tokenAfterBody(e,t)}function tokenAfterBody(e,t){e.insertionMode=InsertionMode.IN_BODY,modeInBody(e,t)}function tokenAfterAfterBody(e,t){e.insertionMode=InsertionMode.IN_BODY,modeInBody(e,t)}function popUntilHtmlOrIntegrationPoint(e){for(;e.treeAdapter.getNamespaceURI(e.openElements.current)!==NS.HTML&&void 0!==e.openElements.currentTagId&&!e._isIntegrationPoint(e.openElements.currentTagId,e.openElements.current);)e.openElements.pop()}function parse3(e,t){return Parser3.parse(e,t)}function parseFragment(e,t,n){"string"==typeof e&&(n=t,t=e,e=null);const r=Parser3.getFragmentParser(e,n);return r.tokenizer.write(t,!0),r.getFragment()}String.prototype.codePointAt,TAG_NAMES.AREA,TAG_NAMES.BASE,TAG_NAMES.BASEFONT,TAG_NAMES.BGSOUND,TAG_NAMES.BR,TAG_NAMES.COL,TAG_NAMES.EMBED,TAG_NAMES.FRAME,TAG_NAMES.HR,TAG_NAMES.IMG,TAG_NAMES.INPUT,TAG_NAMES.KEYGEN,TAG_NAMES.LINK,TAG_NAMES.META,TAG_NAMES.PARAM,TAG_NAMES.SOURCE,TAG_NAMES.TRACK,TAG_NAMES.WBR;var errors={abandonedHeadElementChild:{reason:"Unexpected metadata element after head",description:"Unexpected element after head. Expected the element before `</head>`",url:!1},abruptClosingOfEmptyComment:{reason:"Unexpected abruptly closed empty comment",description:"Unexpected `>` or `->`. Expected `--\x3e` to close comments"},abruptDoctypePublicIdentifier:{reason:"Unexpected abruptly closed public identifier",description:"Unexpected `>`. Expected a closing `\"` or `'` after the public identifier"},abruptDoctypeSystemIdentifier:{reason:"Unexpected abruptly closed system identifier",description:"Unexpected `>`. Expected a closing `\"` or `'` after the identifier identifier"},absenceOfDigitsInNumericCharacterReference:{reason:"Unexpected non-digit at start of numeric character reference",description:"Unexpected `%c`. Expected `[0-9]` for decimal references or `[0-9a-fA-F]` for hexadecimal references"},cdataInHtmlContent:{reason:"Unexpected CDATA section in HTML",description:"Unexpected `<![CDATA[` in HTML. Remove it, use a comment, or encode special characters instead"},characterReferenceOutsideUnicodeRange:{reason:"Unexpected too big numeric character reference",description:"Unexpectedly high character reference. Expected character references to be at most hexadecimal 10ffff (or decimal 1114111)"},closingOfElementWithOpenChildElements:{reason:"Unexpected closing tag with open child elements",description:"Unexpectedly closing tag. Expected other tags to be closed first",url:!1},controlCharacterInInputStream:{reason:"Unexpected control character",description:"Unexpected control character `%x`. Expected a non-control code point, 0x00, or ASCII whitespace"},controlCharacterReference:{reason:"Unexpected control character reference",description:"Unexpectedly control character in reference. Expected a non-control code point, 0x00, or ASCII whitespace"},disallowedContentInNoscriptInHead:{reason:"Disallowed content inside `<noscript>` in `<head>`",description:"Unexpected text character `%c`. Only use text in `<noscript>`s in `<body>`",url:!1},duplicateAttribute:{reason:"Unexpected duplicate attribute",description:"Unexpectedly double attribute. Expected attributes to occur only once"},endTagWithAttributes:{reason:"Unexpected attribute on closing tag",description:"Unexpected attribute. Expected `>` instead"},endTagWithTrailingSolidus:{reason:"Unexpected slash at end of closing tag",description:"Unexpected `%c-1`. Expected `>` instead"},endTagWithoutMatchingOpenElement:{reason:"Unexpected unopened end tag",description:"Unexpected end tag. Expected no end tag or another end tag",url:!1},eofBeforeTagName:{reason:"Unexpected end of file",description:"Unexpected end of file. Expected tag name instead"},eofInCdata:{reason:"Unexpected end of file in CDATA",description:"Unexpected end of file. Expected `]]>` to close the CDATA"},eofInComment:{reason:"Unexpected end of file in comment",description:"Unexpected end of file. Expected `--\x3e` to close the comment"},eofInDoctype:{reason:"Unexpected end of file in doctype",description:"Unexpected end of file. Expected a valid doctype (such as `<!doctype html>`)"},eofInElementThatCanContainOnlyText:{reason:"Unexpected end of file in element that can only contain text",description:"Unexpected end of file. Expected text or a closing tag",url:!1},eofInScriptHtmlCommentLikeText:{reason:"Unexpected end of file in comment inside script",description:"Unexpected end of file. Expected `--\x3e` to close the comment"},eofInTag:{reason:"Unexpected end of file in tag",description:"Unexpected end of file. Expected `>` to close the tag"},incorrectlyClosedComment:{reason:"Incorrectly closed comment",description:"Unexpected `%c-1`. Expected `--\x3e` to close the comment"},incorrectlyOpenedComment:{reason:"Incorrectly opened comment",description:"Unexpected `%c`. Expected `\x3c!--` to open the comment"},invalidCharacterSequenceAfterDoctypeName:{reason:"Invalid sequence after doctype name",description:"Unexpected sequence at `%c`. Expected `public` or `system`"},invalidFirstCharacterOfTagName:{reason:"Invalid first character in tag name",description:"Unexpected `%c`. Expected an ASCII letter instead"},misplacedDoctype:{reason:"Misplaced doctype",description:"Unexpected doctype. Expected doctype before head",url:!1},misplacedStartTagForHeadElement:{reason:"Misplaced `<head>` start tag",description:"Unexpected start tag `<head>`. Expected `<head>` directly after doctype",url:!1},missingAttributeValue:{reason:"Missing attribute value",description:"Unexpected `%c-1`. Expected an attribute value or no `%c-1` instead"},missingDoctype:{reason:"Missing doctype before other content",description:"Expected a `<!doctype html>` before anything else",url:!1},missingDoctypeName:{reason:"Missing doctype name",description:"Unexpected doctype end at `%c`. Expected `html` instead"},missingDoctypePublicIdentifier:{reason:"Missing public identifier in doctype",description:"Unexpected `%c`. Expected identifier for `public` instead"},missingDoctypeSystemIdentifier:{reason:"Missing system identifier in doctype",description:'Unexpected `%c`. Expected identifier for `system` instead (suggested: `"about:legacy-compat"`)'},missingEndTagName:{reason:"Missing name in end tag",description:"Unexpected `%c`. Expected an ASCII letter instead"},missingQuoteBeforeDoctypePublicIdentifier:{reason:"Missing quote before public identifier in doctype",description:"Unexpected `%c`. Expected `\"` or `'` instead"},missingQuoteBeforeDoctypeSystemIdentifier:{reason:"Missing quote before system identifier in doctype",description:"Unexpected `%c`. Expected `\"` or `'` instead"},missingSemicolonAfterCharacterReference:{reason:"Missing semicolon after character reference",description:"Unexpected `%c`. Expected `;` instead"},missingWhitespaceAfterDoctypePublicKeyword:{reason:"Missing whitespace after public identifier in doctype",description:"Unexpected `%c`. Expected ASCII whitespace instead"},missingWhitespaceAfterDoctypeSystemKeyword:{reason:"Missing whitespace after system identifier in doctype",description:"Unexpected `%c`. Expected ASCII whitespace instead"},missingWhitespaceBeforeDoctypeName:{reason:"Missing whitespace before doctype name",description:"Unexpected `%c`. Expected ASCII whitespace instead"},missingWhitespaceBetweenAttributes:{reason:"Missing whitespace between attributes",description:"Unexpected `%c`. Expected ASCII whitespace instead"},missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers:{reason:"Missing whitespace between public and system identifiers in doctype",description:"Unexpected `%c`. Expected ASCII whitespace instead"},nestedComment:{reason:"Unexpected nested comment",description:"Unexpected `\x3c!--`. Expected `--\x3e`"},nestedNoscriptInHead:{reason:"Unexpected nested `<noscript>` in `<head>`",description:"Unexpected `<noscript>`. Expected a closing tag or a meta element",url:!1},nonConformingDoctype:{reason:"Unexpected non-conforming doctype declaration",description:'Expected `<!doctype html>` or `<!doctype html system "about:legacy-compat">`',url:!1},nonVoidHtmlElementStartTagWithTrailingSolidus:{reason:"Unexpected trailing slash on start tag of non-void element",description:"Unexpected `/`. Expected `>` instead"},noncharacterCharacterReference:{reason:"Unexpected noncharacter code point referenced by character reference",description:"Unexpected code point. Do not use noncharacters in HTML"},noncharacterInInputStream:{reason:"Unexpected noncharacter character",description:"Unexpected code point `%x`. Do not use noncharacters in HTML"},nullCharacterReference:{reason:"Unexpected NULL character referenced by character reference",description:"Unexpected code point. Do not use NULL characters in HTML"},openElementsLeftAfterEof:{reason:"Unexpected end of file",description:"Unexpected end of file. Expected closing tag instead",url:!1},surrogateCharacterReference:{reason:"Unexpected surrogate character referenced by character reference",description:"Unexpected code point. Do not use lone surrogate characters in HTML"},surrogateInInputStream:{reason:"Unexpected surrogate character",description:"Unexpected code point `%x`. Do not use lone surrogate characters in HTML"},unexpectedCharacterAfterDoctypeSystemIdentifier:{reason:"Invalid character after system identifier in doctype",description:"Unexpected character at `%c`. Expected `>`"},unexpectedCharacterInAttributeName:{reason:"Unexpected character in attribute name",description:"Unexpected `%c`. Expected whitespace, `/`, `>`, `=`, or probably an ASCII letter"},unexpectedCharacterInUnquotedAttributeValue:{reason:"Unexpected character in unquoted attribute value",description:"Unexpected `%c`. Quote the attribute value to include it"},unexpectedEqualsSignBeforeAttributeName:{reason:"Unexpected equals sign before attribute name",description:"Unexpected `%c`. Add an attribute name before it"},unexpectedNullCharacter:{reason:"Unexpected NULL character",description:"Unexpected code point `%x`. Do not use NULL characters in HTML"},unexpectedQuestionMarkInsteadOfTagName:{reason:"Unexpected question mark instead of tag name",description:"Unexpected `%c`. Expected an ASCII letter instead"},unexpectedSolidusInTag:{reason:"Unexpected slash in tag",description:"Unexpected `%c-1`. Expected it followed by `>` or in a quoted attribute value"},unknownNamedCharacterReference:{reason:"Unexpected unknown named character reference",description:"Unexpected character reference. Expected known named character references"}},dashToCamelRe=/-[a-z]/g,formatCRe=/%c(?:([-+])(\d+))?/g,formatXRe=/%x/g,fatalities={2:!0,1:!1,0:null},emptyOptions={};function dashToCamel(e){return e.charAt(1).toUpperCase()}function rehypeParse(e){const{emitParseErrors:t,...n}={...this.data("settings"),...e};this.parser=function(e,r){return function(e,t){const n=t||emptyOptions,r=n.onerror,s=e instanceof VFile?e:new VFile(e),a=n.fragment?parseFragment:parse3,i=String(s),o=a(i,{sourceCodeLocationInfo:!0,onParseError:n.onerror?function(e){const t=e.code,a=function(e){return e.replace(dashToCamelRe,dashToCamel)}(t),o=n[a],l=null==o||o,c="number"==typeof l?l:l?1:0;if(c){const n=errors[a],i=new VFileMessage(u(n.reason),{place:{start:{line:e.startLine,column:e.startCol,offset:e.startOffset},end:{line:e.endLine,column:e.endCol,offset:e.endOffset}},ruleId:t,source:"hast-util-from-html"});s.path&&(i.file=s.path,i.name=s.path+":"+i.name),i.fatal=fatalities[c],i.note=u(n.description),i.url=!1===n.url?void 0:"https://html.spec.whatwg.org/multipage/parsing.html#parse-error-"+t,r(i)}function u(t){return t.replace(formatCRe,function(t,n,r){const s=(r?Number.parseInt(r,10):0)*("-"===n?-1:1);return"`"===(a=i.charAt(e.startOffset+s))?"` ` `":a;var a}).replace(formatXRe,function(){return"0x"+i.charCodeAt(e.startOffset).toString(16).toUpperCase()})}}:null,scriptingEnabled:!1});return function(e,t){const n=t||{};return one({file:n.file||void 0,location:!1,schema:"svg"===n.space?svg4:html4,verbose:n.verbose||!1},e)}(o,{file:s,space:n.space,verbose:n.verbose})}(e,{...n,onerror:t?function(e){r.path&&(e.name=r.path+":"+e.name,e.file=r.path),r.messages.push(e)}:void 0})}}var htmlVoidElements=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"],Schema3=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};function merge3(e,t){const n={},r={};for(const t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new Schema3(n,r,t)}function normalize4(e){return e.toLowerCase()}Schema3.prototype.normal={},Schema3.prototype.property={},Schema3.prototype.space=void 0;var Info6=class{constructor(e,t){this.attribute=t,this.property=e}};Info6.prototype.attribute="",Info6.prototype.booleanish=!1,Info6.prototype.boolean=!1,Info6.prototype.commaOrSpaceSeparated=!1,Info6.prototype.commaSeparated=!1,Info6.prototype.defined=!1,Info6.prototype.mustUseProperty=!1,Info6.prototype.number=!1,Info6.prototype.overloadedBoolean=!1,Info6.prototype.property="",Info6.prototype.spaceSeparated=!1,Info6.prototype.space=void 0;var types_exports3={};__export(types_exports3,{boolean:()=>boolean3,booleanish:()=>booleanish3,commaOrSpaceSeparated:()=>commaOrSpaceSeparated3,commaSeparated:()=>commaSeparated3,number:()=>number3,overloadedBoolean:()=>overloadedBoolean3,spaceSeparated:()=>spaceSeparated3});var powers3=0,boolean3=increment3(),booleanish3=increment3(),overloadedBoolean3=increment3(),number3=increment3(),spaceSeparated3=increment3(),commaSeparated3=increment3(),commaOrSpaceSeparated3=increment3();function increment3(){return 2**++powers3}var checks3=Object.keys(types_exports3),DefinedInfo3=class extends Info6{constructor(e,t,n,r){let s=-1;if(super(e,t),mark3(this,"space",r),"number"==typeof n)for(;++s<checks3.length;){const e=checks3[s];mark3(this,checks3[s],(n&types_exports3[e])===types_exports3[e])}}};function mark3(e,t,n){n&&(e[t]=n)}function create3(e){const t={},n={};for(const[r,s]of Object.entries(e.properties)){const a=new DefinedInfo3(r,e.transform(e.attributes||{},r),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[normalize4(r)]=r,n[normalize4(a.attribute)]=r}return new Schema3(t,n,e.space)}DefinedInfo3.prototype.defined=!0;var aria3=create3({properties:{ariaActiveDescendant:null,ariaAtomic:booleanish3,ariaAutoComplete:null,ariaBusy:booleanish3,ariaChecked:booleanish3,ariaColCount:number3,ariaColIndex:number3,ariaColSpan:number3,ariaControls:spaceSeparated3,ariaCurrent:null,ariaDescribedBy:spaceSeparated3,ariaDetails:null,ariaDisabled:booleanish3,ariaDropEffect:spaceSeparated3,ariaErrorMessage:null,ariaExpanded:booleanish3,ariaFlowTo:spaceSeparated3,ariaGrabbed:booleanish3,ariaHasPopup:null,ariaHidden:booleanish3,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:spaceSeparated3,ariaLevel:number3,ariaLive:null,ariaModal:booleanish3,ariaMultiLine:booleanish3,ariaMultiSelectable:booleanish3,ariaOrientation:null,ariaOwns:spaceSeparated3,ariaPlaceholder:null,ariaPosInSet:number3,ariaPressed:booleanish3,ariaReadOnly:booleanish3,ariaRelevant:null,ariaRequired:booleanish3,ariaRoleDescription:spaceSeparated3,ariaRowCount:number3,ariaRowIndex:number3,ariaRowSpan:number3,ariaSelected:booleanish3,ariaSetSize:number3,ariaSort:null,ariaValueMax:number3,ariaValueMin:number3,ariaValueNow:number3,ariaValueText:null,role:null},transform:(e,t)=>"role"===t?t:"aria-"+t.slice(4).toLowerCase()});function caseSensitiveTransform3(e,t){return t in e?e[t]:t}function caseInsensitiveTransform3(e,t){return caseSensitiveTransform3(e,t.toLowerCase())}var html5=create3({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:commaSeparated3,acceptCharset:spaceSeparated3,accessKey:spaceSeparated3,action:null,allow:null,allowFullScreen:boolean3,allowPaymentRequest:boolean3,allowUserMedia:boolean3,alt:null,as:null,async:boolean3,autoCapitalize:null,autoComplete:spaceSeparated3,autoFocus:boolean3,autoPlay:boolean3,blocking:spaceSeparated3,capture:null,charSet:null,checked:boolean3,cite:null,className:spaceSeparated3,cols:number3,colSpan:null,content:null,contentEditable:booleanish3,controls:boolean3,controlsList:spaceSeparated3,coords:number3|commaSeparated3,crossOrigin:null,data:null,dateTime:null,decoding:null,default:boolean3,defer:boolean3,dir:null,dirName:null,disabled:boolean3,download:overloadedBoolean3,draggable:booleanish3,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:boolean3,formTarget:null,headers:spaceSeparated3,height:number3,hidden:overloadedBoolean3,high:number3,href:null,hrefLang:null,htmlFor:spaceSeparated3,httpEquiv:spaceSeparated3,id:null,imageSizes:null,imageSrcSet:null,inert:boolean3,inputMode:null,integrity:null,is:null,isMap:boolean3,itemId:null,itemProp:spaceSeparated3,itemRef:spaceSeparated3,itemScope:boolean3,itemType:spaceSeparated3,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:boolean3,low:number3,manifest:null,max:null,maxLength:number3,media:null,method:null,min:null,minLength:number3,multiple:boolean3,muted:boolean3,name:null,nonce:null,noModule:boolean3,noValidate:boolean3,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:boolean3,optimum:number3,pattern:null,ping:spaceSeparated3,placeholder:null,playsInline:boolean3,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:boolean3,referrerPolicy:null,rel:spaceSeparated3,required:boolean3,reversed:boolean3,rows:number3,rowSpan:number3,sandbox:spaceSeparated3,scope:null,scoped:boolean3,seamless:boolean3,selected:boolean3,shadowRootClonable:boolean3,shadowRootDelegatesFocus:boolean3,shadowRootMode:null,shape:null,size:number3,sizes:null,slot:null,span:number3,spellCheck:booleanish3,src:null,srcDoc:null,srcLang:null,srcSet:null,start:number3,step:null,style:null,tabIndex:number3,target:null,title:null,translate:null,type:null,typeMustMatch:boolean3,useMap:null,value:booleanish3,width:number3,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:spaceSeparated3,axis:null,background:null,bgColor:null,border:number3,borderColor:null,bottomMargin:number3,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:boolean3,declare:boolean3,event:null,face:null,frame:null,frameBorder:null,hSpace:number3,leftMargin:number3,link:null,longDesc:null,lowSrc:null,marginHeight:number3,marginWidth:number3,noResize:boolean3,noHref:boolean3,noShade:boolean3,noWrap:boolean3,object:null,profile:null,prompt:null,rev:null,rightMargin:number3,rules:null,scheme:null,scrolling:booleanish3,standby:null,summary:null,text:null,topMargin:number3,valueType:null,version:null,vAlign:null,vLink:null,vSpace:number3,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:boolean3,disableRemotePlayback:boolean3,prefix:null,property:null,results:number3,security:null,unselectable:null},space:"html",transform:caseInsensitiveTransform3}),svg5=create3({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:commaOrSpaceSeparated3,accentHeight:number3,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:number3,amplitude:number3,arabicForm:null,ascent:number3,attributeName:null,attributeType:null,azimuth:number3,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:number3,by:null,calcMode:null,capHeight:number3,className:spaceSeparated3,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:number3,diffuseConstant:number3,direction:null,display:null,dur:null,divisor:number3,dominantBaseline:null,download:boolean3,dx:null,dy:null,edgeMode:null,editable:null,elevation:number3,enableBackground:null,end:null,event:null,exponent:number3,externalResourcesRequired:null,fill:null,fillOpacity:number3,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:commaSeparated3,g2:commaSeparated3,glyphName:commaSeparated3,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:number3,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:number3,horizOriginX:number3,horizOriginY:number3,id:null,ideographic:number3,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:number3,k:number3,k1:number3,k2:number3,k3:number3,k4:number3,kernelMatrix:commaOrSpaceSeparated3,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:number3,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:number3,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:number3,overlineThickness:number3,paintOrder:null,panose1:null,path:null,pathLength:number3,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:spaceSeparated3,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:number3,pointsAtY:number3,pointsAtZ:number3,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:commaOrSpaceSeparated3,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:commaOrSpaceSeparated3,rev:commaOrSpaceSeparated3,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:commaOrSpaceSeparated3,requiredFeatures:commaOrSpaceSeparated3,requiredFonts:commaOrSpaceSeparated3,requiredFormats:commaOrSpaceSeparated3,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:number3,specularExponent:number3,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:number3,strikethroughThickness:number3,string:null,stroke:null,strokeDashArray:commaOrSpaceSeparated3,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:number3,strokeOpacity:number3,strokeWidth:null,style:null,surfaceScale:number3,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:commaOrSpaceSeparated3,tabIndex:number3,tableValues:null,target:null,targetX:number3,targetY:number3,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:commaOrSpaceSeparated3,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:number3,underlineThickness:number3,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:number3,values:null,vAlphabetic:number3,vMathematical:number3,vectorEffect:null,vHanging:number3,vIdeographic:number3,version:null,vertAdvY:number3,vertOriginX:number3,vertOriginY:number3,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:number3,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:caseSensitiveTransform3}),xlink3=create3({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform:(e,t)=>"xlink:"+t.slice(5).toLowerCase()}),xmlns3=create3({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:caseInsensitiveTransform3}),xml3=create3({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform:(e,t)=>"xml:"+t.slice(3).toLowerCase()}),cap3=/[A-Z]/g,dash3=/-[a-z]/g,valid3=/^data[-\w.:]+$/i;function kebab3(e){return"-"+e.toLowerCase()}function camelcase4(e){return e.charAt(1).toUpperCase()}var html6=merge3([aria3,html5,xlink3,xmlns3,xml3],"html"),svg6=merge3([aria3,svg5,xlink3,xmlns3,xml3],"svg"),own3={}.hasOwnProperty,defaultSubsetRegex=/["&'<>`]/g,surrogatePairsRegex=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,controlCharactersRegex=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,regexEscapeRegex=/[|\\{}()[\]^$+*?.]/g,subsetToRegexCache=new WeakMap;var key,hexadecimalRegex=/[\dA-Fa-f]/,decimalRegex=/\d/,characterEntitiesLegacy=["AElig","AMP","Aacute","Acirc","Agrave","Aring","Atilde","Auml","COPY","Ccedil","ETH","Eacute","Ecirc","Egrave","Euml","GT","Iacute","Icirc","Igrave","Iuml","LT","Ntilde","Oacute","Ocirc","Ograve","Oslash","Otilde","Ouml","QUOT","REG","THORN","Uacute","Ucirc","Ugrave","Uuml","Yacute","aacute","acirc","acute","aelig","agrave","amp","aring","atilde","auml","brvbar","ccedil","cedil","cent","copy","curren","deg","divide","eacute","ecirc","egrave","eth","euml","frac12","frac14","frac34","gt","iacute","icirc","iexcl","igrave","iquest","iuml","laquo","lt","macr","micro","middot","nbsp","not","ntilde","oacute","ocirc","ograve","ordf","ordm","oslash","otilde","ouml","para","plusmn","pound","quot","raquo","reg","sect","shy","sup1","sup2","sup3","szlig","thorn","times","uacute","ucirc","ugrave","uml","uuml","yacute","yen","yuml"],characterEntitiesHtml4={nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"­",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",fnof:"ƒ",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",bull:"•",hellip:"…",prime:"′",Prime:"″",oline:"‾",frasl:"⁄",weierp:"℘",image:"ℑ",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦",quot:'"',amp:"&",lt:"<",gt:">",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",circ:"ˆ",tilde:"˜",ensp:" ",emsp:" ",thinsp:" ",zwnj:"‌",zwj:"‍",lrm:"‎",rlm:"‏",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",permil:"‰",lsaquo:"‹",rsaquo:"›",euro:"€"},dangerous=["cent","copy","divide","gt","lt","not","para","times"],own4={}.hasOwnProperty,characters={};for(key in characterEntitiesHtml4)own4.call(characterEntitiesHtml4,key)&&(characters[characterEntitiesHtml4[key]]=key);var notAlphanumericRegex=/[^\dA-Za-z]/;function formatSmart(e,t,n){let r,s=function(e,t,n){const r="&#x"+e.toString(16).toUpperCase();return n&&t&&!hexadecimalRegex.test(String.fromCharCode(t))?r:r+";"}(e,t,n.omitOptionalSemicolons);if((n.useNamedReferences||n.useShortestReferences)&&(r=function(e,t,n,r){const s=String.fromCharCode(e);if(own4.call(characters,s)){const e=characters[s],a="&"+e;return n&&characterEntitiesLegacy.includes(e)&&!dangerous.includes(e)&&(!r||t&&61!==t&&notAlphanumericRegex.test(String.fromCharCode(t)))?a:a+";"}return""}(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!r)&&n.useShortestReferences){const r=function(e,t,n){const r="&#"+String(e);return n&&t&&!decimalRegex.test(String.fromCharCode(t))?r:r+";"}(e,t,n.omitOptionalSemicolons);r.length<s.length&&(s=r)}return r&&(!n.useShortestReferences||r.length<s.length)?r:s}function stringifyEntities(e,t){return function(e,t){return e=e.replace(t.subset?function(e){let t=subsetToRegexCache.get(e);return t||(t=function(e){const t=[];let n=-1;for(;++n<e.length;)t.push(e[n].replace(regexEscapeRegex,"\\$&"));return new RegExp("(?:"+t.join("|")+")","g")}(e),subsetToRegexCache.set(e,t)),t}(t.subset):defaultSubsetRegex,n),t.subset||t.escapeOnly?e:e.replace(surrogatePairsRegex,function(e,n,r){return t.format(1024*(e.charCodeAt(0)-55296)+e.charCodeAt(1)-56320+65536,r.charCodeAt(n+2),t)}).replace(controlCharactersRegex,n);function n(e,n,r){return t.format(e.charCodeAt(0),r.charCodeAt(n+1),t)}}(e,Object.assign({format:formatSmart},t))}var htmlCommentRegex=/^>|^->|<!--|-->|--!>|<!-$/g,bogusCommentEntitySubset=[">"],commentEntitySubset=["<",">"];function ccount(e,t){const n=String(e);if("string"!=typeof t)throw new TypeError("Expected character");let r=0,s=n.indexOf(t);for(;-1!==s;)r++,s=n.indexOf(t,s+t.length);return r}var re=/[ \t\n\f\r]/g;function whitespace(e){return"object"==typeof e?"text"===e.type&&empty(e.value):empty(e)}function empty(e){return""===e.replace(re,"")}var siblingAfter=siblings(1),siblingBefore=siblings(-1),emptyChildren=[];function siblings(e){return function(t,n,r){const s=t?t.children:emptyChildren;let a=(n||0)+e,i=s[a];if(!r)for(;i&&whitespace(i);)a+=e,i=s[a];return i}}var own5={}.hasOwnProperty;function omission(e){return function(t,n,r){return own5.call(e,t.tagName)&&e[t.tagName](t,n,r)}}var closing=omission({body:function(e,t,n){const r=siblingAfter(n,t);return!r||"comment"!==r.type},caption:headOrColgroupOrCaption,colgroup:headOrColgroupOrCaption,dd:function(e,t,n){const r=siblingAfter(n,t);return!r||"element"===r.type&&("dt"===r.tagName||"dd"===r.tagName)},dt:function(e,t,n){const r=siblingAfter(n,t);return Boolean(r&&"element"===r.type&&("dt"===r.tagName||"dd"===r.tagName))},head:headOrColgroupOrCaption,html:function(e,t,n){const r=siblingAfter(n,t);return!r||"comment"!==r.type},li:function(e,t,n){const r=siblingAfter(n,t);return!r||"element"===r.type&&"li"===r.tagName},optgroup:function(e,t,n){const r=siblingAfter(n,t);return!r||"element"===r.type&&"optgroup"===r.tagName},option:function(e,t,n){const r=siblingAfter(n,t);return!r||"element"===r.type&&("option"===r.tagName||"optgroup"===r.tagName)},p:function(e,t,n){const r=siblingAfter(n,t);return r?"element"===r.type&&("address"===r.tagName||"article"===r.tagName||"aside"===r.tagName||"blockquote"===r.tagName||"details"===r.tagName||"div"===r.tagName||"dl"===r.tagName||"fieldset"===r.tagName||"figcaption"===r.tagName||"figure"===r.tagName||"footer"===r.tagName||"form"===r.tagName||"h1"===r.tagName||"h2"===r.tagName||"h3"===r.tagName||"h4"===r.tagName||"h5"===r.tagName||"h6"===r.tagName||"header"===r.tagName||"hgroup"===r.tagName||"hr"===r.tagName||"main"===r.tagName||"menu"===r.tagName||"nav"===r.tagName||"ol"===r.tagName||"p"===r.tagName||"pre"===r.tagName||"section"===r.tagName||"table"===r.tagName||"ul"===r.tagName):!n||!("element"===n.type&&("a"===n.tagName||"audio"===n.tagName||"del"===n.tagName||"ins"===n.tagName||"map"===n.tagName||"noscript"===n.tagName||"video"===n.tagName))},rp:rubyElement,rt:rubyElement,tbody:function(e,t,n){const r=siblingAfter(n,t);return!r||"element"===r.type&&("tbody"===r.tagName||"tfoot"===r.tagName)},td:cells,tfoot:function(e,t,n){return!siblingAfter(n,t)},th:cells,thead:function(e,t,n){const r=siblingAfter(n,t);return Boolean(r&&"element"===r.type&&("tbody"===r.tagName||"tfoot"===r.tagName))},tr:function(e,t,n){const r=siblingAfter(n,t);return!r||"element"===r.type&&"tr"===r.tagName}});function headOrColgroupOrCaption(e,t,n){const r=siblingAfter(n,t,!0);return!r||"comment"!==r.type&&!("text"===r.type&&whitespace(r.value.charAt(0)))}function rubyElement(e,t,n){const r=siblingAfter(n,t);return!r||"element"===r.type&&("rp"===r.tagName||"rt"===r.tagName)}function cells(e,t,n){const r=siblingAfter(n,t);return!r||"element"===r.type&&("td"===r.tagName||"th"===r.tagName)}var opening=omission({body:function(e){const t=siblingAfter(e,-1,!0);return!(t&&("comment"===t.type||"text"===t.type&&whitespace(t.value.charAt(0))||"element"===t.type&&("meta"===t.tagName||"link"===t.tagName||"script"===t.tagName||"style"===t.tagName||"template"===t.tagName)))},colgroup:function(e,t,n){const r=siblingBefore(n,t),s=siblingAfter(e,-1,!0);return!(n&&r&&"element"===r.type&&"colgroup"===r.tagName&&closing(r,n.children.indexOf(r),n))&&Boolean(s&&"element"===s.type&&"col"===s.tagName)},head:function(e){const t=new Set;for(const n of e.children)if("element"===n.type&&("base"===n.tagName||"title"===n.tagName)){if(t.has(n.tagName))return!1;t.add(n.tagName)}const n=e.children[0];return!n||"element"===n.type},html:function(e){const t=siblingAfter(e,-1);return!t||"comment"!==t.type},tbody:function(e,t,n){const r=siblingBefore(n,t),s=siblingAfter(e,-1);return(!n||!r||"element"!==r.type||"thead"!==r.tagName&&"tbody"!==r.tagName||!closing(r,n.children.indexOf(r),n))&&Boolean(s&&"element"===s.type&&"tr"===s.tagName)}}),constants={name:[["\t\n\f\r &/=>".split(""),"\t\n\f\r \"&'/=>`".split("")],["\0\t\n\f\r \"&'/<=>".split(""),"\0\t\n\f\r \"&'/<=>`".split("")]],unquoted:[["\t\n\f\r &>".split(""),"\0\t\n\f\r \"&'<=>`".split("")],["\0\t\n\f\r \"&'<=>`".split(""),"\0\t\n\f\r \"&'<=>`".split("")]],single:[["&'".split(""),"\"&'`".split("")],["\0&'".split(""),"\0\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\0"&'.split(""),"\0\"&'`".split("")]]};function serializeAttribute(e,t,n){const r=function(e,t){const n=normalize4(t);let r=t,s=Info6;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&"data"===n.slice(0,4)&&valid3.test(t)){if("-"===t.charAt(4)){const e=t.slice(5).replace(dash3,camelcase4);r="data"+e.charAt(0).toUpperCase()+e.slice(1)}else{const e=t.slice(4);if(!dash3.test(e)){let n=e.replace(cap3,kebab3);"-"!==n.charAt(0)&&(n="-"+n),t="data"+n}}s=DefinedInfo3}return new s(r,t)}(e.schema,t),s=e.settings.allowParseErrors&&"html"===e.schema.space?0:1,a=e.settings.allowDangerousCharacters?0:1;let i,o=e.quote;if(!r.overloadedBoolean||n!==r.attribute&&""!==n?!r.boolean&&!r.overloadedBoolean||"string"==typeof n&&n!==r.attribute&&""!==n||(n=Boolean(n)):n=!0,null==n||!1===n||"number"==typeof n&&Number.isNaN(n))return"";const l=stringifyEntities(r.attribute,Object.assign({},e.settings.characterReferences,{subset:constants.name[s][a]}));return!0===n?l:(n=Array.isArray(n)?(r.commaSeparated?stringify:stringify2)(n,{padLeft:!e.settings.tightCommaSeparatedLists}):String(n),e.settings.collapseEmptyAttributes&&!n?l:(e.settings.preferUnquoted&&(i=stringifyEntities(n,Object.assign({},e.settings.characterReferences,{attribute:!0,subset:constants.unquoted[s][a]}))),i!==n&&(e.settings.quoteSmart&&ccount(n,o)>ccount(n,e.alternative)&&(o=e.alternative),i=o+stringifyEntities(n,Object.assign({},e.settings.characterReferences,{subset:("'"===o?constants.single:constants.double)[s][a],attribute:!0}))+o),l+(i?"="+i:i)))}var textEntitySubset=["<","&"];function text(e,t,n,r){return!n||"element"!==n.type||"script"!==n.tagName&&"style"!==n.tagName?stringifyEntities(e.value,Object.assign({},r.settings.characterReferences,{subset:textEntitySubset})):e.value}var handle=function(e,t){const n=t||{};function r(t,...n){let s=r.invalid;const a=r.handlers;if(t&&own3.call(t,e)){const n=String(t[e]);s=own3.call(a,n)?a[n]:r.unknown}if(s)return s.call(this,t,...n)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}("type",{invalid:function(e){throw new Error("Expected node, not `"+e+"`")},unknown:function(e){throw new Error("Cannot compile unknown node `"+e.type+"`")},handlers:{comment:function(e,t,n,r){return r.settings.bogusComments?"<?"+stringifyEntities(e.value,Object.assign({},r.settings.characterReferences,{subset:bogusCommentEntitySubset}))+">":"\x3c!--"+e.value.replace(htmlCommentRegex,function(e){return stringifyEntities(e,Object.assign({},r.settings.characterReferences,{subset:commentEntitySubset}))})+"--\x3e"},doctype:function(e,t,n,r){return"<!"+(r.settings.upperDoctype?"DOCTYPE":"doctype")+(r.settings.tightDoctype?"":" ")+"html>"},element:function(e,t,n,r){const s=r.schema,a="svg"!==s.space&&r.settings.omitOptionalTags;let i="svg"===s.space?r.settings.closeEmptyElements:r.settings.voids.includes(e.tagName.toLowerCase());const o=[];let l;"html"===s.space&&"svg"===e.tagName&&(r.schema=svg6);const c=function(e,t){const n=[];let r,s=-1;if(t)for(r in t)if(null!==t[r]&&void 0!==t[r]){const s=serializeAttribute(e,r,t[r]);s&&n.push(s)}for(;++s<n.length;){const t=e.settings.tightAttributes?n[s].charAt(n[s].length-1):void 0;s!==n.length-1&&'"'!==t&&"'"!==t&&(n[s]+=" ")}return n.join("")}(r,e.properties),u=r.all("html"===s.space&&"template"===e.tagName?e.content:e);return r.schema=s,u&&(i=!1),!c&&a&&opening(e,t,n)||(o.push("<",e.tagName,c?" "+c:""),i&&("svg"===s.space||r.settings.closeSelfClosing)&&(l=c.charAt(c.length-1),(!r.settings.tightSelfClosing||"/"===l||l&&'"'!==l&&"'"!==l)&&o.push(" "),o.push("/")),o.push(">")),o.push(u),i||a&&closing(e,t,n)||o.push("</"+e.tagName+">"),o.join("")},raw:function(e,t,n,r){return r.settings.allowDangerousHtml?e.value:text(e,0,n,r)},root:function(e,t,n,r){return r.all(e)},text:text}}),emptyOptions2={},emptyCharacterReferences={},emptyChildren2=[];function one2(e,t,n){return handle(e,t,n,this)}function all2(e){const t=[],n=e&&e.children||emptyChildren2;let r=-1;for(;++r<n.length;)t[r]=this.one(n[r],r,e);return t.join("")}function rehypeStringify(e){const t={...this.data("settings"),...e};this.compiler=function(e){return function(e,t){const n=t||emptyOptions2,r=n.quote||'"',s='"'===r?"'":'"';if('"'!==r&&"'"!==r)throw new Error("Invalid quote `"+r+"`, expected `'` or `\"`");return{one:one2,all:all2,settings:{omitOptionalTags:n.omitOptionalTags||!1,allowParseErrors:n.allowParseErrors||!1,allowDangerousCharacters:n.allowDangerousCharacters||!1,quoteSmart:n.quoteSmart||!1,preferUnquoted:n.preferUnquoted||!1,tightAttributes:n.tightAttributes||!1,upperDoctype:n.upperDoctype||!1,tightDoctype:n.tightDoctype||!1,bogusComments:n.bogusComments||!1,tightCommaSeparatedLists:n.tightCommaSeparatedLists||!1,tightSelfClosing:n.tightSelfClosing||!1,collapseEmptyAttributes:n.collapseEmptyAttributes||!1,allowDangerousHtml:n.allowDangerousHtml||!1,voids:n.voids||htmlVoidElements,characterReferences:n.characterReferences||emptyCharacterReferences,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:"svg"===n.space?svg6:html6,quote:r,alternative:s}.one(Array.isArray(e)?{type:"root",children:e}:e,void 0,void 0)}(e,t)}}var convert=function(e){if(null==e)return ok2;if("function"==typeof e)return castFactory(e);if("object"==typeof e)return Array.isArray(e)?function(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=convert(e[n]);return castFactory(function(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1})}(e):function(e){const t=e;return castFactory(function(n){const r=n;let s;for(s in e)if(r[s]!==t[s])return!1;return!0})}(e);if("string"==typeof e)return t=e,castFactory(function(e){return e&&e.type===t});var t;throw new Error("Expected function, string, or object as test")};function castFactory(e){return function(t,n,r){return Boolean(function(e){return null!==e&&"object"==typeof e&&"type"in e}(t)&&e.call(this,t,"number"==typeof n?n:void 0,r||void 0))}}function ok2(){return!0}var empty2=[];var ABSOLUTE_URL_REGEX=/^[a-zA-Z][a-zA-Z\d+\-.]*?:/,WINDOWS_PATH_REGEX=/^[a-zA-Z]:\\/,HTTP_PROTOCOLS_REGEX=/^https?:/i;function isAbsoluteUrl(e,t={}){if("string"!=typeof e)throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);if(WINDOWS_PATH_REGEX.test(e))return!1;if(!ABSOLUTE_URL_REGEX.test(e))return!1;const{httpOnly:n=!0}=t;return!n||HTTP_PROTOCOLS_REGEX.test(e)}var import_path13=__toESM(require("path"));init_log();var log42=getDomainLogger("site",{component:"HtmlLinkProcessor"}),defaultOptions={markdownLinkResolution:"shortest",prettyLinks:!0,openLinksInNewTab:!1,lazyLoad:!1,externalLinkIcon:!0},HtmlLinkProcessor=class{constructor(e,t={}){this.graph=e,this.options={...defaultOptions,...t}}options;async processLinks(e,t){if(!t||"string"!=typeof t)return log42.error("[HtmlLinkProcessor] Invalid HTML input: "+typeof t),{html:t||"",outgoingLinks:[]};const n=this.options,r=simplifySlug(e),s=new Set,a=unified().use(rehypeParse,{fragment:!0}).use(()=>t=>{!function(e,t,n){let r,s,a;s=t,a=n,r=void 0,function(e,t,n,r){let s;"function"==typeof t&&"function"!=typeof n?(r=n,n=t):s=t;const a=convert(s),i=r?-1:1;!function e(s,o,l){const c=s&&"object"==typeof s?s:{};if("string"==typeof c.type){const e="string"==typeof c.tagName?c.tagName:"string"==typeof c.name?c.name:void 0;Object.defineProperty(h,"name",{value:"node ("+(u=s.type+(e?"<"+e+">":""),""+u+")")})}var u;return h;function h(){let c,u,h,d=empty2;if((!t||a(s,o,l[l.length-1]||void 0))&&(d=function(e){return Array.isArray(e)?e:"number"==typeof e?[!0,e]:null==e?empty2:[e]}(n(s,l)),!1===d[0]))return d;if("children"in s&&s.children){const t=s;if(t.children&&"skip"!==d[0])for(u=(r?t.children.length:-1)+i,h=l.concat(t);u>-1&&u<t.children.length;){const n=t.children[u];if(c=e(n,u,h)(),!1===c[0])return c;u="number"==typeof c[1]?c[1]:u+i}}return d}}(e,void 0,[])()}(e,s,function(e,t){const n=t[t.length-1],r=n?n.children.indexOf(e):void 0;return a(e,r,n)},r)}(t,"element",t=>{if("a"===t.tagName&&t.properties){const a=t.properties.dataWikilink||t.properties.dataSlug,i="string"==typeof t.properties.href;if(!i&&!a)return;let o;o=!i&&a?t.properties.dataWikilink||t.properties.dataSlug:t.properties.href;const l=t.properties.className??[],c=isAbsoluteUrl(o,{httpOnly:!1});l.includes("external")||l.includes("internal")||l.push(c?"external":"internal"),c&&n.externalLinkIcon&&t.children.push({type:"element",tagName:"svg",properties:{"aria-hidden":"true",class:"external-icon",style:"max-width:0.8em;max-height:0.8em",viewBox:"0 0 512 512"},children:[{type:"element",tagName:"path",properties:{d:"M320 0H288V64h32 82.7L201.4 265.4 178.7 288 224 333.3l22.6-22.6L448 109.3V192v32h64V192 32 0H480 320zM32 32H0V64 480v32H32 456h32V480 352 320H424v32 96H64V96h96 32V32H160 32z"},children:[]}]}),1===t.children.length&&"text"===t.children[0].type&&t.children[0].value!==o&&l.push("alias"),t.properties.className=l,c&&n.openLinksInNewTab&&(t.properties.target="_blank");const u=!(isAbsoluteUrl(o,{httpOnly:!1})||o.startsWith("#"));if(u){const a=transformLink(e,o,{strategy:n.markdownLinkResolution,allSlugs:this.graph.getAllSlugs()}),i=new URL(a,"https://base.com/"+stripSlashes2(r,!0)).pathname;let[l,c]=splitAnchor2(i);l.endsWith("/")&&(l+="index");const u=decodeURIComponent(stripSlashes2(l,!0)),h=simplifySlug(u);s.add(h);let d=a;if(d.startsWith("./")&&(d=d.slice(2)),d.startsWith("../")){const t=(d.match(/\.\.\//g)||[]).length,n=e.split("/").filter(e=>e).slice(0,-1),r=d.replace(/\.\.\//g,""),s=n.slice(0,n.length-t);r&&s.push(r),d=s.join("/")}d=n.baseURL?`${n.baseURL}/${d}`:`/${d}`;const[p,g]=splitAnchor2(d);let m=p;m.endsWith(".html")||m.endsWith("/")||(m+=".html"),d=m+g,o=t.properties.href=d,t.properties["data-slug"]=u}n.prettyLinks&&u&&1===t.children.length&&"text"===t.children[0].type&&!t.children[0].value.startsWith("#")&&(t.children[0].value=import_path13.default.basename(t.children[0].value))}if(["img","video","audio","iframe"].includes(t.tagName)&&t.properties&&"string"==typeof t.properties.src&&(n.lazyLoad&&(t.properties.loading="lazy"),!isAbsoluteUrl(t.properties.src,{httpOnly:!1}))){let r=t.properties.src;r=t.properties.src=transformLink(e,r,{strategy:n.markdownLinkResolution,allSlugs:this.graph.getAllSlugs()}),t.properties.src=r}})}).use(rehypeStringify),i=await a.process(t);return{html:String(i),outgoingLinks:Array.from(s)}}};init_log();var log43=getDomainLogger("pkg",{component:"page-filter"}),pageFilter=new class{filterSet=null;currentLanguage=null;setFilter(e){this.filterSet=new Set;for(const t of e){const e=`${t.language}:${t.pagePath}`;this.filterSet.add(e)}log43.debug(`Page filter set: ${e.length} tasks`)}setCurrentLanguage(e){this.currentLanguage=e}clearFilter(){this.filterSet=null,this.currentLanguage=null,log43.debug("Page filter cleared")}shouldProcess(e,t){if(!this.filterSet)return!0;const n=`${e}:${t}`;return this.filterSet.has(n)}getFilterSize(){return this.filterSet?.size??0}};function shouldProcessPage(e,t){return pageFilter.shouldProcess(e,t)}var log44=getDomainLogger("site",{component:"site"}),Site=class{configSvc;contentSvc;translationSvc;languageSvc;sitemap;staticCopySvc;publisher;template=null;author;organization;compiler;url;ref=null;language;navigation=null;title;home=null;pageGraph=null;get Title(){return this.title}get Description(){return this.home?.description()||""}get Compiler(){return this.compiler}get IsGoogleAnalyticsEnabled(){return this.configSvc.isGoogleAnalyticsEnabled()}get GoogleAnalyticsID(){return this.configSvc.googleAnalyticsID()}get IsGoogleAnalyticsRespectDoNotTrack(){return this.configSvc.isGoogleAnalyticsRespectDoNotTrack()}get IsDisqusEnabled(){return this.configSvc.isDisqusEnabled()}get DisqusShortname(){return this.configSvc.disqusShortname()}get IsXRespectDoNotTrack(){return this.configSvc.isXRespectDoNotTrack()}get IsXDisableInlineCSS(){return this.configSvc.isXDisableInlineCSS()}get ConfiguredSocialPlatforms(){return this.configSvc.getConfiguredSocialPlatforms()}GetSocialLink(e){return this.configSvc.getSocialLink(e)}GetSocialTitle(e){return this.configSvc.getSocialTitle(e)}async Pages(){const e=this.languageSvc.getLanguageIndex(this.language.getCurrentLanguage()),t=await this.contentSvc.globalPages(e);return this.sitePages(t)}async RegularPages(){const e=await this.contentSvc.globalRegularPages();return this.sitePages(e)}constructor(e,t,n,r,s,a,i,o,l,c,u,h,d,p,g){this.configSvc=e,this.contentSvc=t,this.translationSvc=n,this.languageSvc=r,this.sitemap=s,this.staticCopySvc=a,this.publisher=i,this.author=o,this.organization=l,this.compiler=c,this.url=u,this.ref=h,this.language=d,this.navigation=p,this.title=g}async build(e){try{this.template=e,await this.setup(),await this.copyStaticFiles();const t=this.languageSvc.languageKeys();for(const e of t)this.language.setCurrentLanguage(e),await this.generateNavigations(),await this.render()}catch(e){const t=e instanceof Error?e.message:String(e);throw log44.error(`❌ Site build failed: ${t}`),e}}async renderAllLanguages(){const e=this.languageSvc.languageKeys();for(const t of e)this.language.setCurrentLanguage(t),await this.generateNavigations(),await this.render()}async buildWithProgress(e,t){try{this.template=e,await this.setup(),await this.copyStaticFiles();const n=this.languageSvc.languageKeys();for(const e of n)this.language.setCurrentLanguage(e),await this.generateNavigations(),await this.renderWithProgress(t)}catch(e){const t=e instanceof Error?e.message:String(e);throw log44.error(`❌ Site build failed: ${t}`),e}}async setup(){try{await this.buildPageGraph()}catch(e){const t=e instanceof Error?e.message:String(e);throw log44.error(`❌ Setup failed: ${t}`),e}}async render(){try{await this.renderPages()}catch(e){throw e}}async renderWithProgress(e){try{await this.renderPagesWithProgress(e)}catch(e){throw e}}async renderPages(){const e=this.language.getCurrentLanguage(),t=this.languageSvc.getLanguageIndex(e),n=[];await this.contentSvc.walkPages(t,async e=>{const t=await this.sitePage(e);n.push(t);const r=await this.contentSvc.getPageSources(e);await t.processResources(r),e.isHome()&&(this.home=t)}),log44.info(`📊 Processing wikilinks for ${n.length} pages...`);for(const e of n)try{await e.WikilinkContent()}catch(t){const n=t instanceof Error?t.message:String(t);log44.warn(`⚠️ Failed to process wikilinks for ${e.slug()}: ${n}`)}log44.info("✅ Wikilink processing complete");for(let t=0;t<n.length;t++){const r=n[t];shouldProcessPage(e,r.file().paths().base())&&r.isStale()&&(await r.render(),r.clearStale())}}async renderPagesWithProgress(e){const t=this.languageSvc.getLanguageIndex(this.language.getCurrentLanguage()),n=[];await this.contentSvc.walkPages(t,async e=>{const t=await this.sitePage(e);n.push(t);const r=await this.contentSvc.getPageSources(e);await t.processResources(r),e.isHome()&&(this.home=t)}),log44.info(`📊 Processing wikilinks for ${n.length} pages...`);for(const e of n)try{await e.WikilinkContent()}catch(t){const n=t instanceof Error?t.message:String(t);log44.warn(`⚠️ Failed to process wikilinks for ${e.slug()}: ${n}`)}log44.info("✅ Wikilink processing complete");const r=n.length;for(let t=0;t<n.length;t++){const s=n[t];await s.render(),e?.({currentPage:t+1,totalPages:r})}}async pageOutput(e){return e.output()}clearSiteCache(){}translate(e){return this.translationSvc.translate(this.language.getCurrentLanguage(),e)}get Home(){return this.home}get Params(){return this.configSvc.configParams()}get Taxonomies(){return this.navigation&&this.navigation.getTaxonomies(this.language.getCurrentLanguage())||new TaxonomyList}get Menus(){return this.navigation?this.navigation.getMenus(this.language.getCurrentLanguage()):new Menus}getTitle(){return this.title}setTitle(e){this.title=e}getConfigService(){return this.configSvc}getContentService(){return this.contentSvc}getLanguageService(){return this.languageSvc}baseURL(){return this.url.base}get BaseURL(){return this.baseURL()}getURL(){return this.url}getRef(){return this.ref?this.ref:{}}getLanguage(){return this.language}get Language(){return this.getLanguage()}get LanguageCode(){return this.language.lang()}get Languages(){return this.language.languages()}getNavigation(){return this.navigation?this.navigation:{}}getPublisher(){return this.publisher}getTemplate(){return this.template}get Author(){return this.author.author(this.home?.author())}get Organization(){return this.organization.organization(this.home?.organization())}getCompiler(){return this.compiler}getSitemap(){return this.sitemap}isMultipleLanguage(){return this.language.isMultipleLanguage()}get IsMultilingual(){return this.isMultipleLanguage()}getCurrentLanguage(){return this.language.lang()}languagePrefix(){return this.language.languagePrefix()}async sitePage(e){return new Page2(this.template,this.languageSvc,this.publisher,e,this)}sitePages(e){const t=[];for(let n=0;n<e.length;n++){const r=e[n];try{const e=this.sitePageSync(r);t.push(e)}catch(e){log44.error(`❌ [Site.sitePages] Failed to convert page ${n}:`,e)}}return t}sitePageSync(e){return new Page2(this.template,this.languageSvc,this.publisher,e,this)}async generateNavigations(){const e=this.language.getCurrentLanguage(),t=this.languageSvc.getLanguageIndex(e);this.navigation&&(await this.navigation.generateMenusForLanguage(e,t),await this.navigation.generateTaxonomiesForLanguage(e,t,this))}GetPage(...e){if(e.length>1)throw new Error(`too many arguments to .Site.GetPage: ${e}. Use lookups on the form {{ .Site.GetPage "/posts/mypage-md" }}`);let t=e[0];t=t.replace(/\\/g,"/"),t.startsWith("/")||(t="/"+t);try{const e=this.languageSvc.getLanguageIndex(this.language.getCurrentLanguage()),n=this.contentSvc.getPageFromPathSync(e,t);return n?this.sitePageSync(n):(log44.warn(`⚠️ GetPage: No page found for key "${t}"`),null)}catch(e){return log44.error(`❌ Error getting page "${t}": ${e}`),null}}async copyStaticFiles(){try{await this.staticCopySvc.copyStaticFiles(this.staticCopySvc.staticFs(),this.staticCopySvc.publishFs())}catch(e){throw log44.error("❌ Static file copy failed:",e),e}}async siteWeightedPage(e){const t=await this.sitePage(e.page()),{WeightedPage:n}=await Promise.resolve().then(()=>(init_taxonomies_builder(),taxonomies_builder_exports));return new n(t,e)}async buildPageGraph(){if(this.pageGraph)log44.debug("PageGraph already built, skipping rebuild");else try{const e=[],t=this.languageSvc.languageKeys();for(const n of t){const t=this.languageSvc.getLanguageIndex(n);await this.contentSvc.walkPages(t,async t=>{e.push(t)})}const n=e.map(e=>e.slug());log44.info(`📄 Collected ${n.length} page slugs`);const r=await this.collectResourceSlugs(e);log44.info(`🖼️ Collected ${r.length} resource slugs`);const s=[...n,...r];this.pageGraph=new PageGraph(s),log44.info(`✅ PageGraph built: ${n.length} pages + ${r.length} resources = ${s.length} total`)}catch(e){const t=e instanceof Error?e.message:String(e);throw log44.error(`❌ Failed to build PageGraph: ${t}`),e}}async collectResourceSlugs(e){const t=[],n=new Set;try{for(const r of e)try{const e=await this.contentSvc.getPageSources(r);for(const r of e){const e=r.slug();n.has(e)||(n.add(e),t.push(e))}}catch(e){const t=e instanceof Error?e.message:String(e);log44.debug(`⚠️ Failed to get resources for page ${r.slug()}: ${t}`)}}catch(e){const t=e instanceof Error?e.message:String(e);log44.warn(`⚠️ Failed to collect resource slugs: ${t}`)}return t}async ProcessWikilinks(e,t){if(!this.pageGraph)return log44.warn("⚠️ PageGraph not built yet, returning original HTML"),t;try{let r="";if(this.url&&this.url.base){if(r=this.url.base.replace(/\/$/,""),r.startsWith("/"));else if(r)try{r=new URL2(r).pathname.replace(/\/$/,"")}catch(e){log44.warn(`Failed to parse baseURL as URL: ${r}, treating as path`)}"/"===r&&(r="")}const s=(n=this.pageGraph,new HtmlLinkProcessor(n,{markdownLinkResolution:"shortest",prettyLinks:!0,openLinksInNewTab:!1,lazyLoad:!0,externalLinkIcon:!0,baseURL:r})),a=await s.processLinks(e,t);return this.pageGraph.registerOutgoingLinks(e,a.outgoingLinks),a.html}catch(n){const r=n instanceof Error?n.message:String(n);return log44.error(`❌ Failed to process wikilinks for ${e}: ${r}`),t}var n}getPageGraph(){return this.pageGraph}GetBacklinks(e){return this.pageGraph?this.pageGraph.getBacklinks(e):(log44.warn(`⚠️ PageGraph not built yet, cannot get backlinks for ${e}`),[])}async GetContentIndex(){if(!this.pageGraph)return log44.warn("⚠️ PageGraph not built yet, cannot generate content index"),new Map;const e=new Map,t=await this.RegularPages();for(const n of t){const t=n.slug(),r=this.pageGraph.getOutgoingLinks(t),s=(n.Plain||"").substring(0,1e3);e.set(t,{slug:t,title:n.Title||n.File.OriginalBaseName,links:r,tags:n.Params?.tags||[],content:s})}return log44.debug(`[Site] Generated contentIndex with ${e.size} entries`),e}},import_path15=__toESM(require("path"));init_log(),getDomainLogger("site",{component:"publisher"});var Publisher=class{fs;constructor(e){this.fs=e}async publishSource(e,...t){const n=await this.openFilesForWriting(...t);try{const t="string"==typeof e?(new TextEncoder).encode(e):e;await this.copyToWriter(n,t)}finally{await n.close()}}async publishFiles(e,...t){const n=await this.openFilesForWriting(...t);try{await this.copyStreamToWriter(n,e)}finally{await n.close()}}async openFilesForWriting(...e){const t=[];for(const n of e){const e=await openFileForWriting(this.fs,n);t.push(e)}return new MultiWriter(t)}async copyToWriter(e,t){await e.write(t)}async copyStreamToWriter(e,t){const n=t.getReader();try{for(;;){const{done:t,value:r}=await n.read();if(t)break;await e.write(r)}}finally{n.releaseLock()}}},MultiWriter=class{files;constructor(e){this.files=e}async write(e){const t=this.files.map(t=>t.write(e));await Promise.all(t)}async close(){const e=this.files.map(e=>e.close());await Promise.all(e)}};async function openFileForWriting(e,t){const n=import_path15.default.normalize(t);try{return await e.create(n)}catch(t){if(!function(e){return e&&("ENOENT"===e.code||"FILE_NOT_FOUND"===e.code||e.message?.includes("not found")||e.message?.includes("no such file"))}(t))throw t;const r=import_path15.default.dirname(n);return await e.mkdirAll(r,511),await e.create(n)}}init_log();var log46=getDomainLogger("site",{component:"ref"}),Ref=class{site;contentSvc;notFoundURL;constructor(e,t,n="#ZgotmplZ"){this.site=e,this.contentSvc=t,this.notFoundURL=n}async relRefFrom(e,t){return this.relRef(e,t)}async relRef(e,t){try{const n=this.decodeRefArgs(e);return n.path?this.refLink(n.path,t,!0,n.outputFormat):""}catch(e){throw new Error(`Invalid arguments to Ref: ${e}`)}}decodeRefArgs(e){return{path:e.path||"",outputFormat:e.outputFormat||""}}async refLink(e,t,n,r){const s=t;if(!s||"function"!=typeof s.unwrapPage)throw new Error("source is not a PageWrapper");const a=s.unwrapPage();let i;const o=e.replace(/\\/g,"/");try{i=new globalThis.URL(o,"http://example.com")}catch(e){return log46.error(`Failed to parse ref URL: ${e}`),this.notFoundURL}let l=null,c="";if(""!==i.pathname)try{l=await this.contentSvc.getPageRef(a,i.pathname,this.site.home.page);let e=null;if(l||this.isPositioner(t)&&(e=t.position()),!l)return this.logNotFound(i.pathname,"page not found",a,e),this.notFoundURL;const r=await this.site.sitePage(l);c=n?r.relPermalink():r.permalink()}catch(t){return log46.error(`[${a.pageIdentity().pageLanguage()}] REF_NOT_FOUND: Ref "${e}": ${t}`),this.notFoundURL}return i.hash&&(c=c+"#"+i.hash),c}isPositioner(e){return e&&"function"==typeof e.position}logNotFound(e,t,n,r){const s=n.pageIdentity().pageLanguage();r&&r.isValid()?log46.error(`[${s}] REF_NOT_FOUND: Ref "${e}": ${r.toString()}: ${t}`):n?log46.error(`[${s}] REF_NOT_FOUND: Ref "${e}" from page "${n.path()}": ${t}`):log46.error(`[${s}] REF_NOT_FOUND: Ref "${e}": ${t}`)}};init_log(),getDomainLogger("site",{component:"language"});var CollatorWrapper=class{collator;constructor(e){this.collator=e}compare(e,t){return this.collator.compare(e,t)}},Language2=class e{langSvc;currentLocation;currentLanguage;collator=null;constructor(e){this.langSvc=e,this.currentLocation="UTC",this.currentLanguage=""}currentLanguageIndex(){try{return this.langSvc.getLanguageIndex(this.currentLanguage)}catch(e){throw new Error(`language "${this.currentLanguage}" not found`)}}async setup(){this.currentLocation="UTC"}languages(){const t=[];for(const n of this.langSvc.languageKeys()){const r=new e(this.langSvc);r.currentLocation=this.currentLocation,r.currentLanguage=n,r.collator=this.collator,t.push(r)}return t}getCollator(){if(!this.collator)try{const e=new Intl.Collator(this.currentLanguage||"en");this.collator=new CollatorWrapper({compare:(t,n)=>e.compare(t,n)})}catch(e){const t=new Intl.Collator("en");this.collator=new CollatorWrapper({compare:(e,n)=>t.compare(e,n)})}return this.collator}location(){return this.currentLocation}isMultipleLanguage(){return this.langSvc.languageKeys().length>1}languagePrefix(){return this.currentLanguage===this.langSvc.defaultLanguage()?"":this.currentLanguage}lang(){return this.currentLanguage}get Lang(){return this.lang()}languageName(){return this.langSvc.getLanguageName(this.currentLanguage)}get LanguageName(){return this.languageName()}defaultLanguageName(){return this.langSvc.getLanguageName(this.langSvc.defaultLanguage())}languageCode(){return this.currentLanguage}get LanguageCode(){return this.languageCode()}get LanguageDirection(){return"ltr"}languageDirection(){return"ltr"}setCurrentLanguage(e){this.currentLanguage=e}getCurrentLanguage(){return this.currentLanguage}setCurrentLocation(e){this.currentLocation=e}},Author2=class{_name;_email;_homeAuthor;constructor(e,t){this._name=e,this._email=t}name(){return this._name}email(){return this._email}author(e){return this._homeAuthor=e,this}get Name(){return this._homeAuthor?.name||this.name()}get Description(){return this._homeAuthor?.description||""}get Avatar(){return this._homeAuthor?.avatar||""}get Twitter(){return this._homeAuthor?.social?.twitter||""}get Socials(){const e=[];if(!this._homeAuthor?.social)return e;for(const[t,n]of Object.entries(this._homeAuthor.social))n&&e.push({ID:t,Link:n});return e}};init_log(),getDomainLogger("site",{component:"organization"});var Organization2=class{_name;_description;_website;_logo;_email;_address;_vision;_homeOrganization;constructor(){this._name="MDFriday",this._description="Turn markdown to website, in minutes.",this._website="https://mdfriday.com",this._logo="https://gohugo.net/mdfriday.svg",this._email="support@mdfriday.com",this._address="Cang long Street, Wuhan, China",this._vision="Make site generation easy and accessible for everyone."}name(){return this._name}description(){return this._description}website(){return this._website}organization(e){return this._homeOrganization=e,this}get Name(){return this._homeOrganization?.name||this.name()}get Description(){return this._homeOrganization?.description||this.description()}get Website(){return this._homeOrganization?.website||this.website()}get Vision(){return this._homeOrganization?.vision||this._vision}get Logo(){return this._homeOrganization?.logo||this._logo}get Address(){return this._homeOrganization?.contact?.address||this._address}get Email(){return this._homeOrganization?.contact?.email||this._email}get Social(){return this._homeOrganization?.social}SocialById(e){return this._homeOrganization?.social?.[e]||""}get Socials(){const e=[];if(!this._homeOrganization?.social)return e;for(const[t,n]of Object.entries(this._homeOrganization.social))n&&e.push({ID:t,Link:n});return e}},Compiler=class{ver;constructor(e){this.ver=e}version(){return this.ver}environment(){return"production"}};init_log();var log49=getDomainLogger("site",{component:"navigation"}),Navigation=class{taxonomies;taxonomiesBuilder=null;taxonomiesCache=new Map;menus;menuBuilder=null;menuCache=new Map;constructor(e){this.taxonomies=new Map,this.menus=new Map;for(const t of e.languageKeys())this.menus.set(t,newEmptyMenus()),this.menuCache.set(t,!1)}setMenuBuilder(e){this.menuBuilder=e}setTaxonomiesBuilder(e){this.taxonomiesBuilder=e}async generateMenusForLanguage(e,t){if(this.menuBuilder){if(!0!==this.menuCache.get(e))try{const n=await this.menuBuilder.buildMenusForLanguage(t);this.menus.set(e,n),this.menuCache.set(e,!0)}catch(t){log49.error(`Failed to generate menus for language ${e}: ${t}`)}}else log49.error("Menu builder not set, cannot generate menus")}async generateTaxonomiesForLanguage(e,t,n){if(this.taxonomiesBuilder){if(!0!==this.taxonomiesCache.get(e))try{const r=await this.taxonomiesBuilder.buildTaxonomiesForLanguage(t,n);this.taxonomies.set(e,r),this.taxonomiesCache.set(e,!0)}catch(t){log49.error(`Failed to generate taxonomies for language ${e}: ${t}`)}}else log49.error("Taxonomies builder not set, cannot generate taxonomies")}getMenus(e){let t=this.menus.get(e);return void 0===t&&(t=newEmptyMenus()),t}getTaxonomies(e){return this.taxonomies.get(e)}};init_log();var log50=getDomainLogger("site",{component:"menu-builder"}),MenuBuilder=class{contentService;site;constructor(e,t){this.contentService=e,this.site=t}async buildMenusForLanguage(e){const t=new Map;return await this.contentService.walkPages(e,async e=>{await this.processPage(e,t)}),this.convertToMenus(t)}async processPage(e,t){try{const n=e.menu();if(!n)return;const r=await this.generatePageUrl(e);for(const[s,a]of Object.entries(n))await this.processMenuSection(s,a,r,e,t)}catch(e){log50.error(`Error processing page for menu: ${e}`)}}async processMenuSection(e,t,n,r,s){if(!(!1===t||Array.isArray(t)&&0===t.length))if(Array.isArray(t))await this.processMenuItems(e,t,n,r,s);else if(t&&"object"==typeof t){let a=0;for(const[i,o]of Object.entries(t))if(!(!1===o||Array.isArray(o)&&0===o.length)&&Array.isArray(o)){const t=`${e}.${i}`;if(await this.processMenuItems(t,o,n,r,s),"footer"===e){const e=`${t}::__subsection__`;s.has(e)||s.set(e,{title:i,url:"",children:new Map,weight:1e3,level:0,menuName:t,order:a})}a++}}}async processMenuItems(e,t,n,r,s){for(let a=0;a<t.length;a++){const i=t[a];if(!i||"object"!=typeof i)continue;if(!i.title||"string"!=typeof i.title)continue;let o=i.url||"";o=""===o?n:await this.processMenuItemUrl(o);const l="number"==typeof i.weight?i.weight:1e3,c=`${e}::${i.title}`;let u=s.get(c);u?l<u.weight&&(u.weight=l,u.url=o):(u={title:i.title,url:o,children:new Map,weight:l,level:0,menuName:e||void 0,order:a},s.set(c,u)),Array.isArray(i.children)&&await this.processChildrenItems(c,i.children,n,r,s,u)}}async processChildrenItems(e,t,n,r,s,a){for(let i=0;i<t.length;i++){const o=t[i];if(!o||"object"!=typeof o)continue;if(!o.title||"string"!=typeof o.title)continue;let l=o.url||"";l=""===l?n:await this.processMenuItemUrl(l);const c="number"==typeof o.weight?o.weight:1e3,u=`${e}::${o.title}`,h={title:o.title,url:l,children:new Map,weight:c,level:a.level+1,menuName:a.menuName||void 0,order:i};s.set(u,h),a.children.set(u,h),Array.isArray(o.children)&&await this.processChildrenItems(u,o.children,n,r,s,h)}}async generatePageUrl(e){try{return(await this.site.sitePage(e)).RelPermalink}catch(t){return log50.error(`Error generating page URL for ${e.path()}: ${t}`),this.fallbackUrlFromPath(e.path())}}async processMenuItemUrl(e){try{return this.site.getURL().relURL(e)}catch(t){return log50.error(`Error processing menu item URL ${e}: ${t}`),e}}fallbackUrlFromPath(e){let t=e.replace(/\.md$/,"");return t.startsWith("/")||(t="/"+t),t.endsWith("/")||t.includes(".")||(t+="/"),t}convertToMenus(e){const t=new Map;for(const[n,r]of e.entries())if(!n.includes("::__subsection__")&&0===r.level){const e=r.menuName||"main";t.has(e)||t.set(e,[]),t.get(e).push(r)}const n=this.buildMenuItems(t.get("nav")||[],e),r=[],s=new Map,a=new Map;for(const[n,r]of t.entries())if(n.startsWith("footer.")){const t=n.substring(7),i=this.buildMenuItems(r,e,!1);s.set(t,i);const o=`${n}::__subsection__`,l=e.get(o);l&&a.set(t,l.order)}const i=Array.from(s.entries()).sort((e,t)=>(a.get(e[0])||0)-(a.get(t[0])||0));for(let e=0;e<i.length;e++){const[t,n]=i[e];if(n.length>0){const s=new Menu2({title:this.capitalizeFirstLetter(t),url:"",children:n,weight:e+1,identifier:`footer-${t}`});r.push(s)}}const o={};return n.length>0&&(o.nav=n),r.length>0&&(o.footer=r),new Menus(o)}capitalizeFirstLetter(e){return e.charAt(0).toUpperCase()+e.slice(1)}buildMenuItems(e,t,n=!0){const r=[];for(const s of e){const e=Array.from(s.children.values()),a=e.length>0?this.buildMenuItems(e,t,n):[],i=new Menu2({title:s.title,url:s.url,children:a,weight:s.weight,identifier:s.url});r.push(i)}return n?r.sort((e,t)=>e.weight()!==t.weight()?e.weight()-t.weight():e.title().localeCompare(t.title())):r.sort((t,n)=>{const r=e.find(e=>e.title===t.title()),s=e.find(e=>e.title===n.title());return(r?.order||0)-(s?.order||0)})}};init_taxonomies_builder(),init_log();var log51=getDomainLogger("site",{component:"navigation-factory"}),NavigationFactory=class{langService;contentService;site;constructor(e,t,n){this.langService=e,this.contentService=t,this.site=n}createNavigation(){try{const t=(e=this.langService,new Navigation(e)),n=new MenuBuilder(this.contentService,this.site);t.setMenuBuilder(n);const r=new TaxonomiesBuilder(this.contentService);return t.setTaxonomiesBuilder(r),t}catch(e){throw log51.error(`Failed to create Navigation entity: ${e}`),e}var e}};init_log(),getDomainLogger("site",{component:"factory"}),init_log();var import_path16=__toESM(require("path")),import_crypto=require("crypto"),import_stream=require("stream"),import_promises=require("stream/promises");init_log();var log53=getDomainLogger("resources",{component:"publisher"}),ResourceHash=class{value="";size=0;resource=null;async setup(e){if(this.value)return;this.resource=e;const t=await e.readSeekCloser(),n=(0,import_crypto.createHash)("sha256");let r=0;const s=[];t.on("data",e=>{n.update(e),r+=e.length,s.push(e)}),await new Promise((e,s)=>{t.on("end",()=>{this.value=n.digest("hex"),this.size=r,e()}),t.on("error",s)}),await t.close()}},PublishOnce=class{hasPublished=!1;publishPromise=null;async do(e){if(!this.hasPublished)return this.publishPromise||(this.publishPromise=e().then(()=>{this.hasPublished=!0})),this.publishPromise}},ResourceImpl=class e{h;openReadSeekCloser;_mediaType;paths;_data;publisher;publishOnce;constructor(e,t,n,r={},s){this.h=new ResourceHash,this.openReadSeekCloser=e,this._mediaType=t,this.paths=n,this._data=r,this.publisher=s,this.publishOnce=new PublishOnce}name(){return this.paths.pathFile()}nameNormalized(){return this.paths.targetPath().replace(/\\/g,"/")}mediaType(){return this._mediaType}resourceType(){return this._mediaType.mainType}relPermalink(){return this.publish(),this.paths.targetLink()}permalink(){return this.publish(),this.paths.targetPath()}async publish(){const e=this.targetPath();this.publisher?await this.publishOnce.do(async()=>{let t=null,n=null;try{t=await this.publisher.openPublishFileForWriting(this.paths.targetPath()),n=await this.readSeekCloser(),await this.copyStreamToFile(n,t)}catch(t){throw log53.errorf("❌ [Resource.publish] Error publishing %s: %s",e,t),t}finally{if(n)try{await n.close()}catch(t){log53.errorf("❌ [Resource.publish] Failed to close ReadSeekCloser %s: %s",e,t)}if(t)try{await t.file.close()}catch(t){log53.errorf("❌ [Resource.publish] Failed to close public writer %s: %s",e,t)}}}):log53.error("⚠️ [Resource.publish] No publisher for: %s",e)}async copyStreamToFile(e,t){const n=this.targetPath();try{await(0,import_promises.pipeline)(e,t)}catch(e){throw log53.errorf("❌ [copyStreamToFile] Error during pipeline for %s: %s",n,e),e}}targetPath(){return this.paths.targetPath()}data(){return this._data}async readSeekCloser(){const e=await this.openReadSeekCloser();if(e&&"function"==typeof e.read){const t=e.read();if(t){const n=new(0,require("stream").Readable);let r;for(n.push(t);null!==(r=e.read());)r&&n.push(r);return n.push(null),Object.assign(n,{seek:async(e,t)=>0,close:async()=>Promise.resolve()})}}return e}async content(e){const t=await this.readSeekCloser();return new Promise((e,n)=>{let r="";t.on("data",e=>{r+=e.toString()}),t.on("end",()=>{e(r)}),t.on("error",n)})}async hash(){return await this.h.setup(this),this.h.value}async size(){return await this.h.setup(this),this.h.size}cloneTo(e){const t=this.clone();return t.paths=t.paths.fromTargetPath(e),t}clone(){const t=new e(this.openReadSeekCloser,this._mediaType,this.paths,{...this._data},this.publisher);return t.h=this.h,t}key(){return this.paths.targetLink()}get RelPermalink(){return this.relPermalink()}get Permalink(){return this.permalink()}get Name(){return this.name()}get MediaType(){return this.mediaType()}get ResourceType(){return this.resourceType()}get TargetPath(){return this.targetPath()}get Data(){return this.data()}get Content(){return this.content()}get Hash(){return()=>this.hash()}get Size(){return()=>this.size()}meta(){return new ResourceMetadataImpl(this.paths.targetPath(),this._mediaType.type,this._data)}mergeData(e){if(e&&0!==Object.keys(e).length)for(const[t,n]of Object.entries(e))t in this._data||(this._data[t]=n)}async transform(...e){let t=this;for(let n=0;n<e.length;n++){const r=e[n];try{const e=await t.readSeekCloser(),n=new import_stream.PassThrough;let s="";const a=[],i={source:{from:e,inPath:t.targetPath(),inMediaType:t.mediaType()},target:{to:n},data:{...t.data()},addOutPathIdentifier:e=>{const n=t.targetPath(),r=PathDomain.parseBasic(n);let s=r.dir;s=s.replace(/\/+$/,"");let a="";s&&(a=s+"/"),a+=r.nameWithoutExt+e+r.ext,i.data.targetPath=a},updateBuffer:()=>{},updateSource:()=>{},close:()=>{e.close()}};n.on("data",e=>{a.push(e)});const o=new Promise((e,t)=>{n.on("end",()=>{s=Buffer.concat(a).toString(),e()}),n.on("error",e=>{t(e)})});await r.transform(i),await o;const l=i.data.targetPath||t.targetPath(),c=this.createTransformedResource(s,l,t.mediaType(),i.data);t=c,i.close()}catch(e){throw e}}return t}createTransformedResource(t,n,r,s){const a=this.paths.fromTargetPath(n);return new e(async()=>{const e=new import_stream.PassThrough;return e.end(t),Object.assign(e,{seek:async(e,t)=>0,close:async()=>Promise.resolve()})},r,a,s,this.publisher)}},import_terser=require("terser"),MinifierClient=class{minifiers=new Map;minifyOutput;constructor(e=!1){this.minifyOutput=e,this.setupMinifiers()}setupMinifiers(){this.minifiers.set("text/css",this.minifyCSS.bind(this)),this.minifiers.set("text/javascript",this.minifyJS.bind(this)),this.minifiers.set("application/javascript",this.minifyJS.bind(this)),this.minifiers.set("application/json",this.minifyJSON.bind(this)),this.minifiers.set("text/html",this.minifyHTML.bind(this)),this.minifiers.set("image/svg+xml",this.minifySVG.bind(this)),this.minifiers.set("application/xml",this.minifyXML.bind(this)),this.minifiers.set("text/xml",this.minifyXML.bind(this))}async minify(e){const t=new MinifyTransformation(this);return e.transform(t)}getMinifier(e){return this.minifiers.get(e)||null}async minifyCSS(e){return e}async minifyJS(e){try{return(await(0,import_terser.minify)(e,{compress:{drop_console:!1,drop_debugger:!0,passes:2},mangle:{toplevel:!1},format:{comments:!1}})).code||e}catch(t){return e}}async minifyJSON(e){try{return JSON.stringify(JSON.parse(e))}catch{return e}}async minifyHTML(e){return e}async minifySVG(e){return e}async minifyXML(e){return e}},MinifyTransformation=class{constructor(e){this.minifierClient=e}key(){return ResourceTransformationKey.newResourceTransformationKey("minify")}async transform(e){e.addOutPathIdentifier(".min");const t=e.source.inMediaType.type,n=this.minifierClient.getMinifier(t);if(!n)return void e.source.from.pipe(e.target.to);let r="";e.source.from.on("data",e=>{r+=e.toString()}),await new Promise((t,s)=>{e.source.from.on("end",async()=>{try{const s=await n(r);e.target.to.write(s),e.target.to.end(),t()}catch(e){s(e)}}),e.source.from.on("error",s)})}},import_crypto2=require("crypto"),IntegrityClient=class{async fingerprint(e,t="sha256"){const n=new FingerprintTransformation(t);return e.transform(n)}generateIntegrity(e){return`sha256-${(0,import_crypto2.createHash)("sha256").update(e,"utf8").digest("base64")}`}generateSHA384(e){return`sha384-${(0,import_crypto2.createHash)("sha384").update(e,"utf8").digest("base64")}`}generateSHA512(e){return`sha512-${(0,import_crypto2.createHash)("sha512").update(e,"utf8").digest("base64")}`}verifyIntegrity(e,t){const[n,r]=t.split("-",2);let s;switch(n){case"sha256":s=(0,import_crypto2.createHash)("sha256").update(e,"utf8").digest("base64");break;case"sha384":s=(0,import_crypto2.createHash)("sha384").update(e,"utf8").digest("base64");break;case"sha512":s=(0,import_crypto2.createHash)("sha512").update(e,"utf8").digest("base64");break;default:return!1}return s===r}},FingerprintTransformation=class{constructor(e){this.algo=e}key(){return ResourceTransformationKey.newResourceTransformationKey("fingerprint",this.algo)}async transform(e){const t=this.newHash(this.algo);let n="";const r=[];e.source.from.on("data",e=>{t.update(e),r.push(e),n+=e.toString()}),await new Promise((n,s)=>{e.source.from.on("end",()=>{try{const s=t.digest(),a=s.toString("hex");e.data.Integrity=this.integrity(this.algo,s);const i=a.substring(0,12);e.addOutPathIdentifier("."+i);for(const t of r)e.target.to.write(t);e.target.to.end(),n()}catch(e){s(e)}}),e.source.from.on("error",s)})}newHash(e){switch(e){case"md5":return(0,import_crypto2.createHash)("md5");case"sha256":return(0,import_crypto2.createHash)("sha256");case"sha384":return(0,import_crypto2.createHash)("sha384");case"sha512":return(0,import_crypto2.createHash)("sha512");default:throw new Error(`Unsupported hash algorithm: "${e}", use either md5, sha256, sha384 or sha512`)}}integrity(e,t){return`${e}-${t.toString("base64")}`}},ExecuteAsTemplateTransform=class{templateExecutor;_targetPath;data;constructor(e,t,n){this.templateExecutor=e,this._targetPath=t,this.data=n}key(){return ResourceTransformationKey.newResourceTransformationKey("execute-as-template",this._targetPath)}async transform(e){try{e.data.targetPath=this._targetPath;let t="";if("function"==typeof e.source.from.read){let n;const r=[];for(;null!==(n=e.source.from.read());)n&&r.push(n);if(r.length>0)t=Buffer.concat(r).toString();else if(e.source.from._readableState&&e.source.from._readableState.buffer){const n=e.source.from._readableState.buffer,r=[];for(const e of n)e&&e.chunk&&r.push(e.chunk);r.length>0&&(t=Buffer.concat(r).toString())}}if(!t)return new Promise((t,n)=>{const r=[];e.source.from.on("data",e=>{r.push(e)}),e.source.from.on("end",async()=>{try{const s=Buffer.concat(r).toString();await this.executeTemplate(s,e,t,n)}catch(t){n(new Error(`failed to parse Resource "${e.source.inPath}" as Template: ${t}`))}}),e.source.from.on("error",e=>{n(e)}),"function"==typeof e.source.from.resume&&e.source.from.resume()});await this.executeTemplateSync(t,e)}catch(t){throw new Error(`failed to parse Resource "${e.source.inPath}" as Template: ${t}`)}}async executeTemplateSync(e,t){const n=await this.templateExecutor.executeTemplate(t.source.inPath,e,this.data);t.target.to.write(n),t.target.to.end()}async executeTemplate(e,t,n,r){try{await this.executeTemplateSync(e,t),n()}catch(e){r(e instanceof Error?e:new Error(String(e)))}}},TemplateClient=class{templateExecutor;constructor(e){this.templateExecutor=e}async executeAsTemplate(e,t,n){try{if(!e)throw new Error("Resource is null or undefined");if("function"!=typeof e.transform)throw new Error("Resource does not implement Transformer interface. Resource type: "+typeof e);const r=new ExecuteAsTemplateTransform(this.templateExecutor,t.replace(/\\/g,"/").replace(/^\/+/,""),n);return await e.transform(r)}catch(e){throw e}}},path24=__toESM(require("path"));init_log();var import_stream2=require("stream"),log54=getDomainLogger("resources",{component:"publisher"}),Publisher2=class{pubFs;urlSvc;constructor(e,t){this.pubFs=e,this.urlSvc=t}async openPublishFileForWriting(e){const t=e.replace(/^\/+/,"");try{const e=await this.pubFs.create(t);return new FileWritable(e)}catch(e){if("ENOENT"===e.code||e.message.includes("ENOENT")){const e=path24.dirname(t);await this.pubFs.mkdirAll(e,511);const n=await this.pubFs.create(t),r=n.close.bind(n);return n.close=async()=>{try{await r()}catch(e){throw log54.errorf("❌ [Publisher.File.close] Error closing publish file (retry) %s, $s",t,e),e}},new FileWritable(n)}throw e}}async openFilesForWriting(...e){if(0===e.length)throw new Error("No filenames provided");const t=e[0];return await this.openFileForWriting(t)}async openFileForWriting(e){const t=path24.normalize(e);try{return await this.pubFs.create(t)}catch(e){if(!this.isFileNotFoundError(e))throw e;const n=path24.dirname(t);return await this.pubFs.mkdirAll(n,511),await this.pubFs.create(t)}}isFileNotFoundError(e){return e&&("ENOENT"===e.code||e.message?.includes("no such file or directory")||e.message?.includes("not found"))}},FileWritable=class extends import_stream2.Writable{file;constructor(e){super(),this.file=e}_write(e,t,n){this.file.write(e).then(()=>n()).catch(n)}_final(e){this.file.sync?.().then(()=>this.file.close()).then(()=>e()).catch(e)}};init_log();var http2=__toESM(require("http")),https2=__toESM(require("https")),log55=getDomainLogger("resources",{component:"http-client"}),HttpClient4=class{defaultTimeout=3e4;defaultHeaders={"User-Agent":"MDFriday-Resources/1.0.0"};async fromRemote(e,t){return new Promise(n=>{try{const r=new URL(e),s="https:"===r.protocol,a=s?https2:http2,i={...this.defaultHeaders,...t?.headers},o={hostname:r.hostname,port:r.port||(s?443:80),path:r.pathname+r.search,method:"GET",headers:i,timeout:t?.timeout||this.defaultTimeout},l=a.request(o,r=>{if(r.statusCode&&r.statusCode>=300&&r.statusCode<400&&r.headers.location)return log55.infof("🔄 [HttpClient.fromRemote] Redirecting from %s to %s",e,r.headers.location),void this.fromRemote(r.headers.location,t).then(n);if(!r.statusCode||r.statusCode<200||r.statusCode>=300)return log55.errorf("❌ [HttpClient.fromRemote] HTTP error %d when fetching %s: %s",r.statusCode||0,e,r.statusMessage||"Unknown error"),void n(null);const s=[];r.on("data",e=>{s.push(e)}),r.on("end",()=>{try{const t=Buffer.concat(s).toString("utf8");log55.infof("✅ [HttpClient.fromRemote] Successfully fetched %d bytes from %s",t.length,e),n(t)}catch(t){log55.errorf("❌ [HttpClient.fromRemote] Error converting response to string from %s: %s",e,t),n(null)}}),r.on("error",t=>{log55.errorf("❌ [HttpClient.fromRemote] Response error when fetching %s: %s",e,t.message),n(null)})});l.on("error",t=>{log55.errorf("❌ [HttpClient.fromRemote] Request error when fetching %s: %s",e,t.message),n(null)}),l.on("timeout",()=>{l.destroy(),log55.errorf("❌ [HttpClient.fromRemote] Request timeout when fetching %s",e),n(null)}),l.end()}catch(t){log55.errorf("❌ [HttpClient.fromRemote] Error fetching content from %s: %s",e,t),n(null)}})}},path25=__toESM(require("path")),import_crypto3=require("crypto");init_log();var log56=getDomainLogger("resources",{component:"resources"}),Resources=class{cache=new Map;workspace;fsSvc;urlSvc;templateSvc;publisher;minifierClient;integrityClient;templateClient=null;httpClient;constructor(e){this.workspace=e,this.fsSvc=e,this.urlSvc=e,this.templateSvc=e,this.publisher=new Publisher2(e.publishFs(),e),this.minifierClient=new MinifierClient,this.integrityClient=new IntegrityClient,this.templateClient=new TemplateClient(this.templateSvc),this.httpClient=new HttpClient4}setTemplateSvc(e){this.templateSvc=e,this.templateClient=new TemplateClient(e)}async getResource(e){const t=path25.posix.normalize(e),n=`${t}__get`;if(this.cache.has(n))return this.cache.get(n)||null;try{const e=this.workspace.assetsFs();if(!await e.stat(t))return null;const r=async()=>{const n=await e.open(t);return await this.createReadSeekCloser(n)},s=await this.buildResource(t,r);return s&&this.cache.set(n,s),s}catch(e){return log56.errorf("❌ [Resources.getResource] Error getting resource %s, %s",t,e),null}}async getResourceWithOpener(e,t){const n=path25.posix.normalize(e),r=`${n}__get_with_opener`;if(this.cache.has(r))return this.cache.get(r)||null;try{const e=await this.buildResource(n,t);return e&&this.cache.set(r,e),e}catch(e){return log56.errorf("❌ [Resources.getResourceWithOpener] Error getting resource with opener %s, %s",n,e),null}}async executeAsTemplate(e,t,n){if(!this.templateClient)throw new Error("Template client not available. Please set template client first.");const r=e.key()+"-template-"+t,s=this.cacheKey(r);if(this.cache.has(s))return this.cache.get(s);try{const r=await this.templateClient.executeAsTemplate(e,t,n);return r?this.cache.set(s,r):log56.warnf("⚠️ [Resources.executeAsTemplate] Template execution returned null for resource %s",e.key()),r}catch(t){throw log56.errorf("❌ [Resources.executeAsTemplate] Error executing template %s, %s",e.key(),t),t}}async minify(e){if(!this.minifierClient)throw new Error("Minifier client not available. Please set minifier client first.");const t=e.key()+"-minify",n=this.cacheKey(t);if(this.cache.has(n))return this.cache.get(n);try{const t=await this.minifierClient.minify(e);return t?this.cache.set(n,t):log56.warnf("⚠️ [Resources.minify] Minification returned null for resource %s",e.key()),t}catch(t){throw log56.errorf("❌ [Resources.minify] Error minifying resource %s, %s",e.key(),t),t}}async fingerprint(e){const t=e.key()+"-fingerprint",n=this.cacheKey(t);if(this.cache.has(n))return this.cache.get(n);try{const t=await this.integrityClient.fingerprint(e);return t?this.cache.set(n,t):log56.warnf("⚠️ [Resources.fingerprint] Fingerprint operation returned null for resource %s",e.key()),t}catch(t){throw log56.errorf("❌ [Resources.fingerprint] Error fingerprinting resource %s, %s",e.key(),t),t}}async getRemote(e){const t=`${e}__remote`;if(this.cache.has(t))return this.cache.get(t)||null;try{const n=await this.httpClient.fromRemote(e);if(!n)return null;const r=async()=>this.newReadSeekerNoOpCloserFromString(n),s=await this.buildResource(e,r);return s&&this.cache.set(t,s),s}catch(t){return log56.errorf("❌ [Resources.fromRemote] Error getting remote resource %s, %s",e,t),null}}cacheKey(e){return(0,import_crypto3.createHash)("sha256").update(e).digest("hex").substring(0,16)}getMinifierClient(){return this.minifierClient}getIntegrityClient(){return this.integrityClient}setTemplateClient(e){this.templateClient=e}async buildResource(e,t){try{const n=path25.extname(e),r=this.getMediaTypeFromExtension(n),s=ResourcePaths.newResourcePaths(e,this.workspace);return new ResourceImpl(t,r,s,{},this.publisher)}catch(t){return log56.errorf("❌ [Resources.buildResource] Error building resource for %s, %s",e,t),null}}getMediaTypeFromExtension(e){const t={".js":{type:"text/javascript",mainType:"text",subType:"javascript"},".css":{type:"text/css",mainType:"text",subType:"css"},".html":{type:"text/html",mainType:"text",subType:"html"},".json":{type:"application/json",mainType:"application",subType:"json"},".svg":{type:"image/svg+xml",mainType:"image",subType:"svg+xml"},".xml":{type:"application/xml",mainType:"application",subType:"xml"},".txt":{type:"text/plain",mainType:"text",subType:"plain"}},n=e?t[e]||t[".txt"]:t[".html"],r=e?e.substring(1):"html",s=e||".html";return new MediaType({type:n.type,mainType:n.mainType,subType:n.subType,delimiter:".",firstSuffix:{suffix:r,fullSuffix:s},mimeSuffix:"",suffixesCSV:r})}async createReadSeekCloser(e){try{const t=[];let n=0;try{for(;;){const r=new Uint8Array(8192),s=await e.read(r);if(0===s.bytesRead)break;n+=s.bytesRead,t.push(r.slice(0,s.bytesRead))}}finally{await e.close()}let r="";if(t.length>0){const e=new Uint8Array(n);let s=0;for(const n of t)e.set(n,s),s+=n.length;r=(new TextDecoder).decode(e)}return this.newReadSeekerNoOpCloserFromString(r)}catch(t){try{await e.close()}catch(t){log56.warnf("❌ [Resources.createReadSeekCloser] Error closing file after read error %s, %s",e.path,t)}return this.newReadSeekerNoOpCloserFromString("")}}newReadSeekerNoOpCloserFromString(e){const{Readable:t}=require("stream"),n=new t({read(){}});return n.push(e),n.push(null),Object.assign(n,{seek:async(e,t)=>0,close:async()=>Promise.resolve()})}},path26=__toESM(require("path")),ResourcePaths=class e{dir;baseDirTarget;baseDirLink;targetBasePaths;file;baseUrl="";constructor(e="",t="",n="",r="",s=[],a=""){this.dir=e,this.file=t,this.baseDirTarget=n,this.baseDirLink=r,this.targetBasePaths=s,this.baseUrl=a}static newResourcePaths(t,n){const r=t.replace(/\\/g,"/"),s=path26.posix.parse(r);let a=s.dir;return"/"===a&&(a=""),new e(a,s.base,n.baseUrl(),n.baseUrl(),[],n.baseUrl())}join(...e){let t="";for(let n=0;n<e.length;n++){const r=e[n];if(r)if(""===t)t=r;else{const e=!t.endsWith("/")&&!r.startsWith("/"),n=t.endsWith("/")&&r.startsWith("/");t+=n?r.substring(1):e?"/"+r:r}}return t.startsWith("/")&&(t=t.substring(1)),t.endsWith("/")&&t.length>1&&(t=t.substring(0,t.length-1)),t}targetLink(){let e=this.join(this.baseDirLink,this.dir,this.file);return e.startsWith("http://")||e.startsWith("https://")||e.startsWith("/")||(e="/"+e),e}targetPath(){return this.join(this.dir,this.file)}fromTargetPath(t){const n=t.replace(/\\/g,"/"),r=path26.posix.parse(n);let s=r.dir;return"/"===s&&(s=""),new e(s,r.base,this.baseUrl,this.baseUrl,this.targetBasePaths,this.baseUrl)}pathDir(){return this.dir}pathBaseDirTarget(){return this.baseDirTarget}pathBaseDirLink(){return this.baseDirLink}pathTargetBasePaths(){return this.targetBasePaths}pathFile(){return this.file}},import_crypto4=require("crypto"),ResourceTransformationKey=class e{constructor(e,t=[]){this.name=e,this.elements=t}static newResourceTransformationKey(t,...n){return new e(t,n)}value(){if(0===this.elements.length)return this.name;const e=this.hashElements(...this.elements);return`${this.name}_${e}`}hashElements(...e){const t=e.map(e=>String(e)).join("|");return(0,import_crypto4.createHash)("sha256").update(t).digest("hex").substring(0,16)}},ResourceMetadataImpl=class e{constructor(e,t,n){this.target=e,this.mediaType=t,this.metaData=n}marshal(){return JSON.stringify({Target:this.target,MediaType:this.mediaType,Data:this.metaData})}static unmarshal(t){const n=JSON.parse(t);return new e(n.Target,n.MediaType,n.Data||{})}};init_log(),init_log();var workerpool=__toESM(require("workerpool")),os=__toESM(require("os")),log57=getDomainLogger("application",{component:"pool-manager"}),WorkerPoolManager=class{pool=null;environment;workerCount;constructor(e={}){this.environment=this.detectEnvironment(),this.workerCount=e.workerCount||this.calculateOptimalWorkerCount(),log57.info("Worker pool manager created",{environment:this.environment,workerCount:this.workerCount})}detectEnvironment(){if("undefined"!=typeof process&&process.versions&&process.versions.node)try{return require.resolve("worker_threads"),log57.debug("Detected Node.js Worker Threads support"),process.versions.electron&&log57.info("✨ Detected Electron environment - using Node.js Worker Threads (full Node.js API support)"),"node"}catch{if(log57.debug("Node.js detected but worker_threads unavailable"),"undefined"!=typeof Worker&&void 0!==globalThis.window)return log57.warn("⚠️ Falling back to Web Workers (limited: no Node.js API access)"),"browser";throw new Error("No worker support available (neither Worker Threads nor Web Workers)")}return"undefined"!=typeof Worker&&void 0!==globalThis.window?(log57.debug("Detected Web Worker support (pure browser environment)"),"browser"):(log57.warn("Unable to detect environment reliably, defaulting to browser mode"),"browser")}calculateOptimalWorkerCount(){if("node"===this.environment){const e=os.cpus().length;return Math.max(1,e-1)}{const e="undefined"!=typeof navigator&&navigator.hardwareConcurrency||4;return Math.max(2,Math.min(e-1,4))}}async initialize(){if(this.pool)return void log57.warn("Worker pool already initialized");const e=performance.now();log57.info(`🚀 Initializing ${this.environment} worker pool with ${this.workerCount} workers...`);try{"node"===this.environment?await this.initializeNodePool():await this.initializeBrowserPool();const t=performance.now()-e;log57.info(`✅ Worker pool initialized in ${t.toFixed(2)}ms`)}catch(t){const n=t instanceof Error?t.message:String(t);if("node"===this.environment){log57.warn(`❌ Node worker pool initialization failed: ${n}`),log57.warn("🔄 Attempting fallback to browser workers...");try{this.environment="browser",await this.initializeBrowserPool();const t=performance.now()-e;return void log57.info(`✅ Successfully initialized browser worker pool as fallback in ${t.toFixed(2)}ms`)}catch(e){const t=e instanceof Error?e.message:String(e);throw log57.error(`❌ Fallback to browser workers also failed: ${t}`),new Error(`Worker pool initialization failed. Node: ${n}, Browser: ${t}`)}}throw log57.error(`❌ Failed to initialize worker pool: ${n}`),t}}async initializeNodePool(){const e=require("path").join(__dirname,"worker","worker-node.js");log57.debug(`Initializing Node.js worker pool with path: ${e}`),this.pool=workerpool.pool(e,{minWorkers:this.workerCount,maxWorkers:this.workerCount,workerType:"thread"}),log57.debug(`Node.js worker pool created with ${this.workerCount} workers`,{workerPath:e})}async initializeBrowserPool(){throw log57.error("❌ Browser/Web Workers mode is not supported for SSG parallel processing"),log57.info("💡 Reason: SSG requires Node.js file system access (fs, path, etc.)"),log57.info("💡 Electron/Obsidian: Should use Node.js Worker Threads instead"),log57.info("💡 Pure browser: Parallel processing not available, use serial mode"),new Error("PARALLEL_NOT_SUPPORTED: SSG parallel processing requires Node.js file system access. Web Workers cannot access fs/path modules. System will fall back to serial processing.")}async exec(e){if(!this.pool)throw new Error("Worker pool not initialized. Call initialize() first.");log57.debug(`📤 Executing worker task: ${e.type}`,{environment:this.environment,taskType:e.type,hasProjectDir:!!e.projDir,hasModuleDir:!!e.moduleDir,pageTasksCount:e.pageTasks?.length||0});try{if("node"===this.environment){log57.debug("🔧 Using Node.js worker (processTask function)");const t=await this.pool.exec("processTask",[e]);return log57.debug("📥 Node worker response received",{success:t.success}),t}{log57.debug("🌐 Using browser worker (calling registered processTask)"),log57.debug("Task being sent to worker:",JSON.stringify({type:e.type,projDir:e.projDir,moduleDir:e.moduleDir,pageTasksCount:e.pageTasks?.length}));const t=await this.pool.exec("processTask",[e]);return log57.debug("📥 Browser worker response received",{success:t.success,hasData:!!t.data,error:t.error}),t}}catch(t){const n=t instanceof Error?t.message:String(t),r=t instanceof Error?t.stack:void 0;return log57.error(`❌ Worker task execution failed: ${n}`),log57.debug("Error details:",{message:n,stack:r,environment:this.environment,taskType:e.type}),{success:!1,error:n}}}getStats(){return this.pool?{environment:this.environment,workerCount:this.workerCount,poolStats:this.pool.stats()}:null}async terminate(){this.pool?(log57.info("🧹 Terminating worker pool..."),await this.pool.terminate(),this.pool=null,log57.info("✅ Worker pool terminated")):log57.warn("Worker pool already terminated")}};init_log();var log58=getDomainLogger("application",{component:"batch-task-queue"}),BatchTaskQueue=class{queue=[];currentIndex=0;totalBatches;constructor(e){this.queue=e,this.totalBatches=e.length,log58.info(`Task queue initialized with ${this.totalBatches} batches`)}nextBatch(){if(this.currentIndex>=this.queue.length)return null;const e=this.queue[this.currentIndex];return this.currentIndex++,e}getProgress(){const e=this.currentIndex,t=this.totalBatches;return{completed:e,total:t,percentage:0===t?100:Math.round(e/t*100)}}hasMore(){return this.currentIndex<this.queue.length}getRemainingCount(){return Math.max(0,this.queue.length-this.currentIndex)}},os2=__toESM(require("os")),log59=getDomainLogger("ssg",{component:"parallel"});async function runWorkerLoop(e,t,n,r,s,a){const i=[];for(log59.debug(`🚀 Worker ${n} loop started`);;){const o=t.nextBatch();if(!o){log59.debug(`Worker ${n} finished - no more tasks`);break}const l=t.getProgress();log59.info(`🔄 Worker ${n} processing batch ${l.completed}/${l.total} (${o.length} tasks)`);const c={type:"process-batch",pageTasks:o};log59.debug(`Worker ${n} sending task to pool manager`,{taskType:c.type,batchSize:o.length});const u=await e.exec(c);if(log59.debug(`Worker ${n} received response`,{success:u.success,hasData:!!u.data,error:u.error}),u.success&&u.data){const e=u.data;i.push(e),s.count+=e.processedCount;const t=70+Math.floor(s.count/r*29);a?.({stage:"build",message:`Rendering pages (${s.count}/${r})...`,percentage:t,pageRender:{currentPage:s.count,totalPages:r}}),log59.info(`✅ Worker ${n} completed batch: ${e.processedCount} tasks in ${e.duration.toFixed(2)}ms`)}else log59.error(`❌ Worker ${n} failed: ${u.error}`),log59.debug(`Worker ${n} error details:`,{batchSize:o.length,error:u.error}),i.push({success:!1,processedCount:0,totalCount:o.length,duration:0,errors:[u.error||"Unknown error"]})}return log59.debug(`Worker ${n} loop completed, processed ${i.length} batches`),i}async function processSSGParallel(e,t,n,r,s){const a=performance.now(),i=process.cwd();process.chdir(e);try{r?.({stage:"config",message:"Initializing parallel SSG...",percentage:5}),r?.({stage:"pages",message:"Collecting all page tasks...",percentage:10});const n=await collectAllPageTasks(e,t);if(0===n.length)return log59.warn("⚠️ No page tasks found to process"),r?.({stage:"completion",message:"No pages to process",percentage:100}),{totalPages:0,totalBatches:0,workerCount:0,batchSize:0,totalDuration:0,parallelSpeedup:0,pagesPerSecond:0};r?.({stage:"config",message:`Found ${n.length} pages, calculating optimal worker configuration...`,percentage:20});const s=os2.cpus().length,i=Math.max(2,Math.floor(.6*s)),o=function(e,t){const n=4*t,r=Math.ceil(e/n);return Math.max(5,Math.min(50,r))}(n.length,i);log59.info(`⚙️ Using ${i} workers with batch size ${o}`),r?.({stage:"config",message:`Creating worker pool with ${i} workers...`,percentage:30});const l=new WorkerPoolManager({workerCount:i});await l.initialize(),r?.({stage:"config",message:"Initializing workers...",percentage:50}),log59.info("🔧 Initializing workers...");const c=performance.now(),u=[];for(let n=0;n<i;n++){log59.debug(`Creating init task for worker ${n}`);const r={type:"init",projDir:e,moduleDir:t},s=l.exec(r);s.then(e=>log59.debug(`Worker ${n} init result:`,{success:e.success,error:e.error}),e=>log59.error(`Worker ${n} init failed:`,e)),u.push(s)}log59.info(`Waiting for ${i} workers to initialize...`);const h=await Promise.all(u),d=performance.now()-c,p=h.filter(e=>!e.success);if(p.length>0)throw log59.error(`❌ ${p.length} workers failed to initialize:`,p),new Error(`Failed to initialize ${p.length} workers: ${p.map(e=>e.error).join(", ")}`);log59.info(`✅ All workers initialized in ${d.toFixed(2)}ms`),r?.({stage:"build",message:`Creating ${Math.ceil(n.length/o)} task batches...`,percentage:65});const g=function(e,t){const n=[];for(let r=0;r<e.length;r+=t)n.push(e.slice(r,r+t));return log59.info(`📦 Created ${n.length} batches (${t} tasks per batch)`),n}(n,o),m=new BatchTaskQueue(g);r?.({stage:"build",message:"Starting parallel page rendering...",percentage:70}),log59.info("🏃 Starting worker loops...");const f=performance.now(),T={count:0},E=[];for(let e=0;e<i;e++)E.push(runWorkerLoop(l,m,e,n.length,T,r));const S=await Promise.all(E),_=performance.now()-f,A=S.flat(),I=A.filter(e=>e.success).length,y=A.reduce((e,t)=>e+t.processedCount,0),D=A.reduce((e,t)=>e+t.errors.length,0);await l.terminate();const w=performance.now()-a,b=y/w*1e3,C=_/y*y/_;return r?.({stage:"completion",message:`Parallel SSG completed! Processed ${y} pages with ${i} workers`,percentage:100}),log59.info("✨ Parallel SSG completed!"),log59.info("📊 Statistics:",{totalTasks:n.length,processedTasks:y,successfulBatches:I,failedBatches:A.length-I,totalErrors:D,totalDuration:`${w.toFixed(2)}ms`,processingDuration:`${_.toFixed(2)}ms`,pagesPerSecond:b.toFixed(2),parallelSpeedup:`${C.toFixed(2)}x`}),{totalPages:n.length,totalBatches:g.length,workerCount:i,batchSize:o,totalDuration:w,parallelSpeedup:C,pagesPerSecond:b}}catch(e){const t=e instanceof Error?e.message:String(e);throw log59.error(`❌ Parallel SSG failed: ${t}`),e}finally{process.chdir(i)}}var configCache,modulesCache,fsCache,contentCache,resourcesCache,siteCache,log60=getDomainLogger("ssg",{component:"application"}),createDomainInstances=(e,t,n,r,s,a)=>({site:e,content:t,fs:n,config:r,modules:s,resources:a});function setDomainInstances(e,t,n,r,s,a,i){siteCache=e,contentCache=t,fsCache=n,configCache=r,modulesCache=s,resourcesCache=a}function getDomainInstances(){return createDomainInstances(siteCache,contentCache,fsCache,configCache,modulesCache,resourcesCache)}async function loadConfiguration(e,t){const n=new OsFs,r=import_path16.default.join(e,"config.json");return await loadConfigWithParams(n,r,e,t)}async function createFileSystem(e,t){const n={path:e.getDir().getWorkingDir(),publish:e.getDir().getPublishDir(),osFs:e.fs()};return await createFs(n,t)}async function createContentEngine(e,t,n,r){const s={baseUrl:()=>t.getRoot().baseUrl(),markdown:()=>r,useInternalRenderer:()=>t.getMarkdown().useInternalRenderer(),isWikilinkEnabled:()=>t.getMarkdown().isWikilinkEnabled(),isTagEnabled:()=>t.getMarkdown().isTagEnabled(),isCalloutEnabled:()=>t.getMarkdown().isCalloutEnabled(),isLatexEnabled:()=>t.getMarkdown().isLatexEnabled(),isMermaidEnabled:()=>t.getMarkdown().isMermaidEnabled(),newFileMetaInfo:t=>e.newFileMetaInfo(t),newFileMetaInfoWithContent:t=>e.newFileMetaInfoWithContent(t),contentFs:()=>e.contentFs(),walkContent:(t,n,r,s)=>e.walkContent(t,n,r,s),walkI18n:(t,n,r)=>e.walkI18n(t,n,r),isLanguageValid:e=>t.getLanguage().isLanguageValid(e),getSourceLang:e=>n.getSourceLang(e),getLanguageIndex:e=>t.getLanguage().getLanguageIndex(e),getLanguageByIndex:e=>t.getLanguage().getLanguageByIndex(e),defaultLanguage:()=>t.getLanguage().defaultLanguage(),languageIndexes:()=>t.getLanguage().languageIndexes(),views:()=>t.getTaxonomy().getViews().map(e=>{const t=e.singular,n=e.plural;return{singular:()=>t||"",plural:()=>n||""}})};return await createContent(s)}function createResourcesEngine(e,t){return new Resources({assetsFs:()=>t.assetsFs(),publishFs:()=>t.publishFs(),baseUrl:()=>e.getProvider().getString("baseURL")||"http://localhost",executeTemplate:async(e,t,n)=>{throw new Error("Template execution not initialized. Please call resources.setTemplateSvc() first.")}})}async function createTemplateEngineFromFs(e,t,n,r){const s=function(e,t,n){const r=e.getProvider().getString("baseURL")||"http://localhost";return{relURL:e=>t.getURL().relURL(e),absURL:e=>t.getURL().absURL(e,t.isMultipleLanguage(),t.languagePrefix()),urlize:e=>t.getURL().urlize(e),translate:e=>t.translate(e),relRefFrom:async(e,t)=>[e.path||"",null],title:()=>e.getProvider().getString("title")||"My Site",baseURL:()=>r,params:()=>e.getProvider().getParams("params"),menus:()=>({}),isMultiLanguage:()=>e.getLanguage().languageKeys().length>1,version:()=>"0.1.0",environment:()=>"development",generator:()=>"AuPro Static Site Generator",defaultLanguage:()=>e.getLanguage().defaultLanguage(),languageKeys:()=>e.getLanguage().languageKeys(),Get:async function(e){try{return await n.getResource(e)}catch(t){return log60.warn(`Resource not found: ${e}`,t),Promise.resolve(null)}},GetRemote:async function(e){return await n.getRemote(e)},Minify:async function(e){return await n.minify(e)},Fingerprint:async function(e){return await n.fingerprint(e)},ExecuteAsTemplate:async function(e,t,r){return await n.executeAsTemplate(r,e,t)}}}(t,n,r),a={walk:e.walkLayouts.bind(e)};return await async function(e,t){return(new Factory2).createWithServices(e,t)}(a,s)}async function createTemplateAdapter(e,t){return{async lookupLayout(t){const[n,r,s,a]=await e.findFirst(t);return a?{preparer:null,found:!1}:s&&n&&r?{preparer:{name:()=>r,execute:async e=>{const[t,r]=await n.Execute(e);if(r)throw log60.errorf("template exec error: %s",r),r;return t}},found:!0}:{preparer:null,found:!1}},async executeWithContext(e,t){if(!e)return"<html><body>Default template - no preparer</body></html>";try{return await e.execute(t)}catch(e){return log60.error(`❌ Template execution error: ${e}`),`<html><body>Template execution error: ${e}</body></html>`}}}}function createSiteForSSG(e,t,n){return function(e){const t=new Publisher(e.publishFs()),n=new URL2(e.baseUrl(),!0),r=new Language2(e),s=new Author2("MDFriday","support@mdfriday.com"),a=new Organization2,i=new Compiler("0.1.0"),o=new Site(e,e,e,e,e,e,t,s,a,i,n,null,r,null,e.siteTitle()),l=function(e,t,n){return new NavigationFactory(e,t,n)}(e,e,o);return o.navigation=l.createNavigation(),o.ref=new Ref({home:{page:null},sitePage:async e=>{const t=await o.sitePage(e);return{relPermalink:()=>t.path?t.path():"",permalink:()=>t.path?t.path():""}}},e,"/404.html"),o}({configParams:()=>e.getProvider().getParams("params"),siteTitle:()=>e.getProvider().getString("title")||"My Site",menus:()=>({}),isGoogleAnalyticsEnabled:()=>e.getService().isGoogleAnalyticsEnabled(),googleAnalyticsID:()=>e.getService().googleAnalyticsID(),isGoogleAnalyticsRespectDoNotTrack:()=>e.getService().isGoogleAnalyticsRespectDoNotTrack(),isDisqusEnabled:()=>e.getService().isDisqusEnabled(),disqusShortname:()=>e.getService().disqusShortname(),isXRespectDoNotTrack:()=>e.getService().isXRespectDoNotTrack(),isXDisableInlineCSS:()=>e.getService().isXDisableInlineCSS(),getConfiguredSocialPlatforms:()=>e.getSocial().getConfiguredPlatforms(),getSocialLink:t=>{const n=e.getSocial().getSocialLink(t);return n?n.url:""},getSocialTitle:t=>{const n=e.getSocial().getSocialLink(t);return n?n.title:""},globalPages:async e=>await n.globalPages(e),globalRegularPages:async()=>await n.globalRegularPages(),walkPages:async(e,t)=>{await n.walkPages(e,t)},getPageSources:async e=>n.getPageSources(e),walkTaxonomies:async(e,t)=>{await n.walkTaxonomies(e,t)},searchPage:async(e,t)=>[],getPageFromPath:async(e,t)=>{try{const r=n.getPageFromPath(e,t);return r||log60.error(`⚠️ Application.getPageFromPath: content domain returned null for path: "${t}"`),r}catch(e){return log60.error("❌ Application.getPageFromPath error delegating to content domain:",e),null}},getPageFromPathSync:(e,t)=>{try{const r=n.getPageFromPath(e,t);return r||log60.warn(`⚠️ Application.getPageFromPathSync: content domain returned null for path: ${t}`),r}catch(e){return log60.error("❌ Application.getPageFromPathSync error delegating to content domain:",e),null}},getPageRef:async(e,t,n)=>null,translate:(e,t)=>n.translate(e,t),defaultLanguage:()=>e.getLanguage().defaultLanguage(),languageKeys:()=>e.getLanguage().languageKeys(),getLanguageIndex:t=>e.getLanguage().getLanguageIndex(t),getLanguageName:t=>e.getLanguage().getLanguageName(t),changeFreq:()=>"weekly",priority:()=>.5,generateSitemap:async()=>({urls:[]}),publishFs:()=>t.publishFs(),staticFs:()=>t.staticFs(),copyStaticFiles:(e,n)=>t.copyStatic([e],n),workingDir:()=>e.getProvider().getString("workingDir")||process.cwd(),getResource:async e=>null,getResourceWithOpener:async(e,t)=>({name:()=>e,readSeekCloser:t,targetPath:()=>e}),baseUrl:()=>e.getProvider().getString("baseURL")||"http://localhost"})}async function generateStaticSite(e,t,n){try{let r=performance.now();const s=await loadConfiguration(e,t);let a=performance.now();log60.info(`✅ Configuration loaded in ${(a-r).toFixed(2)} ms`);const i=n;r=performance.now();const o=await async function(e){const t={osFs:()=>e.fs(),projDir:()=>e.getDir().getWorkingDir(),moduleDir:()=>e.getDir().getThemesDir(),moduleCacheDir:()=>e.getDir().getThemesCacheDir(),importPaths:()=>e.getModule().importPaths(),defaultLanguageKey:()=>e.getLanguage().defaultLanguage(),otherLanguageKeys:()=>e.getLanguage().otherLanguageKeys(),getRelDir:(t,n)=>e.getLanguage().getRelDir(t,n)};return await async function(e){try{const t=e.httpClient?.(),n=newHttpClient(e.osFs(),void 0,void 0,t),r=newZipExtractor(e.osFs()),s=newModuleCache(e.osFs(),e.moduleCacheDir()),a=newModules(e,n,r,s);return await a.load(),a}catch(e){const t=e instanceof Error?e.message:String(e);throw log5.error(`Failed to create modules: ${t}`),new ModuleError(`Failed to create modules: ${t}`,"FACTORY_FAILED")}}(t)}(s);a=performance.now(),log60.info(`✅ Modules created in ${(a-r).toFixed(2)} ms`),r=performance.now();const l=await createFileSystem(s,o);a=performance.now(),log60.info(`✅ Filesystem created in ${(a-r).toFixed(2)} ms`);const c=await createContentEngine(l,s,o,i),u=createSiteForSSG(s,l,c),h=createResourcesEngine(s,l),d=await createTemplateEngineFromFs(l,s,u,h);h.setTemplateSvc({executeTemplate:async(e,t,n)=>await d.executeRaw(e,t,n)}),c.setTemplateSvc({execute:async(e,t)=>await d.executeShortcode(e,t)}),r=performance.now(),await c.collectPages(),a=performance.now(),log60.info(`✅ Pages collected in ${(a-r).toFixed(2)} ms`);const p=await createTemplateAdapter(d);r=performance.now(),await u.build(p),a=performance.now(),setDomainInstances(u,c,l,s,o,h),log60.info(`✅ Site built in ${(a-r).toFixed(2)} ms`)}catch(e){const t=e instanceof Error?e.message:String(e);throw log60.error(`❌ Static site generation failed: ${t}`),new Error(`Failed to generate static site: ${t}`)}}async function processSSG(e,t,n){try{const r=process.cwd();process.chdir(e);try{await generateStaticSite(e,t,n)}finally{process.chdir(r)}}catch(e){const t=e instanceof Error?e.message:String(e);throw log60.error(`❌ SSG processing failed: ${t}`),new Error(`Failed to process SSG: ${t}`)}}async function generateStaticSiteWithProgress(e,t,n,r,s){try{r?.({stage:"config",message:"Loading configuration...",percentage:5});const a=await loadConfiguration(e,t),i=n;r?.({stage:"modules",message:"Creating and downloading modules...",percentage:10});const o=await createModuleWithProgress(a,r,s);r?.({stage:"filesystem",message:"Creating filesystem...",percentage:30});const l=await createFileSystem(a,o);r?.({stage:"content",message:"Creating content engine...",percentage:40});const c=await createContentEngine(l,a,o,i);r?.({stage:"site",message:"Creating site...",percentage:50});const u=createSiteForSSG(a,l,c),h=createResourcesEngine(a,l);r?.({stage:"template",message:"Creating template engine...",percentage:60});const d=await createTemplateEngineFromFs(l,a,u,h);h.setTemplateSvc({executeTemplate:async(e,t,n)=>await d.executeRaw(e,t,n)}),c.setTemplateSvc({execute:async(e,t)=>await d.executeShortcode(e,t)}),r?.({stage:"pages",message:"Collecting pages...",percentage:65}),await c.collectPages(),r?.({stage:"build",message:"Building site...",percentage:70});const p=await createTemplateAdapter(d);return await async function(e,t,n){const r=n?e=>{const t=70+Math.floor(e.currentPage/e.totalPages*29);n({stage:"build",message:`Rendering pages (${e.currentPage}/${e.totalPages})...`,percentage:t,pageRender:e})}:void 0;await e.buildWithProgress(t,r)}(u,p,r),r?.({stage:"completion",message:"SSG generation completed",percentage:100}),setDomainInstances(u,c,l,a,o,h),getDomainInstances()}catch(e){const t=e instanceof Error?e.message:String(e);throw log60.error(`❌ Static site generation failed: ${t}`),new Error(`Failed to generate static site: ${t}`)}}async function createModuleWithProgress(e,t,n){const r={osFs:()=>e.fs(),projDir:()=>e.getDir().getWorkingDir(),moduleDir:()=>e.getDir().getThemesDir(),moduleCacheDir:()=>e.getDir().getThemesCacheDir(),importPaths:()=>e.getModule().importPaths(),defaultLanguageKey:()=>e.getLanguage().defaultLanguage(),otherLanguageKeys:()=>e.getLanguage().otherLanguageKeys(),getRelDir:(t,n)=>e.getLanguage().getRelDir(t,n),httpClient:n?()=>n:void 0};return await async function(e,t){const n=t?e=>{t({stage:"modules",message:`Downloading module: ${e.modulePath}`,percentage:10+Math.floor(.2*e.downloadPercentage),moduleDownload:{modulePath:e.modulePath,downloadPercentage:e.downloadPercentage}})}:void 0;return await async function(e,t){try{const n=e.httpClient?.(),r=newHttpClient(e.osFs(),void 0,void 0,n),s=newZipExtractor(e.osFs()),a=newModuleCache(e.osFs(),e.moduleCacheDir()),i=newModules(e,r,s,a);return await i.load(t),i}catch(e){const t=e instanceof Error?e.message:String(e);throw log5.error(`Failed to create modules: ${t}`),new ModuleError(`Failed to create modules: ${t}`,"FACTORY_FAILED")}}(e,n)}(r,t)}async function processSSGWithProgress(e,t,n,r,s){try{const a=process.cwd();process.chdir(e);try{await generateStaticSiteWithProgress(e,t,n,r,s)}finally{process.chdir(a)}}catch(e){const t=e instanceof Error?e.message:String(e);throw log60.error(`❌ SSG processing failed: ${t}`),new Error(`Failed to process SSG: ${t}`)}}var tasks=[];async function collectAllPageTasks(e,t,n,r,s){if(tasks.length>0)return log60.info("Page tasks already collected, returning cached tasks"),tasks;try{let a=performance.now();const i=await loadConfiguration(e,t);let o=performance.now();log60.info(`✅ Configuration loaded in ${(o-a).toFixed(2)} ms`);const l=n;a=performance.now();const c=await createModuleWithProgress(i,r,s);o=performance.now(),log60.info(`✅ Modules created in ${(o-a).toFixed(2)} ms`),a=performance.now();const u=await createFileSystem(i,c);o=performance.now(),log60.info(`✅ Filesystem created in ${(o-a).toFixed(2)} ms`);const h=await createContentEngine(u,i,c,l),d=createSiteForSSG(i,u,h),p=createResourcesEngine(i,u),g=await createTemplateEngineFromFs(u,i,d,p);p.setTemplateSvc({executeTemplate:async(e,t,n)=>await g.executeRaw(e,t,n)}),h.setTemplateSvc({execute:async(e,t)=>await g.executeShortcode(e,t)}),a=performance.now(),await h.collectPages(),o=performance.now(),log60.info(`✅ Pages collected in ${(o-a).toFixed(2)} ms`),a=performance.now();const m=i.getLanguage().languageKeys();for(const e of m){const t=i.getLanguage().getLanguageIndex(e);await h.walkPages(t,async t=>{const n=t.file().paths().base();tasks.push({language:e,pagePath:n}),t&&t.pageIdentity&&t.pageIdentity().clearStale()}),log60.debug(`Collected pages for language: ${e}`)}o=performance.now(),log60.info(`✅ Page tasks collected in ${(o-a).toFixed(2)} ms`);const f=await createTemplateAdapter(g);return a=performance.now(),await d.build(f),o=performance.now(),log60.info(`✅ Site built in ${(o-a).toFixed(2)} ms`),setDomainInstances(d,h,u,i,c,p),tasks}catch(e){const t=e instanceof Error?e.message:String(e);throw log60.error(`❌ Static site generation failed: ${t}`),new Error(`Failed to generate static site: ${t}`)}}init_log();var chokidar=__toESM(require("chokidar")),path28=__toESM(require("path"));init_log();var log61=getDomainLogger("web",{component:"content-file-watcher"}),ContentFileWatcher=class{constructor(e){this.config=e,this.batchDelay=e.batchDelay||500}watcher=null;eventQueue=[];batchTimer=null;batchDelay;callbacks=[];async startWatching(){this.watcher&&await this.stopWatching(),this.watcher=chokidar.watch(this.config.contentDirs,{ignored:[/(^|[\/\\])\../,/\.tmp$/,/\.swp$/,/~$/,/\.DS_Store$/,...this.config.ignorePatterns||[]],persistent:!0,ignoreInitial:!0,followSymlinks:!0,awaitWriteFinish:{stabilityThreshold:100,pollInterval:50}}),this.watcher.on("add",e=>this.queueEvent(e,"created")).on("change",e=>this.queueEvent(e,"modified")).on("unlink",e=>this.queueEvent(e,"deleted")).on("error",e=>{log61.error("File watcher error:",e)})}onFileChange(e){this.callbacks.push(e)}queueEvent(e,t){let n=e;const{projContentDirs:r,contentDirs:s}=this.config;for(let e=0;e<r.length;e++){const t=r[e];for(let e=0;e<s.length;e++){const r=s[e];if(t!==r&&n.startsWith(r)){n=t+n.slice(r.length);break}}}const a=path28.normalize(n);if(!this.isRelevantFile(a))return;const i={filePath:a,eventType:t,timestamp:Date.now(),isMarkdown:this.isMarkdownFile(a),isImage:this.isImageFile(a)};this.eventQueue.push(i),this.scheduleBatch()}isRelevantFile(e){return this.isMarkdownFile(e)||this.isImageFile(e)}isMarkdownFile(e){const t=path28.extname(e).toLowerCase();return".md"===t||".markdown"===t}isImageFile(e){const t=path28.extname(e).toLowerCase();return[".jpg",".jpeg",".png",".gif",".svg",".webp",".bmp"].includes(t)}scheduleBatch(){this.batchTimer&&clearTimeout(this.batchTimer),this.batchTimer=setTimeout(async()=>{if(this.eventQueue.length>0){const e=this.deduplicateEvents(this.eventQueue);this.eventQueue=[];for(const t of this.callbacks)try{await t(e)}catch(e){log61.error("Error processing file change events:",e)}}},this.batchDelay)}deduplicateEvents(e){const t=new Map;for(const n of e){const e=t.get(n.filePath);(!e||n.timestamp>e.timestamp)&&t.set(n.filePath,n)}return Array.from(t.values())}async stopWatching(){this.batchTimer&&(clearTimeout(this.batchTimer),this.batchTimer=null),this.watcher&&(await this.watcher.close(),this.watcher=null),this.eventQueue=[],this.callbacks=[]}},http3=__toESM(require("http")),path29=__toESM(require("path")),fs2=__toESM(require("fs/promises")),import_ws=require("ws");init_log();var log62=getDomainLogger("web",{component:"livereload-server"}),FoundryLiveReloadServer=class{httpServer=null;wsServer=null;clients=new Set;running=!1;config;constructor(e){this.config={port:e.port||8091,host:e.host||"localhost",livereloadPort:e.livereloadPort||35729,enableLiveReload:!1!==e.enableLiveReload,publicDir:e.publicDir}}async start(){if(this.running)log62.warn("LiveReloadServer already running");else try{await this.startHttpServer(),this.config.enableLiveReload&&await this.startLiveReloadServer(),this.running=!0}catch(e){throw log62.error("Failed to start LiveReloadServer:",e),e}}async stop(){if(this.running)try{for(const e of this.clients)e.close();this.clients.clear(),this.wsServer&&(this.wsServer.close(),this.wsServer=null),this.httpServer&&(await new Promise(e=>{this.httpServer.close(()=>e())}),this.httpServer=null),this.running=!1}catch(e){log62.error("Error stopping LiveReloadServer:",e)}}notifyReload(e){if(!this.config.enableLiveReload||0===this.clients.size)return;const t={command:"reload",liveCSS:this.shouldLiveReloadCSS(e),liveImg:this.shouldLiveReloadImages(e)};if(e&&1===e.length){const n=e[0],r=path29.extname(n).toLowerCase();".css"===r?(t.path=n,t.liveCSS=!0):[".jpg",".jpeg",".png",".gif",".svg",".webp"].includes(r)&&(t.path=n,t.liveImg=!0)}const n=JSON.stringify(t);for(const e of this.clients)e.readyState===import_ws.WebSocket.OPEN&&e.send(n)}getUrl(){return`http://${this.config.host}:${this.config.port}`}isServerRunning(){return this.running}async startHttpServer(){this.httpServer=http3.createServer(async(e,t)=>{try{await this.handleHttpRequest(e,t)}catch(e){log62.error("HTTP request error:",e),t.statusCode=500,t.end("Internal Server Error")}}),await new Promise((e,t)=>{this.httpServer.listen(this.config.port,this.config.host,()=>{e()}),this.httpServer.on("error",e=>{"EADDRINUSE"===e.code?(this.config.port++,this.config.port<8099?this.httpServer.listen(this.config.port,this.config.host):t(new Error("No available ports"))):t(e)})})}async startLiveReloadServer(){this.wsServer=new import_ws.WebSocketServer({port:this.config.livereloadPort,host:this.config.host}),this.wsServer.on("connection",e=>{this.clients.add(e),e.send(JSON.stringify({command:"hello",protocols:["http://livereload.com/protocols/official-7"],serverName:"foundry-livereload"})),e.on("close",()=>{this.clients.delete(e)}),e.on("message",e=>{try{JSON.parse(e.toString())}catch(t){log62.error("Invalid LiveReload message:",e.toString())}})}),this.wsServer.on("error",e=>{log62.error("LiveReload WebSocket server error:",e)})}async handleHttpRequest(e,t){const n=e.url||"/";let r=this.resolveFilePath(n);try{if((await fs2.stat(r)).isDirectory()){const e=path29.join(r,"index.html");try{await fs2.stat(e),r=e}catch{return t.statusCode=404,void t.end("Not Found")}}let e=await fs2.readFile(r);const n=this.getContentType(r);if(t.setHeader("Content-Type",n),n.includes("text/html")&&this.config.enableLiveReload){const t=e.toString(),n=this.getLiveReloadScript(),r=t.replace(/<\/body>/i,`${n}\n</body>`);e=Buffer.from(r,"utf8")}t.setHeader("Cache-Control","no-cache, no-store, must-revalidate"),t.setHeader("Pragma","no-cache"),t.setHeader("Expires","0"),t.statusCode=200,t.end(e)}catch(e){if("ENOENT"!==e.code)throw e;t.statusCode=404,t.end("Not Found")}}resolveFilePath(e){const t=e.split("?")[0].split("#")[0];let n;try{n=decodeURIComponent(t)}catch(e){log62.warn("Failed to decode URL:",t,e),n=t}const r=path29.normalize(n).replace(/^(\.\.[\/\\])+/,""),s=r.startsWith("/")?r.slice(1):r,a=path29.join(this.config.publicDir,s);return"win32"===process.platform&&a.length>260&&log62.warn("Path too long for Windows filesystem:",a),"win32"===process.platform&&/[<>:"|?*\x00-\x1f]/.test(s)&&log62.warn("Path contains invalid characters for Windows:",s),a}getContentType(e){return{".html":"text/html; charset=utf-8",".css":"text/css; charset=utf-8",".js":"application/javascript; charset=utf-8",".json":"application/json; charset=utf-8",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".svg":"image/svg+xml",".webp":"image/webp",".ico":"image/x-icon",".woff":"font/woff",".woff2":"font/woff2",".ttf":"font/ttf",".eot":"application/vnd.ms-fontobject",".xml":"application/xml; charset=utf-8",".txt":"text/plain; charset=utf-8"}[path29.extname(e).toLowerCase()]||"application/octet-stream"}getLiveReloadScript(){return`\n<script>\n(function() {\n 'use strict';\n \n var protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:';\n var address = protocol + '//${this.config.host}:${this.config.livereloadPort}/livereload';\n var socket = new WebSocket(address);\n \n socket.onmessage = function(event) {\n var data = JSON.parse(event.data);\n \n if (data.command === 'reload') {\n if (data.liveCSS) {\n // 热更新 CSS\n reloadCSS();\n } else if (data.liveImg) {\n // 热更新图片\n reloadImages();\n } else {\n // 完整页面刷新\n window.location.reload();\n }\n }\n };\n \n socket.onopen = function() {\n console.log('LiveReload connected');\n };\n \n socket.onclose = function() {\n console.log('LiveReload disconnected');\n // 尝试重连\n setTimeout(function() {\n window.location.reload();\n }, 1000);\n };\n \n function reloadCSS() {\n var links = document.querySelectorAll('link[rel="stylesheet"]');\n for (var i = 0; i < links.length; i++) {\n var link = links[i];\n var href = link.href;\n if (href) {\n var url = new URL(href);\n url.searchParams.set('_t', Date.now().toString());\n link.href = url.toString();\n }\n }\n console.log('CSS reloaded');\n }\n \n function reloadImages() {\n var images = document.querySelectorAll('img');\n for (var i = 0; i < images.length; i++) {\n var img = images[i];\n var src = img.src;\n if (src) {\n var url = new URL(src);\n url.searchParams.set('_t', Date.now().toString());\n img.src = url.toString();\n }\n }\n console.log('Images reloaded');\n }\n})();\n<\/script>`}shouldLiveReloadCSS(e){return!!e&&e.some(e=>".css"===path29.extname(e).toLowerCase())}shouldLiveReloadImages(e){if(!e)return!1;const t=[".jpg",".jpeg",".png",".gif",".svg",".webp"];return e.some(e=>t.includes(path29.extname(e).toLowerCase()))}},http4=__toESM(require("http")),path30=__toESM(require("path")),fs3=__toESM(require("fs/promises"));init_log();var log63=getDomainLogger("web",{component:"electron-livereload-server"}),ElectronLiveReloadServer=class{httpServer=null;running=!1;config;stateFilePath;constructor(e){this.config={port:e.port||8091,host:e.host||"localhost",livereloadPort:e.livereloadPort||35729,enableLiveReload:!1!==e.enableLiveReload,publicDir:e.publicDir},this.stateFilePath=path30.join(this.config.publicDir,".foundry-livereload-state.json")}async start(){if(this.running)log63.warn("ElectronLiveReloadServer already running");else try{await this.startHttpServer(),this.config.enableLiveReload&&await this.initStateFile(),this.running=!0,log63.info(`ElectronLiveReloadServer started at ${this.getUrl()}`)}catch(e){throw log63.error("Failed to start ElectronLiveReloadServer:",e),e}}async stop(){if(this.running)try{this.httpServer&&(await new Promise(e=>{this.httpServer.close(()=>e())}),this.httpServer=null);try{await fs3.unlink(this.stateFilePath)}catch(e){}this.running=!1,log63.info("ElectronLiveReloadServer stopped")}catch(e){log63.error("Error stopping ElectronLiveReloadServer:",e)}}notifyReload(e){if(!this.config.enableLiveReload)return;const t={timestamp:Date.now(),command:"reload",liveCSS:this.shouldLiveReloadCSS(e),liveImg:this.shouldLiveReloadImages(e),...e&&{changedFiles:e}};if(e&&1===e.length){const n=e[0],r=path30.extname(n).toLowerCase();(".css"===r||[".jpg",".jpeg",".png",".gif",".svg",".webp"].includes(r))&&(t.path=n)}this.writeStateFile(t).catch(e=>{log63.error("Failed to write state file:",e)})}getUrl(){return`http://${this.config.host}:${this.config.port}`}isServerRunning(){return this.running}async initStateFile(){const e={timestamp:Date.now(),command:"hello"};await this.writeStateFile(e)}async writeStateFile(e){try{await fs3.writeFile(this.stateFilePath,JSON.stringify(e),"utf8")}catch(e){log63.error("Failed to write LiveReload state file:",e)}}async startHttpServer(){this.httpServer=http4.createServer(async(e,t)=>{try{await this.handleHttpRequest(e,t)}catch(e){log63.error("HTTP request error:",e),t.statusCode=500,t.end("Internal Server Error")}}),await new Promise((e,t)=>{this.httpServer.listen(this.config.port,this.config.host,()=>{e()}),this.httpServer.on("error",e=>{"EADDRINUSE"===e.code?(this.config.port++,this.config.port<8099?this.httpServer.listen(this.config.port,this.config.host):t(new Error("No available ports"))):t(e)})})}async handleHttpRequest(e,t){const n=e.url||"/";if(n.startsWith("/.foundry-livereload-state.json"))try{const e=await fs3.readFile(this.stateFilePath,"utf8");return t.setHeader("Content-Type","application/json; charset=utf-8"),t.setHeader("Cache-Control","no-cache, no-store, must-revalidate"),t.setHeader("Pragma","no-cache"),t.setHeader("Expires","0"),t.statusCode=200,void t.end(e)}catch(e){return void("ENOENT"===e.code?(t.statusCode=404,t.end("State file not found")):(t.statusCode=500,t.end("Internal Server Error")))}let r=this.resolveFilePath(n);try{if((await fs3.stat(r)).isDirectory()){const e=path30.join(r,"index.html");try{await fs3.stat(e),r=e}catch{return t.statusCode=404,void t.end("Not Found")}}let e=await fs3.readFile(r);const n=this.getContentType(r);if(t.setHeader("Content-Type",n),n.includes("text/html")&&this.config.enableLiveReload){const t=e.toString(),n=this.getLiveReloadScript(),r=t.replace(/<\/body>/i,`${n}\n</body>`);e=Buffer.from(r,"utf8")}t.setHeader("Cache-Control","no-cache, no-store, must-revalidate"),t.setHeader("Pragma","no-cache"),t.setHeader("Expires","0"),t.statusCode=200,t.end(e)}catch(e){if("ENOENT"!==e.code)throw e;t.statusCode=404,t.end("Not Found")}}resolveFilePath(e){const t=e.split("?")[0].split("#")[0];let n;try{n=decodeURIComponent(t)}catch(e){log63.warn("Failed to decode URL:",t,e),n=t}const r=path30.normalize(n).replace(/^(\.\.[\/\\])+/,""),s=r.startsWith("/")?r.slice(1):r;return path30.join(this.config.publicDir,s)}getContentType(e){return{".html":"text/html; charset=utf-8",".css":"text/css; charset=utf-8",".js":"application/javascript; charset=utf-8",".json":"application/json; charset=utf-8",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".svg":"image/svg+xml",".webp":"image/webp",".ico":"image/x-icon",".woff":"font/woff",".woff2":"font/woff2",".ttf":"font/ttf",".eot":"application/vnd.ms-fontobject",".xml":"application/xml; charset=utf-8",".txt":"text/plain; charset=utf-8"}[path30.extname(e).toLowerCase()]||"application/octet-stream"}getLiveReloadScript(){return"\n<script>\n(function() {\n 'use strict';\n \n var stateFilePath = '/.foundry-livereload-state.json';\n var storageKey = 'foundry-livereload-last-timestamp';\n var lastTimestamp = 0;\n var pollInterval = 500; // 500ms 轮询间隔\n \n // 从 localStorage 恢复上次的时间戳,避免页面刷新后重复触发\n try {\n var stored = localStorage.getItem(storageKey);\n if (stored) {\n lastTimestamp = parseInt(stored, 10) || 0;\n }\n } catch (error) {\n // localStorage 可能不可用,使用默认值\n console.warn('LiveReload: localStorage not available, may cause duplicate reloads');\n }\n \n function checkForReload() {\n fetch(stateFilePath + '?_t=' + Date.now(), { cache: 'no-cache' })\n .then(function(response) {\n if (!response.ok) {\n throw new Error('Failed to fetch state file');\n }\n return response.json();\n })\n .then(function(state) {\n if (state.timestamp > lastTimestamp) {\n // 更新时间戳并保存到 localStorage\n lastTimestamp = state.timestamp;\n try {\n localStorage.setItem(storageKey, lastTimestamp.toString());\n } catch (error) {\n // localStorage 写入失败,忽略\n }\n \n if (state.command === 'reload') {\n if (state.liveCSS) {\n // 热更新 CSS\n reloadCSS();\n } else if (state.liveImg) {\n // 热更新图片\n reloadImages();\n } else {\n // 完整页面刷新\n window.location.reload();\n }\n }\n }\n })\n .catch(function(error) {\n // 静默处理错误,避免控制台噪音\n });\n }\n \n function reloadCSS() {\n var links = document.querySelectorAll('link[rel=\"stylesheet\"]');\n for (var i = 0; i < links.length; i++) {\n var link = links[i];\n var href = link.href;\n if (href) {\n var url = new URL(href);\n url.searchParams.set('_t', Date.now().toString());\n link.href = url.toString();\n }\n }\n console.log('CSS reloaded');\n }\n \n function reloadImages() {\n var images = document.querySelectorAll('img');\n for (var i = 0; i < images.length; i++) {\n var img = images[i];\n var src = img.src;\n if (src) {\n var url = new URL(src);\n url.searchParams.set('_t', Date.now().toString());\n img.src = url.toString();\n }\n }\n console.log('Images reloaded');\n }\n \n // 开始轮询\n setInterval(checkForReload, pollInterval);\n \n // 初始检查\n checkForReload();\n})();\n<\/script>"}shouldLiveReloadCSS(e){return!!e&&e.some(e=>".css"===path30.extname(e).toLowerCase())}shouldLiveReloadImages(e){if(!e)return!1;const t=[".jpg",".jpeg",".png",".gif",".svg",".webp"];return e.some(e=>t.includes(path30.extname(e).toLowerCase()))}};var log64=getDomainLogger("build",{component:"incremental-coordinator"}),IncrementalBuildCoordinator=class{constructor(e){if(this.config=e,e.enableWatching){const t={contentDirs:e.contentDirs,projContentDirs:e.projContentDirs||e.contentDirs,batchDelay:e.batchDelay||500};this.fileWatcher=new ContentFileWatcher(t),this.fileWatcher.onFileChange(e=>this.handleFileChanges(e))}if(!1!==e.liveReload?.enabled){const t={port:e.liveReload?.port||8091,host:e.liveReload?.host||"localhost",livereloadPort:e.liveReload?.livereloadPort||35729,publicDir:e.publicDir,enableLiveReload:!0};this.liveReloadServer=function(e){return function(){if("undefined"!=typeof globalThis&&globalThis.window&&globalThis.window.process&&globalThis.window.process.type)return!0;try{return require("electron"),!0}catch{}return!!(process.env.ELECTRON_RUN_AS_NODE||process.env.ELECTRON_NO_ATTACH_CONSOLE||process.versions&&process.versions.electron)}()?new ElectronLiveReloadServer(e):new FoundryLiveReloadServer(e)}(t)}}fileWatcher;liveReloadServer;buildInProgress=!1;initialized=!1;domainInstances;async initialize(){this.initialized?log64.warn("IncrementalBuildCoordinator already initialized"):(await this.performFullBuildAndCacheDomains(),this.initialized=!0)}async performFullBuildAndCacheDomains(){try{this.domainInstances=await async function(e,t,n,r,s){try{process.chdir(e);const a=await collectAllPageTasks(e,t,n,r,s);if(a.length>80){log60.info(`📊 Found ${a.length} pages, attempting parallel processing...`);try{return await processSSGParallel(e,t,0,r),getDomainInstances()}catch(i){if((i instanceof Error?i.message:String(i)).includes("PARALLEL_NOT_SUPPORTED"))return log60.warn("⚠️ Parallel processing not available, falling back to serial processing"),log60.info(`🔄 Processing ${a.length} pages in serial mode...`),await generateStaticSiteWithProgress(e,t,n,r,s);throw i}}return log60.info(`📊 Found ${a.length} pages, using serial processing...`),await generateStaticSiteWithProgress(e,t,n,r,s)}catch(e){const t=e instanceof Error?e.message:String(e);throw log60.error(`❌ SSG processing failed: ${t}`),new Error(`Failed to process SSG: ${t}`)}}(this.config.projDir,this.config.modulesDir,this.config.markdown,this.config.progressCallback,this.config.httpClient)}catch(e){throw log64.error("Failed to perform full build and cache domains:",e),e}}async startWatching(){if(!this.initialized)throw new Error("Must call initialize() before startWatching()");this.config.enableWatching&&this.fileWatcher&&await this.fileWatcher.startWatching(),this.liveReloadServer&&await this.liveReloadServer.start()}async stopWatching(){this.fileWatcher&&await this.fileWatcher.stopWatching(),this.liveReloadServer&&await this.liveReloadServer.stop()}async handleFileChanges(e){if(this.buildInProgress)setTimeout(()=>this.handleFileChanges(e),1e3);else try{if(this.buildInProgress=!0,this.needFullRebuild(e))return void await this.performFullRebuild(e);await this.performIncrementalBuild(e)}finally{this.buildInProgress=!1}}needFullRebuild(e){return e.some(e=>"deleted"===e.eventType||"created"===e.eventType)}async performIncrementalBuild(e){if(!this.domainInstances)return log64.error("Domain instances not available, falling back to full rebuild"),void await this.performFullRebuild(e);try{const t=await this.domainInstances.fs.getFileMetaInfos(this.getEventsFilePaths(e));if(await this.domainInstances.content.handleChangeFiles(t),await this.domainInstances.site.renderAllLanguages(),this.liveReloadServer){const t=e.map(e=>e.filePath);this.liveReloadServer.notifyReload(t)}}catch(t){log64.error("Incremental build failed, falling back to full rebuild:",t),await this.performFullRebuild(e)}}getEventsFilePaths(e){return e.map(e=>e.filePath)}async performFullRebuild(e){if(await processSSGWithProgress(this.config.projDir,this.config.modulesDir,this.config.markdown,e=>{log64.info(`Rebuild progress: ${e.stage} - ${e.percentage}%`)},this.config.httpClient),this.liveReloadServer){const t=e.map(e=>e.filePath);this.liveReloadServer.notifyReload(t)}}isInitialized(){return this.initialized}isBuildInProgress(){return this.buildInProgress}getConfig(){return{...this.config}}getServerUrl(){return this.liveReloadServer?this.liveReloadServer.getUrl():""}getLiveReloadStatus(){if(!this.liveReloadServer)return{running:!1};const e=this.liveReloadServer.isServerRunning();return{running:e,...e&&{url:this.liveReloadServer.getUrl()}}}};async function startIncrementalBuild(e){const t=new IncrementalBuildCoordinator(e);return await t.initialize(),e.enableWatching&&await t.startWatching(),t}init_log(),getDomainLogger("build",{component:"incremental-ssg"});
2
+ var LTR_LANGUAGES,RTL_LANGUAGES,ALL_LANGUAGES,LANGUAGE_MAP,CODE_NAME_MAP,DefaultLanguageService,serviceInstance,__create=Object.create,__defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty,__esm=(e,t)=>function(){return e&&(t=(0,e[__getOwnPropNames(e)[0]])(e=0)),t},__export=(e,t)=>{for(var n in t)__defProp(e,n,{get:t[n],enumerable:!0})},__copyProps=(e,t,n,r)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let s of __getOwnPropNames(t))__hasOwnProp.call(e,s)||s===n||__defProp(e,s,{get:()=>t[s],enumerable:!(r=__getOwnPropDesc(t,s))||r.enumerable});return e},__toESM=(e,t,n)=>(n=null!=e?__create(__getProtoOf(e)):{},__copyProps(!t&&e&&e.__esModule?n:__defProp(n,"default",{value:e,enumerable:!0}),e)),__toCommonJS=e=>__copyProps(__defProp({},"__esModule",{value:!0}),e),init_data=__esm({"pkg/lang/data.ts"(){LTR_LANGUAGES=[{code:"en",name:"English",direction:"ltr",englishName:"English"},{code:"zh",name:"中文",direction:"ltr",englishName:"Chinese"},{code:"ja",name:"日本語",direction:"ltr",englishName:"Japanese"},{code:"ko",name:"한국어",direction:"ltr",englishName:"Korean"},{code:"fr",name:"Français",direction:"ltr",englishName:"French"},{code:"de",name:"Deutsch",direction:"ltr",englishName:"German"},{code:"es",name:"Español",direction:"ltr",englishName:"Spanish"},{code:"pt",name:"Português",direction:"ltr",englishName:"Portuguese"},{code:"ru",name:"Русский",direction:"ltr",englishName:"Russian"},{code:"hi",name:"हिंदी",direction:"ltr",englishName:"Hindi"},{code:"it",name:"Italiano",direction:"ltr",englishName:"Italian"},{code:"nl",name:"Nederlands",direction:"ltr",englishName:"Dutch"},{code:"tr",name:"Türkçe",direction:"ltr",englishName:"Turkish"},{code:"vi",name:"Tiếng Việt",direction:"ltr",englishName:"Vietnamese"},{code:"th",name:"ไทย",direction:"ltr",englishName:"Thai"}],RTL_LANGUAGES=[],ALL_LANGUAGES=[...LTR_LANGUAGES,...RTL_LANGUAGES],LANGUAGE_MAP=ALL_LANGUAGES.reduce((e,t)=>(e[t.code]=t,e),{}),CODE_NAME_MAP=ALL_LANGUAGES.reduce((e,t)=>(e[t.code]=t.name,e),{})}});function getLanguageService(){return serviceInstance||(serviceInstance=new DefaultLanguageService),serviceInstance}function createLanguageService(){return new DefaultLanguageService}var lang,languages,init_service=__esm({"pkg/lang/service.ts"(){init_data(),DefaultLanguageService=class{getAllCodes(){return ALL_LANGUAGES.map(e=>e.code)}getAllNames(){return ALL_LANGUAGES.map(e=>e.name)}getCodesByDirection(e){return("ltr"===e?LTR_LANGUAGES:RTL_LANGUAGES).map(e=>e.code)}getNamesByDirection(e){return("ltr"===e?LTR_LANGUAGES:RTL_LANGUAGES).map(e=>e.name)}getCodeNameMap(){return{...CODE_NAME_MAP}}getCodeNameMapByDirection(e){return("ltr"===e?LTR_LANGUAGES:RTL_LANGUAGES).reduce((e,t)=>(e[t.code]=t.name,e),{})}getNameByCode(e){return LANGUAGE_MAP[e]?.name}getLanguageInfo(e){const t=LANGUAGE_MAP[e];return t?{...t}:void 0}isSupported(e){return e in LANGUAGE_MAP}getDirection(e){return LANGUAGE_MAP[e]?.direction}isLTR(e){return"ltr"===LANGUAGE_MAP[e]?.direction}isRTL(e){return"rtl"===LANGUAGE_MAP[e]?.direction}},serviceInstance=null}}),lang_exports={};__export(lang_exports,{ALL_LANGUAGES:()=>ALL_LANGUAGES,CODE_NAME_MAP:()=>CODE_NAME_MAP,DefaultLanguageService:()=>DefaultLanguageService,LANGUAGE_MAP:()=>LANGUAGE_MAP,LTR_LANGUAGES:()=>LTR_LANGUAGES,RTL_LANGUAGES:()=>RTL_LANGUAGES,createLanguageService:()=>createLanguageService,getLanguageService:()=>getLanguageService,lang:()=>lang,languages:()=>languages});var util,Logger,globalLoggerManager,init_lang=__esm({"pkg/lang/index.ts"(){init_data(),init_service(),init_service(),lang=getLanguageService(),languages={getAllCodes:()=>lang.getAllCodes(),getAllNames:()=>lang.getAllNames(),getCodesByDirection:e=>lang.getCodesByDirection(e),getNamesByDirection:e=>lang.getNamesByDirection(e),getCodeNameMap:()=>lang.getCodeNameMap(),getCodeNameMapByDirection:e=>lang.getCodeNameMapByDirection(e),getNameByCode:e=>lang.getNameByCode(e),getLanguageInfo:e=>lang.getLanguageInfo(e),isSupported:e=>lang.isSupported(e),getDirection:e=>lang.getDirection(e),isLTR:e=>lang.isLTR(e),isRTL:e=>lang.isRTL(e)}}}),init_types=__esm({"pkg/log/types.ts"(){}}),init_logger=__esm({"pkg/log/logger.ts"(){util=__toESM(require("util")),init_types(),Logger=class e{config;fields;constructor(e){this.config={enableCaller:!0,jsonFormat:!0,...e},this.fields={}}shouldLog(e){const t=["debug","info","warn","error","fatal"],n=t.indexOf(this.config.level);return t.indexOf(e)>=n}getCaller(){if(!this.config.enableCaller)return;const e=(new Error).stack;if(!e)return;const t=e.split("\n")[4];if(!t)return;const n=t.match(/at .* \((.+):(\d+):(\d+)\)/);if(n){const[,e,t]=n;return`${e.split("/").pop()}:${t}`}const r=t.match(/at (.+):(\d+):(\d+)/);if(r){const[,e,t]=r;return`${e.split("/").pop()}:${t}`}}formatMessage(e,t){return 0===t.length?e:util.format(e,...t)}writeLog(e,t){if(!this.shouldLog(e))return;const n={level:e,timestamp:(new Date).toISOString(),message:t,...this.fields},r=this.getCaller();r&&(n.caller=r);const s=this.config.jsonFormat?JSON.stringify(n):this.formatPlainText(n);console.log(s),"error"===e||"fatal"===e?process.stderr.write(s+"\n"):process.stdout.write(s+"\n"),"fatal"===e&&process.exit(1)}formatPlainText(e){const t=[e.timestamp,e.level.toUpperCase()];e.caller&&t.push(`[${e.caller}]`),t.push(e.message);const n=Object.keys(e).filter(e=>!["level","timestamp","message","caller"].includes(e)).map(t=>`${t}=${JSON.stringify(e[t])}`).join(" ");return n&&t.push(n),t.join(" ")}debug(e,...t){this.writeLog("debug",this.formatMessage(e,t))}info(e,...t){this.writeLog("info",this.formatMessage(e,t))}warn(e,...t){this.writeLog("warn",this.formatMessage(e,t))}error(e,...t){this.writeLog("error",this.formatMessage(e,t))}fatal(e,...t){this.writeLog("fatal",this.formatMessage(e,t))}debugf(e,...t){this.writeLog("debug",this.formatMessage(e,t))}infof(e,...t){this.writeLog("info",this.formatMessage(e,t))}warnf(e,...t){this.writeLog("warn",this.formatMessage(e,t))}errorf(e,...t){this.writeLog("error",this.formatMessage(e,t))}fatalf(e,...t){this.writeLog("fatal",this.formatMessage(e,t))}with(t){const n=new e(this.config);return n.fields={...this.fields,...t},n}}}}),init_http=__esm({"pkg/log/http.ts"(){}});function getDomainLogger(e,t){return globalLoggerManager.getLogger(e,t)}var log39,WeightedPage,WeightedPages,Taxonomy3,OrderedTaxonomyEntry,OrderedTaxonomy,TaxonomyList,TaxonomiesBuilder,init_manager=__esm({"pkg/log/manager.ts"(){init_logger(),init_types(),globalLoggerManager=class e{static instance;globalConfig;loggers;constructor(){this.globalConfig={level:"debug",enableCaller:!0,jsonFormat:!0},this.loggers=new Map}static getInstance(){return e.instance||(e.instance=new e),e.instance}setGlobalConfig(e){this.globalConfig={...this.globalConfig,...e},this.loggers.clear()}getGlobalConfig(){return{...this.globalConfig}}getLogger(e,t){const n=e+(t?JSON.stringify(t):"");if(!this.loggers.has(n)){const s=(r=this.globalConfig,new Logger(r)),a={domain:e,...t},i=s.with(a);this.loggers.set(n,i)}var r;return this.loggers.get(n)}getComponentLogger(e,t,n){const r={component:t,...n};return this.getLogger(e,r)}clearCache(){this.loggers.clear()}getCachedDomains(){return Array.from(this.loggers.keys())}setLogLevel(e){this.setGlobalConfig({level:e})}setCallerEnabled(e){this.setGlobalConfig({enableCaller:e})}setJsonFormat(e){this.setGlobalConfig({jsonFormat:e})}}.getInstance()}}),init_log=__esm({"pkg/log/index.ts"(){init_types(),init_logger(),init_http(),init_manager(),init_logger(),init_types(),function(e="info"){new Logger({level:e})}("info")}}),taxonomies_builder_exports={};__export(taxonomies_builder_exports,{OrderedTaxonomy:()=>OrderedTaxonomy,OrderedTaxonomyEntry:()=>OrderedTaxonomyEntry,TaxonomiesBuilder:()=>TaxonomiesBuilder,Taxonomy:()=>Taxonomy3,TaxonomyList:()=>TaxonomyList,WeightedPage:()=>WeightedPage,WeightedPages:()=>WeightedPages});var cb,mod,init_taxonomies_builder=__esm({"internal/domain/site/entity/taxonomies-builder.ts"(){init_log(),log39=getDomainLogger("site",{component:"taxonomies-builder"}),WeightedPage=class{page;ordinalWeightPage;constructor(e,t){this.page=e,this.ordinalWeightPage=t}get Page(){return this.page}weight(){return this.ordinalWeightPage.weight()}ordinal(){return this.ordinalWeightPage.ordinal()}owner(){return this.ordinalWeightPage.owner()}get Permalink(){return this.page.Permalink}get RelPermalink(){return this.page.RelPermalink}get Title(){return this.page.Title}},WeightedPages=class extends Array{page(){return 0===this.length?(log39.error("Page called on empty WeightedPages"),null):this[0]}get Page(){return this.page()}pages(){return Array.from(this)}sortByWeight(){this.stableSort((e,t)=>e.weight()-t.weight())}count(){return this.length}get Count(){return this.count()}stableSort(e){const t=this.map((e,t)=>({item:e,index:t}));t.sort((t,n)=>{const r=e(t.item,n.item);return 0!==r?r:t.index-n.index}),this.splice(0,this.length,...t.map(e=>e.item))}},Taxonomy3=class{terms=new Map;get(e){return this.terms.get(e)}set(e,t){this.terms.set(e,t)}has(e){return this.terms.has(e)}keys(){return Array.from(this.terms.keys())}values(){return Array.from(this.terms.values())}get Values(){return this.terms}entries(){return Array.from(this.terms.entries())}size(){return this.terms.size}byCount(){const e=this.taxonomyArray();return e.sort((e,t)=>{const n=e.weightedPages.length,r=t.weightedPages.length;return n===r?e.name.localeCompare(t.name):r-n}),new OrderedTaxonomy(e)}taxonomyArray(){const e=[];for(const[t,n]of this.terms.entries())e.push(new OrderedTaxonomyEntry(t,n));return e}},OrderedTaxonomyEntry=class{name;weightedPages;constructor(e,t){this.name=e,this.weightedPages=t}count(){return this.weightedPages.count()}term(){return this.name}},OrderedTaxonomy=class extends Array{constructor(e){super(),e&&this.push(...e)}getOneOPage(){return 0===this.length?null:this[0].weightedPages.page()}},TaxonomyList=class{taxonomies=new Map;get(e){return this.taxonomies.get(e)}set(e,t){this.taxonomies.set(e,t)}has(e){return this.taxonomies.has(e)}keys(){return Array.from(this.taxonomies.keys())}values(){return Array.from(this.taxonomies.values())}get Values(){return this.taxonomies}entries(){return Array.from(this.taxonomies.entries())}size(){return this.taxonomies.size}},TaxonomiesBuilder=class{contentService;constructor(e){this.contentService=e}async buildTaxonomiesForLanguage(e,t){const n=new TaxonomyList;try{return await this.contentService.walkTaxonomies(e,async(e,r,s)=>{n.has(e)||n.set(e,new Taxonomy3);const a=n.get(e);a.has(r)||a.set(r,new WeightedPages);const i=await t.siteWeightedPage(s);a.get(r).push(i)}),n}catch(e){throw log39.error(`Failed to create taxonomies: ${e}`),e}}}}}),require_extend=(cb={"node_modules/extend/index.js"(e,t){var n=Object.prototype.hasOwnProperty,r=Object.prototype.toString,s=Object.defineProperty,a=Object.getOwnPropertyDescriptor,i=function(e){return"function"==typeof Array.isArray?Array.isArray(e):"[object Array]"===r.call(e)},o=function(e){if(!e||"[object Object]"!==r.call(e))return!1;var t,s=n.call(e,"constructor"),a=e.constructor&&e.constructor.prototype&&n.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!s&&!a)return!1;for(t in e);return void 0===t||n.call(e,t)},l=function(e,t){s&&"__proto__"===t.name?s(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},c=function(e,t){if("__proto__"===t){if(!n.call(e,t))return;if(a)return a(e,t).value}return e[t]};t.exports=function e(){var t,n,r,s,a,u,h=arguments[0],d=1,p=arguments.length,g=!1;for("boolean"==typeof h&&(g=h,h=arguments[1]||{},d=2),(null==h||"object"!=typeof h&&"function"!=typeof h)&&(h={});d<p;++d)if(null!=(t=arguments[d]))for(n in t)r=c(h,n),h!==(s=c(t,n))&&(g&&s&&(o(s)||(a=i(s)))?(a?(a=!1,u=r&&i(r)?r:[]):u=r&&o(r)?r:{},l(h,{name:n,newValue:e(g,u,s)})):void 0!==s&&l(h,{name:n,newValue:s}));return h}}},function(){return mod||(0,cb[__getOwnPropNames(cb)[0]])((mod={exports:{}}).exports,mod),mod.exports}),foundry_exports={};__export(foundry_exports,{AutoIDGenerator:()=>AutoIDGenerator,IncrementalBuildCoordinator:()=>IncrementalBuildCoordinator,generateStaticSite:()=>generateStaticSite,processSSG:()=>processSSG,processSSGParallel:()=>processSSGParallel,processSSGWithProgress:()=>processSSGWithProgress,startIncrementalBuild:()=>startIncrementalBuild}),module.exports=__toCommonJS(foundry_exports);var ConfigError=class extends Error{constructor(e,t){super(e),this.code=t,this.name="ConfigError"}},Config=(new ConfigError("configuration not found","CONFIG_NOT_FOUND"),new ConfigError("invalid configuration","INVALID_CONFIG"),new ConfigError("workspace not found","WORKSPACE_NOT_FOUND"),new ConfigError("configuration file not found","CONFIG_FILE_NOT_FOUND"),new ConfigError("invalid configuration format","INVALID_CONFIG_FORMAT"),class{configSourceFs;provider;root;dir;module;service;social;language;taxonomy;markdown;constructor(e,t,n,r,s,a,i,o,l,c){this.configSourceFs=e,this.provider=t,this.root=n,this.dir=r,this.module=s,this.service=a,this.social=i,this.language=o,this.taxonomy=l,this.markdown=c}fs(){return this.configSourceFs}getProvider(){return this.provider}theme(){return this.root.defaultTheme()}getDir(){return this.dir}getRoot(){return this.root}getModule(){return this.module}getService(){return this.service}getSocial(){return this.social}getLanguage(){return this.language}getTaxonomy(){return this.taxonomy}getMarkdown(){return this.markdown}setLanguage(e){this.language=e}setTaxonomy(e){this.taxonomy=e}setMarkdown(e){this.markdown=e}validate(){let e=!0;return this.language&&(e=e&&this.language.validate()),this.markdown&&(e=e&&this.markdown.validate()),e}}),DefaultRootConfig={baseURL:"",title:"",theme:[],timeout:"30s",contentDir:"content",dataDir:"data",layoutDir:"layouts",staticDir:"static",archetypeDir:"archetypes",assetDir:"assets",publishDir:"public",buildDrafts:!1,buildExpired:!1,buildFuture:!1,copyright:"",defaultContentLanguage:"en",defaultContentLanguageInSubdir:!1,disableAliases:!1,disablePathToLower:!1,disableKinds:[],disableLanguages:[],renderSegments:[],disableHugoGeneratorInject:!1,disableLiveReload:!1,enableEmoji:!1},Root=class{rootConfig;rootParams;constructor(e,t={}){this.rootConfig=e,this.rootParams=t}defaultTheme(){return this.rootConfig.theme.length>0?this.rootConfig.theme[0]:""}compiledTimeout(){const e=this.rootConfig.timeout;if(/^\d+$/.test(e))return 1e3*parseInt(e,10);const t=e.match(/^(\d+)([smh])$/);if(t){const e=parseInt(t[1],10);switch(t[2]){case"s":return 1e3*e;case"m":return 60*e*1e3;case"h":return 60*e*60*1e3}}return 3e4}baseUrl(){return this.rootConfig.baseURL}configParams(){return this.rootParams}siteTitle(){return this.rootConfig.title}getRootConfig(){return this.rootConfig}getThemes(){return this.rootConfig.theme}getDefaultContentLanguage(){return this.rootConfig.defaultContentLanguage}shouldBuildDrafts(){return this.rootConfig.buildDrafts}shouldBuildFuture(){return this.rootConfig.buildFuture}shouldBuildExpired(){return this.rootConfig.buildExpired}};var Module=class{moduleConfig;constructor(e){this.moduleConfig=e}importPaths(){return this.moduleConfig.imports.map(e=>e.path)}getModuleConfig(){return this.moduleConfig}getImports(){return this.moduleConfig.imports}getMounts(){return this.moduleConfig.mounts}importCount(){return this.moduleConfig.imports.length}mountCount(){return this.moduleConfig.mounts.length}hasImports(){return this.moduleConfig.imports.length>0}hasMounts(){return this.moduleConfig.mounts.length>0}findImport(e){return this.moduleConfig.imports.find(t=>t.path===e)}findMount(e){return this.moduleConfig.mounts.find(t=>t.source===e)}};var DefaultServiceConfig={disqus:{disable:!1,shortname:""},googleAnalytics:{disable:!1,respectDoNotTrack:!1,id:""},rss:{limit:0},x:{respectDoNotTrack:!1,disableInlineCSS:!1}},Service=class{serviceConfig;constructor(e){this.serviceConfig=e}isGoogleAnalyticsEnabled(){return!this.serviceConfig.googleAnalytics.disable}googleAnalyticsID(){return this.serviceConfig.googleAnalytics.id}isGoogleAnalyticsRespectDoNotTrack(){return this.serviceConfig.googleAnalytics.respectDoNotTrack}isDisqusEnabled(){return!this.serviceConfig.disqus.disable}disqusShortname(){return this.serviceConfig.disqus.shortname}isXRespectDoNotTrack(){return this.serviceConfig.x.respectDoNotTrack}isXDisableInlineCSS(){return this.serviceConfig.x.disableInlineCSS}rssLimit(){return this.serviceConfig.rss.limit}getServiceConfig(){return this.serviceConfig}getGoogleAnalytics(){return this.serviceConfig.googleAnalytics}getDisqus(){return this.serviceConfig.disqus}getRSS(){return this.serviceConfig.rss}hasEnabledServices(){return this.isGoogleAnalyticsEnabled()||this.isDisqusEnabled()}};init_lang();var DefaultLanguageConfig={languageCode:"en",languageName:"English",title:"",weight:0,contentDir:"content",disabled:!1,params:{}},Language=class{defaultLang;configs;indices;constructor(e){this.configs=e,this.defaultLang=this.calculateDefaultLanguage(),this.indices=[],this.setIndices()}calculateDefaultLanguage(){if(0===Object.keys(this.configs).length)return"en";let e="",t=Number.MAX_SAFE_INTEGER;for(const[n,r]of Object.entries(this.configs))r.weight<t&&(t=r.weight,e=n);return e||Object.keys(this.configs)[0]}languages(){return Object.values(this.configs)}defaultLanguage(){return this.defaultLang}isLanguageValid(e){return Object.prototype.hasOwnProperty.call(this.configs,e)}otherLanguageKeys(){return Object.keys(this.configs).filter(e=>e!==this.defaultLang)}getRelDir(e,t){const n=this.configs[t];if(!n)throw new Error(`Language "${t}" not found`);return n.contentDir||"content"}validate(){return e=this.configs,t=this.defaultLang,Object.prototype.hasOwnProperty.call(e,t);var e,t}setIndices(){const e=[];this.configs[this.defaultLang]&&e.push(this.defaultLang);for(const t of Object.keys(this.configs))t!==this.defaultLang&&e.push(t);this.indices=e}languageKeys(){return[...this.indices]}languageIndexes(){return this.indices.map((e,t)=>t)}getLanguageIndex(e){const t=this.indices.indexOf(e);if(-1===t)throw new Error("Language not found in indices");return t}getLanguageByIndex(e){if(e<0||e>=this.indices.length)throw new Error("Language index out of range");return this.indices[e]}getLanguageName(e){const t=this.configs[e];return t?t.languageName:""}getLanguageConfig(e){return this.configs[e]}getConfigs(){return this.configs}};var DefaultTaxonomies={tag:"tags",category:"categories"};function cleanTreeKey(...e){let t="";return e.length>0&&(t=e[0],e.length>1&&(t=e.join("/"))),t=t.replace(/^[.\s/]+|[.\s/]+$/g,""),t=t.toLowerCase(),t=t.replace(/\\/g,"/"),""===t||"/"===t?"":(t.startsWith("/")||(t="/"+t),t)}var Taxonomy=class{taxonomies;views;viewsByTreeKey;constructor(e){this.taxonomies=e,this.views=[],this.viewsByTreeKey={},this.setupViews()}getViews(){return[...this.views]}getTaxonomies(){return{...this.taxonomies}}getViewByTreeKey(e){return this.viewsByTreeKey[e]}hasTaxonomy(e){return Object.prototype.hasOwnProperty.call(this.taxonomies,e)}getPluralForm(e){return this.taxonomies[e]}getSingularForm(e){for(const[t,n]of Object.entries(this.taxonomies))if(n===e)return t}getSingularForms(){return Object.keys(this.taxonomies)}getPluralForms(){return Object.values(this.taxonomies)}setupViews(){this.views=function(e){const t=[];for(const[n,r]of Object.entries(e))t.push({singular:n,plural:r,pluralTreeKey:cleanTreeKey(r)});return t.sort((e,t)=>e.plural.localeCompare(t.plural)),t}(this.taxonomies),this.viewsByTreeKey={};for(const e of this.views)this.viewsByTreeKey[e.pluralTreeKey]=e}getViewCount(){return this.views.length}isEmpty(){return 0===Object.keys(this.taxonomies).length}};function newTaxonomy(e){const t=function(e){if(e.taxonomies&&"object"==typeof e.taxonomies){const t={};for(const[n,r]of Object.entries(e.taxonomies))"string"==typeof r&&(t[n]=r);return t}return{...DefaultTaxonomies}}(e);return new Taxonomy(t)}var DefaultSocialPlatformTemplates=[{id:"email",title:"Email me"},{id:"facebook",title:"Facebook"},{id:"github",title:"GitHub"},{id:"gitlab",title:"GitLab"},{id:"bitbucket",title:"Bitbucket"},{id:"twitter",title:"Twitter"},{id:"slack",title:"Slack"},{id:"reddit",title:"Reddit"},{id:"linkedin",title:"LinkedIn"},{id:"xing",title:"Xing"},{id:"stackoverflow",title:"StackOverflow"},{id:"snapchat",title:"Snapchat"},{id:"instagram",title:"Instagram"},{id:"youtube",title:"Youtube"},{id:"soundcloud",title:"SoundCloud"},{id:"spotify",title:"Spotify"},{id:"bandcamp",title:"Bandcamp"},{id:"itchio",title:"Itch.io"},{id:"keybase",title:"Keybase"},{id:"vk",title:"VK"},{id:"paypal",title:"PayPal"},{id:"telegram",title:"Telegram"},{id:"500px",title:"500px"},{id:"codepen",title:"CodePen"},{id:"kaggle",title:"kaggle"},{id:"mastodon",title:"Mastodon"},{id:"weibo",title:"Weibo"},{id:"medium",title:"Medium"},{id:"discord",title:"Discord"},{id:"strava",title:"Strava"},{id:"steam",title:"Steam"},{id:"quora",title:"Quora"},{id:"amazonwishlist",title:"Amazon Wishlist"},{id:"slideshare",title:"Slideshare"},{id:"angellist",title:"AngelList"},{id:"about",title:"About"},{id:"lastfm",title:"Last.fm"},{id:"bluesky",title:"Bluesky"},{id:"goodreads",title:"Goodreads"}],Social=class{socialConfig;constructor(e){this.socialConfig=e}getUserConfig(){return this.socialConfig.userConfig}getPlatformTemplates(){return this.socialConfig.platformTemplates}getPlatformTemplate(e){return t=e,DefaultSocialPlatformTemplates.find(e=>e.id===t);var t}isPlatformConfigured(e){return e in this.socialConfig.userConfig}getConfiguredPlatforms(){return Object.keys(this.socialConfig.userConfig)}getProcessedSocialLinks(){const e=[];for(const[t,n]of Object.entries(this.socialConfig.userConfig)){const r=this.getPlatformTemplate(t);r?e.push({id:t,title:r.title,url:n.link}):e.push({id:t,title:t.charAt(0).toUpperCase()+t.slice(1),url:n.link})}return e}getSocialLink(e){const t=this.socialConfig.userConfig[e];if(!t)return;const n=this.getPlatformTemplate(e);return n?{id:e,title:n.title,url:t.link}:{id:e,title:e.charAt(0).toUpperCase()+e.slice(1),url:t.link}}hasSocialLinks(){return Object.keys(this.socialConfig.userConfig).length>0}getSocialLinkCount(){return Object.keys(this.socialConfig.userConfig).length}getAvailablePlatforms(){return this.socialConfig.platformTemplates.map(e=>e.id)}getSocialConfig(){return this.socialConfig}};var DefaultMarkdownConfig={useInternalRenderer:!1,plugins:{wikilink:!0,tag:!0,callout:!0,latex:!0,mermaid:!0}},Markdown=class{markdownConfig;constructor(e){this.markdownConfig=e}useInternalRenderer(){return this.markdownConfig.useInternalRenderer}isWikilinkEnabled(){return this.markdownConfig.plugins.wikilink}isTagEnabled(){return this.markdownConfig.plugins.tag}isCalloutEnabled(){return this.markdownConfig.plugins.callout}isLatexEnabled(){return this.markdownConfig.plugins.latex}isMermaidEnabled(){return this.markdownConfig.plugins.mermaid}getMarkdownConfig(){return this.markdownConfig}getPlugins(){return this.markdownConfig.plugins}hasEnabledPlugins(){const e=this.markdownConfig.plugins;return e.wikilink||e.tag||e.callout||e.latex||e.mermaid}validate(){return!this.markdownConfig.useInternalRenderer||this.hasEnabledPlugins()}};var import_path=__toESM(require("path")),DEFAULT_PUBLISH_DIR="public",Dir=class{workingDir;themesDir;publishDir;constructor(e,t,n=DEFAULT_PUBLISH_DIR){this.workingDir=e,this.themesDir=t,this.publishDir=n}getWorkingDir(){return import_path.default.resolve(this.workingDir)}getThemesDir(){return import_path.default.resolve(this.themesDir)}getThemesCacheDir(){return import_path.default.resolve(this.themesDir,".cache")}getPublishDir(){return import_path.default.resolve(this.publishDir)}},DefaultConfigProvider=class{root;keyCache;constructor(e={}){this.root=this.prepareParams(e),this.keyCache=new Map}prepareParams(e){const t={};for(const[n,r]of Object.entries(e))t[n.toLowerCase()]=r;return t}getNestedKeyAndMap(e,t){let n;this.keyCache.has(e)?n=this.keyCache.get(e):(n=e.split("."),this.keyCache.set(e,n));let r=this.root;for(let e=0;e<n.length-1;e++){const s=n[e];if(!(s in r)){if(!t)return["",null];r[s]={}}const a=r[s];if("object"!=typeof a||null===a)return["",null];r=a}return[n[n.length-1],r]}getString(e){const t=this.get(e);return String(t||"")}getInt(e){const t=this.get(e),n=Number(t);return isNaN(n)?0:Math.floor(n)}getBool(e){const t=this.get(e);return"boolean"==typeof t?t:"string"==typeof t?"true"===t.toLowerCase():Boolean(t)}getParams(e){const t=this.get(e);return t&&"object"==typeof t?t:{}}getStringMap(e){const t=this.get(e);return t&&"object"==typeof t?t:{}}getStringMapString(e){const t=this.get(e);if(t&&"object"==typeof t){const e={};for(const[n,r]of Object.entries(t))e[n]=String(r);return e}return{}}getStringSlice(e){const t=this.get(e);return Array.isArray(t)?t.map(e=>String(e)):[]}get(e){if(""===e)return this.root;const[t,n]=this.getNestedKeyAndMap(e.toLowerCase(),!1);return null!==n?n[t]:void 0}set(e,t){const n=e.toLowerCase();if(""===n)return void(t&&"object"==typeof t?Object.assign(this.root,this.prepareParams(t)):this.root[n]=t);const[r,s]=this.getNestedKeyAndMap(n,!0);null!==s&&(r in s&&"object"==typeof s[r]&&"object"==typeof t&&null!==t?Object.assign(s[r],t):s[r]=t)}keys(){return Object.keys(this.root)}merge(e,t){const n=e.toLowerCase();if(""===n)return void(t&&"object"==typeof t&&Object.assign(this.root,this.prepareParams(t)));const[r,s]=this.getNestedKeyAndMap(n,!0);null!==s&&(r in s&&"object"==typeof s[r]&&"object"==typeof t&&null!==t?Object.assign(s[r],t):s[r]=t)}setDefaults(e){const t=this.prepareParams(e);for(const[e,n]of Object.entries(t))e in this.root||(this.root[e]=n)}setDefaultMergeStrategy(){}walkParams(e){const t=n=>{if(n&&"object"==typeof n&&!Array.isArray(n)){if(e(n))return!0;for(const e of Object.values(n))if(t(e))return!0}return!1};t(this.root)}isSet(e){const[t,n]=this.getNestedKeyAndMap(e.toLowerCase(),!1);return null!==n&&t in n}},path2=__toESM(require("path")),ConfigLoader=class{cfg;sourceDescriptor;baseDirs;constructor(e,t){this.cfg=new DefaultConfigProvider,this.sourceDescriptor=e,this.baseDirs=t}async loadConfigByDefault(){const e=this.sourceDescriptor.filename();if(await this.loadProvider(e),this.applyDefaultConfig(),this.cfg.setDefaultMergeStrategy(),!this.cfg.isSet("languages")){const e=this.cfg.getString("defaultContentLanguage");this.cfg.set("languages",{[e]:{}})}return this.cfg}deleteMergeStrategies(){this.cfg.walkParams(e=>!1)}async loadProvider(e){const t=this.baseDirs.workingDir;let n;n=path2.isAbsolute(e)?e:path2.join(t,e);let r="";if(""!==path2.extname(e)&&await this.fileExists(n)&&(r=n),""===r)throw new Error("Unable to locate config file or config directory.");const s=await this.loadConfigFromFile(r);this.cfg.set("",s)}applyDefaultConfig(){this.cfg.setDefaults({baseURL:"",cleanDestinationDir:!1,watch:!1,contentDir:"content",resourceDir:"resources",publishDir:"public",publishDirOrig:"public",themesDir:"themes",assetDir:"assets",layoutDir:"layouts",i18nDir:"i18n",dataDir:"data",archetypeDir:"archetypes",configDir:"config",staticDir:"static",buildDrafts:!1,buildFuture:!1,buildExpired:!1,params:{},environment:"production",uglyURLs:!1,verbose:!1,ignoreCache:!1,canonifyURLs:!1,relativeURLs:!1,removePathAccents:!1,titleCaseStyle:"AP",taxonomies:{tag:"tags",category:"categories"},permalinks:{},sitemap:{priority:-1,filename:"sitemap.xml"},menus:{},disableLiveReload:!1,pluralizeListTitles:!0,capitalizeListTitles:!0,forceSyncStatic:!1,footnoteAnchorPrefix:"",footnoteReturnLinkContents:"",newContentEditor:"",paginate:10,paginatePath:"page",summaryLength:70,rssLimit:-1,sectionPagesMenu:"",disablePathToLower:!1,hasCJKLanguage:!1,enableEmoji:!1,defaultContentLanguage:"en",defaultContentLanguageInSubdir:!1,enableMissingTranslationPlaceholders:!1,enableGitInfo:!1,ignoreFiles:[],disableAliases:!1,debug:!1,disableFastRender:!1,timeout:"30s",timeZone:"",enableInlineShortcodes:!1})}async fileExists(e){try{const t=this.sourceDescriptor.fs();return!(await t.stat(e)).isDir()}catch{return!1}}async loadConfigFromFile(e){const t=this.sourceDescriptor.fs(),n=await t.open(e);try{const e=new Uint8Array(1048576),{bytesRead:t}=await n.read(e),r=(new TextDecoder).decode(e.slice(0,t));try{return JSON.parse(r)}catch{return{}}}finally{await n.close()}}},ConfigSourceDescriptor=class{fileSystem;configFilename;constructor(e,t){this.fileSystem=e,this.configFilename=t}fs(){return this.fileSystem}filename(){return this.configFilename}},path3=__toESM(require("path"));async function loadConfigWithParams(e,t,n,r,s={}){const a={workingDir:path3.resolve(n),modulesDir:path3.resolve(r),publishDir:path3.resolve(DEFAULT_PUBLISH_DIR),cacheDir:""};a.cacheDir=await async function(e,t){if(""!==t)return t;const n=process.env.HOME||process.env.USERPROFILE||"",r=path3.join(n,".cache","mdf");try{return await e.mkdirAll(r,493),r}catch{return path3.join("/tmp","hugo-cache")}}(e,a.cacheDir);const i=new ConfigLoader(function(e,t){return new ConfigSourceDescriptor(e,t)}(e,t),a);try{const t=await i.loadConfigByDefault();for(const[e,n]of Object.entries(s))t.set(e,n);const n=path3.resolve(t.get("publishDir")||DEFAULT_PUBLISH_DIR);return await e.mkdirAll(n,511),function(e,t,n,r,s,a,i,o,l,c){return new Config(e,t,n,r,s,a,i,o,l,c)}(e,t,function(e,t={}){const n=function(e){return{baseURL:e.baseurl||DefaultRootConfig.baseURL,title:e.title||DefaultRootConfig.title,theme:e.theme||DefaultRootConfig.theme,timeout:e.timeout||DefaultRootConfig.timeout,contentDir:e.contentDir||DefaultRootConfig.contentDir,dataDir:e.dataDir||DefaultRootConfig.dataDir,layoutDir:e.layoutDir||DefaultRootConfig.layoutDir,staticDir:e.staticDir||DefaultRootConfig.staticDir,archetypeDir:e.archetypeDir||DefaultRootConfig.archetypeDir,assetDir:e.assetDir||DefaultRootConfig.assetDir,publishDir:e.publishDir||DefaultRootConfig.publishDir,buildDrafts:void 0!==e.buildDrafts?e.buildDrafts:DefaultRootConfig.buildDrafts,buildExpired:void 0!==e.buildExpired?e.buildExpired:DefaultRootConfig.buildExpired,buildFuture:void 0!==e.buildFuture?e.buildFuture:DefaultRootConfig.buildFuture,copyright:e.copyright||DefaultRootConfig.copyright,defaultContentLanguage:e.defaultContentLanguage||DefaultRootConfig.defaultContentLanguage,defaultContentLanguageInSubdir:void 0!==e.defaultContentLanguageInSubdir?e.defaultContentLanguageInSubdir:DefaultRootConfig.defaultContentLanguageInSubdir,disableAliases:void 0!==e.disableAliases?e.disableAliases:DefaultRootConfig.disableAliases,disablePathToLower:void 0!==e.disablePathToLower?e.disablePathToLower:DefaultRootConfig.disablePathToLower,disableKinds:e.disableKinds||DefaultRootConfig.disableKinds,disableLanguages:e.disableLanguages||DefaultRootConfig.disableLanguages,renderSegments:e.renderSegments||DefaultRootConfig.renderSegments,disableHugoGeneratorInject:void 0!==e.disableHugoGeneratorInject?e.disableHugoGeneratorInject:DefaultRootConfig.disableHugoGeneratorInject,disableLiveReload:void 0!==e.disableLiveReload?e.disableLiveReload:DefaultRootConfig.disableLiveReload,enableEmoji:void 0!==e.enableEmoji?e.enableEmoji:DefaultRootConfig.enableEmoji}}(e);return new Root(n,t)}(t.get(""),t.getParams("params")),function(e,t,n){return new Dir(e,t,n)}(a.workingDir,a.modulesDir,n),function(e){const t=function(e){const t={mounts:[],imports:[]};return e.mounts&&Array.isArray(e.mounts)&&(t.mounts=e.mounts.map(e=>({source:e.source||"",target:e.target||"",lang:e.lang}))),e.imports&&Array.isArray(e.imports)&&(t.imports=e.imports.map(e=>({path:e.path||"",url:e.url,version:e.version,mounts:e.mounts||[]}))),t}(e);return new Module(t)}(t.get("module")||{}),function(e){const t=function(e){const t={disqus:{...DefaultServiceConfig.disqus},googleAnalytics:{...DefaultServiceConfig.googleAnalytics},rss:{...DefaultServiceConfig.rss},x:{...DefaultServiceConfig.x}};return e&&(e.disqus&&(t.disqus.shortname=e.disqus.shortname||t.disqus.shortname),e.googleAnalytics&&(t.googleAnalytics.id=e.googleAnalytics.id||t.googleAnalytics.id),e.rss&&(t.rss.limit=void 0!==e.rss.limit?e.rss.limit:t.rss.limit)),t}(e);return new Service(t)}(t.get("services")),function(e){const t=function(e){const t={userConfig:{},platformTemplates:[...DefaultSocialPlatformTemplates]};if(e&&"object"==typeof e)for(const[n,r]of Object.entries(e))if(r&&"object"==typeof r){const e=r;e.link&&(t.userConfig[n]={link:e.link})}return t}(e);return new Social(t)}(t.get("social")),function(e){const t=function(e){const t={};if(!e||0===Object.keys(e).length)return t.en={...DefaultLanguageConfig,title:e?.title||DefaultLanguageConfig.title,params:e?.params||DefaultLanguageConfig.params},t;for(const[n,r]of Object.entries(e)){const s=r,a=languages.getNameByCode(n)||n;t[n]={languageCode:n,languageName:a,title:s.title||e.title||"",weight:void 0!==s.weight?s.weight:0,contentDir:s.contentDir||"content",disabled:void 0!==s.disabled&&s.disabled,params:s.params||e.params||{}}}return t}(e);return new Language(t)}(t.get("languages")),t.isSet("taxonomies")?newTaxonomy(t.get("taxonomies")):newTaxonomy(t.get("")),function(e){const t=function(e){const t={useInternalRenderer:DefaultMarkdownConfig.useInternalRenderer,plugins:{...DefaultMarkdownConfig.plugins}};return e&&(void 0!==e.useInternalRenderer&&(t.useInternalRenderer=Boolean(e.useInternalRenderer)),e.plugins&&(void 0!==e.plugins.wikilink&&(t.plugins.wikilink=Boolean(e.plugins.wikilink)),void 0!==e.plugins.tag&&(t.plugins.tag=Boolean(e.plugins.tag)),void 0!==e.plugins.callout&&(t.plugins.callout=Boolean(e.plugins.callout)),void 0!==e.plugins.latex&&(t.plugins.latex=Boolean(e.plugins.latex)),void 0!==e.plugins.mermaid&&(t.plugins.mermaid=Boolean(e.plugins.mermaid)))),t}(e);return new Markdown(t)}(t.get("markdown")))}finally{i.deleteMergeStrategies()}}var ComponentFolders=["workflows","prompts","content","layouts","static","assets","i18n"],ModuleError=class extends Error{constructor(e,t){super(e),this.code=t,this.name="ModuleError"}},path4=(new ModuleError("module not found","MODULE_NOT_FOUND"),new ModuleError("download failed","DOWNLOAD_FAILED"),new ModuleError("invalid zip file","INVALID_ZIP"),new ModuleError("mount failed","MOUNT_FAILED"),__toESM(require("path"))),Mount=class e{constructor(e,t,n=""){this.sourcePath=e,this.targetPath=t,this.language=n}source(){return this.sourcePath}target(){return this.targetPath}lang(){return this.language}setLanguage(e){this.language=e}component(){return this.targetPath.split(path4.sep)[0]||""}componentAndName(){const e=this.targetPath.split(path4.sep);return{component:e[0]||"",name:e.slice(1).join(path4.sep)}}copy(){return new e(this.sourcePath,this.targetPath,this.language)}equals(e){return this.sourcePath===e.sourcePath&&this.targetPath===e.targetPath&&this.language===e.language}toConfig(){const e={sourcePath:this.sourcePath,targetPath:this.targetPath};return this.language&&(e.language=this.language),e}toString(){return`${this.sourcePath} -> ${this.targetPath} (${this.language})`}},path5=__toESM(require("path")),http=__toESM(require("http")),https=__toESM(require("https"));init_log();var log=getDomainLogger("module",{component:"httpclient"}),NodeHttpClient=class{constructor(e,t=3e4,n={}){this.fs=e,this.timeout=t,this.headers=n}defaultTimeout=3e4;defaultHeaders={"User-Agent":"MDFriday-CLI/1.0.0"};async download(e,t,n){return new Promise((r,s)=>{try{const a=new URL(e),i="https:"===a.protocol,o=i?https:http,l={...this.defaultHeaders,...this.headers,...n?.headers},c={hostname:a.hostname,port:a.port||(i?443:80),path:a.pathname+a.search,method:"GET",headers:l,timeout:n?.timeout||this.timeout},u=o.request(c,async e=>{if(!e.statusCode||e.statusCode<200||e.statusCode>=300)return void s(new ModuleError(`HTTP ${e.statusCode}: ${e.statusMessage}`,"HTTP_ERROR"));const a=parseInt(e.headers["content-length"]||"0",10);let i=0,o=Date.now(),l=-1;try{const c=path5.dirname(t);await this.fs.mkdirAll(c,493);const u=await this.fs.create(t),h=[];e.on("data",e=>{if(h.push(e),i+=e.length,n?.onProgress&&a>0){const e=Date.now(),t=Math.round(i/a*100);if(e-o>=100&&t!==l||t-l>=5){const r={loaded:i,total:a,percentage:t};try{n.onProgress(r),l=t}catch(e){log.error(`Progress callback error: ${e}`)}o=e}}}),e.on("end",async()=>{try{const e=Buffer.concat(h),t=new Uint8Array(e);if(await u.write(t),await u.sync(),await u.close(),n?.onProgress&&a>0){const e={loaded:a,total:a,percentage:100};try{n.onProgress(e)}catch(e){log.warn(`Progress callback error: ${e}`)}}r()}catch(e){const t=e instanceof Error?e.message:String(e);s(new ModuleError(`File write failed: ${t}`,"WRITE_FAILED"))}}),e.on("error",e=>{log.error(`Response error: ${e.message}`),s(new ModuleError(`Download failed: ${e.message}`,"DOWNLOAD_FAILED"))})}catch(e){const t=e instanceof Error?e.message:String(e);s(new ModuleError(`File system error: ${t}`,"FS_ERROR"))}});u.on("error",e=>{log.error("Request error:",e),s(new ModuleError(`Request failed: ${e.message}`,"REQUEST_FAILED"))}),u.on("timeout",()=>{u.destroy(),log.error(`Request timeout for ${e}`),s(new ModuleError("Request timeout","TIMEOUT"))}),u.end()}catch(e){const t=e instanceof Error?e.message:String(e);s(new ModuleError(`Download failed: ${t}`,"DOWNLOAD_FAILED"))}})}async get(e,t){return new Promise((n,r)=>{try{const s=new URL(e),a="https:"===s.protocol,i=a?https:http,o={...this.defaultHeaders,...this.headers,...t?.headers},l={hostname:s.hostname,port:s.port||(a?443:80),path:s.pathname+s.search,method:"GET",headers:o,timeout:t?.timeout||this.timeout},c=i.request(l,e=>{const t=[],s={};Object.entries(e.headers).forEach(([e,t])=>{s[e]=Array.isArray(t)?t.join(", "):t||""}),e.on("data",e=>{t.push(e)}),e.on("end",()=>{const r=Buffer.concat(t),a=r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength);n({data:a,headers:s,status:e.statusCode||0})}),e.on("error",e=>{r(new ModuleError(`Response error: ${e.message}`,"RESPONSE_ERROR"))})});c.on("error",e=>{r(new ModuleError(`GET request failed: ${e.message}`,"REQUEST_FAILED"))}),c.on("timeout",()=>{c.destroy(),r(new ModuleError("GET request timeout","TIMEOUT"))}),c.end()}catch(e){const t=e instanceof Error?e.message:String(e);r(new ModuleError(`GET request failed: ${t}`,"REQUEST_FAILED"))}})}};function newHttpClient(e,t,n,r){return r||new NodeHttpClient(e,t,n)}init_log();var import_jszip=__toESM(require("jszip")),path6=__toESM(require("path")),log2=getDomainLogger("module",{component:"zipextractor"}),JsZipExtractor=class{constructor(e){this.fs=e}async extract(e,t){try{const n=await this.fs.open(e),r=(await n.stat()).size(),s=new Uint8Array(r),a=await n.read(s);await n.close(),await this.extractZipData(a.buffer,t)}catch(t){const n=t instanceof Error?t.message:String(t);throw log2.error(`ZIP extraction failed for ${e}: ${n}`),new ModuleError(`ZIP extraction failed: ${n}`,"EXTRACTION_FAILED")}}async list(e){try{const t=await this.fs.open(e),n=await t.stat(),r=new Uint8Array(n.size()),s=await t.read(r);return await t.close(),await this.listZipContents(s.buffer)}catch(e){const t=e instanceof Error?e.message:String(e);throw new ModuleError(`ZIP listing failed: ${t}`,"LIST_FAILED")}}async extractZipData(e,t){try{await this.fs.mkdirAll(t,493);const n=new import_jszip.default,r=await n.loadAsync(e),s=[];r.forEach((e,t)=>{t.dir||s.push(e)});const a=[];let i=0;r.forEach((e,n)=>{a.push(this.extractSingleEntry(e,n,t).then(()=>{i++}))}),await Promise.all(a)}catch(e){const t=e instanceof Error?e.message:String(e);throw log2.error(`Failed to extract ZIP data: ${t}`),new ModuleError(`Failed to extract ZIP data: ${t}`,"EXTRACTION_FAILED")}}async extractSingleEntry(e,t,n){const r=path6.join(n,e);if(t.dir)await this.fs.mkdirAll(r,493);else{const e=path6.dirname(r);e!==n&&await this.fs.mkdirAll(e,493);const s=await t.async("uint8array"),a=await this.fs.create(r);await a.write(s),await a.close()}}async listZipContents(e){try{const t=new import_jszip.default,n=await t.loadAsync(e),r=[];return n.forEach(e=>{r.push(e)}),r}catch(e){const t=e instanceof Error?e.message:String(e);throw new ModuleError(`Failed to list ZIP contents: ${t}`,"LIST_FAILED")}}},WebZipExtractor=class{constructor(e){this.fs=e}async extract(e,t){try{throw new ModuleError("Web ZIP extraction not implemented","NOT_IMPLEMENTED")}catch(e){const t=e instanceof Error?e.message:String(e);throw new ModuleError(`Web ZIP extraction failed: ${t}`,"WEB_EXTRACTION_FAILED")}}async list(e){try{throw new ModuleError("Web ZIP listing not implemented","NOT_IMPLEMENTED")}catch(e){const t=e instanceof Error?e.message:String(e);throw new ModuleError(`Web ZIP listing failed: ${t}`,"WEB_LIST_FAILED")}}};function newZipExtractor(e,t="node"){switch(t){case"node":return new JsZipExtractor(e);case"browser":return new WebZipExtractor(e);default:throw new Error(`Unsupported environment: ${t}`)}}init_log();var path7=__toESM(require("path")),log3=getDomainLogger("module",{component:"cache"}),FsModuleCache=class{constructor(e,t="./module/cache"){this.fs=e,this.cacheDir=t}cacheDir;async get(e){try{const t=this.getCacheFilePath(e),n=await this.fs.open(t),r=await n.stat(),s=new Uint8Array(r.size());await n.read(s),await n.close();const a=(new TextDecoder).decode(s);return JSON.parse(a)}catch(t){if(t.message?.includes("ENOENT")||t.message?.includes("no such file"))return log3.error(`Cache miss: ${e}`,t),null;const n=t instanceof Error?t.message:String(t);throw log3.error(`Cache read error for ${e}: ${n}`),new ModuleError(`Failed to read cache: ${n}`,"CACHE_READ_FAILED")}}async set(e,t){try{await this.fs.mkdirAll(this.cacheDir,493);const n=this.getCacheFilePath(e),r=JSON.stringify(t,null,2),s=(new TextEncoder).encode(r),a=await this.fs.create(n);await a.write(s),await a.sync(),await a.close()}catch(t){const n=t instanceof Error?t.message:String(t);throw log3.error(`Cache write error for ${e}: ${n}`),new ModuleError(`Failed to write cache: ${n}`,"CACHE_WRITE_FAILED")}}async has(e){try{const t=this.getCacheFilePath(e);return await this.fs.stat(t),!0}catch(e){return!1}}async delete(e){try{const t=this.getCacheFilePath(e);await this.fs.remove(t)}catch(t){if(!t.message?.includes("ENOENT")&&!t.message?.includes("no such file")){const n=t instanceof Error?t.message:String(t);throw log3.error(`Cache delete error for ${e}: ${n}`),new ModuleError(`Failed to delete cache: ${n}`,"CACHE_DELETE_FAILED")}}}async clear(){try{await this.fs.removeAll(this.cacheDir)}catch(e){if(!e.message?.includes("ENOENT")&&!e.message?.includes("no such file")){const t=e instanceof Error?e.message:String(e);throw log3.error(`Cache clear error: ${t}`),new ModuleError(`Failed to clear cache: ${t}`,"CACHE_CLEAR_FAILED")}}}getCacheFilePath(e){const t=e.replace(/[/\\:*?"<>|]/g,"_").replace(/^_+|_+$/g,"")+".json";return path7.join(this.cacheDir,t)}getCacheDir(){return this.cacheDir}async getStats(){try{const e=await this.listCacheFiles();let t=0;for(const n of e)try{const e=path7.join(this.cacheDir,n);t+=(await this.fs.stat(e)).size()}catch(e){}return{totalEntries:e.length,totalSize:t}}catch(e){return{totalEntries:0,totalSize:0}}}async listCached(){try{return(await this.listCacheFiles()).map(e=>path7.basename(e,".json").replace(/_/g,"/"))}catch(e){return[]}}async listCacheFiles(){try{const e=await this.fs.open(this.cacheDir),t=await e.readdirnames(-1);return await e.close(),t.filter(e=>e.endsWith(".json"))}catch(e){return[]}}};function newModuleCache(e,t){return new FsModuleCache(e,t)}var path8=__toESM(require("path")),Module2=class e{constructor(e,t,n,r=null,s=!1){this.fs=e,this.absoluteDir=t,this.modulePath=n,this.parentModule=r,this.mountDirs=[],this.metadata=null,this.isProject=s}absoluteDir;modulePath;parentModule;mountDirs;metadata;isProject=!1;isProjectModule(){return this.isProject}owner(){return this.parentModule}mounts(){return this.mountDirs.map(e=>e)}dir(){return this.absoluteDir}path(){return this.modulePath}setMetadata(e){this.metadata=e}getMetadata(){return this.metadata}async applyMounts(e){try{let t=e.mounts||[];if(0===t.length)for(const e of ComponentFolders){const n=path8.join(this.absoluteDir,e);try{(await this.fs.stat(n)).isDir()&&t.push({sourcePath:e,targetPath:e})}catch(e){}}this.mountDirs=t.map(e=>{return t=e.sourcePath,n=e.targetPath,new Mount(t,n);var t,n})}catch(e){const t=e instanceof Error?e.message:String(e);throw new ModuleError(`Failed to apply mounts: ${t}`,"MOUNT_FAILED")}}appendMount(e){this.mountDirs.push(e)}removeMount(e){const t=this.mountDirs.findIndex(t=>t.equals(e));return t>=0&&(this.mountDirs.splice(t,1),!0)}getMountByTarget(e){return this.mountDirs.find(t=>t.target()===e)||null}getMountsByComponent(e){return this.mountDirs.filter(t=>t.component()===e)}isDownloaded(){return"completed"===this.metadata?.downloadStatus}isDownloading(){return"downloading"===this.metadata?.downloadStatus}isDownloadFailed(){return"failed"===this.metadata?.downloadStatus}async exists(){try{return(await this.fs.stat(this.absoluteDir)).isDir()}catch(e){return!1}}copy(){const t=new e(this.fs,this.absoluteDir,this.modulePath,this.parentModule,this.isProject);return t.mountDirs=this.mountDirs.map(e=>e.copy()),t.metadata=this.metadata?{...this.metadata}:null,t}toString(){return`Module{path: ${this.modulePath}, dir: ${this.absoluteDir}, mounts: ${this.mountDirs.length}}`}},ProjectModule=class{constructor(e){this.module=e}getModule(){return this.module}appendMount(e){this.module.appendMount(e)}setDefaultLanguage(e){const t=this.module.mounts();for(const n of t)n instanceof Mount&&n.setLanguage(e)}applyDefaultMounts(){const e=ComponentFolders.map(e=>new Mount(e,e));for(const t of e)this.module.appendMount(t)}owner(){return this.module.owner()}mounts(){return this.module.mounts()}dir(){return this.module.dir()}path(){return this.module.path()}};function newModule2(e,t,n,r){return new Module2(e,t,n,r||null,!1)}var import_path2=__toESM(require("path")),Lang=class{sourceLangMap;constructor(e){this.sourceLangMap=new Map;for(const t of e)for(const e of t.mounts())this.sourceLangMap.set(e.source(),e.lang())}getSourceLang(e){const t=this.sourceLangMap.get(import_path2.default.basename(e));return void 0!==t?[t,!0]:["",!1]}},Themes=class e{themes;constructor(e){this.themes=e}static fromJson(t){return new e(t)}findThemeByUrl(e){const t=this.extractBaseUrl(e);for(const e of this.themes)if(t===this.extractBaseUrl(e.download_url))return e;return null}resolveLatestVersion(e){const t=this.findThemeByUrl(e);return t?t.download_url:e}extractBaseUrl(e){try{const t=new URL(e);return t.searchParams.delete("version"),t.toString()}catch(t){const n=e.indexOf("?");if(-1===n)return e;const r=e.substring(0,n),s=new URLSearchParams(e.substring(n+1));s.delete("version");const a=s.toString();return a?`${r}?${a}`:r}}getAllThemes(){return[...this.themes]}getThemeByName(e){return this.themes.find(t=>t.name.toLowerCase()===e.toLowerCase())||null}getThemesByTag(e){return this.themes.filter(t=>t.tags.some(t=>t.toLowerCase()===e.toLowerCase()))}};init_log();var import_smol_toml=require("smol-toml"),path10=__toESM(require("path")),log4=getDomainLogger("module",{component:"modules"}),Modules=class{constructor(e,t,n,r){var s;this.info=e,this.httpClient=t,this.zipExtractor=n,this.moduleCache=r,this.projectModule=function(e){const t=e.osFs(),n=e.projDir(),r=e.defaultLanguageKey(),s=new Module2(t,n,"project-root",null,!0),a=new ProjectModule(s);a.applyDefaultMounts(),r&&a.setDefaultLanguage(r);const i=e.otherLanguageKeys();for(const t of i)try{const n=e.getRelDir("content",t);if(n&&""!==n){const e=new Mount(n,"content",t);a.appendMount(e)}}catch(e){console.warn(`Failed to get relative directory for language ${t}:`,e)}return a}(this.info),this.lang=(s=this.all(),new Lang(s))}projectModule;modules=[];downloadedModules=new Set;lang;themesCache=new Map;proj(){return this.projectModule.getModule()}all(){const e=[this.projectModule.getModule()];return e.push(...this.modules),e}isProjMod(e){return e===this.projectModule.getModule()}async load(e){const t=this.info.importPaths();if(0!==t.length)for(let n=0;n<t.length;n++){const r=t[n],{cleanUrl:s,version:a}=this.parseVersionFromImportPath(r);let i=r;"latest"===a&&(i=await this.resolveLatestVersion(r)),this.downloadedModules.has(i)?log4.info(`Module already downloaded: ${i}`):await this.addModule(this.projectModule.getModule(),i,t=>{e?.({modulePath:i,downloadPercentage:t.percentage})})}else log4.warn("No import paths configured - no modules will be downloaded")}parseVersionFromImportPath(e){try{const t=new URL(e),n=t.searchParams.get("version")||"latest";return t.searchParams.delete("version"),{cleanUrl:t.toString(),version:n}}catch(t){return log4.warn(`Failed to parse import path ${e}:`,t),{cleanUrl:e,version:"latest"}}}getThemeRegistryUrl(e){try{const t=new URL(e).hostname;return"sunwei.xyz"===t||"www.sunwei.xyz"===t?"https://sunwei.xyz/mdf/themes-zh.json":"https://gohugo.net/themes.json"}catch(t){return log4.warn(`Failed to parse import path ${e}, using default theme registry`),"https://gohugo.net/themes.json"}}async resolveLatestVersion(e){const{version:t}=this.parseVersionFromImportPath(e);if("latest"!==t)return e;try{const t=this.getThemeRegistryUrl(e);log4.info(`Fetching latest theme versions from ${t}...`);let n=this.themesCache.get(t);if(!n){const e=await this.httpClient.get(t),r=(new TextDecoder).decode(e.data),s=JSON.parse(r);n=Themes.fromJson(s),this.themesCache.set(t,n)}const r=n.resolveLatestVersion(e);return r!==e?log4.info(`Resolved latest version: ${e} -> ${r}`):log4.warn(`Could not resolve latest version for ${e}, using original path`),r}catch(t){return log4.error(`Failed to resolve latest version for ${e}:`,t),e}}async downloadModule(e,t){try{let n=e.version;if("latest"===e.version){const t=await this.resolveLatestVersion(e.path),{version:r}=this.parseVersionFromImportPath(t);n=r}const r=await this.moduleCache.get(e.path);if(r&&"completed"===r.downloadStatus&&this.isCacheValidForVersion(r.version,n)){const t=await this.createModuleFromCache(e,r);if(await t.exists())return log4.info(`Using cached module ${e.path} version ${r.version}`),t}r&&"completed"===r.downloadStatus&&!this.isCacheValidForVersion(r.version,n)&&log4.info(`Cache version mismatch for ${e.path}: cached=${r.version}, requested=${n||"latest"}`);const s=this.getModuleDir(e.path),a=path10.join(s,"module.zip"),i={path:e.path,version:e.version||"latest",url:e.url,dir:s,downloadStatus:"downloading",downloadedAt:new Date};await this.moduleCache.set(e.path,i);try{const n=this.addTimestampToUrl(e.url);await this.httpClient.download(n,a,{onProgress:e=>{t?.({percentage:e.percentage})}}),await this.zipExtractor.extract(a,s),i.downloadStatus="completed",i.downloadedAt=new Date;try{const e=await this.info.osFs().stat(a);i.size=e.size()}catch(e){}try{await this.info.osFs().remove(a)}catch(e){}await this.moduleCache.set(e.path,i);const r=newModule2(this.info.osFs(),s,e.path);return r.setMetadata(i),await r.applyMounts(e),r}catch(t){i.downloadStatus="failed",await this.moduleCache.set(e.path,i);const n=t instanceof Error?t.message:String(t);throw new ModuleError(`Failed to download module ${e.path}: ${n}`,"DOWNLOAD_FAILED")}}catch(e){if(e instanceof ModuleError)throw e;const t=e instanceof Error?e.message:String(e);throw new ModuleError(`Module download failed: ${t}`,"DOWNLOAD_FAILED")}}async addModule(e,t,n){try{if(this.downloadedModules.has(t))return;const{cleanUrl:e,version:r}=this.parseVersionFromImportPath(t),s={path:t,url:this.getDownloadUrl(e),...r&&{version:r}},a=await this.downloadModule(s,n);this.modules.push(a),this.downloadedModules.add(t);try{const e=await this.parseThemeToml(a);for(const t of e){if(this.downloadedModules.has(t)){log4.info(`Module ${t} already downloaded, skipping`);continue}log4.info(`Recursively downloading module dependency: ${t}`);const e=t,{cleanUrl:r,version:s}=this.parseVersionFromImportPath(e);let i=e;"latest"===s&&(i=await this.resolveLatestVersion(e)),await this.addModule(a,i,e=>{n?.({percentage:.5*e.percentage})})}}catch(e){const n=e instanceof Error?e.message:String(e);log4.warn(`Failed to process recursive imports for module ${t}: ${n}`)}}catch(e){const n=e instanceof Error?e.message:String(e);throw new ModuleError(`Failed to add module ${t}: ${n}`,"ADD_MODULE_FAILED")}}async createModuleFromCache(e,t){const n=newModule2(this.info.osFs(),t.dir,e.path);return n.setMetadata(t),await n.applyMounts(e),n}getModuleDir(e){const t=e.replace(/[/\\:*?"<>|]/g,"_").replace(/^_+|_+$/g,"");return path10.join(this.info.moduleDir(),t)}getDownloadUrl(e){return e}isCacheValidForVersion(e,t){return!t||e===t}addTimestampToUrl(e){try{const t=new URL(e),n=Date.now().toString();return t.searchParams.set("_t",n),t.toString()}catch(t){const n=e.includes("?")?"&":"?";return`${e}${n}_t=${Date.now()}`}}getModuleByPath(e){return this.modules.find(t=>t.path()===e)||null}isModuleDownloaded(e){return this.downloadedModules.has(e)}async getModuleStatus(e){const t=await this.moduleCache.get(e);return t?.downloadStatus||"pending"}async removeModule(e){try{const t=this.modules.findIndex(t=>t.path()===e);if(t>=0){const n=this.modules[t];try{await this.info.osFs().removeAll(n.dir())}catch(e){}this.modules.splice(t,1),this.downloadedModules.delete(e),await this.moduleCache.delete(e)}}catch(t){const n=t instanceof Error?t.message:String(t);throw new ModuleError(`Failed to remove module ${e}: ${n}`,"REMOVE_MODULE_FAILED")}}async clearAll(){try{for(const e of this.modules)try{await this.info.osFs().removeAll(e.dir())}catch(e){}this.modules=[],this.downloadedModules.clear(),await this.moduleCache.clear()}catch(e){const t=e instanceof Error?e.message:String(e);throw new ModuleError(`Failed to clear modules: ${t}`,"CLEAR_MODULES_FAILED")}}getSourceLang(e){return this.lang.getSourceLang(e)}async parseThemeToml(e){try{const t=path10.join(e.dir(),"theme.toml");try{if((await this.info.osFs().stat(t)).isDir())return[]}catch(e){return[]}let n;try{const e=await this.info.osFs().open(t);try{const t=[],r=new Uint8Array(4096);for(;;){const n=await e.read(r);if(0===n.bytesRead)break;t.push(r.slice(0,n.bytesRead))}const s=t.reduce((e,t)=>e+t.length,0),a=new Uint8Array(s);let i=0;for(const e of t)a.set(e,i),i+=e.length;n=new TextDecoder("utf-8").decode(a)}finally{await e.close()}}catch(t){const n=t instanceof Error?t.message:String(t);return log4.warn(`Failed to read theme.toml for module ${e.path()}: ${n}`),[]}const r=(0,import_smol_toml.parse)(n);return r.module?.imports?(log4.info(`Found ${r.module.imports.length} module imports in ${e.path()}/theme.toml`),r.module.imports.map(e=>e.path)):[]}catch(t){const n=t instanceof Error?t.message:String(t);return log4.warn(`Failed to parse theme.toml for module ${e.path()}: ${n}`),[]}}};function newModules(e,t,n,r){return new Modules(e,t,n,r)}init_log();var log5=getDomainLogger("module",{component:"factory"}),FsError=class extends Error{constructor(e,t){super(e),this.code=t,this.name="FsError"}},ErrFileClosed=new FsError("File is closed","FILE_CLOSED"),ErrFileNotFound=(new FsError("out of range","OUT_OF_RANGE"),new FsError("too large","TOO_LARGE"),new FsError("file not found","FILE_NOT_FOUND")),ErrSkipDir=(new FsError("file exists","FILE_EXISTS"),new FsError("destination exists","DESTINATION_EXISTS"),new Error("skip directory")),OverlayFsError=(new FsError("walkway already walked","ALREADY_WALKED"),class extends FsError{constructor(e,t){super(e,t),this.name="OverlayFsError"}}),ErrNoFilesystems=new OverlayFsError("no filesystems to write to","NO_FILESYSTEMS"),OriginFs=(new OverlayFsError("operation not supported","OPERATION_NOT_SUPPORTED"),class{source;origin;publishDir;constructor(e,t,n){this.source=e,this.origin=t,this.publishDir=n}getSource(){return this.source}getOrigin(){return this.origin}publish(){return this.publishDir}});init_log(),getDomainLogger("fs",{component:"filemeta"});var FileMeta=class{filename;componentRoot;componentDir;openFunc;constructor(e="",t=null){this.filename=e,this.componentRoot="",this.componentDir="",this.openFunc=t}fileName(){return this.filename}relativeFilename(){if(""===this.componentRoot)return this.filename;const e=this.filename.indexOf(this.componentRoot);if(-1===e)throw new Error(`filename ${this.filename} has no root ${this.componentRoot}`);let t=this.filename.substring(e+this.componentRoot.length);return t.startsWith("/")||(t="/"+t),t}component(){return this.componentDir}root(){return this.componentRoot}async open(){if(null===this.openFunc)throw new Error("OpenFunc not set");return await this.openFunc()}setFileName(e){this.filename=e}setComponentRoot(e){this.componentRoot=e}setComponentDir(e){this.componentDir=e}setOpenFunc(e){this.openFunc=e}merge(e){e&&(e.filename&&!this.filename&&(this.filename=e.filename),e.componentRoot&&!this.componentRoot&&(this.componentRoot=e.componentRoot),e.componentDir&&!this.componentDir&&(this.componentDir=e.componentDir),e.openFunc&&!this.openFunc&&(this.openFunc=e.openFunc))}};function newFileMeta(e,t){return new FileMeta(e,t)}var FileInfo=class{fileInfo;_fileMeta;constructor(e,t){this.fileInfo=e,this._fileMeta=t}meta(){return this._fileMeta}type(){return this.fileInfo.mode()}info(){return this.fileInfo}setMeta(e){this._fileMeta=e}name(){return this.fileInfo.name()}size(){return this.fileInfo.size()}mode(){return this.fileInfo.mode()}modTime(){return this.fileInfo.modTime()}isDir(){return this.fileInfo.isDir()}sys(){return this.fileInfo.sys()}fileName(){return this._fileMeta.fileName()}relativeFilename(){return this._fileMeta.relativeFilename()}component(){return this._fileMeta.component()}root(){return this._fileMeta.root()}async open(){return await this._fileMeta.open()}};function newFileInfo(e,t){const n=newFileMeta(t),r=new FileInfo(e,n);return isMetaProvider(e)&&r.meta().merge(e.meta()),r}function newFileInfoWithMeta(e,t){const n=new FileInfo(e,t);return isMetaProvider(e)&&n.meta().merge(e.meta()),n}function isMetaProvider(e){return e&&"function"==typeof e.meta}var path11=__toESM(require("path")),File=class{file;fileMeta;fs;_isDir;constructor(e,t,n,r=!1){this.file=e,this.fileMeta=t,this.fs=n,this._isDir=r}isNop(){return null===this.file}async close(){if(null!==this.file)return await this.file.close()}async readDir(e){const t=[];if(this._isDir&&this.file){const n=await this.file.readdir(e);for(const e of n){const n=this.joinPath(this.fileMeta.fileName(),e.name()),r=newFileMeta(n,async()=>await this.fs.open(n));r.merge(this.fileMeta);const s=newFileInfo(e,n);s.setMeta(r),t.push(s)}}return t}meta(){return this.fileMeta}joinPath(e,t){return e.endsWith("/")?e+t:e+"/"+t}async read(e){if(null===this.file)throw new Error("File is null");return await this.file.read(e)}async readAt(e,t){if(null===this.file)throw new Error("File is null");return await this.file.readAt(e,t)}async seek(e,t){if(null===this.file)throw new Error("File is null");return await this.file.seek(e,t)}async write(e){if(null===this.file)throw new Error("File is null");return await this.file.write(e)}async writeAt(e,t){if(null===this.file)throw new Error("File is null");return await this.file.writeAt(e,t)}name(){return path11.basename(this.fileMeta.fileName())}async readdir(e){if(null===this.file)throw new Error("File is null");return await this.readDir(e)}async readdirnames(e){if(null===this.file)throw new Error("File is null");return await this.file.readdirnames(e)}async stat(){if(null===this.file)throw new Error("File is null");return await this.file.stat()}async sync(){if(null!==this.file)return await this.file.sync()}async truncate(e){if(null===this.file)throw new Error("File is null");return await this.file.truncate(e)}async writeString(e){if(null===this.file)throw new Error("File is null");return await this.file.writeString(e)}},DirFile=class extends File{virtualOpener;filter;constructor(e,t=null,n=null){super(e.isNop()?null:e,e.meta(),e.fs,!0),this.virtualOpener=t,this.filter=n}async readDir(e){if(!this.isNop()){let t=await super.readDir(e);return null!==this.filter&&(t=await this.filter(t)),t}return await this.readVirtualDir()}async readVirtualDir(){if(null!==this.virtualOpener)return await this.virtualOpener();throw new Error("virtual dir opener not found")}setFilter(e){this.filter=e}setVirtualOpener(e){this.virtualOpener=e}getFilter(){return this.filter}getVirtualOpener(){return this.virtualOpener}},path12=__toESM(require("path"));init_log(),getDomainLogger("fs",{component:"basefs"});var BaseFs=class{fs;roots;constructor(e,t){this.fs=e,this.roots=t}toAbsolutePath(e){if(0===this.roots.length)return e;const t=this.roots[0];return""===e?t:path12.isAbsolute(e)?e.startsWith(t)?e:path12.join(t,e.substring(1)):path12.join(t,e)}isSameRootedPath(e){const t=this.roots[0];return e.startsWith(path12.join(t,path12.sep))||e===t}async stat(e){const t=this.toAbsolutePath(e);if(!this.isSameRootedPath(t))throw new Error(`path ${e} is outside of the BaseFs root`);try{const n=await this.fs.stat(t);if(n.isDir()){const r=newFileInfo(n,t);return r.meta().setOpenFunc(async()=>await this.openDir(e)),r}const r=newFileInfo(n,t),s=this.getRoot(t);return r.meta().setComponentRoot(s),r.meta().setOpenFunc(async()=>await this.openInternal(e)),r}catch(e){throw e}}async open(e){const t=this.toAbsolutePath(e);return(await this.fs.stat(t)).isDir()?await this.openDir(e):await this.openInternal(e)}async openInternal(e,t=!1){const n=this.toAbsolutePath(e),r=await this.fs.open(n),s=this.getRoot(n),a=newFileMeta(n);return a.setComponentRoot(s),t?function(e,t,n){return new File(e,t,n,!0)}(r,a,this.fs):function(e,t,n){return new File(e,t,n)}(r,a,this.fs)}getRoot(e){for(const t of this.roots)if(e.startsWith(t))return t;return""}async openDir(e){const t=await this.openInternal(e,!0),n=this.toAbsolutePath(e),r=this.getRoot(n),s=newFileMeta(n);return s.setComponentRoot(r),function(e,t,n){const r=new File(e,t,n,!0);return new DirFile(r)}(t,s,this.fs)}async create(e){const t=this.toAbsolutePath(e);return await this.fs.create(t)}async mkdir(e,t){const n=this.toAbsolutePath(e);return await this.fs.mkdir(n,t)}async mkdirAll(e,t){const n=this.toAbsolutePath(e);return await this.fs.mkdirAll(n,t)}async openFile(e,t,n){const r=this.toAbsolutePath(e);return await this.fs.openFile(r,t,n)}async remove(e){const t=this.toAbsolutePath(e);return await this.fs.remove(t)}async removeAll(e){const t=this.toAbsolutePath(e);return await this.fs.removeAll(t)}async rename(e,t){const n=this.toAbsolutePath(e),r=this.toAbsolutePath(t);return await this.fs.rename(n,r)}name(){return`BaseFs(${this.fs.name()})`}async chmod(e,t){const n=this.toAbsolutePath(e);return await this.fs.chmod(n,t)}async chown(e,t,n){const r=this.toAbsolutePath(e);return await this.fs.chown(r,t,n)}async chtimes(e,t,n){const r=this.toAbsolutePath(e);return await this.fs.chtimes(r,t,n)}};function newBaseFs(e,t){return new BaseFs(e,t)}var path13=__toESM(require("path"));init_log();var log8=getDomainLogger("fs",{component:"walkway"}),Walkway=class{fs;root;cb;cfg;walked=!1;constructor(e,t){if(!e)throw new Error("fs must be set");if(!t.walkFn)throw new Error("walkFn must be set");this.fs=e,this.cb=t,this.root="",this.cfg={}}async walkWith(e,t){return this.cfg=t,this.root=e,await this.walk()}async walk(){if(this.walked)throw new Error("this walkway is already walked");return this.walked=!0,await this.walkRecursive(this.root,this.cfg.info,this.cfg.dirEntries)}checkErr(e,t){return!(!this.isNotExistError(t)||this.cfg.failOnNotExist||(log8.warn(`File "${e}" not found, skipping.`),0))}isNotExistError(e){return e.message.includes("ENOENT")||e.message.includes("no such file")||"ENOENT"===e.code}async walkRecursive(e,t,n){if(!t)try{const n=await this.fs.stat(e),r=newFileMeta(e);r.setOpenFunc(async()=>await this.fs.open(e)),t=newFileInfoWithMeta(n,r)}catch(t){if(e===this.root&&this.isNotExistError(t)){if(this.cfg.failOnNotExist)throw new FsError(`walk: root not found: ${t.message}`,"WALK_ROOT_NOT_FOUND");return}if(this.checkErr(e,t))return;throw new FsError(`walk: stat: ${t.message}`,"WALK_STAT_FAILED")}try{const n=await this.cb.walkFn(e,t);if(n instanceof Error)throw n}catch(e){if(t.isDir()&&e===ErrSkipDir)return;throw e}if(t.isDir()){if(!n)try{const t=await this.fs.open(e),r=await t.readdir(-1);await t.close(),n=r.map(e=>e),this.cfg.sortDirEntries&&n.sort((e,t)=>e.name().localeCompare(t.name()))}catch(t){if(this.checkErr(e,t))return;throw new FsError(`walk: readdir: ${t.message}`,"WALK_READDIR_FAILED")}if(this.cfg.ignoreFile&&(n=n.filter(e=>!this.cfg.ignoreFile(e.fileName()))),this.cb.hookPre)try{n=await this.cb.hookPre(t,e,n)}catch(e){if(e===ErrSkipDir)return;throw e}for(const t of n){const n=path13.join(e,t.name());try{await this.walkRecursive(n,t)}catch(e){if(!t.isDir()||e!==ErrSkipDir)throw e}}if(this.cb.hookPost)try{await this.cb.hookPost(t,e,n)}catch(e){if(e===ErrSkipDir)return;throw e}}}};init_log();var log9=getDomainLogger("fs",{component:"static-copier"}),StaticCopier=class{fromFss;toFs;constructor(e,t){this.fromFss=e,this.toFs=t}async copy(){this.fromFss&&0!==this.fromFss.length?this.toFs?await this.doWithPublishDirs(this.toFs,async e=>{for(const t of this.fromFss)await this.copyStaticTo(t,e)}):log9.error("No publish filesystem found"):log9.error("No static filesystems found")}async doWithPublishDirs(e,t){try{await t("/")}catch(e){throw log9.error("Error in doWithPublishDirs:",e),e}}async copyStaticTo(e,t){try{return await this.walkSourceFiles(e,t)}catch(e){throw log9.error(`Error copying static files to ${t}:`,e),e}}async walkSourceFiles(e,t){let n=0;try{await this.walkFileSystem(e,"/",async(r,s)=>{s||(await this.copyFile(e,r,this.toFs,t),n++)})}catch(e){throw log9.error("Error walking source files:",e),e}return n}async walkFileSystem(e,t,n){try{const r=await e.open(t);if(!(await r.stat()).isDir())return await r.close(),void await n(t,!1);const s=await r.readdir(-1);await r.close();for(const r of s){const s=this.joinPath(t,r.name());r.isDir()?(await n(s,!0),await this.walkFileSystem(e,s,n)):await n(s,!1)}}catch(e){log9.error(`Could not read directory ${t}:`,e)}}async copyFile(e,t,n,r){let s=null,a=null;try{const i=t.startsWith("/")?t.slice(1):t,o=this.joinPath(r,i),l=this.dirname(o);"/"!==l&&await n.mkdirAll(l,493),s=await e.open(t);const c=await s.stat(),u=new Uint8Array(c.size());await s.read(u),a=await n.create(o),await a.write(u)}catch(e){log9.warn(`Failed to copy static file ${t}:`,e)}finally{if(a)try{await a.close()}catch(e){log9.warn(`Failed to close target file: ${e}`)}if(s)try{await s.close()}catch(e){log9.warn(`Failed to close source file: ${e}`)}}}joinPath(...e){return e.map(e=>e.replace(/^\/+|\/+$/g,"")).filter(e=>e.length>0).join("/").replace(/^/,"/")}dirname(e){const t=e.split("/").filter(e=>e.length>0);return t.length<=1?"/":"/"+t.slice(0,-1).join("/")}};init_log();var log10=getDomainLogger("fs",{component:"incremental-file-collector"});async function createFileMetaInfo(e,t){try{const n=await t.stat(e),r=newFileMeta(e);return r.setOpenFunc(async()=>await t.open(e)),newFileInfoWithMeta(n,r)}catch(t){throw new Error(`Failed to stat file ${e}: ${t.message}`)}}var Fs2=class{originFs;prompts;workflows;content;layouts;statics;assets;i18n;work;service;constructor(e,t,n,r,s,a,i,o,l){this.originFs=e,this.prompts=t,this.workflows=n,this.content=r,this.layouts=s,this.statics=a,this.assets=i,this.i18n=o,this.work=l,this.service=new Service3}os(){return this.originFs.getOrigin()}workFs(){return this.work}workflowFs(){return this.workflows}promptFs(){return this.prompts}contentFs(){return this.content}layoutsFs(){return this.layouts}staticFs(){return this.statics}assetsFs(){return this.assets}publishFs(){return this.originFs.publish()}copyStatic(e,t){return new StaticCopier(e,t).copy()}newFileMetaInfo(e){return this.service.newFileMetaInfo(e)}newFileMetaInfoWithContent(e){return this.service.newFileMetaInfoWithContent(e)}async getFileMetaInfos(e){return async function(e,t){const n=new Map;let r=!1;for(const s of e)for(const e of t)try{const t=await createFileMetaInfo(s,e);if(n.set(s,t),r=!0,r)break}catch(t){log10.error(`Failed to create FileMetaInfo for ${s} with fs=${e}:`,t)}return n}(e,this.content)}newBasePathFs(e,t){return newBaseFs(e,[t])}async walkPrompts(e,t,n){return await this.walk(this.prompts,e,t,n)}async walkWorkflows(e,t,n){return await this.walk(this.workflows,e,t,n)}async walkLayouts(e,t,n){return await this.walk(this.layouts,e,t,n)}async walkContent(e,t,n,r){await this.walk(e,t,n,r)}async walkStatics(e,t,n){return await this.walk(this.statics,e,t,n)}async walkI18n(e,t,n){return await this.walk(this.i18n,e,t,n)}async walk(e,t,n,r){const s=function(e,t){return new Walkway(e,t)}(e,n);return""===t&&(t="/"),await s.walkWith(t,r)}},defaultDirMerger=(e,t)=>{const n=[...e];for(const r of t){let t=!1;for(const n of e)if(r.name()===n.name()){t=!0;break}t||n.push(r)}return n},OverlayOptions=class e{fss;firstWritable;dirsMerger;constructor(e){this.fss=[...e.fss],this.firstWritable=e.firstWritable??!1,this.dirsMerger=e.dirsMerger??defaultDirMerger}withFilesystems(...t){return new e({fss:[...this.fss,...t],firstWritable:this.firstWritable,dirsMerger:this.dirsMerger})}withFirstWritable(t){return new e({fss:this.fss,firstWritable:t,dirsMerger:this.dirsMerger})}withDirsMerger(t){return new e({fss:this.fss,firstWritable:this.firstWritable,dirsMerger:t})}getWritableFs(){return this.firstWritable&&0!==this.fss.length?this.fss[0]:null}isValid(){return void 0!==this.dirsMerger}getFilesystemCount(){return this.fss.length}getFilesystem(e){return e<0||e>=this.fss.length?null:this.fss[e]}hasFilesystem(e){return this.fss.includes(e)}getFilesystems(){return this.fss}};function newOverlayOptions(e,t=!1,n){const r={fss:e,firstWritable:t};return void 0!==n&&(r.dirsMerger=n),new OverlayOptions(r)}function createDefaultOverlayOptions(e){return newOverlayOptions(e,!1,defaultDirMerger)}var OverlayDir=class{_name;fss;dirOpeners;info;merge;err;offset;fis;closed;constructor(e={}){this._name=e.name||"",this.fss=e.fss?[...e.fss]:[],this.dirOpeners=e.dirOpeners?[...e.dirOpeners]:[],void 0!==e.info&&(this.info=e.info),this.merge=e.merge||defaultDirMerger,this.offset=0,this.fis=[],this.closed=!1}name(){return this._name}isClosed(){return this.closed||0===this.fss.length&&0===this.dirOpeners.length}async readdir(e){if(this.isClosed())throw ErrFileClosed;if(this.err)throw this.err;0===this.offset&&await this.loadDirectoryEntries();const t=this.fis.slice(this.offset);if(e<=0){if(this.err=new Error("EOF"),this.offset>0&&0===t.length)throw this.err;return[...t]}if(0===t.length)throw this.err=new Error("EOF"),this.err;const n=t.slice(0,e);return this.offset+=n.length,n}async readdirnames(e){if(this.isClosed())throw ErrFileClosed;return(await this.readdir(e)).map(e=>e.name())}async loadDirectoryEntries(){for(let e=0;e<this.fss.length;e++){const t=this.fss[e];await this.readFromFilesystem(t,null)}for(let e=0;e<this.dirOpeners.length;e++){const t=await this.dirOpeners[e]();await this.readFromFilesystem(null,t)}}async readFromFilesystem(e,t){let n=t;try{if(!n&&e){const t="/"===this._name?"":this._name;n=await e.open(t)}if(!n)return;const t=await n.readdir(-1);this.fis=this.merge(this.fis,t)}catch(e){}finally{n&&!t&&await n.close()}}async stat(){if(this.isClosed())throw ErrFileClosed;if(this.info)return await this.info();if(this.fss.length>0)return await this.fss[0].stat(this._name);throw new OverlayFsError("no filesystem available for stat","NO_FILESYSTEM")}async close(){this.closed=!0,this.fss=[],this.dirOpeners=[],this.fis=[],delete this.info,this.offset=0,delete this.err}notSupported(e){throw new OverlayFsError(`operation ${e} not supported on directory "${this._name}"`,"OPERATION_NOT_SUPPORTED")}async read(e){this.notSupported("read")}async readAt(e,t){this.notSupported("readAt")}async seek(e,t){this.notSupported("seek")}async write(e){this.notSupported("write")}async writeAt(e,t){this.notSupported("writeAt")}async sync(){this.notSupported("sync")}async truncate(e){this.notSupported("truncate")}async writeString(e){this.notSupported("writeString")}},dirPool=new class{pool=[];get(){return this.pool.length>0?this.pool.pop():new OverlayDir}release(e){e.fss=[],e.dirOpeners=[],e.fis=[],delete e.info,e.offset=0,e._name="",delete e.err,e.closed=!1,this.pool.push(e)}};init_log(),getDomainLogger("fs",{component:"overlayfs"});var OverlayFs=class e{fss;mergeDirs;firstWritable;constructor(e){this.fss=[...e.fss],this.mergeDirs=e.dirsMerger,this.firstWritable=e.firstWritable}name(){return"overlayfs"}filesystem(e){return e<0||e>=this.fss.length?null:this.fss[e]}numFilesystems(){return this.fss.length}append(...t){const n=new OverlayOptions({fss:[...this.fss,...t],firstWritable:this.firstWritable,dirsMerger:this.mergeDirs});return new e(n)}withDirsMerger(t){const n=new OverlayOptions({fss:this.fss,firstWritable:this.firstWritable,dirsMerger:t});return new e(n)}writeFs(){if(0===this.fss.length)throw ErrNoFilesystems;return this.fss[0]}async collectDirs(e,t){for(const n of this.fss)await this.collectDirsRecursive(n,e,t)}async collectDirsRecursive(e,t,n){try{(await e.stat(t)).isDir()&&n(e)}catch(e){}const r=e;if(r.filesystem&&r.numFilesystems)for(let e=0;e<r.numFilesystems();e++){const s=r.filesystem(e);s&&await this.collectDirsRecursive(s,t,n)}}async statInternal(e,t){for(let n=0;n<this.fss.length;n++){const r=this.fss[n],[s,a,i,o]=await this.statRecursive(r,e,t);if(null===o||!this.isNotExistError(o))return[s,a,i,o]}return[null,null,!1,ErrFileNotFound]}async statRecursive(e,t,n){try{const n=await e.stat(t);return[e,n,!1,null]}catch(t){if(!this.isNotExistError(t))return[e,null,!1,t]}const r=e;if(r.filesystem&&r.numFilesystems)for(let e=0;e<r.numFilesystems();e++){const s=r.filesystem(e);if(s){const[e,r,a,i]=await this.statRecursive(s,t,n);if(null===i||!this.isNotExistError(i))return[e,r,a,i]}}return[null,null,!1,ErrFileNotFound]}isNotExistError(e){return e.message.includes("ENOENT")||e.message.includes("no such file")||e===ErrFileNotFound}async create(e){if(!this.firstWritable)throw new OverlayFsError("filesystem is read-only","READ_ONLY");return await this.writeFs().create(e)}async mkdir(e,t){if(!this.firstWritable)throw new OverlayFsError("filesystem is read-only","READ_ONLY");return await this.writeFs().mkdir(e,t)}async mkdirAll(e,t){if(!this.firstWritable)throw new OverlayFsError("filesystem is read-only","READ_ONLY");return await this.writeFs().mkdirAll(e,t)}async open(e){if(0===this.fss.length)throw ErrFileNotFound;const[t,n,,r]=await this.statInternal(e,!1);if(r)throw r;if(n.isDir()){const t=[];if(await this.collectDirs(e,e=>{t.push(e)}),0===t.length)throw ErrFileNotFound;return 1===t.length?await t[0].open(e):await async function(e,t,n,r){if(!n)throw new OverlayFsError("info function must not be null","INFO_REQUIRED");const s=dirPool.get(),a={name:e,fss:[...r],info:n,merge:t||defaultDirMerger};return Object.assign(s,new OverlayDir(a)),s}(e,this.mergeDirs,async()=>n,t)}return await t.open(e)}async openFile(e,t,n){const r=!!(1&t)||!!(2&t);if(r&&!this.firstWritable)throw new OverlayFsError("filesystem is read-only","READ_ONLY");return r?await this.writeFs().openFile(e,t,n):await this.open(e)}async remove(e){if(!this.firstWritable)throw new OverlayFsError("filesystem is read-only","READ_ONLY");return await this.writeFs().remove(e)}async removeAll(e){if(!this.firstWritable)throw new OverlayFsError("filesystem is read-only","READ_ONLY");return await this.writeFs().removeAll(e)}async rename(e,t){if(!this.firstWritable)throw new OverlayFsError("filesystem is read-only","READ_ONLY");return await this.writeFs().rename(e,t)}async stat(e){const t="/"===e?"":e,[,n,,r]=await this.statInternal(t,!1);if(r)throw r;return n}async chmod(e,t){if(!this.firstWritable)throw new OverlayFsError("filesystem is read-only","READ_ONLY");return await this.writeFs().chmod(e,t)}async chown(e,t,n){if(!this.firstWritable)throw new OverlayFsError("filesystem is read-only","READ_ONLY");return await this.writeFs().chown(e,t,n)}async chtimes(e,t,n){if(!this.firstWritable)throw new OverlayFsError("filesystem is read-only","READ_ONLY");return await this.writeFs().chtimes(e,t,n)}};function newOverlayFs(e){return new OverlayFs(e)}var VirtualFileInfo=class{_name;_content;_modTime;constructor(e,t="This is a virtual file."){this._name=e,this._content=t,this._modTime=new Date}name(){return this._name}size(){return Buffer.byteLength(this._content,"utf8")}mode(){return 420}modTime(){return this._modTime}isDir(){return!1}sys(){return null}getContent(){return this._content}},VirtualFile=class{_fileName;_fileContent;_fileInfo=null;constructor(e,t){this._fileName=e,this._fileContent=t}fullName(){return this._fileName}async open(){return{name:()=>this._fileName,close:async()=>{},read:async e=>{const t=Buffer.from(this._fileContent,"utf8"),n=Math.min(e.length,t.length);return t.copy(e,0,0,n),{bytesRead:n,buffer:e}},readAt:async(e,t)=>{const n=Buffer.from(this._fileContent,"utf8"),r=Math.min(t,n.length),s=Math.min(e.length,n.length-r);return s>0&&n.copy(e,0,r,r+s),{bytesRead:s,buffer:e}},seek:async(e,t)=>e,write:async e=>({bytesWritten:e.length,buffer:e}),writeAt:async(e,t)=>({bytesWritten:e.length,buffer:e}),readdir:async e=>[],readdirnames:async e=>[],stat:async()=>this.getFileInfo(),sync:async()=>{},truncate:async e=>{},writeString:async e=>({bytesWritten:Buffer.byteLength(e,"utf8")})}}getFileInfo(){return this._fileInfo||(this._fileInfo=new VirtualFileInfo(this._fileName,this._fileContent)),this._fileInfo}},globalVirtualFile=null;var Service3=class{newFileMetaInfo(e){return function(e){const t=(globalVirtualFile||(globalVirtualFile=new VirtualFile("/content/file.txt","This is a virtual file.")),globalVirtualFile.getFileInfo()),n=newFileMeta(e);return new FileInfo(t,n)}(e)}newFileMetaInfoWithContent(e){return function(e){const t=function(e){const t=Math.floor(1e6*Math.random()).toString().padStart(6,"0");return new VirtualFile(`/content/file_${t}.md`,e)}(e),n=t.getFileInfo(),r=newFileMeta(t.fullName(),()=>t.open());return r.setComponentRoot("content"),r.setComponentDir("content"),new FileInfo(n,r)}(e)}},Factory=class{create(e){return newOverlayFs(createDefaultOverlayOptions(e))}createWithOptions(e){return function(e){const t=new OverlayOptions(e);return new OverlayFs(t)}(e)}createReadOnly(e){return newOverlayFs(createDefaultOverlayOptions(e))}createWritable(e){const t=function(e){return newOverlayOptions(e,!0,void 0)}(e);return newOverlayFs(t)}createWithMerger(e,t){return newOverlayFs(createDefaultOverlayOptions(e).withDirsMerger(t))}};function createReadOnlyOverlayFs(e){return(new Factory).createReadOnly(e)}var path14=__toESM(require("path"));init_log(),getDomainLogger("fs",{component:"filesystemscollector"});var RootMapping=class{from;to;toBase;constructor(e,t,n=""){this.from=e,this.to=t,this.toBase=n}fs(e){return newBaseFs(e,[this.to])}},FilesystemsCollector=class{sourceProject;overlayMountsPrompt;overlayMountsWorkflow;overlayMountsContent;overlayMountsLayouts;overlayMountsStatics;overlayMountsAssets;overlayMountsI18n;constructor(e){this.sourceProject=e,this.overlayMountsPrompt=createReadOnlyOverlayFs([]),this.overlayMountsWorkflow=createReadOnlyOverlayFs([]),this.overlayMountsContent=[],this.overlayMountsLayouts=createReadOnlyOverlayFs([]),this.overlayMountsStatics=createReadOnlyOverlayFs([]),this.overlayMountsAssets=createReadOnlyOverlayFs([]),this.overlayMountsI18n=createReadOnlyOverlayFs([])}async collect(e){const t=e.all();for(const e of t){const t=[],n=[],r=[],s=[],a=[],i=[],o=[],l=t=>path14.isAbsolute(t)?["",t]:[e.dir(),this.absPathify(e.dir(),t)],c=e.mounts();for(const e of c){const[c,u]=l(e.source()),h=new RootMapping(e.target(),u,c).fs(this.sourceProject);this.isPrompts(e.target())?n.push(h):this.isWorkflows(e.target())?t.push(h):this.isContent(e.target())?r.push(h):this.isLayouts(e.target())?s.push(h):this.isStatics(e.target())?a.push(h):this.isAssets(e.target())?i.push(h):this.isI18n(e.target())&&o.push(h)}if(t.length>0&&(this.overlayMountsWorkflow=this.overlayMountsWorkflow.append(...t)),n.length>0&&(this.overlayMountsPrompt=this.overlayMountsPrompt.append(...n)),e.isProjectModule())for(const e of r){let t=createReadOnlyOverlayFs([]);t=t.append(e),this.overlayMountsContent.push(t)}s.length>0&&(this.overlayMountsLayouts=this.overlayMountsLayouts.append(...s)),a.length>0&&(this.overlayMountsStatics=this.overlayMountsStatics.append(...a)),i.length>0&&(this.overlayMountsAssets=this.overlayMountsAssets.append(...i)),o.length>0&&(this.overlayMountsI18n=this.overlayMountsI18n.append(...o))}}isPrompts(e){return"prompts"===e||e.startsWith("prompts/")||e.startsWith("/prompts/")}isWorkflows(e){return"workflows"===e||e.startsWith("workflows/")||e.startsWith("/workflows/")}isContent(e){return"content"===e||e.startsWith("content/")||e.startsWith("/content/")}isLayouts(e){return"layouts"===e||e.startsWith("layouts/")||e.startsWith("/layouts/")}isStatics(e){return"static"===e||e.startsWith("static/")||e.startsWith("/static/")}isAssets(e){return"assets"===e||e.startsWith("assets/")||e.startsWith("/assets/")}isI18n(e){return"i18n"===e||e.startsWith("i18n/")||e.startsWith("/i18n/")}absPathify(e,t){return path14.resolve(e,t)}},fs=__toESM(require("fs/promises")),path15=__toESM(require("path"));init_log();var log13=getDomainLogger("fs",{component:"osfs"}),OsFileInfo=class{constructor(e,t){this.stats=e,this._name=t}name(){return this._name}size(){return this.stats.size}mode(){return this.stats.mode}modTime(){return this.stats.mtime}isDir(){return this.stats.isDirectory()}sys(){return this.stats}},OsFile=class{constructor(e,t="r"){this.filePath=e,this.flags=t}handle=null;closed=!1;position=0;async ensureOpen(){this.handle||this.closed||(this.handle=await fs.open(this.filePath,this.flags))}async close(){if(this.handle){try{await this.handle.close()}catch(e){throw log13.error(`❌ Error closing file handle for ${this.filePath}:`,e),e}this.handle=null}this.closed=!0}async read(e){if(this.closed)throw new Error("File is closed");if(await this.ensureOpen(),!this.handle)throw new Error("Failed to open file");const t=await this.handle.read(e,0,e.length,this.position);return this.position+=t.bytesRead,{bytesRead:t.bytesRead,buffer:e}}async readAt(e,t){if(this.closed)throw new Error("File is closed");if(await this.ensureOpen(),!this.handle)throw new Error("Failed to open file");return{bytesRead:(await this.handle.read(e,0,e.length,t)).bytesRead,buffer:e}}async seek(e,t){if(this.closed)throw new Error("File is closed");switch(t){case 0:default:this.position=e;break;case 1:this.position+=e;break;case 2:if(await this.ensureOpen(),this.handle){const t=await this.handle.stat();this.position=t.size+e}}return this.position}async write(e){if(this.closed)throw new Error("File is closed");if(await this.ensureOpen(),!this.handle)throw new Error("Failed to open file");const t=await this.handle.write(e,0,e.length,this.position);return this.position+=t.bytesWritten,{bytesWritten:t.bytesWritten,buffer:e}}async writeAt(e,t){if(this.closed)throw new Error("File is closed");if(await this.ensureOpen(),!this.handle)throw new Error("Failed to open file");return{bytesWritten:(await this.handle.write(e,0,e.length,t)).bytesWritten,buffer:e}}name(){return this.filePath}async readdir(e){if(this.closed)throw new Error("File is closed");const t=await fs.readdir(this.filePath,{withFileTypes:!0}),n=[],r=e>0?Math.min(e,t.length):t.length;for(let e=0;e<r;e++){const r=t[e],s=path15.join(this.filePath,r.name),a=await fs.stat(s);n.push(new OsFileInfo(a,r.name))}return n}async readdirnames(e){if(this.closed)throw new Error("File is closed");const t=await fs.readdir(this.filePath);return e>0?t.slice(0,e):t}async stat(){if(this.closed)throw new Error("File is closed");const e=await fs.stat(this.filePath);return new OsFileInfo(e,path15.basename(this.filePath))}async sync(){if(this.closed)throw new Error("File is closed");await this.ensureOpen(),this.handle&&await this.handle.sync()}async truncate(e){if(this.closed)throw new Error("File is closed");await this.ensureOpen(),this.handle&&(await this.handle.truncate(e),this.position>e&&(this.position=e))}async writeString(e){const t=Buffer.from(e,"utf8");return{bytesWritten:(await this.write(t)).bytesWritten}}},OsFs=class{async create(e){return await fs.writeFile(e,""),new OsFile(e,"w+")}async mkdir(e,t){await fs.mkdir(e,{mode:t})}async mkdirAll(e,t){await fs.mkdir(e,{mode:t,recursive:!0})}async open(e){return await fs.access(e),(await fs.stat(e)).isDirectory(),new OsFile(e,"r")}async openFile(e,t,n){let r="r";return 1&t&&(r="w"),2&t&&(r="r+"),64&t&&(r="w"),512&t&&(r="w"),1024&t&&(r="a"),new OsFile(e,r)}async remove(e){(await fs.stat(e)).isDirectory()?await fs.rmdir(e):await fs.unlink(e)}async removeAll(e){await fs.rm(e,{recursive:!0,force:!0})}async rename(e,t){await fs.rename(e,t)}async stat(e){const t=await fs.stat(e);return new OsFileInfo(t,path15.basename(e))}name(){return"OsFs"}async chmod(e,t){await fs.chmod(e,t)}async chown(e,t,n){await fs.chown(e,t,n)}async chtimes(e,t,n){await fs.utimes(e,t,n)}};async function createFs(e,t){const n=function(e){const t=e.osFs,n=e.osFs,r=newBaseFs(e.osFs,[e.publish]);return new OriginFs(t,n,r)}(e),r=await async function(e,t){const n=(r=e.getSource(),new FilesystemsCollector(r));var r;return await n.collect(t),n}(n,t),s=newBaseFs(e.osFs,[e.path]);return new Fs2(n,r.overlayMountsPrompt,r.overlayMountsWorkflow,r.overlayMountsContent,r.overlayMountsLayouts,r.overlayMountsStatics,r.overlayMountsAssets,r.overlayMountsI18n,s)}var PageKind_PAGE="page",PageKind_HOME="home",PageKind_SECTION="section",PageKind_TAXONOMY="taxonomy",PageKind_TERM="term",PageKind_SITEMAP="sitemap",PageKind_STATUS_404="404",BufWriter=class{buffer;position;capacity;constructor(e=1024){this.capacity=e,this.buffer=new Uint8Array(this.capacity),this.position=0}async write(e){this.ensureCapacity(e.length),this.buffer.set(e,this.position),this.position+=e.length}async writeString(e){const t=(new TextEncoder).encode(e);await this.write(t)}async writeByte(e){this.ensureCapacity(1),this.buffer[this.position]=e,this.position++}bytes(){return this.buffer.slice(0,this.position)}length(){return this.position}truncate(e){if(e<0||e>this.position)throw new Error("Invalid truncate size");this.position=e}ensureCapacity(e){const t=this.position+e;if(t<=this.capacity)return;const n=Math.max(2*this.capacity,t),r=new Uint8Array(n);r.set(this.buffer),this.buffer=r,this.capacity=n}},TableOfContentsImpl=class{constructor(e=[]){this.fragments=e}toHTML(e,t,n){if(0===this.fragments.length)return"";const r=this.filterByLevel(this.fragments,e,t);if(0===r.length)return"";const s=n?"ol":"ul";return`<${s}>\n${this.renderFragments(r,n)}</${s}>\n`}filterByLevel(e,t,n){return e.filter(e=>e.level>=t&&e.level<=n).map(e=>{const r={id:e.id,text:e.text,level:e.level};return e.children&&(r.children=this.filterByLevel(e.children,t,n)),r})}renderFragments(e,t){const n=t?"ol":"ul";return e.map(e=>{let r=` <li><a href="#${e.id}">${this.escapeHTML(e.text)}</a>`;return e.children&&e.children.length>0&&(r+=`\n <${n}>\n${this.renderFragments(e.children,t)} </${n}>`),r+="</li>",r}).join("\n")}escapeHTML(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}addFragment(e){this.fragments.push(e)}getFragments(){return[...this.fragments]}},HeaderImpl=class{constructor(e,t,n=[],r=[],s=[]){this._name=e,this._level=t,this._links=n,this._paragraphs=r,this._listParagraphs=s}name(){return this._name}level(){return this._level}links(){return[...this._links]}paragraphs(){return[...this._paragraphs]}listParagraphs(){return[...this._listParagraphs]}addLink(e){this._links.push(e)}addParagraph(e){this._paragraphs.push(e)}addListParagraph(e){this._listParagraphs.push(e)}},TOCBuilder=class{fragments=[];stack=[];addHeading(e,t,n){for(;this.stack.length>0&&this.stack[this.stack.length-1].level>=t;)this.stack.pop();const r={id:n,text:e,level:t,children:[]};if(0===this.stack.length)this.fragments.push(r);else{const e=this.stack[this.stack.length-1];e.children||(e.children=[]),e.children.push(r)}this.stack.push(r)}build(){return new TableOfContentsImpl(this.fragments)}reset(){this.fragments=[],this.stack=[]}},AutoIDGenerator=class{usedIds=new Set;generateID(e,t="github"){let n;switch(t){case"github":default:n=this.githubStyle(e);break;case"github-ascii":n=this.githubAsciiStyle(e);break;case"blackfriday":n=this.blackfridayStyle(e)}if(this.usedIds.has(n)){let e=1,t=`${n}-${e}`;for(;this.usedIds.has(t);)e++,t=`${n}-${e}`;n=t}return this.usedIds.add(n),n}githubStyle(e){return e.toLowerCase().replace(/[^\w\u4e00-\u9fff\s-]/g,"").replace(/\s+/g,"-").replace(/^-+|-+$/g,"")}githubAsciiStyle(e){return e.toLowerCase().replace(/[^\w\s-]/g,"").replace(/\s+/g,"-").replace(/^-+|-+$/g,"")}blackfridayStyle(e){return e.toLowerCase().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/^-+|-+$/g,"")}reset(){this.usedIds.clear()}},HighlightResultImpl=class{constructor(e,t){this.wrappedContent=e,this.innerContent=t}wrapped(){return this.wrappedContent}inner(){return this.innerContent}},DefaultHighlighter=class{constructor(e){this.config=e}async highlight(e,t,n){if(!t||"text"===t||"plain"===t)return this.escapeHTML(e);const r=this.escapeHTML(e),s=`language-${t}`;return this.config.lineNos?this.addLineNumbers(r,s):`<code class="${s}">${r}</code>`}async highlightCodeBlock(e,t){const n=e.type(),r=e.inner(),s=await this.highlight(r,n,t);return new HighlightResultImpl(`<pre>${s}</pre>`,s)}async renderCodeblock(e,t,n){const r=await this.highlightCodeBlock(n);await t.writeString(r.wrapped())}isDefaultCodeBlockRenderer(){return!0}escapeHTML(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}addLineNumbers(e,t){const n=e.split("\n").map((e,n)=>{const r=n+this.config.lineNoStart;return this.config.lineNumbersInTable?`<tr><td class="line-number">${r}</td><td class="line-code"><code class="${t}">${e}</code></td></tr>`:`<span class="line-number">${r}</span><code class="${t}">${e}</code>`});return this.config.lineNumbersInTable?`<table class="code-table"><tbody>${n.join("")}</tbody></table>`:n.join("\n")}};init_log();var Item=class{Type;Err;low;high;segments;firstByte;isString;content;bytes;constructor(){this.Type=0,this.Err=null,this.low=0,this.high=0,this.segments=[],this.firstByte=0,this.isString=!1,this.content="",this.bytes=[]}Pos(){return this.segments.length>0?this.segments[0].Low:this.low}Val(e){if(0===this.segments.length)return e.slice(this.low,this.high);if(1===this.segments.length)return e.slice(this.segments[0].Low,this.segments[0].High);const t=[];for(const n of this.segments)t.push(e.slice(n.Low,n.High));const n=t.reduce((e,t)=>e+t.length,0),r=new Uint8Array(n);let s=0;for(const e of t)r.set(e,s),s+=e.length;return r}ValStr(e){return(new TextDecoder).decode(this.Val(e))}ValTyped(e){const t=this.ValStr(e);if(this.isString)return t;if(boolRe.test(t))return"true"===t;if(intRe.test(t)){const e=parseInt(t,10);return isNaN(e)?t:e}if(floatRe.test(t)){const e=parseFloat(t);return isNaN(e)?t:e}return t}IsText(){return 18===this.Type||17===this.Type}IsIndentation(){return 17===this.Type}IsNonWhitespace(e){return this.ValStr(e).trim().length>0}IsShortcodeName(){return 13===this.Type}IsInlineShortcodeName(){return 14===this.Type}IsLeftShortcodeDelim(){return 10===this.Type||8===this.Type}IsRightShortcodeDelim(){return 11===this.Type||9===this.Type}IsShortcodeClose(){return 12===this.Type}IsShortcodeParam(){return 15===this.Type}IsShortcodeParamVal(){return 16===this.Type}IsShortcodeMarkupDelimiter(){return 10===this.Type||11===this.Type}IsFrontMatter(){return this.Type>=3&&this.Type<=6}IsDone(){return 0===this.Type||1===this.Type}IsEOF(){return 1===this.Type}IsError(){return 0===this.Type}ToString(e){const t=this.Val(e),n=this.ValStr(e),r=function(e){const t=e;return t<0||t>=_ItemType_index.length-1?`ItemType(${t})`:_ItemType_name.slice(_ItemType_index[t],_ItemType_index[t+1])}(this.Type);switch(!0){case 1===this.Type:return"EOF";case 0===this.Type:return n;case 17===this.Type:return`${r}:[${s=n,s.replace(/ /g,"␣").replace(/\t/g,"→")}]`;case this.Type>19:return`<${n}>`;case t.length>50:return`${r}:${n.substring(0,20)}...`;default:return`${r}:[${n}]`}var s}},boolRe=/^(true|false)$/,intRe=/^[-+]?\d+$/,floatRe=/^[-+]?\d*\.\d+$/,_ItemType_name="tErrortEOFTypeLeadSummaryDividerTypeFrontMatterYAMLTypeFrontMatterTOMLTypeFrontMatterJSONTypeFrontMatterORGTypeIgnoretLeftDelimScNoMarkuptRightDelimScNoMarkuptLeftDelimScWithMarkuptRightDelimScWithMarkuptScClosetScNametScNameInlinetScParamtScParamValtIndentationtTexttKeywordMarker",_ItemType_index=[0,6,10,32,51,70,89,107,117,137,158,180,203,211,218,231,239,250,262,267,281];new Uint8Array([239,187,191]);var summaryDivider=(new TextEncoder).encode("\x3c!--more--\x3e"),summaryDividerOrg=(new TextEncoder).encode("# more"),delimTOML=(new TextEncoder).encode("+++"),delimYAML=(new TextEncoder).encode("---"),delimOrg=(new TextEncoder).encode("#+"),leftDelimSc=(new TextEncoder).encode("{{"),leftDelimScNoMarkup=(new TextEncoder).encode("{{<"),rightDelimScNoMarkup=(new TextEncoder).encode(">}}"),leftDelimScWithMarkup=(new TextEncoder).encode("{{%"),rightDelimScWithMarkup=(new TextEncoder).encode("%}}"),leftComment=(new TextEncoder).encode("/*"),rightComment=(new TextEncoder).encode("*/"),inlineIdentifier=(new TextEncoder).encode("inline "),sectionHandlers=class{l;skipAll;handlers;skipIndexes;constructor(e){this.l=e,this.skipAll=!1,this.handlers=[],this.skipIndexes=[]}skip(){if(this.skipAll)return-1;this.skipIndexes=[];let e=!1;for(const t of this.handlers){if(t.skipAll)continue;const n=t.skip();-1!==n&&(e=!0,this.skipIndexes.push(n))}return e?function(...e){let t=-1;for(const n of e)n<0||(-1===t||n<t)&&(t=n);return t}(...this.skipIndexes):(this.skipAll=!0,-1)}lex(e){if(this.skipAll)return null;this.l.pos>this.l.start&&this.l.emit(18);for(const t of this.handlers){if(t.skipAll)continue;const[n,r]=t.lexFunc(e,t.l);if(null===n||r)return n}return this.l.pos++,e}},sectionHandler=class{l;skipAll;skipFunc;lexFunc;constructor(e,t,n){this.l=e,this.skipAll=!1,this.skipFunc=t,this.lexFunc=n}skip(){if(this.skipAll)return-1;const e=this.skipFunc(this.l);return-1===e&&(this.skipAll=!0),e}};function isSpace(e){return 32===e||9===e}function isAlphaNumericOrHyphen(e){return isAlphaNumeric(e)||45===e}function isEndOfLine(e){return 13===e||10===e}function isAlphaNumeric(e){return 95===e||e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57}var Iterator=class{items;lastPos;constructor(e){this.items=e,this.lastPos=-1}Next(){return this.lastPos++,this.Current()}Current(){if(this.lastPos>=this.items.length){const e=new Item;return e.Type=0,e.Err=new Error("no more tokens"),e}return this.items[this.lastPos]}Backup(){if(this.lastPos<0)throw new Error("need to go forward before going back");this.lastPos--}Pos(){return this.lastPos}IsValueNext(){const e=this.Peek();return 0!==e.Type&&1!==e.Type}Peek(){return this.items[this.lastPos+1]}PeekWalk(e){for(let t=this.lastPos+1;t<this.items.length&&e(this.items[t]);t++);}Consume(e){for(let t=0;t<e;t++){const e=this.Next();if(0===e.Type||1===e.Type){this.Backup();break}}}LineNumber(e){const t=new Uint8Array([10]),n=e.slice(0,this.Current().low);let r=0;for(let e=0;e<n.length;e++)n[e]===t[0]&&r++;return r+1}},pageLexer=class{input;stateStart;state;pos;start;width;sectionHandlers;cfg;summaryDivider;summaryDividerChecked;lexerShortcodeState;items;err;inFrontMatter;parenDepth;constructor(e,t,n){this.input=e,this.stateStart=t,this.state=null,this.pos=0,this.start=0,this.width=0,this.cfg=n,this.summaryDivider=null,this.summaryDividerChecked=!1,this.err=null,this.items=[],this.inFrontMatter=!1,this.parenDepth=0,this.lexerShortcodeState={currLeftDelimItem:8,currRightDelimItem:9,isInline:!1,currShortcodeName:"",closingState:0,elementStepNum:0,paramElements:0,paramState:0,openShortcodes:{}},this.lexSummaryDivider=this.lexSummaryDivider.bind(this),this.lexMainSection=this.lexMainSection.bind(this),this.lexIdentifierInShortcode=this.lexIdentifierInShortcode.bind(this),this.lexEndOfShortcode=this.lexEndOfShortcode.bind(this),this.lexShortcodeLeftDelim=this.lexShortcodeLeftDelim.bind(this),this.lexShortcodeRightDelim=this.lexShortcodeRightDelim.bind(this),this.lexShortcodeParam=this.lexShortcodeParam.bind(this),this.lexShortcodeValue=this.lexShortcodeValue.bind(this),this.lexShortcodeValueQuoted=this.lexShortcodeValueQuoted.bind(this),this.lexShortcodeValueUnquoted=this.lexShortcodeValueUnquoted.bind(this),this.lexInsideShortcode=this.lexInsideShortcode.bind(this),this.lexDone=this.lexDone.bind(this),this.sectionHandlers=function(e){const t=new sectionHandlers(e),n=new sectionHandler(e,e=>e.index(leftDelimSc),(e,t)=>{if(!t.isShortCodeStart())return[e,!1];if(t.lexerShortcodeState.isInline){const e=t.input.slice(t.pos+3),n=function(e){for(let t=0;t<e.length;t++)if(!isSpace(e[t])){if(47===e[t])return t;break}return-1}(e);if(n!==t.input.length-1){const r=(new TextDecoder).decode(e.slice(n+1)).trim();if(-1===n||!r.startsWith(t.lexerShortcodeState.currShortcodeName+" "))return[t.errorf("inline shortcodes do not support nesting"),!0]}}return t.hasPrefix(leftDelimScWithMarkup)?(t.lexerShortcodeState.currLeftDelimItem=10,t.lexerShortcodeState.currRightDelimItem=11):(t.lexerShortcodeState.currLeftDelimItem=8,t.lexerShortcodeState.currRightDelimItem=9),[t.lexShortcodeLeftDelim,!0]}),r=new sectionHandler(e,e=>e.summaryDividerChecked||!e.summaryDivider?-1:e.index(e.summaryDivider),(e,t)=>t.summaryDivider&&t.hasPrefix(t.summaryDivider)?(t.summaryDividerChecked=!0,t.pos+=t.summaryDivider.length,t.consumeSpace(),t.emit(2),[e,!0]):[e,!1]);return t.handlers=[n,r],t.skipIndexes=new Array(t.handlers.length),t}(this)}Iterator(){return e=this.items,new Iterator(e);var e}Input(){return this.input}run(){for(this.state=this.stateStart;null!==this.state;)this.state=this.state(this);return this}next(){if(this.pos>=this.input.length)return this.width=0,-1;const e=this.input[this.pos];return this.width=1,this.pos+=this.width,e}peek(){const e=this.next();return this.backup(),e}backup(){this.pos-=this.width}append(e){e.Pos()<this.input.length&&(7===e.Type&&239===this.input[e.Pos()]?e.firstByte=239:e.firstByte=this.input[e.Pos()]),this.items.push(e)}emit(e){const t=()=>{this.start=this.pos};if(18===e)for(let n=this.pos-1;n>=this.start;n--){const r=this.input[n];if(32!==r&&9!==r&&13!==r&&10!==r)break;if(n===this.start&&10!==r){const e=new Item;return e.Type=17,e.low=this.start,e.high=this.pos,this.append(e),void t()}if(10===r&&n<this.pos-1){const r=new Item;r.Type=e,r.low=this.start,r.high=n+1,this.append(r);const s=new Item;return s.Type=17,s.low=n+1,s.high=this.pos,this.append(s),void t()}if(10===r&&n===this.pos-1)break}const n=new Item;n.Type=e,n.low=this.start,n.high=this.pos,n.low<this.input.length&&(7===e&&239===this.input[n.low]?n.firstByte=239:n.firstByte=this.input[n.low]),this.append(n),t()}emitString(e){const t=new Item;t.Type=e,t.low=this.start,t.high=this.pos,t.isString=!0,this.pos>this.start&&(t.firstByte=this.input[this.start]),this.items.push(t),this.start=this.pos}isEOF(){return this.pos>=this.input.length}ignoreEscapesAndEmit(e,t){let n=this.start,r=n;const s=[];for(;n<this.pos;){const e=1;92===this.input[n]&&(n>r&&s.push({Low:r,High:n}),r=n+e),n+=e}if(r<this.pos&&s.push({Low:r,High:this.pos}),s.length>0){const t=new Item;t.Type=e,t.segments=s,s[0].High>s[0].Low&&(t.firstByte=this.input[s[0].Low]),this.items.push(t),this.start=this.pos}this.start=this.pos}current(){return this.input.slice(this.start,this.pos)}ignore(){this.start=this.pos}errorf(e,...t){const n=new Error(e.replace(/%[a-z]/g,()=>String(t.shift()))),r=new Item;return r.Type=0,r.Err=n,r.low=this.start,r.high=this.pos,this.append(r),null}consumeCRLF(){let e=!1;const t=this.peek();return 13===t?(this.next(),10===this.peek()&&(this.next(),e=!0)):10===t&&(this.next(),e=!0),e}consumeToSpace(){for(;;){const e=this.next();if(-1===e||isSpace(e))return void this.backup()}}consumeSpace(){for(;;){const e=this.next();if(-1===e||!this.isUnicodeSpace(e))return void this.backup()}}isUnicodeSpace(e){return 32===e||9===e||10===e||12===e||13===e||133===e||160===e||8192===e||8193===e||8194===e||8195===e||8196===e||8197===e||8198===e||8199===e||8200===e||8201===e||8202===e||8232===e||8233===e||8239===e||8287===e||12288===e}index(e){const t=this.input.slice(this.pos),n=e.length,r=t.length;if(n>r)return-1;e:for(let s=0;s<=r-n;s++){for(let r=0;r<n;r++)if(t[s+r]!==e[r])continue e;return s}return-1}hasPrefix(e){if(this.pos+e.length>this.input.length)return!1;for(let t=0;t<e.length;t++)if(this.input[this.pos+t]!==e[t])return!1;return!0}isShortCodeStart(){return this.hasPrefix(leftDelimScWithMarkup)||this.hasPrefix(leftDelimScNoMarkup)}lexFrontMatterSection(e,t,n,r){for(let e=0;e<2;e++)if(this.next()!==t)return this.errorf(`invalid ${n} delimiter`);let s,a=this.consumeCRLF();for(this.ignore();;){if(!a&&(s=this.next(),-1===s))return this.errorf(`EOF looking for end ${n} front matter delimiter`);if((a||isEndOfLine(s))&&this.hasPrefix(r)){this.emit(e),this.pos+=3,this.consumeCRLF(),this.ignore();break}a=!1}return()=>this.lexMainSection()}currentLeftShortcodeDelimItem(){return this.lexerShortcodeState.currLeftDelimItem}currentRightShortcodeDelimItem(){return this.lexerShortcodeState.currRightDelimItem}currentLeftShortcodeDelim(){return 10===this.lexerShortcodeState.currLeftDelimItem?leftDelimScWithMarkup:leftDelimScNoMarkup}currentRightShortcodeDelim(){return 11===this.lexerShortcodeState.currRightDelimItem?rightDelimScWithMarkup:rightDelimScNoMarkup}lexIdentifier(){for(;;)if(!isAlphaNumericOrHyphen(this.next()))return this.backup(),0===(new TextDecoder).decode(this.input.slice(this.start,this.pos)).length||this.emit(15),null}lexMainSection(){if(this.isEOF())return()=>this.lexDone();const e=this.sectionHandlers.skip();if(-1===e)return this.pos=this.input.length,()=>this.lexDone();e>0&&(this.pos+=e);const t=this.sectionHandlers.lex(this.lexMainSection);return null!==t?t:(this.pos=this.input.length,this.lexDone)}lexInlineShortcodeContent(){for(;;){if(this.pos>=this.input.length)return this.errorf("unclosed inline shortcode");if(this.hasPrefix(leftDelimScWithMarkup)||this.hasPrefix(leftDelimScNoMarkup))return this.errorf("inline shortcodes do not support nesting");if(this.hasPrefix(this.currentRightShortcodeDelim()))return this.backup(),this.pos>this.start&&this.emit(18),()=>this.lexShortcodeRightDelim();this.next()}}lexIdentifierInShortcode(){let e=!1;for(;;){const t=this.next();switch(!0){case isAlphaNumericOrHyphen(t):case 47===t:break;case 46===t:if(this.lexerShortcodeState.isInline=this.hasPrefix(inlineIdentifier),!this.lexerShortcodeState.isInline)return this.errorf("period in shortcode name only allowed for inline identifiers");break;default:this.backup();const n=(new TextDecoder).decode(this.input.slice(this.start,this.pos));return this.lexerShortcodeState.closingState>0&&!this.lexerShortcodeState.openShortcodes[n]?this.errorf(`closing tag for shortcode '${n}' does not match start tag`):(this.lexerShortcodeState.closingState>0&&(this.lexerShortcodeState.openShortcodes[n]=!1,e=!0),this.lexerShortcodeState.closingState=0,this.lexerShortcodeState.currShortcodeName=n,this.lexerShortcodeState.openShortcodes[n]=!0,this.lexerShortcodeState.elementStepNum++,this.lexerShortcodeState.isInline?this.emit(14):this.emit(13),e?()=>this.lexEndOfShortcode():this.lexInsideShortcode)}}}lexEndOfShortcode(){return this.lexerShortcodeState.isInline=!1,this.hasPrefix(this.currentRightShortcodeDelim())?()=>this.lexShortcodeRightDelim():!0!==isSpace(this.next())?this.errorf("unclosed shortcode"):(this.ignore(),()=>this.lexEndOfShortcode())}lexShortcodeLeftDelim(){return this.pos+=this.currentLeftShortcodeDelim().length,this.isComment()?()=>this.lexComment():(this.emit(this.lexerShortcodeState.currLeftDelimItem),this.lexerShortcodeState.elementStepNum=0,this.lexerShortcodeState.paramElements=0,this.lexerShortcodeState.paramState=0,this.start=this.pos,this.lexInsideShortcode)}peekString(e){const t=(Uint8Array,e.length);if(this.pos+t>this.input.length)return null;const n=this.input.slice(this.pos,this.pos+t);if(e instanceof Uint8Array){for(let r=0;r<t;r++)if(n[r]!==e[r])return null;return(new TextDecoder).decode(n)}{const t=(new TextDecoder).decode(n);return t===e?t:null}}lexSummaryDivider(){if(!this.hasPrefix(summaryDivider))return null;if(this.start<this.pos){const e=new Item;e.Type=18,e.low=this.start,e.high=this.pos,e.low<this.input.length&&(e.firstByte=this.input[e.low]),this.append(e)}const e=new Item;return e.Type=2,e.low=this.pos,e.high=this.pos+summaryDivider.length,e.low<this.input.length&&(e.firstByte=this.input[e.low]),this.append(e),this.pos+=summaryDivider.length,this.start=this.pos,()=>this.lexMainSection()}handleBOM(){if(this.pos+3<=this.input.length){const e=this.input.slice(this.pos,this.pos+3);if(239===e[0]&&187===e[1]&&191===e[2]){const e=new Item;return e.Type=7,e.low=this.pos,e.high=this.pos+3,e.firstByte=239,this.append(e),this.pos+=3,this.start=this.pos,!0}}return!1}lexIntroSection(){this.summaryDivider=summaryDivider,0===this.pos&&this.handleBOM();e:for(;;){const e=this.next();if(-1===e)break;switch(!0){case 43===e:if(this.hasPrefix(delimTOML.slice(1)))return()=>this.lexFrontMatterSection(4,e,"TOML",delimTOML);this.backup();break e;case 45===e:if(this.hasPrefix(delimYAML.slice(1)))return()=>this.lexFrontMatterSection(3,e,"YAML",delimYAML);this.backup();break e;case 123===e:return lexFrontMatterJSON;case 35===e:return lexFrontMatterOrgMode;case 65279===e:this.emit(7);break;case!isSpace(e)&&!isEndOfLine(e):break e}}return()=>this.lexMainSection()}lexInsideShortcode(){if(this.hasPrefix(this.currentRightShortcodeDelim()))return this.lexShortcodeRightDelim;const e=this.next();if(-1===e)return this.errorf("unclosed shortcode action");if(isSpace(e)||isEndOfLine(e))this.ignore();else{if(61===e){this.consumeSpace(),this.ignore();const e=this.peek();return 34===e||92===e?this.lexShortcodeQuotedParamVal(92!==e,16):96===e?this.lexShortCodeParamRawStringVal(16):this.lexShortcodeParamVal}if(47===e){if(""===this.lexerShortcodeState.currShortcodeName)return this.errorf("got closing shortcode, but none is open");this.lexerShortcodeState.closingState++,this.lexerShortcodeState.isInline=!1,this.emit(12)}else{if(92!==e)return this.lexerShortcodeState.elementStepNum>0&&(isAlphaNumericOrHyphen(e)||34===e||96===e)?(this.backup(),this.lexShortcodeParam(!1)):isAlphaNumeric(e)?(this.backup(),this.lexIdentifierInShortcode):this.errorf(`unrecognized character in shortcode action: U+${e.toString(16).toUpperCase()} '${String.fromCharCode(e)}'. Note: Parameters with non-alphanumeric args must be quoted`);if(this.ignore(),34===this.peek()||96===this.peek())return this.lexShortcodeParam(!0)}}return this.lexInsideShortcode}lexShortcodeParam(e){let t,n=!0,r=!1;for(;;){if(t=this.next(),n){if(34===t||96===t&&!e)return 2===this.lexerShortcodeState.paramElements?this.errorf("got quoted positional parameter. Cannot mix named and positional parameters"):(this.lexerShortcodeState.paramElements=1,this.backup(),34===t?()=>this.lexShortcodeQuotedParamVal(!e,15):()=>this.lexShortCodeParamRawStringVal(15));if(96===t&&e)return this.errorf("unrecognized escape character");n=!1}else if(61===t){this.backup(),r=!0;break}if(!isAlphaNumericOrHyphen(t)&&46!==t){this.backup();break}}if(0===this.lexerShortcodeState.paramElements)this.lexerShortcodeState.paramElements++,r&&this.lexerShortcodeState.paramElements++;else{if(r&&1===this.lexerShortcodeState.paramElements)return this.errorf(`got named parameter '${(new TextDecoder).decode(this.current())}'. Cannot mix named and positional parameters`);if(!r&&2===this.lexerShortcodeState.paramElements)return this.errorf(`got positional parameter '${(new TextDecoder).decode(this.current())}'. Cannot mix named and positional parameters`)}return this.emit(15),this.lexInsideShortcode}lexShortcodeParamVal(){const e=this.next();if(isSpace(e))return this.ignore(),()=>this.lexShortcodeParamVal();switch(this.backup(),e){case 34:return this.next(),this.ignore(),()=>this.lexShortcodeQuotedParamVal(!1,16);case 96:return this.next(),this.ignore(),()=>this.lexShortCodeParamRawStringVal(16);default:return()=>this.lexShortcodeValueUnquoted()}}lexShortcodeValueUnquoted(){for(;;){const e=this.next();if(-1===e||isSpace(e)||this.isRightShortcodeDelim())return this.backup(),this.pos>this.start&&this.emit(16),this.lexInsideShortcode}}lexShortcodeQuotedParamVal(e,t){let n=!1,r=!1,s=0;e:for(;;){const t=this.next();switch(!0){case 92===t:if(34===this.peek()){if(n&&!e){this.backup();break e}n&&(r=!0,s=1)}else if(96===this.peek())return this.errorf("unrecognized escape character");break;case-1===t:case 10===t:return this.errorf(`unterminated quoted string in shortcode parameter-argument: '${(new TextDecoder).decode(this.current())}'`);case 34===t:if(0===s){if(n){this.backup();break e}n=!0,this.ignore()}else s=0}}r?this.ignoreEscapesAndEmit(t,!0):this.emitString(t);const a=this.next();return 92===a?34===this.peek()&&(this.ignore(),this.next(),this.ignore()):34===a?this.ignore():this.backup(),this.lexInsideShortcode}lexShortCodeParamRawStringVal(e){let t=!1;e:for(;;)switch(this.next()){case 96:if(t){this.backup();break e}t=!0,this.ignore();break;case-1:return this.errorf(`unterminated raw string in shortcode parameter-argument: '${(new TextDecoder).decode(this.input.slice(this.start,this.pos))}'`)}return this.emitString(e),this.next(),this.ignore(),this.lexInsideShortcode}lexDone(){return this.pos>this.start&&this.emit(18),this.emit(1),null}lexShortcodeRightDelim(){return this.pos+=this.currentRightShortcodeDelim().length,this.emit(this.lexerShortcodeState.currRightDelimItem),this.lexerShortcodeState.closingState=0,()=>this.lexMainSection()}lexShortcodeValue(){switch(this.next()){case-1:return this.errorf("unterminated quoted string in shortcode parameter");case 32:case 9:return this.ignore(),()=>this.lexShortcodeValue();case 34:return this.ignore(),()=>this.lexShortcodeValueQuoted();default:return this.backup(),()=>this.lexShortcodeValueUnquoted()}}lexShortcodeValueQuoted(){for(;;)switch(this.next()){case-1:return this.errorf("unterminated quoted string in shortcode parameter");case 92:34===this.peek()&&this.next();break;case 34:return this.backup(),this.emitString(16),this.next(),this.ignore(),this.lexInsideShortcode}}isRightShortcodeDelim(){return this.hasPrefix(this.currentRightShortcodeDelim())}lexComment(){const e=this.index(new Uint8Array([...rightComment,...this.currentRightShortcodeDelim()]));return e<=1?this.errorf("comment must be closed"):(this.emit(18),this.pos+=leftComment.length,this.ignore(),this.pos+=e-leftComment.length,this.emit(18),this.pos+=rightComment.length,this.ignore(),this.pos+=this.currentRightShortcodeDelim().length,this.emit(18),this.lexMainSection)}isComment(){return!(this.pos+2>this.input.length)&&47===this.input[this.pos]&&42===this.input[this.pos+1]}};function lexFrontMatterJSON(e){e.backup();let t=!1,n=0;for(;;){const r=e.next();switch(!0){case-1===r:return e.errorf("unexpected EOF parsing JSON front matter");case 123===r:t||n++;break;case 125===r:t||n--;break;case 34===r:t=!t;break;case 92===r:e.next()}if(0===n)break}return e.consumeCRLF(),e.emit(5),()=>e.lexMainSection()}function lexFrontMatterOrgMode(e){if(e.summaryDivider=summaryDividerOrg,e.backup(),!e.hasPrefix(delimOrg))return()=>e.lexMainSection();e:for(;;){const t=e.next();switch(!0){case 10===t:if(!e.hasPrefix(delimOrg))break e;break;case-1===t:break e}}return e.emit(6),()=>e.lexMainSection()}function lexIntroSection(e){return e.lexIntroSection()}var log14=getDomainLogger("markdown",{component:"pageparser"});init_log();var log15=getDomainLogger("markdown",{component:"parseinfo"}),SourceParseInfo=class{source;posMainContent=-1;itemsStep1=[];handlers;constructor(e,t){this.source=e,this.handlers=t,this.validateHandlers()}validateHandlers(){if(!this.handlers.frontMatterHandler())throw new Error("no front matter handler");if(!this.handlers.summaryHandler())throw new Error("no summary handler");if(!this.handlers.shortcodeHandler())throw new Error("no shortcode handler");if(!this.handlers.bytesHandler())throw new Error("no bytes handler")}isEmpty(){return 0===this.itemsStep1.length}async parse(){const e=function(e,t={}){const[n,r]=function(e,t){const[n,r]=function(e,t){const n=function(e,t,n){return new pageLexer(e,lexIntroSection,n)}(e,0,t);return n.run(),[n,null]}(e,t);return r?[[],r]:[n.items,n.err]}(e,t);if(r)throw log14.error("Error parsing bytes:",r),r;return n}(this.source,{});this.itemsStep1=e}async handle(){if(this.isEmpty())return;const e=new Iterator(this.itemsStep1);for(;;){const t=e.Next();try{if(7===t.Type)log15.info(`Ignoring item at position ${t.Pos()}: ${t.ValStr(this.source)}`);else if(t.IsFrontMatter()){await this.handlers.frontMatterHandler()(t);const n=e.Peek();n.IsDone()||(this.posMainContent=n.Pos())}else if(2===t.Type)await this.handlers.summaryHandler()(t,e);else if(t.IsLeftShortcodeDelim()){e.Backup();const t=e.Current();await this.handlers.shortcodeHandler()(t,e)}else{if(t.IsEOF())break;if(t.IsError())throw log15.error(`Error parsing item at position ${t.Pos()}: ${t.Err}`),this.createError(t.Err||new Error("Unknown parsing error"),t);await this.handlers.bytesHandler()(t)}}catch(e){throw this.createError(e,t)}}}getMainContentPosition(){return this.posMainContent}getItems(){return this.itemsStep1}getSource(){return this.source}createError(e,t){const n=function(e,t,n){const r="string"==typeof t?(s=t,(new TextEncoder).encode(s)):t;var s;if(n<0)return{filename:e,line:1,column:1,offset:0};let a=1,i=1;for(let e=0;e<Math.min(n,r.length);e++)10===r[e]?(a++,i=1):i++;return{filename:e,line:a,column:i,offset:n}}("",this.source,t.Pos()),r=new Error(`${e.message} at line ${n.line}, column ${n.column}`);return r.position=n,r}};init_log();var log16=getDomainLogger("markdown",{component:"vo/shortcode"}),ShortcodeImpl=class{name;params;pos;length;rawContent;placeholder;inline;closed;inner;ordinal;indentation;doMarkup;isClosing;info;templs;constructor(e=0,t="",n=null,r=0,s=0,a=!1,i=!1){this.ordinal=e,this.name=t,this.params=n,this.pos=r,this.length=s,this.rawContent="",this.inline=a,this.closed=i,this.doMarkup=!1,this.isClosing=!1,this.placeholder="",this.inner=[]}needsInner(){return!this.inline}},ShortcodeParser=class{shortcodes=[];nameSet=new Set;source;ordinal=0;pid;openShortcodes=new Map;paramElements=0;constructor(e,t=Date.now()){this.source=e,this.pid=t}parseItem(e,t){const n=this.extractShortcode(this.ordinal,0,t);if(!n)throw new Error("Failed to extract shortcode");n.pos=e.Pos()+e.ValStr(this.source).length,n.length=t.Current().Pos()+t.Current().ValStr(this.source).length-n.pos;const r=this.source.slice(n.pos,n.pos+n.length);return n.rawContent=(new TextDecoder).decode(r),n.name&&this.nameSet.add(n.name),n.params??=[],n.placeholder=createShortcodePlaceholder("s",this.pid,this.ordinal),this.ordinal++,this.shortcodes.push(n),n}extractShortcode(e,t,n){const r=new ShortcodeImpl(e);if(n.Pos()>0){n.Backup();const e=n.Next();e.IsIndentation()&&(r.indentation=e.ValStr(this.source))}let s=0,a=0;const i=t+1;let o=!1;const l="failed to extract shortcode";let c=0;for(;;){const e=n.Next();if(e.IsLeftShortcodeDelim()){const t=n.Peek();if(t.IsRightShortcodeDelim())throw new Error("shortcode has no name");if(t.IsShortcodeClose())continue;if(s>0){n.Backup();const e=this.extractShortcode(a,i,n);a++,e&&e.name&&(this.nameSet.add(e.name),Array.isArray(r.inner)||(r.inner=[]),r.inner.push(e))}else r.doMarkup=e.IsShortcodeMarkupDelimiter();s++}else if(e.IsRightShortcodeDelim()){if(!r.inline&&!r.needsInner())return this.openShortcodes.set(r.name,!1),r}else{if(e.IsShortcodeClose()){o=!0;const e=n.Peek();if(!r.inline&&!r.needsInner()){if(e.IsError())continue;throw new Error(`${l}: shortcode "${r.name}" does not evaluate .Inner or .InnerDeindent, yet a closing tag was provided`)}return e.IsRightShortcodeDelim()?n.Consume(1):(r.isClosing=!0,n.Consume(2)),r.inline||this.openShortcodes.set(r.name,!1),r}if(e.IsText()){Array.isArray(r.inner)||(r.inner=[]);const t=e.ValStr(this.source);r.inner.push(t)}else if(e.IsShortcodeName()||e.IsInlineShortcodeName()){if(r.name=e.ValStr(this.source).trim(),r.inline=e.IsInlineShortcodeName(),this.openShortcodes.has(r.name)&&this.openShortcodes.get(r.name))throw new Error(`shortcode ${r.name} nested in itself`);if(r.inline||this.openShortcodes.set(r.name,!0),r.inline){const e=this.source.slice(n.Pos()+3),t=indexNonWhiteSpace2(e,"/");if(t!==this.source.length-1){const n=(new TextDecoder).decode(e.slice(t+1));if(-1===t||!n.startsWith(r.name+" "))throw new Error("inline shortcodes do not support nesting")}}}else if(e.IsShortcodeParam()){if(!n.IsValueNext()){log16.warn(`${l}: shortcode "${r.name}" has a parameter without a value`);continue}if(n.Peek().IsShortcodeParamVal())if(null===r.params||void 0===r.params){const t={},s=e.ValStr(this.source);n.Next(),t[s]=n.Current().ValTyped(this.source),r.params=t}else{if(Array.isArray(r.params))throw new Error(`${l}: invalid state: invalid param type Array for shortcode "${r.name}", expected a map`);{const t=e.ValStr(this.source);n.Next(),r.params[t]=n.Current().ValTyped(this.source)}}else if(null===r.params||void 0===r.params){const t=[];t.push(e.ValTyped(this.source)),r.params=t}else{if(!Array.isArray(r.params))throw new Error(`${l}: invalid state: invalid param type Object for shortcode "${r.name}", expected an array`);r.params.push(e.ValTyped(this.source))}}else if(e.IsShortcodeParamVal()){if(0===c&&(c=1),Array.isArray(r.params))r.params.push(e.ValTyped(this.source));else if(null===r.params||void 0===r.params){const t=[];t.push(e.ValTyped(this.source)),r.params=t}}else if(e.IsDone()){if(!e.IsError()&&!o&&r.needsInner())throw new Error(`${l}: shortcode "${r.name}" must be closed or self-closed`);n.Backup();break}}}return r.inline||this.openShortcodes.set(r.name,!1),r}getShortcodes(){return this.shortcodes}getNames(){return Array.from(this.nameSet)}},SHORTCODE_PLACEHOLDER_PREFIX=(createShortcodePlaceholder("TOC",0,0),"HAHAHUGOSHORTCODE");function createShortcodePlaceholder(e,t,n){return`${SHORTCODE_PLACEHOLDER_PREFIX}${e}${t}${n}HBHB`}function indexNonWhiteSpace2(e,t){const n=t.charCodeAt(0);for(let t=0;t<e.length;t++)if(!isSpace2(e[t])&&e[t]===n)return t;return-1}function isSpace2(e){return 32===e||9===e||13===e||10===e}var MediaType=class{type;mainType;subType;delimiter;firstSuffix;mimeSuffix;suffixesCSV;constructor(e){this.type=e.type,this.mainType=e.mainType,this.subType=e.subType,this.delimiter=e.delimiter,this.firstSuffix=e.firstSuffix,this.mimeSuffix=e.mimeSuffix,this.suffixesCSV=e.suffixesCSV}sub(){if(this.subType)return this.subType;const e=this.type.split("/");return 2===e.length?e[1].split("+")[0]:""}getMimeSuffix(){if(this.mimeSuffix)return this.mimeSuffix;const e=this.type.indexOf("+");return-1!==e?this.type.substring(e+1):void 0}getSuffixList(){return this.suffixesCSV?this.suffixesCSV.split(","):[]}};init_log(),getDomainLogger("markdown",{component:"content"});var INTERNAL_SUMMARY_DIVIDER_PRE=(new TextEncoder).encode("\n\nHUGOMORE42\n\n"),Content=class{hasSummaryDivider=!1;summaryTruncated=!1;rawSource;items=[];renderer;constructor(e,t){this.rawSource=e,this.renderer=t}isEmpty(){return!this.rawSource||0===this.rawSource.length}setSummaryDivider(){this.hasSummaryDivider=!0}getHasSummaryDivider(){return this.hasSummaryDivider}setSummaryTruncated(){this.summaryTruncated=!0}getTruncated(){return this.summaryTruncated}addReplacement(e,t){const n={val:e,source:t};this.items.push(n)}addShortcode(e){this.items.push(e)}addItem(e){this.items.push(e)}addItems(...e){this.items.push(...e)}rawContent(){return(new TextDecoder).decode(this.rawSource)}pureContent(){const e=[],t=new TextDecoder,n=new TextEncoder;for(const t of this.items)if(this.isItem(t)){const n=this.rawSource.slice(t.Pos(),t.Pos()+t.Val(this.rawSource).length);e.push(n)}else this.isContentReplacement(t)?e.push(t.val):this.isShortcode(t)&&e.push(n.encode(t.placeholder));const r=e.reduce((e,t)=>e+t.length,0),s=new Uint8Array(r);let a=0;for(const t of e)s.set(t,a),a+=t.length;return t.decode(s)}pureContentWithoutPlaceholder(){const e=[],t=new TextDecoder;for(const t of this.items)if(this.isItem(t)){const n=this.rawSource.slice(t.Pos(),t.Pos()+t.Val(this.rawSource).length);e.push(n)}else this.isContentReplacement(t)?e.push(t.val):this.isShortcode(t);const n=e.reduce((e,t)=>e+t.length,0),r=new Uint8Array(n);let s=0;for(const t of e)r.set(t,s),s+=t.length;return t.decode(r)}renderedContent(e){let t=this.pureContent();if(e)for(const n of this.items)if(this.isShortcode(n)){const r=e(n);t=t.replace(n.placeholder,r)}return t}async renderedContentAsync(e){let t=await this.renderer.render(this.pureContent());if(e)for(const n of this.items)if(this.isShortcode(n))try{const r=await e(n);t=t.replace(n.placeholder,r)}catch(e){}return t}getItems(){return[...this.items]}getShortcodes(){return this.items.filter(this.isShortcode)}getTextItems(){return this.items.filter(this.isItem)}getReplacements(){return this.items.filter(this.isContentReplacement)}extractSummary(e,t){const n=(new TextDecoder).decode(e),r=this.extractSummaryFromHTML(t,n,70,this.containsCJK(n)),s=r.summaryLowHigh.high>r.summaryLowHigh.low?n.substring(r.summaryLowHigh.low,r.summaryLowHigh.high).trim():"";if(s)return this.summaryTruncated=r.truncated,{summary:s,truncated:r.truncated};const a=this.trimShortHTML(e);return this.summaryTruncated=a.length<e.length,{summary:(new TextDecoder).decode(e),truncated:this.summaryTruncated}}extractSummaryFromHTML(e,t,n,r){const s={source:t,summaryLowHigh:{low:0,high:t.length},truncated:!1};if(n<=0)return s;let a=0;const i=t.split(/\s+/);for(let e=0;e<i.length&&a<n;e++){const o=i[e].trim();if(0!==o.length&&!this.isProbablyHTMLToken(o)){if(r){const e=this.stripHTML(o),t=[...e].length;a+=e.length===e.replace(/[^\u0000-\u007F]/g,"").length?1:t}else a+=1;if(a>=n){const n=i.slice(0,e+1).join(" "),r=t.indexOf(n)+n.length;s.summaryLowHigh={low:0,high:Math.min(r,t.length)},s.truncated=!0;break}}}return s}containsCJK(e){return/[\u4e00-\u9fff\u3400-\u4dbf\u3040-\u309f\u30a0-\u30ff\uac00-\ud7af]/.test(e)}isProbablyHTMLToken(e){return">"===e||/^<\/?[A-Za-z]+>?$/.test(e)||/^[A-Za-z]+=["']/.test(e)}stripHTML(e){return e.replace(/<[^>]*>/g,"").replace(/\s+/g," ").trim()}trimShortHTML(e){const t=new TextDecoder,n=new TextEncoder;let r=t.decode(e);return 1===(r.match(/<p>/g)||[]).length&&(r=r.trim(),r.startsWith("<p>")&&r.endsWith("</p>")&&(r=r.slice(3,-4).trim())),n.encode(r)}cleanDividerPlaceholders(e){return this.hasSummaryDivider?e.replace(new RegExp("HUGOMORE42","g"),""):e}getDividedSummary(e){const t=e;if(this.hasSummaryDivider){const e=t.indexOf("HUGOMORE42");if(-1!==e)return t.substring(0,e).trim()}return""}async getRenderedSummary(e,t){if(this.hasSummaryDivider&&e)return this.getDividedSummary(e);const n=this.pureContentWithoutPlaceholder(),r=(new TextEncoder).encode(n),s=new MediaType({type:"text/html",mainType:"text",subType:"html",delimiter:".",firstSuffix:{suffix:"html",fullSuffix:".html"},mimeSuffix:"",suffixesCSV:"html"}),a=this.extractSummary(r,s);let i=a.summary;return a.truncated&&(i+="..."),t&&i.length>t&&(i=i.substring(0,t).trim()+"..."),await this.renderer.render(i)}getWordCount(){return this.pureContent().trim().split(/\s+/).filter(e=>e.length>0).length}getReadingTime(e=200){const t=this.getWordCount();return Math.ceil(t/e)}isItem(e){return"Type"in e&&"firstByte"in e&&"low"in e&&"high"in e}isShortcode(e){return"name"in e&&"placeholder"in e&&"params"in e}isContentReplacement(e){return"val"in e&&"source"in e}},yaml=__toESM(require("js-yaml")),import_smol_toml2=require("smol-toml"),RenderingResultImpl=class{constructor(e){this.buffer=e}bytes(){return this.buffer.bytes()}toString(){return(new TextDecoder).decode(this.bytes())}},ResultImpl=class{constructor(e,t){this.parsingResult=e,this.renderingResult=t}headers(){return this.parsingResult.headers()}tableOfContents(){return this.parsingResult.tableOfContents()}bytes(){return this.renderingResult.bytes()}};init_log();var log18=getDomainLogger("markdown",{component:"MarkdownImpl"}),MarkdownImpl=class{constructor(e,t){this.renderer=e,this.highlighter=t}async render(e,t){const n=await this.parse(e),r=await this.renderToBytes(e,t,n);return new ResultImpl(n,r)}async highlight(e,t,n){return this.highlighter.highlight(e,t,n)}async highlightCodeBlock(e,t){return this.highlighter.highlightCodeBlock(e,t)}async renderCodeblock(e,t,n){return this.highlighter.renderCodeblock(e,t,n)}isDefaultCodeBlockRenderer(){return this.highlighter.isDefaultCodeBlockRenderer()}async prepareRender(e){const t=await this.parseContent(e),n=t.frontMatter?.params,r=await this.renderer.parse(t.content.pureContent());return{frontMatter:()=>n||{},toc:()=>r.tableOfContents(),render:async e=>{const r=await t.content.renderedContentAsync(e.shortcodeRenderer),s=await t.content.getRenderedSummary(r,e.maxSummaryLength),a=t.content.getWordCount(),i=t.content.getReadingTime(e.wordsPerMinute),o={renderedContent:t.content.cleanDividerPlaceholders(r),wordCount:a,readingTime:i};return n&&(o.frontMatter=n),s&&(o.summary=s),o}}}async parseAndRenderContent(e,t={}){const n=await this.parseContent(e),r=n.frontMatter?.params;let s;s=t.shortcodeRenderer&&n.shortcodes.length>0?await n.content.renderedContentAsync(t.shortcodeRenderer):n.content.pureContent();const a=await this.renderer.render(s);if(this.hasCollectedTagsSupport()){const e=this.getCollectedTags();if(e.length>0){const t=r||{},s=Array.isArray(t.tags)?t.tags:t.tags?[t.tags]:[],a=[...new Set([...s,...e])];t.tags=a,n.frontMatter&&(n.frontMatter.params=t),log18.debug(`Merged tags: YAML [${s.join(", ")}] + inline [${e.join(", ")}] = [${a.join(", ")}]`)}}const i=n.content.getDividedSummary(a),o={renderedContent:a,wordCount:n.content.getWordCount(),readingTime:n.content.getReadingTime(t.wordsPerMinute)};return r&&(o.frontMatter=r),i&&(o.summary=i),o}hasCollectedTagsSupport(){return"function"==typeof this.renderer.getCollectedTags}getCollectedTags(){return this.hasCollectedTagsSupport()?this.renderer.getCollectedTags():[]}async parseContent(e){let t;const n=new Content(e,this.renderer),r=new ShortcodeParser(e),s=[],a=function(e,t){return new SourceParseInfo(e,t)}(e,{frontMatterHandler:()=>n=>{t=this.parseFrontMatter(n,e)},summaryHandler:()=>(t,r)=>{let s=-1;r.PeekWalk(t=>(-1!==s||t.IsDone()||(s=t.Pos()),!t.IsNonWhitespace(e)||(n.setSummaryTruncated(),!1))),n.setSummaryDivider(),n.addReplacement(INTERNAL_SUMMARY_DIVIDER_PRE,t)},shortcodeHandler:()=>(e,t)=>{const a=r.parseItem(e,t);s.push(a),n.addShortcode(a)},bytesHandler:()=>e=>{n.addItem(e)}});return await a.parse(),await a.handle(),{frontMatter:t,content:n,shortcodes:s,summary:await n.getRenderedSummary(),wordCount:n.getWordCount(),readingTime:n.getReadingTime()}}parseFrontMatter(e,t){const n=e.ValStr(t);let r,s={};switch(e.Type){case 3:r="yaml",s=this.parseYAML(n);break;case 4:r="toml",s=this.parseTOML(n);break;case 5:r="json",s=this.parseJSON(n);break;case 6:r="org",s=this.parseOrg(n);break;default:r="yaml"}return{params:s,format:r}}parseYAML(e){try{const t=yaml.load(e);return t&&"object"==typeof t&&!Array.isArray(t)?t:{}}catch(e){return{}}}parseTOML(e){try{const t=(0,import_smol_toml2.parse)(e);return t&&"object"==typeof t&&!Array.isArray(t)?t:{}}catch(e){return{}}}parseJSON(e){try{return JSON.parse(e)}catch(e){return{}}}parseOrg(e){const t={},n=e.split("\n");for(const e of n){const n=e.trim();if(!n.startsWith("#+"))continue;const r=n.match(/^#\+([^:]+):\s*(.*)$/);if(r){const e=r[1].trim().toLowerCase(),n=r[2].trim();t[e]=this.parseValue(n)}}return t}parseValue(e){if(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))return e.slice(1,-1);if("true"===e)return!0;if("false"===e)return!1;if(/^-?\d+$/.test(e))return parseInt(e,10);if(/^-?\d*\.\d+$/.test(e))return parseFloat(e);if(e.startsWith("[")&&e.endsWith("]")){const t=e.slice(1,-1).trim();return t?t.split(",").map(e=>this.parseValue(e.trim())):[]}return e}async parse(e){const t=(new TextDecoder).decode(e.src);return await this.renderer.parse(t)}async renderToBytes(e,t,n){const r=(new TextDecoder).decode(e.src),s=await this.renderer.render(r),a=new BufWriter;return await a.writeString(s),new RenderingResultImpl(a)}},import_markdown_it=__toESM(require("markdown-it")),ParserResult=class{_headers=[];_toc;tokens;source;idGenerator;constructor(e,t,n){this.tokens=e,this.source=t,this.idGenerator=n||new AutoIDGenerator,this._toc=this.buildTableOfContents(),this._headers=this.extractHeaders()}headers(){return[...this._headers]}tableOfContents(){return this._toc}getTokens(){return[...this.tokens]}getSource(){return this.source}buildTableOfContents(){const e=new TOCBuilder;for(const t of this.tokens)if("heading_open"===t.type){const n=parseInt(t.tag.substring(1)),r=this.findNextTextToken(t);if(r){const t=r.content,s=this.idGenerator.generateID(t);e.addHeading(t,n,s)}}return e.build()}extractHeaders(){const e=[];for(let t=0;t<this.tokens.length;t++){const n=this.tokens[t];if("heading_open"===n.type){const r=parseInt(n.tag.substring(1)),s=this.findNextTextToken(n,t);if(s){const t=new HeaderImpl(s.content,r);e.push(t)}}}return e}findNextTextToken(e,t){for(let n=void 0!==t?t+1:this.tokens.indexOf(e)+1;n<this.tokens.length;n++){const e=this.tokens[n];if("inline"===e.type)return e;if("heading_close"===e.type)break}return null}};function slugifyFilePath(e,t){e=function(e){return e.startsWith("/")&&(e=e.substring(1)),e.endsWith("/")&&(e=e.slice(0,-1)),e}(e);let n=(r=e,r.match(/\.[A-Za-z0-9]+$/)?.[0]);var r;const s=e.replace(new RegExp(n+"$"),"");(t||[".md",".html",void 0].includes(n))&&(n="");let a=function(e){return e.split("/").map(e=>e.replace(/\s/g,"-").replace(/&/g,"-and-").replace(/%/g,"-percent").replace(/\?/g,"").replace(/#/g,"")).join("/").replace(/\/$/,"")}(s);return function(e,t){return e===t||e.endsWith("/"+t)}(a,"_index")&&(a=a.replace(/_index$/,"index")),a+n}function splitAnchor(e){let[t,n]=e.split("#",2);return t.endsWith(".pdf")?[t,void 0===n?"":`#${n}`]:(n=void 0===n?"":"#"+n.toLowerCase().trim().replace(/\s+/g,"-").replace(/[^\w\u4e00-\u9fa5\-]+/g,"").replace(/\-+/g,"-").replace(/^-+|-+$/g,""),[t,n])}var externalLinkRegex=/^https?:\/\//i,wikilinkRegex=new RegExp(/!?\[\[([^\[\]\|\#\\]+)?(#+[^\[\]\|\#\\]+)?(\\?\|[^\[\]\#]*)?\]\]/g),tableRegex=new RegExp(/^\|([^\n])+\|\n(\|)( ?:?-{3,}:? ?\|)+\n(\|([^\n])+\|\n?)+/gm),tableWikilinkRegex=new RegExp(/(!?\[\[[^\]]*?\]\]|\[\^[^\]]*?\])/g);function wikilinkInlineRule(e,t){const n=e.pos,r=e.posMax;if(n+5>r)return!1;const s=33===e.src.charCodeAt(n),a=s?1:0;if(91!==e.src.charCodeAt(n+a)||91!==e.src.charCodeAt(n+a+1))return!1;let i=n+a+2,o=!1;for(;i<r-1;){if(93===e.src.charCodeAt(i)&&93===e.src.charCodeAt(i+1)){o=!0;break}i++}if(!o)return!1;const l=e.src.slice(n+a+2,i);if(0===l.trim().length)return!1;const c=l.indexOf("|"),u=l.indexOf("#");let h,d="",p="";if(-1!==c){const e=l.slice(0,c);h=l.slice(c+1).trim();const t=e.indexOf("#");-1!==t?(d=e.slice(0,t).trim(),p=e.slice(t).trim()):d=e.trim()}else-1!==u?(d=l.slice(0,u).trim(),p=l.slice(u).trim()):d=l.trim();if(!t){const t=s?"wikilink_embed":"wikilink_link",n=e.push(t,"",0),r={isEmbed:s,filepath:d,anchor:p,alias:h,url:d+p};n.meta=r,n.content=h||d}return e.pos=i+2,!0}function renderWikilinkLink(e,t){const n=e[t].meta,[r,s]=splitAnchor(n.url),a=slugifyFilePath(r),i=escapeHtml(n.alias??n.filepath);return`<a class="internal" data-slug="${a}" data-wikilink="${escapeHtml(n.url)}">${i}</a>`}var wikilinkImageEmbedRegex=new RegExp(/^(?<alt>(?!^\d*x?\d*$).*?)?(\|?\s*?(?<width>\d+)(x(?<height>\d+))?)?$/);function renderWikilinkEmbed(e,t){const n=e[t].meta,{filepath:r,anchor:s,alias:a}=n,i=slugifyFilePath(r),o=function(e){const t=e.toLowerCase().match(/\.[a-z0-9]+$/);return t?t[0]:""}(r);if([".png",".jpg",".jpeg",".gif",".bmp",".svg",".webp"].includes(o)){const{alt:e,width:t,height:n}=function(e){if(!e)return{alt:"",width:"auto",height:"auto"};const t=wikilinkImageEmbedRegex.exec(e);return t&&t.groups?{alt:t.groups.alt||"",width:t.groups.width||"auto",height:t.groups.height||"auto"}:{alt:e,width:"auto",height:"auto"}}(a);return`<img src="${i}" alt="${escapeHtml(e)}" width="${t}" height="${n}" />`}return[".mp4",".webm",".ogv",".mov",".mkv"].includes(o)?`<video src="${i}" controls></video>`:[".mp3",".webm",".wav",".m4a",".ogg",".3gp",".flac"].includes(o)?`<audio src="${i}" controls></audio>`:[".pdf"].includes(o)?`<iframe src="${i}" class="pdf"></iframe>`:`<blockquote class="transclude" data-url="${i}" data-block="${s}"><a href="${i+s}" class="transclude-inner">Transclude of ${i}</a></blockquote>`}function escapeHtml(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function wikilinkPlugin(e,t){!1!==t?.enable&&(e.inline.ruler.before("link","wikilink",wikilinkInlineRule),e.renderer.rules.wikilink_link=renderWikilinkLink,e.renderer.rules.wikilink_embed=renderWikilinkEmbed)}function tagInlineRule(e,t){const n=e.pos;if(n+2>e.posMax)return!1;if(35!==e.src.charCodeAt(n))return!1;if(n>0){const t=e.src.charCodeAt(n-1);if(32!==t&&10!==t&&9!==t)return!1}const r=e.src.slice(n),s=/^#((?:[-_\p{L}\p{Emoji}\p{M}\d])+(?:\/[-_\p{L}\p{Emoji}\p{M}\d]+)*)/u.exec(r);if(!s)return!1;const a=s[0],i=s[1];if(/^[\/\d]+$/.test(i))return!1;if(!t){const t=e.push("tag","",0),n=i.split("/").map(e=>e.trim().toLowerCase().replace(/\s+/g,"-").replace(/[^\p{L}\p{Emoji}\p{M}\d\-_]/gu,"")).join("/"),r=e.md.__tagPluginState,s={rawTag:i,slugTag:n,url:`${r?.tagBaseURL||"tags/"}${n}`};t.meta=s,t.content=i,r?.onTagFound&&r.onTagFound(n)}return e.pos=n+a.length,!0}function renderTag(e,t){const n=e[t].meta,r=n.rawTag.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;");return`<a href="${n.url}" class="internal tag-link">${r}</a>`}function tagPlugin(e,t){const n={enable:!0,tagBaseURL:"tags/",...t};!1!==n.enable&&(e.__tagPluginState={tagBaseURL:n.tagBaseURL,onTagFound:n.onTagFound},e.inline.ruler.before("emphasis","tag",tagInlineRule),e.renderer.rules.tag=renderTag)}new RegExp(/(?<=^| )#((?:[-_\p{L}\p{Emoji}\p{M}\d])+(?:\/[-_\p{L}\p{Emoji}\p{M}\d]+)*)/gu);var import_token=__toESM(require("markdown-it/lib/token.mjs")),calloutMapping={note:"note",abstract:"abstract",summary:"abstract",tldr:"abstract",info:"info",todo:"todo",tip:"tip",hint:"tip",important:"tip",success:"success",check:"success",done:"success",question:"question",help:"question",faq:"question",warning:"warning",caution:"warning",attention:"warning",failure:"failure",fail:"failure",missing:"failure",danger:"danger",error:"danger",bug:"bug",example:"example",quote:"quote",cite:"quote"},calloutRegex=/^\[\!([\w-]+)\|?(.+?)?\]([+-]?)/;function parseCallout(e,t){if("blockquote_open"!==e[t].type)return null;let n=t+1;for(;n<e.length&&"paragraph_open"!==e[n].type;){if("blockquote_close"===e[n].type)return null;n++}if(n>=e.length)return null;const r=n+1;if("inline"!==e[r].type)return null;const s=e[r].content,a=s.match(calloutRegex);if(!a)return null;const[i,o,l="",c]=a;var u;return{type:function(e){const t=e.toLowerCase();return calloutMapping[t]??e}(o.toLowerCase()),title:s.split("\n")[0].slice(i.length).trim()||(u=o.replace(/-/g," ")).charAt(0).toUpperCase()+u.slice(1),collapse:c,metadata:l,firstLineIdx:r}}function transformCalloutTokens(e,t,n){const r=parseCallout(e,t);if(!r)return t;const{type:s,title:a,collapse:i,metadata:o,firstLineIdx:l}=r;let c=t+1,u=1;for(;c<e.length&&u>0;)"blockquote_open"===e[c].type&&u++,"blockquote_close"===e[c].type&&u--,c++;c--,e[t].type="callout_open",e[t].tag="div",e[t].attrSet("class",`callout ${s}${i?" is-collapsible":""}${"-"===i?" is-collapsed":""}`),e[t].attrSet("data-callout",s),i&&e[t].attrSet("data-callout-fold",i),o&&e[t].attrSet("data-callout-metadata",o);const h=e[l],d=h.content.split("\n"),p=d[0],g=p.match(calloutRegex);if(g){const t=g[0],n=p.slice(t.length).trim(),r=d.slice(1);if(h.content=n,r.length>0&&r.join("\n").trim()){const t=l+1,n=new import_token.default("paragraph_open","p",1),s=new import_token.default("inline","",0);s.content=r.join("\n").trim(),s.children=[];const a=new import_token.default("paragraph_close","p",-1);e.splice(t+1,0,n,s,a),c+=3}}let m=t+1;for(;m<c&&"paragraph_open"!==e[m].type;)m++;let f=m+1;for(;f<c&&"paragraph_close"!==e[f].type;)f++;const T=[],E=new import_token.default("callout_title_open","div",1);E.attrSet("class","callout-title"),T.push(E);const S=new import_token.default("callout_icon","div",0);S.attrSet("class","callout-icon"),T.push(S);const _=new import_token.default("callout_title_inner_open","div",1);_.attrSet("class","callout-title-inner"),T.push(_);const A=new import_token.default("inline","",0);A.content=a,A.children=[],T.push(A);const I=new import_token.default("callout_title_inner_close","div",-1);if(T.push(I),i){const e=new import_token.default("callout_fold_icon","div",0);e.attrSet("class","fold-callout-icon"),T.push(e)}const y=new import_token.default("callout_title_close","div",-1);T.push(y),e.splice(m,f-m+1),c-=f-m+1,e.splice(t+1,0,...T),c+=T.length;const D=t+1+T.length;if(D<c){const t=new import_token.default("callout_content_open","div",1);t.attrSet("class","callout-content"),e.splice(D,0,t),c++;const n=new import_token.default("callout_content_close","div",-1);e.splice(c,0,n),c++}return e[c].type="callout_close",e[c].tag="div",c}function calloutRule(e){let t=0,n=0;for(;t<e.tokens.length;)"blockquote_open"===e.tokens[t].type&&parseCallout(e.tokens,t)?(transformCalloutTokens(e.tokens,t,e.md),n++,t++):t++;return n>0}function calloutPlugin(e,t){!1!=={enable:!0,...t}.enable&&(e.core.ruler.after("block","callout",calloutRule),function(e){e.renderer.rules.callout_open=(e,t)=>{const n=e[t];return`<div${n.attrs?n.attrs.map(e=>{return` ${e[0]}="${t=e[1],t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}"`;var t}).join(""):""}>`},e.renderer.rules.callout_close=()=>"</div>\n",e.renderer.rules.callout_title_open=(e,t)=>'<div class="callout-title">',e.renderer.rules.callout_title_close=()=>"</div>",e.renderer.rules.callout_title_inner_open=()=>'<div class="callout-title-inner">',e.renderer.rules.callout_title_inner_close=()=>"</div>",e.renderer.rules.callout_icon=()=>'<div class="callout-icon"></div>',e.renderer.rules.callout_fold_icon=()=>'<div class="fold-callout-icon"></div>',e.renderer.rules.callout_content_open=()=>'<div class="callout-content">',e.renderer.rules.callout_content_close=()=>"</div>"}(e))}function escapeHtml4(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function mathInlineRule(e,t){const n=e.pos,r=e.posMax;if(36!==e.src.charCodeAt(n))return!1;if(n>0&&92===e.src.charCodeAt(n-1))return!1;if(36===e.src.charCodeAt(n+1))return!1;let s=n+1,a=!1;for(;s<r;){const t=e.src.charCodeAt(s);if(10===t)return!1;if(36===t&&92!==e.src.charCodeAt(s-1)){a=!0;break}s++}if(!a)return!1;const i=e.src.slice(n+1,s);if(0===i.trim().length)return!1;if(!t){const t=e.push("math_inline","math",0);t.content=i,t.markup="$"}return e.pos=s+1,!0}function mathBlockRule(e,t,n,r){let s=e.bMarks[t]+e.tShift[t],a=e.eMarks[t];if(s+2>a)return!1;if(36!==e.src.charCodeAt(s)||36!==e.src.charCodeAt(s+1))return!1;if("$$"!==e.src.slice(s,a).trim())return!1;let i=t+1,o=!1;for(;i<n;){if(s=e.bMarks[i]+e.tShift[i],a=e.eMarks[i],"$$"===e.src.slice(s,a).trim()){o=!0;break}i++}if(!o)return!1;const l=[];for(let n=t+1;n<i;n++){const t=e.bMarks[n]+e.tShift[n],r=e.eMarks[n];l.push(e.src.slice(t,r))}const c=l.join("\n");if(!r){const n=e.push("math_block","math",0);n.content=c,n.markup="$$",n.block=!0,n.map=[t,i+1]}return e.line=i+1,!0}function renderMathInline(e,t){return`<span class="math math-inline" data-math="inline">${escapeHtml4(e[t].content)}</span>`}function renderMathBlock(e,t){return`<div class="math math-display" data-math="block">${escapeHtml4(e[t].content)}</div>\n`}function latexPlugin(e,t){!1!==t?.enable&&(e.inline.ruler.before("escape","math_inline",mathInlineRule),e.block.ruler.before("fence","math_block",mathBlockRule,{alt:["paragraph","reference","blockquote","list"]}),e.renderer.rules.math_inline=renderMathInline,e.renderer.rules.math_block=renderMathBlock)}function mermaidPlugin(e,t){if(!1===t?.enable)return;const n=e.renderer.rules.fence||function(e,t,n,r,s){return s.renderToken(e,t,n)};e.renderer.rules.fence=function(t,r,s,a,i){const o=t[r],l=o.info?e.utils.unescapeAll(o.info).trim():"";if("mermaid"===(l?l.split(/\s+/g)[0]:"")){const t=o.content;return`<pre class="mermaid-wrapper"><code class="language-mermaid mermaid">${e.utils.escapeHtml(t)}</code><button class="expand-button" aria-label="Expand diagram"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M15 3h6v6M9 21H3v-6M21 3l-7 7M3 21l7-7"/></svg></button><div id="mermaid-container"><div id="mermaid-space"><div class="mermaid-content"></div></div></div></pre>\n`}return n(t,r,s,a,i)}}var MarkdownItRenderer=class{md;config;idGenerator;collectedTags=new Set;constructor(e,t){this.config=e,this.idGenerator=new AutoIDGenerator,t?(this.md=t,this.config.extensions.wikilink?.enable&&this.md.use(wikilinkPlugin,{enable:!0}),this.config.extensions.parseTags&&this.md.use(tagPlugin,{enable:!0,tagBaseURL:"tags/",onTagFound:e=>this.collectedTags.add(e)}),this.config.extensions.callouts&&this.md.use(calloutPlugin,{enable:!0}),this.config.extensions.latex?.enable&&this.md.use(latexPlugin,{enable:!0}),this.config.extensions.mermaid?.enable&&this.md.use(mermaidPlugin,{enable:!0})):this.md=this.createMarkdownItInstance(),this.setupRendererRules()}setupRendererRules(){const e=this.idGenerator;this.md.renderer.rules.heading_open=function(t,n){const r=t[n+1].content,s=e.generateID(r);return t[n].attrPush(["id",s]),`<${t[n].tag} id="${s}">`}}async render(e){return this.idGenerator.reset(),this.collectedTags.clear(),this.config.extensions.wikilink?.enable&&(e=e.replace(tableRegex,e=>e.replace(tableWikilinkRegex,(e,t)=>{let n=t??"";return n=n.replace("#","\\#"),n=n.replace(/((^|[^\\])(\\\\)*)\|/g,"$1\\|"),n})).replace(wikilinkRegex,(e,...t)=>{const[n,r,s]=t,[a,i]=splitAnchor(`${n??""}${r??""}`),o=Boolean(r?.startsWith("#^"))?"^":"",l=i?`#${o}${i.trim().replace(/^#+/,"")}`:"",c=s??r?.replace("#","|")??"",u=e.startsWith("!")?"!":"";return n?.match(externalLinkRegex)?`${u}[${c.replace(/^\|/,"")}](${n})`:`${u}[[${a}${l}${c}]]`})),this.md.render(e)}getCollectedTags(){return Array.from(this.collectedTags)}async parse(e){this.idGenerator.reset();const t=await this._parse(e);return new ParserResult(t,(new TextEncoder).encode(e),this.idGenerator)}async _parse(e){return this.md.parse(e,{})}getMarkdownIt(){return this.md}addPlugin(e,t){this.md.use(e,t)}createMarkdownItInstance(){const e=new import_markdown_it.default({html:this.config.renderer.unsafe,breaks:!1,linkify:this.config.extensions.linkify,typographer:!this.config.extensions.typographer.disable});return this.config.extensions.typographer.disable||(e.options.quotes=[this.config.extensions.typographer.leftDoubleQuote,this.config.extensions.typographer.rightDoubleQuote,this.config.extensions.typographer.leftSingleQuote,this.config.extensions.typographer.rightSingleQuote]),this.configureBasicPlugins(e),this.config.extensions.wikilink?.enable&&e.use(wikilinkPlugin,{enable:!0}),this.config.extensions.parseTags&&e.use(tagPlugin,{enable:!0,tagBaseURL:"tags/",onTagFound:e=>this.collectedTags.add(e)}),this.config.extensions.callouts&&e.use(calloutPlugin,{enable:!0}),this.config.extensions.latex?.enable&&e.use(latexPlugin,{enable:!0}),this.config.extensions.mermaid?.enable&&e.use(mermaidPlugin,{enable:!0}),e}configureBasicPlugins(e){this.config.extensions.table&&e.enable(["table"]),this.config.extensions.strikethrough&&e.enable(["strikethrough"])}};init_log();var yaml2=__toESM(require("js-yaml")),PathType=(e=>(e[e.File=0]="File",e[e.ContentResource=1]="ContentResource",e[e.ContentSingle=2]="ContentSingle",e[e.Leaf=3]="Leaf",e[e.Branch=4]="Branch",e))(PathType||{}),PATH_CONSTANTS={CONTENT_EXTENSIONS:[".md",".markdown",".mdown",".mkd",".mkdn",".html",".htm",".xml"],HTML_EXTENSIONS:[".html",".htm"],INDEX_NAMES:["index","_index"],PATH_SEPARATOR:"/",EXTENSION_SEPARATOR:".",LANGUAGE_SEPARATOR:".",SYSTEM_PATH_SEPARATOR:(()=>{try{return require("path").sep}catch{return"/"}})(),COMPONENT_FOLDER_CONTENT:"content",COMPONENT_FOLDER_STATIC:"static",COMPONENT_FOLDER_LAYOUTS:"layouts",COMPONENT_FOLDER_ARCHETYPES:"archetypes",COMPONENT_FOLDER_DATA:"data",COMPONENT_FOLDER_ASSETS:"assets",COMPONENT_FOLDER_I18N:"i18n",normalizePath:e=>{let t=e.replace(/\\/g,"/");return t.startsWith("//")&&(t=t.substring(1)),t}},PathComponentsImpl=class e{constructor(e,t,n,r,s,a=!1,i){this.original=e,this.normalized=t,this.positions=n,this.identifiers=r,this.bundleType=s,this.disabled=a,this.component=i}withBundleType(t){return new e(this.original,this.normalized,this.positions,this.identifiers,t,this.disabled)}withDisabled(t){return new e(this.original,this.normalized,this.positions,this.identifiers,this.bundleType,t)}hasIdentifiers(){return this.identifiers.length>0}firstIdentifier(){return this.identifiers.length>0?this.identifiers[0]:null}lastIdentifier(){return this.identifiers.length>0?this.identifiers[this.identifiers.length-1]:null}getIdentifier(e){return e>=0&&e<this.identifiers.length?this.identifiers[e]:null}isContentComponent(e){return"content"===e||"archetypes"===e}clone(){return new e(this.original,this.normalized,{...this.positions},[...this.identifiers],this.bundleType,this.disabled,this.component)}toString(){return`PathComponents{original="${this.original}", normalized="${this.normalized}", bundleType=${PathType[this.bundleType]}, identifiers=${this.identifiers.length}}`}},PathPositionsImpl=class e{constructor(e=-1,t=-1,n=-1,r=-1){this.containerLow=e,this.containerHigh=t,this.sectionHigh=n,this.identifierLanguage=r}reset(){this.containerLow=-1,this.containerHigh=-1,this.sectionHigh=-1,this.identifierLanguage=-1}hasContainer(){return-1!==this.containerLow&&-1!==this.containerHigh}hasSection(){return this.sectionHigh>0}hasLanguageIdentifier(){return-1!==this.identifierLanguage}clone(){return new e(this.containerLow,this.containerHigh,this.sectionHigh,this.identifierLanguage)}},LowHighImpl=class{constructor(e,t){if(this.low=e,this.high=t,e>t)throw new Error(`Invalid range: low (${e}) must be <= high (${t})`)}length(){return this.high-this.low}isEmpty(){return this.low===this.high}contains(e){return e>=this.low&&e<this.high}substring(e){return e.substring(this.low,this.high)}toString(){return`[${this.low}, ${this.high})`}},PathComponentsFactory=class{static createEmpty(e="",t=0){return new PathComponentsImpl(e,e,new PathPositionsImpl,[],t,!1)}static create(e,t,n=0){return new PathComponentsImpl(e,t||e,new PathPositionsImpl,[],n,!1)}static createFull(e,t,n,r,s,a=!1){return new PathComponentsImpl(e,t,n,r,s,a)}},Path=class e{constructor(e){this.components=e}_unnormalized;shouldTrimLeadingSlash=!1;component(){if(this.components.component)return this.components.component;const e=this.components.normalized.split("/").filter(e=>e.length>0);return 0===e.length?"content":{static:"static",layouts:"layouts",themes:"themes",archetypes:"archetypes",data:"data",i18n:"i18n",assets:"assets"}[e[0]]||"content"}path(){return this.norm(this.components.normalized)}name(){return this.components.positions.containerHigh>0?this.components.normalized.substring(this.components.positions.containerHigh):this.components.normalized}originalNameNoExt(){const e=this.components.firstIdentifier();return e?this.components.original.substring(this.components.positions.containerHigh,e.low-1):this.components.original.substring(this.components.positions.containerHigh)}nameNoExt(){const e=this.components.firstIdentifier();return e?this.components.normalized.substring(this.components.positions.containerHigh,e.low-1):this.components.normalized.substring(this.components.positions.containerHigh)}nameNoLang(){if(this.components.identifiers.length>=2){const e=this.components.identifiers[this.components.identifiers.length-1],t=this.components.identifiers[this.components.identifiers.length-2],n=this.components.normalized.substring(t.low,t.high);if(["en","fr","es","de","zh","ja","ko","pt","it","ru","ar"].includes(n)){const n=this.components.positions.containerHigh;return this.components.normalized.substring(n,t.low-1)+this.components.normalized.substring(e.low-1)}}return this.name()}dir(){let e="";return this.components.positions.containerHigh>0&&(e=this.components.normalized.substring(0,this.components.positions.containerHigh-1)),""===e&&(e="/"),this.norm(e)}ext(){if(0===this.components.identifiers.length)return"";const e=this.components.identifiers[this.components.identifiers.length-1],t=this.components.normalized.substring(e.low,e.high);return t?"."+t:""}lang(){if(this.components.identifiers.length>=2){const e=this.components.identifiers[this.components.identifiers.length-2],t=this.components.normalized.substring(e.low,e.high);if(["en","fr","es","de","zh","ja","ko","pt","it","ru","ar"].includes(t))return"."+t}return""}section(){if(this.components.positions.sectionHigh<=0)return"";const e=this.components.normalized.substring(1,this.components.positions.sectionHigh);return"_index.md"===e||"index.md"===e||e.endsWith("/_index.md")||e.endsWith("/index.md")?"":this.norm(e)}sections(){const e=this.dir();if("/"===e||""===e)return[];const t=[],n=(e.startsWith("/")?e.substring(1):e).split("/").filter(e=>e.length>0);let r="";for(const e of n)""===r?r=e:r+="/"+e,t.push(this.norm(r));return t}container(){return-1===this.components.positions.containerLow?"":this.norm(this.components.normalized.substring(this.components.positions.containerLow,this.components.positions.containerHigh-1))}containerDir(){return this.isLeafBundle()||this.isBranchBundle(),this.dir()}base(){return this.isBranchBundle()&&"/_index.md"===this.components.normalized?"/":this.isLeafBundle()?this.baseInternal(!1,!0):this.isContent()&&!this.isBundle()?this.pathNoIdentifier():this.isContent()?this.isBundle()?this.baseInternal(!1,!0):this.baseInternal(!this.isContentPage(),this.isBundle()):this.path()}baseNoLeadingSlash(){return this.base().substring(1)}baseNameNoIdentifier(){return this.isBundle()?this.container():this.nameNoIdentifier()}nameNoIdentifier(){if(0===this.components.identifiers.length)return this.name();const e=this.components.identifiers[0],t=this.components.positions.containerHigh;return this.components.normalized.substring(t,e.low-1)}pathNoLang(){return this.baseInternal(!0,!1)}pathNoIdentifier(){if(0===this.components.identifiers.length)return this.path();const e=this.components.identifiers[0],t=this.components.normalized.substring(0,e.low-1);return this.norm(t)}pathRel(e){let t=e.base();return t.endsWith("/")||(t+="/"),this.path().replace(new RegExp("^"+this.escapeRegExp(t)),"")}baseRel(e){let t=e.base();return"/"===t&&(t=""),this.base().substring(t.length+1)}trimLeadingSlash(){const t=this.components.clone(),n=new e(t);return n.setShouldTrimLeadingSlash(!0),n}identifier(e){const t=this.components.identifiers.length;if(0===t||e<0||e>=t)return"";let n;n=1===t?0:0===e?t-1:t-1-e;const r=this.identifierAsString(n);return r?"."+r:""}identifiers(){const e=[],t=this.components.identifiers.length;for(let n=0;n<t;n++){const t=this.identifier(n);t&&e.push(t)}return e}bundleType(){return this.components.bundleType}isContent(){return this.bundleType()>=1}isBundle(){return this.bundleType()>3}isBranchBundle(){return 4===this.bundleType()}isLeafBundle(){return 3===this.bundleType()}isHTML(){const e=this.ext().toLowerCase();return PATH_CONSTANTS.HTML_EXTENSIONS.some(t=>t===e)}disabled(){return this.components.disabled}forBundleType(t){const n=this.components.withBundleType(t);return new e(n)}unnormalized(){if(!this._unnormalized)if(this.components.original===this.components.normalized)this._unnormalized=this;else{const t=new PathComponentsImpl(this.components.original,this.components.original,this.components.positions,this.components.identifiers,this.components.bundleType,this.components.disabled);this._unnormalized=new e(t)}return this._unnormalized}setShouldTrimLeadingSlash(e){this.shouldTrimLeadingSlash=e}norm(e){return this.shouldTrimLeadingSlash&&e.startsWith("/")?e.substring(1):e}isContentPage(){return this.bundleType()>=2}baseInternal(e,t){if(0===this.components.identifiers.length)return this.norm(this.components.normalized);if(e&&1===this.components.identifiers.length)return this.norm(this.components.normalized);let n=this.components.identifiers[this.components.identifiers.length-1].low-1;if(t&&(n=this.components.positions.containerHigh-1),0===n&&n++,!e)return this.norm(this.components.normalized.substring(0,n));const r=this.components.identifiers[0];return this.norm(this.components.normalized.substring(0,n)+this.components.normalized.substring(r.low-1,r.high))}identifierAsString(e){const t=this.identifierIndex(e);if(-1===t)return"";const n=this.components.identifiers[t];return this.components.normalized.substring(n.low,n.high)}identifierIndex(e){return e<0||e>=this.components.identifiers.length?-1:e}escapeRegExp(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}toString(){return`Path{path="${this.path()}", component="${this.component()}", bundleType=${PathType[this.bundleType()]}}`}equals(e){return this.path()===e.path()&&this.component()===e.component()&&this.bundleType()===e.bundleType()}hashCode(){return`${this.component()}:${this.path()}:${this.bundleType()}`}},PathUtils=class{static fromString(e,t){const n=new PathComponentsImpl(t,t,{containerLow:-1,containerHigh:-1,sectionHigh:-1,identifierLanguage:-1},[],0,!1);return new Path(n)}static hasExtension(e,t){const n=e.ext(),r=t.startsWith(".")?t:"."+t;return n.toLowerCase()===r.toLowerCase()}static isUnder(e,t){const n=e.path();let r;r=t.isBranchBundle()?t.dir():t.path();const s="/"===r?"/":r+"/";return n!==r&&n.startsWith(s)}static relativeTo(e,t){return t.pathRel(e)}static compare(e,t){const n=e.path().localeCompare(t.path());if(0!==n)return n;const r=e.component().localeCompare(t.component());return 0!==r?r:e.bundleType()-t.bundleType()}},PathProcessorImpl=class{normalizer;extChecker;constructor(e,t){this.normalizer=e||new PathParsingNormalizer,this.extChecker=t||new DefaultFileExtensionChecker}parse(e,t){let n=t;n&&""!==n||(n="/");const r=this.normalizer.normalize(n),s=this.createPathComponents(e,r,t);return new Path(s)}parseIdentity(e,t){const n=this.parse(e,t);return{identifierBase:()=>n.base()}}parseBaseAndBaseNameNoIdentifier(e,t){const n=this.parse(e,t);return[n.base(),n.baseNameNoIdentifier()]}createPathComponents(e,t,n){let r=e,s=t;if(t.startsWith("/")){const n=t.split("/").filter(e=>e.length>0);if(n.length>0){const t=n[0];["static","layouts","themes","archetypes","data","i18n","assets"].includes(t)&&"content"===e&&(r=t),["images","assets","static","css","js","fonts"].includes(t)&&"content"===e&&(r="static")}}const a=s.lastIndexOf("/"),i=a>=0?s.substring(a+1):s;a>=0&&s.substring(0,a);let o=this.detectBundleType(i,r);const l=this.calculatePathPositions(s),c=this.extractIdentifiers(s,i);return new PathComponentsImpl(n,s,l,c,o,!1,r)}detectBundleType(e,t){if("content"!==t&&"archetypes"!==t)return 0;let n=e.split(".")[0];return"index"===n&&this.isContentFile(e)?3:"_index"===n&&this.isContentFile(e)?4:this.isContentFile(e)?2:0}isContentFile(e){const t=this.getFileExtension(e);return["md","html","markdown","mdown","mkd","mkdn","htm"].includes(t.toLowerCase())}getFileExtension(e){const t=e.lastIndexOf(".");return t>0&&t<e.length-1?e.substring(t+1):""}calculatePathPositions(e){let t=-1,n=-1,r=-1;for(let s=e.length-1;s>=0;s--)"/"===e[s]&&(-1===r?r=s+1:-1===n&&(n=s+1),s>0&&(t=s));return new PathPositionsImpl(n,r,t,-1)}extractIdentifiers(e,t){const n=[],r=e.substring(0,e.length-t.length).length,s=t.split(".");if(s.length<=1)return n;let a=r+s[0].length;for(let e=1;e<s.length;e++){const t=a+1,r=t+s[e].length;n.push(new LowHighImpl(t,r)),a=r}return n}},PathParsingNormalizer=class{constructor(e=!0,t=!0){this.toLowerCase=e,this.replaceSpaces=t}normalize(e){let t=e;return t=t.replace(/\\/g,"/"),this.toLowerCase&&(t=t.toLowerCase()),this.replaceSpaces&&(t=t.replace(/\s/g,"-")),t}},BasicPathNormalizer=class{constructor(e=!0,t=!0){this.toLowerCase=e,this.replaceSpaces=t}normalize(e){let t=e;return t=t.replace(/\\/g,"/"),this.toLowerCase&&(t=t.toLowerCase()),this.replaceSpaces&&(t=t.replace(/\s+/g,"-")),t}},DefaultFileExtensionChecker=class{isContentExt(e){return PATH_CONSTANTS.CONTENT_EXTENSIONS.includes(e.toLowerCase())}isHTML(e){return PATH_CONSTANTS.HTML_EXTENSIONS.includes(e.toLowerCase())}hasExt(e){for(let t=e.length-1;t>=0;t--){if("."===e[t])return!0;if("/"===e[t])return!1}return!1}},PathParserUtils=class e{static parseBasic(e){const t=e.lastIndexOf("/"),n=t>=0?e.substring(0,t):"",r=t>=0?e.substring(t+1):e,s=r.lastIndexOf("."),a=s>=0?r.substring(s):"",i=s>=0?r.substring(0,s):r;return{dir:n,name:r,ext:a,nameWithoutExt:i}}static join(...e){return e.filter(e=>e.length>0).map(e=>e.replace(/^\/+|\/+$/g,"")).join("/").replace(/\/+/g,"/")}static normalizeBasic(e){return(new BasicPathNormalizer).normalize(e)}static isBundle(t){const n=e.parseBasic(t);return PATH_CONSTANTS.INDEX_NAMES.includes(n.nameWithoutExt)}static extractSection(e){const t=e.startsWith("/")?e.substring(1):e,n=t.indexOf("/");return n>=0?t.substring(0,n):t}static removeExtension(e){const t=e.lastIndexOf(".");return t>e.lastIndexOf("/")?e.substring(0,t):e}static hasExtension(e){return(new DefaultFileExtensionChecker).hasExt(e)}},PathFactoryImpl=class{processor;pool;constructor(e,t){const n=e?.normalizer?{normalize:e.normalizer}:new BasicPathNormalizer(!1!==e?.normalize,!1!==e?.replaceSpaces),r=new DefaultFileExtensionChecker;this.processor=new PathProcessorImpl(n,r),t&&(this.pool=t)}create(e,t,n){return this.pool&&this.pool.get(),this.processor.parse(e,t)}createFromComponents(e){return new Path(e)}createMany(e,t,n){return t.map(t=>this.create(e,t,n))}createWithConfig(e,t,n){const r={};return void 0!==n?.toLowerCase&&(r.normalize=n.toLowerCase),void 0!==n?.replaceSpaces&&(r.replaceSpaces=n.replaceSpaces),void 0!==n?.customNormalizer&&(r.normalizer=n.customNormalizer),this.create(e,t,r)}},DefaultPathFactory=class extends PathFactoryImpl{constructor(){super({normalize:!0,replaceSpaces:!0})}},SimplePathPool=class{pool=[];maxSize;constructor(e=100){this.maxSize=e}get(){if(this.pool.length>0)return this.pool.pop();const e=PathComponentsFactory.createEmpty();return new Path(e)}put(e){this.pool.length<this.maxSize&&this.pool.push(e)}clear(){this.pool=[]}size(){return this.pool.length}},PathBuilder=class{component="";path="";config={};factory;constructor(e){this.factory=e||new DefaultPathFactory}withComponent(e){return this.component=e,this}withPath(e){return this.path=e,this}withNormalization(e){return this.config.normalize=e,this}withSpaceReplacement(e){return this.config.replaceSpaces=e,this}withNormalizer(e){return this.config.normalizer=e,this}build(){if(!this.component||!this.path)throw new Error("Component and path must be set");return this.factory.create(this.component,this.path,this.config)}reset(){return this.component="",this.path="",this.config={},this}},PathFactoryUtils=class e{static defaultFactory=new DefaultPathFactory;static createContentPath(t){return e.defaultFactory.create("content",t)}static createStaticPath(t){return e.defaultFactory.create("static",t)}static createLayoutPath(t){return e.defaultFactory.create("layouts",t)}static createArchetypePath(t){return e.defaultFactory.create("archetypes",t)}static createDataPath(t){return e.defaultFactory.create("data",t)}static createThemePath(t){return e.defaultFactory.create("themes",t)}static createFromConfig(e){const t={};void 0!==e.normalize&&(t.normalize=e.normalize),void 0!==e.replaceSpaces&&(t.replaceSpaces=e.replaceSpaces);const n=new PathFactoryImpl(t);return e.paths.map(t=>n.create(e.component,t))}static builder(){return new PathBuilder}static createWithPool(e,t,n){return new PathFactoryImpl(void 0,n).create(e,t)}},PathDomain={createContentPath:PathFactoryUtils.createContentPath,createStaticPath:PathFactoryUtils.createStaticPath,createLayoutPath:PathFactoryUtils.createLayoutPath,createArchetypePath:PathFactoryUtils.createArchetypePath,createDataPath:PathFactoryUtils.createDataPath,createThemePath:PathFactoryUtils.createThemePath,builder:PathFactoryUtils.builder,parseBasic:PathParserUtils.parseBasic,join:PathParserUtils.join,normalizeBasic:PathParserUtils.normalizeBasic,isBundle:PathParserUtils.isBundle,extractSection:PathParserUtils.extractSection,removeExtension:PathParserUtils.removeExtension,checkExtension:PathParserUtils.hasExtension,hasSpecificExtension:PathUtils.hasExtension,isUnder:PathUtils.isUnder,relativeTo:PathUtils.relativeTo,compare:PathUtils.compare,createProcessor:()=>new PathProcessorImpl,createFactory:()=>new DefaultPathFactory,createPool:e=>new SimplePathPool(e),createNormalizer:e=>new BasicPathNormalizer(e?.toLowerCase,e?.replaceSpaces)},log19=getDomainLogger("content",{component:"translator"}),Translator=class{contentLanguage;translateFuncs=new Map;constructor(e){this.contentLanguage=e}translate(e,t){const n=e.toLowerCase(),r=this.translateFuncs.get(n);if(r){const e=r(t);if(e)return e}log19.info(`Translation func for language ${e} not found, use default.`);const s=this.translateFuncs.get(this.contentLanguage.toLowerCase());if(s){const e=s(t);if(e)return e}return log19.info("i18n not initialized; if you need string translations, check that you have a bundle in /i18n that matches the site language or the default language."),`[i18n] ${t}`}async setupTranslateFuncs(e){try{await e.walkI18n("",{walkFn:async(e,t)=>{if(e.endsWith(".yaml")||e.endsWith(".yml"))try{const n=(PATH_CONSTANTS.normalizePath(e).split("/").pop()||"").replace(/\.(yaml|yml)$/,"").toLowerCase(),r=await this.readI18nFile(t),s=this.parseI18nContent(r),a=new Map;s.forEach(e=>{a.set(e.id,e.translation)});const i=e=>a.get(e)||(log19.warn(`i18n|MISSING_TRANSLATION|${n}|${e}`),"");this.translateFuncs.set(n,i),log19.info(`✅ Loaded i18n translations for language: ${n} (${s.length} items)`)}catch(t){log19.error(`❌ Failed to load i18n file ${e}:`,t)}}},{}),log19.info(`🌍 Translation setup complete. Loaded ${this.translateFuncs.size} languages: [${Array.from(this.translateFuncs.keys()).join(", ")}]`)}catch(e){throw e}}async readI18nFile(e){let t=null;try{t=await e.open();const n=await t.stat(),r=new Uint8Array(n.size()),s=await t.read(r),a=new TextDecoder("utf-8").decode(s.buffer);return 65279===a.charCodeAt(0)?a.slice(1):a}catch(e){throw log19.error("❌ Failed to read i18n file:",e),e}finally{if(t)try{await t.close()}catch(e){log19.warn(`Failed to close i18n file: ${e}`)}}}parseI18nContent(e){try{const t=yaml2.load(e);return Array.isArray(t)?t.filter(e=>e&&"object"==typeof e&&e.id&&e.translation).map(e=>({id:String(e.id),translation:String(e.translation)})):(log19.warn("i18n YAML content is not an array"),[])}catch(e){return log19.error("❌ Failed to parse i18n YAML content:",e),[]}}getAvailableLanguages(){return Array.from(this.translateFuncs.keys())}hasLanguage(e){return this.translateFuncs.has(e.toLowerCase())}};init_log();var log20=getDomainLogger("content",{component:"content"});async function createContent(e){const t=new MDConverter(function(e,t){const n=new DefaultHighlighter({style:"github",lineNos:!1,lineNoStart:1,anchorLineNos:!1,lineAnchors:"",lineNumbersInTable:!0,noClasses:!0,codeFences:!0,guessSyntax:!1,tabWidth:4});return new MarkdownImpl(t||!e?new MarkdownItRenderer({extensions:{typographer:{disable:!1,leftSingleQuote:"&lsquo;",rightSingleQuote:"&rsquo;",leftDoubleQuote:"&ldquo;",rightDoubleQuote:"&rdquo;",enDash:"&ndash;",emDash:"&mdash;",ellipsis:"&hellip;",leftAngleQuote:"&laquo;",rightAngleQuote:"&raquo;",apostrophe:"&rsquo;"},footnote:!0,definitionList:!0,table:!0,strikethrough:!0,linkify:!0,linkifyProtocol:"https",taskList:!0,cjk:{enable:!1,eastAsianLineBreaks:!1,eastAsianLineBreaksStyle:"simple",escapedSpace:!1},passthrough:{enable:!1,delimiters:{inline:[],block:[]}},highlight:{style:"github",lineNos:!1,lineNoStart:1,anchorLineNos:!1,lineAnchors:"",lineNumbersInTable:!0,noClasses:!0,codeFences:!0,guessSyntax:!1,tabWidth:4},wikilink:{enable:!0,disableBrokenWikilinks:!1,markdownLinkResolution:"shortest",prettyLinks:!0},parseTags:!0,callouts:!0,latex:{enable:!0},mermaid:{enable:!0}},renderer:{unsafe:!0},parser:{autoHeadingID:!0,autoHeadingIDType:"github",wrapStandAloneImageWithinParagraph:!0,attribute:{title:!0,block:!1}},duplicateResourceFiles:!1,renderHooks:{image:{enableDefault:!0},link:{enableDefault:!0}}},void 0):e,n)}(e.markdown(),e.useInternalRenderer())),n=await async function(e){const t=new Translator(e.defaultLanguage());try{await t.setupTranslateFuncs(e)}catch(e){log20.warn("Failed to setup translator, continuing without i18n support:",e)}return t}(e),r=new PageBuilder(e,e,e,null,null,new Taxonomy2(e.views(),e),new Term(e),new Section(e),new Standalone(e),t,null),s=new PageMap(r);r.pageMapper=s,s.setupReverseIndex();const a=new Content2(e,t,s,n);return r.contentHub=a,a}var kindMapMain={[PageKind_PAGE]:"page",[PageKind_HOME]:"home",[PageKind_SECTION]:"section",[PageKind_TAXONOMY]:"taxonomy",[PageKind_TERM]:"term",[PageKind_STATUS_404]:"404",[PageKind_SITEMAP]:"sitemap",taxonomyterm:"taxonomy"};function getKindMain(e){return kindMapMain[e.toLowerCase()]||""}init_log(),getDomainLogger("content",{component:"identity"});var Identity=class{id;lang;langIdx;stale=!0;constructor(e,t="",n=0){this.id=e,this.lang=t,this.langIdx=n}ID(){return this.id}identifierBase(){return`${this.id}-${this.lang}`}pageLanguage(){return this.lang}pageLanguageIndex(){return this.langIdx}pageIdentity(){return this}markStale(){this.stale||(this.stale=!0)}isStale(){return this.stale}clearStale(){this.stale&&(this.stale=!1)}},crypto=__toESM(require("crypto")),path16=__toESM(require("path"));init_log(),getDomainLogger("content",{component:"FileInfo"});var contentFileExtensionsSet=new Set([".md"]),FileInfo7=class e{fileMetaInfo;pathInfo;bundleType;uniqueIDCache;lazyInitDone=!1;constructor(e,t){this.fileMetaInfo=e;const n=PathDomain.createProcessor();this.pathInfo=n.parse(PATH_CONSTANTS.COMPONENT_FOLDER_CONTENT,t),this.bundleType=0,this.determineBundleType()}static newFileInfo(t){const n=PATH_CONSTANTS.normalizePath(t.relativeFilename());return new e(t,n)}pageFile(){return this}shiftToResource(){this.isContent()&&(this.bundleType=1)}relPath(){const e=this.pathInfo.dir(),t=e.startsWith("/")?e.substring(1):e;return path16.join(t,this.pathInfo.name())}section(){return this.pathInfo.section()}isZero(){return null==this.fileMetaInfo}filename(){return this.fileMetaInfo.fileName()}dir(){return this.pathToDir(this.pathInfo.dir())}ext(){return this.pathInfo.ext()}logicalName(){return this.pathInfo.name()}originalBaseFileName(){return this.pathInfo.originalNameNoExt()}baseFileName(){return this.pathInfo.nameNoExt()}translationBaseName(){return this.pathInfo.nameNoIdentifier()}contentBaseName(){return this.pathInfo.baseNameNoIdentifier()}baseNameNoIdentifier(){return this.pathInfo.baseNameNoIdentifier()}root(){return this.pathInfo.dir()||"/"}uniqueID(){return this.init(),this.uniqueIDCache}fileInfo(){return this.fileMetaInfo}type(){const e=this.section();return""!==e?e:"page"}async open(){return await this.fileMetaInfo.open()}paths(){return this.pathInfo}path(){return this.pathInfo.path()}toString(){return this.baseFileName()}getBundleType(){return this.bundleType}isBundle(){return this.bundleType>=3}isLeafBundle(){return 3===this.bundleType}isBranchBundle(){return 4===this.bundleType}isContentResource(){return 1===this.bundleType}isContent(){return this.bundleType>=1}init(){if(!this.lazyInitDone){this.lazyInitDone=!0;const e=this.relPath().replace(/\\/g,"/");this.uniqueIDCache=crypto.createHash("md5").update(e).digest("hex")}}pathToDir(e){return""===e?e:path16.normalize(e.substring(1)+"/")}determineBundleType(){var e;if(e=this.pathInfo.ext(),contentFileExtensionsSet.has(e))switch(this.pathInfo.nameNoIdentifier()){case"index":this.bundleType=3;break;case"_index":this.bundleType=4;break;default:this.bundleType=2}}};function newFileInfo2(e){return FileInfo7.newFileInfo(e)}function sortByDefault(e){pageBy(lessPageTitle).sort(e)}function pageBy(e){return new PageByWrapper(e)}var PageByWrapper=class{constructor(e){this.by=e}sort(e){!function(e,t){const n=Array.from({length:t.len()},(e,t)=>t);n.sort((e,n)=>t.less(e,n)?-1:t.less(n,e)?1:e-n);const r=[...e];for(let t=0;t<n.length;t++)e[t]=r[n[t]]}(e,new PageSorterImpl(e,this.by))}},lessPageTitle=(e,t)=>collatorStringCompare(e=>e.title(),e,t)<0,language=(e,t)=>collatorStringCompare(e=>e.pageIdentity().pageLanguage(),e,t)<0,weight=(e,t)=>e.pageWeight()<t.pageWeight(),collatorStringCompare=(e,t,n)=>{const r=e(t),s=e(n);return r<s?-1:r>s?1:0},PageSorterImpl=class{constructor(e,t){this.pages=e,this.by=t}len(){return this.pages.length}swap(e,t){[this.pages[e],this.pages[t]]=[this.pages[t],this.pages[e]]}less(e,t){return this.by(this.pages[e],this.pages[t])}},Cast=class{static toString(e){return null==e?"":"string"==typeof e?e:"number"==typeof e||"boolean"==typeof e?e.toString():String(e)}static toInt(e){if(null==e)return 0;if("number"==typeof e)return Math.floor(e);if("string"==typeof e){const t=parseInt(e,10);return isNaN(t)?0:t}return 0}static toTime(e){if(null==e)return new Date;if(e instanceof Date)return e;if("string"==typeof e){const t=new Date(e);return isNaN(t.getTime())?new Date:t}return"number"==typeof e?new Date(e):new Date}},Strings=class{static sliceToLower(e){return e.map(e=>e.toLowerCase())}},Types=class{static toStringSlicePreserveString(e){return null==e?null:Array.isArray(e)?e.map(e=>Cast.toString(e)):"string"==typeof e?[e]:[Cast.toString(e)]}},import_path9=__toESM(require("path")),FrontMatterParserImpl=class{params;langSvc;taxonomySvc;constructor(e,t,n){this.params=e,this.langSvc=t,this.taxonomySvc=n}async parse(e){const t={terms:{},params:this.params,path:"",lang:"",kind:"",title:"",description:"",weight:0};try{await this.parseCustomized(t)}catch(e){throw e}try{await this.parseTerms(t)}catch(e){throw e}try{await this.parseTitle(t)}catch(e){throw e}try{await this.parseDescription(t)}catch(e){throw e}try{await this.parseWeight(t)}catch(e){throw e}try{await this.parseDate(t)}catch(e){throw e}try{await this.parseOrganization(t,e)}catch(e){throw e}try{await this.parseAuthor(t,e)}catch(e){throw e}try{await this.parseMenu(t)}catch(e){throw e}return t}async parseDate(e){if(this.params){const t=this.params.date;null!=t&&(e.date=Cast.toTime(t))}}async parseWeight(e){if(e.weight=1e4,this.params){const t=this.params.weight;null!=t&&(e.weight=Cast.toInt(t))}}async parseTitle(e){if(this.params){const t=this.params.title;null!=t&&(e.title=Cast.toString(t))}}async parseDescription(e){if(this.params){const t=this.params.description;null!=t&&(e.description=Cast.toString(t))}}async parseCustomized(e){if(!this.params)return;const t=this.params.path;null!=t&&(e.path=this.toSlashPreserveLeading(Cast.toString(t)));const n=this.params.lang;if(null!=n){const t=Cast.toString(n).toLowerCase();this.langSvc.isLanguageValid(t)&&(e.lang=t)}const r=this.params.kind;if(null!=r){const t=Cast.toString(r);if(""!==t){const n=getKindMain(t);if(""===n)throw new Error(`unknown kind "${t}" in front matter`);e.kind=n}}}async parseTerms(e){const t=this.taxonomySvc.views();for(const n of t){const t=Types.toStringSlicePreserveString(getParam(this.params||{},n.plural(),!1));null!==t&&(e.terms[n.plural()]=t)}}async parseOrganization(e,t){if(!this.params)return;const n=this.params.organization;if(!n||"object"!=typeof n)return;const r={};void 0!==n.name&&null!==n.name&&(r.name=Cast.toString(n.name)),void 0!==n.description&&null!==n.description&&(r.description=Cast.toString(n.description)),void 0!==n.vision&&null!==n.vision&&(r.vision=Cast.toString(n.vision)),void 0!==n.website&&null!==n.website&&(r.website=Cast.toString(n.website)),void 0!==n.logo&&null!==n.logo&&(r.logo=import_path9.default.join(t,Cast.toString(n.logo)));const s=this.parseContact(n.contact);s&&(r.contact=s);const a=this.parseSocial(n.social);a&&(r.social=a),Object.keys(r).length>0&&(e.organization=r)}async parseMenu(e){if(!this.params)return;const t=this.params.menu;if(!t||"object"!=typeof t)return;const n={};for(const[e,r]of Object.entries(t))if(!1!==r){if(Array.isArray(r)){const t=this.parseMenuItems(r);t.length>0&&(n[e]=t)}else if(r&&"object"==typeof r){const t={};for(const[e,n]of Object.entries(r))if(!1===n)t[e]=!1;else if(Array.isArray(n)){const r=this.parseMenuItems(n);r.length>0&&(t[e]=r)}Object.keys(t).length>0&&(n[e]=t)}}else n[e]=!1;Object.keys(n).length>0&&(e.menu=n)}parseMenuItems(e){const t=[];for(const n of e){if(!n||"object"!=typeof n)continue;const e={title:"",url:""};if(void 0!==n.title&&null!==n.title&&(e.title=Cast.toString(n.title),void 0!==n.url&&null!==n.url)){{const t=Cast.toString(n.url);e.url=""===t?"":t}if(void 0!==n.weight&&null!==n.weight&&(e.weight=Cast.toInt(n.weight)),Array.isArray(n.children)){const t=this.parseMenuItems(n.children);t.length>0&&(e.children=t)}t.push(e)}}return t}async parseAuthor(e,t){if(!this.params)return;const n=this.params.author;if(!n||"object"!=typeof n)return;const r={};void 0!==n.name&&null!==n.name&&(r.name=Cast.toString(n.name)),void 0!==n.description&&null!==n.description&&(r.description=Cast.toString(n.description)),void 0!==n.website&&null!==n.website&&(r.website=Cast.toString(n.website)),void 0!==n.avatar&&null!==n.avatar&&(r.avatar=import_path9.default.join(t,Cast.toString(n.avatar)));const s=this.parseContact(n.contact);s&&(r.contact=s);const a=this.parseSocial(n.social);a&&(r.social=a),Object.keys(r).length>0&&(e.author=r)}parseContact(e){if(!e||"object"!=typeof e)return null;const t={};return void 0!==e.email&&null!==e.email&&(t.email=Cast.toString(e.email)),void 0!==e.address&&null!==e.address&&(t.address=Cast.toString(e.address)),void 0!==e.phone&&null!==e.phone&&(t.phone=Cast.toString(e.phone)),Object.keys(t).length>0?t:null}parseSocial(e){if(!e||"object"!=typeof e)return null;const t={},n=["github","twitter","linkedin"];for(const r of n)void 0!==e[r]&&null!==e[r]&&(t[r]=Cast.toString(e[r]));for(const[r,s]of Object.entries(e))n.includes(r)||null==s||(t[r]=Cast.toString(s));return Object.keys(t).length>0?t:null}toSlashPreserveLeading(e){return e.replace(/\\/g,"/")}};function getParamToLower(e,t){return getParam(e,t,!0)}function getParam(e,t,n){const r=e[t.toLowerCase()];if(null==r)return null;switch(typeof r){case"boolean":return r;case"string":return n?r.toLowerCase():r;case"number":return Number.isInteger(r)?Cast.toInt(r):r;default:return r instanceof Date?r:Array.isArray(r)&&r.every(e=>"string"==typeof e)&&n?Strings.sliceToLower(r):r}}var dimensionFlag_index=e=>{if(0===e)throw new Error("dimension flag not set");return e-1},LeafNode=class{key;val;constructor(e,t){this.key=e,this.val=t}},Edge=class{label;node;constructor(e,t){this.label=e,this.node=t}},Node=class{leaf=null;prefix="";edges=[];isLeaf(){return null!==this.leaf}addEdge(e){const t=this.edges.length;let n=0;for(;n<t&&this.edges[n].label<e.label;)n++;this.edges.splice(n,0,e)}updateEdge(e,t){const n=this.edges.length;let r=0;for(;r<n&&this.edges[r].label<e;)r++;if(!(r<n&&this.edges[r].label===e))throw new Error("replacing missing edge");this.edges[r].node=t}getEdge(e){const t=this.edges.length;let n=0;for(;n<t&&this.edges[n].label<e;)n++;return n<t&&this.edges[n].label===e?this.edges[n].node:null}delEdge(e){const t=this.edges.length;let n=0;for(;n<t&&this.edges[n].label<e;)n++;n<t&&this.edges[n].label===e&&this.edges.splice(n,1)}mergeChild(){const e=this.edges[0].node;this.prefix=this.prefix+e.prefix,this.leaf=e.leaf,this.edges=e.edges}};function longestPrefix(e,t){const n=Math.min(e.length,t.length);let r=0;for(r=0;r<n&&e[r]===t[r];r++);return r}var Tree=class e{root;size;constructor(){this.root=new Node,this.size=0}static newFromMap(t){const n=new e;if(t)if(t instanceof Map)t.forEach((e,t)=>{n.insert(t,e)});else for(const[e,r]of Object.entries(t))n.insert(e,r);return n}len(){return this.size}insert(e,t){let n=null,r=this.root,s=e;for(;;){if(0===s.length){if(r.isLeaf()){const e=r.leaf.val;return r.leaf.val=t,[e,!0]}return r.leaf=new LeafNode(e,t),this.size++,[void 0,!1]}if(n=r,r=r.getEdge(s.charCodeAt(0)),null===r){const r=new Edge(s.charCodeAt(0),new Node);return r.node.leaf=new LeafNode(e,t),r.node.prefix=s,n.addEdge(r),this.size++,[void 0,!1]}const a=longestPrefix(s,r.prefix);if(a===r.prefix.length){s=s.substring(a);continue}this.size++;const i=new Node;i.prefix=s.substring(0,a),n.updateEdge(s.charCodeAt(0),i),i.addEdge(new Edge(r.prefix.charCodeAt(a),r)),r.prefix=r.prefix.substring(a);const o=new LeafNode(e,t);if(s=s.substring(a),0===s.length)return i.leaf=o,[void 0,!1];const l=new Node;return l.leaf=o,l.prefix=s,i.addEdge(new Edge(s.charCodeAt(0),l)),[void 0,!1]}}delete(e){let t=null,n=0,r=this.root,s=e;for(;;){if(0===s.length){if(!r.isLeaf())break;const e=r.leaf;return r.leaf=null,this.size--,null!==t&&0===r.edges.length&&t.delEdge(n),r!==this.root&&1===r.edges.length&&r.mergeChild(),null===t||t===this.root||1!==t.edges.length||t.isLeaf()||t.mergeChild(),[e.val,!0]}if(t=r,n=s.charCodeAt(0),r=r.getEdge(n),null===r)break;if(!s.startsWith(r.prefix))break;s=s.substring(r.prefix.length)}return[void 0,!1]}async deletePrefix(e){return await this._deletePrefix(null,this.root,e)}async _deletePrefix(e,t,n){if(0===n.length){let n=0;return await recursiveWalk(t,(e,t)=>(n++,Promise.resolve(!1))),t.isLeaf()&&(t.leaf=null),t.edges=[],null===e||e===this.root||1!==e.edges.length||e.isLeaf()||e.mergeChild(),this.size-=n,n}const r=n.charCodeAt(0),s=t.getEdge(r);return null===s||!s.prefix.startsWith(n)&&!n.startsWith(s.prefix)?0:(n=s.prefix.length>n.length?n.substring(n.length):n.substring(s.prefix.length),this._deletePrefix(t,s,n))}get(e){let t=this.root,n=e;for(;;){if(0===n.length){if(t.isLeaf())return[t.leaf.val,!0];break}if(t=t.getEdge(n.charCodeAt(0)),null===t)break;if(!n.startsWith(t.prefix))break;n=n.substring(t.prefix.length)}return[void 0,!1]}longestPrefix(e){let t=null,n=this.root,r=e;for(;n.isLeaf()&&(t=n.leaf),0!==r.length&&(n=n.getEdge(r.charCodeAt(0)),null!==n)&&r.startsWith(n.prefix);)r=r.substring(n.prefix.length);return null!==t?[t.key,t.val,!0]:["",void 0,!1]}minimum(){let e=this.root;for(;;){if(e.isLeaf())return[e.leaf.key,e.leaf.val,!0];if(!(e.edges.length>0))break;e=e.edges[0].node}return["",void 0,!1]}maximum(){let e=this.root;for(;;){const t=e.edges.length;if(!(t>0)){if(e.isLeaf())return[e.leaf.key,e.leaf.val,!0];break}e=e.edges[t-1].node}return["",void 0,!1]}async walk(e){await recursiveWalk(this.root,e)}async walkPrefix(e,t){let n=this.root,r=e;for(;;){if(0===r.length)return void await recursiveWalk(n,t);if(n=n.getEdge(r.charCodeAt(0)),null===n)return;if(!r.startsWith(n.prefix))return void(n.prefix.startsWith(r)&&await recursiveWalk(n,t));r=r.substring(n.prefix.length)}}async walkPath(e,t){let n=this.root,r=e;for(;;){if(null!==n.leaf&&await t(n.leaf.key,n.leaf.val))return;if(0===r.length)return;if(n=n.getEdge(r.charCodeAt(0)),null===n)return;if(!r.startsWith(n.prefix))break;r=r.substring(n.prefix.length)}}async toMap(){const e={};return await this.walk((t,n)=>(e[t]=n,Promise.resolve(!1))),e}};async function recursiveWalk(e,t){if(null!==e.leaf&&await t(e.leaf.key,e.leaf.val))return!0;let n=0,r=e.edges.length;for(;n<r;){const s=e.edges[n];if(await recursiveWalk(s.node,t))return!0;if(0===e.edges.length)return recursiveWalk(e,t);e.edges.length>=r&&n++,r=e.edges.length}return!1}var WalkableTrees=class{trees;constructor(e){this.trees=e}walkPrefixRaw(e,t){for(const n of this.trees)n.walkPrefixRaw(e,t)}},MutableTrees=class{trees;constructor(e){this.trees=e}delete(e){for(const t of this.trees)t.delete(e)}deleteAll(e){for(const t of this.trees)t.deleteAll(e)}async deletePrefix(e){let t=0;for(const n of this.trees)t+=await n.deletePrefix(e);return Promise.resolve(t)}async deletePrefixAll(e){let t=0;for(const n of this.trees)t+=await n.deletePrefixAll(e);return t}lock(e){const t=this.trees.map(t=>t.lock(e));return()=>{for(const e of t)e()}}canLock(){for(const e of this.trees)if(!e.canLock())return!1;return!0}};function cleanKey(e){return"/"===e?"":e}function mustValidateKey(e){const t=function(e){return""===e?null:e.length<2?new Error(`too short key: "${e}"`):"/"!==e[0]?new Error(`key must start with '/': "${e}"`):"/"===e[e.length-1]?new Error(`key must not end with '/': "${e}"`):null}(e);if(t)throw t;return e}function newSimpleTree(){return new SimpleTree}var SimpleTree=class{mu;tree;zero;constructor(){this.tree=new Tree,this.zero=void 0;let e=!1,t=0;this.mu={lock:()=>{for(;e||t>0;);e=!0},unlock:()=>{e=!1},rLock:()=>{for(;e;);t++},rUnlock:()=>{t--}}}get(e){this.mu.rLock();try{const[t,n]=this.tree.get(e);return n?t:this.zero}finally{this.mu.rUnlock()}}longestPrefix(e){this.mu.rLock();try{const[t,n,r]=this.tree.longestPrefix(e);return r?[t,n]:["",this.zero]}finally{this.mu.rUnlock()}}insert(e,t){this.mu.lock();try{return this.tree.insert(e,t),t}finally{this.mu.unlock()}}async walkPrefix(e,t,n){switch(e){case 0:break;case 1:this.mu.rLock();break;case 2:this.mu.lock()}try{let e=null;return await this.tree.walkPrefix(t,async(t,r)=>{const[s,a]=n(t,r);return a?(e=a,Promise.resolve(!0)):s}),e}finally{switch(e){case 0:break;case 1:this.mu.rUnlock();break;case 2:this.mu.unlock()}}}},TreeShiftTree=class e{d;v;trees;constructor(e,t){if(t<=0)throw new Error("length must be > 0");this.d=e,this.v=0,this.trees=[];for(let e=0;e<t;e++)this.trees.push(newSimpleTree())}static newTreeShiftTree(t,n){return new e(t,n)}shape(t,n){if(t!==this.d)throw new Error("dimension mismatch");if(n>=this.trees.length)throw new Error("value out of range");const r=Object.create(e.prototype);return Object.assign(r,this),r.v=n,r}get(e){return this.trees[this.v].get(e)}longestPrefix(e){return this.trees[this.v].longestPrefix(e)}insert(e,t){return this.trees[this.v].insert(e,t)}async walkPrefix(e,t,n){return await this.trees[this.v].walkPrefix(e,t,n)}delete(e){for(const t of this.trees)t.tree.delete(e)}async deletePrefix(e){let t=0;for(const n of this.trees)t+=await n.tree.deletePrefix(e);return t}lock(e){if(e){for(const e of this.trees)e.mu.lock();return()=>{for(const e of this.trees)e.mu.unlock()}}for(const e of this.trees)e.mu.rLock();return()=>{for(const e of this.trees)e.mu.rUnlock()}}},NodeShiftTree=class e{tree;dims;shifter;mu;constructor(e){if(!e.shifter)throw new Error("Shifter is required");this.shifter=e.shifter,this.tree=new Tree,this.dims=[0];let t=!1,n=0;this.mu={lock:()=>{for(;t||n>0;);t=!0},unlock:()=>{t=!1},rLock:()=>{for(;t;);n++},rUnlock:()=>{n--},tryLock:()=>!(t||n>0||(t=!0,0))}}static new(t){return new e(t)}delete(e){this.deleteInternal(e)}async deleteAll(e){await this.tree.walkPrefix(e,(e,t)=>{const[n,r]=this.tree.delete(e);return Promise.resolve(!1)})}async deletePrefix(e){let t=0;const n=[];await this.tree.walkPrefix(e,(e,t)=>(n.push(e),Promise.resolve(!1)));for(const e of n)this.deleteInternal(e)&&t++;return t}deleteInternal(e){let t=!1;const[n,r]=this.tree.get(e);if(r){const[r,s]=this.shifter.delete(n,this.dims);t=r,s&&this.tree.delete(e)}return t}async deletePrefixAll(e){let t=0;return await this.tree.walkPrefix(e,(e,n)=>{const[r,s]=this.tree.delete(e);return s&&t++,Promise.resolve(!1)}),t}increment(e){return this.shape(e,this.dims[e]+1)}insertIntoCurrentDimension(e,t){e=mustValidateKey(cleanKey(e));const[n,r]=this.tree.get(e);return r&&(t=this.shifter.insertInto(n,t,this.dims)),this.tree.insert(e,t),[t,!0]}insertIntoValuesDimension(e,t){e=mustValidateKey(cleanKey(e));const[n,r]=this.tree.get(e);return r&&(t=this.shifter.insert(n,t)),this.tree.insert(e,t),[t,!0]}insertRawWithLock(e,t){this.mu.lock();try{return this.tree.insert(e,t)}finally{this.mu.unlock()}}insertWithLock(e,t){this.mu.lock();try{return this.insertIntoValuesDimension(e,t)}finally{this.mu.unlock()}}len(){return this.tree.len()}canLock(){const e=this.mu.tryLock();return e&&this.mu.unlock(),e}lock(e){return e?this.mu.lock():this.mu.rLock(),()=>{e?this.mu.unlock():this.mu.rUnlock()}}longestPrefix(e,t,n){let r=e;for(;;){const[e,s,a]=this.tree.longestPrefix(r);if(a){const[r,a]=this.shift(s,t);if(a&&(!n||n(r)))return[e,r]}if(""===r||"/"===r)return["",void 0];const i=r.lastIndexOf("/");if(0===i)r="";else{if(!(i>0))break;r=r.substring(0,i)}}return["",void 0]}longestPrefixAll(e){const[t,,n]=this.tree.longestPrefix(e);return[t,n]}getRaw(e){const[t,n]=this.tree.get(e);return n?[t,!0]:[void 0,!1]}async walkPrefixRaw(e,t){await this.tree.walkPrefix(e,(e,n)=>t(e,n))}shape(e,t){const n=this.clone();return n.dims[e]=t,n}toString(){return`Root{${this.dims}}`}get(e){const[t]=this.getInternal(e);return t}forEachInDimension(e,t,n){e=cleanKey(e);const[r,s]=this.tree.get(e);s&&this.shifter.forEachInDimension(r,t,n)}has(e){const[,t]=this.getInternal(e);return t}clone(){const t=Object.create(e.prototype);return Object.assign(t,this),t.dims=[...this.dims],t}shift(e,t){const[n,r]=this.shifter.shift(e,this.dims,t);return[n,r]}getInternal(e){e=cleanKey(e);const[t,n]=this.tree.get(e);if(!n)return[void 0,!1];const[r,s]=this.shift(t,!0);return[r,s]}},NodeShiftTreeWalker=class e{tree;handle;prefix;lockType;noShift;exact;debug;walkContext;skipPrefixes=[];constructor(e){if(!e.tree)throw new Error("Tree is required");this.tree=e.tree,this.handle=e.handle,this.prefix=e.prefix||"",this.lockType=e.lockType||0,this.noShift=e.noShift||!1,this.exact=e.exact||!1,this.debug=e.debug||!1,this.walkContext=e.walkContext}extend(){const t=new e({tree:this.tree,handle:this.handle,prefix:this.prefix,lockType:this.lockType,noShift:this.noShift,exact:this.exact,debug:this.debug,walkContext:this.walkContext});return t.resetLocalState(),t}skipPrefix(...e){this.skipPrefixes.push(...e)}shouldSkip(e){for(const t of this.skipPrefixes)if(e.startsWith(t))return!0;return!1}async walk(){this.resetLocalState();let e=null;this.lockType>0&&(e=this.tree.lock(2===this.lockType));try{let e=null;const t=async(t,n)=>{if(this.shouldSkip(t))return!1;const[r,s,a]=this.toT(this.tree,n);if(!s)return!1;const[i,o]=await this.handle(t,r,a);return!(!i&&!o||(e=o,0))};return""!==this.prefix?await this.tree.tree.walkPrefix(this.prefix,t):await this.tree.tree.walk(t),e}finally{e&&e()}}resetLocalState(){this.skipPrefixes=[]}toT(e,t){if(this.noShift)return[t,!0,2];{const[n,r,s]=e.shifter.shift(t,e.dims,this.exact);return[n,r,s]}}},Shifter2=class{delete(e,t){return[e.delete(t[dimensionFlag_index(1)]),e.isEmpty()]}shift(e,t,n){const[r,s]=e.shift(t[dimensionFlag_index(1)],n);return null!==r?s?[r,!0,1]:[r,!0,2]:[new PageTreesNode,!1,2]}forEachInDimension(e,t,n){if(t!==dimensionFlag_index(1))throw new Error("only language dimension supported");n(e)}insertInto(e,t,n){return e.mergeWithLang(t,n[dimensionFlag_index(1)])}insert(e,t){return e.merge(t)}},PageShifter=class extends Shifter2{shift(e,t,n){const[r,s]=e.shift(t[dimensionFlag_index(1)],n);return null!==r&&s?[r,!0,1]:[new PageTreesNode,!1,2]}},SourceShifter=class extends Shifter2{shift(e,t,n){const[r,s]=e.shift(t[dimensionFlag_index(1)],n);return null!==r?s?[r,!0,1]:[r,!0,2]:[new PageTreesNode,!1,2]}},WeightedTermTreeNode=class{pageTreesNodeInstance;term;constructor(e,t){this.pageTreesNodeInstance=e,this.term=t}getPage(){return this.pageTreesNodeInstance.getPage()}getPages(){return this.pageTreesNodeInstance.getPages()}getResource(){return this.pageTreesNodeInstance.getResource()}isEmpty(){return this.pageTreesNodeInstance.isEmpty()}shift(e,t){return this.pageTreesNodeInstance.shift(e,t)}},PageTreesNode=class{nodes;constructor(){this.nodes=new Map}setNode(e,t){this.nodes.set(e,t)}merge(e){const t=new Map;for(const e of this.nodes.keys())t.set(e.pageLanguage(),e);for(const[n,r]of e.nodes.entries()){const e=t.get(n.pageLanguage());e?this.nodes.set(e,r):this.nodes.set(n,r)}return this}mergeWithLang(e,t){const n=new Map;for(const e of this.nodes.keys())n.set(e.pageLanguage(),e);for(const[r,s]of e.nodes.entries()){const e=n.get(r.pageLanguage());if(e){const n=this.nodes.get(e);n&&n.pageIdentity().pageLanguageIndex()===t&&this.remove(e)}this.nodes.set(r,s)}return this}remove(e){const t=this.nodes.get(e);return!!t&&(this.markStale(t),this.nodes.delete(e),!0)}delete(e){for(const[t,n]of this.nodes.entries())if(n.pageIdentity().pageLanguageIndex()===e)return this.remove(t);return!1}isEmpty(){return 0===this.nodes.size}shift(e,t){let n=null;for(const[t,r]of this.nodes.entries())if(null===n&&(n=r),r.pageIdentity().pageLanguageIndex()===e)return[newPageTreesNode2(r),!0];return null===n||t?[null,!1]:[newPageTreesNode2(n),!1]}getPage(){for(const e of this.nodes.values())if(e&&"function"==typeof e.kind)return[e,!0];return[null,!1]}getPages(){const e=[];for(const t of this.nodes.values())t&&"function"==typeof t.kind&&e.push(t);return e}getResource(){for(const e of this.nodes.values())return[e,!0];return[null,!1]}markStale(e){"staleVersions"in e&&e.staleVersions}},PageTrees=class{treePages;treeResources;treePagesResources;treeTaxonomyEntries;resourceTrees;constructor(){this.treePages=new NodeShiftTree({shifter:new PageShifter}),this.treeResources=new NodeShiftTree({shifter:new SourceShifter}),this.treeTaxonomyEntries=TreeShiftTree.newTreeShiftTree(0,10),this.treePagesResources=new WalkableTrees([]),this.resourceTrees=new MutableTrees([]),this.treePagesResources=new WalkableTrees([this.treePages,this.treeResources]),this.resourceTrees=new MutableTrees([this.treeResources])}createMutableTrees(){this.treePagesResources=new WalkableTrees([this.treePages,this.treeResources]),this.resourceTrees=new MutableTrees([this.treeResources])}get TreePages(){return this.treePages}get TreeResources(){return this.treeResources}get TreePagesResources(){return this.treePagesResources}get TreeTaxonomyEntries(){return this.treeTaxonomyEntries}get ResourceTrees(){return this.resourceTrees}};function newPageTreesNode2(e){const t=new PageTreesNode;return e&&t.setNode(e.pageIdentity(),e),t}init_log();var pageIDCounter=0,log23=getDomainLogger("content",{component:"pagesource"}),Source=class{id;identity;file;constructor(e){this.id=(++pageIDCounter).toString(),this.identity=new Identity(pageIDCounter),this.file=e}sourceKey(){return`${this.identity.lang}/${this.file.filename()}`.replace(/\\/g,"/")}async contentSource(){return await this.readSourceAll()}async readSourceAll(){try{const e=await this.file.open(),t=await e.stat(),n=new Uint8Array(t.size()),r=await e.read(n);return await e.close(),r.buffer}catch(e){const t=e instanceof Error?e.message:String(e);throw new Error(`Failed to read file content: ${t}`)}}async posOffset(e){try{const t=await this.contentSource();return function(e,t,n){if(n<0)return{filename:e,lineNumber:0,columnNumber:0,offset:0};const r=t.slice(0,n);let s=1;for(let e=0;e<r.length;e++)10===r[e]&&s++;let a=-1;for(let e=r.length-1;e>=0;e--)if(10===r[e]){a=e;break}return{filename:e,lineNumber:s,columnNumber:n-a,offset:n}}(this.file.filename(),t,e)}catch(e){throw new Error(`failed to read content source for "${this.file.filename()}": ${e}`)}}pageIdentity(){return this.identity}pageFile(){return this.file}staleVersions(){return[]}section(){return this.file.section()}paths(){return this.file.paths()}path(){return this.file.paths().path()}slug(){return this.pathToSlug(this.path())}pathToSlug(e){let t=e.replace(/^\//,"");return t=t.replace(/\.md$/,""),t.endsWith("/index")&&(t=t.replace(/\/index$/,"")),"index"!==t&&""!==t||(t="index"),t.endsWith("/_index")&&(t=t.replace(/\/_index$/,"")),t}opener(){return()=>this.file.open()}openReader(){return{read:async()=>new Uint8Array(0)}}async content(){try{return log23.error(`Reading content not implemented from: ${this.file.filename()}`),new Uint8Array(0)}catch(e){const t=`failed to read content source for "${this.file.filename()}": ${e}`;throw log23.error(t),new Error(t)}}};function newPageSource(e){return new Source(e)}init_log();var log24=getDomainLogger("content",{component:"pagemap"});function addTrailingSlash(e){return e.endsWith("/")||(e+="/"),e}var ambiguousContentNode=new PageTreesNode,ContentTreeReverseIndexMap=class{initOnce=!1;m=new Map;constructor(){}},ContentTreeReverseIndex=class{initFn;contentTreeReverseIndexMap;constructor(e){this.initFn=e,this.contentTreeReverseIndexMap=new ContentTreeReverseIndexMap}reset(){this.contentTreeReverseIndexMap=new ContentTreeReverseIndexMap}get(e){return this.contentTreeReverseIndexMap.initOnce||(this.contentTreeReverseIndexMap.m=new Map,this.initFn(this.contentTreeReverseIndexMap.m),this.contentTreeReverseIndexMap.initOnce=!0),this.contentTreeReverseIndexMap.m.get(e)||null}},pagePredicates_kindPage=e=>"page"===e.kind(),pagePredicates_shouldListLocal=e=>!e.shouldList||e.shouldList(!1),pagePredicates_shouldListGlobal=e=>!e.shouldList||e.shouldList(!0),PageMapQueryPagesBelowPathImpl=class{path;keyPart;include;constructor(e,t,n=pagePredicates_shouldListLocal){this.path=e,this.keyPart=t,this.include=n}key(){return this.path+"/"+this.keyPart}},PageMapQueryPagesInSectionImpl=class extends PageMapQueryPagesBelowPathImpl{recursive;includeSelf;index;constructor(e,t,n,r,s,a){super(e,t,a),this.recursive=n,this.includeSelf=r,this.index=s}key(){return"gagesInSection/"+super.key()+"/"+this.recursive.toString()+"/"+this.index.toString()+"/"+this.includeSelf.toString()}},PageMap=class extends PageTrees{pageReverseIndex=null;pageBuilder;constructor(e){super(),this.pageBuilder=e}setupReverseIndex(){this.pageReverseIndex=new ContentTreeReverseIndex(async e=>{const t=new NodeShiftTreeWalker({tree:this.treePages,lockType:1,handle:async(t,n,r)=>{if(n){const[t,r]=n.getPage();if(!r)return[!1,null];t.pageFile&&t.pageFile()&&((t,n)=>{const r=e.get(t);r&&r!==ambiguousContentNode?e.set(t,ambiguousContentNode):r||e.set(t,n)})(t.paths().baseNameNoIdentifier(),n)}return[!1,null]}});try{await t.walk()}catch(e){log24.error(`setupReverseIndex error: ${e}`)}})}insertResourceNode(e,t){const n=this.treeResources,r=n.lock(!0);try{n.insertIntoValuesDimension(e,t)}finally{r()}}async addFi(e){if(e.fileInfo().isDir())return;const t=newPageSource(e),n=t.paths().base();switch(t.file.getBundleType()){case 0:this.insertResourceNode(n,newPageTreesNode2(t));break;case 1:const e=await this.pageBuilder.withSource(t).build();if(!e)return;this.insertResourceNode(n,newPageTreesNode2(e));break;default:const r=await this.pageBuilder.withSource(t).build();this.treePages.insertWithLock(t.paths().base(),newPageTreesNode2(r))}}async assemble(){await this.assembleStructurePages(),await this.applyAggregates(),await this.cleanPages(),await this.assembleTerms()}async assembleTerms(){for(const e of this.pageBuilder.langSvc.languageIndexes()){const t=this.treePages.shape(0,e),n=this.treeTaxonomyEntries.shape(0,e);await this.pageBuilder.term.assemble(t,n,this.pageBuilder,e)}}async cleanPages(){}async applyAggregates(){}async assembleStructurePages(){await this.addMissingTaxonomies();for(const e of this.pageBuilder.langSvc.languageIndexes()){const t=this.treePages.shape(0,e);await this.pageBuilder.section.assemble(t,this.pageBuilder,e)}await this.addMissingStandalone()}async addMissingTaxonomies(){const e=this.treePages.lock(!0);try{for(const e of this.pageBuilder.langSvc.languageIndexes()){const t=this.treePages.shape(0,e);await this.pageBuilder.taxonomy.assemble(t,this.pageBuilder,e)}}finally{e()}}async addMissingStandalone(){const e=this.treePages,t=e.lock(!0);try{await this.pageBuilder.standalone.assemble(e,this.pageBuilder)}finally{t()}}async getResourcesForPage(e){const t=[];return await this.forEachResourceInPage(e,0,!1,(e,n,r)=>{const[s,a]=n.getResource();return a&&t.push(s),[!1,null]}),t}async forEachResourceInPage(e,t,n,r){let s=e.paths().base();"/"===s&&(s="");const a=addTrailingSlash(s),i="page"!==e.kind(),o=new NodeShiftTreeWalker({tree:this.treeResources.shape(0,e.pageIdentity().pageLanguageIndex()),prefix:a,lockType:t,exact:n,handle:async(e,t,n)=>{if(i){const[t]=this.treePages.longestPrefixAll(e);if(t!==s&&this.pathDir(t)!==this.pathDir(e))return o.skipPrefix(t+"/"),[!1,null]}return r(e,t,n)}});try{await o.walk()}catch(e){log24.error(`forEachResourceInPage error: ${e}`)}}async getPagesInSection(e,t){const n=t.key(),r=this.treePages.shape(0,e);return this.getOrCreatePagesFromCacheSync(null,n,async e=>{const n=addTrailingSlash(t.path),s=[];let a="";const i=t.include,o=new NodeShiftTreeWalker({tree:r,prefix:n,handle:async(e,n,r)=>{if(t.recursive){const[e,t]=n.getPage();return t&&i(e)&&s.push(e),[!1,null]}const[l,c]=n.getPage();if(c&&i(l)&&s.push(l),!l.isPage||!l.isPage()){const t=e+"/";""!==a&&a===t||o.skipPrefix(t),a=t}return[!1,null]}});try{if(await o.walk(),t.includeSelf){const e=r.get(t.path);if(e){const[t,n]=e.getPage();n&&i(t)&&s.push(t)}}const e=s;return function(e){pageBy(weight).sort(e)}(e),Promise.resolve(e)}catch(e){log24.error(`getPagesInSection error: ${e}`)}return Promise.resolve(s)})}async getOrCreatePagesFromCacheSync(e,t,n){return await n(t)}async getPagesWithTerm(e,t){const n=t.key(),r=this.treeTaxonomyEntries.shape(0,e);return await this.getOrCreatePagesFromCacheSync(null,n,async e=>{const n=[],s=t.include;try{await r.walkPrefix(0,addTrailingSlash(t.path),(e,t)=>{const[r,a]=t.getPage();return a&&s(r)&&n.push(r),[!1,null]});const e=n;return sortByDefault(e),e}catch(e){log24.error(`getPagesWithTerm error: ${e}`)}return n})}getTermsForPageInTaxonomy(e,t,n){const r=((s=n).startsWith("/")||(s="/"+s),s);var s;const a=this.treeTaxonomyEntries.shape(0,e);return this.getOrCreatePagesFromCacheSync(null,r+t,async e=>{const n=[];try{await a.walkPrefix(0,addTrailingSlash(r),(e,r)=>(e.endsWith(t)&&n.push(r.term.page),[!1,null]));const e=n;return sortByDefault(e),e}catch(e){log24.error(`getTermsForPageInTaxonomy error: ${e}`)}return n})}async getSections(e,t){const n=[];let r="";const s=this.treePages.shape(0,e),a=new NodeShiftTreeWalker({tree:s,prefix:t,handle:async(e,t,s)=>{const[i,o]=t.getPage();return o?(i.isPage&&i.isPage()||(""!==r&&e.startsWith(r)||(i.isSection&&i.isSection()&&i.shouldList&&i.shouldList(!1)&&i.parent&&i.parent()===i?n.push(i):a.skipPrefix(e+"/")),r=e+"/"),[!1,null]):[!1,null]}});try{await a.walk();const e=n;return sortByDefault(e),e}catch(e){log24.error(`getSections error: ${e}`)}return n}pathDir(e){const t=e.lastIndexOf("/");return-1===t?"":e.substring(0,t)}};init_log();var log25=getDomainLogger("content",{component:"pagecollector"}),PagesCollector=class{m;fs;processedPaths=new Set;constructor(e,t){this.m=e,this.fs=t}async collect(){try{const e="",t=this.fs.contentFs();for(const n of t){this.processedPaths.clear();const t=await n.stat(e);await this.collectDir(n,e,t)}}catch(e){log25.error(`Failed to collect directory: ${e}, continuing...`)}}async collectDir(e,t,n){try{await this.fs.walkContent(e,t,{hookPre:async(e,t,n)=>{const r=t;if(this.processedPaths.has(r))return log25.warn("Path already processed!",{path:r,dirName:e.name(),dirIsDir:e.isDir(),readdirLength:n.length}),[];if(this.processedPaths.add(r),0===n.length)return[];for(const e of n){if(e.isDir&&e.isDir())continue;const t=newFileInfo2(e);await this.m.addFi(t)}return n},walkFn:async(e,t)=>{}},{info:n})}catch(e){throw log25.error(`Failed to collect directory: ${e}`,{path:t,rootName:n.name(),rootIsDir:n.isDir(),stack:e.stack||"No stack trace available"}),new Error(`Failed to collect directory: ${e}`)}}async handleBundleLeaf(e,t,n,r){const s=t.paths(),a=async(e,n)=>{if(n.isDir())return;const r=newFileInfo2(n);n!==t.fileInfo()&&(r.isLeafBundle()&&r.paths().dir()===s.dir()||r.shiftToResource()),await this.m.addFi(r)},i=this.fs.contentFs();for(const t of i)await this.fs.walkContent(t,n,{walkFn:a},{info:e,dirEntries:r})}};init_log();var log26=getDomainLogger("content",{component:"content"}),Content2=class{fs;converter;pageMap;translator;pageCollected=!1;constructor(e,t,n,r){this.fs=e,this.converter=t,this.pageMap=n,this.translator=r}setTemplateSvc(e){this.pageMap.pageBuilder.templateSvc=e}async renderString(e,...t){if(t.length<1||t.length>2)throw new Error("RenderString want 1 or 2 arguments");let n=1;if(1!==t.length){const e=t[0];if("object"!=typeof e||null===e)throw new Error("first argument must be a map");throw new Error("RenderString not implemented yet")}n=0;const r=t[0],s=String(r);return newFileInfo2(this.fs.newFileMetaInfoWithContent(s)),s}async collectPages(){if(this.pageCollected)log26.info("Pages have already been collected, skipping.");else try{await this.process(),await this.assemble(),this.pageCollected=!0}catch(e){throw new Error(`process/assemble: ${e}`)}}async process(){try{const e=new PagesCollector(this.pageMap,this.fs);await e.collect()}catch(e){throw e}}async assemble(){try{await this.pageMap.assemble()}catch(e){throw e}}async getPageSources(e){let t=e.paths().base();return"/"===t&&(t=""),await this.pageMap.getResourcesForPage(e)}async globalPages(e){return await this.pageMap.getPagesInSection(e,new PageMapQueryPagesInSectionImpl("","global",!0,!0,0,pagePredicates_shouldListGlobal))}async globalRegularPages(){return await this.pageMap.getPagesInSection(0,new PageMapQueryPagesInSectionImpl("","global",!0,!0,0,e=>pagePredicates_shouldListGlobal(e)&&pagePredicates_kindPage(e)))}async walkPages(e,t){const n=this.pageMap.treePages.shape(0,e),r=new NodeShiftTreeWalker({tree:n,handle:async(e,n,r)=>{const[s,a]=n.getPage();if(!a)return[!1,null];try{await t(s)}catch(e){return[!1,e instanceof Error?e:new Error(String(e))]}return[!1,null]}});try{await r.walk()}catch(t){throw log26.error(`WalkPages failed for langIndex ${e}:`,t),t}}async walkTaxonomies(e,t){try{const n=this.pageMap.treePages.shape(0,e),r=this.pageMap.pageBuilder.taxonomy;for(const s of r.views){const a=r.pluralTreeKey(s.plural()),i=new NodeShiftTreeWalker({tree:n,prefix:addTrailingSlash(a),lockType:1,handle:async(n,r,a)=>{const[i,o]=r.getPage();if(!o)return[!1,null];if("term"===i.kind()){const r=i;if(!r.term)return[!0,new Error("term is empty")];const a=r.term.toLowerCase();try{const i=this.pageMap.treeTaxonomyEntries.shape(0,e);return await i.walkPrefix(1,addTrailingSlash(n),(e,n)=>{const[i,o]=n.getPage();return o?(t(s.plural(),a,{weight:()=>n.term.Weight(),ordinal:()=>n.term.Ordinal(),page:()=>i,owner:()=>r}).catch(e=>{log26.error("Error in taxonomy walker:",e)}),[!1,null]):[!1,null]}),[!1,null]}catch(e){return[!0,e]}}return[!1,null]}});await i.walk()}}catch(e){throw e}}getPageFromPath(e,t){try{const n=PathDomain.createProcessor().parse(PATH_CONSTANTS.COMPONENT_FOLDER_CONTENT,t);let r=this.pageMap.treePages.shape(0,e).get(n.base());if(r){const[e,t]=r.getPage();if(t)return e}return null}catch(e){return log26.error(`❌ Content.getPageFromPath error for path "${t}":`,e),null}}getPageFromFile(e,t){try{let n=this.pageMap.treePages.shape(0,e).get(t.paths().base());if(n){const[e,t]=n.getPage();if(t)return e}return null}catch(e){return log26.error(`❌ Content.getPageFromPath error for path "${t.path()}":`,e),null}}async handleChangeFiles(e){const t=[];for(const[n,r]of e)try{await this.addOrUpdateFile(r,t)}catch(e){log26.error(`Failed to process file change for ${n}:`,e)}return t}async addOrUpdateFile(e,t){if(!e.isDir())try{const n=newFileInfo2(e),r=n.paths().base();r&&t.push(r),await this.pageMap.addFi(n);const s=this.getPageFromFile(0,n);s&&s.pageIdentity&&s.pageIdentity().markStale()}catch(t){throw log26.error(`Failed to add/update file in PageMap: ${e.fileName()}`,t),t}}translate(e,t){return this.translator?this.translator.translate(e,t):(log26.warn("Translator not initialized, returning fallback translation"),`[i18n] ${t}`)}getAvailableLanguages(){return this.translator?this.translator.getAvailableLanguages():[]}hasLanguageSupport(e){return!!this.translator&&this.translator.hasLanguage(e)}},MDConverter=class{md;constructor(e){this.md=e}async convert(e,t){return this.md.render(t,e)}async parseContent(e){return this.md.parseContent(e)}async parseAndRenderContent(e,t){return this.md.parseAndRenderContent(e,t)}async prepareRender(e){return this.md.prepareRender(e)}},Content3=class{rawSource;frontMatter;renderedContent="";summary="";wordCount=0;readingTime=0;toc;lazyRendered=!0;lazyRender;constructor(e){this.rawSource=e}updateWithContentResult(e){e.frontMatter&&(this.frontMatter=e.frontMatter),this.renderedContent=e.renderedContent||"",this.summary=e.summary,this.wordCount=e.wordCount||0,this.readingTime=e.readingTime||0}getRawSource(){return this.rawSource}async RenderedContent(){return await this.render(),this.renderedContent}async Summary(){return await this.render(),this.summary}async WordCount(){return await this.render(),this.wordCount}async ReadingTime(){return await this.render(),this.readingTime}async render(){return this.lazyRendered&&this.lazyRender&&(await this.lazyRender(),this.lazyRendered=!1),Promise.resolve()}isEmpty(){return!this.rawSource||0===this.rawSource.length}};function newContent(e){return new Content3(e)}init_log();var log27=getDomainLogger("content",{component:"section"}),Section=class{home;seen;fsSvc;constructor(e){this.home=null,this.seen={},this.fsSvc=e}isHome(e){return""===e}isSectionExist(e){return!(""!==e&&!this.seen[e]&&(this.seen[e]=!0,1))}async assemble(e,t,n){this.seen={};const r=new NodeShiftTreeWalker({tree:e,lockType:2,handle:async(e,s,a)=>{if(!s)throw new Error("n is null");const[i,o]=s.getPage();if(!o)return[!1,null];if(this.isHome(e))return this.home=i,[!1,null];const l=i.kind();if(l!==getKindMain("page")&&l!==getKindMain("section"))return[!1,null];const c=i.paths().sections();for(const e of c)if(!this.isSectionExist(e))try{const s=newPageSource(newFileInfo2(this.fsSvc.newFileMetaInfo("/"+e+"/_index.md"))),a=s.paths().base();if(!r.tree.get(a)){const e=await t.withSource(s).withLangIdx(n).kindBuild();r.tree.insertIntoValuesDimension(a,newPageTreesNode2(e))}}catch(e){return[!1,e]}return[!1,null]}});try{await r.walk()}catch(e){throw log27.error("Error walking pages:",e),e}if(!this.home&&(await this.createHome(t),this.home)){const t=this.home;e.insertWithLock(t.paths().base(),newPageTreesNode2(t))}}async createHome(e){const t=newPageSource(newFileInfo2(this.fsSvc.newFileMetaInfo("/_index.md"))),n=await e.withSource(t).kindBuild();this.home=n}},Standalone=class{fsSvc;constructor(e){this.fsSvc=e}async assemble(e,t){const n="/404",r=await this.addStandalone(n,t);e.insertIntoValuesDimension(n,newPageTreesNode2(r));const s="/_sitemap",a=await this.addStandalone(s,t);e.insertIntoValuesDimension(s,newPageTreesNode2(a))}async addStandalone(e,t){const n=newPageSource(newFileInfo2(this.fsSvc.newFileMetaInfo(e+".md")));return await t.withSource(n).kindBuild()}};init_log();var Output=class{source;pageKind;baseName;target=null;constructor(e,t){this.source=e,this.pageKind=t,this.baseName="",this.setBasename(),this.buildTarget()}setBasename(){switch(this.pageKind){case getKindMain("404"):this.baseName="404";break;case getKindMain("sitemap"):this.baseName="sitemap";break;default:this.baseName=this.source.paths().baseNameNoIdentifier()||"index"}}buildTarget(){let e="",t="";const n="index";switch(this.pageKind){case getKindMain("home"):e=`${n}.html`,t="";break;case getKindMain("page"):const r=this.source.paths().containerDir();e=r&&"/"!==r?`${r}/${this.baseName}.html`:`/${this.baseName}.html`,t=r||"";break;case getKindMain("section"):case getKindMain("taxonomy"):case getKindMain("term"):const s=this.source.paths().dir();e=s?`${s}/${n}.html`:`${n}.html`,t=s||"";break;case getKindMain("404"):const a=this.source.paths().dir();e=a?`${a}/${this.baseName}.html`:`${this.baseName}.html`,t=a||"";break;case getKindMain("sitemap"):const i=this.source.paths().dir();e=i?`${i}/${this.baseName}.xml`:`${this.baseName}.xml`,t=i||"";break;default:e=`${n}.html`,t=""}this.target={prefix:this.source.identity.pageLanguage(),filePath:e,subResourceBaseTarget:t}}createBasicResult(){return{bytes:()=>new Uint8Array,headers:()=>[],tableOfContents:()=>({toHTML:(e,t,n)=>""})}}output(e){return{targetFileBase:()=>{if(!this.target)return"index.html";const e=this.target.filePath,t=e.lastIndexOf("/");return t>=0?e.substring(t+1):e},targetFilePath:()=>this.target.filePath,targetSubResourceDir:()=>this.target.subResourceBaseTarget,targetPrefix:()=>this.target.prefix,content:async()=>e.content?e.content.RenderedContent():"",summary:async()=>e.content?e.content.Summary():"",tableOfContents:()=>e.content&&e.content.toc?e.content.toc.toHTML(1,6,!1):"",result:()=>this.createBasicResult(),readingTime:async()=>e.content?e.content.ReadingTime():0,wordCount:async()=>e.content?e.content.WordCount():0}}};init_log(),getDomainLogger("content",{component:"paginator"});var PaginatorImpl=class{paginatedElements;_pagers;base;total;size;constructor(e,t,n,r){if(this.paginatedElements=e,this.base=r,this.total=t,this.size=n,this._pagers=[],e.length>0)for(let t=0;t<e.length;t++)this._pagers.push(new PagerImpl(t+1,this));else this._pagers.push(new PagerImpl(1,this))}totalPages(){return this.paginatedElements.length}pagers(){return[...this._pagers]}getElement(e){return 0===this.paginatedElements.length?[]:this.paginatedElements[e-1]||[]}getBase(){return this.base}getPagers(){return this._pagers}getAllPages(){const e=[];for(const t of this.paginatedElements)e.push(...t);return e}},PagerImpl=class{number;paginator;constructor(e,t){this.number=e,this.paginator=t}pageNumber(){return this.number}totalPages(){return this.paginator.totalPages()}url(){const e=this.pageNumber();if(e>1){const t=`/page/${e}/`;return this.pathJoin(this.paginator.getBase(),t)}return this.paginator.getBase()}pages(){return this.element()}allPages(){return this.paginator.getAllPages()}pagers(){return this.paginator.pagers()}first(){return this.paginator.getPagers()[0]}last(){const e=this.paginator.getPagers();return e[e.length-1]}hasPrev(){return this.pageNumber()>1}prev(){return this.hasPrev()?this.paginator.getPagers()[this.pageNumber()-2]:null}hasNext(){return this.pageNumber()<this.paginator.totalPages()}next(){return this.hasNext()?this.paginator.getPagers()[this.pageNumber()]:null}element(){return this.paginator.getElement(this.pageNumber())}pathJoin(e,t){return e.endsWith("/")&&(e=e.slice(0,-1)),t.startsWith("/")||(t="/"+t),e+t}},PaginatorManagerImpl=class{currentPager=null;initialized=!1;svc;page;constructor(e,t){this.svc=e,this.page=t}async current(){return this.initialized||await this.initializePaginator(),this.currentPager?this.currentPager:new PaginatorImpl([],0,10,this.page.paths().base()).pagers()[0]}setCurrent(e){this.currentPager=e}async paginate(e){if(!this.initialized){const t=this.svc.pageSize();let n;n=Array.isArray(e)&&e.length>0&&"key"in e[0]?this.newPaginatorFromPageGroups(e,t,this.page.paths().base()):this.newPaginatorFromPages(e,t,this.page.paths().base()),this.currentPager=n.pagers()[0],this.initialized=!0}return this.currentPager||this.current()}async paginator(){return this.initialized||await this.initializePaginator(),this.currentPager||this.current()}async initializePaginator(){try{const e=this.svc.pageSize();let t=[];switch(this.page.kind()){case"home":t=await this.svc.globalRegularPages();break;case"term":case"taxonomy":const e=await this.page.pages();t=e?.length?Array.from({length:e.length},(t,n)=>e[n]):[];break;default:const n=await this.page.regularPages();t=n&&n.length>0?Array.from({length:n.length},(e,t)=>n[t]):await this.svc.globalRegularPages()}const n=this.page.paths().base(),r=this.newPaginatorFromPages(t,e,n);this.currentPager=r.pagers()[0],this.initialized=!0}catch(e){const t=this.page.paths().base(),n=new PaginatorImpl([],0,10,t);this.currentPager=n.pagers()[0],this.initialized=!0}}newPaginatorFromPages(e,t,n){if(t<=0)throw new Error("paginator size must be positive");const r=this.splitPages(e,t);return new PaginatorImpl(r,e.length,t,n)}newPaginatorFromPageGroups(e,t,n){if(t<=0)throw new Error("paginator size must be positive");const r=[];if(e&&e.length>0)for(let t=0;t<e.length;t++){const n=e[t];if(n&&n.pages){const e=n.pages();if(e)for(let t=0;t<e.length;t++)r.push(e[t])}}const s=this.splitPages(r,t);return new PaginatorImpl(s,r.length,t,n)}splitPages(e,t){const n=[];for(let r=0;r<e.length;r+=t){const s=Math.min(r+t,e.length);n.push(e.slice(r,s))}return n}},Scratch=class{values;constructor(){this.values=new Map}add(e,t){const n=this.values.get(e);let r;return r=void 0!==n?Array.isArray(n)?[...n,t]:"number"==typeof n&&"number"==typeof t||"string"==typeof n&&"string"==typeof t?n+t:t:t,this.values.set(e,r),""}Add(e,t){return this.add(e,t)}set(e,t){return this.values.set(e,t),""}Set(e,t){return this.set(e,t)}delete(e){return this.values.delete(e),""}get(e){return this.values.get(e)}Get(e){return this.get(e)}getValues(){return this.values}setInMap(e,t,n){let r=this.values.get(e);return r&&"object"==typeof r||(r={},this.values.set(e,r)),r[t]=n,""}};function dir(e){const t=e.lastIndexOf("/");if(-1===t)return"";let n=e.slice(0,t+1);return n.length>1&&n.endsWith("/")&&(n=n.slice(0,-1)),n}var import_path10=__toESM(require("path"));init_log(),getDomainLogger("content",{component:"page"});var PageImpl=class{source;content;meta;layout;pagerManager;title_;description_="";kind_;pageMap;output_=null;store_=null;constructor(e,t,n,r,s="",a="page",i=null){this.source=e,this.content=t,this.meta=n,this.layout=r,this.title_=s,this.kind_=a,this.pageMap=i,this.pagerManager=new PaginatorManagerImpl({pageSize:()=>10,globalRegularPages:async()=>[]},this)}rawContent(){if(!this.content)return"";const e=this.content.getRawSource();return(new TextDecoder).decode(e)}pageIdentity(){return this.source.identity}pageFile(){return this.source.file}staleVersions(){return[]}section(){return this.source.file.section()}paths(){return this.source.file.paths()}path(){return this.source.file.paths().path()}slug(){return this.pathToSlug(this.path())}pathToSlug(e){let t=e.replace(/^\//,"");return t=t.replace(/\.md$/,""),t.endsWith("/index")&&(t=t.replace(/\/index$/,"")),"index"!==t&&""!==t||(t="index"),t.endsWith("/_index")&&(t=t.replace(/\/_index$/,"")),t}posOffset(e){return this.source.posOffset(e)}description(){return this.description_}get Description(){return this.description()}StaticURL(e){return/^(https?:)?\/\//.test(e)?e:((e=(e=import_path10.default.normalize(e)).replace(/\\/g,"/")).startsWith("/")&&(e=e.slice(1)),`${this.meta.pageBaseUrl().replace(/\/+$/,"")}/${e}`)}params(){return this.meta.params()}get Params(){return this.params()}store(){return this.store_||(this.store_=new Scratch),this.store_}get Store(){return this.store()}scratch(){return this.store()}get Scratch(){return this.scratch()}pageBaseUrl(){return this.meta.pageBaseUrl()}pageWeight(){return this.meta.pageWeight()}pageDate(){return this.meta.pageDate()}publishDate(){return this.meta.publishDate()}async relatedKeywords(e){return this.meta.relatedKeywords(e)}shouldList(e){return this.meta.shouldList(e)}shouldListAny(){return this.meta.shouldListAny()}noLink(){return this.meta.noLink()}organization(){return this.meta.organization()}author(){return this.meta.author()}menu(){return this.meta.menu()}async current(){return await this.pagerManager.current()}setCurrent(e){this.pagerManager.setCurrent(e)}async paginator(){return await this.pagerManager.paginator()}async paginate(e){return this.pagerManager.paginate(e)}file(){return this.source.file}get Type(){return this.file().type()}name(){return this.source.file.baseFileName()}title(){return this.title_}get Title(){return this.title()}kind(){return this.kind_}isHome(){return this.kind()===getKindMain("home")}isPage(){return this.kind()===getKindMain("page")}isSection(){return this.kind()===getKindMain("section")}isAncestor(e){return e.path()!==this.path()&&e.paths().base().startsWith(this.paths().base())}eq(e){return this.pageIdentity().identifierBase()===e.pageIdentity().identifierBase()}layouts(){switch(this.kind_){case getKindMain("home"):return this.source.file.isBranchBundle()?this.layout.homeList():this.layout.home();case getKindMain("page"):return this.layout.page(this.source.file.section(),this.source.file.baseFileName());case getKindMain("section"):return this.layout.section(this.source.file.section());case getKindMain("taxonomy"):return this.layout.taxonomy();case getKindMain("term"):return this.layout.term();case getKindMain("404"):return this.layout.standalone404();case getKindMain("sitemap"):return this.layout.standaloneSitemap();default:return[]}}output(){return this.output_||(this.output_=new Output(this.source,this.kind())),this.output_.output(this)}get TargetPath(){return this.output().targetFilePath()}get Summary(){return this.output().summary()}truncated(){return!0}parent(){if(this.isHome())return null;let e=this.paths().containerDir();if(""===e)return null;for(;;){const t=this.pageMap?.treePages.longestPrefix(e,!0);if(!t)return null;const[n,r]=t;if(!r)return null;const[s,a]=r.getPage();if(!s)return null;if(this.isBundled())return a?s:null;if(!s.isPage())return a?s:null;e=dir(e)}}async Pages(){return await this.pages()}async pages(){const e=this.pageIdentity().pageLanguageIndex();switch(this.kind()){case"page":case"section":case"home":return await this.pageMap.getPagesInSection(e,new PageMapQueryPagesInSectionImpl(this.paths().base(),"page-section",!1,!1,e,e=>pagePredicates_shouldListLocal(e)&&(pagePredicates_kindPage(e)||(e=>"section"===e.kind())(e))));case"term":return await this.pageMap.getPagesWithTerm(e,new PageMapQueryPagesBelowPathImpl(this.paths().base(),"term"));case"taxonomy":return await this.pageMap.getPagesInSection(e,new PageMapQueryPagesInSectionImpl(this.paths().base(),"term",!0,!1,e,e=>pagePredicates_shouldListLocal(e)&&(e=>"term"===e.kind())(e)));default:return Promise.resolve([])}}prevInSection(){return null}nextInSection(){return null}sections(e){return[]}async regularPages(){const e=this.pageIdentity().pageLanguageIndex();switch(this.kind()){case"page":case"section":case"home":case"taxonomy":return this.pageMap?await this.pageMap.getPagesInSection(e,new PageMapQueryPagesInSectionImpl(this.paths().base(),"",!1,!1,e,e=>pagePredicates_shouldListLocal(e)&&pagePredicates_kindPage(e))):[];case"term":return this.pageMap?await this.pageMap.getPagesWithTerm(e,new PageMapQueryPagesBelowPathImpl(this.paths().base(),"",e=>pagePredicates_shouldListLocal(e)&&pagePredicates_kindPage(e))):[];default:return[]}}regularPagesRecursive(){return[]}async terms(e,t){return this.pageMap?this.pageMap?.getTermsForPageInTaxonomy(e,this.paths().base(),t):null}async isTranslated(){return(await this.translations()).length>0}async translations(){const e=this.path()+"/"+this.pageIdentity().pageLanguage()+"/translations";if(!this.pageMap)return[];try{return await this.pageMap.getOrCreatePagesFromCacheSync(null,e,async e=>{const t=await this.allTranslations(),n=[];for(let e=0;e<t.length;e++){const r=t.at(e);r&&!r.eq(this)&&n.push(r)}return n})}catch(e){throw e}}async allTranslations(){const e=this.path()+"/translations-all";if(!this.pageMap)return[];try{return await this.pageMap.getOrCreatePagesFromCacheSync(null,e,async e=>{const t=[];var n;return this.pageMap.treePages.forEachInDimension(this.paths().base(),dimensionFlag_index(1),e=>{if(null!=e){const n=e.getPages();t.push(...n)}return!1}),n=t,pageBy(language).sort(n),t})}catch(e){throw e}}isBundled(){return this.source.file.isBundle()}},TaxonomyPageImpl=class extends PageImpl{singular;constructor(e,t,n,r,s,a="",i="taxonomy",o=null){super(e,t,n,r,a,i,o),this.singular=s}params(){const e=super.params();return e.Singular=this.singular,e}},TermPageImpl=class extends TaxonomyPageImpl{term;constructor(e,t,n,r,s,a,i="",o="term",l=null){super(e,t,n,r,s,i,o,l),this.term=a}params(){const e=super.params();return e.Term=this.term,e}},Meta=class{baseURL;list;parameters;weight;date;org;authorInfo;menuConfig;constructor(e,t="always",n={},r=0,s=new Date,a,i,o){this.baseURL=e,this.list=t,this.parameters=n,this.weight=r,this.date=s,this.org=a,this.authorInfo=i,this.menuConfig=o}description(){return""}params(){return this.parameters}pageBaseUrl(){return this.baseURL}pageWeight(){return this.weight}pageDate(){return this.date}publishDate(){return this.pageDate()}async relatedKeywords(e){return[]}shouldList(e){switch(this.list){case"always":default:return!0;case"never":return!1;case"local":return!e}}shouldListAny(){return this.shouldList(!0)||this.shouldList(!1)}noLink(){return!1}organization(){return this.org}author(){return this.authorInfo}menu(){return this.menuConfig}},Layout=class{home(){return["index.html","_default/index.html","_default/single.html"]}homeList(){return["index.html","_default/index.html","_default/list.html"]}section(e){return[`${e}/section.html`,`${e}/list.html`,"_default/section.html","_default/list.html","_default/index.html"]}page(e,t){const n=e?`${e}/${t}`:t,r=e?`${e}/single.html`:"single.html",s=[];return"index"!==n&&s.push(`${n}.html`),s.push(r),"index"!==t&&s.push(`_default/${t}.html`),s.push("_default/single.html"),s.push("index.html"),s.push("_default/index.html"),s}taxonomy(){return["taxonomy/taxonomy.html","taxonomy/list.html","_default/list.html","_default/taxonomy.html"]}term(){return["taxonomy/tag.html","term/term.html","taxonomy/list.html","_default/list.html","_default/term.html"]}standalone404(){return["404.html"]}standaloneSitemap(){return["sitemap.xml","_default/sitemap.xml"]}},ShortcodeWithPage=class{_params;_inner;_page;_parent;_name;_isNamedParams;_ordinal;_indentation;_innerDeindent=null;_posOffset;_pos=null;_scratch=null;constructor(e,t,n,r,s,a,i,o="",l=0){this._params=e,this._inner=t,this._page=n,this._parent=r,this._name=s,this._isNamedParams=a,this._ordinal=i,this._indentation=o,this._posOffset=l}get params(){return this._params}get Params(){return this._params}get IsNamedParams(){return this._isNamedParams}get inner(){return this._inner}get Inner(){return this._inner}get page(){return this._page}get Page(){return this._page}get parent(){return this._parent}get Parent(){return this._parent}get name(){return this._name}get isNamedParams(){return this._isNamedParams}get ordinal(){return this._ordinal}get Ordinal(){return this._ordinal}innerDeindent(){if(""===this._indentation)return this._inner;if(null===this._innerDeindent){const e=this._inner.split("\n");this._innerDeindent=e.map(e=>e.startsWith(this._indentation)?e.substring(this._indentation.length):e).join("\n")}return this._innerDeindent}get InnerDeindent(){return this.innerDeindent()}async position(){return this._pos||(this._pos=await this._page.posOffset(this._posOffset)),this._pos}scratch(){return this._scratch||(this._scratch=new Scratch),this._scratch}get(e){return this._params?Array.isArray(this._params)?"number"==typeof e?e>=this._params.length?"":this._params[e]:null:"object"==typeof this._params&&"string"==typeof e?this._params[e]||"":null:null}Get(e){return this.get(e)}},TemplateError=class extends Error{constructor(e,t){super(e),this.code=t,this.name="TemplateError"}},path19=(new TemplateError("template not found","TEMPLATE_NOT_FOUND"),new TemplateError("template parse failed","PARSE_FAILED"),new TemplateError("template execute failed","EXECUTE_FAILED"),new TemplateError("invalid template","INVALID_TEMPLATE"),__toESM(require("path"))),BaseOf=class{baseof=new Map;needsBaseof=new Map;getTemplateSearchOrder(e){const t=[];return t.push("_default/baseof.html"),t}getBaseOf(e){return this.baseof.get(e)||null}getNeedsBaseOf(e){return this.needsBaseof.get(e)||null}addBaseOf(e,t){this.baseof.set(e,t)}addNeedsBaseOf(e,t){this.needsBaseof.set(e,t)}isBaseTemplatePath(e){return path19.basename(e).includes("baseof")}needsBaseOf(e,t){return!this.noBaseNeeded(e)&&this.needsBaseTemplate(t)}noBaseNeeded(e){return!!e.startsWith("partials/")}needsBaseTemplate(e){let t=-1,n=!1;for(let r=0;r<e.length;)if(!n&&e.substring(r).startsWith("{{/*"))n=!0,r+=4;else if(!n&&e.substring(r).startsWith("{{- /*"))n=!0,r+=6;else if(n&&e.substring(r).startsWith("*/}}"))n=!1,r+=4;else if(n&&e.substring(r).startsWith("*/ -}}"))n=!1,r+=6;else{const s=e[r];if(!n){if(e.substring(r).startsWith("{{")){t=r;break}if(!/\s/.test(s))break}r++}return-1!==t&&/^{{-?\s*define/.test(e.substring(t))}getAllBaseOf(){return new Map(this.baseof)}getAllNeedsBaseOf(){return new Map(this.needsBaseof)}clear(){this.baseof.clear(),this.needsBaseof.clear()}getStats(){return{baseOfCount:this.baseof.size,needsBaseOfCount:this.needsBaseof.size}}},TemplateInfo2=class e{constructor(e,t,n){this.name=e,this.template=t,this.fi=n}identifierBase(){return this.name}errWithFileContext(e,t){const n=`${e}: ${t.message}`,r=new TemplateError(n,"TEMPLATE_FILE_ERROR");return Object.defineProperty(r,"fileName",{value:this.name,enumerable:!0}),Object.defineProperty(r,"fileContent",{value:this.template,enumerable:!0}),r}isZero(){return""===this.name}copy(){return new e(this.name,this.template,this.fi)}getCleanContent(){return removeLeadingBOM(this.template)}};function removeLeadingBOM(e){for(let t=0;t<e.length;t++){const n=e[t];if(0===t&&"\ufeff"!==n)return e;if(t>0)return e.substring(t)}return e}function resolveTemplateType(e){return function(e){return e.includes("_shortcodes/")}(e)?1:e.includes("_partials/")?2:0}init_log(),getDomainLogger("template",{component:"namespace"});var BaseNamespace=class{templates=new Map;mutex=new Set;addTemplate(e,t){this.withLock(()=>{this.templates.set(e,t)})}findTemplate(e){return this.withReadLock(()=>{if(this.templates.has(e))return this.templates.get(e)||null;if(!e.endsWith(".html")){const t=e+".html";if(this.templates.has(t))return this.templates.get(t)||null}for(const[t,n]of this.templates.entries())if(t.includes(e))return n;return null})}getTemplates(){return this.withReadLock(()=>new Map(this.templates))}hasTemplate(e){return this.withReadLock(()=>this.templates.has(e))}getTemplateNames(){return this.withReadLock(()=>Array.from(this.templates.keys()))}removeTemplate(e){return this.withLock(()=>this.templates.delete(e))}clear(){this.withLock(()=>{this.templates.clear()})}size(){return this.withReadLock(()=>this.templates.size)}getTemplatesByPattern(e){return this.withReadLock(()=>{const t=[];for(const[n,r]of this.templates)e.test(n)&&t.push(r);return t})}withLock(e){const t="write";for(;this.mutex.has(t););this.mutex.add(t);try{return e()}finally{this.mutex.delete(t)}}withReadLock(e){const t="read";this.mutex.add(t);try{return e()}finally{this.mutex.delete(t)}}},RegularTemplateNamespace=class extends BaseNamespace{lookup(e){const t=this.findTemplate(e);return t?t.template:null}findTemplateWithDependencies(e){return this.findTemplate(e)}getTemplatesNeedingBase(){return this.withReadLock(()=>Array.from(this.templates.values()).filter(e=>e.baseInfo))}},PartialTemplateNamespace=class extends BaseNamespace{lookup(e){const t=this.findTemplate(e);return t?t.template:null}addPartialTemplate(e,t){const n={...t,type:2};this.addTemplate(e,n)}},ShortcodeTemplateNamespace=class extends BaseNamespace{lookup(e){const t=this.findTemplate(e);return t?t.template:null}addShortcodeTemplate(e,t){const n={...t,type:1};this.addTemplate(e,n)}getShortcode(e){return this.lookup("_shortcodes/"+e)}hasShortcode(e){return this.hasTemplate(e)}getShortcodeNames(){return this.getTemplateNames()}},Executor=class{async execute(e,t){try{const[n,r]=await e.Execute(t);if(r)throw new TemplateError(`Template execution failed: ${r.message}`,"EXECUTION_FAILED");return n}catch(e){if(e instanceof TemplateError)throw e;const t=e instanceof Error?e.message:String(e);throw new TemplateError(`Template execution failed: ${t}`,"EXECUTION_FAILED")}}async executeWithTimeout(e,t,n){return new Promise(async(r,s)=>{const a=setTimeout(()=>{s(new TemplateError("Template execution timeout","EXECUTION_TIMEOUT"))},n);await this.execute(e,t).then(e=>{clearTimeout(a),r(e)}).catch(e=>{clearTimeout(a),s(e)})})}async executeSafely(e,t){try{return{result:await this.execute(e,t),error:null}}catch(e){if(e instanceof TemplateError)return{result:null,error:e};const t=e instanceof Error?e.message:String(e);return{result:null,error:new TemplateError(`Execution failed: ${t}`,"EXECUTION_ERROR")}}}async executeBatch(e){return(await Promise.allSettled(e.map(async({name:e,template:t,data:n})=>{try{return{name:e,result:await this.execute(t,n),error:null}}catch(t){return{name:e,result:null,error:t instanceof TemplateError?t:new TemplateError(`Batch execution failed: ${t.message}`,"BATCH_EXECUTION_FAILED")}}}))).map(e=>"fulfilled"===e.status?e.value:{name:"unknown",result:null,error:new TemplateError(`Batch execution failed: ${e.reason}`,"BATCH_EXECUTION_FAILED")})}async executeWithContext(e,t,n){if(n.signal?.aborted)throw new TemplateError("Template execution was cancelled","EXECUTION_CANCELLED");const r=new Promise((e,t)=>{n.signal&&n.signal.addEventListener("abort",()=>{t(new TemplateError("Template execution was cancelled","EXECUTION_CANCELLED"))})}),s=n.timeout?new Promise((e,t)=>{setTimeout(()=>{t(new TemplateError("Template execution timeout","EXECUTION_TIMEOUT"))},n.timeout)}):new Promise(()=>{});try{return await Promise.race([this.execute(e,t),r,s])}catch(e){if(e instanceof TemplateError)throw e;throw new TemplateError(`Context execution failed: ${e.message}`,"CONTEXT_EXECUTION_FAILED")}}},import_text_template=require("@mdfriday/text-template"),import_text_template2=require("@mdfriday/text-template");init_log(),init_log();var log31=getDomainLogger("content",{component:"cache"}),ConcurrentCache=class{cache=new Map;pendingPromises=new Map;deletedKeys=new Set;constructor(){}get(e){return this.cache.get(e)}set(e,t){this.deletedKeys.has(e)||this.cache.set(e,t),this.pendingPromises.delete(e),this.deletedKeys.delete(e)}has(e){return this.cache.has(e)}isPending(e){return this.pendingPromises.has(e)}delete(e){return this.deletedKeys.add(e),this.pendingPromises.delete(e),this.cache.delete(e)}clear(){this.cache.clear(),this.pendingPromises.clear(),this.deletedKeys.clear()}size(){return this.cache.size}pendingCount(){return this.pendingPromises.size}async getOrCreate(e,t){const n=this.cache.get(e);if(void 0!==n)return n;const r=this.pendingPromises.get(e);return r?await r:this.createAndCache(e,t)}async createAndCache(e,t){const n=this.executeCreate(e,t);this.pendingPromises.set(e,n);try{const t=await n;return this.deletedKeys.has(e)?(this.deletedKeys.delete(e),this.pendingPromises.delete(e),t):(this.set(e,t),t)}catch(t){throw this.pendingPromises.delete(e),log31.error(`Failed to create value for key ${String(e)} : ${t}`),t}}async executeCreate(e,t){try{return await t(e)}catch(t){const n=t instanceof Error?t.message:String(t),r=new Error(`Cache creation failed for key ${String(e)}: ${n}`);throw t instanceof Error&&t.stack&&(r.stack=t.stack,r.originalError=t),r}}getStats(){return{size:this.cache.size,pendingCount:this.pendingPromises.size,keys:Array.from(this.cache.keys()),pendingKeys:Array.from(this.pendingPromises.keys())}}async preload(e){const t=e.filter(({key:e})=>!this.has(e)&&!this.isPending(e)).map(({key:e,create:t})=>this.getOrCreate(e,t));t.length>0&&await Promise.allSettled(t)}},log32=(new ConcurrentCache,getDomainLogger("template",{component:"parser"})),Parser=class{prototypeText;prototypeTextClone;readyInit=!1;funcMap;parseOverlapCache;constructor(e=new Map){this.funcMap=e,this.prototypeText=(0,import_text_template.New)(""),this.parseOverlapCache=new ConcurrentCache,this.funcMap.size>0&&this.prototypeText.Funcs(this.funcMap)}async markReady(){this.readyInit||(this.prototypeTextClone=this.prototypeText,this.readyInit=!0)}async parse(e){try{const t=(0,import_text_template.New)(e.name);this.funcMap&&this.funcMap.size>0&&t.Funcs(this.funcMap);const[n,r]=t.Parse(e.template);if(r)throw new TemplateError(`Parse failed: ${r.message}`,"PARSE_FAILED");return{template:n,info:e,type:resolveTemplateType(e.name)}}catch(e){if(e instanceof TemplateError)throw e;const t=e instanceof Error?e.message:String(e);throw new TemplateError(`Parse failed: ${t}`,"PARSE_FAILED")}}async parseWithLock(e,t){try{this.prototypeTextClone||await this.markReady();const n=(0,import_text_template.New)(e);this.funcMap&&this.funcMap.size>0&&n.Funcs(this.funcMap);const[r,s]=n.Parse(t);if(s)throw new TemplateError(`Parse with lock failed: ${s.message}`,"PARSE_LOCK_FAILED");return r}catch(e){if(e instanceof TemplateError)throw e;const t=e instanceof Error?e.message:String(e);throw new TemplateError(`Parse with lock failed: ${t}`,"PARSE_LOCK_FAILED")}}async parseOverlap(e,t,n){const r=`${e.name}::${t.name||"empty"}`;return this.parseOverlapCache.getOrCreate(r,async()=>{try{const r={template:await this.applyBaseTemplate(e,t,n),info:e,type:resolveTemplateType(e.name)};return t.isZero&&!t.name||(r.baseInfo=t),[r,!0,null]}catch(e){const t=e instanceof TemplateError?e:new TemplateError(`Parse overlap failed: ${e.message}`,"PARSE_OVERLAP_FAILED");return log32.error(`Failed to parse template overlap for key: ${r}: ${t.message}`),[null,!1,t]}})}async applyBaseTemplate(e,t,n){try{const r=(0,import_text_template.New)(e.name);if(this.funcMap&&this.funcMap.size>0&&r.Funcs(this.funcMap),!t.isZero||t.name){const[e,n]=r.Parse(t.template);if(n)throw new TemplateError(`Base template parse failed: ${n.message}`,"BASE_PARSE_FAILED")}const[s,a]=r.Clone();if(a)throw new TemplateError(`Template clone failed: ${a.message}`,"CLONE_FAILED");const[i,o]=s.Parse(e.template);if(o)throw new TemplateError(`Overlay template parse failed: ${o.message}`,"OVERLAY_PARSE_FAILED");const l=await this.getDependencies(i,new Map,n);for(const[t,n]of l)if(t!==e.name)try{if(n.template.Tree){const[,e]=i.AddParseTree(t,n.template.Tree);if(e)throw log32.error(`AddParseTree failed: ${e.message} with name ${t}`),new TemplateError(`AddParseTree failed: ${e.message}`,"ADD_PARSE_TREE_FAILED")}}catch(n){throw log32.error(`Error adding dependency ${t} to template ${e.name}:`,n),new TemplateError(`Failed to add dependency ${t}: ${n.message}`,"DEPENDENCY_ADD_FAILED")}return i}catch(e){if(e instanceof TemplateError)throw e;const t=e instanceof Error?e.message:String(e);throw new TemplateError(`Apply base template failed: ${t}`,"APPLY_BASE_FAILED")}}async getDependencies(e,t,n){const r=new Map;if(t.has(e.Name()))return r;t.set(e.Name(),e);try{const s=new Set,a=e=>{if(!e)return;const t=e.Type();if(t===import_text_template2.NodeType.NodeTemplate){const t=e.Name;t&&s.add(t)}else if(t===import_text_template2.NodeType.NodeList){const t=e;if(t.Nodes)for(const e of t.Nodes)a(e)}if(t===import_text_template2.NodeType.NodeAction){const t=e;t.Pipe&&a(t.Pipe)}else if(t===import_text_template2.NodeType.NodePipe){const t=e;if(t.Cmds)for(const e of t.Cmds)a(e)}else if(t===import_text_template2.NodeType.NodeCommand){const t=e;if(t.Args)for(const e of t.Args)a(e)}else if(t===import_text_template2.NodeType.NodeIf||t===import_text_template2.NodeType.NodeRange||t===import_text_template2.NodeType.NodeWith){const t=e;t.Pipe&&a(t.Pipe),t.List&&a(t.List),t.ElseList&&a(t.ElseList)}};e.Tree&&e.Tree.Root&&a(e.Tree.Root);for(const e of s){const s=n(e);if(s&&(r.set(e,s),!t.has(s.template.Name()))){const e=await this.getDependencies(s.template,t,n);for(const[t,n]of e)r.has(t)||r.set(t,n)}}}catch(t){log32.error(`Error getting dependencies for template ${e.Name()}:`,t)}return r}setFuncMap(e){this.funcMap=new Map([...this.funcMap,...e]),this.funcMap.size>0&&this.prototypeText.Funcs(this.funcMap)}getFuncMap(){return new Map(this.funcMap)}async parseMultiple(e){const t=await Promise.allSettled(e.map(e=>this.parse(e))),n=[],r=[];for(const e of t)"fulfilled"===e.status?n.push(e.value):r.push(e.reason);if(r.length>0)throw new TemplateError(`Failed to parse ${r.length} templates: ${r.map(e=>e.message).join(", ")}`,"MULTIPLE_PARSE_FAILED");return n}clearCache(){this.parseOverlapCache.clear()}getCacheStats(){return this.parseOverlapCache.getStats()}},Lookup=class{baseOf;funcsv;constructor(e,t){if(this.baseOf=e||new BaseOf,this.funcsv=new Map,t)for(const[e,n]of t)this.funcsv.set(e,n)}findNoDependence(e,t){try{const n=t.lookup(e);return n?[n,!0,null]:[null,!1,null]}catch(e){return[null,!1,e]}}findTemplate(e,t){try{const n=t.lookup(e);if(n)return[n,!0,null];const r=t.findTemplateWithDependencies(e);return r&&r.baseInfo?[r.template,!0,null]:[null,!1,null]}catch(e){return[null,!1,e]}}findPartial(e,t){try{const n=t.lookup(e);return n?[n,!0,null]:[null,!1,null]}catch(e){return[null,!1,e]}}findShortcode(e,t){try{const n=t.getShortcode(e);return n?[n,!0,null]:[null,!1,null]}catch(e){return[null,!1,e]}}findDependentInfo(e){const t=this.baseOf.getNeedsBaseOf(e);if(!t)return[null,null,!1];let n=null,r=!1;for(const t of this.baseOf.getTemplateSearchOrder(e))if(n=this.baseOf.getBaseOf(t),n){r=!0;break}return[t,n,r]}getFunc(e){return this.funcsv.get(e)}setFunc(e,t){this.funcsv.set(e,t)}setFuncMap(e){this.funcsv.clear();for(const[t,n]of e)this.funcsv.set(t,n)}getFuncMap(){return new Map(this.funcsv)}newTemplateLookup(e){return t=>e.findTemplate(t)}getBaseOf(){return this.baseOf}setBaseOf(e){this.baseOf=e}hasDependencies(e){const[t,n,r]=this.findDependentInfo(e);return r&&(null!==t||null!==n)}getAllFunctions(){return Array.from(this.funcsv.keys())}clearFunctions(){this.funcsv.clear()}getStats(){const e=this.baseOf.getStats();return{functionCount:this.funcsv.size,baseTemplateCount:e.baseOfCount,dependentTemplateCount:e.needsBaseOfCount}}};init_log();var log33=getDomainLogger("template",{component:"template-engine"}),TemplateEngine=class{executor;lookup;parser;templateNamespace;partialNamespace;shortcodeNamespace;fs;constructor(e,t,n,r,s,a,i){this.executor=e,this.lookup=t,this.parser=n,this.templateNamespace=r,this.partialNamespace=s,this.shortcodeNamespace=a,this.fs=i}async markReady(){try{await this.parser.markReady()}catch(e){throw new TemplateError(`Failed to mark template engine ready: ${e.message}`,"TEMPLATE_ENGINE_READY_FAILED")}}async getTemplate(e){const[t,n,r]=this.lookup.findTemplate(e,this.templateNamespace);if(r)return[null,!1,r];if(n&&t)return[t,!0,null];const[s,a,i]=this.lookup.findDependentInfo(e);if(i&&s)try{const[e,t,n]=await this.parser.parseOverlap(s,a||s,this.lookup.newTemplateLookup(this.templateNamespace));if(n)return[null,!1,n];if(t&&e)return[e.template,!0,null]}catch(e){return[null,!1,e]}return[null,!1,null]}async getPartial(e){let t=e.startsWith("partials/")?e:`partials/${e}`;return t=e.endsWith(".html")?t:`${t}.html`,this.lookup.findPartial(t,this.partialNamespace)}async getShortcode(e){return this.lookup.findShortcode(e,this.shortcodeNamespace)}async get(e){switch(resolveTemplateType(e)){case 1:return this.getShortcode(e);case 2:return this.getPartial(e);default:return this.getTemplate(e)}}async findFirst(e){if(!e||0===e.length)return[null,null,!1,null];for(const t of e)try{const[e,n,r]=await this.get(t);if(r)continue;if(n&&e)return[e,t,!0,null]}catch(e){log33.error("Error finding template:",e)}return[null,null,!1,null]}hasShortcode(e){return this.shortcodeNamespace.hasShortcode(e)}getShortcodeNames(){return this.shortcodeNamespace.getShortcodeNames()}getShortcodeCount(){return this.getShortcodeNames().length}async loadTemplates(){const e=async(e,t)=>{if(t.isDir())return;const n=e.startsWith(PATH_CONSTANTS.SYSTEM_PATH_SEPARATOR)?e.substring(1):e,r=PATH_CONSTANTS.normalizePath(n);try{await this.addTemplateFileInfo(r,t)}catch(e){log33.error("Error adding template:",new TemplateError(`Failed to add template ${r}: ${e.message}`,"LOAD_TEMPLATE_FAILED"))}};try{await this.fs.walk("",{walkFn:e},{})}catch(e){if(!e.message?.includes("ENOENT")&&!e.message?.includes("no such file"))throw e}}async addTemplateFileInfo(e,t){try{const n=await async function(e,t){let n=null;try{n=await t.open();const r=await n.stat(),s=new Uint8Array(r.size()),a=await n.read(s),i=removeLeadingBOM(new TextDecoder("utf-8").decode(a.buffer));return new TemplateInfo2(e,i,t)}catch(n){throw new TemplateInfo2(e,"",t).errWithFileContext("failed to load template",n)}finally{if(n)try{await n.close()}catch(e){console.warn(`Failed to close template file: ${e}`)}}}(e,t);await this.addTemplate(n.name,n)}catch(t){throw new TemplateError(`Failed to load template info for ${e}: ${t.message}`,"LOAD_TEMPLATE_INFO_FAILED")}}async addTemplate(e,t){try{if(this.lookup.getBaseOf().isBaseTemplatePath(e))return void this.lookup.getBaseOf().addBaseOf(e,t);if(this.lookup.getBaseOf().needsBaseOf(e,t.template))return void this.lookup.getBaseOf().addNeedsBaseOf(e,t);const n=resolveTemplateType(e),r=await this.parser.parse(t);switch(n){case 1:this.shortcodeNamespace.addShortcodeTemplate(e,r);break;case 2:this.partialNamespace.addPartialTemplate(e,r);break;default:this.templateNamespace.addTemplate(e,r)}}catch(t){throw new TemplateError(`Failed to add template ${e}: ${t.message}`,"ADD_TEMPLATE_FAILED")}}async execute(e,t){const[n,r,s]=await this.get(e);if(s)throw s;if(!r||!n)throw new TemplateError(`Template not found: ${e}`,"TEMPLATE_NOT_FOUND");return await this.executor.execute(n,t)}async executeRaw(e,t,n){const r=await this.parser.parseWithLock(e,t);if(!r)throw new TemplateError(`Raw Template parse error: ${e}`,"TEMPLATE_PARSE_ERROR");return await this.executor.execute(r,n)}async executeShortcode(e,t){const n=this.shortcodeNamespace.getShortcode(e);if(!n)throw new TemplateError(`Shortcode template '${e}' not found`,"SHORTCODE_NOT_FOUND");try{return await this.executor.execute(n,t)}catch(t){throw new TemplateError(`Error executing shortcode template '${e}': ${t.message}`,"SHORTCODE_EXECUTION_FAILED")}}async executeSafely(e,t){try{return{result:await this.execute(e,t),error:null}}catch(e){return e instanceof TemplateError?{result:null,error:e}:{result:null,error:new TemplateError(`Execute safely failed: ${e.message}`,"EXECUTE_SAFELY_FAILED")}}}async executeShortcodeSafely(e,t){try{return{result:await this.executeShortcode(e,t),error:null}}catch(e){return e instanceof TemplateError?{result:null,error:e}:{result:null,error:new TemplateError(`Execute shortcode safely failed: ${e.message}`,"EXECUTE_SHORTCODE_SAFELY_FAILED")}}}async hasTemplate(e){const[,t]=await this.get(e);return t}getTemplateNames(){return this.templateNamespace.getTemplateNames()}getPartialTemplateNames(){return this.partialNamespace.getTemplateNames()}getAllTemplateNames(){return[...this.templateNamespace.getTemplateNames(),...this.partialNamespace.getTemplateNames(),...this.shortcodeNamespace.getTemplateNames()]}getPartialNamespace(){return this.partialNamespace}getShortcodeNamespace(){return this.shortcodeNamespace}getTemplateNamespace(){return this.templateNamespace}clear(){this.templateNamespace.clear(),this.lookup.getBaseOf().clear()}getTemplatesByPattern(e){return this.templateNamespace.getTemplatesByPattern(e).map(e=>e.info.name)}};init_log();var crypto2=__toESM(require("crypto")),log34=getDomainLogger("template",{component:"registry"}),engineDependentFunctions=[],PartialFunction=class{engine=null;getFunctionName(){return"partial"}updateEngine(e){this.engine=e}execute=async(e,t)=>{if(!this.engine)return log34.error(`Partial function called but engine not set: ${e}`),`\x3c!-- Partial function called but engine not ready: ${e} --\x3e`;try{const n=e.startsWith("partials/")?e:`partials/${e}`;return await this.executePartial(n,t)}catch(t){return log34.error(`Partial execution failed for "${e}":`,t),`\x3c!-- Partial execution failed: ${e} - ${t.message} --\x3e`}};async executePartial(e,t){if(!this.engine)return`\x3c!-- Template engine not available: ${e} --\x3e`;try{const[n,r,s]=await this.engine.getPartial(e);if(s)return log34.error("Error getting partial template:",s),`\x3c!-- Error getting partial template: ${e} - ${s.message} --\x3e`;if(!r||!n)return log34.warn(`Template not found: ${e}`),`\x3c!-- Template not found: ${e} --\x3e`;const[a,i]=await n.Execute(t);return i?(log34.error("Template execution error:",i),`\x3c!-- Template execution error: ${e} - ${i.message} --\x3e`):a}catch(t){return log34.error("Sync partial execution failed:",t),`\x3c!-- Partial sync execution failed: ${e} - ${t.message} --\x3e`}}},DefaultTemplateRegistry=class{registerCoreFunctions(e){this.registerCryptoFunctions(e),this.registerStringFunctions(e),this.registerMathFunctions(e),this.registerTimeFunctions(e),this.registerCollectionFunctions(e),this.registerSafeFunctions(e),this.registerReflectFunctions(e),this.registerFmtFunctions(e),this.registerPathFunctions(e),this.registerTransformFunctions(e)}registerCryptoFunctions(e){e.set("md5",e=>e?crypto2.createHash("md5").update(e).digest("hex"):""),e.set("encryptAESGCM",(e,t)=>{if(!e||!t)return"";const n=crypto2.randomBytes(16),r=crypto2.randomBytes(12),s=crypto2.pbkdf2Sync(e,n,1e5,32,"sha256"),a=crypto2.createCipheriv("aes-256-gcm",s,r),i=Buffer.concat([a.update(t,"utf8"),a.final()]),o=a.getAuthTag();return Buffer.concat([n,r,o,i]).toString("base64")})}registerExtendedFunctions(e,t){this.registerURLFunctions(e,t),this.registerSiteFunctions(e,t),this.registerResourcesFunctions(e,t),this.registerHugoFunctions(e,t),this.registerLanguageFunctions(e,t)}registerAllFunctions(e,t){this.registerCoreFunctions(e),this.registerStringFunctions(e),this.registerMathFunctions(e),this.registerTimeFunctions(e),this.registerCollectionFunctions(e),this.registerEngineDependentFunctions(e),t&&(this.registerURLFunctions(e,t),this.registerExtendedFunctions(e,t))}registerEngineDependentFunctions(e){const t=new PartialFunction;engineDependentFunctions.push(t),e.set(t.getFunctionName(),t.execute)}registerURLFunctions(e,t){e.set("urls",()=>({Parse:e=>{try{return{Host:new URL(e).host}}catch{return{Host:""}}},JoinPath:(...e)=>e.filter(e=>""!==e).map(e=>e.replace(/^\/+|\/+$/g,"")).join("/"),URLize:e=>t.urlize(e),Abs:e=>t.absURL(e),Rel:e=>t.relURL(e),AbsLangURL:e=>t.absURL(e),RelLangURL:e=>t.relURL(e),Sanitize:e=>{try{return new URL(e).toString()}catch{return e.replace(/[<>"'%{}|\\^`]/g,"")}},PathEscape:e=>encodeURIComponent(e).replace(/%2F/g,"/").replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`),QueryEscape:e=>encodeURIComponent(e),QueryUnescape:e=>{try{return decodeURIComponent(e)}catch{return e}},IsAbs:e=>{try{return""!==new URL(e).protocol}catch{return!1}},IsRelative:e=>{try{return new URL(e),!1}catch{return!0}}})),e.set("absURL",e=>t.absURL(e)),e.set("relURL",e=>t.relURL(e)),e.set("urlize",e=>t.urlize(e)),e.set("relref",(e,n)=>{if(/^https?:\/\//.test(n))return n;let r="";const s=n.indexOf("#");return-1!==s&&(r=n.slice(s),n=n.slice(0,s)),(n=n.replace(/^\/+|\/+$/g,"")).startsWith("./")||n.startsWith("../")||n.startsWith("/")?t.relURL(n+r):t.relURL("/"+n+r)}),e.set("ref",(e,n)=>{if(/^https?:\/\//.test(n))return n;let r="";const s=n.indexOf("#");return-1!==s&&(r=n.slice(s),n=n.slice(0,s)),(n=n.replace(/^\/+|\/+$/g,"")).startsWith("./")||n.startsWith("../")||n.startsWith("/")?t.absURL(n+r):t.absURL("/"+n+r)}),e.set("absLangURL",e=>t.absURL(e)),e.set("relLangURL",e=>t.relURL(e))}registerSiteFunctions(e,t){e.set("Site",()=>({Title:t.title(),BaseURL:t.baseURL(),Params:t.params(),Menus:t.menus(),IsMultiLingual:t.isMultiLanguage(),LanguageCode:t.defaultLanguage()}))}registerResourcesFunctions(e,t){e.set("resources",()=>({Get:async e=>await t.Get(e),GetRemote:async e=>await t.GetRemote(e),Minify:async e=>await t.Minify(e),Fingerprint:async e=>await t.Fingerprint(e),ExecuteAsTemplate:async(e,n,r)=>await t.ExecuteAsTemplate(e,n,r)}))}registerHugoFunctions(e,t){e.set("hugo",()=>({Version:t.version(),Environment:t.environment(),Generator:t.generator()}))}registerLanguageFunctions(e,t){const{lang:n}=(init_lang(),__toCommonJS(lang_exports));e.set("lang",()=>({getAllCodes:()=>n.getAllCodes(),getAllNames:()=>n.getAllNames(),getCodesByDirection:e=>n.getCodesByDirection(e),getNamesByDirection:e=>n.getNamesByDirection(e),getCodeNameMap:()=>n.getCodeNameMap(),getCodeNameMapByDirection:e=>n.getCodeNameMapByDirection(e),getNameByCode:e=>n.getNameByCode(e),getLanguageInfo:e=>n.getLanguageInfo(e),isSupported:e=>n.isSupported(e),getDirection:e=>n.getDirection(e),isLTR:e=>n.isLTR(e),isRTL:e=>n.isRTL(e)})),e.set("langName",e=>n.getNameByCode(e)||e),e.set("langDirection",e=>n.getDirection(e)||"ltr"),e.set("isLTR",e=>n.isLTR(e)),e.set("isRTL",e=>n.isRTL(e)),e.set("i18n",e=>t.translate(e))}registerStringFunctions(e){e.set("humanize",e=>e?(e=(e=(e=(e=e.replace(/([a-z])([A-Z])/g,"$1 $2")).replace(/[_-]+/g," ")).replace(/\.[^/.]+$/,"")).charAt(0).toUpperCase()+e.slice(1).toLowerCase()).trim():""),e.set("upper",e=>e.toUpperCase()),e.set("lower",e=>e.toLowerCase()),e.set("title",e=>e.replace(/\w\S*/g,e=>e.charAt(0).toUpperCase()+e.substr(1).toLowerCase())),e.set("trim",e=>e.trim()),e.set("replace",(...e)=>{if(e.length<3)throw new Error("replace requires at least 3 arguments: string, old, new");const t=String(e[0]),n=String(e[1]),r=String(e[2]);if(e.length>=4){const s=Number(e[3]);if(isNaN(s))throw new Error("replace limit must be a number");let a=t,i=0,o=0;for(;i<s&&o<a.length;){const e=a.indexOf(n,o);if(-1===e)break;a=a.substring(0,e)+r+a.substring(e+n.length),o=e+r.length,i++}return a}return t.split(n).join(r)}),e.set("replaceRE",(...t)=>{if(t.length<3)throw new Error("replaceRE requires at least 3 arguments: pattern, replacement, string");const n=t[0],r=t[1],s=t[2],a=t.length>=4?t[3]:void 0;return e.get("strings")().ReplaceRE(n,r,s,a)}),e.set("split",(e,t)=>null==e?(log34.warn("split function: first argument is null or undefined"),[]):"string"!=typeof e?(log34.warn("split function: first argument must be a string, got:",typeof e,"value:",e),Array.isArray(e)?e:String(e).split(t)):e.split(t)),e.set("splitRegex",(e,t)=>{if(null==e)return log34.warn("splitRegex function: first argument is null or undefined"),[];if("string"!=typeof e){if(log34.warn("splitRegex function: first argument must be a string, got:",typeof e,"value:",e),Array.isArray(e))return e;const n=String(e);try{const e=new RegExp(t);return n.split(e)}catch(e){return log34.warn("splitRegex function: invalid regex pattern:",t,"error:",e),[n]}}try{const n=new RegExp(t);return e.split(n)}catch(n){return log34.warn("splitRegex function: invalid regex pattern:",t,"error:",n),[e]}}),e.set("delimit",(e,t)=>Array.isArray(e)?e.join(t):String(e)),e.set("in",(e,t)=>(Array.isArray(e)||"string"==typeof e&&"string"==typeof t)&&e.includes(t)),e.set("hasPrefix",(e,t)=>e.startsWith(t)),e.set("hasSuffix",(e,t)=>e.endsWith(t)),e.set("strings",()=>({ToLower:e=>String(e).toLowerCase(),ToUpper:e=>String(e).toUpperCase(),Title:e=>String(e).replace(/\w\S*/g,e=>e.charAt(0).toUpperCase()+e.substr(1).toLowerCase()),Trim:(e,t)=>String(e).split("").filter(e=>!t.includes(e)).join(""),TrimSpace:e=>String(e).trim(),TrimLeft:(e,t)=>{const n=String(t);let r=0;for(;r<n.length&&e.includes(n[r]);)r++;return n.slice(r)},TrimRight:(e,t)=>{const n=String(t);let r=n.length-1;for(;r>=0&&e.includes(n[r]);)r--;return n.slice(0,r+1)},TrimPrefix:(e,t)=>{const n=String(t);return n.startsWith(e)?n.slice(e.length):n},TrimSuffix:(e,t)=>{const n=String(t);return n.endsWith(e)?n.slice(0,-e.length):n},Contains:(e,t)=>String(e).includes(t),ContainsAny:(e,t)=>{const n=String(e);return t.split("").some(e=>n.includes(e))},HasPrefix:(e,t)=>String(e).startsWith(t),HasSuffix:(e,t)=>String(e).endsWith(t),Replace:(e,t,n,r)=>{const s=String(e);if(void 0===r)return s.split(t).join(n);let a=s,i=0,o=0;for(;i<r&&o<a.length;){const e=a.indexOf(t,o);if(-1===e)break;a=a.substring(0,e)+n+a.substring(e+t.length),o=e+n.length,i++}return a},ReplaceRE:(e,t,n,r)=>{const s=String(e),a=String(t),i=String(n);let o,l=-1;if(void 0!==r){const e=parseInt(String(r),10);if(isNaN(e))throw new Error("limit argument must be integer");l=e}try{o=new RegExp(s,"g")}catch(e){throw new Error(`invalid regular expression: ${s}`)}let c=0;return i.replace(o,e=>l>=0&&c>=l?e:(c++,a))},Split:(e,t)=>String(e).split(t),SliceString:(e,t,n)=>{const r=String(e);return void 0!==n?r.slice(t,n):r.slice(t)},Substr:(e,t,n)=>{const r=String(e);return t<0&&(t=r.length+t),t<0&&(t=0),t>=r.length?"":void 0===n?r.slice(t):n<=0?"":r.slice(t,t+n)},Count:(e,t)=>{const n=String(t);return e?(n.match(new RegExp(e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"g"))||[]).length:n.length+1},CountWords:e=>{const t=String(e).trim();return t?t.split(/\s+/).length:0},CountRunes:e=>String(e).replace(/\s/g,"").length,RuneCount:e=>String(e).length,Repeat:(e,t)=>{if(e<0)throw new Error("strings: negative Repeat count");return String(t).repeat(e)},FirstUpper:e=>{const t=String(e);return t.charAt(0).toUpperCase()+t.slice(1)}})),e.set("substr",(e,...t)=>{const n=String(e),r=Array.from(n),s=r.length;let a,i;switch(t.length){case 0:throw new Error("too few arguments");case 1:const e=Number(t[0]);if(isNaN(e)||!Number.isInteger(e))throw new Error("start argument must be an integer");a=e,i=s;break;case 2:const n=Number(t[0]),r=Number(t[1]);if(isNaN(n)||!Number.isInteger(n))throw new Error("start argument must be an integer");if(isNaN(r)||!Number.isInteger(r))throw new Error("length argument must be an integer");a=n,i=r;break;default:throw new Error("too many arguments")}if(0===s)return"";if(a<0&&(a+=s),a<0&&(a=0),a>s-1)return"";let o=s;return 0===i?"":(i<0?o+=i:i>0&&(o=a+i),a>=o||o<0?"":(o>s&&(o=s),r.slice(a,o).join("")))}),e.set("truncate",(e,...t)=>{const n=Number(e);if(isNaN(n)||!Number.isInteger(n))throw new Error("truncate length must be an integer");let r,s=" …";switch(t.length){case 0:throw new Error("truncate requires a length and a string");case 1:r=t[0],s=" …";break;case 2:s=String(t[0]),r=t[1];break;default:throw new Error("too many arguments passed to truncate")}const a=String(r),i=/<[^>]+>/.test(a);return Array.from(a).length<=n?i?a:this.escapeHTML(a):i?this.truncateHTML(a,n,s):this.truncateText(a,n,s)})}escapeHTML(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}truncateText(e,t,n){const r=Array.from(e);if(r.length<=t)return this.escapeHTML(e);let s=0,a=0;for(let e=0;e<r.length&&a<t;e++){const t=r[e];a++,/\s/.test(t)&&(s=e),/[\u4e00-\u9fff\u3400-\u4dbf\u3040-\u309f\u30a0-\u30ff\uac00-\ud7af]/.test(t)&&(s=e)}let i=a>=t?s>0?s:t:r.length;const o=r.slice(0,i).join("");return this.escapeHTML(o)+n}truncateHTML(e,t,n){const r=/^<(\/)?([^ ]+?)(?:(\s*\/)| .*?)?>/,s=new Set(["br","col","link","base","img","param","area","hr","input"]),a=[];let i=0,o=0,l=0,c=0,u=0;const h=Array.from(e);for(;u<h.length;){const e=h[u];if("<"===e){const e=h.slice(u).join("").match(r);if(e){const t=e[0],n="/"===e[1],r=e[2].toLowerCase(),l="/"===e[3];u+=t.length,i=o,s.has(r)||l||a.push({name:r,pos:u-t.length,openTag:!n});continue}}if(l++,/\s/.test(e)?i=o:/[\u4e00-\u9fff\u3400-\u4dbf\u3040-\u309f\u30a0-\u30ff\uac00-\ud7af]/.test(e)?i=u:o=u+1,l>t){c=i>0?i:u;break}u++}if(l<=t)return e;let d=h.slice(0,c).join("")+n,p=null;for(let e=a.length-1;e>=0;e--){const t=a[e];t.pos>=c||null!==p?null!==p&&p.name===t.name&&(p=null):t.openTag?d+=`</${t.name}>`:p=t}return d}registerMathFunctions(e){e.set("add",(e,t)=>e+t),e.set("sub",(e,t)=>e-t),e.set("mul",(e,t)=>e*t),e.set("div",(e,t)=>0!==t?e/t:0),e.set("mod",(e,t)=>0!==t?e%t:0),e.set("math",()=>({Abs:e=>{const t=Number(e);if(isNaN(t))throw new Error("the math.Abs function requires a numeric argument");return Math.abs(t)},Add:(...e)=>{if(e.length<2)throw new Error("must provide at least two numbers");return e.reduce((e,t)=>{const n=Number(t);if(isNaN(n))throw new Error("Add operator can't be used with non-numeric values");return e+n},0)},Ceil:e=>{const t=Number(e);if(isNaN(t))throw new Error("Ceil operator can't be used with non-numeric value");return Math.ceil(t)},Div:(...e)=>{if(e.length<2)throw new Error("must provide at least two numbers");return e.reduce((e,t,n)=>{const r=Number(t);if(isNaN(r))throw new Error("Div operator can't be used with non-numeric values");if(0===n)return r;if(0===r)throw new Error("division by zero");return e/r})},Floor:e=>{const t=Number(e);if(isNaN(t))throw new Error("Floor operator can't be used with non-numeric value");return Math.floor(t)},Log:e=>{const t=Number(e);if(isNaN(t))throw new Error("Log operator can't be used with non-numeric value");return Math.log(t)},Max:(...e)=>{if(0===e.length)throw new Error("must provide at least one number");const t=e.flat().map(e=>{const t=Number(e);if(isNaN(t))throw new Error("Max operator can't be used with non-numeric values");return t});return Math.max(...t)},Min:(...e)=>{if(0===e.length)throw new Error("must provide at least one number");const t=e.flat().map(e=>{const t=Number(e);if(isNaN(t))throw new Error("Min operator can't be used with non-numeric values");return t});return Math.min(...t)},Mod:(e,t)=>{const n=Number(e),r=Number(t);if(isNaN(n)||isNaN(r))throw new Error("modulo operator can't be used with non-numeric value");if(0===r)throw new Error("the number can't be divided by zero at modulo operation");return n%r},ModBool:(e,t)=>{const n=Number(e),r=Number(t);if(isNaN(n)||isNaN(r))throw new Error("modulo operator can't be used with non-numeric value");if(0===r)throw new Error("the number can't be divided by zero at modulo operation");return n%r===0},Mul:(...e)=>{if(e.length<2)throw new Error("must provide at least two numbers");return e.reduce((e,t)=>{const n=Number(t);if(isNaN(n))throw new Error("Mul operator can't be used with non-numeric values");return e*n},1)},Pow:(e,t)=>{const n=Number(e),r=Number(t);if(isNaN(n)||isNaN(r))throw new Error("Pow operator can't be used with non-numeric value");return Math.pow(n,r)},Rand:()=>Math.random(),Round:e=>{const t=Number(e);if(isNaN(t))throw new Error("Round operator can't be used with non-numeric value");return Math.round(t)},Sqrt:e=>{const t=Number(e);if(isNaN(t))throw new Error("Sqrt operator can't be used with non-numeric value");return Math.sqrt(t)},Sub:(...e)=>{if(e.length<2)throw new Error("must provide at least two numbers");return e.reduce((e,t,n)=>{const r=Number(t);if(isNaN(r))throw new Error("Sub operator can't be used with non-numeric values");return 0===n?r:e-r})},Sum:(...e)=>{if(0===e.length)throw new Error("must provide at least one number");return e.flat().map(e=>{const t=Number(e);if(isNaN(t))throw new Error("Sum operator can't be used with non-numeric values");return t}).reduce((e,t)=>e+t,0)},Product:(...e)=>{if(0===e.length)throw new Error("must provide at least one number");return e.flat().map(e=>{const t=Number(e);if(isNaN(t))throw new Error("Product operator can't be used with non-numeric values");return t}).reduce((e,t)=>e*t,1)}}))}registerTimeFunctions(e){e.set("time",()=>({AsTime:e=>{if(!e)return null;if(e instanceof Date)return e;if("string"==typeof e){const t=new Date(e);return isNaN(t.getTime())?null:t}if("number"==typeof e){const t=new Date(e<1e10?1e3*e:e);return isNaN(t.getTime())?null:t}return null},Format:(e,t)=>{const n=t instanceof Date?t:new Date(t);if(isNaN(n.getTime()))return"";const r=n.getFullYear(),s=n.getMonth()+1,a=n.getDate(),i=n.getHours(),o=n.getMinutes(),l=n.getSeconds(),c=n.toLocaleString("en-US",{weekday:"short"}),u=n.toLocaleString("en-US",{month:"short"}),h=[{pattern:"2006",placeholder:"{{YEAR_FULL}}",value:r.toString()},{pattern:"January",placeholder:"{{MONTH_FULL}}",value:n.toLocaleString("en-US",{month:"long"})},{pattern:"Monday",placeholder:"{{WEEKDAY_FULL}}",value:n.toLocaleString("en-US",{weekday:"long"})},{pattern:"MST",placeholder:"{{TIMEZONE}}",value:n.toLocaleString("en-US",{timeZoneName:"short"})},{pattern:"Jan",placeholder:"{{MONTH_SHORT}}",value:u},{pattern:"Mon",placeholder:"{{WEEKDAY_SHORT}}",value:c},{pattern:"06",placeholder:"{{YEAR_SHORT}}",value:r.toString().slice(-2)},{pattern:"15",placeholder:"{{HOUR_24}}",value:i.toString().padStart(2,"0")},{pattern:"01",placeholder:"{{MONTH_ZERO}}",value:s.toString().padStart(2,"0")},{pattern:"02",placeholder:"{{DAY_ZERO}}",value:a.toString().padStart(2,"0")},{pattern:"04",placeholder:"{{MINUTE_ZERO}}",value:o.toString().padStart(2,"0")},{pattern:"05",placeholder:"{{SECOND_ZERO}}",value:l.toString().padStart(2,"0")},{pattern:"PM",placeholder:"{{AMPM_UPPER}}",value:i>=12?"PM":"AM"},{pattern:"pm",placeholder:"{{AMPM_LOWER}}",value:i>=12?"pm":"am"},{pattern:"3",placeholder:"{{HOUR_12}}",value:((i+11)%12+1).toString()},{pattern:"1",placeholder:"{{MONTH_NUM}}",value:s.toString()},{pattern:"2",placeholder:"{{DAY_NUM}}",value:a.toString()},{pattern:"4",placeholder:"{{MINUTE_NUM}}",value:o.toString()},{pattern:"5",placeholder:"{{SECOND_NUM}}",value:l.toString()}];let d=e;for(const{pattern:e,placeholder:t}of h){const n=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");d=d.replace(new RegExp(n,"g"),t)}for(const{placeholder:e,value:t}of h)d=d.replace(new RegExp(e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"g"),t);return d},Now:()=>new Date,Parse:(e,t)=>{try{const e=new Date(t);return isNaN(e.getTime())?null:e}catch{return null}},Unix:e=>{const t=e instanceof Date?e:new Date(e);return Math.floor(t.getTime()/1e3)},UnixNano:e=>1e6*(e instanceof Date?e:new Date(e)).getTime()})),e.set("now",()=>{const e=new Date;return{Format:t=>{const n=e.getFullYear(),r=e.getMonth()+1,s=e.getDate(),a=e.getHours(),i=e.getMinutes(),o=e.getSeconds(),l=[{pattern:"2006",value:n.toString()},{pattern:"06",value:n.toString().slice(-2)},{pattern:"01",value:r.toString().padStart(2,"0")},{pattern:"1",value:r.toString()},{pattern:"02",value:s.toString().padStart(2,"0")},{pattern:"2",value:s.toString()},{pattern:"15",value:a.toString().padStart(2,"0")},{pattern:"3",value:(a%12||12).toString()},{pattern:"04",value:i.toString().padStart(2,"0")},{pattern:"4",value:i.toString()},{pattern:"05",value:o.toString().padStart(2,"0")},{pattern:"5",value:o.toString()}];let c=t;for(const{pattern:e,value:t}of l){const n=new RegExp(`\\b${e}\\b`,"g");c=c.replace(n,t)}return"2006"===t?n.toString():"06"===t?n.toString().slice(-2):"01"===t?r.toString().padStart(2,"0"):"02"===t?s.toString().padStart(2,"0"):"15"===t?a.toString().padStart(2,"0"):"04"===t?i.toString().padStart(2,"0"):"05"===t?o.toString().padStart(2,"0"):c},getTime:()=>e.getTime(),toString:()=>e.toString(),toISOString:()=>e.toISOString()}}),e.set("dateFormat",(e,t)=>t.toLocaleDateString())}registerCollectionFunctions(e){e.set("len",e=>Array.isArray(e)||"string"==typeof e?e.length:e&&"object"==typeof e?Object.keys(e).length:0),e.set("first",(e,t)=>Array.isArray(e)?e.slice(0,1):Array.isArray(t)?t.slice(0,e):[]),e.set("last",(e,t)=>Array.isArray(e)?e.slice(-1):Array.isArray(t)?t.slice(-e):[]),e.set("merge",(...e)=>{const t={};for(const n of e)n&&"object"==typeof n&&!Array.isArray(n)&&Object.assign(t,n);return t}),e.set("index",(e,...t)=>{try{return this.doIndex(e,t)}catch(n){return log34.error(`Index of type ${typeof e} with args [${t.join(", ")}] failed:`,n),null}}),e.set("reverse",e=>Array.isArray(e)?[...e].reverse():e),e.set("append",(...e)=>{if(e.length<2)return e[0]||[];const t=Array.isArray(e[0])?[...e[0]]:[e[0]];for(let n=1;n<e.length;n++)Array.isArray(e[n])?t.push(...e[n]):t.push(e[n]);return t}),e.set("prepend",(e,...t)=>Array.isArray(e)?[...t,...e]:[...t,e]),e.set("seq",(...e)=>{if(e.length<1||e.length>3)throw new Error("invalid number of arguments to Seq");const t=e.map(e=>{const t=Number(e);if(isNaN(t))throw new Error("invalid arguments to Seq");return Math.floor(t)});let n,r=1,s=t[0];if(1===t.length){if(n=s,0===n)return[];n>0?s=1:(s=-1,r=-1)}else if(2===t.length)n=t[1],n<s&&(r=-1);else{if(r=t[1],n=t[2],0===r)throw new Error("'increment' must not be 0");if(s<n&&r<0)throw new Error("'increment' must be > 0");if(s>n&&r>0)throw new Error("'increment' must be < 0")}if(n<-1e5)throw new Error("size of result exceeds limit");const a=Math.floor((n-s)/r)+1;if(a<=0||a>2e3)throw new Error("size of result exceeds limit");const i=new Array(a);let o=s;for(let e=0;e<a&&(i[e]=o,o+=r,!(r<0&&o<n||r>0&&o>n));e++);return i}),e.set("sort",(e,...t)=>{if(null==e)throw new Error("sequence must be provided");let n;if(Array.isArray(e))n=[...e];else{if("object"!=typeof e||null===e)throw new Error("can't sort "+typeof e);n=Object.values(e)}if(0===n.length)return n;let r="",s=!0;for(let e=0;e<t.length;e++){const n=t[e];0===e?"string"==typeof n&&(r=n):1===e&&"string"==typeof n&&"desc"===n.toLowerCase()&&(s=!1)}const a=(e,t)=>{if(!t||"value"===t)return e;const n=t.split(".");let r=e;for(const e of n){if(null==r)return;if("object"!=typeof r)return;r=r[e]}return r};return n.sort((e,t)=>{let n=r?a(e,r):e,i=r?a(t,r):t;if(null==n)return null==i?0:s?-1:1;if(null==i)return s?1:-1;if("string"==typeof n&&"string"==typeof i){const e=n.localeCompare(i);return s?e:-e}if("number"==typeof n&&"number"==typeof i){const e=n-i;return s?e:-e}const o=String(n),l=String(i),c=o.localeCompare(l);return s?c:-c})}),e.set("where",(()=>(e,t,...n)=>{if(!e)return[];let r,s="==";if(1===n.length)r=n[0];else{if(2!==n.length)throw new Error("where function requires 2-4 arguments");s=n[0],r=n[1]}const a=[];if(Array.isArray(e))for(let n=0;n<e.length;n++){const i=e[n],o=this.getNestedValue(i,t);this.checkCondition(o,r,s)&&a.push(i)}else if("object"==typeof e)for(const[n,i]of Object.entries(e))if(Array.isArray(i)){const e=i.filter(e=>{const n=this.getNestedValue(e,t);return this.checkCondition(n,r,s)});e.length>0&&a.push({[n]:e})}return a})()),e.set("intersect",(e,t)=>Array.isArray(e)&&Array.isArray(t)?e.filter(e=>t.includes(e)):[]),e.set("querify",(...e)=>{let t=[];if(t=1===e.length&&Array.isArray(e[0])?e[0]:e,t.length%2!=0)throw new Error("querify requires an even number of arguments (key-value pairs)");const n=[];for(let e=0;e<t.length;e+=2){const r=String(t[e]),s=String(t[e+1]);n.push([r,s])}return n.sort((e,t)=>e[0].localeCompare(t[0])),n.map(([e,t])=>`${encodeURIComponent(e).replace(/%20/g,"+")}=${encodeURIComponent(t).replace(/%20/g,"+")}`).join("&")}),e.set("isset",(e,t)=>{if(null==e)return!1;if(Array.isArray(e)){const n=Number(t);return isNaN(n)||!Number.isInteger(n)?(console.warn(`isset unable to use key of type ${typeof t} as index`),!1):e.length>n&&n>=0}if("object"==typeof e)return t in e;if("string"==typeof e){const n=Number(t);return isNaN(n)||!Number.isInteger(n)?(console.warn(`isset unable to use key of type ${typeof t} as index`),!1):e.length>n&&n>=0}return console.warn(`calling isset with unsupported type "${typeof e}" (${e.constructor?.name||typeof e}) will always return false.`),!1})}doIndex(e,t){if(null==e)return null;if(0===t.length)return e;let n=e;for(const e of t){if(null==n)return null;if(Array.isArray(n))n=this.indexArray(n,e);else if("string"==typeof n)n=this.indexString(n,e);else{if("object"!=typeof n)throw new Error("can't index item of type "+typeof n);n=this.indexObject(n,e)}}return n}indexArray(e,t){const n=this.toInteger(t);if(null===n)throw new Error("cannot index slice/array with type "+typeof t);return n<0||n>=e.length?null:e[n]}indexString(e,t){const n=this.toInteger(t);if(null===n)throw new Error("cannot index string with type "+typeof t);return n<0||n>=e.length?null:e.charAt(n)}indexObject(e,t){const n=String(t);if(e.hasOwnProperty(n))return e[n];const r=Object.keys(e).find(e=>e.toLowerCase()===n.toLowerCase());if(r)return e[r];if(e instanceof Map){if(e.has(n))return e.get(n);for(const t of e.keys())if(String(t).toLowerCase()===n.toLowerCase())return e.get(t)}return null}toInteger(e){if("number"==typeof e)return Number.isInteger(e)?e:Math.floor(e);if("string"==typeof e){const t=parseInt(e,10);if(!isNaN(t))return t}return null}checkCondition(e,t,n){const r=n.toLowerCase().trim();if(null==e&&null==t)return["==","=","eq",""].includes(r);if(null==e||null==t)return["!=","<>","ne"].includes(r);if("in"===r)return(Array.isArray(t)||"string"==typeof t&&"string"==typeof e)&&t.includes(e);if("intersect"===r)return!(!Array.isArray(e)||!Array.isArray(t))&&e.some(e=>t.includes(e));const[s,a]=this.normalizeForComparison(e,t);switch(r){case"":case"=":case"==":case"eq":return s===a;case"!=":case"<>":case"ne":return s!==a;case"<":case"lt":return s<a;case"<=":case"le":return s<=a;case">":case"gt":return s>a;case">=":case"ge":return s>=a;default:return!1}}normalizeForComparison(e,t){if("number"==typeof e&&"number"==typeof t)return[e,t];if("number"==typeof e&&"string"==typeof t){const n=parseFloat(t);if(!isNaN(n))return[e,n]}if("string"==typeof e&&"number"==typeof t){const n=parseFloat(e);if(!isNaN(n))return[n,t]}return"string"==typeof e&&"string"==typeof t||"boolean"==typeof e&&"boolean"==typeof t?[e,t]:[String(e),String(t)]}registerSafeFunctions(e){e.set("return",(...e)=>0===e.length?"":1===e.length?e[0]:e),e.set("cond",(...e)=>{if(e.length<2)throw new Error("cond requires at least 2 arguments");const t=e[0],n=e[1],r=e.length>2?e[2]:"";let s=!1;return!0===t||1===t?s=!0:"string"==typeof t?s=t.length>0&&"false"!==t&&"0"!==t:"number"==typeof t?s=0!==t:Array.isArray(t)?s=t.length>0:t&&"object"==typeof t&&(s=Object.keys(t).length>0),s?n:r}),e.set("safeHTML",e=>e),e.set("safeCSS",e=>e),e.set("safeJS",e=>e),e.set("safeURL",e=>e),e.set("dict",(...e)=>{if(e.length%2!=0)throw new Error("dict requires an even number of arguments");const t={};for(let n=0;n<e.length;n+=2)t[String(e[n])]=e[n+1];return t}),e.set("slice",(...e)=>e),e.set("default",(e,t)=>null!=t&&""!==t&&0!==t?t:e),e.set("jsonify",(...e)=>{if(0===e.length)return"";let t,n={};if(1===e.length)t=e[0];else{if(2!==e.length)throw new Error("too many arguments to jsonify");{const r=e[0];t=e[1],r&&"object"==typeof r&&(n.prefix=r.prefix||"",n.indent=r.indent||"",n.noHTMLEscape=r.noHTMLEscape||!1)}}try{let e;return n.indent?(e=JSON.stringify(t,null,n.indent),n.prefix&&(e=e.split("\n").map(e=>n.prefix+e).join("\n"))):e=JSON.stringify(t),n.noHTMLEscape||(e=e.replace(/&/g,"\\u0026").replace(/</g,"\\u003c").replace(/>/g,"\\u003e")),e}catch(e){throw new Error(`failed to jsonify object: ${e.message}`)}})}registerFmtFunctions(e){e.set("printf",(e,...t)=>{let n=e,r=0;return n=n.replace(/%[vsdft%]/g,e=>{if("%%"===e)return"%";if(r>=t.length)return e;const n=t[r++];switch(e){case"%v":case"%s":default:return String(n);case"%d":return String(Math.floor(Number(n)||0));case"%f":return String(Number(n)||0);case"%t":return String(Boolean(n))}}),n}),e.set("print",(...e)=>e.map(e=>String(e)).join(" ")),e.set("println",(...e)=>e.map(e=>String(e)).join(" ")+"\n"),e.set("errorf",(e,...t)=>{let n=e;for(let e=0;e<t.length;e++)n=n.replace(/%[sd%]/,String(t[e]));return log34.error("Template Error:",n),""}),e.set("warnf",(e,...t)=>{let n=e;for(let e=0;e<t.length;e++)n=n.replace(/%[sd%]/,String(t[e]));return log34.warn("Template Warning:",n),""}),e.set("fmt",()=>({Print:(...e)=>e.map(e=>String(e)).join(" "),Printf:(e,...t)=>{let n=e;for(let e=0;e<t.length;e++)n=n.replace(/%[sd%]/,String(t[e]));return n},Println:(...e)=>e.map(e=>String(e)).join(" ")+"\n",Errorf:(e,...t)=>{let n=e;for(let e=0;e<t.length;e++)n=n.replace(/%[sd%]/,String(t[e]));return log34.error("Template Error:",n),""},Erroridf:(e,t,...n)=>{let r=t;for(let e=0;e<n.length;e++)r=r.replace(/%[sd%]/,String(n[e]));return log34.error("Template Error:",r),""},Warnf:(e,...t)=>{let n=e;for(let e=0;e<t.length;e++)n=n.replace(/%[sd%]/,String(t[e]));return log34.error("Template Warning:",n),""},Warnidf:(e,t,...n)=>{let r=t;for(let e=0;e<n.length;e++)r=r.replace(/%[sd%]/,String(n[e]));return log34.error("Template Warning:",r),""}}))}registerReflectFunctions(e){e.set("reflect",()=>({IsMap:e=>{if(null==e)return!1;if("object"!=typeof e||Array.isArray(e))return!1;if(e instanceof Map)return!0;if(e.constructor===Object)return!0;const t=Object.getPrototypeOf(e);return t===Object.prototype||null===t},IsSlice:e=>Array.isArray(e)}))}registerPathFunctions(e){e.set("path",()=>({Base:e=>{if(!e)return".";if(!(e=(e=e.replace(/\\/g,"/")).replace(/\/+$/,"")))return"/";const t=e.split("/");return t[t.length-1]||"/"},Clean:e=>{if(!e)return".";const t=(e=e.replace(/\\/g,"/")).startsWith("/"),n=e.split("/").filter(e=>e&&"."!==e),r=[];for(const e of n)".."===e?r.length>0&&".."!==r[r.length-1]?r.pop():t||r.push(".."):r.push(e);return e=r.join("/"),t&&(e="/"+e),e||(t?"/":".")},Dir:e=>{if(!e)return".";if(!(e=e.replace(/\/+$/,"")))return"/";const t=e.split("/");return t.pop(),t.join("/")||"."},Ext:e=>{const t=e.split("/").pop()||"",n=t.lastIndexOf(".");return-1===n||0===n?"":t.substring(n)},IsAbs:e=>e.startsWith("/"),Join:(...e)=>{if(0===e.length)return".";let t=e.filter(e=>e).map(e=>e.replace(/^\/+|\/+$/g,"")).join("/");return e[0]&&e[0].startsWith("/")&&(t="/"+t),t||"."},Split:e=>{if(!e)return[".",""];const t=e.lastIndexOf("/");return-1===t?["",e]:[e.substring(0,t),e.substring(t+1)]}}))}registerTransformFunctions(e){e.set("transform",()=>({Unmarshal:(...e)=>{if(e.length<1||e.length>2)throw new Error("unmarshal takes 1 or 2 arguments");let t,n,r={};if(1===e.length)t=e[0];else{const n=e[0];if(!n||"object"!=typeof n)throw new Error("first argument must be a map");r=n,t=e[1]}if(t&&"object"==typeof t&&"function"==typeof t.Content)try{const e=t.Content();return this.unmarshalContent(e,r)}catch(e){throw new Error(`failed to get content from resource: ${e.message}`)}if("string"==typeof t)n=t;else{if(!t||"function"!=typeof t.toString)throw new Error(`type ${typeof t} not supported`);n=t.toString()}return n&&""!==n.trim()?this.unmarshalContent(n,r):null},Plainify:e=>{const t=String(e);return this.stripHTML(t)}})),e.set("unmarshal",(...t)=>e.get("transform")().Unmarshal(...t)),e.set("plainify",e=>{const t=String(e);return this.stripHTML(t)})}stripHTML(e){if(!e.includes("<")&&!e.includes(">"))return e;let t=e.replace(/\n/g," ").replace(/<\/p>/gi,"\n").replace(/<br\s*\/?>/gi,"\n").replace(/<\/div>/gi,"\n").replace(/<\/h[1-6]>/gi,"\n").replace(/<\/li>/gi,"\n").replace(/<\/tr>/gi,"\n").replace(/<\/blockquote>/gi,"\n");t=t.replace(/<[^>]*>/g,"");const n=t.split("\n");return t=n.map(e=>e.trim().replace(/\s+/g," ")).filter(e=>e.length>0).join("\n").trim(),t=t.replace(/\n\s*\n/g,"\n"),t}unmarshalContent(e,t={}){const n=e.trim();if(!n)return null;let r=t.format;r||(r=this.detectFormat(n));try{switch(r.toLowerCase()){case"json":return JSON.parse(n);case"yaml":case"yml":return this.parseYAML(n);case"toml":return this.parseTOML(n);case"csv":return this.parseCSV(n);default:throw new Error(`format "${r}" not supported`)}}catch(e){throw new Error(`failed to unmarshal ${r}: ${e.message}`)}}detectFormat(e){const t=e.trim();if(t.startsWith("{")&&t.endsWith("}")||t.startsWith("[")&&t.endsWith("]"))try{return JSON.parse(t),"json"}catch{}return t.startsWith("---")||/^[a-zA-Z_][a-zA-Z0-9_]*\s*:\s*.+/m.test(t)?"yaml":/^\[.*\]$/m.test(t)||/^[a-zA-Z_][a-zA-Z0-9_]*\s*=\s*.+/m.test(t)?"toml":/^[^,\n]*,[^,\n]*/.test(t)?"csv":"json"}parseYAML(e){const t=e.split("\n"),n={};for(const e of t){const t=e.trim();if(!t||t.startsWith("#")||"---"===t)continue;const r=t.indexOf(":");if(r>0){const e=t.substring(0,r).trim();let s=t.substring(r+1).trim();(s.startsWith('"')&&s.endsWith('"')||s.startsWith("'")&&s.endsWith("'"))&&(s=s.slice(1,-1)),"true"===s?n[e]=!0:"false"===s?n[e]=!1:/^\d+$/.test(s)?n[e]=parseInt(s,10):/^\d*\.\d+$/.test(s)?n[e]=parseFloat(s):n[e]=s}}return n}parseTOML(e){const t=e.split("\n"),n={};let r="";for(const e of t){const t=e.trim();if(!t||t.startsWith("#"))continue;if(t.startsWith("[")&&t.endsWith("]")){r=t.slice(1,-1),n[r]||(n[r]={});continue}const s=t.indexOf("=");if(s>0){const e=t.substring(0,s).trim();let a,i=t.substring(s+1).trim();(i.startsWith('"')&&i.endsWith('"')||i.startsWith("'")&&i.endsWith("'"))&&(i=i.slice(1,-1)),a="true"===i||"false"!==i&&(/^\d+$/.test(i)?parseInt(i,10):/^\d*\.\d+$/.test(i)?parseFloat(i):i),r?n[r][e]=a:n[e]=a}}return n}parseCSV(e){const t=e.trim().split("\n");if(0===t.length)return[];const n=this.parseCSVLine(t[0]),r=[];for(let e=1;e<t.length;e++){const s=this.parseCSVLine(t[e]),a={};for(let e=0;e<n.length;e++){const t=n[e],r=e<s.length?s[e]:"";/^\d+$/.test(r)?a[t]=parseInt(r,10):/^\d*\.\d+$/.test(r)?a[t]=parseFloat(r):a[t]="true"===r||"false"!==r&&r}r.push(a)}return r}parseCSVLine(e){const t=[];let n="",r=!1;for(let s=0;s<e.length;s++){const a=e[s];'"'===a?r&&'"'===e[s+1]?(n+='"',s++):r=!r:","!==a||r?n+=a:(t.push(n.trim()),n="")}return t.push(n.trim()),t}getNestedValue(e,t){if(!e||!t)return;const n=t.replace(/^\\.+/,"").split(".");let r=e;for(let e=0;e<n.length;e++){const t=n[e];if(null==r)return;if("object"==typeof r){if(r.hasOwnProperty(t)){r=r[t];continue}const e=Object.keys(r).find(e=>e.toLowerCase()===t.toLowerCase());if(e){r=r[e];continue}const n=t.toLowerCase();if("function"==typeof r[n])try{r=r[n]();continue}catch(e){return}return}return}return r}};function newTemplateRegistry(){return new DefaultTemplateRegistry}var Factory2=class{async create(e){return this.createWithConfig(e,{})}async createWithConfig(e,t){try{const n=(new Builder).withFs(e).withNamespaces(new RegularTemplateNamespace,new PartialTemplateNamespace,new ShortcodeTemplateNamespace);t.services?n.withServices(t.services):t.funcMap?n.withFuncMap(t.funcMap):n.withFuncMap(function(){const e=new Map;return newTemplateRegistry().registerCoreFunctions(e),e}());const r=await n.buildLookup().buildParser().buildExecutor().build();return await r.markReady(),r}catch(e){const t=e instanceof Error?e.message:String(e);throw new TemplateError(`Failed to create template engine: ${t}`,"FACTORY_CREATE_FAILED")}}async createWithServices(e,t){return this.createWithConfig(e,{services:t})}},Builder=class{funcMap=new Map;services;fs;templateNamespace;partialNamespace;shortcodeNamespace;lookup;parser;executor;withFs(e){return this.fs=e,this}withNamespaces(e,t,n){return this.templateNamespace=e,this.partialNamespace=t,this.shortcodeNamespace=n,this}withFuncMap(e){return this.funcMap=new Map([...this.funcMap,...e]),this}withServices(e){return this.services=e,this.funcMap=function(e){const t=new Map;return newTemplateRegistry().registerAllFunctions(t,e),t}(e),this}buildLookup(){const e=new BaseOf;return this.lookup=function(e,t){return new Lookup(e,t)}(e,this.funcMap),this}buildParser(){return this.parser=function(e=new Map){return new Parser(e)}(this.funcMap),this}buildExecutor(){return this.executor=new Executor,this}async build(){if(!this.fs)throw new TemplateError("File system is required","BUILDER_FS_REQUIRED");if(!this.templateNamespace)throw new TemplateError("Template namespace is required","BUILDER_TEMPLATE_NAMESPACE_REQUIRED");if(!this.partialNamespace)throw new TemplateError("Partial namespace is required","BUILDER_PARTIAL_NAMESPACE_REQUIRED");if(!this.shortcodeNamespace)throw new TemplateError("Shortcode namespace is required","BUILDER_SHORTCODE_NAMESPACE_REQUIRED");if(!this.lookup)throw new TemplateError("Lookup is required","BUILDER_LOOKUP_REQUIRED");if(!this.parser)throw new TemplateError("Parser is required","BUILDER_PARSER_REQUIRED");if(!this.executor)throw new TemplateError("Executor is required","BUILDER_EXECUTOR_REQUIRED");const e=(t=this.executor,n=this.lookup,r=this.parser,s=this.templateNamespace,a=this.partialNamespace,i=this.shortcodeNamespace,o=this.fs,new TemplateEngine(t,n,r,s,a,i,o));var t,n,r,s,a,i,o;!function(e){for(const t of engineDependentFunctions)try{t.updateEngine(e)}catch(e){log34.error(`❌ Failed to update function ${t.getFunctionName()}:`,e)}}(e);try{await e.loadTemplates()}catch(e){const t=e instanceof Error?e.message:String(e);throw new TemplateError(`Failed to load templates: ${t}`,"BUILDER_LOAD_TEMPLATES_FAILED")}return e}};var log35=getDomainLogger("content",{component:"pagebuilder"}),PageBuilder=class{urlSvc;langSvc;taxonomySvc;templateSvc;pageMapper;taxonomy;term;section;standalone;converter;contentHub;source;sourceByte;kind;singular;term_;langIdx;fm;fmParser;c;renderableDocument=null;constructor(e,t,n,r,s,a,i,o,l,c,u){this.urlSvc=e,this.langSvc=t,this.taxonomySvc=n,this.templateSvc=r,this.pageMapper=null,this.taxonomy=a,this.term=i,this.section=o,this.standalone=l,this.converter=c,this.contentHub=u,this.source=null,this.sourceByte=new Uint8Array,this.kind="",this.singular="",this.term_="",this.langIdx=-1,this.fm=null,this.fmParser=null,this.c=null}withSource(e){const t=Object.assign(Object.create(Object.getPrototypeOf(this)),this);return t.reset(),t.source=e,t}withLangIdx(e){return this.langIdx=e,this}reset(){this.c=null,this.kind="",this.langIdx=-1}async build(){if(!this.source)throw new Error("source for page builder is nil");const e=await this.source.contentSource();this.sourceByte=e,await this.parse(e);const t=await this.buildInternal();return await this.render(t),t}async kindBuild(){if(!this.source)throw new Error("source for page builder is nil");return await this.parseKind(),-1===this.langIdx?await this.parseLanguageByDefault():await this.parseLanguageByIdx(this.langIdx),this.fm={path:"",lang:"",kind:"",title:"",description:"",weight:999,terms:{},params:{}},this.c=newContent(new Uint8Array),await this.buildInternal()}async buildInternal(){switch(this.kind){case getKindMain("home"):return await this.buildHome();case getKindMain("section"):return await this.buildSection();case getKindMain("page"):return await this.buildPage();case getKindMain("taxonomy"):return await this.buildTaxonomy();case getKindMain("term"):return await this.buildTerm();case getKindMain("404"):return await this.build404();case getKindMain("sitemap"):return await this.buildSitemap();default:throw new Error(`unknown kind "${this.kind}"`)}}async buildPage(){const e=await this.newPage(this.source,this.c);return await this.applyFrontMatter(e),e.pageMap=this.pageMapper,await this.buildOutput(e),await this.adaptPagination(e),e}async buildPageWithKind(e){const t=await this.newPage(this.source,this.c);if(await this.applyFrontMatter(t),t.pageMap=this.pageMapper,t.kind_=e,e===getKindMain("sitemap")||e===getKindMain("404")){const e=t.meta;e&&(e.list="never")}return await this.buildOutput(t),t}async applyFrontMatter(e){if(this.fm){e.title_=this.fm.title,e.description_=this.fm.description;const t=e.meta;t&&(t.weight=this.fm.weight,t.parameters=this.fm.params||{},this.fm.date&&(t.date=this.fm.date),void 0!==this.fm.organization&&(t.org=this.fm.organization),void 0!==this.fm.author&&(t.authorInfo=this.fm.author),void 0!==this.fm.menu&&(t.menuConfig=this.fm.menu))}}async buildHome(){const e=await this.buildPageWithKind(getKindMain("home"));return await this.buildPagination(e),e}async buildSection(){const e=await this.buildPageWithKind(getKindMain("section"));return await this.buildPagination(e),e}async build404(){const e=await this.buildPageWithKind(getKindMain("404"));return await this.adaptPagination(e),e}async buildSitemap(){const e=await this.buildPageWithKind(getKindMain("sitemap"));return await this.adaptPagination(e),e}async buildTaxonomy(){const e=this.taxonomy.getTaxonomy(this.source.file.paths().path()),t=e?e.singular():"",n=await this.newTaxonomy(this.source,this.c,t);return n.pageMap=this.pageMapper,await this.buildOutput(n),await this.buildPagination(n),n}async buildTerm(){const e=this.source.file.paths(),t=this.taxonomy.getTaxonomy(e.path()),n=t?t.singular():"",r=e.unnormalized().baseNameNoIdentifier(),s=await this.newTerm(this.source,this.c,n,r);return s.pageMap=this.pageMapper,await this.buildOutput(s),await this.buildPagination(s),s}async render(e){if(this.c?.lazyRendered)return void(this.c.lazyRender=async()=>{const t=await(this.renderableDocument?.render({maxSummaryLength:300,wordsPerMinute:200,shortcodeRenderer:this.createShortcodeRenderer(e)}));this.c?.updateWithContentResult(t)});log35.info(`Lazy rendering not enabled, rendering immediately for page: ${e.path()}`);const t=await(this.renderableDocument?.render({maxSummaryLength:300,wordsPerMinute:200,shortcodeRenderer:this.createShortcodeRenderer(e)}));this.c?.updateWithContentResult(t)}async parse(e){this.renderableDocument=await this.converter.prepareRender(e),this.c=newContent(e),this.c.toc=this.renderableDocument.toc(),this.fmParser=new FrontMatterParserImpl(this.renderableDocument.frontMatter(),this.langSvc,this.taxonomySvc),await this.parseFrontMatter(),await this.parseLanguage(),await this.parseKind(),await this.parseTerms()}async parseTerms(){this.fm&&this.fm.terms&&(this.term.terms=this.fm.terms)}async parseKind(){const e=this.source.file.paths();let t="";if(this.fm&&(t=this.fm.kind||""),""===t)switch(t=getKindMain("page"),e.baseNoLeadingSlash()){case"/":case"":t=getKindMain("home");break;case"404":t=getKindMain("404");break;case"_sitemap":t=getKindMain("sitemap");break;default:if(this.source.file.isBranchBundle()){t=getKindMain("section");const n=this.taxonomy.getTaxonomy(e.path());this.taxonomy.isZero(n)||(t=this.taxonomy.isTaxonomyPath(e.path())?getKindMain("taxonomy"):getKindMain("term"))}}this.kind=t}async parseLanguageByDefault(){const e=this.langSvc.defaultLanguage(),t=await this.langSvc.getLanguageIndex(e);this.source.identity.lang=e,this.source.identity.langIdx=t}async parseLanguageByIdx(e){const t=this.langSvc.getLanguageByIndex(e);this.source.identity.lang=t,this.source.identity.langIdx=e}async parseLanguage(){const[e,t]=this.langSvc.getSourceLang(this.source.file.fileInfo().root());if(t){const t=this.langSvc.getLanguageIndex(e);return this.source.identity.lang=e,void(this.source.identity.langIdx=t)}await this.parseLanguageByDefault()}async parseFrontMatter(){this.fmParser?this.fm=await this.fmParser.parse(this.urlSvc.baseUrl()):this.fm={path:"",lang:"",kind:"",title:"",description:"",weight:999,terms:{},params:{}}}createShortcodeRenderer(e){return async t=>{if(!this.templateSvc)return log35.warn(`Template service not available for shortcode: ${t.name}`),"";try{return t.name?await this.doRenderShortcode(t,null,0,e):(log35.warn("Shortcode missing name"),"")}catch(e){return log35.error(`Error rendering shortcode "${t.name}":`,e),""}}}async doRenderShortcode(e,t,n,r){if(e.inline)return log35.warn("Inline shortcodes are not supported yet."),"";let s=new ShortcodeWithPage(e.params||{},"",r,t,e.name,"object"==typeof e.params&&!Array.isArray(e.params),e.ordinal||0,e.indentation||"",e.pos||0);if(e.inner&&e.inner.length>0){let a="";for(const t of e.inner)if("string"==typeof t)a+=t;else{if("object"!=typeof t||!("name"in t))return log35.error(`Illegal state on shortcode rendering of "${e.name}". Illegal type in inner data: ${typeof t}`),"";a+=await this.doRenderShortcode(t,s,n+1,r)}if(e.doMarkup)try{const n=await this.renderShortcodeMarkdown(r,a);s=new ShortcodeWithPage(e.params||{},n,r,t,e.name,"object"==typeof e.params&&!Array.isArray(e.params),e.ordinal||0,e.indentation||"",e.pos||0)}catch(e){throw new Error(`Failed to process inner content: ${e}`)}else s=new ShortcodeWithPage(e.params||{},a,r,t,e.name,"object"==typeof e.params&&!Array.isArray(e.params),e.ordinal||0,e.indentation||"",e.pos||0)}try{let t=await(this.templateSvc?.execute(e.name,s));if(!e.inner?.length&&e.indentation){const n=t?.split("\n");t=n?.map((t,n)=>0===n?t:e.indentation+t).join("\n")}return t||""}catch(t){if(t instanceof TemplateError&&"SHORTCODE_NOT_FOUND"===t.code)return e.rawContent;throw new Error(`Failed to process shortcode: ${t instanceof Error?t.message:String(t)}`)}}async renderShortcodeMarkdown(e,t){try{const n={document:e,documentID:e.path(),documentName:e.name(),filename:e.pageFile().filename()},r={ctx:{},src:(new TextEncoder).encode(t),renderTOC:!1,getRenderer:()=>null},s=await this.converter.convert(n,r);let a=(new TextDecoder).decode(s.bytes());return a.includes("\n")||(a=a.replace(/^<p>(.*)<\/p>\n$/,"$1")),a}catch(e){return log35.error("Error rendering shortcode markdown:",e),""}}async buildPagination(e){const t=new PaginatorManagerImpl({pageSize:()=>10,globalRegularPages:async()=>this.contentHub?await this.contentHub.globalRegularPages():[]},e);e.pagerManager=t}async adaptPagination(e){const t={current:()=>new PaginatorImpl([],0,10,e.path()).pagers()[0],setCurrent:t=>{throw new Error(`pagination not supported for this page: ${e.path()}`)},paginator:async()=>{throw new Error(`pagination not supported for this page: ${e.path()}`)},paginate:async t=>{throw new Error(`pagination not supported for this page: ${e.path()}`)}};e.pagerManager=t}async buildOutput(e){}async newPage(e,t){const n=new Meta(this.urlSvc.baseUrl(),"always",{},0,e.file.fileInfo().modTime()),r=new Layout;return new PageImpl(e,t,n,r,"",getKindMain("page"),this.pageMapper)}async newTaxonomy(e,t,n){const r=new Meta(this.urlSvc.baseUrl(),"always",{},0,e.file.fileInfo().modTime()),s=new Layout;return new TaxonomyPageImpl(e,t,r,s,n,n,getKindMain("taxonomy"),this.pageMapper)}async newTerm(e,t,n,r){const s=new Meta(this.urlSvc.baseUrl(),"always",{},0,e.file.fileInfo().modTime()),a=new Layout;return new TermPageImpl(e,t,s,a,n,r,r,getKindMain("term"),this.pageMapper)}},path20=__toESM(require("path")),filepath=__toESM(require("path")),Taxonomy2=class{views;fsSvc;constructor(e,t){this.views=e,this.fsSvc=t}async assemble(e,t,n){for(const r of this.views){const s=this.pluralTreeKey(r.plural()),a=(e.get(s),newPageSource(newFileInfo2(this.fsSvc.newFileMetaInfo(s+"/_index.md")))),i=await t.withSource(a).withLangIdx(n).kindBuild();e.insertIntoValuesDimension(s,newPageTreesNode2(i))}}isTaxonomyPath(e){const t=this.getTaxonomy(e);return!!t&&e===path20.join(this.pluralTreeKey(t.plural()),"_index.md")}pluralTreeKey(e){return function(...e){let t="";return e.length>0&&(t=e[0],e.length>1&&(t=path20.join(...e))),t=t.replace(/^[\.\/ \s]+|[\.\/ \s]+$/g,""),t=filepath.posix.normalize(t.toLowerCase().replace(/[^\w\-_\/]/g,"")),""===t||"/"===t?"":("/"!==t[0]&&(t="/"+t),t)}(e)}getTaxonomy(e){for(const t of this.views)if(e.startsWith(this.pluralTreeKey(t.plural())))return t;return null}isZero(e){return!e||""===e.singular()}};init_log();var log36=getDomainLogger("content",{component:"term"});function toStringSlicePreserveString(e){return e?Array.isArray(e)?e.map(e=>String(e)):"string"==typeof e?[e]:[String(e)]:null}function toInt(e){if("number"==typeof e)return Math.floor(e);if("string"==typeof e){const t=parseInt(e,10);if(isNaN(t))throw new Error(`cannot convert "${e}" to int`);return t}throw new Error(`cannot convert ${typeof e} to int`)}var Term=class{terms;fsSvc;constructor(e){this.terms={},this.fsSvc=e}async assemble(e,t,n,r){const s=new NodeShiftTreeWalker({tree:e,lockType:2,handle:async(s,a,i)=>{const[o,l]=a.getPage();if(!l)return[!1,null];for(const a of n.taxonomy.views){const i=toStringSlicePreserveString(getParam(o.params(),a.plural(),!1));if(!i)continue;const l=getParamToLower(o.params(),a.plural()+"_weight");let c=0;if(null==l||""===l)c=0;else try{c=toInt(l)}catch(e){log36.warn(`Unable to convert taxonomy weight ${l} to int for "${o.paths().path()}"`)}for(let l=0;l<i.length;l++){const u=i[l];if(""===u)continue;const h="/"+a.plural()+"/"+u;try{const i=newFileInfo2(this.fsSvc.newFileMetaInfo(h+"/_index.md")),d=i.paths(),p=newPageSource(i),g=await n.withSource(p).withLangIdx(r).kindBuild();e.insertIntoValuesDimension(d.base(),newPageTreesNode2(g));const m=e.get(d.base());if(m){const[e,t]=m.getPage();if(!t)return[!1,null];const n=e;n.term=u,n.singular=a.singular()}let f=s;""===f&&(f="/");const T=d.base()+f,[E,S]=m.getPage();if(!S)return[!1,null];t.insert(T,new WeightedTermTreeNode(newPageTreesNode2(o),{page:E,ordinal:l,weight:c,Weight:()=>c,Ordinal:()=>l}))}catch(e){return[!1,e]}}}return[!1,null]}});try{return await s.walk(),null}catch(e){return e}}},import_path11=__toESM(require("path"));init_log(),init_log(),getDomainLogger("site",{component:"pager"});var SitePager=class e{page;pager;constructor(e,t){this.page=e,this.pager=t}pageNumber(){return this.pager.pageNumber()}totalPages(){return this.pager.totalPages()}url(){return this.pager.url()}pages(){return this.pager.pages()}allPages(){return this.pager.allPages()}pagers(){return this.pager.pagers()}first(){return this.pager.first()}last(){return this.pager.last()}hasPrev(){return this.pager.hasPrev()}prev(){return this.pager.prev()}hasNext(){return this.pager.hasNext()}next(){return this.pager.next()}get PageNumber(){return this.pageNumber()}get TotalPages(){return this.totalPages()}get URL(){let e=this.url();return e.startsWith("/")&&(e=e.slice(1)),this.page.Site.getURL().relURL(e)}get HasPrev(){return this.hasPrev()}get HasNext(){return this.hasNext()}get First(){const t=this.first();return t?new e(this.page,t):null}get Last(){const t=this.last();return t?new e(this.page,t):null}get Prev(){const t=this.prev();return t?new e(this.page,t):null}get Next(){const t=this.next();return t?new e(this.page,t):null}get Pagers(){return this.pagers().map(t=>new e(this.page,t))}get Pages(){const e=this.pages();return this.page.sitePages(e)}get AllPages(){const e=this.pager.allPages();return this.page.sitePages(e)}},log38=getDomainLogger("site",{component:"page"}),Page2=class e{tmplSvc;langSvc;publisher;contentPage;pageOutput=null;site;resources=[];_paginator=null;_processedContent=null;constructor(e,t,n,r,s){this.tmplSvc=e,this.langSvc=t,this.publisher=n,this.contentPage=r,this.site=s}async processResources(e){this.resources=e}async render(){try{await this.renderResources(),await this.renderPage()}catch(e){log38.error(`Failed to render page ${this.paths().path()}: ${e}`)}}getPageOutput(){return this.pageOutput||(this.pageOutput=this.output()),this.pageOutput}async renderPage(){const e=this.layouts(),{preparer:t,found:n}=await this.tmplSvc.lookupLayout(e);if(!n)return void log38.warn(`Failed to find layout: ${e.join(",")} for page ${this.paths().path()}`);const r=[];let s=this.getPageOutput().targetPrefix();s=this.site.getLanguage().getCurrentLanguage()===s&&s===this.langSvc.defaultLanguage()?"":this.site.getLanguage().getCurrentLanguage(),r.push(import_path11.default.join(s,this.getPageOutput().targetFilePath())),await this.renderAndWritePage(t,r);const a=await this.current();if(a){let e=a.next();for(;e;){this.setCurrent(e);const n=[import_path11.default.join(s,e.url(),this.getPageOutput().targetFileBase())];await this.renderAndWritePage(t,n),e=e.next()}}}async renderAndWritePage(e,t){try{const n=await this.tmplSvc.executeWithContext(e,this);await this.publisher.publishSource(n,...t)}catch(e){throw this.errorf(e,"failed to publish page")}}async renderResources(){for(const e of this.resources){const t=[];let n=this.getPageOutput().targetPrefix();n=this.site.getLanguage().getCurrentLanguage()===n&&n===this.langSvc.defaultLanguage()?"":this.site.getLanguage().getCurrentLanguage();let r=e.path();t.push(import_path11.default.join(n,r));let s=null;try{const n=()=>e.pageFile().open();if(s=await n(),!s)throw new Error("Failed to open resource stream");let r;r="function"==typeof s.read?new ReadableStream({async start(e){try{const t=new Uint8Array(8192);for(;;){const n=await s.read(t);if(0===n.bytesRead)break;e.enqueue(t.slice(0,n.bytesRead))}e.close()}catch(t){e.error(t)}}}):new ReadableStream({start(e){e.close()}}),await this.publisher.publishFiles(r,...t)}catch(e){throw this.errorf(e,"failed to publish page resources")}finally{if(s)try{await s.close()}catch(e){log38.warn(`Failed to close resource stream: ${e}`)}}}}errorf(e,t,...n){const r=[this.pageIdentity().pageLanguage(),this.paths().path(),...n],s=`[%s] page "%s": ${t}: %s`,a=this.sprintf(s,...r,e.message||e);return new Error(a)}sprintf(e,...t){let n=0;return e.replace(/%s/g,()=>t[n++]||"")}clone(){const t=new e(this.tmplSvc,this.langSvc,this.publisher,this.contentPage,this.site);return t.resources=[...this.resources],t.pageOutput=this.pageOutput,t}pageIdentity(){return this.contentPage.pageIdentity()}pageFile(){return this.contentPage.pageFile()}staleVersions(){return this.contentPage.staleVersions()}section(){return this.contentPage.section()}paths(){return this.contentPage.paths()}path(){return this.contentPage.path()}slug(){return this.contentPage.slug()}file(){return this.contentPage.file()}name(){return this.contentPage.name()}title(){return this.contentPage.title()}kind(){return this.contentPage.kind()}scratch(){return this.contentPage.scratch()}get Scratch(){return this.contentPage.scratch()}IsAncestor(e){return this.contentPage.isAncestor(e.contentPage)}get Title(){return this.title()}get Section(){return this.contentPage.section()}get LinkTitle(){return this.title()}get IsSection(){return this.contentPage.isSection()}get IsPage(){return this.contentPage.isPage()}get Content(){return this.getPageOutput().content()}async WikilinkContent(){if(null!==this._processedContent)return this._processedContent;const e=await this.getPageOutput().content();return e?(this._processedContent=await this.site.ProcessWikilinks(this.slug(),e),this._processedContent):e}async Summary(){return this.contentPage.output().summary()}async ReadingTime(){return await this.getPageOutput().readingTime()}async WordCount(){return await this.getPageOutput().wordCount()}async Backlinks(){const e=this.site.GetBacklinks(this.slug()),t=[],n=await this.site.RegularPages();for(const r of e){const e=n.find(e=>e.slug()===r);e&&t.push(e)}return t}OutgoingLinks(){const e=this.site.getPageGraph();return e?e.getOutgoingLinks(this.slug()):[]}get Description(){return this.description()}get Date(){return this.pageDate()}get LocalDate(){return this.pageDate().toLocaleDateString()}get RelPermalink(){let e;if(this.pageIdentity().pageLanguage()===this.langSvc.defaultLanguage())e=this.getPageOutput().targetFilePath();else{const t=this.getPageOutput().targetPrefix(),n=this.getPageOutput().targetFilePath();e=this.pathJoin(t,n)}return e.startsWith("/")&&(e=e.slice(1)),this.site.getURL().relURL(e)}get GitInfo(){return{}}get File(){return{BaseFileName:this.contentPage.file().baseFileName(),OriginalBaseName:this.contentPage.file().originalBaseFileName(),Dir:this.contentPage.file().dir()}}isHome(){return this.contentPage.isHome()}get IsHome(){return this.isHome()}isPage(){return this.contentPage.isPage()}isSection(){return this.contentPage.isSection()}isAncestor(e){return this.contentPage.isAncestor(e)}eq(e){return this.contentPage.eq(e)}isBundled(){return this.contentPage.isBundled()}layouts(){return this.contentPage.layouts()}output(){return this.contentPage.output()}pageOutputs(){return[this.contentPage.output()]}truncated(){return this.contentPage.truncated()}get Truncated(){return this.contentPage.truncated()}parent(){return this.contentPage.parent()}pages(){return this.contentPage.pages()}isStale(){return this.contentPage.pageIdentity().isStale()}clearStale(){this.contentPage.pageIdentity().clearStale()}prevInSection(){return this.contentPage.prevInSection()}nextInSection(){return this.contentPage.nextInSection()}sections(e){return this.contentPage.sections(e)}regularPages(){return this.contentPage.regularPages()}regularPagesRecursive(){return this.contentPage.regularPagesRecursive()}terms(e,t){return this.contentPage.terms(e,t)}isTranslated(){return this.contentPage.isTranslated()}translations(){return this.contentPage.translations()}rawContent(){return this.contentPage.rawContent()}description(){return this.contentPage.description?this.contentPage.description():""}params(){return this.contentPage.params?this.contentPage.params():{}}pageBaseUrl(){return this.contentPage.pageBaseUrl()?this.contentPage.pageBaseUrl():""}pageWeight(){return this.contentPage.pageWeight?this.contentPage.pageWeight():0}pageDate(){return this.contentPage.pageDate?this.contentPage.pageDate():new Date}publishDate(){return this.contentPage.publishDate?this.contentPage.publishDate():new Date}get PublishDate(){return this.publishDate()}async relatedKeywords(e){return this.contentPage.relatedKeywords?await this.contentPage.relatedKeywords(e):[]}shouldList(e){return!this.contentPage.shouldList||this.contentPage.shouldList(e)}shouldListAny(){return!this.contentPage.shouldListAny||this.contentPage.shouldListAny()}noLink(){return!!this.contentPage.noLink&&this.contentPage.noLink()}organization(){return this.contentPage.organization?this.contentPage.organization():void 0}author(){return this.contentPage.author?this.contentPage.author():void 0}menu(){return this.contentPage.menu?this.contentPage.menu():void 0}current(){return this.contentPage.current()}setCurrent(e){this.contentPage.setCurrent(e)}posOffset(e){return this.contentPage.posOffset(e)}paginator(){return this.contentPage.paginator()}async paginate(e){return this.contentPage.paginate(e)}get Plain(){return this.rawContent()}get TableOfContents(){return this.getPageOutput().tableOfContents()}get Params(){return this.params()}get Site(){return this.site}get Sites(){return{First:this.site,Default:this.site}}get Lastmod(){return this.contentPage.pageDate?this.contentPage.pageDate():null}get Sitemap(){return{ChangeFreq:"weekly",Priority:.5,Filename:"sitemap.xml"}}get IsTranslated(){return this.isTranslated()}async Paginator(){return this._paginator||await this.setupCurrentPaginator(),this._paginator}async Paginate(e){try{const t=e.map(e=>e.contentPage),n=await this.contentPage.paginate(t);return n&&(this._paginator=new SitePager(this,n)),this._paginator}catch(e){return log38.error("Error during pagination:",e),null}}async setupCurrentPaginator(){try{const e=await this.contentPage.paginator();this._paginator=e?new SitePager(this,e):null}catch(e){log38.error("Error initializing Paginator:",e),this._paginator=null}}get Language(){return{Lang:this.pageIdentity().pageLanguage(),LanguageName:this.langSvc.getLanguageName(this.pageIdentity().pageLanguage()),Title:this.title(),Weight:this.pageWeight()}}get Permalink(){return this.RelPermalink}sitePages(e){const t=[];for(const n of e){const e=this.sitePage(n);e&&t.push(e)}return t}sitePage(t){try{return null===t?(log38.warn(`Invalid content page provided: ${t}`),null):new e(this.tmplSvc,this.langSvc,this.publisher,t,this.site)}catch(e){return log38.error(`Error creating site page: ${e}`),null}}pathJoin(...e){return e.filter(e=>e&&e.length>0).map(e=>e.replace(/^\/+|\/+$/g,"")).filter(e=>e.length>0).join("/")}joinURL(e,t){return e?t?(e.endsWith("/")&&(e=e.slice(0,-1)),t.startsWith("/")||(t="/"+t),e+t):e:t}async Translations(){const e=await this.translations();return Array.isArray(e)?e.map(e=>this.sitePage(e)).filter(e=>null!==e):[]}async GetTerms(e){const t=await this.terms(this.site.getLanguage().currentLanguageIndex(),e);return Array.isArray(t)?t.map(e=>this.sitePage(e)).filter(e=>null!==e):[]}async Pages(){return await this.getSitePages()}get Page(){return this.contentPage}get Kind(){return this.kind()}get Type(){if("home"===this.kind())return"page";if("page"===this.kind()){const e=this.section();if(e&&e.length>0)return e}return"page"}get Parent(){return this.sitePage(this.contentPage.parent())}async getSitePages(){const e=await this.contentPage.pages();return!e||Array.isArray(e)&&0===e.length?[]:this.sitePages(e)}},BaseURL=class e{url;withPath;withPathNoTrailingSlash;withoutPath;basePath;basePathNoTrailingSlash;isRelative;constructor(e,t=!1){if(this.url=e,this.isRelative=t,this.withPath=e.toString(),this.withPathNoTrailingSlash=this.withPath.replace(/\/$/,""),t)this.withoutPath="/";else{const t=new URL(e.toString());t.pathname="",this.withoutPath=t.toString().replace(/\/$/,"")}this.basePath=e.pathname,this.basePathNoTrailingSlash=this.basePath.replace(/\/$/,"")}static fromString(t){try{t&&"/"!==t||(t="/");const n=t.trim();if(n.startsWith("/")&&!n.startsWith("//")){const t=new URL(n,"http://localhost");return t.pathname.endsWith("/")||(t.pathname+="/"),new e(t,!0)}if(n.startsWith("//")){const t=new URL("https:"+n);return t.pathname.endsWith("/")||(t.pathname+="/"),new e(t)}if(n.includes("://")){const t=new URL(n);if(!["http:","https:"].includes(t.protocol))throw new Error(`Unsupported protocol: ${t.protocol}. Only http and https are supported.`);return t.pathname.endsWith("/")||(t.pathname+="/"),new e(t)}if(n.includes(":")&&!n.includes("/")){const e=n.indexOf(":"),t=n.substring(0,e+1);throw new Error(`Unsupported protocol: ${t}. Only http and https are supported.`)}const r=new URL("https://"+n);return r.pathname.endsWith("/")||(r.pathname+="/"),new e(r)}catch(e){throw new Error(`Invalid URL: ${e?.message||"Unknown error"}`)}}getRoot(e){return this.isRelative?this.basePath:e.startsWith("/")?this.withoutPath:this.withPath}toString(){return this.isRelative?this.basePath:this.withPath}path(){return this.url.pathname}port(){return this.url.port?parseInt(this.url.port):0}hostURL(){return this.isRelative?"/":this.toString().replace(this.path(),"")}protocol(){return this.url.protocol}host(){return this.url.host}hostname(){return this.url.hostname}getURL(){return new URL(this.url.toString())}withProtocol(t){if(this.isRelative)throw new Error("Cannot change protocol of relative URL");const n=this.getURL();let r=t;const s=r.endsWith("://"),a=r.endsWith(":");if(s?r=r.slice(0,-3):a&&(r=r.slice(0,-1)),a&&!n.pathname)throw new Error(`cannot determine BaseURL for protocol ${t}`);return n.protocol=r,e.fromString(n.toString())}withPort(t){if(this.isRelative)throw new Error("Cannot set port on relative URL");const n=this.getURL();return n.port=t.toString(),e.fromString(n.toString())}isRelativeURL(){return this.isRelative}isAbsoluteURL(){return!this.isRelative}},URL2=class e{base;canonical;baseURL=null;constructor(e,t=!1){this.base=e,this.canonical=t,this.setup()}setup(){try{this.baseURL=BaseURL.fromString(this.base)}catch(e){throw new Error(e?.message||"Failed to setup URL")}}isAbsURL(e){return e.startsWith("http://")||e.startsWith("https://")?[!0,null]:[/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(e),null]}startWithBaseUrlRoot(e){return!!this.baseURL&&e.startsWith(this.baseURL.getRoot(e))}isProtocolRelPath(e){return e.startsWith("//")}trimBaseUrlRoot(e){if(!this.baseURL)return e;const t=this.baseURL.getRoot(e);return e.endsWith(t)?e.slice(0,-t.length):e}addContextRoot(e){if(!this.baseURL)return e;let t=e;return this.canonical||(n=this.baseURL.getRoot(e),r=e,t=!n||r.startsWith(n)?r:function(...e){return e.filter(Boolean).join("/").replace(/\/+/g,"/").replace(/\/$/,"")}(n,r)),t;var n,r}handleRootSuffix(e,t){return this.baseURL?(""===e&&this.baseURL.getRoot(e).endsWith("/")&&(t+="/"),t):t}handlePrefix(e){return e.startsWith("/")||(e="/"+e),e}relURL(e){if(!e)return this.baseURL?this.baseURL.basePath:"";const[t,n]=this.isAbsURL(e);if(n)return e;if(t||this.isProtocolRelPath(e))return e;if(!this.baseURL)return e;let r=e;if(e.startsWith("/"))return this.baseURL.isRelativeURL()?e:this.baseURL.withoutPath+e;if(r=this.baseURL.isRelativeURL()?(this.baseURL.basePath.endsWith("/")?this.baseURL.basePath:this.baseURL.basePath+"/")+e:(this.baseURL.withPath.endsWith("/")?this.baseURL.withPath:this.baseURL.withPath+"/")+e,r.includes("://")){const e=r.indexOf("://"),t=r.substring(0,e+3),n=r.substring(e+3);r=t+n.replace(/\/+/g,"/")}else r=r.replace(/\/+/g,"/");return r}absURL(e,t=!1,n=""){const[r,s]=this.isAbsURL(e);if(s)return e;if(r||this.isProtocolRelPath(e))return e;if(!this.baseURL)return e;const a=this.baseURL.getRoot(e);if(t&&n){let t=!1,r=e;if(e.startsWith("/")&&(r=e.slice(1)),t=r===n||r.startsWith(n+"/"),!t){const t=""===e||e.endsWith("/");e=this.joinPaths(n,e),t&&(e+="/")}}return function(e,t){const n=`${e.replace(/\/$/,"")}/${t.replace(/^\//,"")}`;try{return new URL(n)}catch{return new URL("http://"+n)}}(a,e).toString()}urlize(e){return this.urlEscape(this.makePathSanitized(e))}makePathSanitized(e){return this.makePath(e).toLowerCase()}urlEscape(t){try{if(/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(t))return new e(t).toString();const n=t.match(/^([^?#]*)(\?[^#]*)?(#.*)?$/);if(!n)return encodeURI(t);const[,r="",s="",a=""]=n;return encodeURI(r)+(s||"")+(a||"")}catch{return encodeURI(t)}}makePath(e){let t=function(e){return e.replace(/[\s\t\n\r]+/g,"-").replace(/[^\w\-_]/g,"").replace(/-+/g,"-").replace(/^-|-$/g,"")}(e);return t=t.normalize("NFD").replace(/[\u0300-\u036f]/g,""),t}basePathNoSlash(){return this.baseURL?this.baseURL.basePathNoTrailingSlash:""}joinPaths(...e){return e.filter(Boolean).join("/").replace(/\/+/g,"/").replace(/\/$/,"")}};init_log(),init_taxonomies_builder(),init_log(),getDomainLogger("site",{component:"menu"});var Menu2=class e{_title;_url;_children;_weight;_identifier;constructor(e){this._title=e.title,this._url=e.url,this._children=e.children||[],this._weight=e.weight||0,this._identifier=e.identifier||this._url}title(){return this._title}get Title(){return this.title()}url(){return this._url}get URL(){return this.url()}children(){return[...this._children]}get Children(){return this.children()}weight(){return this._weight}identifier(){return this._identifier}hasChildren(){return this._children.length>0}get HasChildren(){return this.hasChildren()}addChild(t){const n=[...this._children,t];return new e({title:this._title,url:this._url,children:n,weight:this._weight,identifier:this._identifier})}toJSON(){return{title:this._title,url:this._url,weight:this._weight,children:this._children.map(e=>e.toJSON())}}withChildren(t){return new e({title:this._title,url:this._url,children:t,weight:this._weight,identifier:this._identifier})}},Menus=class{_nav;_footer;constructor(e={}){this._nav=e.nav?this.sortMenus([...e.nav]):[],this._footer=e.footer?this.sortMenus([...e.footer]):[]}nav(){return[...this._nav]}get Nav(){return this.nav()}footer(){return[...this._footer]}get Footer(){return this.footer()}sortMenus(e){return e.sort((e,t)=>{if(e.weight()!==t.weight())return 0===t.weight()?-1:0===e.weight()?1:e.weight()-t.weight();const n=e.title().localeCompare(t.title());return 0!==n?n:e.identifier().localeCompare(t.identifier())})}toJSON(){return{nav:this._nav.map(e=>e.toJSON()),footer:this._footer.map(e=>e.toJSON())}}};function newEmptyMenus(){return new Menus({})}var import_github_slugger=require("github-slugger");function splitAnchor2(e){let[t,n]=e.split("#",2);return t.endsWith(".pdf")?[t,void 0===n?"":`#${n}`]:(n=void 0===n?"":"#"+(0,import_github_slugger.slug)(n),[t,n])}function simplifySlug(e){const t=stripSlashes2((endsWith2(n=e,"index")&&(n=n.slice(0,-5)),n),!0);var n;return 0===t.length?"/":t}function pathToRoot(e){let t=e.split("/").filter(e=>""!==e).slice(0,-1).map(e=>"..").join("/");return 0===t.length&&(t="."),t}function joinSegments(...e){if(0===e.length)return"";let t=e.filter(e=>""!==e&&"/"!==e).map(e=>stripSlashes2(e)).join("/");return e[0].startsWith("/")&&(t="/"+t),e[e.length-1].endsWith("/")&&(t+="/"),t}function transformLink(e,t,n){let r=function(e){let[t,n]=splitAnchor2(decodeURI(e));const r=isFolderPath(t);let s=t.split("/").filter(e=>e.length>0),a=s.filter(isRelativeSegment).join("/");const i=simplifySlug(function(e){let t=(n=e=stripSlashes2(e),n.match(/\.[A-Za-z0-9]+$/)?.[0]);var n;const r=e.replace(new RegExp(t+"$"),"");[".md",".html",void 0].includes(t)&&(t="");let s=function(e){return e.split("/").map(e=>e.replace(/\s/g,"-").replace(/&/g,"-and-").replace(/%/g,"-percent").replace(/\?/g,"").replace(/#/g,"")).join("/").replace(/\/$/,"")}(r);return endsWith2(s,"_index")&&(s=s.replace(/_index$/,"index")),s+t}(s.filter(e=>!isRelativeSegment(e)&&""!==e).join("/"))),o=r?"/":"";return""===(l=joinSegments(stripSlashes2(a),stripSlashes2(i)))&&(l="."),l.startsWith(".")||(l=joinSegments(".",l)),l+o+n;var l}(t);if("relative"===n.strategy)return r;{const t=isFolderPath(r)?"/":"",s=stripSlashes2(r.slice(1));let[a,i]=splitAnchor2(s);if("shortest"===n.strategy){const t=n.allSlugs.filter(e=>{const t=e.split("/").at(-1);return a.toLowerCase()===t?.toLowerCase()});if(1===t.length)return function(e,t){return joinSegments(pathToRoot(e),simplifySlug(t))}(e,t[0])+i}return joinSegments(pathToRoot(e),s)+t}}function isFolderPath(e){return e.endsWith("/")||endsWith2(e,"index")||endsWith2(e,"index.md")||endsWith2(e,"index.html")}function endsWith2(e,t){return e===t||e.endsWith("/"+t)}function isRelativeSegment(e){return/^\.{0,2}$/.test(e)}function stripSlashes2(e,t){return e.startsWith("/")&&(e=e.substring(1)),!t&&e.endsWith("/")&&(e=e.slice(0,-1)),e}init_log();var log41=getDomainLogger("site",{component:"PageGraph"}),PageGraph=class{allSlugs;outgoingLinks=new Map;constructor(e){this.allSlugs=[...e],log41.info(`PageGraph initialized with ${e.length} items (pages + resources)`)}registerOutgoingLinks(e,t){const n=simplifySlug(e);this.outgoingLinks.set(n,t)}getBacklinks(e){const t=simplifySlug(e),n=[];for(const[e,r]of this.outgoingLinks.entries())r.includes(t)&&n.push(e);return n}getAllSlugs(){return[...this.allSlugs]}hasSlug(e){return this.allSlugs.includes(e)}resolveLink(e,t,n){return transformLink(e,t,{strategy:n,allSlugs:this.allSlugs})}getOutgoingLinks(e){const t=simplifySlug(e);return this.outgoingLinks.get(t)||[]}getAllOutgoingLinks(){return new Map(this.outgoingLinks)}getStats(){return{totalPages:this.allSlugs.length,slugs:[...this.allSlugs]}}};function bail(e){if(e)throw e}var import_extend=__toESM(require_extend(),1);function isPlainObject(e){if("object"!=typeof e||null===e)return!1;const t=Object.getPrototypeOf(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)}function point(e){return index(e&&e.line)+":"+index(e&&e.column)}function position(e){return point(e&&e.start)+"-"+point(e&&e.end)}function index(e){return e&&"number"==typeof e?e:1}var VFileMessage=class extends Error{constructor(e,t,n){super(),"string"==typeof t&&(n=t,t=void 0);let r="",s={},a=!1;if(t&&(s="line"in t&&"column"in t||"start"in t&&"end"in t?{place:t}:"type"in t?{ancestors:[t],place:t.position}:{...t}),"string"==typeof e?r=e:!s.cause&&e&&(a=!0,r=e.message,s.cause=e),!s.ruleId&&!s.source&&"string"==typeof n){const e=n.indexOf(":");-1===e?s.ruleId=n:(s.source=n.slice(0,e),s.ruleId=n.slice(e+1))}if(!s.place&&s.ancestors&&s.ancestors){const e=s.ancestors[s.ancestors.length-1];e&&(s.place=e.position)}const i=s.place&&"start"in s.place?s.place.start:s.place;var o;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=i?i.column:void 0,this.fatal=void 0,this.file="",this.message=r,this.line=i?i.line:void 0,this.name=((o=s.place)&&"object"==typeof o?"position"in o||"type"in o?position(o.position):"start"in o||"end"in o?position(o):"line"in o||"column"in o?point(o):"":"")||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=a&&s.cause&&"string"==typeof s.cause.stack?s.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};VFileMessage.prototype.file="",VFileMessage.prototype.name="",VFileMessage.prototype.reason="",VFileMessage.prototype.message="",VFileMessage.prototype.stack="",VFileMessage.prototype.column=void 0,VFileMessage.prototype.line=void 0,VFileMessage.prototype.ancestors=void 0,VFileMessage.prototype.cause=void 0,VFileMessage.prototype.fatal=void 0,VFileMessage.prototype.place=void 0,VFileMessage.prototype.ruleId=void 0,VFileMessage.prototype.source=void 0;var import_node_path=__toESM(require("path"),1),import_node_process=__toESM(require("process"),1),import_node_url=require("url");function isUrl(e){return Boolean(null!==e&&"object"==typeof e&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&void 0===e.auth)}var order=["history","path","basename","stem","extname","dirname"],VFile=class{constructor(e){let t;t=e?isUrl(e)?{path:e}:"string"==typeof e||function(e){return Boolean(e&&"object"==typeof e&&"byteLength"in e&&"byteOffset"in e)}(e)?{value:e}:e:{},this.cwd="cwd"in t?"":import_node_process.default.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n,r=-1;for(;++r<order.length;){const e=order[r];e in t&&void 0!==t[e]&&null!==t[e]&&(this[e]="history"===e?[...t[e]]:t[e])}for(n in t)order.includes(n)||(this[n]=t[n])}get basename(){return"string"==typeof this.path?import_node_path.default.basename(this.path):void 0}set basename(e){assertNonEmpty(e,"basename"),assertPart(e,"basename"),this.path=import_node_path.default.join(this.dirname||"",e)}get dirname(){return"string"==typeof this.path?import_node_path.default.dirname(this.path):void 0}set dirname(e){assertPath(this.basename,"dirname"),this.path=import_node_path.default.join(e||"",this.basename)}get extname(){return"string"==typeof this.path?import_node_path.default.extname(this.path):void 0}set extname(e){if(assertPart(e,"extname"),assertPath(this.dirname,"extname"),e){if(46!==e.codePointAt(0))throw new Error("`extname` must start with `.`");if(e.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=import_node_path.default.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){isUrl(e)&&(e=(0,import_node_url.fileURLToPath)(e)),assertNonEmpty(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return"string"==typeof this.path?import_node_path.default.basename(this.path,this.extname):void 0}set stem(e){assertNonEmpty(e,"stem"),assertPart(e,"stem"),this.path=import_node_path.default.join(this.dirname||"",e+(this.extname||""))}fail(e,t,n){const r=this.message(e,t,n);throw r.fatal=!0,r}info(e,t,n){const r=this.message(e,t,n);return r.fatal=void 0,r}message(e,t,n){const r=new VFileMessage(e,t,n);return this.path&&(r.name=this.path+":"+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(e){return void 0===this.value?"":"string"==typeof this.value?this.value:new TextDecoder(e||void 0).decode(this.value)}};function assertPart(e,t){if(e&&e.includes(import_node_path.default.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+import_node_path.default.sep+"`")}function assertNonEmpty(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function assertPath(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}var CallableInstance=function(e){const t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r},own={}.hasOwnProperty,unified=(new class e extends CallableInstance{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=function(){const e=[],t={run:function(...t){let n=-1;const r=t.pop();if("function"!=typeof r)throw new TypeError("Expected function as last argument, not "+r);!function s(a,...i){const o=e[++n];let l=-1;if(a)r(a);else{for(;++l<t.length;)null!==i[l]&&void 0!==i[l]||(i[l]=t[l]);t=i,o?function(e,t){let n;return function(...t){const a=e.length>t.length;let i;a&&t.push(r);try{i=e.apply(this,t)}catch(e){if(a&&n)throw e;return r(e)}a||(i&&i.then&&"function"==typeof i.then?i.then(s,r):i instanceof Error?r(i):s(i))};function r(e,...r){n||(n=!0,t(e,...r))}function s(e){r(null,e)}}(o,s)(...i):r(null,...i)}}(null,...t)},use:function(n){if("function"!=typeof n)throw new TypeError("Expected `middelware` to be a function, not "+n);return e.push(n),t}};return t}()}copy(){const t=new e;let n=-1;for(;++n<this.attachers.length;){const e=this.attachers[n];t.use(...e)}return t.data((0,import_extend.default)(!0,{},this.namespace)),t}data(e,t){return"string"==typeof e?2===arguments.length?(assertUnfrozen("data",this.frozen),this.namespace[e]=t,this):own.call(this.namespace,e)&&this.namespace[e]||void 0:e?(assertUnfrozen("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;const e=this;for(;++this.freezeIndex<this.attachers.length;){const[t,...n]=this.attachers[this.freezeIndex];if(!1===n[0])continue;!0===n[0]&&(n[0]=void 0);const r=t.call(e,...n);"function"==typeof r&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(e){this.freeze();const t=vfile(e),n=this.parser||this.Parser;return assertParser("parse",n),n(String(t),t)}process(e,t){const n=this;return this.freeze(),assertParser("process",this.parser||this.Parser),assertCompiler("process",this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,s){const a=vfile(e),i=n.parse(a);function o(e,n){e||!n?s(e):r?r(n):t(void 0,n)}n.run(i,a,function(e,t,r){if(e||!t||!r)return o(e);const s=t,a=n.stringify(s,r);var i;"string"==typeof(i=a)||function(e){return Boolean(e&&"object"==typeof e&&"byteLength"in e&&"byteOffset"in e)}(i)?r.value=a:r.result=a,o(e,r)})}}processSync(e){let t,n=!1;return this.freeze(),assertParser("processSync",this.parser||this.Parser),assertCompiler("processSync",this.compiler||this.Compiler),this.process(e,function(e,r){n=!0,bail(e),t=r}),assertDone("processSync","process",n),t}run(e,t,n){assertNode(e),this.freeze();const r=this.transformers;return n||"function"!=typeof t||(n=t,t=void 0),n?s(void 0,n):new Promise(s);function s(s,a){const i=vfile(t);r.run(e,i,function(t,r,i){const o=r||e;t?a(t):s?s(o):n(void 0,o,i)})}}runSync(e,t){let n,r=!1;return this.run(e,t,function(e,t){bail(e),n=t,r=!0}),assertDone("runSync","run",r),n}stringify(e,t){this.freeze();const n=vfile(t),r=this.compiler||this.Compiler;return assertCompiler("stringify",r),assertNode(e),r(e,n)}use(e,...t){const n=this.attachers,r=this.namespace;if(assertUnfrozen("use",this.frozen),null==e);else if("function"==typeof e)o(e,t);else{if("object"!=typeof e)throw new TypeError("Expected usable value, not `"+e+"`");Array.isArray(e)?i(e):a(e)}return this;function s(e){if("function"==typeof e)o(e,[]);else{if("object"!=typeof e)throw new TypeError("Expected usable value, not `"+e+"`");if(Array.isArray(e)){const[t,...n]=e;o(t,n)}else a(e)}}function a(e){if(!("plugins"in e)&&!("settings"in e))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");i(e.plugins),e.settings&&(r.settings=(0,import_extend.default)(!0,r.settings,e.settings))}function i(e){let t=-1;if(null==e);else{if(!Array.isArray(e))throw new TypeError("Expected a list of plugins, not `"+e+"`");for(;++t<e.length;)s(e[t])}}function o(e,t){let r=-1,s=-1;for(;++r<n.length;)if(n[r][0]===e){s=r;break}if(-1===s)n.push([e,...t]);else if(t.length>0){let[r,...a]=t;const i=n[s][1];isPlainObject(i)&&isPlainObject(r)&&(r=(0,import_extend.default)(!0,i,r)),n[s]=[e,r,...a]}}}}).freeze();function assertParser(e,t){if("function"!=typeof t)throw new TypeError("Cannot `"+e+"` without `parser`")}function assertCompiler(e,t){if("function"!=typeof t)throw new TypeError("Cannot `"+e+"` without `compiler`")}function assertUnfrozen(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function assertNode(e){if(!isPlainObject(e)||"string"!=typeof e.type)throw new TypeError("Expected node, got `"+e+"`")}function assertDone(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function vfile(e){return function(e){return Boolean(e&&"object"==typeof e&&"message"in e&&"messages"in e)}(e)?e:new VFile(e)}var Schema=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};function merge(e,t){const n={},r={};for(const t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new Schema(n,r,t)}function normalize2(e){return e.toLowerCase()}Schema.prototype.normal={},Schema.prototype.property={},Schema.prototype.space=void 0;var Info4=class{constructor(e,t){this.attribute=t,this.property=e}};Info4.prototype.attribute="",Info4.prototype.booleanish=!1,Info4.prototype.boolean=!1,Info4.prototype.commaOrSpaceSeparated=!1,Info4.prototype.commaSeparated=!1,Info4.prototype.defined=!1,Info4.prototype.mustUseProperty=!1,Info4.prototype.number=!1,Info4.prototype.overloadedBoolean=!1,Info4.prototype.property="",Info4.prototype.spaceSeparated=!1,Info4.prototype.space=void 0;var types_exports={};__export(types_exports,{boolean:()=>boolean,booleanish:()=>booleanish,commaOrSpaceSeparated:()=>commaOrSpaceSeparated,commaSeparated:()=>commaSeparated,number:()=>number,overloadedBoolean:()=>overloadedBoolean,spaceSeparated:()=>spaceSeparated});var powers=0,boolean=increment(),booleanish=increment(),overloadedBoolean=increment(),number=increment(),spaceSeparated=increment(),commaSeparated=increment(),commaOrSpaceSeparated=increment();function increment(){return 2**++powers}var checks=Object.keys(types_exports),DefinedInfo=class extends Info4{constructor(e,t,n,r){let s=-1;if(super(e,t),mark(this,"space",r),"number"==typeof n)for(;++s<checks.length;){const e=checks[s];mark(this,checks[s],(n&types_exports[e])===types_exports[e])}}};function mark(e,t,n){n&&(e[t]=n)}function create(e){const t={},n={};for(const[r,s]of Object.entries(e.properties)){const a=new DefinedInfo(r,e.transform(e.attributes||{},r),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[normalize2(r)]=r,n[normalize2(a.attribute)]=r}return new Schema(t,n,e.space)}DefinedInfo.prototype.defined=!0;var aria=create({properties:{ariaActiveDescendant:null,ariaAtomic:booleanish,ariaAutoComplete:null,ariaBusy:booleanish,ariaChecked:booleanish,ariaColCount:number,ariaColIndex:number,ariaColSpan:number,ariaControls:spaceSeparated,ariaCurrent:null,ariaDescribedBy:spaceSeparated,ariaDetails:null,ariaDisabled:booleanish,ariaDropEffect:spaceSeparated,ariaErrorMessage:null,ariaExpanded:booleanish,ariaFlowTo:spaceSeparated,ariaGrabbed:booleanish,ariaHasPopup:null,ariaHidden:booleanish,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:spaceSeparated,ariaLevel:number,ariaLive:null,ariaModal:booleanish,ariaMultiLine:booleanish,ariaMultiSelectable:booleanish,ariaOrientation:null,ariaOwns:spaceSeparated,ariaPlaceholder:null,ariaPosInSet:number,ariaPressed:booleanish,ariaReadOnly:booleanish,ariaRelevant:null,ariaRequired:booleanish,ariaRoleDescription:spaceSeparated,ariaRowCount:number,ariaRowIndex:number,ariaRowSpan:number,ariaSelected:booleanish,ariaSetSize:number,ariaSort:null,ariaValueMax:number,ariaValueMin:number,ariaValueNow:number,ariaValueText:null,role:null},transform:(e,t)=>"role"===t?t:"aria-"+t.slice(4).toLowerCase()});function caseSensitiveTransform(e,t){return t in e?e[t]:t}function caseInsensitiveTransform(e,t){return caseSensitiveTransform(e,t.toLowerCase())}var html=create({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:commaSeparated,acceptCharset:spaceSeparated,accessKey:spaceSeparated,action:null,allow:null,allowFullScreen:boolean,allowPaymentRequest:boolean,allowUserMedia:boolean,alt:null,as:null,async:boolean,autoCapitalize:null,autoComplete:spaceSeparated,autoFocus:boolean,autoPlay:boolean,blocking:spaceSeparated,capture:null,charSet:null,checked:boolean,cite:null,className:spaceSeparated,cols:number,colSpan:null,content:null,contentEditable:booleanish,controls:boolean,controlsList:spaceSeparated,coords:number|commaSeparated,crossOrigin:null,data:null,dateTime:null,decoding:null,default:boolean,defer:boolean,dir:null,dirName:null,disabled:boolean,download:overloadedBoolean,draggable:booleanish,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:boolean,formTarget:null,headers:spaceSeparated,height:number,hidden:overloadedBoolean,high:number,href:null,hrefLang:null,htmlFor:spaceSeparated,httpEquiv:spaceSeparated,id:null,imageSizes:null,imageSrcSet:null,inert:boolean,inputMode:null,integrity:null,is:null,isMap:boolean,itemId:null,itemProp:spaceSeparated,itemRef:spaceSeparated,itemScope:boolean,itemType:spaceSeparated,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:boolean,low:number,manifest:null,max:null,maxLength:number,media:null,method:null,min:null,minLength:number,multiple:boolean,muted:boolean,name:null,nonce:null,noModule:boolean,noValidate:boolean,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:boolean,optimum:number,pattern:null,ping:spaceSeparated,placeholder:null,playsInline:boolean,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:boolean,referrerPolicy:null,rel:spaceSeparated,required:boolean,reversed:boolean,rows:number,rowSpan:number,sandbox:spaceSeparated,scope:null,scoped:boolean,seamless:boolean,selected:boolean,shadowRootClonable:boolean,shadowRootDelegatesFocus:boolean,shadowRootMode:null,shape:null,size:number,sizes:null,slot:null,span:number,spellCheck:booleanish,src:null,srcDoc:null,srcLang:null,srcSet:null,start:number,step:null,style:null,tabIndex:number,target:null,title:null,translate:null,type:null,typeMustMatch:boolean,useMap:null,value:booleanish,width:number,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:spaceSeparated,axis:null,background:null,bgColor:null,border:number,borderColor:null,bottomMargin:number,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:boolean,declare:boolean,event:null,face:null,frame:null,frameBorder:null,hSpace:number,leftMargin:number,link:null,longDesc:null,lowSrc:null,marginHeight:number,marginWidth:number,noResize:boolean,noHref:boolean,noShade:boolean,noWrap:boolean,object:null,profile:null,prompt:null,rev:null,rightMargin:number,rules:null,scheme:null,scrolling:booleanish,standby:null,summary:null,text:null,topMargin:number,valueType:null,version:null,vAlign:null,vLink:null,vSpace:number,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:boolean,disableRemotePlayback:boolean,prefix:null,property:null,results:number,security:null,unselectable:null},space:"html",transform:caseInsensitiveTransform}),svg=create({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:commaOrSpaceSeparated,accentHeight:number,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:number,amplitude:number,arabicForm:null,ascent:number,attributeName:null,attributeType:null,azimuth:number,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:number,by:null,calcMode:null,capHeight:number,className:spaceSeparated,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:number,diffuseConstant:number,direction:null,display:null,dur:null,divisor:number,dominantBaseline:null,download:boolean,dx:null,dy:null,edgeMode:null,editable:null,elevation:number,enableBackground:null,end:null,event:null,exponent:number,externalResourcesRequired:null,fill:null,fillOpacity:number,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:commaSeparated,g2:commaSeparated,glyphName:commaSeparated,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:number,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:number,horizOriginX:number,horizOriginY:number,id:null,ideographic:number,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:number,k:number,k1:number,k2:number,k3:number,k4:number,kernelMatrix:commaOrSpaceSeparated,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:number,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:number,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:number,overlineThickness:number,paintOrder:null,panose1:null,path:null,pathLength:number,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:spaceSeparated,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:number,pointsAtY:number,pointsAtZ:number,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:commaOrSpaceSeparated,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:commaOrSpaceSeparated,rev:commaOrSpaceSeparated,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:commaOrSpaceSeparated,requiredFeatures:commaOrSpaceSeparated,requiredFonts:commaOrSpaceSeparated,requiredFormats:commaOrSpaceSeparated,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:number,specularExponent:number,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:number,strikethroughThickness:number,string:null,stroke:null,strokeDashArray:commaOrSpaceSeparated,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:number,strokeOpacity:number,strokeWidth:null,style:null,surfaceScale:number,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:commaOrSpaceSeparated,tabIndex:number,tableValues:null,target:null,targetX:number,targetY:number,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:commaOrSpaceSeparated,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:number,underlineThickness:number,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:number,values:null,vAlphabetic:number,vMathematical:number,vectorEffect:null,vHanging:number,vIdeographic:number,version:null,vertAdvY:number,vertOriginX:number,vertOriginY:number,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:number,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:caseSensitiveTransform}),xlink=create({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform:(e,t)=>"xlink:"+t.slice(5).toLowerCase()}),xmlns=create({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:caseInsensitiveTransform}),xml=create({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform:(e,t)=>"xml:"+t.slice(3).toLowerCase()}),cap=/[A-Z]/g,dash=/-[a-z]/g,valid=/^data[-\w.:]+$/i;function kebab(e){return"-"+e.toLowerCase()}function camelcase(e){return e.charAt(1).toUpperCase()}var html2=merge([aria,html,xlink,xmlns,xml],"html"),svg2=merge([aria,svg,xlink,xmlns,xml],"svg");function parse(e){const t=[],n=String(e||"");let r=n.indexOf(","),s=0,a=!1;for(;!a;){-1===r&&(r=n.length,a=!0);const e=n.slice(s,r).trim();!e&&a||t.push(e),s=r+1,r=n.indexOf(",",s)}return t}function stringify(e,t){const n=t||{};return(""===e[e.length-1]?[...e,""]:e).join((n.padRight?" ":"")+","+(!1===n.padLeft?"":" ")).trim()}var search=/[#.]/g;function parse2(e){const t=String(e||"").trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function stringify2(e){return e.join(" ").trim()}function createH(e,t,n){const r=n?function(e){const t=new Map;for(const n of e)t.set(n.toLowerCase(),n);return t}(n):void 0;return function(n,s,...a){let i;if(null==n){i={type:"root",children:[]};const e=s;a.unshift(e)}else{i=function(e,t){const n=e||"",r={};let s,a,i=0;for(;i<n.length;){search.lastIndex=i;const e=search.exec(n),t=n.slice(i,e?e.index:n.length);t&&(s?"#"===s?r.id=t:Array.isArray(r.className)?r.className.push(t):r.className=[t]:a=t,i+=t.length),e&&(s=e[0],i++)}return{type:"element",tagName:a||t||"div",properties:r,children:[]}}(n,t);const o=i.tagName.toLowerCase(),l=r?r.get(o):void 0;if(i.tagName=l||o,function(e){if(null===e||"object"!=typeof e||Array.isArray(e))return!0;if("string"!=typeof e.type)return!1;const t=e,n=Object.keys(e);for(const e of n){const n=t[e];if(n&&"object"==typeof n){if(!Array.isArray(n))return!0;const e=n;for(const t of e)if("number"!=typeof t&&"string"!=typeof t)return!0}}return!(!("children"in e)||!Array.isArray(e.children))}(s))a.unshift(s);else for(const[t,n]of Object.entries(s))addProperty(e,i.properties,t,n)}for(const e of a)addChild(i.children,e);return"element"===i.type&&"template"===i.tagName&&(i.content={type:"root",children:i.children},i.children=[]),i}}function addProperty(e,t,n,r){const s=function(e,t){const n=normalize2(t);let r=t,s=Info4;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&"data"===n.slice(0,4)&&valid.test(t)){if("-"===t.charAt(4)){const e=t.slice(5).replace(dash,camelcase);r="data"+e.charAt(0).toUpperCase()+e.slice(1)}else{const e=t.slice(4);if(!dash.test(e)){let n=e.replace(cap,kebab);"-"!==n.charAt(0)&&(n="-"+n),t="data"+n}}s=DefinedInfo}return new s(r,t)}(e,n);let a;if(null!=r){if("number"==typeof r){if(Number.isNaN(r))return;a=r}else a="boolean"==typeof r?r:"string"==typeof r?s.spaceSeparated?parse2(r):s.commaSeparated?parse(r):s.commaOrSpaceSeparated?parse2(parse(r).join(" ")):parsePrimitive(s,s.property,r):Array.isArray(r)?[...r]:"style"===s.property?function(e){const t=[];for(const[n,r]of Object.entries(e))t.push([n,r].join(": "));return t.join("; ")}(r):String(r);if(Array.isArray(a)){const e=[];for(const t of a)e.push(parsePrimitive(s,s.property,t));a=e}"className"===s.property&&Array.isArray(t.className)&&(a=t.className.concat(a)),t[s.property]=a}}function addChild(e,t){if(null==t);else if("number"==typeof t||"string"==typeof t)e.push({type:"text",value:String(t)});else if(Array.isArray(t))for(const n of t)addChild(e,n);else{if("object"!=typeof t||!("type"in t))throw new Error("Expected node, nodes, or string, got `"+t+"`");"root"===t.type?addChild(e,t.children):e.push(t)}}function parsePrimitive(e,t,n){if("string"==typeof n){if(e.number&&n&&!Number.isNaN(Number(n)))return Number(n);if((e.boolean||e.overloadedBoolean)&&(""===n||normalize2(n)===normalize2(t)))return!0}return n}var h=createH(html2,"div"),s=createH(svg2,"g",["altGlyph","altGlyphDef","altGlyphItem","animateColor","animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","glyphRef","linearGradient","radialGradient","solidColor","textArea","textPath"]),Schema2=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};function merge2(e,t){const n={},r={};for(const t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new Schema2(n,r,t)}function normalize3(e){return e.toLowerCase()}Schema2.prototype.normal={},Schema2.prototype.property={},Schema2.prototype.space=void 0;var Info5=class{constructor(e,t){this.attribute=t,this.property=e}};Info5.prototype.attribute="",Info5.prototype.booleanish=!1,Info5.prototype.boolean=!1,Info5.prototype.commaOrSpaceSeparated=!1,Info5.prototype.commaSeparated=!1,Info5.prototype.defined=!1,Info5.prototype.mustUseProperty=!1,Info5.prototype.number=!1,Info5.prototype.overloadedBoolean=!1,Info5.prototype.property="",Info5.prototype.spaceSeparated=!1,Info5.prototype.space=void 0;var types_exports2={};__export(types_exports2,{boolean:()=>boolean2,booleanish:()=>booleanish2,commaOrSpaceSeparated:()=>commaOrSpaceSeparated2,commaSeparated:()=>commaSeparated2,number:()=>number2,overloadedBoolean:()=>overloadedBoolean2,spaceSeparated:()=>spaceSeparated2});var powers2=0,boolean2=increment2(),booleanish2=increment2(),overloadedBoolean2=increment2(),number2=increment2(),spaceSeparated2=increment2(),commaSeparated2=increment2(),commaOrSpaceSeparated2=increment2();function increment2(){return 2**++powers2}var checks2=Object.keys(types_exports2),DefinedInfo2=class extends Info5{constructor(e,t,n,r){let s=-1;if(super(e,t),mark2(this,"space",r),"number"==typeof n)for(;++s<checks2.length;){const e=checks2[s];mark2(this,checks2[s],(n&types_exports2[e])===types_exports2[e])}}};function mark2(e,t,n){n&&(e[t]=n)}function create2(e){const t={},n={};for(const[r,s]of Object.entries(e.properties)){const a=new DefinedInfo2(r,e.transform(e.attributes||{},r),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[normalize3(r)]=r,n[normalize3(a.attribute)]=r}return new Schema2(t,n,e.space)}DefinedInfo2.prototype.defined=!0;var aria2=create2({properties:{ariaActiveDescendant:null,ariaAtomic:booleanish2,ariaAutoComplete:null,ariaBusy:booleanish2,ariaChecked:booleanish2,ariaColCount:number2,ariaColIndex:number2,ariaColSpan:number2,ariaControls:spaceSeparated2,ariaCurrent:null,ariaDescribedBy:spaceSeparated2,ariaDetails:null,ariaDisabled:booleanish2,ariaDropEffect:spaceSeparated2,ariaErrorMessage:null,ariaExpanded:booleanish2,ariaFlowTo:spaceSeparated2,ariaGrabbed:booleanish2,ariaHasPopup:null,ariaHidden:booleanish2,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:spaceSeparated2,ariaLevel:number2,ariaLive:null,ariaModal:booleanish2,ariaMultiLine:booleanish2,ariaMultiSelectable:booleanish2,ariaOrientation:null,ariaOwns:spaceSeparated2,ariaPlaceholder:null,ariaPosInSet:number2,ariaPressed:booleanish2,ariaReadOnly:booleanish2,ariaRelevant:null,ariaRequired:booleanish2,ariaRoleDescription:spaceSeparated2,ariaRowCount:number2,ariaRowIndex:number2,ariaRowSpan:number2,ariaSelected:booleanish2,ariaSetSize:number2,ariaSort:null,ariaValueMax:number2,ariaValueMin:number2,ariaValueNow:number2,ariaValueText:null,role:null},transform:(e,t)=>"role"===t?t:"aria-"+t.slice(4).toLowerCase()});function caseSensitiveTransform2(e,t){return t in e?e[t]:t}function caseInsensitiveTransform2(e,t){return caseSensitiveTransform2(e,t.toLowerCase())}var html3=create2({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:commaSeparated2,acceptCharset:spaceSeparated2,accessKey:spaceSeparated2,action:null,allow:null,allowFullScreen:boolean2,allowPaymentRequest:boolean2,allowUserMedia:boolean2,alt:null,as:null,async:boolean2,autoCapitalize:null,autoComplete:spaceSeparated2,autoFocus:boolean2,autoPlay:boolean2,blocking:spaceSeparated2,capture:null,charSet:null,checked:boolean2,cite:null,className:spaceSeparated2,cols:number2,colSpan:null,content:null,contentEditable:booleanish2,controls:boolean2,controlsList:spaceSeparated2,coords:number2|commaSeparated2,crossOrigin:null,data:null,dateTime:null,decoding:null,default:boolean2,defer:boolean2,dir:null,dirName:null,disabled:boolean2,download:overloadedBoolean2,draggable:booleanish2,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:boolean2,formTarget:null,headers:spaceSeparated2,height:number2,hidden:overloadedBoolean2,high:number2,href:null,hrefLang:null,htmlFor:spaceSeparated2,httpEquiv:spaceSeparated2,id:null,imageSizes:null,imageSrcSet:null,inert:boolean2,inputMode:null,integrity:null,is:null,isMap:boolean2,itemId:null,itemProp:spaceSeparated2,itemRef:spaceSeparated2,itemScope:boolean2,itemType:spaceSeparated2,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:boolean2,low:number2,manifest:null,max:null,maxLength:number2,media:null,method:null,min:null,minLength:number2,multiple:boolean2,muted:boolean2,name:null,nonce:null,noModule:boolean2,noValidate:boolean2,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:boolean2,optimum:number2,pattern:null,ping:spaceSeparated2,placeholder:null,playsInline:boolean2,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:boolean2,referrerPolicy:null,rel:spaceSeparated2,required:boolean2,reversed:boolean2,rows:number2,rowSpan:number2,sandbox:spaceSeparated2,scope:null,scoped:boolean2,seamless:boolean2,selected:boolean2,shadowRootClonable:boolean2,shadowRootDelegatesFocus:boolean2,shadowRootMode:null,shape:null,size:number2,sizes:null,slot:null,span:number2,spellCheck:booleanish2,src:null,srcDoc:null,srcLang:null,srcSet:null,start:number2,step:null,style:null,tabIndex:number2,target:null,title:null,translate:null,type:null,typeMustMatch:boolean2,useMap:null,value:booleanish2,width:number2,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:spaceSeparated2,axis:null,background:null,bgColor:null,border:number2,borderColor:null,bottomMargin:number2,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:boolean2,declare:boolean2,event:null,face:null,frame:null,frameBorder:null,hSpace:number2,leftMargin:number2,link:null,longDesc:null,lowSrc:null,marginHeight:number2,marginWidth:number2,noResize:boolean2,noHref:boolean2,noShade:boolean2,noWrap:boolean2,object:null,profile:null,prompt:null,rev:null,rightMargin:number2,rules:null,scheme:null,scrolling:booleanish2,standby:null,summary:null,text:null,topMargin:number2,valueType:null,version:null,vAlign:null,vLink:null,vSpace:number2,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:boolean2,disableRemotePlayback:boolean2,prefix:null,property:null,results:number2,security:null,unselectable:null},space:"html",transform:caseInsensitiveTransform2}),svg3=create2({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:commaOrSpaceSeparated2,accentHeight:number2,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:number2,amplitude:number2,arabicForm:null,ascent:number2,attributeName:null,attributeType:null,azimuth:number2,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:number2,by:null,calcMode:null,capHeight:number2,className:spaceSeparated2,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:number2,diffuseConstant:number2,direction:null,display:null,dur:null,divisor:number2,dominantBaseline:null,download:boolean2,dx:null,dy:null,edgeMode:null,editable:null,elevation:number2,enableBackground:null,end:null,event:null,exponent:number2,externalResourcesRequired:null,fill:null,fillOpacity:number2,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:commaSeparated2,g2:commaSeparated2,glyphName:commaSeparated2,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:number2,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:number2,horizOriginX:number2,horizOriginY:number2,id:null,ideographic:number2,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:number2,k:number2,k1:number2,k2:number2,k3:number2,k4:number2,kernelMatrix:commaOrSpaceSeparated2,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:number2,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:number2,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:number2,overlineThickness:number2,paintOrder:null,panose1:null,path:null,pathLength:number2,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:spaceSeparated2,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:number2,pointsAtY:number2,pointsAtZ:number2,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:commaOrSpaceSeparated2,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:commaOrSpaceSeparated2,rev:commaOrSpaceSeparated2,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:commaOrSpaceSeparated2,requiredFeatures:commaOrSpaceSeparated2,requiredFonts:commaOrSpaceSeparated2,requiredFormats:commaOrSpaceSeparated2,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:number2,specularExponent:number2,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:number2,strikethroughThickness:number2,string:null,stroke:null,strokeDashArray:commaOrSpaceSeparated2,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:number2,strokeOpacity:number2,strokeWidth:null,style:null,surfaceScale:number2,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:commaOrSpaceSeparated2,tabIndex:number2,tableValues:null,target:null,targetX:number2,targetY:number2,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:commaOrSpaceSeparated2,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:number2,underlineThickness:number2,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:number2,values:null,vAlphabetic:number2,vMathematical:number2,vectorEffect:null,vHanging:number2,vIdeographic:number2,version:null,vertAdvY:number2,vertOriginX:number2,vertOriginY:number2,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:number2,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:caseSensitiveTransform2}),xlink2=create2({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform:(e,t)=>"xlink:"+t.slice(5).toLowerCase()}),xmlns2=create2({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:caseInsensitiveTransform2}),xml2=create2({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform:(e,t)=>"xml:"+t.slice(3).toLowerCase()}),cap2=/[A-Z]/g,dash2=/-[a-z]/g,valid2=/^data[-\w.:]+$/i;function find2(e,t){const n=normalize3(t);let r=t,s=Info5;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&"data"===n.slice(0,4)&&valid2.test(t)){if("-"===t.charAt(4)){const e=t.slice(5).replace(dash2,camelcase2);r="data"+e.charAt(0).toUpperCase()+e.slice(1)}else{const e=t.slice(4);if(!dash2.test(e)){let n=e.replace(cap2,kebab2);"-"!==n.charAt(0)&&(n="-"+n),t="data"+n}}s=DefinedInfo2}return new s(r,t)}function kebab2(e){return"-"+e.toLowerCase()}function camelcase2(e){return e.charAt(1).toUpperCase()}var html4=merge2([aria2,html3,xlink2,xmlns2,xml2],"html"),svg4=merge2([aria2,svg3,xlink2,xmlns2,xml2],"svg");function next(e,t){const n=e.indexOf("\r",t),r=e.indexOf("\n",t);return-1===r?n:-1===n||n+1===r?r:n<r?n:r}var own2={}.hasOwnProperty,proto=Object.prototype;function one(e,t){let n;switch(t.nodeName){case"#comment":{const r=t;return n={type:"comment",value:r.data},patch(e,r,n),n}case"#document":case"#document-fragment":{const r=t,s="mode"in r&&("quirks"===r.mode||"limited-quirks"===r.mode);if(n={type:"root",children:all(e,t.childNodes),data:{quirksMode:s}},e.file&&e.location){const t=String(e.file),r=function(e){const t=String(e),n=[];return{toOffset:function(e){if(e&&"number"==typeof e.line&&"number"==typeof e.column&&!Number.isNaN(e.line)&&!Number.isNaN(e.column)){for(;n.length<e.line;){const e=n[n.length-1],r=next(t,e),s=-1===r?t.length+1:r+1;if(e===s)break;n.push(s)}const r=(e.line>1?n[e.line-2]:0)+e.column-1;if(r<n[e.line-1])return r}},toPoint:function(e){if("number"==typeof e&&e>-1&&e<=t.length){let r=0;for(;;){let s=n[r];if(void 0===s){const e=next(t,n[r-1]);s=-1===e?t.length+1:e+1,n[r]=s}if(s>e)return{line:r+1,column:e-(r>0?n[r-1]:0)+1,offset:e};r++}}}}}(t),s=r.toPoint(0),a=r.toPoint(t.length);n.position={start:s,end:a}}return n}case"#documentType":return n={type:"doctype"},patch(e,t,n),n;case"#text":{const r=t;return n={type:"text",value:r.value},patch(e,r,n),n}default:return n=function(e,t){const n=e.schema;e.schema="http://www.w3.org/2000/svg"===t.namespaceURI?svg4:html4;let r=-1;const a={};for(;++r<t.attrs.length;){const e=t.attrs[r],n=(e.prefix?e.prefix+":":"")+e.name;own2.call(proto,n)||(a[n]=e.value)}const i=("svg"===e.schema.space?s:h)(t.tagName,a,all(e,t.childNodes));if(patch(e,t,i),"template"===i.tagName){const n=t,r=n.sourceCodeLocation,s=r&&r.startTag&&position2(r.startTag),a=r&&r.endTag&&position2(r.endTag),o=one(e,n.content);s&&a&&e.file&&(o.position={start:s.end,end:a.start}),i.content=o}return e.schema=n,i}(e,t),n}}function all(e,t){let n=-1;const r=[];for(;++n<t.length;){const s=one(e,t[n]);r.push(s)}return r}function patch(e,t,n){if("sourceCodeLocation"in t&&t.sourceCodeLocation&&e.file){const r=function(e,t,n){const r=position2(n);if("element"===t.type){const s=t.children[t.children.length-1];if(r&&!n.endTag&&s&&s.position&&s.position.end&&(r.end=Object.assign({},s.position.end)),e.verbose){const r={};let s;if(n.attrs)for(s in n.attrs)own2.call(n.attrs,s)&&(r[find2(e.schema,s).property]=position2(n.attrs[s]));n.startTag;const a=position2(n.startTag),i=n.endTag?position2(n.endTag):void 0,o={opening:a};i&&(o.closing=i),o.properties=r,t.data={position:o}}}return r}(e,n,t.sourceCodeLocation);r&&(e.location=!0,n.position=r)}}function position2(e){const t=point2({line:e.startLine,column:e.startCol,offset:e.startOffset}),n=point2({line:e.endLine,column:e.endCol,offset:e.endOffset});return t||n?{start:t,end:n}:void 0}function point2(e){return e.line&&e.column?e:void 0}var CODE_POINTS,CODE_POINTS2,UNDEFINED_CODE_POINTS=new Set([65534,65535,131070,131071,196606,196607,262142,262143,327678,327679,393214,393215,458750,458751,524286,524287,589822,589823,655358,655359,720894,720895,786430,786431,851966,851967,917502,917503,983038,983039,1048574,1048575,1114110,1114111]);(CODE_POINTS2=CODE_POINTS||(CODE_POINTS={}))[CODE_POINTS2.EOF=-1]="EOF",CODE_POINTS2[CODE_POINTS2.NULL=0]="NULL",CODE_POINTS2[CODE_POINTS2.TABULATION=9]="TABULATION",CODE_POINTS2[CODE_POINTS2.CARRIAGE_RETURN=13]="CARRIAGE_RETURN",CODE_POINTS2[CODE_POINTS2.LINE_FEED=10]="LINE_FEED",CODE_POINTS2[CODE_POINTS2.FORM_FEED=12]="FORM_FEED",CODE_POINTS2[CODE_POINTS2.SPACE=32]="SPACE",CODE_POINTS2[CODE_POINTS2.EXCLAMATION_MARK=33]="EXCLAMATION_MARK",CODE_POINTS2[CODE_POINTS2.QUOTATION_MARK=34]="QUOTATION_MARK",CODE_POINTS2[CODE_POINTS2.AMPERSAND=38]="AMPERSAND",CODE_POINTS2[CODE_POINTS2.APOSTROPHE=39]="APOSTROPHE",CODE_POINTS2[CODE_POINTS2.HYPHEN_MINUS=45]="HYPHEN_MINUS",CODE_POINTS2[CODE_POINTS2.SOLIDUS=47]="SOLIDUS",CODE_POINTS2[CODE_POINTS2.DIGIT_0=48]="DIGIT_0",CODE_POINTS2[CODE_POINTS2.DIGIT_9=57]="DIGIT_9",CODE_POINTS2[CODE_POINTS2.SEMICOLON=59]="SEMICOLON",CODE_POINTS2[CODE_POINTS2.LESS_THAN_SIGN=60]="LESS_THAN_SIGN",CODE_POINTS2[CODE_POINTS2.EQUALS_SIGN=61]="EQUALS_SIGN",CODE_POINTS2[CODE_POINTS2.GREATER_THAN_SIGN=62]="GREATER_THAN_SIGN",CODE_POINTS2[CODE_POINTS2.QUESTION_MARK=63]="QUESTION_MARK",CODE_POINTS2[CODE_POINTS2.LATIN_CAPITAL_A=65]="LATIN_CAPITAL_A",CODE_POINTS2[CODE_POINTS2.LATIN_CAPITAL_Z=90]="LATIN_CAPITAL_Z",CODE_POINTS2[CODE_POINTS2.RIGHT_SQUARE_BRACKET=93]="RIGHT_SQUARE_BRACKET",CODE_POINTS2[CODE_POINTS2.GRAVE_ACCENT=96]="GRAVE_ACCENT",CODE_POINTS2[CODE_POINTS2.LATIN_SMALL_A=97]="LATIN_SMALL_A",CODE_POINTS2[CODE_POINTS2.LATIN_SMALL_Z=122]="LATIN_SMALL_Z";var ERR,ERR2;function isSurrogate(e){return e>=55296&&e<=57343}function isControlCodePoint(e){return 32!==e&&10!==e&&13!==e&&9!==e&&12!==e&&e>=1&&e<=31||e>=127&&e<=159}function isUndefinedCodePoint(e){return e>=64976&&e<=65007||UNDEFINED_CODE_POINTS.has(e)}(ERR2=ERR||(ERR={})).controlCharacterInInputStream="control-character-in-input-stream",ERR2.noncharacterInInputStream="noncharacter-in-input-stream",ERR2.surrogateInInputStream="surrogate-in-input-stream",ERR2.nonVoidHtmlElementStartTagWithTrailingSolidus="non-void-html-element-start-tag-with-trailing-solidus",ERR2.endTagWithAttributes="end-tag-with-attributes",ERR2.endTagWithTrailingSolidus="end-tag-with-trailing-solidus",ERR2.unexpectedSolidusInTag="unexpected-solidus-in-tag",ERR2.unexpectedNullCharacter="unexpected-null-character",ERR2.unexpectedQuestionMarkInsteadOfTagName="unexpected-question-mark-instead-of-tag-name",ERR2.invalidFirstCharacterOfTagName="invalid-first-character-of-tag-name",ERR2.unexpectedEqualsSignBeforeAttributeName="unexpected-equals-sign-before-attribute-name",ERR2.missingEndTagName="missing-end-tag-name",ERR2.unexpectedCharacterInAttributeName="unexpected-character-in-attribute-name",ERR2.unknownNamedCharacterReference="unknown-named-character-reference",ERR2.missingSemicolonAfterCharacterReference="missing-semicolon-after-character-reference",ERR2.unexpectedCharacterAfterDoctypeSystemIdentifier="unexpected-character-after-doctype-system-identifier",ERR2.unexpectedCharacterInUnquotedAttributeValue="unexpected-character-in-unquoted-attribute-value",ERR2.eofBeforeTagName="eof-before-tag-name",ERR2.eofInTag="eof-in-tag",ERR2.missingAttributeValue="missing-attribute-value",ERR2.missingWhitespaceBetweenAttributes="missing-whitespace-between-attributes",ERR2.missingWhitespaceAfterDoctypePublicKeyword="missing-whitespace-after-doctype-public-keyword",ERR2.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers="missing-whitespace-between-doctype-public-and-system-identifiers",ERR2.missingWhitespaceAfterDoctypeSystemKeyword="missing-whitespace-after-doctype-system-keyword",ERR2.missingQuoteBeforeDoctypePublicIdentifier="missing-quote-before-doctype-public-identifier",ERR2.missingQuoteBeforeDoctypeSystemIdentifier="missing-quote-before-doctype-system-identifier",ERR2.missingDoctypePublicIdentifier="missing-doctype-public-identifier",ERR2.missingDoctypeSystemIdentifier="missing-doctype-system-identifier",ERR2.abruptDoctypePublicIdentifier="abrupt-doctype-public-identifier",ERR2.abruptDoctypeSystemIdentifier="abrupt-doctype-system-identifier",ERR2.cdataInHtmlContent="cdata-in-html-content",ERR2.incorrectlyOpenedComment="incorrectly-opened-comment",ERR2.eofInScriptHtmlCommentLikeText="eof-in-script-html-comment-like-text",ERR2.eofInDoctype="eof-in-doctype",ERR2.nestedComment="nested-comment",ERR2.abruptClosingOfEmptyComment="abrupt-closing-of-empty-comment",ERR2.eofInComment="eof-in-comment",ERR2.incorrectlyClosedComment="incorrectly-closed-comment",ERR2.eofInCdata="eof-in-cdata",ERR2.absenceOfDigitsInNumericCharacterReference="absence-of-digits-in-numeric-character-reference",ERR2.nullCharacterReference="null-character-reference",ERR2.surrogateCharacterReference="surrogate-character-reference",ERR2.characterReferenceOutsideUnicodeRange="character-reference-outside-unicode-range",ERR2.controlCharacterReference="control-character-reference",ERR2.noncharacterCharacterReference="noncharacter-character-reference",ERR2.missingWhitespaceBeforeDoctypeName="missing-whitespace-before-doctype-name",ERR2.missingDoctypeName="missing-doctype-name",ERR2.invalidCharacterSequenceAfterDoctypeName="invalid-character-sequence-after-doctype-name",ERR2.duplicateAttribute="duplicate-attribute",ERR2.nonConformingDoctype="non-conforming-doctype",ERR2.missingDoctype="missing-doctype",ERR2.misplacedDoctype="misplaced-doctype",ERR2.endTagWithoutMatchingOpenElement="end-tag-without-matching-open-element",ERR2.closingOfElementWithOpenChildElements="closing-of-element-with-open-child-elements",ERR2.disallowedContentInNoscriptInHead="disallowed-content-in-noscript-in-head",ERR2.openElementsLeftAfterEof="open-elements-left-after-eof",ERR2.abandonedHeadElementChild="abandoned-head-element-child",ERR2.misplacedStartTagForHeadElement="misplaced-start-tag-for-head-element",ERR2.nestedNoscriptInHead="nested-noscript-in-head",ERR2.eofInElementThatCanContainOnlyText="eof-in-element-that-can-contain-only-text";var TokenType,TokenType2,Preprocessor=class{constructor(e){this.handler=e,this.html="",this.pos=-1,this.lastGapPos=-2,this.gapStack=[],this.skipNextNewLine=!1,this.lastChunkWritten=!1,this.endOfChunkHit=!1,this.bufferWaterline=65536,this.isEol=!1,this.lineStartPos=0,this.droppedBufferSize=0,this.line=1,this.lastErrOffset=-1}get col(){return this.pos-this.lineStartPos+Number(this.lastGapPos!==this.pos)}get offset(){return this.droppedBufferSize+this.pos}getError(e,t){const{line:n,col:r,offset:s}=this,a=r+t,i=s+t;return{code:e,startLine:n,endLine:n,startCol:a,endCol:a,startOffset:i,endOffset:i}}_err(e){this.handler.onParseError&&this.lastErrOffset!==this.offset&&(this.lastErrOffset=this.offset,this.handler.onParseError(this.getError(e,0)))}_addGap(){this.gapStack.push(this.lastGapPos),this.lastGapPos=this.pos}_processSurrogate(e){if(this.pos!==this.html.length-1){const t=this.html.charCodeAt(this.pos+1);if(function(e){return e>=56320&&e<=57343}(t))return this.pos++,this._addGap(),1024*(e-55296)+9216+t}else if(!this.lastChunkWritten)return this.endOfChunkHit=!0,CODE_POINTS.EOF;return this._err(ERR.surrogateInInputStream),e}willDropParsedChunk(){return this.pos>this.bufferWaterline}dropParsedChunk(){this.willDropParsedChunk()&&(this.html=this.html.substring(this.pos),this.lineStartPos-=this.pos,this.droppedBufferSize+=this.pos,this.pos=0,this.lastGapPos=-2,this.gapStack.length=0)}write(e,t){this.html.length>0?this.html+=e:this.html=e,this.endOfChunkHit=!1,this.lastChunkWritten=t}insertHtmlAtCurrentPos(e){this.html=this.html.substring(0,this.pos+1)+e+this.html.substring(this.pos+1),this.endOfChunkHit=!1}startsWith(e,t){if(this.pos+e.length>this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,!1;if(t)return this.html.startsWith(e,this.pos);for(let t=0;t<e.length;t++)if((32|this.html.charCodeAt(this.pos+t))!==e.charCodeAt(t))return!1;return!0}peek(e){const t=this.pos+e;if(t>=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,CODE_POINTS.EOF;const n=this.html.charCodeAt(t);return n===CODE_POINTS.CARRIAGE_RETURN?CODE_POINTS.LINE_FEED:n}advance(){if(this.pos++,this.isEol&&(this.isEol=!1,this.line++,this.lineStartPos=this.pos),this.pos>=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,CODE_POINTS.EOF;let e=this.html.charCodeAt(this.pos);return e===CODE_POINTS.CARRIAGE_RETURN?(this.isEol=!0,this.skipNextNewLine=!0,CODE_POINTS.LINE_FEED):e===CODE_POINTS.LINE_FEED&&(this.isEol=!0,this.skipNextNewLine)?(this.line--,this.skipNextNewLine=!1,this._addGap(),this.advance()):(this.skipNextNewLine=!1,isSurrogate(e)&&(e=this._processSurrogate(e)),null===this.handler.onParseError||e>31&&e<127||e===CODE_POINTS.LINE_FEED||e===CODE_POINTS.CARRIAGE_RETURN||e>159&&e<64976||this._checkForProblematicCharacters(e),e)}_checkForProblematicCharacters(e){isControlCodePoint(e)?this._err(ERR.controlCharacterInInputStream):isUndefinedCodePoint(e)&&this._err(ERR.noncharacterInInputStream)}retreat(e){for(this.pos-=e;this.pos<this.lastGapPos;)this.lastGapPos=this.gapStack.pop(),this.pos--;this.isEol=!1}};function getTokenAttr(e,t){for(let n=e.attrs.length-1;n>=0;n--)if(e.attrs[n].name===t)return e.attrs[n].value;return null}(TokenType2=TokenType||(TokenType={}))[TokenType2.CHARACTER=0]="CHARACTER",TokenType2[TokenType2.NULL_CHARACTER=1]="NULL_CHARACTER",TokenType2[TokenType2.WHITESPACE_CHARACTER=2]="WHITESPACE_CHARACTER",TokenType2[TokenType2.START_TAG=3]="START_TAG",TokenType2[TokenType2.END_TAG=4]="END_TAG",TokenType2[TokenType2.COMMENT=5]="COMMENT",TokenType2[TokenType2.DOCTYPE=6]="DOCTYPE",TokenType2[TokenType2.EOF=7]="EOF",TokenType2[TokenType2.HIBERNATION=8]="HIBERNATION";var CharCodes,CharCodes2,BinTrieFlags,BinTrieFlags2,EntityDecoderState,EntityDecoderState2,DecodingMode,DecodingMode2,htmlDecodeTree=new Uint16Array('ᵁ<Õıʊҝջאٵ۞ޢߖࠏ੊ઑඡ๭༉༦჊ረዡᐕᒝᓃᓟᔥ\0\0\0\0\0\0ᕫᛍᦍᰒᷝ὾⁠↰⊍⏀⏻⑂⠤⤒ⴈ⹈⿎〖㊺㘹㞬㣾㨨㩱㫠㬮ࠀEMabcfglmnoprstu\\bfms„‹•˜¦³¹ÈÏlig耻Æ䃆P耻&䀦cute耻Á䃁reve;䄂Āiyx}rc耻Â䃂;䐐r;쀀𝔄rave耻À䃀pha;䎑acr;䄀d;橓Āgp¡on;䄄f;쀀𝔸plyFunction;恡ing耻Å䃅Ācs¾Ãr;쀀𝒜ign;扔ilde耻Ã䃃ml耻Ä䃄ЀaceforsuåûþėĜĢħĪĀcrêòkslash;或Ŷöø;櫧ed;挆y;䐑ƀcrtąċĔause;戵noullis;愬a;䎒r;쀀𝔅pf;쀀𝔹eve;䋘còēmpeq;扎܀HOacdefhilorsuōőŖƀƞƢƵƷƺǜȕɳɸɾcy;䐧PY耻©䂩ƀcpyŝŢźute;䄆Ā;iŧŨ拒talDifferentialD;慅leys;愭ȀaeioƉƎƔƘron;䄌dil耻Ç䃇rc;䄈nint;戰ot;䄊ĀdnƧƭilla;䂸terDot;䂷òſi;䎧rcleȀDMPTLJNjǑǖot;抙inus;抖lus;投imes;抗oĀcsǢǸkwiseContourIntegral;戲eCurlyĀDQȃȏoubleQuote;思uote;怙ȀlnpuȞȨɇɕonĀ;eȥȦ户;橴ƀgitȯȶȺruent;扡nt;戯ourIntegral;戮ĀfrɌɎ;愂oduct;成nterClockwiseContourIntegral;戳oss;樯cr;쀀𝒞pĀ;Cʄʅ拓ap;才րDJSZacefiosʠʬʰʴʸˋ˗ˡ˦̳ҍĀ;oŹʥtrahd;椑cy;䐂cy;䐅cy;䐏ƀgrsʿ˄ˇger;怡r;憡hv;櫤Āayː˕ron;䄎;䐔lĀ;t˝˞戇a;䎔r;쀀𝔇Āaf˫̧Ācm˰̢riticalȀADGT̖̜̀̆cute;䂴oŴ̋̍;䋙bleAcute;䋝rave;䁠ilde;䋜ond;拄ferentialD;慆Ѱ̽\0\0\0͔͂\0Ѕf;쀀𝔻ƀ;DE͈͉͍䂨ot;惜qual;扐blèCDLRUVͣͲ΂ϏϢϸontourIntegraìȹoɴ͹\0\0ͻ»͉nArrow;懓Āeo·ΤftƀARTΐΖΡrrow;懐ightArrow;懔eåˊngĀLRΫτeftĀARγιrrow;柸ightArrow;柺ightArrow;柹ightĀATϘϞrrow;懒ee;抨pɁϩ\0\0ϯrrow;懑ownArrow;懕erticalBar;戥ǹABLRTaВЪаўѿͼrrowƀ;BUНОТ憓ar;椓pArrow;懵reve;䌑eft˒к\0ц\0ѐightVector;楐eeVector;楞ectorĀ;Bљњ憽ar;楖ightǔѧ\0ѱeeVector;楟ectorĀ;BѺѻ懁ar;楗eeĀ;A҆҇护rrow;憧ĀctҒҗr;쀀𝒟rok;䄐ࠀNTacdfglmopqstuxҽӀӄӋӞӢӧӮӵԡԯԶՒ՝ՠեG;䅊H耻Ð䃐cute耻É䃉ƀaiyӒӗӜron;䄚rc耻Ê䃊;䐭ot;䄖r;쀀𝔈rave耻È䃈ement;戈ĀapӺӾcr;䄒tyɓԆ\0\0ԒmallSquare;旻erySmallSquare;斫ĀgpԦԪon;䄘f;쀀𝔼silon;䎕uĀaiԼՉlĀ;TՂՃ橵ilde;扂librium;懌Āci՗՚r;愰m;橳a;䎗ml耻Ë䃋Āipժկsts;戃onentialE;慇ʀcfiosօֈ֍ֲ׌y;䐤r;쀀𝔉lledɓ֗\0\0֣mallSquare;旼erySmallSquare;斪Ͱֺ\0ֿ\0\0ׄf;쀀𝔽All;戀riertrf;愱cò׋؀JTabcdfgorstר׬ׯ׺؀ؒؖ؛؝أ٬ٲcy;䐃耻>䀾mmaĀ;d׷׸䎓;䏜reve;䄞ƀeiy؇،ؐdil;䄢rc;䄜;䐓ot;䄠r;쀀𝔊;拙pf;쀀𝔾eater̀EFGLSTصلَٖٛ٦qualĀ;Lؾؿ扥ess;招ullEqual;执reater;檢ess;扷lantEqual;橾ilde;扳cr;쀀𝒢;扫ЀAacfiosuڅڋږڛڞڪھۊRDcy;䐪Āctڐڔek;䋇;䁞irc;䄤r;愌lbertSpace;愋ǰگ\0ڲf;愍izontalLine;攀Āctۃۅòکrok;䄦mpńېۘownHumðįqual;扏܀EJOacdfgmnostuۺ۾܃܇܎ܚܞܡܨ݄ݸދޏޕcy;䐕lig;䄲cy;䐁cute耻Í䃍Āiyܓܘrc耻Î䃎;䐘ot;䄰r;愑rave耻Ì䃌ƀ;apܠܯܿĀcgܴܷr;䄪inaryI;慈lieóϝǴ݉\0ݢĀ;eݍݎ戬Āgrݓݘral;戫section;拂isibleĀCTݬݲomma;恣imes;恢ƀgptݿރވon;䄮f;쀀𝕀a;䎙cr;愐ilde;䄨ǫޚ\0ޞcy;䐆l耻Ï䃏ʀcfosuެ޷޼߂ߐĀiyޱ޵rc;䄴;䐙r;쀀𝔍pf;쀀𝕁ǣ߇\0ߌr;쀀𝒥rcy;䐈kcy;䐄΀HJacfosߤߨ߽߬߱ࠂࠈcy;䐥cy;䐌ppa;䎚Āey߶߻dil;䄶;䐚r;쀀𝔎pf;쀀𝕂cr;쀀𝒦րJTaceflmostࠥࠩࠬࡐࡣ঳সে্਷ੇcy;䐉耻<䀼ʀcmnpr࠷࠼ࡁࡄࡍute;䄹bda;䎛g;柪lacetrf;愒r;憞ƀaeyࡗ࡜ࡡron;䄽dil;䄻;䐛Āfsࡨ॰tԀACDFRTUVarࡾࢩࢱࣦ࣠ࣼयज़ΐ४Ānrࢃ࢏gleBracket;柨rowƀ;BR࢙࢚࢞憐ar;懤ightArrow;懆eiling;挈oǵࢷ\0ࣃbleBracket;柦nǔࣈ\0࣒eeVector;楡ectorĀ;Bࣛࣜ懃ar;楙loor;挊ightĀAV࣯ࣵrrow;憔ector;楎Āerँगeƀ;AVउऊऐ抣rrow;憤ector;楚iangleƀ;BEतथऩ抲ar;槏qual;抴pƀDTVषूौownVector;楑eeVector;楠ectorĀ;Bॖॗ憿ar;楘ectorĀ;B॥०憼ar;楒ightáΜs̀EFGLSTॾঋকঝঢভqualGreater;拚ullEqual;扦reater;扶ess;檡lantEqual;橽ilde;扲r;쀀𝔏Ā;eঽা拘ftarrow;懚idot;䄿ƀnpw৔ਖਛgȀLRlr৞৷ਂਐeftĀAR০৬rrow;柵ightArrow;柷ightArrow;柶eftĀarγਊightáοightáϊf;쀀𝕃erĀLRਢਬeftArrow;憙ightArrow;憘ƀchtਾੀੂòࡌ;憰rok;䅁;扪Ѐacefiosuਗ਼੝੠੷੼અઋ઎p;椅y;䐜Ādl੥੯iumSpace;恟lintrf;愳r;쀀𝔐nusPlus;戓pf;쀀𝕄cò੶;䎜ҀJacefostuણધભીଔଙඑ඗ඞcy;䐊cute;䅃ƀaey઴હાron;䅇dil;䅅;䐝ƀgswે૰଎ativeƀMTV૓૟૨ediumSpace;怋hiĀcn૦૘ë૙eryThiî૙tedĀGL૸ଆreaterGreateòٳessLesóੈLine;䀊r;쀀𝔑ȀBnptଢନଷ଺reak;恠BreakingSpace;䂠f;愕ڀ;CDEGHLNPRSTV୕ୖ୪୼஡௫ఄ౞಄ದ೘ൡඅ櫬Āou୛୤ngruent;扢pCap;扭oubleVerticalBar;戦ƀlqxஃஊ஛ement;戉ualĀ;Tஒஓ扠ilde;쀀≂̸ists;戄reater΀;EFGLSTஶஷ஽௉௓௘௥扯qual;扱ullEqual;쀀≧̸reater;쀀≫̸ess;批lantEqual;쀀⩾̸ilde;扵umpń௲௽ownHump;쀀≎̸qual;쀀≏̸eĀfsఊధtTriangleƀ;BEచఛడ拪ar;쀀⧏̸qual;括s̀;EGLSTవశ఼ౄోౘ扮qual;扰reater;扸ess;쀀≪̸lantEqual;쀀⩽̸ilde;扴estedĀGL౨౹reaterGreater;쀀⪢̸essLess;쀀⪡̸recedesƀ;ESಒಓಛ技qual;쀀⪯̸lantEqual;拠ĀeiಫಹverseElement;戌ghtTriangleƀ;BEೋೌ೒拫ar;쀀⧐̸qual;拭ĀquೝഌuareSuĀbp೨೹setĀ;E೰ೳ쀀⊏̸qual;拢ersetĀ;Eഃആ쀀⊐̸qual;拣ƀbcpഓതൎsetĀ;Eഛഞ쀀⊂⃒qual;抈ceedsȀ;ESTലള഻െ抁qual;쀀⪰̸lantEqual;拡ilde;쀀≿̸ersetĀ;E൘൛쀀⊃⃒qual;抉ildeȀ;EFT൮൯൵ൿ扁qual;扄ullEqual;扇ilde;扉erticalBar;戤cr;쀀𝒩ilde耻Ñ䃑;䎝܀Eacdfgmoprstuvලෂ෉෕ෛ෠෧෼ขภยา฿ไlig;䅒cute耻Ó䃓Āiy෎ීrc耻Ô䃔;䐞blac;䅐r;쀀𝔒rave耻Ò䃒ƀaei෮ෲ෶cr;䅌ga;䎩cron;䎟pf;쀀𝕆enCurlyĀDQฎบoubleQuote;怜uote;怘;橔Āclวฬr;쀀𝒪ash耻Ø䃘iŬื฼de耻Õ䃕es;樷ml耻Ö䃖erĀBP๋๠Āar๐๓r;怾acĀek๚๜;揞et;掴arenthesis;揜Ҁacfhilors๿ງຊຏຒດຝະ໼rtialD;戂y;䐟r;쀀𝔓i;䎦;䎠usMinus;䂱Āipຢອncareplanåڝf;愙Ȁ;eio຺ູ໠໤檻cedesȀ;EST່້໏໚扺qual;檯lantEqual;扼ilde;找me;怳Ādp໩໮uct;戏ortionĀ;aȥ໹l;戝Āci༁༆r;쀀𝒫;䎨ȀUfos༑༖༛༟OT耻"䀢r;쀀𝔔pf;愚cr;쀀𝒬؀BEacefhiorsu༾གྷཇའཱིྦྷྪྭ႖ႩႴႾarr;椐G耻®䂮ƀcnrཎནབute;䅔g;柫rĀ;tཛྷཝ憠l;椖ƀaeyཧཬཱron;䅘dil;䅖;䐠Ā;vླྀཹ愜erseĀEUྂྙĀlq྇ྎement;戋uilibrium;懋pEquilibrium;楯r»ཹo;䎡ghtЀACDFTUVa࿁࿫࿳ဢဨၛႇϘĀnr࿆࿒gleBracket;柩rowƀ;BL࿜࿝࿡憒ar;懥eftArrow;懄eiling;按oǵ࿹\0စbleBracket;柧nǔည\0နeeVector;楝ectorĀ;Bဝသ懂ar;楕loor;挋Āerိ၃eƀ;AVဵံြ抢rrow;憦ector;楛iangleƀ;BEၐၑၕ抳ar;槐qual;抵pƀDTVၣၮၸownVector;楏eeVector;楜ectorĀ;Bႂႃ憾ar;楔ectorĀ;B႑႒懀ar;楓Āpuႛ႞f;愝ndImplies;楰ightarrow;懛ĀchႹႼr;愛;憱leDelayed;槴ڀHOacfhimoqstuფჱჷჽᄙᄞᅑᅖᅡᅧᆵᆻᆿĀCcჩხHcy;䐩y;䐨FTcy;䐬cute;䅚ʀ;aeiyᄈᄉᄎᄓᄗ檼ron;䅠dil;䅞rc;䅜;䐡r;쀀𝔖ortȀDLRUᄪᄴᄾᅉownArrow»ОeftArrow»࢚ightArrow»࿝pArrow;憑gma;䎣allCircle;战pf;쀀𝕊ɲᅭ\0\0ᅰt;戚areȀ;ISUᅻᅼᆉᆯ斡ntersection;抓uĀbpᆏᆞsetĀ;Eᆗᆘ抏qual;抑ersetĀ;Eᆨᆩ抐qual;抒nion;抔cr;쀀𝒮ar;拆ȀbcmpᇈᇛሉላĀ;sᇍᇎ拐etĀ;Eᇍᇕqual;抆ĀchᇠህeedsȀ;ESTᇭᇮᇴᇿ扻qual;檰lantEqual;扽ilde;承Tháྌ;我ƀ;esሒሓሣ拑rsetĀ;Eሜም抃qual;抇et»ሓրHRSacfhiorsሾቄ቉ቕ቞ቱቶኟዂወዑORN耻Þ䃞ADE;愢ĀHc቎ቒcy;䐋y;䐦Ābuቚቜ;䀉;䎤ƀaeyብቪቯron;䅤dil;䅢;䐢r;쀀𝔗Āeiቻ኉Dzኀ\0ኇefore;戴a;䎘Ācn኎ኘkSpace;쀀  Space;怉ldeȀ;EFTካኬኲኼ戼qual;扃ullEqual;扅ilde;扈pf;쀀𝕋ipleDot;惛Āctዖዛr;쀀𝒯rok;䅦ૡዷጎጚጦ\0ጬጱ\0\0\0\0\0ጸጽ፷ᎅ\0᏿ᐄᐊᐐĀcrዻጁute耻Ú䃚rĀ;oጇገ憟cir;楉rǣጓ\0጖y;䐎ve;䅬Āiyጞጣrc耻Û䃛;䐣blac;䅰r;쀀𝔘rave耻Ù䃙acr;䅪Ādiፁ፩erĀBPፈ፝Āarፍፐr;䁟acĀekፗፙ;揟et;掵arenthesis;揝onĀ;P፰፱拃lus;抎Āgp፻፿on;䅲f;쀀𝕌ЀADETadps᎕ᎮᎸᏄϨᏒᏗᏳrrowƀ;BDᅐᎠᎤar;椒ownArrow;懅ownArrow;憕quilibrium;楮eeĀ;AᏋᏌ报rrow;憥ownáϳerĀLRᏞᏨeftArrow;憖ightArrow;憗iĀ;lᏹᏺ䏒on;䎥ing;䅮cr;쀀𝒰ilde;䅨ml耻Ü䃜ҀDbcdefosvᐧᐬᐰᐳᐾᒅᒊᒐᒖash;披ar;櫫y;䐒ashĀ;lᐻᐼ抩;櫦Āerᑃᑅ;拁ƀbtyᑌᑐᑺar;怖Ā;iᑏᑕcalȀBLSTᑡᑥᑪᑴar;戣ine;䁼eparator;杘ilde;所ThinSpace;怊r;쀀𝔙pf;쀀𝕍cr;쀀𝒱dash;抪ʀcefosᒧᒬᒱᒶᒼirc;䅴dge;拀r;쀀𝔚pf;쀀𝕎cr;쀀𝒲Ȁfiosᓋᓐᓒᓘr;쀀𝔛;䎞pf;쀀𝕏cr;쀀𝒳ҀAIUacfosuᓱᓵᓹᓽᔄᔏᔔᔚᔠcy;䐯cy;䐇cy;䐮cute耻Ý䃝Āiyᔉᔍrc;䅶;䐫r;쀀𝔜pf;쀀𝕐cr;쀀𝒴ml;䅸ЀHacdefosᔵᔹᔿᕋᕏᕝᕠᕤcy;䐖cute;䅹Āayᕄᕉron;䅽;䐗ot;䅻Dzᕔ\0ᕛoWidtè૙a;䎖r;愨pf;愤cr;쀀𝒵௡ᖃᖊᖐ\0ᖰᖶᖿ\0\0\0\0ᗆᗛᗫᙟ᙭\0ᚕ᚛ᚲᚹ\0ᚾcute耻á䃡reve;䄃̀;Ediuyᖜᖝᖡᖣᖨᖭ戾;쀀∾̳;房rc耻â䃢te肻´̆;䐰lig耻æ䃦Ā;r²ᖺ;쀀𝔞rave耻à䃠ĀepᗊᗖĀfpᗏᗔsym;愵èᗓha;䎱ĀapᗟcĀclᗤᗧr;䄁g;樿ɤᗰ\0\0ᘊʀ;adsvᗺᗻᗿᘁᘇ戧nd;橕;橜lope;橘;橚΀;elmrszᘘᘙᘛᘞᘿᙏᙙ戠;榤e»ᘙsdĀ;aᘥᘦ戡ѡᘰᘲᘴᘶᘸᘺᘼᘾ;榨;榩;榪;榫;榬;榭;榮;榯tĀ;vᙅᙆ戟bĀ;dᙌᙍ抾;榝Āptᙔᙗh;戢»¹arr;捼Āgpᙣᙧon;䄅f;쀀𝕒΀;Eaeiop዁ᙻᙽᚂᚄᚇᚊ;橰cir;橯;扊d;手s;䀧roxĀ;e዁ᚒñᚃing耻å䃥ƀctyᚡᚦᚨr;쀀𝒶;䀪mpĀ;e዁ᚯñʈilde耻ã䃣ml耻ä䃤Āciᛂᛈoninôɲnt;樑ࠀNabcdefiklnoprsu᛭ᛱᜰ᜼ᝃᝈ᝸᝽០៦ᠹᡐᜍ᤽᥈ᥰot;櫭Ācrᛶ᜞kȀcepsᜀᜅᜍᜓong;扌psilon;䏶rime;怵imĀ;e᜚᜛戽q;拍Ŷᜢᜦee;抽edĀ;gᜬᜭ挅e»ᜭrkĀ;t፜᜷brk;掶Āoyᜁᝁ;䐱quo;怞ʀcmprtᝓ᝛ᝡᝤᝨausĀ;eĊĉptyv;榰séᜌnoõēƀahwᝯ᝱ᝳ;䎲;愶een;扬r;쀀𝔟g΀costuvwឍឝឳេ៕៛៞ƀaiuបពរðݠrc;旯p»፱ƀdptឤឨឭot;樀lus;樁imes;樂ɱឹ\0\0ើcup;樆ar;昅riangleĀdu៍្own;施p;斳plus;樄eåᑄåᒭarow;植ƀako៭ᠦᠵĀcn៲ᠣkƀlst៺֫᠂ozenge;槫riangleȀ;dlr᠒᠓᠘᠝斴own;斾eft;旂ight;斸k;搣Ʊᠫ\0ᠳƲᠯ\0ᠱ;斒;斑4;斓ck;斈ĀeoᠾᡍĀ;qᡃᡆ쀀=⃥uiv;쀀≡⃥t;挐Ȁptwxᡙᡞᡧᡬf;쀀𝕓Ā;tᏋᡣom»Ꮜtie;拈؀DHUVbdhmptuvᢅᢖᢪᢻᣗᣛᣬ᣿ᤅᤊᤐᤡȀLRlrᢎᢐᢒᢔ;敗;敔;敖;敓ʀ;DUduᢡᢢᢤᢦᢨ敐;敦;敩;敤;敧ȀLRlrᢳᢵᢷᢹ;敝;敚;敜;教΀;HLRhlrᣊᣋᣍᣏᣑᣓᣕ救;敬;散;敠;敫;敢;敟ox;槉ȀLRlrᣤᣦᣨᣪ;敕;敒;攐;攌ʀ;DUduڽ᣷᣹᣻᣽;敥;敨;攬;攴inus;抟lus;択imes;抠ȀLRlrᤙᤛᤝ᤟;敛;敘;攘;攔΀;HLRhlrᤰᤱᤳᤵᤷ᤻᤹攂;敪;敡;敞;攼;攤;攜Āevģ᥂bar耻¦䂦Ȁceioᥑᥖᥚᥠr;쀀𝒷mi;恏mĀ;e᜚᜜lƀ;bhᥨᥩᥫ䁜;槅sub;柈Ŭᥴ᥾lĀ;e᥹᥺怢t»᥺pƀ;Eeįᦅᦇ;檮Ā;qۜۛೡᦧ\0᧨ᨑᨕᨲ\0ᨷᩐ\0\0᪴\0\0᫁\0\0ᬡᬮ᭍᭒\0᯽\0ᰌƀcpr᦭ᦲ᧝ute;䄇̀;abcdsᦿᧀᧄ᧊᧕᧙戩nd;橄rcup;橉Āau᧏᧒p;橋p;橇ot;橀;쀀∩︀Āeo᧢᧥t;恁îړȀaeiu᧰᧻ᨁᨅǰ᧵\0᧸s;橍on;䄍dil耻ç䃧rc;䄉psĀ;sᨌᨍ橌m;橐ot;䄋ƀdmnᨛᨠᨦil肻¸ƭptyv;榲t脀¢;eᨭᨮ䂢räƲr;쀀𝔠ƀceiᨽᩀᩍy;䑇ckĀ;mᩇᩈ朓ark»ᩈ;䏇r΀;Ecefms᩟᩠ᩢᩫ᪤᪪᪮旋;槃ƀ;elᩩᩪᩭ䋆q;扗eɡᩴ\0\0᪈rrowĀlr᩼᪁eft;憺ight;憻ʀRSacd᪒᪔᪖᪚᪟»ཇ;擈st;抛irc;抚ash;抝nint;樐id;櫯cir;槂ubsĀ;u᪻᪼晣it»᪼ˬ᫇᫔᫺\0ᬊonĀ;eᫍᫎ䀺Ā;qÇÆɭ᫙\0\0᫢aĀ;t᫞᫟䀬;䁀ƀ;fl᫨᫩᫫戁îᅠeĀmx᫱᫶ent»᫩eóɍǧ᫾\0ᬇĀ;dኻᬂot;橭nôɆƀfryᬐᬔᬗ;쀀𝕔oäɔ脀©;sŕᬝr;愗Āaoᬥᬩrr;憵ss;朗Ācuᬲᬷr;쀀𝒸Ābpᬼ᭄Ā;eᭁᭂ櫏;櫑Ā;eᭉᭊ櫐;櫒dot;拯΀delprvw᭠᭬᭷ᮂᮬᯔ᯹arrĀlr᭨᭪;椸;椵ɰ᭲\0\0᭵r;拞c;拟arrĀ;p᭿ᮀ憶;椽̀;bcdosᮏᮐᮖᮡᮥᮨ截rcap;橈Āauᮛᮞp;橆p;橊ot;抍r;橅;쀀∪︀Ȁalrv᮵ᮿᯞᯣrrĀ;mᮼᮽ憷;椼yƀevwᯇᯔᯘqɰᯎ\0\0ᯒreã᭳uã᭵ee;拎edge;拏en耻¤䂤earrowĀlrᯮ᯳eft»ᮀight»ᮽeäᯝĀciᰁᰇoninôǷnt;戱lcty;挭ঀAHabcdefhijlorstuwz᰸᰻᰿ᱝᱩᱵᲊᲞᲬᲷ᳻᳿ᴍᵻᶑᶫᶻ᷆᷍rò΁ar;楥Ȁglrs᱈ᱍ᱒᱔ger;怠eth;愸òᄳhĀ;vᱚᱛ怐»ऊūᱡᱧarow;椏aã̕Āayᱮᱳron;䄏;䐴ƀ;ao̲ᱼᲄĀgrʿᲁr;懊tseq;橷ƀglmᲑᲔᲘ耻°䂰ta;䎴ptyv;榱ĀirᲣᲨsht;楿;쀀𝔡arĀlrᲳᲵ»ࣜ»သʀaegsv᳂͸᳖᳜᳠mƀ;oș᳊᳔ndĀ;ș᳑uit;晦amma;䏝in;拲ƀ;io᳧᳨᳸䃷de脀÷;o᳧ᳰntimes;拇nø᳷cy;䑒cɯᴆ\0\0ᴊrn;挞op;挍ʀlptuwᴘᴝᴢᵉᵕlar;䀤f;쀀𝕕ʀ;emps̋ᴭᴷᴽᵂqĀ;d͒ᴳot;扑inus;戸lus;戔quare;抡blebarwedgåúnƀadhᄮᵝᵧownarrowóᲃarpoonĀlrᵲᵶefôᲴighôᲶŢᵿᶅkaro÷གɯᶊ\0\0ᶎrn;挟op;挌ƀcotᶘᶣᶦĀryᶝᶡ;쀀𝒹;䑕l;槶rok;䄑Ādrᶰᶴot;拱iĀ;fᶺ᠖斿Āah᷀᷃ròЩaòྦangle;榦Āci᷒ᷕy;䑟grarr;柿ऀDacdefglmnopqrstuxḁḉḙḸոḼṉṡṾấắẽỡἪἷὄ὎὚ĀDoḆᴴoôᲉĀcsḎḔute耻é䃩ter;橮ȀaioyḢḧḱḶron;䄛rĀ;cḭḮ扖耻ê䃪lon;払;䑍ot;䄗ĀDrṁṅot;扒;쀀𝔢ƀ;rsṐṑṗ檚ave耻è䃨Ā;dṜṝ檖ot;檘Ȁ;ilsṪṫṲṴ檙nters;揧;愓Ā;dṹṺ檕ot;檗ƀapsẅẉẗcr;䄓tyƀ;svẒẓẕ戅et»ẓpĀ1;ẝẤijạả;怄;怅怃ĀgsẪẬ;䅋p;怂ĀgpẴẸon;䄙f;쀀𝕖ƀalsỄỎỒrĀ;sỊị拕l;槣us;橱iƀ;lvỚớở䎵on»ớ;䏵ȀcsuvỪỳἋἣĀioữḱrc»Ḯɩỹ\0\0ỻíՈantĀglἂἆtr»ṝess»Ṻƀaeiἒ἖Ἒls;䀽st;扟vĀ;DȵἠD;橸parsl;槥ĀDaἯἳot;打rr;楱ƀcdiἾὁỸr;愯oô͒ĀahὉὋ;䎷耻ð䃰Āmrὓὗl耻ë䃫o;悬ƀcipὡὤὧl;䀡sôծĀeoὬὴctatioîՙnentialåչৡᾒ\0ᾞ\0ᾡᾧ\0\0ῆῌ\0ΐ\0ῦῪ \0 ⁚llingdotseñṄy;䑄male;晀ƀilrᾭᾳ῁lig;耀ffiɩᾹ\0\0᾽g;耀ffig;耀ffl;쀀𝔣lig;耀filig;쀀fjƀaltῙ῜ῡt;晭ig;耀flns;斱of;䆒ǰ΅\0ῳf;쀀𝕗ĀakֿῷĀ;vῼ´拔;櫙artint;樍Āao‌⁕Ācs‑⁒ႉ‸⁅⁈\0⁐β•‥‧‪‬\0‮耻½䂽;慓耻¼䂼;慕;慙;慛Ƴ‴\0‶;慔;慖ʴ‾⁁\0\0⁃耻¾䂾;慗;慜5;慘ƶ⁌\0⁎;慚;慝8;慞l;恄wn;挢cr;쀀𝒻ࢀEabcdefgijlnorstv₂₉₟₥₰₴⃰⃵⃺⃿℃ℒℸ̗ℾ⅒↞Ā;lٍ₇;檌ƀcmpₐₕ₝ute;䇵maĀ;dₜ᳚䎳;檆reve;䄟Āiy₪₮rc;䄝;䐳ot;䄡Ȁ;lqsؾق₽⃉ƀ;qsؾٌ⃄lanô٥Ȁ;cdl٥⃒⃥⃕c;檩otĀ;o⃜⃝檀Ā;l⃢⃣檂;檄Ā;e⃪⃭쀀⋛︀s;檔r;쀀𝔤Ā;gٳ؛mel;愷cy;䑓Ȁ;Eajٚℌℎℐ;檒;檥;檤ȀEaesℛℝ℩ℴ;扩pĀ;p℣ℤ檊rox»ℤĀ;q℮ℯ檈Ā;q℮ℛim;拧pf;쀀𝕘Āci⅃ⅆr;愊mƀ;el٫ⅎ⅐;檎;檐茀>;cdlqr׮ⅠⅪⅮⅳⅹĀciⅥⅧ;檧r;橺ot;拗Par;榕uest;橼ʀadelsↄⅪ←ٖ↛ǰ↉\0↎proø₞r;楸qĀlqؿ↖lesó₈ií٫Āen↣↭rtneqq;쀀≩︀Å↪ԀAabcefkosy⇄⇇⇱⇵⇺∘∝∯≨≽ròΠȀilmr⇐⇔⇗⇛rsðᒄf»․ilôکĀdr⇠⇤cy;䑊ƀ;cwࣴ⇫⇯ir;楈;憭ar;意irc;䄥ƀalr∁∎∓rtsĀ;u∉∊晥it»∊lip;怦con;抹r;쀀𝔥sĀew∣∩arow;椥arow;椦ʀamopr∺∾≃≞≣rr;懿tht;戻kĀlr≉≓eftarrow;憩ightarrow;憪f;쀀𝕙bar;怕ƀclt≯≴≸r;쀀𝒽asè⇴rok;䄧Ābp⊂⊇ull;恃hen»ᱛૡ⊣\0⊪\0⊸⋅⋎\0⋕⋳\0\0⋸⌢⍧⍢⍿\0⎆⎪⎴cute耻í䃭ƀ;iyݱ⊰⊵rc耻î䃮;䐸Ācx⊼⊿y;䐵cl耻¡䂡ĀfrΟ⋉;쀀𝔦rave耻ì䃬Ȁ;inoܾ⋝⋩⋮Āin⋢⋦nt;樌t;戭fin;槜ta;愩lig;䄳ƀaop⋾⌚⌝ƀcgt⌅⌈⌗r;䄫ƀelpܟ⌏⌓inåގarôܠh;䄱f;抷ed;䆵ʀ;cfotӴ⌬⌱⌽⍁are;愅inĀ;t⌸⌹戞ie;槝doô⌙ʀ;celpݗ⍌⍐⍛⍡al;抺Āgr⍕⍙eróᕣã⍍arhk;樗rod;樼Ȁcgpt⍯⍲⍶⍻y;䑑on;䄯f;쀀𝕚a;䎹uest耻¿䂿Āci⎊⎏r;쀀𝒾nʀ;EdsvӴ⎛⎝⎡ӳ;拹ot;拵Ā;v⎦⎧拴;拳Ā;iݷ⎮lde;䄩ǫ⎸\0⎼cy;䑖l耻ï䃯̀cfmosu⏌⏗⏜⏡⏧⏵Āiy⏑⏕rc;䄵;䐹r;쀀𝔧ath;䈷pf;쀀𝕛ǣ⏬\0⏱r;쀀𝒿rcy;䑘kcy;䑔Ѐacfghjos␋␖␢␧␭␱␵␻ppaĀ;v␓␔䎺;䏰Āey␛␠dil;䄷;䐺r;쀀𝔨reen;䄸cy;䑅cy;䑜pf;쀀𝕜cr;쀀𝓀஀ABEHabcdefghjlmnoprstuv⑰⒁⒆⒍⒑┎┽╚▀♎♞♥♹♽⚚⚲⛘❝❨➋⟀⠁⠒ƀart⑷⑺⑼rò৆òΕail;椛arr;椎Ā;gঔ⒋;檋ar;楢ॣ⒥\0⒪\0⒱\0\0\0\0\0⒵Ⓔ\0ⓆⓈⓍ\0⓹ute;䄺mptyv;榴raîࡌbda;䎻gƀ;dlࢎⓁⓃ;榑åࢎ;檅uo耻«䂫rЀ;bfhlpst࢙ⓞⓦⓩ⓫⓮⓱⓵Ā;f࢝ⓣs;椟s;椝ë≒p;憫l;椹im;楳l;憢ƀ;ae⓿─┄檫il;椙Ā;s┉┊檭;쀀⪭︀ƀabr┕┙┝rr;椌rk;杲Āak┢┬cĀek┨┪;䁻;䁛Āes┱┳;榋lĀdu┹┻;榏;榍Ȁaeuy╆╋╖╘ron;䄾Ādi═╔il;䄼ìࢰâ┩;䐻Ȁcqrs╣╦╭╽a;椶uoĀ;rนᝆĀdu╲╷har;楧shar;楋h;憲ʀ;fgqs▋▌উ◳◿扤tʀahlrt▘▤▷◂◨rrowĀ;t࢙□aé⓶arpoonĀdu▯▴own»њp»०eftarrows;懇ightƀahs◍◖◞rrowĀ;sࣴࢧarpoonó྘quigarro÷⇰hreetimes;拋ƀ;qs▋ও◺lanôবʀ;cdgsব☊☍☝☨c;檨otĀ;o☔☕橿Ā;r☚☛檁;檃Ā;e☢☥쀀⋚︀s;檓ʀadegs☳☹☽♉♋pproøⓆot;拖qĀgq♃♅ôউgtò⒌ôছiíলƀilr♕࣡♚sht;楼;쀀𝔩Ā;Eজ♣;檑š♩♶rĀdu▲♮Ā;l॥♳;楪lk;斄cy;䑙ʀ;achtੈ⚈⚋⚑⚖rò◁orneòᴈard;楫ri;旺Āio⚟⚤dot;䅀ustĀ;a⚬⚭掰che»⚭ȀEaes⚻⚽⛉⛔;扨pĀ;p⛃⛄檉rox»⛄Ā;q⛎⛏檇Ā;q⛎⚻im;拦Ѐabnoptwz⛩⛴⛷✚✯❁❇❐Ānr⛮⛱g;柬r;懽rëࣁgƀlmr⛿✍✔eftĀar০✇ightá৲apsto;柼ightá৽parrowĀlr✥✩efô⓭ight;憬ƀafl✶✹✽r;榅;쀀𝕝us;樭imes;樴š❋❏st;戗áፎƀ;ef❗❘᠀旊nge»❘arĀ;l❤❥䀨t;榓ʀachmt❳❶❼➅➇ròࢨorneòᶌarĀ;d྘➃;業;怎ri;抿̀achiqt➘➝ੀ➢➮➻quo;怹r;쀀𝓁mƀ;egল➪➬;檍;檏Ābu┪➳oĀ;rฟ➹;怚rok;䅂萀<;cdhilqrࠫ⟒☹⟜⟠⟥⟪⟰Āci⟗⟙;檦r;橹reå◲mes;拉arr;楶uest;橻ĀPi⟵⟹ar;榖ƀ;ef⠀भ᠛旃rĀdu⠇⠍shar;楊har;楦Āen⠗⠡rtneqq;쀀≨︀Å⠞܀Dacdefhilnopsu⡀⡅⢂⢎⢓⢠⢥⢨⣚⣢⣤ઃ⣳⤂Dot;戺Ȁclpr⡎⡒⡣⡽r耻¯䂯Āet⡗⡙;時Ā;e⡞⡟朠se»⡟Ā;sျ⡨toȀ;dluျ⡳⡷⡻owîҌefôएðᏑker;斮Āoy⢇⢌mma;権;䐼ash;怔asuredangle»ᘦr;쀀𝔪o;愧ƀcdn⢯⢴⣉ro耻µ䂵Ȁ;acdᑤ⢽⣀⣄sôᚧir;櫰ot肻·Ƶusƀ;bd⣒ᤃ⣓戒Ā;uᴼ⣘;横ţ⣞⣡p;櫛ò−ðઁĀdp⣩⣮els;抧f;쀀𝕞Āct⣸⣽r;쀀𝓂pos»ᖝƀ;lm⤉⤊⤍䎼timap;抸ఀGLRVabcdefghijlmoprstuvw⥂⥓⥾⦉⦘⧚⧩⨕⨚⩘⩝⪃⪕⪤⪨⬄⬇⭄⭿⮮ⰴⱧⱼ⳩Āgt⥇⥋;쀀⋙̸Ā;v⥐௏쀀≫⃒ƀelt⥚⥲⥶ftĀar⥡⥧rrow;懍ightarrow;懎;쀀⋘̸Ā;v⥻ే쀀≪⃒ightarrow;懏ĀDd⦎⦓ash;抯ash;抮ʀbcnpt⦣⦧⦬⦱⧌la»˞ute;䅄g;쀀∠⃒ʀ;Eiop඄⦼⧀⧅⧈;쀀⩰̸d;쀀≋̸s;䅉roø඄urĀ;a⧓⧔普lĀ;s⧓ସdz⧟\0⧣p肻 ଷmpĀ;e௹ఀʀaeouy⧴⧾⨃⨐⨓ǰ⧹\0⧻;橃on;䅈dil;䅆ngĀ;dൾ⨊ot;쀀⩭̸p;橂;䐽ash;怓΀;Aadqsxஒ⨩⨭⨻⩁⩅⩐rr;懗rĀhr⨳⨶k;椤Ā;oᏲᏰot;쀀≐̸uiöୣĀei⩊⩎ar;椨í஘istĀ;s஠டr;쀀𝔫ȀEest௅⩦⩹⩼ƀ;qs஼⩭௡ƀ;qs஼௅⩴lanô௢ií௪Ā;rஶ⪁»ஷƀAap⪊⪍⪑rò⥱rr;憮ar;櫲ƀ;svྍ⪜ྌĀ;d⪡⪢拼;拺cy;䑚΀AEadest⪷⪺⪾⫂⫅⫶⫹rò⥦;쀀≦̸rr;憚r;急Ȁ;fqs఻⫎⫣⫯tĀar⫔⫙rro÷⫁ightarro÷⪐ƀ;qs఻⪺⫪lanôౕĀ;sౕ⫴»శiíౝĀ;rవ⫾iĀ;eచథiäඐĀpt⬌⬑f;쀀𝕟膀¬;in⬙⬚⬶䂬nȀ;Edvஉ⬤⬨⬮;쀀⋹̸ot;쀀⋵̸ǡஉ⬳⬵;拷;拶iĀ;vಸ⬼ǡಸ⭁⭃;拾;拽ƀaor⭋⭣⭩rȀ;ast୻⭕⭚⭟lleì୻l;쀀⫽⃥;쀀∂̸lint;樔ƀ;ceಒ⭰⭳uåಥĀ;cಘ⭸Ā;eಒ⭽ñಘȀAait⮈⮋⮝⮧rò⦈rrƀ;cw⮔⮕⮙憛;쀀⤳̸;쀀↝̸ghtarrow»⮕riĀ;eೋೖ΀chimpqu⮽⯍⯙⬄୸⯤⯯Ȁ;cerല⯆ഷ⯉uå൅;쀀𝓃ortɭ⬅\0\0⯖ará⭖mĀ;e൮⯟Ā;q൴൳suĀbp⯫⯭å೸åഋƀbcp⯶ⰑⰙȀ;Ees⯿ⰀഢⰄ抄;쀀⫅̸etĀ;eഛⰋqĀ;qണⰀcĀ;eലⰗñസȀ;EesⰢⰣൟⰧ抅;쀀⫆̸etĀ;e൘ⰮqĀ;qൠⰣȀgilrⰽⰿⱅⱇìௗlde耻ñ䃱çృiangleĀlrⱒⱜeftĀ;eచⱚñదightĀ;eೋⱥñ೗Ā;mⱬⱭ䎽ƀ;esⱴⱵⱹ䀣ro;愖p;怇ҀDHadgilrsⲏⲔⲙⲞⲣⲰⲶⳓⳣash;抭arr;椄p;쀀≍⃒ash;抬ĀetⲨⲬ;쀀≥⃒;쀀>⃒nfin;槞ƀAetⲽⳁⳅrr;椂;쀀≤⃒Ā;rⳊⳍ쀀<⃒ie;쀀⊴⃒ĀAtⳘⳜrr;椃rie;쀀⊵⃒im;쀀∼⃒ƀAan⳰⳴ⴂrr;懖rĀhr⳺⳽k;椣Ā;oᏧᏥear;椧ቓ᪕\0\0\0\0\0\0\0\0\0\0\0\0\0ⴭ\0ⴸⵈⵠⵥ⵲ⶄᬇ\0\0ⶍⶫ\0ⷈⷎ\0ⷜ⸙⸫⸾⹃Ācsⴱ᪗ute耻ó䃳ĀiyⴼⵅrĀ;c᪞ⵂ耻ô䃴;䐾ʀabios᪠ⵒⵗLjⵚlac;䅑v;樸old;榼lig;䅓Ācr⵩⵭ir;榿;쀀𝔬ͯ⵹\0\0⵼\0ⶂn;䋛ave耻ò䃲;槁Ābmⶈ෴ar;榵Ȁacitⶕ⶘ⶥⶨrò᪀Āir⶝ⶠr;榾oss;榻nå๒;槀ƀaeiⶱⶵⶹcr;䅍ga;䏉ƀcdnⷀⷅǍron;䎿;榶pf;쀀𝕠ƀaelⷔ⷗ǒr;榷rp;榹΀;adiosvⷪⷫⷮ⸈⸍⸐⸖戨rò᪆Ȁ;efmⷷⷸ⸂⸅橝rĀ;oⷾⷿ愴f»ⷿ耻ª䂪耻º䂺gof;抶r;橖lope;橗;橛ƀclo⸟⸡⸧ò⸁ash耻ø䃸l;折iŬⸯ⸴de耻õ䃵esĀ;aǛ⸺s;樶ml耻ö䃶bar;挽ૡ⹞\0⹽\0⺀⺝\0⺢⺹\0\0⻋ຜ\0⼓\0\0⼫⾼\0⿈rȀ;astЃ⹧⹲຅脀¶;l⹭⹮䂶leìЃɩ⹸\0\0⹻m;櫳;櫽y;䐿rʀcimpt⺋⺏⺓ᡥ⺗nt;䀥od;䀮il;怰enk;怱r;쀀𝔭ƀimo⺨⺰⺴Ā;v⺭⺮䏆;䏕maô੶ne;明ƀ;tv⺿⻀⻈䏀chfork»´;䏖Āau⻏⻟nĀck⻕⻝kĀ;h⇴⻛;愎ö⇴sҀ;abcdemst⻳⻴ᤈ⻹⻽⼄⼆⼊⼎䀫cir;樣ir;樢Āouᵀ⼂;樥;橲n肻±ຝim;樦wo;樧ƀipu⼙⼠⼥ntint;樕f;쀀𝕡nd耻£䂣Ԁ;Eaceinosu່⼿⽁⽄⽇⾁⾉⾒⽾⾶;檳p;檷uå໙Ā;c໎⽌̀;acens່⽙⽟⽦⽨⽾pproø⽃urlyeñ໙ñ໎ƀaes⽯⽶⽺pprox;檹qq;檵im;拨iíໟmeĀ;s⾈ຮ怲ƀEas⽸⾐⽺ð⽵ƀdfp໬⾙⾯ƀals⾠⾥⾪lar;挮ine;挒urf;挓Ā;t໻⾴ï໻rel;抰Āci⿀⿅r;쀀𝓅;䏈ncsp;怈̀fiopsu⿚⋢⿟⿥⿫⿱r;쀀𝔮pf;쀀𝕢rime;恗cr;쀀𝓆ƀaeo⿸〉〓tĀei⿾々rnionóڰnt;樖stĀ;e【】䀿ñἙô༔઀ABHabcdefhilmnoprstux぀けさすムㄎㄫㅇㅢㅲㆎ㈆㈕㈤㈩㉘㉮㉲㊐㊰㊷ƀartぇおがròႳòϝail;検aròᱥar;楤΀cdenqrtとふへみわゔヌĀeuねぱ;쀀∽̱te;䅕iãᅮmptyv;榳gȀ;del࿑らるろ;榒;榥å࿑uo耻»䂻rր;abcfhlpstw࿜ガクシスゼゾダッデナp;極Ā;f࿠ゴs;椠;椳s;椞ë≝ð✮l;楅im;楴l;憣;憝Āaiパフil;椚oĀ;nホボ戶aló༞ƀabrョリヮrò៥rk;杳ĀakンヽcĀekヹ・;䁽;䁝Āes㄂㄄;榌lĀduㄊㄌ;榎;榐Ȁaeuyㄗㄜㄧㄩron;䅙Ādiㄡㄥil;䅗ì࿲âヺ;䑀Ȁclqsㄴㄷㄽㅄa;椷dhar;楩uoĀ;rȎȍh;憳ƀacgㅎㅟངlȀ;ipsླྀㅘㅛႜnåႻarôྩt;断ƀilrㅩဣㅮsht;楽;쀀𝔯ĀaoㅷㆆrĀduㅽㅿ»ѻĀ;l႑ㆄ;楬Ā;vㆋㆌ䏁;䏱ƀgns㆕ㇹㇼht̀ahlrstㆤㆰ㇂㇘㇤㇮rrowĀ;t࿜ㆭaéトarpoonĀduㆻㆿowîㅾp»႒eftĀah㇊㇐rrowó࿪arpoonóՑightarrows;應quigarro÷ニhreetimes;拌g;䋚ingdotseñἲƀahm㈍㈐㈓rò࿪aòՑ;怏oustĀ;a㈞㈟掱che»㈟mid;櫮Ȁabpt㈲㈽㉀㉒Ānr㈷㈺g;柭r;懾rëဃƀafl㉇㉊㉎r;榆;쀀𝕣us;樮imes;樵Āap㉝㉧rĀ;g㉣㉤䀩t;榔olint;樒arò㇣Ȁachq㉻㊀Ⴜ㊅quo;怺r;쀀𝓇Ābu・㊊oĀ;rȔȓƀhir㊗㊛㊠reåㇸmes;拊iȀ;efl㊪ၙᠡ㊫方tri;槎luhar;楨;愞ൡ㋕㋛㋟㌬㌸㍱\0㍺㎤\0\0㏬㏰\0㐨㑈㑚㒭㒱㓊㓱\0㘖\0\0㘳cute;䅛quï➺Ԁ;Eaceinpsyᇭ㋳㋵㋿㌂㌋㌏㌟㌦㌩;檴ǰ㋺\0㋼;檸on;䅡uåᇾĀ;dᇳ㌇il;䅟rc;䅝ƀEas㌖㌘㌛;檶p;檺im;择olint;樓iíሄ;䑁otƀ;be㌴ᵇ㌵担;橦΀Aacmstx㍆㍊㍗㍛㍞㍣㍭rr;懘rĀhr㍐㍒ë∨Ā;oਸ਼਴t耻§䂧i;䀻war;椩mĀin㍩ðnuóñt;朶rĀ;o㍶⁕쀀𝔰Ȁacoy㎂㎆㎑㎠rp;景Āhy㎋㎏cy;䑉;䑈rtɭ㎙\0\0㎜iäᑤaraì⹯耻­䂭Āgm㎨㎴maƀ;fv㎱㎲㎲䏃;䏂Ѐ;deglnprካ㏅㏉㏎㏖㏞㏡㏦ot;橪Ā;q኱ኰĀ;E㏓㏔檞;檠Ā;E㏛㏜檝;檟e;扆lus;樤arr;楲aròᄽȀaeit㏸㐈㐏㐗Āls㏽㐄lsetmé㍪hp;樳parsl;槤Ādlᑣ㐔e;挣Ā;e㐜㐝檪Ā;s㐢㐣檬;쀀⪬︀ƀflp㐮㐳㑂tcy;䑌Ā;b㐸㐹䀯Ā;a㐾㐿槄r;挿f;쀀𝕤aĀdr㑍ЂesĀ;u㑔㑕晠it»㑕ƀcsu㑠㑹㒟Āau㑥㑯pĀ;sᆈ㑫;쀀⊓︀pĀ;sᆴ㑵;쀀⊔︀uĀbp㑿㒏ƀ;esᆗᆜ㒆etĀ;eᆗ㒍ñᆝƀ;esᆨᆭ㒖etĀ;eᆨ㒝ñᆮƀ;afᅻ㒦ְrť㒫ֱ»ᅼaròᅈȀcemt㒹㒾㓂㓅r;쀀𝓈tmîñiì㐕aræᆾĀar㓎㓕rĀ;f㓔ឿ昆Āan㓚㓭ightĀep㓣㓪psiloîỠhé⺯s»⡒ʀbcmnp㓻㕞ሉ㖋㖎Ҁ;Edemnprs㔎㔏㔑㔕㔞㔣㔬㔱㔶抂;櫅ot;檽Ā;dᇚ㔚ot;櫃ult;櫁ĀEe㔨㔪;櫋;把lus;檿arr;楹ƀeiu㔽㕒㕕tƀ;en㔎㕅㕋qĀ;qᇚ㔏eqĀ;q㔫㔨m;櫇Ābp㕚㕜;櫕;櫓c̀;acensᇭ㕬㕲㕹㕻㌦pproø㋺urlyeñᇾñᇳƀaes㖂㖈㌛pproø㌚qñ㌗g;晪ڀ123;Edehlmnps㖩㖬㖯ሜ㖲㖴㗀㗉㗕㗚㗟㗨㗭耻¹䂹耻²䂲耻³䂳;櫆Āos㖹㖼t;檾ub;櫘Ā;dሢ㗅ot;櫄sĀou㗏㗒l;柉b;櫗arr;楻ult;櫂ĀEe㗤㗦;櫌;抋lus;櫀ƀeiu㗴㘉㘌tƀ;enሜ㗼㘂qĀ;qሢ㖲eqĀ;q㗧㗤m;櫈Ābp㘑㘓;櫔;櫖ƀAan㘜㘠㘭rr;懙rĀhr㘦㘨ë∮Ā;oਫ਩war;椪lig耻ß䃟௡㙑㙝㙠ዎ㙳㙹\0㙾㛂\0\0\0\0\0㛛㜃\0㜉㝬\0\0\0㞇ɲ㙖\0\0㙛get;挖;䏄rë๟ƀaey㙦㙫㙰ron;䅥dil;䅣;䑂lrec;挕r;쀀𝔱Ȁeiko㚆㚝㚵㚼Dz㚋\0㚑eĀ4fኄኁaƀ;sv㚘㚙㚛䎸ym;䏑Ācn㚢㚲kĀas㚨㚮pproø዁im»ኬsðኞĀas㚺㚮ð዁rn耻þ䃾Ǭ̟㛆⋧es膀×;bd㛏㛐㛘䃗Ā;aᤏ㛕r;樱;樰ƀeps㛡㛣㜀á⩍Ȁ;bcf҆㛬㛰㛴ot;挶ir;櫱Ā;o㛹㛼쀀𝕥rk;櫚á㍢rime;怴ƀaip㜏㜒㝤dåቈ΀adempst㜡㝍㝀㝑㝗㝜㝟ngleʀ;dlqr㜰㜱㜶㝀㝂斵own»ᶻeftĀ;e⠀㜾ñम;扜ightĀ;e㊪㝋ñၚot;旬inus;樺lus;樹b;槍ime;樻ezium;揢ƀcht㝲㝽㞁Āry㝷㝻;쀀𝓉;䑆cy;䑛rok;䅧Āio㞋㞎xô᝷headĀlr㞗㞠eftarro÷ࡏightarrow»ཝऀAHabcdfghlmoprstuw㟐㟓㟗㟤㟰㟼㠎㠜㠣㠴㡑㡝㡫㢩㣌㣒㣪㣶ròϭar;楣Ācr㟜㟢ute耻ú䃺òᅐrǣ㟪\0㟭y;䑞ve;䅭Āiy㟵㟺rc耻û䃻;䑃ƀabh㠃㠆㠋ròᎭlac;䅱aòᏃĀir㠓㠘sht;楾;쀀𝔲rave耻ù䃹š㠧㠱rĀlr㠬㠮»ॗ»ႃlk;斀Āct㠹㡍ɯ㠿\0\0㡊rnĀ;e㡅㡆挜r»㡆op;挏ri;旸Āal㡖㡚cr;䅫肻¨͉Āgp㡢㡦on;䅳f;쀀𝕦̀adhlsuᅋ㡸㡽፲㢑㢠ownáᎳarpoonĀlr㢈㢌efô㠭ighô㠯iƀ;hl㢙㢚㢜䏅»ᏺon»㢚parrows;懈ƀcit㢰㣄㣈ɯ㢶\0\0㣁rnĀ;e㢼㢽挝r»㢽op;挎ng;䅯ri;旹cr;쀀𝓊ƀdir㣙㣝㣢ot;拰lde;䅩iĀ;f㜰㣨»᠓Āam㣯㣲rò㢨l耻ü䃼angle;榧ހABDacdeflnoprsz㤜㤟㤩㤭㦵㦸㦽㧟㧤㧨㧳㧹㧽㨁㨠ròϷarĀ;v㤦㤧櫨;櫩asèϡĀnr㤲㤷grt;榜΀eknprst㓣㥆㥋㥒㥝㥤㦖appá␕othinçẖƀhir㓫⻈㥙opô⾵Ā;hᎷ㥢ïㆍĀiu㥩㥭gmá㎳Ābp㥲㦄setneqĀ;q㥽㦀쀀⊊︀;쀀⫋︀setneqĀ;q㦏㦒쀀⊋︀;쀀⫌︀Āhr㦛㦟etá㚜iangleĀlr㦪㦯eft»थight»ၑy;䐲ash»ံƀelr㧄㧒㧗ƀ;beⷪ㧋㧏ar;抻q;扚lip;拮Ābt㧜ᑨaòᑩr;쀀𝔳tré㦮suĀbp㧯㧱»ജ»൙pf;쀀𝕧roð໻tré㦴Ācu㨆㨋r;쀀𝓋Ābp㨐㨘nĀEe㦀㨖»㥾nĀEe㦒㨞»㦐igzag;榚΀cefoprs㨶㨻㩖㩛㩔㩡㩪irc;䅵Ādi㩀㩑Ābg㩅㩉ar;機eĀ;qᗺ㩏;扙erp;愘r;쀀𝔴pf;쀀𝕨Ā;eᑹ㩦atèᑹcr;쀀𝓌ૣណ㪇\0㪋\0㪐㪛\0\0㪝㪨㪫㪯\0\0㫃㫎\0㫘ៜ៟tré៑r;쀀𝔵ĀAa㪔㪗ròσrò৶;䎾ĀAa㪡㪤ròθrò৫að✓is;拻ƀdptឤ㪵㪾Āfl㪺ឩ;쀀𝕩imåឲĀAa㫇㫊ròώròਁĀcq㫒ីr;쀀𝓍Āpt៖㫜ré។Ѐacefiosu㫰㫽㬈㬌㬑㬕㬛㬡cĀuy㫶㫻te耻ý䃽;䑏Āiy㬂㬆rc;䅷;䑋n耻¥䂥r;쀀𝔶cy;䑗pf;쀀𝕪cr;쀀𝓎Ācm㬦㬩y;䑎l耻ÿ䃿Ԁacdefhiosw㭂㭈㭔㭘㭤㭩㭭㭴㭺㮀cute;䅺Āay㭍㭒ron;䅾;䐷ot;䅼Āet㭝㭡træᕟa;䎶r;쀀𝔷cy;䐶grarr;懝pf;쀀𝕫cr;쀀𝓏Ājn㮅㮇;怍j;怌'.split("").map(e=>e.charCodeAt(0))),decodeMap=new Map([[0,65533],[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]);function isNumber(e){return e>=CharCodes.ZERO&&e<=CharCodes.NINE}function isHexadecimalCharacter(e){return e>=CharCodes.UPPER_A&&e<=CharCodes.UPPER_F||e>=CharCodes.LOWER_A&&e<=CharCodes.LOWER_F}function isEntityInAttributeInvalidEnd(e){return e===CharCodes.EQUALS||function(e){return e>=CharCodes.UPPER_A&&e<=CharCodes.UPPER_Z||e>=CharCodes.LOWER_A&&e<=CharCodes.LOWER_Z||isNumber(e)}(e)}String.fromCodePoint,(CharCodes2=CharCodes||(CharCodes={}))[CharCodes2.NUM=35]="NUM",CharCodes2[CharCodes2.SEMI=59]="SEMI",CharCodes2[CharCodes2.EQUALS=61]="EQUALS",CharCodes2[CharCodes2.ZERO=48]="ZERO",CharCodes2[CharCodes2.NINE=57]="NINE",CharCodes2[CharCodes2.LOWER_A=97]="LOWER_A",CharCodes2[CharCodes2.LOWER_F=102]="LOWER_F",CharCodes2[CharCodes2.LOWER_X=120]="LOWER_X",CharCodes2[CharCodes2.LOWER_Z=122]="LOWER_Z",CharCodes2[CharCodes2.UPPER_A=65]="UPPER_A",CharCodes2[CharCodes2.UPPER_F=70]="UPPER_F",CharCodes2[CharCodes2.UPPER_Z=90]="UPPER_Z",(BinTrieFlags2=BinTrieFlags||(BinTrieFlags={}))[BinTrieFlags2.VALUE_LENGTH=49152]="VALUE_LENGTH",BinTrieFlags2[BinTrieFlags2.BRANCH_LENGTH=16256]="BRANCH_LENGTH",BinTrieFlags2[BinTrieFlags2.JUMP_TABLE=127]="JUMP_TABLE",(EntityDecoderState2=EntityDecoderState||(EntityDecoderState={}))[EntityDecoderState2.EntityStart=0]="EntityStart",EntityDecoderState2[EntityDecoderState2.NumericStart=1]="NumericStart",EntityDecoderState2[EntityDecoderState2.NumericDecimal=2]="NumericDecimal",EntityDecoderState2[EntityDecoderState2.NumericHex=3]="NumericHex",EntityDecoderState2[EntityDecoderState2.NamedEntity=4]="NamedEntity",(DecodingMode2=DecodingMode||(DecodingMode={}))[DecodingMode2.Legacy=0]="Legacy",DecodingMode2[DecodingMode2.Strict=1]="Strict",DecodingMode2[DecodingMode2.Attribute=2]="Attribute";var NS,NS2,ATTRS,ATTRS2,DOCUMENT_MODE,DOCUMENT_MODE2,TAG_NAMES,TAG_NAMES2,TAG_ID,TAG_ID2,EntityDecoder=class{constructor(e,t,n){this.decodeTree=e,this.emitCodePoint=t,this.errors=n,this.state=EntityDecoderState.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=DecodingMode.Strict}startEntity(e){this.decodeMode=e,this.state=EntityDecoderState.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(e,t){switch(this.state){case EntityDecoderState.EntityStart:return e.charCodeAt(t)===CharCodes.NUM?(this.state=EntityDecoderState.NumericStart,this.consumed+=1,this.stateNumericStart(e,t+1)):(this.state=EntityDecoderState.NamedEntity,this.stateNamedEntity(e,t));case EntityDecoderState.NumericStart:return this.stateNumericStart(e,t);case EntityDecoderState.NumericDecimal:return this.stateNumericDecimal(e,t);case EntityDecoderState.NumericHex:return this.stateNumericHex(e,t);case EntityDecoderState.NamedEntity:return this.stateNamedEntity(e,t)}}stateNumericStart(e,t){return t>=e.length?-1:(32|e.charCodeAt(t))===CharCodes.LOWER_X?(this.state=EntityDecoderState.NumericHex,this.consumed+=1,this.stateNumericHex(e,t+1)):(this.state=EntityDecoderState.NumericDecimal,this.stateNumericDecimal(e,t))}addToNumericResult(e,t,n,r){if(t!==n){const s=n-t;this.result=this.result*Math.pow(r,s)+Number.parseInt(e.substr(t,s),r),this.consumed+=s}}stateNumericHex(e,t){const n=t;for(;t<e.length;){const r=e.charCodeAt(t);if(!isNumber(r)&&!isHexadecimalCharacter(r))return this.addToNumericResult(e,n,t,16),this.emitNumericEntity(r,3);t+=1}return this.addToNumericResult(e,n,t,16),-1}stateNumericDecimal(e,t){const n=t;for(;t<e.length;){const r=e.charCodeAt(t);if(!isNumber(r))return this.addToNumericResult(e,n,t,10),this.emitNumericEntity(r,2);t+=1}return this.addToNumericResult(e,n,t,10),-1}emitNumericEntity(e,t){var n;if(this.consumed<=t)return null===(n=this.errors)||void 0===n||n.absenceOfDigitsInNumericCharacterReference(this.consumed),0;if(e===CharCodes.SEMI)this.consumed+=1;else if(this.decodeMode===DecodingMode.Strict)return 0;return this.emitCodePoint(function(e){var t;return e>=55296&&e<=57343||e>1114111?65533:null!==(t=decodeMap.get(e))&&void 0!==t?t:e}(this.result),this.consumed),this.errors&&(e!==CharCodes.SEMI&&this.errors.missingSemicolonAfterCharacterReference(),this.errors.validateNumericCharacterReference(this.result)),this.consumed}stateNamedEntity(e,t){const{decodeTree:n}=this;let r=n[this.treeIndex],s=(r&BinTrieFlags.VALUE_LENGTH)>>14;for(;t<e.length;t++,this.excess++){const a=e.charCodeAt(t);if(this.treeIndex=determineBranch(n,r,this.treeIndex+Math.max(1,s),a),this.treeIndex<0)return 0===this.result||this.decodeMode===DecodingMode.Attribute&&(0===s||isEntityInAttributeInvalidEnd(a))?0:this.emitNotTerminatedNamedEntity();if(r=n[this.treeIndex],s=(r&BinTrieFlags.VALUE_LENGTH)>>14,0!==s){if(a===CharCodes.SEMI)return this.emitNamedEntityData(this.treeIndex,s,this.consumed+this.excess);this.decodeMode!==DecodingMode.Strict&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}}return-1}emitNotTerminatedNamedEntity(){var e;const{result:t,decodeTree:n}=this,r=(n[t]&BinTrieFlags.VALUE_LENGTH)>>14;return this.emitNamedEntityData(t,r,this.consumed),null===(e=this.errors)||void 0===e||e.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(e,t,n){const{decodeTree:r}=this;return this.emitCodePoint(1===t?r[e]&~BinTrieFlags.VALUE_LENGTH:r[e+1],n),3===t&&this.emitCodePoint(r[e+2],n),n}end(){var e;switch(this.state){case EntityDecoderState.NamedEntity:return 0===this.result||this.decodeMode===DecodingMode.Attribute&&this.result!==this.treeIndex?0:this.emitNotTerminatedNamedEntity();case EntityDecoderState.NumericDecimal:return this.emitNumericEntity(0,2);case EntityDecoderState.NumericHex:return this.emitNumericEntity(0,3);case EntityDecoderState.NumericStart:return null===(e=this.errors)||void 0===e||e.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case EntityDecoderState.EntityStart:return 0}}};function determineBranch(e,t,n,r){const s=(t&BinTrieFlags.BRANCH_LENGTH)>>7,a=t&BinTrieFlags.JUMP_TABLE;if(0===s)return 0!==a&&r===a?n:-1;if(a){const t=r-a;return t<0||t>=s?-1:e[n+t]-1}let i=n,o=i+s-1;for(;i<=o;){const t=i+o>>>1,n=e[t];if(n<r)i=t+1;else{if(!(n>r))return e[t+s];o=t-1}}return-1}(NS2=NS||(NS={})).HTML="http://www.w3.org/1999/xhtml",NS2.MATHML="http://www.w3.org/1998/Math/MathML",NS2.SVG="http://www.w3.org/2000/svg",NS2.XLINK="http://www.w3.org/1999/xlink",NS2.XML="http://www.w3.org/XML/1998/namespace",NS2.XMLNS="http://www.w3.org/2000/xmlns/",(ATTRS2=ATTRS||(ATTRS={})).TYPE="type",ATTRS2.ACTION="action",ATTRS2.ENCODING="encoding",ATTRS2.PROMPT="prompt",ATTRS2.NAME="name",ATTRS2.COLOR="color",ATTRS2.FACE="face",ATTRS2.SIZE="size",(DOCUMENT_MODE2=DOCUMENT_MODE||(DOCUMENT_MODE={})).NO_QUIRKS="no-quirks",DOCUMENT_MODE2.QUIRKS="quirks",DOCUMENT_MODE2.LIMITED_QUIRKS="limited-quirks",(TAG_NAMES2=TAG_NAMES||(TAG_NAMES={})).A="a",TAG_NAMES2.ADDRESS="address",TAG_NAMES2.ANNOTATION_XML="annotation-xml",TAG_NAMES2.APPLET="applet",TAG_NAMES2.AREA="area",TAG_NAMES2.ARTICLE="article",TAG_NAMES2.ASIDE="aside",TAG_NAMES2.B="b",TAG_NAMES2.BASE="base",TAG_NAMES2.BASEFONT="basefont",TAG_NAMES2.BGSOUND="bgsound",TAG_NAMES2.BIG="big",TAG_NAMES2.BLOCKQUOTE="blockquote",TAG_NAMES2.BODY="body",TAG_NAMES2.BR="br",TAG_NAMES2.BUTTON="button",TAG_NAMES2.CAPTION="caption",TAG_NAMES2.CENTER="center",TAG_NAMES2.CODE="code",TAG_NAMES2.COL="col",TAG_NAMES2.COLGROUP="colgroup",TAG_NAMES2.DD="dd",TAG_NAMES2.DESC="desc",TAG_NAMES2.DETAILS="details",TAG_NAMES2.DIALOG="dialog",TAG_NAMES2.DIR="dir",TAG_NAMES2.DIV="div",TAG_NAMES2.DL="dl",TAG_NAMES2.DT="dt",TAG_NAMES2.EM="em",TAG_NAMES2.EMBED="embed",TAG_NAMES2.FIELDSET="fieldset",TAG_NAMES2.FIGCAPTION="figcaption",TAG_NAMES2.FIGURE="figure",TAG_NAMES2.FONT="font",TAG_NAMES2.FOOTER="footer",TAG_NAMES2.FOREIGN_OBJECT="foreignObject",TAG_NAMES2.FORM="form",TAG_NAMES2.FRAME="frame",TAG_NAMES2.FRAMESET="frameset",TAG_NAMES2.H1="h1",TAG_NAMES2.H2="h2",TAG_NAMES2.H3="h3",TAG_NAMES2.H4="h4",TAG_NAMES2.H5="h5",TAG_NAMES2.H6="h6",TAG_NAMES2.HEAD="head",TAG_NAMES2.HEADER="header",TAG_NAMES2.HGROUP="hgroup",TAG_NAMES2.HR="hr",TAG_NAMES2.HTML="html",TAG_NAMES2.I="i",TAG_NAMES2.IMG="img",TAG_NAMES2.IMAGE="image",TAG_NAMES2.INPUT="input",TAG_NAMES2.IFRAME="iframe",TAG_NAMES2.KEYGEN="keygen",TAG_NAMES2.LABEL="label",TAG_NAMES2.LI="li",TAG_NAMES2.LINK="link",TAG_NAMES2.LISTING="listing",TAG_NAMES2.MAIN="main",TAG_NAMES2.MALIGNMARK="malignmark",TAG_NAMES2.MARQUEE="marquee",TAG_NAMES2.MATH="math",TAG_NAMES2.MENU="menu",TAG_NAMES2.META="meta",TAG_NAMES2.MGLYPH="mglyph",TAG_NAMES2.MI="mi",TAG_NAMES2.MO="mo",TAG_NAMES2.MN="mn",TAG_NAMES2.MS="ms",TAG_NAMES2.MTEXT="mtext",TAG_NAMES2.NAV="nav",TAG_NAMES2.NOBR="nobr",TAG_NAMES2.NOFRAMES="noframes",TAG_NAMES2.NOEMBED="noembed",TAG_NAMES2.NOSCRIPT="noscript",TAG_NAMES2.OBJECT="object",TAG_NAMES2.OL="ol",TAG_NAMES2.OPTGROUP="optgroup",TAG_NAMES2.OPTION="option",TAG_NAMES2.P="p",TAG_NAMES2.PARAM="param",TAG_NAMES2.PLAINTEXT="plaintext",TAG_NAMES2.PRE="pre",TAG_NAMES2.RB="rb",TAG_NAMES2.RP="rp",TAG_NAMES2.RT="rt",TAG_NAMES2.RTC="rtc",TAG_NAMES2.RUBY="ruby",TAG_NAMES2.S="s",TAG_NAMES2.SCRIPT="script",TAG_NAMES2.SEARCH="search",TAG_NAMES2.SECTION="section",TAG_NAMES2.SELECT="select",TAG_NAMES2.SOURCE="source",TAG_NAMES2.SMALL="small",TAG_NAMES2.SPAN="span",TAG_NAMES2.STRIKE="strike",TAG_NAMES2.STRONG="strong",TAG_NAMES2.STYLE="style",TAG_NAMES2.SUB="sub",TAG_NAMES2.SUMMARY="summary",TAG_NAMES2.SUP="sup",TAG_NAMES2.TABLE="table",TAG_NAMES2.TBODY="tbody",TAG_NAMES2.TEMPLATE="template",TAG_NAMES2.TEXTAREA="textarea",TAG_NAMES2.TFOOT="tfoot",TAG_NAMES2.TD="td",TAG_NAMES2.TH="th",TAG_NAMES2.THEAD="thead",TAG_NAMES2.TITLE="title",TAG_NAMES2.TR="tr",TAG_NAMES2.TRACK="track",TAG_NAMES2.TT="tt",TAG_NAMES2.U="u",TAG_NAMES2.UL="ul",TAG_NAMES2.SVG="svg",TAG_NAMES2.VAR="var",TAG_NAMES2.WBR="wbr",TAG_NAMES2.XMP="xmp",(TAG_ID2=TAG_ID||(TAG_ID={}))[TAG_ID2.UNKNOWN=0]="UNKNOWN",TAG_ID2[TAG_ID2.A=1]="A",TAG_ID2[TAG_ID2.ADDRESS=2]="ADDRESS",TAG_ID2[TAG_ID2.ANNOTATION_XML=3]="ANNOTATION_XML",TAG_ID2[TAG_ID2.APPLET=4]="APPLET",TAG_ID2[TAG_ID2.AREA=5]="AREA",TAG_ID2[TAG_ID2.ARTICLE=6]="ARTICLE",TAG_ID2[TAG_ID2.ASIDE=7]="ASIDE",TAG_ID2[TAG_ID2.B=8]="B",TAG_ID2[TAG_ID2.BASE=9]="BASE",TAG_ID2[TAG_ID2.BASEFONT=10]="BASEFONT",TAG_ID2[TAG_ID2.BGSOUND=11]="BGSOUND",TAG_ID2[TAG_ID2.BIG=12]="BIG",TAG_ID2[TAG_ID2.BLOCKQUOTE=13]="BLOCKQUOTE",TAG_ID2[TAG_ID2.BODY=14]="BODY",TAG_ID2[TAG_ID2.BR=15]="BR",TAG_ID2[TAG_ID2.BUTTON=16]="BUTTON",TAG_ID2[TAG_ID2.CAPTION=17]="CAPTION",TAG_ID2[TAG_ID2.CENTER=18]="CENTER",TAG_ID2[TAG_ID2.CODE=19]="CODE",TAG_ID2[TAG_ID2.COL=20]="COL",TAG_ID2[TAG_ID2.COLGROUP=21]="COLGROUP",TAG_ID2[TAG_ID2.DD=22]="DD",TAG_ID2[TAG_ID2.DESC=23]="DESC",TAG_ID2[TAG_ID2.DETAILS=24]="DETAILS",TAG_ID2[TAG_ID2.DIALOG=25]="DIALOG",TAG_ID2[TAG_ID2.DIR=26]="DIR",TAG_ID2[TAG_ID2.DIV=27]="DIV",TAG_ID2[TAG_ID2.DL=28]="DL",TAG_ID2[TAG_ID2.DT=29]="DT",TAG_ID2[TAG_ID2.EM=30]="EM",TAG_ID2[TAG_ID2.EMBED=31]="EMBED",TAG_ID2[TAG_ID2.FIELDSET=32]="FIELDSET",TAG_ID2[TAG_ID2.FIGCAPTION=33]="FIGCAPTION",TAG_ID2[TAG_ID2.FIGURE=34]="FIGURE",TAG_ID2[TAG_ID2.FONT=35]="FONT",TAG_ID2[TAG_ID2.FOOTER=36]="FOOTER",TAG_ID2[TAG_ID2.FOREIGN_OBJECT=37]="FOREIGN_OBJECT",TAG_ID2[TAG_ID2.FORM=38]="FORM",TAG_ID2[TAG_ID2.FRAME=39]="FRAME",TAG_ID2[TAG_ID2.FRAMESET=40]="FRAMESET",TAG_ID2[TAG_ID2.H1=41]="H1",TAG_ID2[TAG_ID2.H2=42]="H2",TAG_ID2[TAG_ID2.H3=43]="H3",TAG_ID2[TAG_ID2.H4=44]="H4",TAG_ID2[TAG_ID2.H5=45]="H5",TAG_ID2[TAG_ID2.H6=46]="H6",TAG_ID2[TAG_ID2.HEAD=47]="HEAD",TAG_ID2[TAG_ID2.HEADER=48]="HEADER",TAG_ID2[TAG_ID2.HGROUP=49]="HGROUP",TAG_ID2[TAG_ID2.HR=50]="HR",TAG_ID2[TAG_ID2.HTML=51]="HTML",TAG_ID2[TAG_ID2.I=52]="I",TAG_ID2[TAG_ID2.IMG=53]="IMG",TAG_ID2[TAG_ID2.IMAGE=54]="IMAGE",TAG_ID2[TAG_ID2.INPUT=55]="INPUT",TAG_ID2[TAG_ID2.IFRAME=56]="IFRAME",TAG_ID2[TAG_ID2.KEYGEN=57]="KEYGEN",TAG_ID2[TAG_ID2.LABEL=58]="LABEL",TAG_ID2[TAG_ID2.LI=59]="LI",TAG_ID2[TAG_ID2.LINK=60]="LINK",TAG_ID2[TAG_ID2.LISTING=61]="LISTING",TAG_ID2[TAG_ID2.MAIN=62]="MAIN",TAG_ID2[TAG_ID2.MALIGNMARK=63]="MALIGNMARK",TAG_ID2[TAG_ID2.MARQUEE=64]="MARQUEE",TAG_ID2[TAG_ID2.MATH=65]="MATH",TAG_ID2[TAG_ID2.MENU=66]="MENU",TAG_ID2[TAG_ID2.META=67]="META",TAG_ID2[TAG_ID2.MGLYPH=68]="MGLYPH",TAG_ID2[TAG_ID2.MI=69]="MI",TAG_ID2[TAG_ID2.MO=70]="MO",TAG_ID2[TAG_ID2.MN=71]="MN",TAG_ID2[TAG_ID2.MS=72]="MS",TAG_ID2[TAG_ID2.MTEXT=73]="MTEXT",TAG_ID2[TAG_ID2.NAV=74]="NAV",TAG_ID2[TAG_ID2.NOBR=75]="NOBR",TAG_ID2[TAG_ID2.NOFRAMES=76]="NOFRAMES",TAG_ID2[TAG_ID2.NOEMBED=77]="NOEMBED",TAG_ID2[TAG_ID2.NOSCRIPT=78]="NOSCRIPT",TAG_ID2[TAG_ID2.OBJECT=79]="OBJECT",TAG_ID2[TAG_ID2.OL=80]="OL",TAG_ID2[TAG_ID2.OPTGROUP=81]="OPTGROUP",TAG_ID2[TAG_ID2.OPTION=82]="OPTION",TAG_ID2[TAG_ID2.P=83]="P",TAG_ID2[TAG_ID2.PARAM=84]="PARAM",TAG_ID2[TAG_ID2.PLAINTEXT=85]="PLAINTEXT",TAG_ID2[TAG_ID2.PRE=86]="PRE",TAG_ID2[TAG_ID2.RB=87]="RB",TAG_ID2[TAG_ID2.RP=88]="RP",TAG_ID2[TAG_ID2.RT=89]="RT",TAG_ID2[TAG_ID2.RTC=90]="RTC",TAG_ID2[TAG_ID2.RUBY=91]="RUBY",TAG_ID2[TAG_ID2.S=92]="S",TAG_ID2[TAG_ID2.SCRIPT=93]="SCRIPT",TAG_ID2[TAG_ID2.SEARCH=94]="SEARCH",TAG_ID2[TAG_ID2.SECTION=95]="SECTION",TAG_ID2[TAG_ID2.SELECT=96]="SELECT",TAG_ID2[TAG_ID2.SOURCE=97]="SOURCE",TAG_ID2[TAG_ID2.SMALL=98]="SMALL",TAG_ID2[TAG_ID2.SPAN=99]="SPAN",TAG_ID2[TAG_ID2.STRIKE=100]="STRIKE",TAG_ID2[TAG_ID2.STRONG=101]="STRONG",TAG_ID2[TAG_ID2.STYLE=102]="STYLE",TAG_ID2[TAG_ID2.SUB=103]="SUB",TAG_ID2[TAG_ID2.SUMMARY=104]="SUMMARY",TAG_ID2[TAG_ID2.SUP=105]="SUP",TAG_ID2[TAG_ID2.TABLE=106]="TABLE",TAG_ID2[TAG_ID2.TBODY=107]="TBODY",TAG_ID2[TAG_ID2.TEMPLATE=108]="TEMPLATE",TAG_ID2[TAG_ID2.TEXTAREA=109]="TEXTAREA",TAG_ID2[TAG_ID2.TFOOT=110]="TFOOT",TAG_ID2[TAG_ID2.TD=111]="TD",TAG_ID2[TAG_ID2.TH=112]="TH",TAG_ID2[TAG_ID2.THEAD=113]="THEAD",TAG_ID2[TAG_ID2.TITLE=114]="TITLE",TAG_ID2[TAG_ID2.TR=115]="TR",TAG_ID2[TAG_ID2.TRACK=116]="TRACK",TAG_ID2[TAG_ID2.TT=117]="TT",TAG_ID2[TAG_ID2.U=118]="U",TAG_ID2[TAG_ID2.UL=119]="UL",TAG_ID2[TAG_ID2.SVG=120]="SVG",TAG_ID2[TAG_ID2.VAR=121]="VAR",TAG_ID2[TAG_ID2.WBR=122]="WBR",TAG_ID2[TAG_ID2.XMP=123]="XMP";var TAG_NAME_TO_ID=new Map([[TAG_NAMES.A,TAG_ID.A],[TAG_NAMES.ADDRESS,TAG_ID.ADDRESS],[TAG_NAMES.ANNOTATION_XML,TAG_ID.ANNOTATION_XML],[TAG_NAMES.APPLET,TAG_ID.APPLET],[TAG_NAMES.AREA,TAG_ID.AREA],[TAG_NAMES.ARTICLE,TAG_ID.ARTICLE],[TAG_NAMES.ASIDE,TAG_ID.ASIDE],[TAG_NAMES.B,TAG_ID.B],[TAG_NAMES.BASE,TAG_ID.BASE],[TAG_NAMES.BASEFONT,TAG_ID.BASEFONT],[TAG_NAMES.BGSOUND,TAG_ID.BGSOUND],[TAG_NAMES.BIG,TAG_ID.BIG],[TAG_NAMES.BLOCKQUOTE,TAG_ID.BLOCKQUOTE],[TAG_NAMES.BODY,TAG_ID.BODY],[TAG_NAMES.BR,TAG_ID.BR],[TAG_NAMES.BUTTON,TAG_ID.BUTTON],[TAG_NAMES.CAPTION,TAG_ID.CAPTION],[TAG_NAMES.CENTER,TAG_ID.CENTER],[TAG_NAMES.CODE,TAG_ID.CODE],[TAG_NAMES.COL,TAG_ID.COL],[TAG_NAMES.COLGROUP,TAG_ID.COLGROUP],[TAG_NAMES.DD,TAG_ID.DD],[TAG_NAMES.DESC,TAG_ID.DESC],[TAG_NAMES.DETAILS,TAG_ID.DETAILS],[TAG_NAMES.DIALOG,TAG_ID.DIALOG],[TAG_NAMES.DIR,TAG_ID.DIR],[TAG_NAMES.DIV,TAG_ID.DIV],[TAG_NAMES.DL,TAG_ID.DL],[TAG_NAMES.DT,TAG_ID.DT],[TAG_NAMES.EM,TAG_ID.EM],[TAG_NAMES.EMBED,TAG_ID.EMBED],[TAG_NAMES.FIELDSET,TAG_ID.FIELDSET],[TAG_NAMES.FIGCAPTION,TAG_ID.FIGCAPTION],[TAG_NAMES.FIGURE,TAG_ID.FIGURE],[TAG_NAMES.FONT,TAG_ID.FONT],[TAG_NAMES.FOOTER,TAG_ID.FOOTER],[TAG_NAMES.FOREIGN_OBJECT,TAG_ID.FOREIGN_OBJECT],[TAG_NAMES.FORM,TAG_ID.FORM],[TAG_NAMES.FRAME,TAG_ID.FRAME],[TAG_NAMES.FRAMESET,TAG_ID.FRAMESET],[TAG_NAMES.H1,TAG_ID.H1],[TAG_NAMES.H2,TAG_ID.H2],[TAG_NAMES.H3,TAG_ID.H3],[TAG_NAMES.H4,TAG_ID.H4],[TAG_NAMES.H5,TAG_ID.H5],[TAG_NAMES.H6,TAG_ID.H6],[TAG_NAMES.HEAD,TAG_ID.HEAD],[TAG_NAMES.HEADER,TAG_ID.HEADER],[TAG_NAMES.HGROUP,TAG_ID.HGROUP],[TAG_NAMES.HR,TAG_ID.HR],[TAG_NAMES.HTML,TAG_ID.HTML],[TAG_NAMES.I,TAG_ID.I],[TAG_NAMES.IMG,TAG_ID.IMG],[TAG_NAMES.IMAGE,TAG_ID.IMAGE],[TAG_NAMES.INPUT,TAG_ID.INPUT],[TAG_NAMES.IFRAME,TAG_ID.IFRAME],[TAG_NAMES.KEYGEN,TAG_ID.KEYGEN],[TAG_NAMES.LABEL,TAG_ID.LABEL],[TAG_NAMES.LI,TAG_ID.LI],[TAG_NAMES.LINK,TAG_ID.LINK],[TAG_NAMES.LISTING,TAG_ID.LISTING],[TAG_NAMES.MAIN,TAG_ID.MAIN],[TAG_NAMES.MALIGNMARK,TAG_ID.MALIGNMARK],[TAG_NAMES.MARQUEE,TAG_ID.MARQUEE],[TAG_NAMES.MATH,TAG_ID.MATH],[TAG_NAMES.MENU,TAG_ID.MENU],[TAG_NAMES.META,TAG_ID.META],[TAG_NAMES.MGLYPH,TAG_ID.MGLYPH],[TAG_NAMES.MI,TAG_ID.MI],[TAG_NAMES.MO,TAG_ID.MO],[TAG_NAMES.MN,TAG_ID.MN],[TAG_NAMES.MS,TAG_ID.MS],[TAG_NAMES.MTEXT,TAG_ID.MTEXT],[TAG_NAMES.NAV,TAG_ID.NAV],[TAG_NAMES.NOBR,TAG_ID.NOBR],[TAG_NAMES.NOFRAMES,TAG_ID.NOFRAMES],[TAG_NAMES.NOEMBED,TAG_ID.NOEMBED],[TAG_NAMES.NOSCRIPT,TAG_ID.NOSCRIPT],[TAG_NAMES.OBJECT,TAG_ID.OBJECT],[TAG_NAMES.OL,TAG_ID.OL],[TAG_NAMES.OPTGROUP,TAG_ID.OPTGROUP],[TAG_NAMES.OPTION,TAG_ID.OPTION],[TAG_NAMES.P,TAG_ID.P],[TAG_NAMES.PARAM,TAG_ID.PARAM],[TAG_NAMES.PLAINTEXT,TAG_ID.PLAINTEXT],[TAG_NAMES.PRE,TAG_ID.PRE],[TAG_NAMES.RB,TAG_ID.RB],[TAG_NAMES.RP,TAG_ID.RP],[TAG_NAMES.RT,TAG_ID.RT],[TAG_NAMES.RTC,TAG_ID.RTC],[TAG_NAMES.RUBY,TAG_ID.RUBY],[TAG_NAMES.S,TAG_ID.S],[TAG_NAMES.SCRIPT,TAG_ID.SCRIPT],[TAG_NAMES.SEARCH,TAG_ID.SEARCH],[TAG_NAMES.SECTION,TAG_ID.SECTION],[TAG_NAMES.SELECT,TAG_ID.SELECT],[TAG_NAMES.SOURCE,TAG_ID.SOURCE],[TAG_NAMES.SMALL,TAG_ID.SMALL],[TAG_NAMES.SPAN,TAG_ID.SPAN],[TAG_NAMES.STRIKE,TAG_ID.STRIKE],[TAG_NAMES.STRONG,TAG_ID.STRONG],[TAG_NAMES.STYLE,TAG_ID.STYLE],[TAG_NAMES.SUB,TAG_ID.SUB],[TAG_NAMES.SUMMARY,TAG_ID.SUMMARY],[TAG_NAMES.SUP,TAG_ID.SUP],[TAG_NAMES.TABLE,TAG_ID.TABLE],[TAG_NAMES.TBODY,TAG_ID.TBODY],[TAG_NAMES.TEMPLATE,TAG_ID.TEMPLATE],[TAG_NAMES.TEXTAREA,TAG_ID.TEXTAREA],[TAG_NAMES.TFOOT,TAG_ID.TFOOT],[TAG_NAMES.TD,TAG_ID.TD],[TAG_NAMES.TH,TAG_ID.TH],[TAG_NAMES.THEAD,TAG_ID.THEAD],[TAG_NAMES.TITLE,TAG_ID.TITLE],[TAG_NAMES.TR,TAG_ID.TR],[TAG_NAMES.TRACK,TAG_ID.TRACK],[TAG_NAMES.TT,TAG_ID.TT],[TAG_NAMES.U,TAG_ID.U],[TAG_NAMES.UL,TAG_ID.UL],[TAG_NAMES.SVG,TAG_ID.SVG],[TAG_NAMES.VAR,TAG_ID.VAR],[TAG_NAMES.WBR,TAG_ID.WBR],[TAG_NAMES.XMP,TAG_ID.XMP]]);function getTagID(e){var t;return null!==(t=TAG_NAME_TO_ID.get(e))&&void 0!==t?t:TAG_ID.UNKNOWN}var State,State2,$=TAG_ID,SPECIAL_ELEMENTS={[NS.HTML]:new Set([$.ADDRESS,$.APPLET,$.AREA,$.ARTICLE,$.ASIDE,$.BASE,$.BASEFONT,$.BGSOUND,$.BLOCKQUOTE,$.BODY,$.BR,$.BUTTON,$.CAPTION,$.CENTER,$.COL,$.COLGROUP,$.DD,$.DETAILS,$.DIR,$.DIV,$.DL,$.DT,$.EMBED,$.FIELDSET,$.FIGCAPTION,$.FIGURE,$.FOOTER,$.FORM,$.FRAME,$.FRAMESET,$.H1,$.H2,$.H3,$.H4,$.H5,$.H6,$.HEAD,$.HEADER,$.HGROUP,$.HR,$.HTML,$.IFRAME,$.IMG,$.INPUT,$.LI,$.LINK,$.LISTING,$.MAIN,$.MARQUEE,$.MENU,$.META,$.NAV,$.NOEMBED,$.NOFRAMES,$.NOSCRIPT,$.OBJECT,$.OL,$.P,$.PARAM,$.PLAINTEXT,$.PRE,$.SCRIPT,$.SECTION,$.SELECT,$.SOURCE,$.STYLE,$.SUMMARY,$.TABLE,$.TBODY,$.TD,$.TEMPLATE,$.TEXTAREA,$.TFOOT,$.TH,$.THEAD,$.TITLE,$.TR,$.TRACK,$.UL,$.WBR,$.XMP]),[NS.MATHML]:new Set([$.MI,$.MO,$.MN,$.MS,$.MTEXT,$.ANNOTATION_XML]),[NS.SVG]:new Set([$.TITLE,$.FOREIGN_OBJECT,$.DESC]),[NS.XLINK]:new Set,[NS.XML]:new Set,[NS.XMLNS]:new Set},NUMBERED_HEADERS=new Set([$.H1,$.H2,$.H3,$.H4,$.H5,$.H6]);TAG_NAMES.STYLE,TAG_NAMES.SCRIPT,TAG_NAMES.XMP,TAG_NAMES.IFRAME,TAG_NAMES.NOEMBED,TAG_NAMES.NOFRAMES,TAG_NAMES.PLAINTEXT,(State2=State||(State={}))[State2.DATA=0]="DATA",State2[State2.RCDATA=1]="RCDATA",State2[State2.RAWTEXT=2]="RAWTEXT",State2[State2.SCRIPT_DATA=3]="SCRIPT_DATA",State2[State2.PLAINTEXT=4]="PLAINTEXT",State2[State2.TAG_OPEN=5]="TAG_OPEN",State2[State2.END_TAG_OPEN=6]="END_TAG_OPEN",State2[State2.TAG_NAME=7]="TAG_NAME",State2[State2.RCDATA_LESS_THAN_SIGN=8]="RCDATA_LESS_THAN_SIGN",State2[State2.RCDATA_END_TAG_OPEN=9]="RCDATA_END_TAG_OPEN",State2[State2.RCDATA_END_TAG_NAME=10]="RCDATA_END_TAG_NAME",State2[State2.RAWTEXT_LESS_THAN_SIGN=11]="RAWTEXT_LESS_THAN_SIGN",State2[State2.RAWTEXT_END_TAG_OPEN=12]="RAWTEXT_END_TAG_OPEN",State2[State2.RAWTEXT_END_TAG_NAME=13]="RAWTEXT_END_TAG_NAME",State2[State2.SCRIPT_DATA_LESS_THAN_SIGN=14]="SCRIPT_DATA_LESS_THAN_SIGN",State2[State2.SCRIPT_DATA_END_TAG_OPEN=15]="SCRIPT_DATA_END_TAG_OPEN",State2[State2.SCRIPT_DATA_END_TAG_NAME=16]="SCRIPT_DATA_END_TAG_NAME",State2[State2.SCRIPT_DATA_ESCAPE_START=17]="SCRIPT_DATA_ESCAPE_START",State2[State2.SCRIPT_DATA_ESCAPE_START_DASH=18]="SCRIPT_DATA_ESCAPE_START_DASH",State2[State2.SCRIPT_DATA_ESCAPED=19]="SCRIPT_DATA_ESCAPED",State2[State2.SCRIPT_DATA_ESCAPED_DASH=20]="SCRIPT_DATA_ESCAPED_DASH",State2[State2.SCRIPT_DATA_ESCAPED_DASH_DASH=21]="SCRIPT_DATA_ESCAPED_DASH_DASH",State2[State2.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN=22]="SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN",State2[State2.SCRIPT_DATA_ESCAPED_END_TAG_OPEN=23]="SCRIPT_DATA_ESCAPED_END_TAG_OPEN",State2[State2.SCRIPT_DATA_ESCAPED_END_TAG_NAME=24]="SCRIPT_DATA_ESCAPED_END_TAG_NAME",State2[State2.SCRIPT_DATA_DOUBLE_ESCAPE_START=25]="SCRIPT_DATA_DOUBLE_ESCAPE_START",State2[State2.SCRIPT_DATA_DOUBLE_ESCAPED=26]="SCRIPT_DATA_DOUBLE_ESCAPED",State2[State2.SCRIPT_DATA_DOUBLE_ESCAPED_DASH=27]="SCRIPT_DATA_DOUBLE_ESCAPED_DASH",State2[State2.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH=28]="SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH",State2[State2.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN=29]="SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN",State2[State2.SCRIPT_DATA_DOUBLE_ESCAPE_END=30]="SCRIPT_DATA_DOUBLE_ESCAPE_END",State2[State2.BEFORE_ATTRIBUTE_NAME=31]="BEFORE_ATTRIBUTE_NAME",State2[State2.ATTRIBUTE_NAME=32]="ATTRIBUTE_NAME",State2[State2.AFTER_ATTRIBUTE_NAME=33]="AFTER_ATTRIBUTE_NAME",State2[State2.BEFORE_ATTRIBUTE_VALUE=34]="BEFORE_ATTRIBUTE_VALUE",State2[State2.ATTRIBUTE_VALUE_DOUBLE_QUOTED=35]="ATTRIBUTE_VALUE_DOUBLE_QUOTED",State2[State2.ATTRIBUTE_VALUE_SINGLE_QUOTED=36]="ATTRIBUTE_VALUE_SINGLE_QUOTED",State2[State2.ATTRIBUTE_VALUE_UNQUOTED=37]="ATTRIBUTE_VALUE_UNQUOTED",State2[State2.AFTER_ATTRIBUTE_VALUE_QUOTED=38]="AFTER_ATTRIBUTE_VALUE_QUOTED",State2[State2.SELF_CLOSING_START_TAG=39]="SELF_CLOSING_START_TAG",State2[State2.BOGUS_COMMENT=40]="BOGUS_COMMENT",State2[State2.MARKUP_DECLARATION_OPEN=41]="MARKUP_DECLARATION_OPEN",State2[State2.COMMENT_START=42]="COMMENT_START",State2[State2.COMMENT_START_DASH=43]="COMMENT_START_DASH",State2[State2.COMMENT=44]="COMMENT",State2[State2.COMMENT_LESS_THAN_SIGN=45]="COMMENT_LESS_THAN_SIGN",State2[State2.COMMENT_LESS_THAN_SIGN_BANG=46]="COMMENT_LESS_THAN_SIGN_BANG",State2[State2.COMMENT_LESS_THAN_SIGN_BANG_DASH=47]="COMMENT_LESS_THAN_SIGN_BANG_DASH",State2[State2.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH=48]="COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH",State2[State2.COMMENT_END_DASH=49]="COMMENT_END_DASH",State2[State2.COMMENT_END=50]="COMMENT_END",State2[State2.COMMENT_END_BANG=51]="COMMENT_END_BANG",State2[State2.DOCTYPE=52]="DOCTYPE",State2[State2.BEFORE_DOCTYPE_NAME=53]="BEFORE_DOCTYPE_NAME",State2[State2.DOCTYPE_NAME=54]="DOCTYPE_NAME",State2[State2.AFTER_DOCTYPE_NAME=55]="AFTER_DOCTYPE_NAME",State2[State2.AFTER_DOCTYPE_PUBLIC_KEYWORD=56]="AFTER_DOCTYPE_PUBLIC_KEYWORD",State2[State2.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER=57]="BEFORE_DOCTYPE_PUBLIC_IDENTIFIER",State2[State2.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED=58]="DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED",State2[State2.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED=59]="DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED",State2[State2.AFTER_DOCTYPE_PUBLIC_IDENTIFIER=60]="AFTER_DOCTYPE_PUBLIC_IDENTIFIER",State2[State2.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS=61]="BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS",State2[State2.AFTER_DOCTYPE_SYSTEM_KEYWORD=62]="AFTER_DOCTYPE_SYSTEM_KEYWORD",State2[State2.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER=63]="BEFORE_DOCTYPE_SYSTEM_IDENTIFIER",State2[State2.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED=64]="DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED",State2[State2.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED=65]="DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED",State2[State2.AFTER_DOCTYPE_SYSTEM_IDENTIFIER=66]="AFTER_DOCTYPE_SYSTEM_IDENTIFIER",State2[State2.BOGUS_DOCTYPE=67]="BOGUS_DOCTYPE",State2[State2.CDATA_SECTION=68]="CDATA_SECTION",State2[State2.CDATA_SECTION_BRACKET=69]="CDATA_SECTION_BRACKET",State2[State2.CDATA_SECTION_END=70]="CDATA_SECTION_END",State2[State2.CHARACTER_REFERENCE=71]="CHARACTER_REFERENCE",State2[State2.AMBIGUOUS_AMPERSAND=72]="AMBIGUOUS_AMPERSAND";var TokenizerMode={DATA:State.DATA,RCDATA:State.RCDATA,RAWTEXT:State.RAWTEXT,SCRIPT_DATA:State.SCRIPT_DATA,PLAINTEXT:State.PLAINTEXT,CDATA_SECTION:State.CDATA_SECTION};function isAsciiUpper(e){return e>=CODE_POINTS.LATIN_CAPITAL_A&&e<=CODE_POINTS.LATIN_CAPITAL_Z}function isAsciiLetter(e){return function(e){return e>=CODE_POINTS.LATIN_SMALL_A&&e<=CODE_POINTS.LATIN_SMALL_Z}(e)||isAsciiUpper(e)}function isAsciiAlphaNumeric2(e){return isAsciiLetter(e)||function(e){return e>=CODE_POINTS.DIGIT_0&&e<=CODE_POINTS.DIGIT_9}(e)}function toAsciiLower(e){return e+32}function isWhitespace(e){return e===CODE_POINTS.SPACE||e===CODE_POINTS.LINE_FEED||e===CODE_POINTS.TABULATION||e===CODE_POINTS.FORM_FEED}function isScriptDataDoubleEscapeSequenceEnd(e){return isWhitespace(e)||e===CODE_POINTS.SOLIDUS||e===CODE_POINTS.GREATER_THAN_SIGN}var EntryType,EntryType2,Tokenizer=class{constructor(e,t){this.options=e,this.handler=t,this.paused=!1,this.inLoop=!1,this.inForeignNode=!1,this.lastStartTagName="",this.active=!1,this.state=State.DATA,this.returnState=State.DATA,this.entityStartPos=0,this.consumedAfterSnapshot=-1,this.currentCharacterToken=null,this.currentToken=null,this.currentAttr={name:"",value:""},this.preprocessor=new Preprocessor(t),this.currentLocation=this.getCurrentLocation(-1),this.entityDecoder=new EntityDecoder(htmlDecodeTree,(e,t)=>{this.preprocessor.pos=this.entityStartPos+t-1,this._flushCodePointConsumedAsCharacterReference(e)},t.onParseError?{missingSemicolonAfterCharacterReference:()=>{this._err(ERR.missingSemicolonAfterCharacterReference,1)},absenceOfDigitsInNumericCharacterReference:e=>{this._err(ERR.absenceOfDigitsInNumericCharacterReference,this.entityStartPos-this.preprocessor.pos+e)},validateNumericCharacterReference:e=>{const t=function(e){return e===CODE_POINTS.NULL?ERR.nullCharacterReference:e>1114111?ERR.characterReferenceOutsideUnicodeRange:isSurrogate(e)?ERR.surrogateCharacterReference:isUndefinedCodePoint(e)?ERR.noncharacterCharacterReference:isControlCodePoint(e)||e===CODE_POINTS.CARRIAGE_RETURN?ERR.controlCharacterReference:null}(e);t&&this._err(t,1)}}:void 0)}_err(e,t=0){var n,r;null===(r=(n=this.handler).onParseError)||void 0===r||r.call(n,this.preprocessor.getError(e,t))}getCurrentLocation(e){return this.options.sourceCodeLocationInfo?{startLine:this.preprocessor.line,startCol:this.preprocessor.col-e,startOffset:this.preprocessor.offset-e,endLine:-1,endCol:-1,endOffset:-1}:null}_runParsingLoop(){if(!this.inLoop){for(this.inLoop=!0;this.active&&!this.paused;){this.consumedAfterSnapshot=0;const e=this._consume();this._ensureHibernation()||this._callState(e)}this.inLoop=!1}}pause(){this.paused=!0}resume(e){if(!this.paused)throw new Error("Parser was already resumed");this.paused=!1,this.inLoop||(this._runParsingLoop(),this.paused||null==e||e())}write(e,t,n){this.active=!0,this.preprocessor.write(e,t),this._runParsingLoop(),this.paused||null==n||n()}insertHtmlAtCurrentPos(e){this.active=!0,this.preprocessor.insertHtmlAtCurrentPos(e),this._runParsingLoop()}_ensureHibernation(){return!!this.preprocessor.endOfChunkHit&&(this.preprocessor.retreat(this.consumedAfterSnapshot),this.consumedAfterSnapshot=0,this.active=!1,!0)}_consume(){return this.consumedAfterSnapshot++,this.preprocessor.advance()}_advanceBy(e){this.consumedAfterSnapshot+=e;for(let t=0;t<e;t++)this.preprocessor.advance()}_consumeSequenceIfMatch(e,t){return!!this.preprocessor.startsWith(e,t)&&(this._advanceBy(e.length-1),!0)}_createStartTagToken(){this.currentToken={type:TokenType.START_TAG,tagName:"",tagID:TAG_ID.UNKNOWN,selfClosing:!1,ackSelfClosing:!1,attrs:[],location:this.getCurrentLocation(1)}}_createEndTagToken(){this.currentToken={type:TokenType.END_TAG,tagName:"",tagID:TAG_ID.UNKNOWN,selfClosing:!1,ackSelfClosing:!1,attrs:[],location:this.getCurrentLocation(2)}}_createCommentToken(e){this.currentToken={type:TokenType.COMMENT,data:"",location:this.getCurrentLocation(e)}}_createDoctypeToken(e){this.currentToken={type:TokenType.DOCTYPE,name:e,forceQuirks:!1,publicId:null,systemId:null,location:this.currentLocation}}_createCharacterToken(e,t){this.currentCharacterToken={type:e,chars:t,location:this.currentLocation}}_createAttr(e){this.currentAttr={name:e,value:""},this.currentLocation=this.getCurrentLocation(0)}_leaveAttrName(){var e,t;const n=this.currentToken;null===getTokenAttr(n,this.currentAttr.name)?(n.attrs.push(this.currentAttr),n.location&&this.currentLocation&&((null!==(e=(t=n.location).attrs)&&void 0!==e?e:t.attrs=Object.create(null))[this.currentAttr.name]=this.currentLocation,this._leaveAttrValue())):this._err(ERR.duplicateAttribute)}_leaveAttrValue(){this.currentLocation&&(this.currentLocation.endLine=this.preprocessor.line,this.currentLocation.endCol=this.preprocessor.col,this.currentLocation.endOffset=this.preprocessor.offset)}prepareToken(e){this._emitCurrentCharacterToken(e.location),this.currentToken=null,e.location&&(e.location.endLine=this.preprocessor.line,e.location.endCol=this.preprocessor.col+1,e.location.endOffset=this.preprocessor.offset+1),this.currentLocation=this.getCurrentLocation(-1)}emitCurrentTagToken(){const e=this.currentToken;this.prepareToken(e),e.tagID=getTagID(e.tagName),e.type===TokenType.START_TAG?(this.lastStartTagName=e.tagName,this.handler.onStartTag(e)):(e.attrs.length>0&&this._err(ERR.endTagWithAttributes),e.selfClosing&&this._err(ERR.endTagWithTrailingSolidus),this.handler.onEndTag(e)),this.preprocessor.dropParsedChunk()}emitCurrentComment(e){this.prepareToken(e),this.handler.onComment(e),this.preprocessor.dropParsedChunk()}emitCurrentDoctype(e){this.prepareToken(e),this.handler.onDoctype(e),this.preprocessor.dropParsedChunk()}_emitCurrentCharacterToken(e){if(this.currentCharacterToken){switch(e&&this.currentCharacterToken.location&&(this.currentCharacterToken.location.endLine=e.startLine,this.currentCharacterToken.location.endCol=e.startCol,this.currentCharacterToken.location.endOffset=e.startOffset),this.currentCharacterToken.type){case TokenType.CHARACTER:this.handler.onCharacter(this.currentCharacterToken);break;case TokenType.NULL_CHARACTER:this.handler.onNullCharacter(this.currentCharacterToken);break;case TokenType.WHITESPACE_CHARACTER:this.handler.onWhitespaceCharacter(this.currentCharacterToken)}this.currentCharacterToken=null}}_emitEOFToken(){const e=this.getCurrentLocation(0);e&&(e.endLine=e.startLine,e.endCol=e.startCol,e.endOffset=e.startOffset),this._emitCurrentCharacterToken(e),this.handler.onEof({type:TokenType.EOF,location:e}),this.active=!1}_appendCharToCurrentCharacterToken(e,t){if(this.currentCharacterToken){if(this.currentCharacterToken.type===e)return void(this.currentCharacterToken.chars+=t);this.currentLocation=this.getCurrentLocation(0),this._emitCurrentCharacterToken(this.currentLocation),this.preprocessor.dropParsedChunk()}this._createCharacterToken(e,t)}_emitCodePoint(e){const t=isWhitespace(e)?TokenType.WHITESPACE_CHARACTER:e===CODE_POINTS.NULL?TokenType.NULL_CHARACTER:TokenType.CHARACTER;this._appendCharToCurrentCharacterToken(t,String.fromCodePoint(e))}_emitChars(e){this._appendCharToCurrentCharacterToken(TokenType.CHARACTER,e)}_startCharacterReference(){this.returnState=this.state,this.state=State.CHARACTER_REFERENCE,this.entityStartPos=this.preprocessor.pos,this.entityDecoder.startEntity(this._isCharacterReferenceInAttribute()?DecodingMode.Attribute:DecodingMode.Legacy)}_isCharacterReferenceInAttribute(){return this.returnState===State.ATTRIBUTE_VALUE_DOUBLE_QUOTED||this.returnState===State.ATTRIBUTE_VALUE_SINGLE_QUOTED||this.returnState===State.ATTRIBUTE_VALUE_UNQUOTED}_flushCodePointConsumedAsCharacterReference(e){this._isCharacterReferenceInAttribute()?this.currentAttr.value+=String.fromCodePoint(e):this._emitCodePoint(e)}_callState(e){switch(this.state){case State.DATA:this._stateData(e);break;case State.RCDATA:this._stateRcdata(e);break;case State.RAWTEXT:this._stateRawtext(e);break;case State.SCRIPT_DATA:this._stateScriptData(e);break;case State.PLAINTEXT:this._statePlaintext(e);break;case State.TAG_OPEN:this._stateTagOpen(e);break;case State.END_TAG_OPEN:this._stateEndTagOpen(e);break;case State.TAG_NAME:this._stateTagName(e);break;case State.RCDATA_LESS_THAN_SIGN:this._stateRcdataLessThanSign(e);break;case State.RCDATA_END_TAG_OPEN:this._stateRcdataEndTagOpen(e);break;case State.RCDATA_END_TAG_NAME:this._stateRcdataEndTagName(e);break;case State.RAWTEXT_LESS_THAN_SIGN:this._stateRawtextLessThanSign(e);break;case State.RAWTEXT_END_TAG_OPEN:this._stateRawtextEndTagOpen(e);break;case State.RAWTEXT_END_TAG_NAME:this._stateRawtextEndTagName(e);break;case State.SCRIPT_DATA_LESS_THAN_SIGN:this._stateScriptDataLessThanSign(e);break;case State.SCRIPT_DATA_END_TAG_OPEN:this._stateScriptDataEndTagOpen(e);break;case State.SCRIPT_DATA_END_TAG_NAME:this._stateScriptDataEndTagName(e);break;case State.SCRIPT_DATA_ESCAPE_START:this._stateScriptDataEscapeStart(e);break;case State.SCRIPT_DATA_ESCAPE_START_DASH:this._stateScriptDataEscapeStartDash(e);break;case State.SCRIPT_DATA_ESCAPED:this._stateScriptDataEscaped(e);break;case State.SCRIPT_DATA_ESCAPED_DASH:this._stateScriptDataEscapedDash(e);break;case State.SCRIPT_DATA_ESCAPED_DASH_DASH:this._stateScriptDataEscapedDashDash(e);break;case State.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN:this._stateScriptDataEscapedLessThanSign(e);break;case State.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:this._stateScriptDataEscapedEndTagOpen(e);break;case State.SCRIPT_DATA_ESCAPED_END_TAG_NAME:this._stateScriptDataEscapedEndTagName(e);break;case State.SCRIPT_DATA_DOUBLE_ESCAPE_START:this._stateScriptDataDoubleEscapeStart(e);break;case State.SCRIPT_DATA_DOUBLE_ESCAPED:this._stateScriptDataDoubleEscaped(e);break;case State.SCRIPT_DATA_DOUBLE_ESCAPED_DASH:this._stateScriptDataDoubleEscapedDash(e);break;case State.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH:this._stateScriptDataDoubleEscapedDashDash(e);break;case State.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN:this._stateScriptDataDoubleEscapedLessThanSign(e);break;case State.SCRIPT_DATA_DOUBLE_ESCAPE_END:this._stateScriptDataDoubleEscapeEnd(e);break;case State.BEFORE_ATTRIBUTE_NAME:this._stateBeforeAttributeName(e);break;case State.ATTRIBUTE_NAME:this._stateAttributeName(e);break;case State.AFTER_ATTRIBUTE_NAME:this._stateAfterAttributeName(e);break;case State.BEFORE_ATTRIBUTE_VALUE:this._stateBeforeAttributeValue(e);break;case State.ATTRIBUTE_VALUE_DOUBLE_QUOTED:this._stateAttributeValueDoubleQuoted(e);break;case State.ATTRIBUTE_VALUE_SINGLE_QUOTED:this._stateAttributeValueSingleQuoted(e);break;case State.ATTRIBUTE_VALUE_UNQUOTED:this._stateAttributeValueUnquoted(e);break;case State.AFTER_ATTRIBUTE_VALUE_QUOTED:this._stateAfterAttributeValueQuoted(e);break;case State.SELF_CLOSING_START_TAG:this._stateSelfClosingStartTag(e);break;case State.BOGUS_COMMENT:this._stateBogusComment(e);break;case State.MARKUP_DECLARATION_OPEN:this._stateMarkupDeclarationOpen(e);break;case State.COMMENT_START:this._stateCommentStart(e);break;case State.COMMENT_START_DASH:this._stateCommentStartDash(e);break;case State.COMMENT:this._stateComment(e);break;case State.COMMENT_LESS_THAN_SIGN:this._stateCommentLessThanSign(e);break;case State.COMMENT_LESS_THAN_SIGN_BANG:this._stateCommentLessThanSignBang(e);break;case State.COMMENT_LESS_THAN_SIGN_BANG_DASH:this._stateCommentLessThanSignBangDash(e);break;case State.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:this._stateCommentLessThanSignBangDashDash(e);break;case State.COMMENT_END_DASH:this._stateCommentEndDash(e);break;case State.COMMENT_END:this._stateCommentEnd(e);break;case State.COMMENT_END_BANG:this._stateCommentEndBang(e);break;case State.DOCTYPE:this._stateDoctype(e);break;case State.BEFORE_DOCTYPE_NAME:this._stateBeforeDoctypeName(e);break;case State.DOCTYPE_NAME:this._stateDoctypeName(e);break;case State.AFTER_DOCTYPE_NAME:this._stateAfterDoctypeName(e);break;case State.AFTER_DOCTYPE_PUBLIC_KEYWORD:this._stateAfterDoctypePublicKeyword(e);break;case State.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER:this._stateBeforeDoctypePublicIdentifier(e);break;case State.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED:this._stateDoctypePublicIdentifierDoubleQuoted(e);break;case State.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED:this._stateDoctypePublicIdentifierSingleQuoted(e);break;case State.AFTER_DOCTYPE_PUBLIC_IDENTIFIER:this._stateAfterDoctypePublicIdentifier(e);break;case State.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS:this._stateBetweenDoctypePublicAndSystemIdentifiers(e);break;case State.AFTER_DOCTYPE_SYSTEM_KEYWORD:this._stateAfterDoctypeSystemKeyword(e);break;case State.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER:this._stateBeforeDoctypeSystemIdentifier(e);break;case State.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED:this._stateDoctypeSystemIdentifierDoubleQuoted(e);break;case State.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED:this._stateDoctypeSystemIdentifierSingleQuoted(e);break;case State.AFTER_DOCTYPE_SYSTEM_IDENTIFIER:this._stateAfterDoctypeSystemIdentifier(e);break;case State.BOGUS_DOCTYPE:this._stateBogusDoctype(e);break;case State.CDATA_SECTION:this._stateCdataSection(e);break;case State.CDATA_SECTION_BRACKET:this._stateCdataSectionBracket(e);break;case State.CDATA_SECTION_END:this._stateCdataSectionEnd(e);break;case State.CHARACTER_REFERENCE:this._stateCharacterReference();break;case State.AMBIGUOUS_AMPERSAND:this._stateAmbiguousAmpersand(e);break;default:throw new Error("Unknown state")}}_stateData(e){switch(e){case CODE_POINTS.LESS_THAN_SIGN:this.state=State.TAG_OPEN;break;case CODE_POINTS.AMPERSAND:this._startCharacterReference();break;case CODE_POINTS.NULL:this._err(ERR.unexpectedNullCharacter),this._emitCodePoint(e);break;case CODE_POINTS.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateRcdata(e){switch(e){case CODE_POINTS.AMPERSAND:this._startCharacterReference();break;case CODE_POINTS.LESS_THAN_SIGN:this.state=State.RCDATA_LESS_THAN_SIGN;break;case CODE_POINTS.NULL:this._err(ERR.unexpectedNullCharacter),this._emitChars("�");break;case CODE_POINTS.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateRawtext(e){switch(e){case CODE_POINTS.LESS_THAN_SIGN:this.state=State.RAWTEXT_LESS_THAN_SIGN;break;case CODE_POINTS.NULL:this._err(ERR.unexpectedNullCharacter),this._emitChars("�");break;case CODE_POINTS.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateScriptData(e){switch(e){case CODE_POINTS.LESS_THAN_SIGN:this.state=State.SCRIPT_DATA_LESS_THAN_SIGN;break;case CODE_POINTS.NULL:this._err(ERR.unexpectedNullCharacter),this._emitChars("�");break;case CODE_POINTS.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_statePlaintext(e){switch(e){case CODE_POINTS.NULL:this._err(ERR.unexpectedNullCharacter),this._emitChars("�");break;case CODE_POINTS.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateTagOpen(e){if(isAsciiLetter(e))this._createStartTagToken(),this.state=State.TAG_NAME,this._stateTagName(e);else switch(e){case CODE_POINTS.EXCLAMATION_MARK:this.state=State.MARKUP_DECLARATION_OPEN;break;case CODE_POINTS.SOLIDUS:this.state=State.END_TAG_OPEN;break;case CODE_POINTS.QUESTION_MARK:this._err(ERR.unexpectedQuestionMarkInsteadOfTagName),this._createCommentToken(1),this.state=State.BOGUS_COMMENT,this._stateBogusComment(e);break;case CODE_POINTS.EOF:this._err(ERR.eofBeforeTagName),this._emitChars("<"),this._emitEOFToken();break;default:this._err(ERR.invalidFirstCharacterOfTagName),this._emitChars("<"),this.state=State.DATA,this._stateData(e)}}_stateEndTagOpen(e){if(isAsciiLetter(e))this._createEndTagToken(),this.state=State.TAG_NAME,this._stateTagName(e);else switch(e){case CODE_POINTS.GREATER_THAN_SIGN:this._err(ERR.missingEndTagName),this.state=State.DATA;break;case CODE_POINTS.EOF:this._err(ERR.eofBeforeTagName),this._emitChars("</"),this._emitEOFToken();break;default:this._err(ERR.invalidFirstCharacterOfTagName),this._createCommentToken(2),this.state=State.BOGUS_COMMENT,this._stateBogusComment(e)}}_stateTagName(e){const t=this.currentToken;switch(e){case CODE_POINTS.SPACE:case CODE_POINTS.LINE_FEED:case CODE_POINTS.TABULATION:case CODE_POINTS.FORM_FEED:this.state=State.BEFORE_ATTRIBUTE_NAME;break;case CODE_POINTS.SOLIDUS:this.state=State.SELF_CLOSING_START_TAG;break;case CODE_POINTS.GREATER_THAN_SIGN:this.state=State.DATA,this.emitCurrentTagToken();break;case CODE_POINTS.NULL:this._err(ERR.unexpectedNullCharacter),t.tagName+="�";break;case CODE_POINTS.EOF:this._err(ERR.eofInTag),this._emitEOFToken();break;default:t.tagName+=String.fromCodePoint(isAsciiUpper(e)?toAsciiLower(e):e)}}_stateRcdataLessThanSign(e){e===CODE_POINTS.SOLIDUS?this.state=State.RCDATA_END_TAG_OPEN:(this._emitChars("<"),this.state=State.RCDATA,this._stateRcdata(e))}_stateRcdataEndTagOpen(e){isAsciiLetter(e)?(this.state=State.RCDATA_END_TAG_NAME,this._stateRcdataEndTagName(e)):(this._emitChars("</"),this.state=State.RCDATA,this._stateRcdata(e))}handleSpecialEndTag(e){if(!this.preprocessor.startsWith(this.lastStartTagName,!1))return!this._ensureHibernation();switch(this._createEndTagToken(),this.currentToken.tagName=this.lastStartTagName,this.preprocessor.peek(this.lastStartTagName.length)){case CODE_POINTS.SPACE:case CODE_POINTS.LINE_FEED:case CODE_POINTS.TABULATION:case CODE_POINTS.FORM_FEED:return this._advanceBy(this.lastStartTagName.length),this.state=State.BEFORE_ATTRIBUTE_NAME,!1;case CODE_POINTS.SOLIDUS:return this._advanceBy(this.lastStartTagName.length),this.state=State.SELF_CLOSING_START_TAG,!1;case CODE_POINTS.GREATER_THAN_SIGN:return this._advanceBy(this.lastStartTagName.length),this.emitCurrentTagToken(),this.state=State.DATA,!1;default:return!this._ensureHibernation()}}_stateRcdataEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars("</"),this.state=State.RCDATA,this._stateRcdata(e))}_stateRawtextLessThanSign(e){e===CODE_POINTS.SOLIDUS?this.state=State.RAWTEXT_END_TAG_OPEN:(this._emitChars("<"),this.state=State.RAWTEXT,this._stateRawtext(e))}_stateRawtextEndTagOpen(e){isAsciiLetter(e)?(this.state=State.RAWTEXT_END_TAG_NAME,this._stateRawtextEndTagName(e)):(this._emitChars("</"),this.state=State.RAWTEXT,this._stateRawtext(e))}_stateRawtextEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars("</"),this.state=State.RAWTEXT,this._stateRawtext(e))}_stateScriptDataLessThanSign(e){switch(e){case CODE_POINTS.SOLIDUS:this.state=State.SCRIPT_DATA_END_TAG_OPEN;break;case CODE_POINTS.EXCLAMATION_MARK:this.state=State.SCRIPT_DATA_ESCAPE_START,this._emitChars("<!");break;default:this._emitChars("<"),this.state=State.SCRIPT_DATA,this._stateScriptData(e)}}_stateScriptDataEndTagOpen(e){isAsciiLetter(e)?(this.state=State.SCRIPT_DATA_END_TAG_NAME,this._stateScriptDataEndTagName(e)):(this._emitChars("</"),this.state=State.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars("</"),this.state=State.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEscapeStart(e){e===CODE_POINTS.HYPHEN_MINUS?(this.state=State.SCRIPT_DATA_ESCAPE_START_DASH,this._emitChars("-")):(this.state=State.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEscapeStartDash(e){e===CODE_POINTS.HYPHEN_MINUS?(this.state=State.SCRIPT_DATA_ESCAPED_DASH_DASH,this._emitChars("-")):(this.state=State.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEscaped(e){switch(e){case CODE_POINTS.HYPHEN_MINUS:this.state=State.SCRIPT_DATA_ESCAPED_DASH,this._emitChars("-");break;case CODE_POINTS.LESS_THAN_SIGN:this.state=State.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break;case CODE_POINTS.NULL:this._err(ERR.unexpectedNullCharacter),this._emitChars("�");break;case CODE_POINTS.EOF:this._err(ERR.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateScriptDataEscapedDash(e){switch(e){case CODE_POINTS.HYPHEN_MINUS:this.state=State.SCRIPT_DATA_ESCAPED_DASH_DASH,this._emitChars("-");break;case CODE_POINTS.LESS_THAN_SIGN:this.state=State.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break;case CODE_POINTS.NULL:this._err(ERR.unexpectedNullCharacter),this.state=State.SCRIPT_DATA_ESCAPED,this._emitChars("�");break;case CODE_POINTS.EOF:this._err(ERR.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this.state=State.SCRIPT_DATA_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataEscapedDashDash(e){switch(e){case CODE_POINTS.HYPHEN_MINUS:this._emitChars("-");break;case CODE_POINTS.LESS_THAN_SIGN:this.state=State.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break;case CODE_POINTS.GREATER_THAN_SIGN:this.state=State.SCRIPT_DATA,this._emitChars(">");break;case CODE_POINTS.NULL:this._err(ERR.unexpectedNullCharacter),this.state=State.SCRIPT_DATA_ESCAPED,this._emitChars("�");break;case CODE_POINTS.EOF:this._err(ERR.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this.state=State.SCRIPT_DATA_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataEscapedLessThanSign(e){e===CODE_POINTS.SOLIDUS?this.state=State.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:isAsciiLetter(e)?(this._emitChars("<"),this.state=State.SCRIPT_DATA_DOUBLE_ESCAPE_START,this._stateScriptDataDoubleEscapeStart(e)):(this._emitChars("<"),this.state=State.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataEscapedEndTagOpen(e){isAsciiLetter(e)?(this.state=State.SCRIPT_DATA_ESCAPED_END_TAG_NAME,this._stateScriptDataEscapedEndTagName(e)):(this._emitChars("</"),this.state=State.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataEscapedEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars("</"),this.state=State.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataDoubleEscapeStart(e){if(this.preprocessor.startsWith("script",!1)&&isScriptDataDoubleEscapeSequenceEnd(this.preprocessor.peek(6))){this._emitCodePoint(e);for(let e=0;e<6;e++)this._emitCodePoint(this._consume());this.state=State.SCRIPT_DATA_DOUBLE_ESCAPED}else this._ensureHibernation()||(this.state=State.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataDoubleEscaped(e){switch(e){case CODE_POINTS.HYPHEN_MINUS:this.state=State.SCRIPT_DATA_DOUBLE_ESCAPED_DASH,this._emitChars("-");break;case CODE_POINTS.LESS_THAN_SIGN:this.state=State.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break;case CODE_POINTS.NULL:this._err(ERR.unexpectedNullCharacter),this._emitChars("�");break;case CODE_POINTS.EOF:this._err(ERR.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateScriptDataDoubleEscapedDash(e){switch(e){case CODE_POINTS.HYPHEN_MINUS:this.state=State.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH,this._emitChars("-");break;case CODE_POINTS.LESS_THAN_SIGN:this.state=State.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break;case CODE_POINTS.NULL:this._err(ERR.unexpectedNullCharacter),this.state=State.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars("�");break;case CODE_POINTS.EOF:this._err(ERR.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this.state=State.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataDoubleEscapedDashDash(e){switch(e){case CODE_POINTS.HYPHEN_MINUS:this._emitChars("-");break;case CODE_POINTS.LESS_THAN_SIGN:this.state=State.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break;case CODE_POINTS.GREATER_THAN_SIGN:this.state=State.SCRIPT_DATA,this._emitChars(">");break;case CODE_POINTS.NULL:this._err(ERR.unexpectedNullCharacter),this.state=State.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars("�");break;case CODE_POINTS.EOF:this._err(ERR.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this.state=State.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataDoubleEscapedLessThanSign(e){e===CODE_POINTS.SOLIDUS?(this.state=State.SCRIPT_DATA_DOUBLE_ESCAPE_END,this._emitChars("/")):(this.state=State.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(e))}_stateScriptDataDoubleEscapeEnd(e){if(this.preprocessor.startsWith("script",!1)&&isScriptDataDoubleEscapeSequenceEnd(this.preprocessor.peek(6))){this._emitCodePoint(e);for(let e=0;e<6;e++)this._emitCodePoint(this._consume());this.state=State.SCRIPT_DATA_ESCAPED}else this._ensureHibernation()||(this.state=State.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(e))}_stateBeforeAttributeName(e){switch(e){case CODE_POINTS.SPACE:case CODE_POINTS.LINE_FEED:case CODE_POINTS.TABULATION:case CODE_POINTS.FORM_FEED:break;case CODE_POINTS.SOLIDUS:case CODE_POINTS.GREATER_THAN_SIGN:case CODE_POINTS.EOF:this.state=State.AFTER_ATTRIBUTE_NAME,this._stateAfterAttributeName(e);break;case CODE_POINTS.EQUALS_SIGN:this._err(ERR.unexpectedEqualsSignBeforeAttributeName),this._createAttr("="),this.state=State.ATTRIBUTE_NAME;break;default:this._createAttr(""),this.state=State.ATTRIBUTE_NAME,this._stateAttributeName(e)}}_stateAttributeName(e){switch(e){case CODE_POINTS.SPACE:case CODE_POINTS.LINE_FEED:case CODE_POINTS.TABULATION:case CODE_POINTS.FORM_FEED:case CODE_POINTS.SOLIDUS:case CODE_POINTS.GREATER_THAN_SIGN:case CODE_POINTS.EOF:this._leaveAttrName(),this.state=State.AFTER_ATTRIBUTE_NAME,this._stateAfterAttributeName(e);break;case CODE_POINTS.EQUALS_SIGN:this._leaveAttrName(),this.state=State.BEFORE_ATTRIBUTE_VALUE;break;case CODE_POINTS.QUOTATION_MARK:case CODE_POINTS.APOSTROPHE:case CODE_POINTS.LESS_THAN_SIGN:this._err(ERR.unexpectedCharacterInAttributeName),this.currentAttr.name+=String.fromCodePoint(e);break;case CODE_POINTS.NULL:this._err(ERR.unexpectedNullCharacter),this.currentAttr.name+="�";break;default:this.currentAttr.name+=String.fromCodePoint(isAsciiUpper(e)?toAsciiLower(e):e)}}_stateAfterAttributeName(e){switch(e){case CODE_POINTS.SPACE:case CODE_POINTS.LINE_FEED:case CODE_POINTS.TABULATION:case CODE_POINTS.FORM_FEED:break;case CODE_POINTS.SOLIDUS:this.state=State.SELF_CLOSING_START_TAG;break;case CODE_POINTS.EQUALS_SIGN:this.state=State.BEFORE_ATTRIBUTE_VALUE;break;case CODE_POINTS.GREATER_THAN_SIGN:this.state=State.DATA,this.emitCurrentTagToken();break;case CODE_POINTS.EOF:this._err(ERR.eofInTag),this._emitEOFToken();break;default:this._createAttr(""),this.state=State.ATTRIBUTE_NAME,this._stateAttributeName(e)}}_stateBeforeAttributeValue(e){switch(e){case CODE_POINTS.SPACE:case CODE_POINTS.LINE_FEED:case CODE_POINTS.TABULATION:case CODE_POINTS.FORM_FEED:break;case CODE_POINTS.QUOTATION_MARK:this.state=State.ATTRIBUTE_VALUE_DOUBLE_QUOTED;break;case CODE_POINTS.APOSTROPHE:this.state=State.ATTRIBUTE_VALUE_SINGLE_QUOTED;break;case CODE_POINTS.GREATER_THAN_SIGN:this._err(ERR.missingAttributeValue),this.state=State.DATA,this.emitCurrentTagToken();break;default:this.state=State.ATTRIBUTE_VALUE_UNQUOTED,this._stateAttributeValueUnquoted(e)}}_stateAttributeValueDoubleQuoted(e){switch(e){case CODE_POINTS.QUOTATION_MARK:this.state=State.AFTER_ATTRIBUTE_VALUE_QUOTED;break;case CODE_POINTS.AMPERSAND:this._startCharacterReference();break;case CODE_POINTS.NULL:this._err(ERR.unexpectedNullCharacter),this.currentAttr.value+="�";break;case CODE_POINTS.EOF:this._err(ERR.eofInTag),this._emitEOFToken();break;default:this.currentAttr.value+=String.fromCodePoint(e)}}_stateAttributeValueSingleQuoted(e){switch(e){case CODE_POINTS.APOSTROPHE:this.state=State.AFTER_ATTRIBUTE_VALUE_QUOTED;break;case CODE_POINTS.AMPERSAND:this._startCharacterReference();break;case CODE_POINTS.NULL:this._err(ERR.unexpectedNullCharacter),this.currentAttr.value+="�";break;case CODE_POINTS.EOF:this._err(ERR.eofInTag),this._emitEOFToken();break;default:this.currentAttr.value+=String.fromCodePoint(e)}}_stateAttributeValueUnquoted(e){switch(e){case CODE_POINTS.SPACE:case CODE_POINTS.LINE_FEED:case CODE_POINTS.TABULATION:case CODE_POINTS.FORM_FEED:this._leaveAttrValue(),this.state=State.BEFORE_ATTRIBUTE_NAME;break;case CODE_POINTS.AMPERSAND:this._startCharacterReference();break;case CODE_POINTS.GREATER_THAN_SIGN:this._leaveAttrValue(),this.state=State.DATA,this.emitCurrentTagToken();break;case CODE_POINTS.NULL:this._err(ERR.unexpectedNullCharacter),this.currentAttr.value+="�";break;case CODE_POINTS.QUOTATION_MARK:case CODE_POINTS.APOSTROPHE:case CODE_POINTS.LESS_THAN_SIGN:case CODE_POINTS.EQUALS_SIGN:case CODE_POINTS.GRAVE_ACCENT:this._err(ERR.unexpectedCharacterInUnquotedAttributeValue),this.currentAttr.value+=String.fromCodePoint(e);break;case CODE_POINTS.EOF:this._err(ERR.eofInTag),this._emitEOFToken();break;default:this.currentAttr.value+=String.fromCodePoint(e)}}_stateAfterAttributeValueQuoted(e){switch(e){case CODE_POINTS.SPACE:case CODE_POINTS.LINE_FEED:case CODE_POINTS.TABULATION:case CODE_POINTS.FORM_FEED:this._leaveAttrValue(),this.state=State.BEFORE_ATTRIBUTE_NAME;break;case CODE_POINTS.SOLIDUS:this._leaveAttrValue(),this.state=State.SELF_CLOSING_START_TAG;break;case CODE_POINTS.GREATER_THAN_SIGN:this._leaveAttrValue(),this.state=State.DATA,this.emitCurrentTagToken();break;case CODE_POINTS.EOF:this._err(ERR.eofInTag),this._emitEOFToken();break;default:this._err(ERR.missingWhitespaceBetweenAttributes),this.state=State.BEFORE_ATTRIBUTE_NAME,this._stateBeforeAttributeName(e)}}_stateSelfClosingStartTag(e){switch(e){case CODE_POINTS.GREATER_THAN_SIGN:this.currentToken.selfClosing=!0,this.state=State.DATA,this.emitCurrentTagToken();break;case CODE_POINTS.EOF:this._err(ERR.eofInTag),this._emitEOFToken();break;default:this._err(ERR.unexpectedSolidusInTag),this.state=State.BEFORE_ATTRIBUTE_NAME,this._stateBeforeAttributeName(e)}}_stateBogusComment(e){const t=this.currentToken;switch(e){case CODE_POINTS.GREATER_THAN_SIGN:this.state=State.DATA,this.emitCurrentComment(t);break;case CODE_POINTS.EOF:this.emitCurrentComment(t),this._emitEOFToken();break;case CODE_POINTS.NULL:this._err(ERR.unexpectedNullCharacter),t.data+="�";break;default:t.data+=String.fromCodePoint(e)}}_stateMarkupDeclarationOpen(e){this._consumeSequenceIfMatch("--",!0)?(this._createCommentToken(3),this.state=State.COMMENT_START):this._consumeSequenceIfMatch("doctype",!1)?(this.currentLocation=this.getCurrentLocation(8),this.state=State.DOCTYPE):this._consumeSequenceIfMatch("[CDATA[",!0)?this.inForeignNode?this.state=State.CDATA_SECTION:(this._err(ERR.cdataInHtmlContent),this._createCommentToken(8),this.currentToken.data="[CDATA[",this.state=State.BOGUS_COMMENT):this._ensureHibernation()||(this._err(ERR.incorrectlyOpenedComment),this._createCommentToken(2),this.state=State.BOGUS_COMMENT,this._stateBogusComment(e))}_stateCommentStart(e){switch(e){case CODE_POINTS.HYPHEN_MINUS:this.state=State.COMMENT_START_DASH;break;case CODE_POINTS.GREATER_THAN_SIGN:{this._err(ERR.abruptClosingOfEmptyComment),this.state=State.DATA;const e=this.currentToken;this.emitCurrentComment(e);break}default:this.state=State.COMMENT,this._stateComment(e)}}_stateCommentStartDash(e){const t=this.currentToken;switch(e){case CODE_POINTS.HYPHEN_MINUS:this.state=State.COMMENT_END;break;case CODE_POINTS.GREATER_THAN_SIGN:this._err(ERR.abruptClosingOfEmptyComment),this.state=State.DATA,this.emitCurrentComment(t);break;case CODE_POINTS.EOF:this._err(ERR.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break;default:t.data+="-",this.state=State.COMMENT,this._stateComment(e)}}_stateComment(e){const t=this.currentToken;switch(e){case CODE_POINTS.HYPHEN_MINUS:this.state=State.COMMENT_END_DASH;break;case CODE_POINTS.LESS_THAN_SIGN:t.data+="<",this.state=State.COMMENT_LESS_THAN_SIGN;break;case CODE_POINTS.NULL:this._err(ERR.unexpectedNullCharacter),t.data+="�";break;case CODE_POINTS.EOF:this._err(ERR.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break;default:t.data+=String.fromCodePoint(e)}}_stateCommentLessThanSign(e){const t=this.currentToken;switch(e){case CODE_POINTS.EXCLAMATION_MARK:t.data+="!",this.state=State.COMMENT_LESS_THAN_SIGN_BANG;break;case CODE_POINTS.LESS_THAN_SIGN:t.data+="<";break;default:this.state=State.COMMENT,this._stateComment(e)}}_stateCommentLessThanSignBang(e){e===CODE_POINTS.HYPHEN_MINUS?this.state=State.COMMENT_LESS_THAN_SIGN_BANG_DASH:(this.state=State.COMMENT,this._stateComment(e))}_stateCommentLessThanSignBangDash(e){e===CODE_POINTS.HYPHEN_MINUS?this.state=State.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:(this.state=State.COMMENT_END_DASH,this._stateCommentEndDash(e))}_stateCommentLessThanSignBangDashDash(e){e!==CODE_POINTS.GREATER_THAN_SIGN&&e!==CODE_POINTS.EOF&&this._err(ERR.nestedComment),this.state=State.COMMENT_END,this._stateCommentEnd(e)}_stateCommentEndDash(e){const t=this.currentToken;switch(e){case CODE_POINTS.HYPHEN_MINUS:this.state=State.COMMENT_END;break;case CODE_POINTS.EOF:this._err(ERR.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break;default:t.data+="-",this.state=State.COMMENT,this._stateComment(e)}}_stateCommentEnd(e){const t=this.currentToken;switch(e){case CODE_POINTS.GREATER_THAN_SIGN:this.state=State.DATA,this.emitCurrentComment(t);break;case CODE_POINTS.EXCLAMATION_MARK:this.state=State.COMMENT_END_BANG;break;case CODE_POINTS.HYPHEN_MINUS:t.data+="-";break;case CODE_POINTS.EOF:this._err(ERR.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break;default:t.data+="--",this.state=State.COMMENT,this._stateComment(e)}}_stateCommentEndBang(e){const t=this.currentToken;switch(e){case CODE_POINTS.HYPHEN_MINUS:t.data+="--!",this.state=State.COMMENT_END_DASH;break;case CODE_POINTS.GREATER_THAN_SIGN:this._err(ERR.incorrectlyClosedComment),this.state=State.DATA,this.emitCurrentComment(t);break;case CODE_POINTS.EOF:this._err(ERR.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break;default:t.data+="--!",this.state=State.COMMENT,this._stateComment(e)}}_stateDoctype(e){switch(e){case CODE_POINTS.SPACE:case CODE_POINTS.LINE_FEED:case CODE_POINTS.TABULATION:case CODE_POINTS.FORM_FEED:this.state=State.BEFORE_DOCTYPE_NAME;break;case CODE_POINTS.GREATER_THAN_SIGN:this.state=State.BEFORE_DOCTYPE_NAME,this._stateBeforeDoctypeName(e);break;case CODE_POINTS.EOF:{this._err(ERR.eofInDoctype),this._createDoctypeToken(null);const e=this.currentToken;e.forceQuirks=!0,this.emitCurrentDoctype(e),this._emitEOFToken();break}default:this._err(ERR.missingWhitespaceBeforeDoctypeName),this.state=State.BEFORE_DOCTYPE_NAME,this._stateBeforeDoctypeName(e)}}_stateBeforeDoctypeName(e){if(isAsciiUpper(e))this._createDoctypeToken(String.fromCharCode(toAsciiLower(e))),this.state=State.DOCTYPE_NAME;else switch(e){case CODE_POINTS.SPACE:case CODE_POINTS.LINE_FEED:case CODE_POINTS.TABULATION:case CODE_POINTS.FORM_FEED:break;case CODE_POINTS.NULL:this._err(ERR.unexpectedNullCharacter),this._createDoctypeToken("�"),this.state=State.DOCTYPE_NAME;break;case CODE_POINTS.GREATER_THAN_SIGN:{this._err(ERR.missingDoctypeName),this._createDoctypeToken(null);const e=this.currentToken;e.forceQuirks=!0,this.emitCurrentDoctype(e),this.state=State.DATA;break}case CODE_POINTS.EOF:{this._err(ERR.eofInDoctype),this._createDoctypeToken(null);const e=this.currentToken;e.forceQuirks=!0,this.emitCurrentDoctype(e),this._emitEOFToken();break}default:this._createDoctypeToken(String.fromCodePoint(e)),this.state=State.DOCTYPE_NAME}}_stateDoctypeName(e){const t=this.currentToken;switch(e){case CODE_POINTS.SPACE:case CODE_POINTS.LINE_FEED:case CODE_POINTS.TABULATION:case CODE_POINTS.FORM_FEED:this.state=State.AFTER_DOCTYPE_NAME;break;case CODE_POINTS.GREATER_THAN_SIGN:this.state=State.DATA,this.emitCurrentDoctype(t);break;case CODE_POINTS.NULL:this._err(ERR.unexpectedNullCharacter),t.name+="�";break;case CODE_POINTS.EOF:this._err(ERR.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:t.name+=String.fromCodePoint(isAsciiUpper(e)?toAsciiLower(e):e)}}_stateAfterDoctypeName(e){const t=this.currentToken;switch(e){case CODE_POINTS.SPACE:case CODE_POINTS.LINE_FEED:case CODE_POINTS.TABULATION:case CODE_POINTS.FORM_FEED:break;case CODE_POINTS.GREATER_THAN_SIGN:this.state=State.DATA,this.emitCurrentDoctype(t);break;case CODE_POINTS.EOF:this._err(ERR.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._consumeSequenceIfMatch("public",!1)?this.state=State.AFTER_DOCTYPE_PUBLIC_KEYWORD:this._consumeSequenceIfMatch("system",!1)?this.state=State.AFTER_DOCTYPE_SYSTEM_KEYWORD:this._ensureHibernation()||(this._err(ERR.invalidCharacterSequenceAfterDoctypeName),t.forceQuirks=!0,this.state=State.BOGUS_DOCTYPE,this._stateBogusDoctype(e))}}_stateAfterDoctypePublicKeyword(e){const t=this.currentToken;switch(e){case CODE_POINTS.SPACE:case CODE_POINTS.LINE_FEED:case CODE_POINTS.TABULATION:case CODE_POINTS.FORM_FEED:this.state=State.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER;break;case CODE_POINTS.QUOTATION_MARK:this._err(ERR.missingWhitespaceAfterDoctypePublicKeyword),t.publicId="",this.state=State.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;break;case CODE_POINTS.APOSTROPHE:this._err(ERR.missingWhitespaceAfterDoctypePublicKeyword),t.publicId="",this.state=State.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;break;case CODE_POINTS.GREATER_THAN_SIGN:this._err(ERR.missingDoctypePublicIdentifier),t.forceQuirks=!0,this.state=State.DATA,this.emitCurrentDoctype(t);break;case CODE_POINTS.EOF:this._err(ERR.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(ERR.missingQuoteBeforeDoctypePublicIdentifier),t.forceQuirks=!0,this.state=State.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBeforeDoctypePublicIdentifier(e){const t=this.currentToken;switch(e){case CODE_POINTS.SPACE:case CODE_POINTS.LINE_FEED:case CODE_POINTS.TABULATION:case CODE_POINTS.FORM_FEED:break;case CODE_POINTS.QUOTATION_MARK:t.publicId="",this.state=State.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;break;case CODE_POINTS.APOSTROPHE:t.publicId="",this.state=State.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;break;case CODE_POINTS.GREATER_THAN_SIGN:this._err(ERR.missingDoctypePublicIdentifier),t.forceQuirks=!0,this.state=State.DATA,this.emitCurrentDoctype(t);break;case CODE_POINTS.EOF:this._err(ERR.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(ERR.missingQuoteBeforeDoctypePublicIdentifier),t.forceQuirks=!0,this.state=State.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateDoctypePublicIdentifierDoubleQuoted(e){const t=this.currentToken;switch(e){case CODE_POINTS.QUOTATION_MARK:this.state=State.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;break;case CODE_POINTS.NULL:this._err(ERR.unexpectedNullCharacter),t.publicId+="�";break;case CODE_POINTS.GREATER_THAN_SIGN:this._err(ERR.abruptDoctypePublicIdentifier),t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=State.DATA;break;case CODE_POINTS.EOF:this._err(ERR.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:t.publicId+=String.fromCodePoint(e)}}_stateDoctypePublicIdentifierSingleQuoted(e){const t=this.currentToken;switch(e){case CODE_POINTS.APOSTROPHE:this.state=State.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;break;case CODE_POINTS.NULL:this._err(ERR.unexpectedNullCharacter),t.publicId+="�";break;case CODE_POINTS.GREATER_THAN_SIGN:this._err(ERR.abruptDoctypePublicIdentifier),t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=State.DATA;break;case CODE_POINTS.EOF:this._err(ERR.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:t.publicId+=String.fromCodePoint(e)}}_stateAfterDoctypePublicIdentifier(e){const t=this.currentToken;switch(e){case CODE_POINTS.SPACE:case CODE_POINTS.LINE_FEED:case CODE_POINTS.TABULATION:case CODE_POINTS.FORM_FEED:this.state=State.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS;break;case CODE_POINTS.GREATER_THAN_SIGN:this.state=State.DATA,this.emitCurrentDoctype(t);break;case CODE_POINTS.QUOTATION_MARK:this._err(ERR.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),t.systemId="",this.state=State.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break;case CODE_POINTS.APOSTROPHE:this._err(ERR.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),t.systemId="",this.state=State.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break;case CODE_POINTS.EOF:this._err(ERR.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(ERR.missingQuoteBeforeDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=State.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBetweenDoctypePublicAndSystemIdentifiers(e){const t=this.currentToken;switch(e){case CODE_POINTS.SPACE:case CODE_POINTS.LINE_FEED:case CODE_POINTS.TABULATION:case CODE_POINTS.FORM_FEED:break;case CODE_POINTS.GREATER_THAN_SIGN:this.emitCurrentDoctype(t),this.state=State.DATA;break;case CODE_POINTS.QUOTATION_MARK:t.systemId="",this.state=State.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break;case CODE_POINTS.APOSTROPHE:t.systemId="",this.state=State.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break;case CODE_POINTS.EOF:this._err(ERR.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(ERR.missingQuoteBeforeDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=State.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateAfterDoctypeSystemKeyword(e){const t=this.currentToken;switch(e){case CODE_POINTS.SPACE:case CODE_POINTS.LINE_FEED:case CODE_POINTS.TABULATION:case CODE_POINTS.FORM_FEED:this.state=State.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER;break;case CODE_POINTS.QUOTATION_MARK:this._err(ERR.missingWhitespaceAfterDoctypeSystemKeyword),t.systemId="",this.state=State.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break;case CODE_POINTS.APOSTROPHE:this._err(ERR.missingWhitespaceAfterDoctypeSystemKeyword),t.systemId="",this.state=State.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break;case CODE_POINTS.GREATER_THAN_SIGN:this._err(ERR.missingDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=State.DATA,this.emitCurrentDoctype(t);break;case CODE_POINTS.EOF:this._err(ERR.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(ERR.missingQuoteBeforeDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=State.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBeforeDoctypeSystemIdentifier(e){const t=this.currentToken;switch(e){case CODE_POINTS.SPACE:case CODE_POINTS.LINE_FEED:case CODE_POINTS.TABULATION:case CODE_POINTS.FORM_FEED:break;case CODE_POINTS.QUOTATION_MARK:t.systemId="",this.state=State.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break;case CODE_POINTS.APOSTROPHE:t.systemId="",this.state=State.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break;case CODE_POINTS.GREATER_THAN_SIGN:this._err(ERR.missingDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=State.DATA,this.emitCurrentDoctype(t);break;case CODE_POINTS.EOF:this._err(ERR.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(ERR.missingQuoteBeforeDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=State.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateDoctypeSystemIdentifierDoubleQuoted(e){const t=this.currentToken;switch(e){case CODE_POINTS.QUOTATION_MARK:this.state=State.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;break;case CODE_POINTS.NULL:this._err(ERR.unexpectedNullCharacter),t.systemId+="�";break;case CODE_POINTS.GREATER_THAN_SIGN:this._err(ERR.abruptDoctypeSystemIdentifier),t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=State.DATA;break;case CODE_POINTS.EOF:this._err(ERR.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:t.systemId+=String.fromCodePoint(e)}}_stateDoctypeSystemIdentifierSingleQuoted(e){const t=this.currentToken;switch(e){case CODE_POINTS.APOSTROPHE:this.state=State.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;break;case CODE_POINTS.NULL:this._err(ERR.unexpectedNullCharacter),t.systemId+="�";break;case CODE_POINTS.GREATER_THAN_SIGN:this._err(ERR.abruptDoctypeSystemIdentifier),t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=State.DATA;break;case CODE_POINTS.EOF:this._err(ERR.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:t.systemId+=String.fromCodePoint(e)}}_stateAfterDoctypeSystemIdentifier(e){const t=this.currentToken;switch(e){case CODE_POINTS.SPACE:case CODE_POINTS.LINE_FEED:case CODE_POINTS.TABULATION:case CODE_POINTS.FORM_FEED:break;case CODE_POINTS.GREATER_THAN_SIGN:this.emitCurrentDoctype(t),this.state=State.DATA;break;case CODE_POINTS.EOF:this._err(ERR.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(ERR.unexpectedCharacterAfterDoctypeSystemIdentifier),this.state=State.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBogusDoctype(e){const t=this.currentToken;switch(e){case CODE_POINTS.GREATER_THAN_SIGN:this.emitCurrentDoctype(t),this.state=State.DATA;break;case CODE_POINTS.NULL:this._err(ERR.unexpectedNullCharacter);break;case CODE_POINTS.EOF:this.emitCurrentDoctype(t),this._emitEOFToken()}}_stateCdataSection(e){switch(e){case CODE_POINTS.RIGHT_SQUARE_BRACKET:this.state=State.CDATA_SECTION_BRACKET;break;case CODE_POINTS.EOF:this._err(ERR.eofInCdata),this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateCdataSectionBracket(e){e===CODE_POINTS.RIGHT_SQUARE_BRACKET?this.state=State.CDATA_SECTION_END:(this._emitChars("]"),this.state=State.CDATA_SECTION,this._stateCdataSection(e))}_stateCdataSectionEnd(e){switch(e){case CODE_POINTS.GREATER_THAN_SIGN:this.state=State.DATA;break;case CODE_POINTS.RIGHT_SQUARE_BRACKET:this._emitChars("]");break;default:this._emitChars("]]"),this.state=State.CDATA_SECTION,this._stateCdataSection(e)}}_stateCharacterReference(){let e=this.entityDecoder.write(this.preprocessor.html,this.preprocessor.pos);if(e<0){if(!this.preprocessor.lastChunkWritten)return this.active=!1,this.preprocessor.pos=this.preprocessor.html.length-1,this.consumedAfterSnapshot=0,void(this.preprocessor.endOfChunkHit=!0);e=this.entityDecoder.end()}0===e?(this.preprocessor.pos=this.entityStartPos,this._flushCodePointConsumedAsCharacterReference(CODE_POINTS.AMPERSAND),this.state=!this._isCharacterReferenceInAttribute()&&isAsciiAlphaNumeric2(this.preprocessor.peek(1))?State.AMBIGUOUS_AMPERSAND:this.returnState):this.state=this.returnState}_stateAmbiguousAmpersand(e){isAsciiAlphaNumeric2(e)?this._flushCodePointConsumedAsCharacterReference(e):(e===CODE_POINTS.SEMICOLON&&this._err(ERR.unknownNamedCharacterReference),this.state=this.returnState,this._callState(e))}},IMPLICIT_END_TAG_REQUIRED=new Set([TAG_ID.DD,TAG_ID.DT,TAG_ID.LI,TAG_ID.OPTGROUP,TAG_ID.OPTION,TAG_ID.P,TAG_ID.RB,TAG_ID.RP,TAG_ID.RT,TAG_ID.RTC]),IMPLICIT_END_TAG_REQUIRED_THOROUGHLY=new Set([...IMPLICIT_END_TAG_REQUIRED,TAG_ID.CAPTION,TAG_ID.COLGROUP,TAG_ID.TBODY,TAG_ID.TD,TAG_ID.TFOOT,TAG_ID.TH,TAG_ID.THEAD,TAG_ID.TR]),SCOPING_ELEMENTS_HTML=new Set([TAG_ID.APPLET,TAG_ID.CAPTION,TAG_ID.HTML,TAG_ID.MARQUEE,TAG_ID.OBJECT,TAG_ID.TABLE,TAG_ID.TD,TAG_ID.TEMPLATE,TAG_ID.TH]),SCOPING_ELEMENTS_HTML_LIST=new Set([...SCOPING_ELEMENTS_HTML,TAG_ID.OL,TAG_ID.UL]),SCOPING_ELEMENTS_HTML_BUTTON=new Set([...SCOPING_ELEMENTS_HTML,TAG_ID.BUTTON]),SCOPING_ELEMENTS_MATHML=new Set([TAG_ID.ANNOTATION_XML,TAG_ID.MI,TAG_ID.MN,TAG_ID.MO,TAG_ID.MS,TAG_ID.MTEXT]),SCOPING_ELEMENTS_SVG=new Set([TAG_ID.DESC,TAG_ID.FOREIGN_OBJECT,TAG_ID.TITLE]),TABLE_ROW_CONTEXT=new Set([TAG_ID.TR,TAG_ID.TEMPLATE,TAG_ID.HTML]),TABLE_BODY_CONTEXT=new Set([TAG_ID.TBODY,TAG_ID.TFOOT,TAG_ID.THEAD,TAG_ID.TEMPLATE,TAG_ID.HTML]),TABLE_CONTEXT=new Set([TAG_ID.TABLE,TAG_ID.TEMPLATE,TAG_ID.HTML]),TABLE_CELLS=new Set([TAG_ID.TD,TAG_ID.TH]),OpenElementStack=class{get currentTmplContentOrNode(){return this._isInTemplate()?this.treeAdapter.getTemplateContent(this.current):this.current}constructor(e,t,n){this.treeAdapter=t,this.handler=n,this.items=[],this.tagIDs=[],this.stackTop=-1,this.tmplCount=0,this.currentTagId=TAG_ID.UNKNOWN,this.current=e}_indexOf(e){return this.items.lastIndexOf(e,this.stackTop)}_isInTemplate(){return this.currentTagId===TAG_ID.TEMPLATE&&this.treeAdapter.getNamespaceURI(this.current)===NS.HTML}_updateCurrentElement(){this.current=this.items[this.stackTop],this.currentTagId=this.tagIDs[this.stackTop]}push(e,t){this.stackTop++,this.items[this.stackTop]=e,this.current=e,this.tagIDs[this.stackTop]=t,this.currentTagId=t,this._isInTemplate()&&this.tmplCount++,this.handler.onItemPush(e,t,!0)}pop(){const e=this.current;this.tmplCount>0&&this._isInTemplate()&&this.tmplCount--,this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(e,!0)}replace(e,t){const n=this._indexOf(e);this.items[n]=t,n===this.stackTop&&(this.current=t)}insertAfter(e,t,n){const r=this._indexOf(e)+1;this.items.splice(r,0,t),this.tagIDs.splice(r,0,n),this.stackTop++,r===this.stackTop&&this._updateCurrentElement(),this.current&&void 0!==this.currentTagId&&this.handler.onItemPush(this.current,this.currentTagId,r===this.stackTop)}popUntilTagNamePopped(e){let t=this.stackTop+1;do{t=this.tagIDs.lastIndexOf(e,t-1)}while(t>0&&this.treeAdapter.getNamespaceURI(this.items[t])!==NS.HTML);this.shortenToLength(Math.max(t,0))}shortenToLength(e){for(;this.stackTop>=e;){const t=this.current;this.tmplCount>0&&this._isInTemplate()&&(this.tmplCount-=1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(t,this.stackTop<e)}}popUntilElementPopped(e){const t=this._indexOf(e);this.shortenToLength(Math.max(t,0))}popUntilPopped(e,t){const n=this._indexOfTagNames(e,t);this.shortenToLength(Math.max(n,0))}popUntilNumberedHeaderPopped(){this.popUntilPopped(NUMBERED_HEADERS,NS.HTML)}popUntilTableCellPopped(){this.popUntilPopped(TABLE_CELLS,NS.HTML)}popAllUpToHtmlElement(){this.tmplCount=0,this.shortenToLength(1)}_indexOfTagNames(e,t){for(let n=this.stackTop;n>=0;n--)if(e.has(this.tagIDs[n])&&this.treeAdapter.getNamespaceURI(this.items[n])===t)return n;return-1}clearBackTo(e,t){const n=this._indexOfTagNames(e,t);this.shortenToLength(n+1)}clearBackToTableContext(){this.clearBackTo(TABLE_CONTEXT,NS.HTML)}clearBackToTableBodyContext(){this.clearBackTo(TABLE_BODY_CONTEXT,NS.HTML)}clearBackToTableRowContext(){this.clearBackTo(TABLE_ROW_CONTEXT,NS.HTML)}remove(e){const t=this._indexOf(e);t>=0&&(t===this.stackTop?this.pop():(this.items.splice(t,1),this.tagIDs.splice(t,1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(e,!1)))}tryPeekProperlyNestedBodyElement(){return this.stackTop>=1&&this.tagIDs[1]===TAG_ID.BODY?this.items[1]:null}contains(e){return this._indexOf(e)>-1}getCommonAncestor(e){const t=this._indexOf(e)-1;return t>=0?this.items[t]:null}isRootHtmlElementCurrent(){return 0===this.stackTop&&this.tagIDs[0]===TAG_ID.HTML}hasInDynamicScope(e,t){for(let n=this.stackTop;n>=0;n--){const r=this.tagIDs[n];switch(this.treeAdapter.getNamespaceURI(this.items[n])){case NS.HTML:if(r===e)return!0;if(t.has(r))return!1;break;case NS.SVG:if(SCOPING_ELEMENTS_SVG.has(r))return!1;break;case NS.MATHML:if(SCOPING_ELEMENTS_MATHML.has(r))return!1}}return!0}hasInScope(e){return this.hasInDynamicScope(e,SCOPING_ELEMENTS_HTML)}hasInListItemScope(e){return this.hasInDynamicScope(e,SCOPING_ELEMENTS_HTML_LIST)}hasInButtonScope(e){return this.hasInDynamicScope(e,SCOPING_ELEMENTS_HTML_BUTTON)}hasNumberedHeaderInScope(){for(let e=this.stackTop;e>=0;e--){const t=this.tagIDs[e];switch(this.treeAdapter.getNamespaceURI(this.items[e])){case NS.HTML:if(NUMBERED_HEADERS.has(t))return!0;if(SCOPING_ELEMENTS_HTML.has(t))return!1;break;case NS.SVG:if(SCOPING_ELEMENTS_SVG.has(t))return!1;break;case NS.MATHML:if(SCOPING_ELEMENTS_MATHML.has(t))return!1}}return!0}hasInTableScope(e){for(let t=this.stackTop;t>=0;t--)if(this.treeAdapter.getNamespaceURI(this.items[t])===NS.HTML)switch(this.tagIDs[t]){case e:return!0;case TAG_ID.TABLE:case TAG_ID.HTML:return!1}return!0}hasTableBodyContextInTableScope(){for(let e=this.stackTop;e>=0;e--)if(this.treeAdapter.getNamespaceURI(this.items[e])===NS.HTML)switch(this.tagIDs[e]){case TAG_ID.TBODY:case TAG_ID.THEAD:case TAG_ID.TFOOT:return!0;case TAG_ID.TABLE:case TAG_ID.HTML:return!1}return!0}hasInSelectScope(e){for(let t=this.stackTop;t>=0;t--)if(this.treeAdapter.getNamespaceURI(this.items[t])===NS.HTML)switch(this.tagIDs[t]){case e:return!0;case TAG_ID.OPTION:case TAG_ID.OPTGROUP:break;default:return!1}return!0}generateImpliedEndTags(){for(;void 0!==this.currentTagId&&IMPLICIT_END_TAG_REQUIRED.has(this.currentTagId);)this.pop()}generateImpliedEndTagsThoroughly(){for(;void 0!==this.currentTagId&&IMPLICIT_END_TAG_REQUIRED_THOROUGHLY.has(this.currentTagId);)this.pop()}generateImpliedEndTagsWithExclusion(e){for(;void 0!==this.currentTagId&&this.currentTagId!==e&&IMPLICIT_END_TAG_REQUIRED_THOROUGHLY.has(this.currentTagId);)this.pop()}};(EntryType2=EntryType||(EntryType={}))[EntryType2.Marker=0]="Marker",EntryType2[EntryType2.Element=1]="Element";var MARKER={type:EntryType.Marker},FormattingElementList=class{constructor(e){this.treeAdapter=e,this.entries=[],this.bookmark=null}_getNoahArkConditionCandidates(e,t){const n=[],r=t.length,s=this.treeAdapter.getTagName(e),a=this.treeAdapter.getNamespaceURI(e);for(let e=0;e<this.entries.length;e++){const t=this.entries[e];if(t.type===EntryType.Marker)break;const{element:i}=t;if(this.treeAdapter.getTagName(i)===s&&this.treeAdapter.getNamespaceURI(i)===a){const t=this.treeAdapter.getAttrList(i);t.length===r&&n.push({idx:e,attrs:t})}}return n}_ensureNoahArkCondition(e){if(this.entries.length<3)return;const t=this.treeAdapter.getAttrList(e),n=this._getNoahArkConditionCandidates(e,t);if(n.length<3)return;const r=new Map(t.map(e=>[e.name,e.value]));let s=0;for(let e=0;e<n.length;e++){const t=n[e];t.attrs.every(e=>r.get(e.name)===e.value)&&(s+=1,s>=3&&this.entries.splice(t.idx,1))}}insertMarker(){this.entries.unshift(MARKER)}pushElement(e,t){this._ensureNoahArkCondition(e),this.entries.unshift({type:EntryType.Element,element:e,token:t})}insertElementAfterBookmark(e,t){const n=this.entries.indexOf(this.bookmark);this.entries.splice(n,0,{type:EntryType.Element,element:e,token:t})}removeEntry(e){const t=this.entries.indexOf(e);-1!==t&&this.entries.splice(t,1)}clearToLastMarker(){const e=this.entries.indexOf(MARKER);-1===e?this.entries.length=0:this.entries.splice(0,e+1)}getElementEntryInScopeWithTagName(e){const t=this.entries.find(t=>t.type===EntryType.Marker||this.treeAdapter.getTagName(t.element)===e);return t&&t.type===EntryType.Element?t:null}getElementEntry(e){return this.entries.find(t=>t.type===EntryType.Element&&t.element===e)}},defaultTreeAdapter={createDocument:()=>({nodeName:"#document",mode:DOCUMENT_MODE.NO_QUIRKS,childNodes:[]}),createDocumentFragment:()=>({nodeName:"#document-fragment",childNodes:[]}),createElement:(e,t,n)=>({nodeName:e,tagName:e,attrs:n,namespaceURI:t,childNodes:[],parentNode:null}),createCommentNode:e=>({nodeName:"#comment",data:e,parentNode:null}),createTextNode:e=>({nodeName:"#text",value:e,parentNode:null}),appendChild(e,t){e.childNodes.push(t),t.parentNode=e},insertBefore(e,t,n){const r=e.childNodes.indexOf(n);e.childNodes.splice(r,0,t),t.parentNode=e},setTemplateContent(e,t){e.content=t},getTemplateContent:e=>e.content,setDocumentType(e,t,n,r){const s=e.childNodes.find(e=>"#documentType"===e.nodeName);if(s)s.name=t,s.publicId=n,s.systemId=r;else{const s={nodeName:"#documentType",name:t,publicId:n,systemId:r,parentNode:null};defaultTreeAdapter.appendChild(e,s)}},setDocumentMode(e,t){e.mode=t},getDocumentMode:e=>e.mode,detachNode(e){if(e.parentNode){const t=e.parentNode.childNodes.indexOf(e);e.parentNode.childNodes.splice(t,1),e.parentNode=null}},insertText(e,t){if(e.childNodes.length>0){const n=e.childNodes[e.childNodes.length-1];if(defaultTreeAdapter.isTextNode(n))return void(n.value+=t)}defaultTreeAdapter.appendChild(e,defaultTreeAdapter.createTextNode(t))},insertTextBefore(e,t,n){const r=e.childNodes[e.childNodes.indexOf(n)-1];r&&defaultTreeAdapter.isTextNode(r)?r.value+=t:defaultTreeAdapter.insertBefore(e,defaultTreeAdapter.createTextNode(t),n)},adoptAttributes(e,t){const n=new Set(e.attrs.map(e=>e.name));for(let r=0;r<t.length;r++)n.has(t[r].name)||e.attrs.push(t[r])},getFirstChild:e=>e.childNodes[0],getChildNodes:e=>e.childNodes,getParentNode:e=>e.parentNode,getAttrList:e=>e.attrs,getTagName:e=>e.tagName,getNamespaceURI:e=>e.namespaceURI,getTextNodeContent:e=>e.value,getCommentNodeContent:e=>e.data,getDocumentTypeNodeName:e=>e.name,getDocumentTypeNodePublicId:e=>e.publicId,getDocumentTypeNodeSystemId:e=>e.systemId,isTextNode:e=>"#text"===e.nodeName,isCommentNode:e=>"#comment"===e.nodeName,isDocumentTypeNode:e=>"#documentType"===e.nodeName,isElementNode:e=>Object.prototype.hasOwnProperty.call(e,"tagName"),setNodeSourceCodeLocation(e,t){e.sourceCodeLocation=t},getNodeSourceCodeLocation:e=>e.sourceCodeLocation,updateNodeSourceCodeLocation(e,t){e.sourceCodeLocation={...e.sourceCodeLocation,...t}}},QUIRKS_MODE_PUBLIC_ID_PREFIXES=["+//silmaril//dtd html pro v0r11 19970101//","-//as//dtd html 3.0 aswedit + extensions//","-//advasoft ltd//dtd html 3.0 aswedit + extensions//","-//ietf//dtd html 2.0 level 1//","-//ietf//dtd html 2.0 level 2//","-//ietf//dtd html 2.0 strict level 1//","-//ietf//dtd html 2.0 strict level 2//","-//ietf//dtd html 2.0 strict//","-//ietf//dtd html 2.0//","-//ietf//dtd html 2.1e//","-//ietf//dtd html 3.0//","-//ietf//dtd html 3.2 final//","-//ietf//dtd html 3.2//","-//ietf//dtd html 3//","-//ietf//dtd html level 0//","-//ietf//dtd html level 1//","-//ietf//dtd html level 2//","-//ietf//dtd html level 3//","-//ietf//dtd html strict level 0//","-//ietf//dtd html strict level 1//","-//ietf//dtd html strict level 2//","-//ietf//dtd html strict level 3//","-//ietf//dtd html strict//","-//ietf//dtd html//","-//metrius//dtd metrius presentational//","-//microsoft//dtd internet explorer 2.0 html strict//","-//microsoft//dtd internet explorer 2.0 html//","-//microsoft//dtd internet explorer 2.0 tables//","-//microsoft//dtd internet explorer 3.0 html strict//","-//microsoft//dtd internet explorer 3.0 html//","-//microsoft//dtd internet explorer 3.0 tables//","-//netscape comm. corp.//dtd html//","-//netscape comm. corp.//dtd strict html//","-//o'reilly and associates//dtd html 2.0//","-//o'reilly and associates//dtd html extended 1.0//","-//o'reilly and associates//dtd html extended relaxed 1.0//","-//sq//dtd html 2.0 hotmetal + extensions//","-//softquad software//dtd hotmetal pro 6.0::19990601::extensions to html 4.0//","-//softquad//dtd hotmetal pro 4.0::19971010::extensions to html 4.0//","-//spyglass//dtd html 2.0 extended//","-//sun microsystems corp.//dtd hotjava html//","-//sun microsystems corp.//dtd hotjava strict html//","-//w3c//dtd html 3 1995-03-24//","-//w3c//dtd html 3.2 draft//","-//w3c//dtd html 3.2 final//","-//w3c//dtd html 3.2//","-//w3c//dtd html 3.2s draft//","-//w3c//dtd html 4.0 frameset//","-//w3c//dtd html 4.0 transitional//","-//w3c//dtd html experimental 19960712//","-//w3c//dtd html experimental 970421//","-//w3c//dtd w3 html//","-//w3o//dtd w3 html 3.0//","-//webtechs//dtd mozilla html 2.0//","-//webtechs//dtd mozilla html//"],QUIRKS_MODE_NO_SYSTEM_ID_PUBLIC_ID_PREFIXES=[...QUIRKS_MODE_PUBLIC_ID_PREFIXES,"-//w3c//dtd html 4.01 frameset//","-//w3c//dtd html 4.01 transitional//"],QUIRKS_MODE_PUBLIC_IDS=new Set(["-//w3o//dtd w3 html strict 3.0//en//","-/w3c/dtd html 4.0 transitional/en","html"]),LIMITED_QUIRKS_PUBLIC_ID_PREFIXES=["-//w3c//dtd xhtml 1.0 frameset//","-//w3c//dtd xhtml 1.0 transitional//"],LIMITED_QUIRKS_WITH_SYSTEM_ID_PUBLIC_ID_PREFIXES=[...LIMITED_QUIRKS_PUBLIC_ID_PREFIXES,"-//w3c//dtd html 4.01 frameset//","-//w3c//dtd html 4.01 transitional//"];function hasPrefix(e,t){return t.some(t=>e.startsWith(t))}var InsertionMode,InsertionMode2,SVG_ATTRS_ADJUSTMENT_MAP=new Map(["attributeName","attributeType","baseFrequency","baseProfile","calcMode","clipPathUnits","diffuseConstant","edgeMode","filterUnits","glyphRef","gradientTransform","gradientUnits","kernelMatrix","kernelUnitLength","keyPoints","keySplines","keyTimes","lengthAdjust","limitingConeAngle","markerHeight","markerUnits","markerWidth","maskContentUnits","maskUnits","numOctaves","pathLength","patternContentUnits","patternTransform","patternUnits","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","refX","refY","repeatCount","repeatDur","requiredExtensions","requiredFeatures","specularConstant","specularExponent","spreadMethod","startOffset","stdDeviation","stitchTiles","surfaceScale","systemLanguage","tableValues","targetX","targetY","textLength","viewBox","viewTarget","xChannelSelector","yChannelSelector","zoomAndPan"].map(e=>[e.toLowerCase(),e])),XML_ATTRS_ADJUSTMENT_MAP=new Map([["xlink:actuate",{prefix:"xlink",name:"actuate",namespace:NS.XLINK}],["xlink:arcrole",{prefix:"xlink",name:"arcrole",namespace:NS.XLINK}],["xlink:href",{prefix:"xlink",name:"href",namespace:NS.XLINK}],["xlink:role",{prefix:"xlink",name:"role",namespace:NS.XLINK}],["xlink:show",{prefix:"xlink",name:"show",namespace:NS.XLINK}],["xlink:title",{prefix:"xlink",name:"title",namespace:NS.XLINK}],["xlink:type",{prefix:"xlink",name:"type",namespace:NS.XLINK}],["xml:lang",{prefix:"xml",name:"lang",namespace:NS.XML}],["xml:space",{prefix:"xml",name:"space",namespace:NS.XML}],["xmlns",{prefix:"",name:"xmlns",namespace:NS.XMLNS}],["xmlns:xlink",{prefix:"xmlns",name:"xlink",namespace:NS.XMLNS}]]),SVG_TAG_NAMES_ADJUSTMENT_MAP=new Map(["altGlyph","altGlyphDef","altGlyphItem","animateColor","animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","glyphRef","linearGradient","radialGradient","textPath"].map(e=>[e.toLowerCase(),e])),EXITS_FOREIGN_CONTENT=new Set([TAG_ID.B,TAG_ID.BIG,TAG_ID.BLOCKQUOTE,TAG_ID.BODY,TAG_ID.BR,TAG_ID.CENTER,TAG_ID.CODE,TAG_ID.DD,TAG_ID.DIV,TAG_ID.DL,TAG_ID.DT,TAG_ID.EM,TAG_ID.EMBED,TAG_ID.H1,TAG_ID.H2,TAG_ID.H3,TAG_ID.H4,TAG_ID.H5,TAG_ID.H6,TAG_ID.HEAD,TAG_ID.HR,TAG_ID.I,TAG_ID.IMG,TAG_ID.LI,TAG_ID.LISTING,TAG_ID.MENU,TAG_ID.META,TAG_ID.NOBR,TAG_ID.OL,TAG_ID.P,TAG_ID.PRE,TAG_ID.RUBY,TAG_ID.S,TAG_ID.SMALL,TAG_ID.SPAN,TAG_ID.STRONG,TAG_ID.STRIKE,TAG_ID.SUB,TAG_ID.SUP,TAG_ID.TABLE,TAG_ID.TT,TAG_ID.U,TAG_ID.UL,TAG_ID.VAR]);function adjustTokenMathMLAttrs(e){for(let t=0;t<e.attrs.length;t++)if("definitionurl"===e.attrs[t].name){e.attrs[t].name="definitionURL";break}}function adjustTokenSVGAttrs(e){for(let t=0;t<e.attrs.length;t++){const n=SVG_ATTRS_ADJUSTMENT_MAP.get(e.attrs[t].name);null!=n&&(e.attrs[t].name=n)}}function adjustTokenXMLAttrs(e){for(let t=0;t<e.attrs.length;t++){const n=XML_ATTRS_ADJUSTMENT_MAP.get(e.attrs[t].name);n&&(e.attrs[t].prefix=n.prefix,e.attrs[t].name=n.name,e.attrs[t].namespace=n.namespace)}}(InsertionMode2=InsertionMode||(InsertionMode={}))[InsertionMode2.INITIAL=0]="INITIAL",InsertionMode2[InsertionMode2.BEFORE_HTML=1]="BEFORE_HTML",InsertionMode2[InsertionMode2.BEFORE_HEAD=2]="BEFORE_HEAD",InsertionMode2[InsertionMode2.IN_HEAD=3]="IN_HEAD",InsertionMode2[InsertionMode2.IN_HEAD_NO_SCRIPT=4]="IN_HEAD_NO_SCRIPT",InsertionMode2[InsertionMode2.AFTER_HEAD=5]="AFTER_HEAD",InsertionMode2[InsertionMode2.IN_BODY=6]="IN_BODY",InsertionMode2[InsertionMode2.TEXT=7]="TEXT",InsertionMode2[InsertionMode2.IN_TABLE=8]="IN_TABLE",InsertionMode2[InsertionMode2.IN_TABLE_TEXT=9]="IN_TABLE_TEXT",InsertionMode2[InsertionMode2.IN_CAPTION=10]="IN_CAPTION",InsertionMode2[InsertionMode2.IN_COLUMN_GROUP=11]="IN_COLUMN_GROUP",InsertionMode2[InsertionMode2.IN_TABLE_BODY=12]="IN_TABLE_BODY",InsertionMode2[InsertionMode2.IN_ROW=13]="IN_ROW",InsertionMode2[InsertionMode2.IN_CELL=14]="IN_CELL",InsertionMode2[InsertionMode2.IN_SELECT=15]="IN_SELECT",InsertionMode2[InsertionMode2.IN_SELECT_IN_TABLE=16]="IN_SELECT_IN_TABLE",InsertionMode2[InsertionMode2.IN_TEMPLATE=17]="IN_TEMPLATE",InsertionMode2[InsertionMode2.AFTER_BODY=18]="AFTER_BODY",InsertionMode2[InsertionMode2.IN_FRAMESET=19]="IN_FRAMESET",InsertionMode2[InsertionMode2.AFTER_FRAMESET=20]="AFTER_FRAMESET",InsertionMode2[InsertionMode2.AFTER_AFTER_BODY=21]="AFTER_AFTER_BODY",InsertionMode2[InsertionMode2.AFTER_AFTER_FRAMESET=22]="AFTER_AFTER_FRAMESET";var BASE_LOC={startLine:-1,startCol:-1,startOffset:-1,endLine:-1,endCol:-1,endOffset:-1},TABLE_STRUCTURE_TAGS=new Set([TAG_ID.TABLE,TAG_ID.TBODY,TAG_ID.TFOOT,TAG_ID.THEAD,TAG_ID.TR]),defaultParserOptions={scriptingEnabled:!0,sourceCodeLocationInfo:!1,treeAdapter:defaultTreeAdapter,onParseError:null},Parser3=class{constructor(e,t,n=null,r=null){this.fragmentContext=n,this.scriptHandler=r,this.currentToken=null,this.stopped=!1,this.insertionMode=InsertionMode.INITIAL,this.originalInsertionMode=InsertionMode.INITIAL,this.headElement=null,this.formElement=null,this.currentNotInHTML=!1,this.tmplInsertionModeStack=[],this.pendingCharacterTokens=[],this.hasNonWhitespacePendingCharacterToken=!1,this.framesetOk=!0,this.skipNextNewLine=!1,this.fosterParentingEnabled=!1,this.options={...defaultParserOptions,...e},this.treeAdapter=this.options.treeAdapter,this.onParseError=this.options.onParseError,this.onParseError&&(this.options.sourceCodeLocationInfo=!0),this.document=null!=t?t:this.treeAdapter.createDocument(),this.tokenizer=new Tokenizer(this.options,this),this.activeFormattingElements=new FormattingElementList(this.treeAdapter),this.fragmentContextID=n?getTagID(this.treeAdapter.getTagName(n)):TAG_ID.UNKNOWN,this._setContextModes(null!=n?n:this.document,this.fragmentContextID),this.openElements=new OpenElementStack(this.document,this.treeAdapter,this)}static parse(e,t){const n=new this(t);return n.tokenizer.write(e,!0),n.document}static getFragmentParser(e,t){const n={...defaultParserOptions,...t};null!=e||(e=n.treeAdapter.createElement(TAG_NAMES.TEMPLATE,NS.HTML,[]));const r=n.treeAdapter.createElement("documentmock",NS.HTML,[]),s=new this(n,r,e);return s.fragmentContextID===TAG_ID.TEMPLATE&&s.tmplInsertionModeStack.unshift(InsertionMode.IN_TEMPLATE),s._initTokenizerForFragmentParsing(),s._insertFakeRootElement(),s._resetInsertionMode(),s._findFormInFragmentContext(),s}getFragment(){const e=this.treeAdapter.getFirstChild(this.document),t=this.treeAdapter.createDocumentFragment();return this._adoptNodes(e,t),t}_err(e,t,n){var r;if(!this.onParseError)return;const s=null!==(r=e.location)&&void 0!==r?r:BASE_LOC,a={code:t,startLine:s.startLine,startCol:s.startCol,startOffset:s.startOffset,endLine:n?s.startLine:s.endLine,endCol:n?s.startCol:s.endCol,endOffset:n?s.startOffset:s.endOffset};this.onParseError(a)}onItemPush(e,t,n){var r,s;null===(s=(r=this.treeAdapter).onItemPush)||void 0===s||s.call(r,e),n&&this.openElements.stackTop>0&&this._setContextModes(e,t)}onItemPop(e,t){var n,r;if(this.options.sourceCodeLocationInfo&&this._setEndLocation(e,this.currentToken),null===(r=(n=this.treeAdapter).onItemPop)||void 0===r||r.call(n,e,this.openElements.current),t){let e,t;0===this.openElements.stackTop&&this.fragmentContext?(e=this.fragmentContext,t=this.fragmentContextID):({current:e,currentTagId:t}=this.openElements),this._setContextModes(e,t)}}_setContextModes(e,t){const n=e===this.document||e&&this.treeAdapter.getNamespaceURI(e)===NS.HTML;this.currentNotInHTML=!n,this.tokenizer.inForeignNode=!n&&void 0!==e&&void 0!==t&&!this._isIntegrationPoint(t,e)}_switchToTextParsing(e,t){this._insertElement(e,NS.HTML),this.tokenizer.state=t,this.originalInsertionMode=this.insertionMode,this.insertionMode=InsertionMode.TEXT}switchToPlaintextParsing(){this.insertionMode=InsertionMode.TEXT,this.originalInsertionMode=InsertionMode.IN_BODY,this.tokenizer.state=TokenizerMode.PLAINTEXT}_getAdjustedCurrentElement(){return 0===this.openElements.stackTop&&this.fragmentContext?this.fragmentContext:this.openElements.current}_findFormInFragmentContext(){let e=this.fragmentContext;for(;e;){if(this.treeAdapter.getTagName(e)===TAG_NAMES.FORM){this.formElement=e;break}e=this.treeAdapter.getParentNode(e)}}_initTokenizerForFragmentParsing(){if(this.fragmentContext&&this.treeAdapter.getNamespaceURI(this.fragmentContext)===NS.HTML)switch(this.fragmentContextID){case TAG_ID.TITLE:case TAG_ID.TEXTAREA:this.tokenizer.state=TokenizerMode.RCDATA;break;case TAG_ID.STYLE:case TAG_ID.XMP:case TAG_ID.IFRAME:case TAG_ID.NOEMBED:case TAG_ID.NOFRAMES:case TAG_ID.NOSCRIPT:this.tokenizer.state=TokenizerMode.RAWTEXT;break;case TAG_ID.SCRIPT:this.tokenizer.state=TokenizerMode.SCRIPT_DATA;break;case TAG_ID.PLAINTEXT:this.tokenizer.state=TokenizerMode.PLAINTEXT}}_setDocumentType(e){const t=e.name||"",n=e.publicId||"",r=e.systemId||"";if(this.treeAdapter.setDocumentType(this.document,t,n,r),e.location){const t=this.treeAdapter.getChildNodes(this.document).find(e=>this.treeAdapter.isDocumentTypeNode(e));t&&this.treeAdapter.setNodeSourceCodeLocation(t,e.location)}}_attachElementToTree(e,t){if(this.options.sourceCodeLocationInfo){const n=t&&{...t,startTag:t};this.treeAdapter.setNodeSourceCodeLocation(e,n)}if(this._shouldFosterParentOnInsertion())this._fosterParentElement(e);else{const t=this.openElements.currentTmplContentOrNode;this.treeAdapter.appendChild(null!=t?t:this.document,e)}}_appendElement(e,t){const n=this.treeAdapter.createElement(e.tagName,t,e.attrs);this._attachElementToTree(n,e.location)}_insertElement(e,t){const n=this.treeAdapter.createElement(e.tagName,t,e.attrs);this._attachElementToTree(n,e.location),this.openElements.push(n,e.tagID)}_insertFakeElement(e,t){const n=this.treeAdapter.createElement(e,NS.HTML,[]);this._attachElementToTree(n,null),this.openElements.push(n,t)}_insertTemplate(e){const t=this.treeAdapter.createElement(e.tagName,NS.HTML,e.attrs),n=this.treeAdapter.createDocumentFragment();this.treeAdapter.setTemplateContent(t,n),this._attachElementToTree(t,e.location),this.openElements.push(t,e.tagID),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(n,null)}_insertFakeRootElement(){const e=this.treeAdapter.createElement(TAG_NAMES.HTML,NS.HTML,[]);this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(e,null),this.treeAdapter.appendChild(this.openElements.current,e),this.openElements.push(e,TAG_ID.HTML)}_appendCommentNode(e,t){const n=this.treeAdapter.createCommentNode(e.data);this.treeAdapter.appendChild(t,n),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(n,e.location)}_insertCharacters(e){let t,n;if(this._shouldFosterParentOnInsertion()?(({parent:t,beforeElement:n}=this._findFosterParentingLocation()),n?this.treeAdapter.insertTextBefore(t,e.chars,n):this.treeAdapter.insertText(t,e.chars)):(t=this.openElements.currentTmplContentOrNode,this.treeAdapter.insertText(t,e.chars)),!e.location)return;const r=this.treeAdapter.getChildNodes(t),s=n?r.lastIndexOf(n):r.length,a=r[s-1];if(this.treeAdapter.getNodeSourceCodeLocation(a)){const{endLine:t,endCol:n,endOffset:r}=e.location;this.treeAdapter.updateNodeSourceCodeLocation(a,{endLine:t,endCol:n,endOffset:r})}else this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(a,e.location)}_adoptNodes(e,t){for(let n=this.treeAdapter.getFirstChild(e);n;n=this.treeAdapter.getFirstChild(e))this.treeAdapter.detachNode(n),this.treeAdapter.appendChild(t,n)}_setEndLocation(e,t){if(this.treeAdapter.getNodeSourceCodeLocation(e)&&t.location){const n=t.location,r=this.treeAdapter.getTagName(e),s=t.type===TokenType.END_TAG&&r===t.tagName?{endTag:{...n},endLine:n.endLine,endCol:n.endCol,endOffset:n.endOffset}:{endLine:n.startLine,endCol:n.startCol,endOffset:n.startOffset};this.treeAdapter.updateNodeSourceCodeLocation(e,s)}}shouldProcessStartTagTokenInForeignContent(e){if(!this.currentNotInHTML)return!1;let t,n;return 0===this.openElements.stackTop&&this.fragmentContext?(t=this.fragmentContext,n=this.fragmentContextID):({current:t,currentTagId:n}=this.openElements),(e.tagID!==TAG_ID.SVG||this.treeAdapter.getTagName(t)!==TAG_NAMES.ANNOTATION_XML||this.treeAdapter.getNamespaceURI(t)!==NS.MATHML)&&(this.tokenizer.inForeignNode||(e.tagID===TAG_ID.MGLYPH||e.tagID===TAG_ID.MALIGNMARK)&&void 0!==n&&!this._isIntegrationPoint(n,t,NS.HTML))}_processToken(e){switch(e.type){case TokenType.CHARACTER:this.onCharacter(e);break;case TokenType.NULL_CHARACTER:this.onNullCharacter(e);break;case TokenType.COMMENT:this.onComment(e);break;case TokenType.DOCTYPE:this.onDoctype(e);break;case TokenType.START_TAG:this._processStartTag(e);break;case TokenType.END_TAG:this.onEndTag(e);break;case TokenType.EOF:this.onEof(e);break;case TokenType.WHITESPACE_CHARACTER:this.onWhitespaceCharacter(e)}}_isIntegrationPoint(e,t,n){return function(e,t,n,r){return(!r||r===NS.HTML)&&function(e,t,n){if(t===NS.MATHML&&e===TAG_ID.ANNOTATION_XML)for(let e=0;e<n.length;e++)if(n[e].name===ATTRS.ENCODING){const t=n[e].value.toLowerCase();return"text/html"===t||"application/xhtml+xml"===t}return t===NS.SVG&&(e===TAG_ID.FOREIGN_OBJECT||e===TAG_ID.DESC||e===TAG_ID.TITLE)}(e,t,n)||(!r||r===NS.MATHML)&&function(e,t){return t===NS.MATHML&&(e===TAG_ID.MI||e===TAG_ID.MO||e===TAG_ID.MN||e===TAG_ID.MS||e===TAG_ID.MTEXT)}(e,t)}(e,this.treeAdapter.getNamespaceURI(t),this.treeAdapter.getAttrList(t),n)}_reconstructActiveFormattingElements(){const e=this.activeFormattingElements.entries.length;if(e){const t=this.activeFormattingElements.entries.findIndex(e=>e.type===EntryType.Marker||this.openElements.contains(e.element));for(let n=-1===t?e-1:t-1;n>=0;n--){const e=this.activeFormattingElements.entries[n];this._insertElement(e.token,this.treeAdapter.getNamespaceURI(e.element)),e.element=this.openElements.current}}}_closeTableCell(){this.openElements.generateImpliedEndTags(),this.openElements.popUntilTableCellPopped(),this.activeFormattingElements.clearToLastMarker(),this.insertionMode=InsertionMode.IN_ROW}_closePElement(){this.openElements.generateImpliedEndTagsWithExclusion(TAG_ID.P),this.openElements.popUntilTagNamePopped(TAG_ID.P)}_resetInsertionMode(){for(let e=this.openElements.stackTop;e>=0;e--)switch(0===e&&this.fragmentContext?this.fragmentContextID:this.openElements.tagIDs[e]){case TAG_ID.TR:return void(this.insertionMode=InsertionMode.IN_ROW);case TAG_ID.TBODY:case TAG_ID.THEAD:case TAG_ID.TFOOT:return void(this.insertionMode=InsertionMode.IN_TABLE_BODY);case TAG_ID.CAPTION:return void(this.insertionMode=InsertionMode.IN_CAPTION);case TAG_ID.COLGROUP:return void(this.insertionMode=InsertionMode.IN_COLUMN_GROUP);case TAG_ID.TABLE:return void(this.insertionMode=InsertionMode.IN_TABLE);case TAG_ID.BODY:return void(this.insertionMode=InsertionMode.IN_BODY);case TAG_ID.FRAMESET:return void(this.insertionMode=InsertionMode.IN_FRAMESET);case TAG_ID.SELECT:return void this._resetInsertionModeForSelect(e);case TAG_ID.TEMPLATE:return void(this.insertionMode=this.tmplInsertionModeStack[0]);case TAG_ID.HTML:return void(this.insertionMode=this.headElement?InsertionMode.AFTER_HEAD:InsertionMode.BEFORE_HEAD);case TAG_ID.TD:case TAG_ID.TH:if(e>0)return void(this.insertionMode=InsertionMode.IN_CELL);break;case TAG_ID.HEAD:if(e>0)return void(this.insertionMode=InsertionMode.IN_HEAD)}this.insertionMode=InsertionMode.IN_BODY}_resetInsertionModeForSelect(e){if(e>0)for(let t=e-1;t>0;t--){const e=this.openElements.tagIDs[t];if(e===TAG_ID.TEMPLATE)break;if(e===TAG_ID.TABLE)return void(this.insertionMode=InsertionMode.IN_SELECT_IN_TABLE)}this.insertionMode=InsertionMode.IN_SELECT}_isElementCausesFosterParenting(e){return TABLE_STRUCTURE_TAGS.has(e)}_shouldFosterParentOnInsertion(){return this.fosterParentingEnabled&&void 0!==this.openElements.currentTagId&&this._isElementCausesFosterParenting(this.openElements.currentTagId)}_findFosterParentingLocation(){for(let e=this.openElements.stackTop;e>=0;e--){const t=this.openElements.items[e];switch(this.openElements.tagIDs[e]){case TAG_ID.TEMPLATE:if(this.treeAdapter.getNamespaceURI(t)===NS.HTML)return{parent:this.treeAdapter.getTemplateContent(t),beforeElement:null};break;case TAG_ID.TABLE:{const n=this.treeAdapter.getParentNode(t);return n?{parent:n,beforeElement:t}:{parent:this.openElements.items[e-1],beforeElement:null}}}}return{parent:this.openElements.items[0],beforeElement:null}}_fosterParentElement(e){const t=this._findFosterParentingLocation();t.beforeElement?this.treeAdapter.insertBefore(t.parent,e,t.beforeElement):this.treeAdapter.appendChild(t.parent,e)}_isSpecialElement(e,t){const n=this.treeAdapter.getNamespaceURI(e);return SPECIAL_ELEMENTS[n].has(t)}onCharacter(e){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode)!function(e,t){e._insertCharacters(t),e.framesetOk=!1}(this,e);else switch(this.insertionMode){case InsertionMode.INITIAL:tokenInInitialMode(this,e);break;case InsertionMode.BEFORE_HTML:tokenBeforeHtml(this,e);break;case InsertionMode.BEFORE_HEAD:tokenBeforeHead(this,e);break;case InsertionMode.IN_HEAD:tokenInHead(this,e);break;case InsertionMode.IN_HEAD_NO_SCRIPT:tokenInHeadNoScript(this,e);break;case InsertionMode.AFTER_HEAD:tokenAfterHead(this,e);break;case InsertionMode.IN_BODY:case InsertionMode.IN_CAPTION:case InsertionMode.IN_CELL:case InsertionMode.IN_TEMPLATE:characterInBody(this,e);break;case InsertionMode.TEXT:case InsertionMode.IN_SELECT:case InsertionMode.IN_SELECT_IN_TABLE:this._insertCharacters(e);break;case InsertionMode.IN_TABLE:case InsertionMode.IN_TABLE_BODY:case InsertionMode.IN_ROW:characterInTable(this,e);break;case InsertionMode.IN_TABLE_TEXT:characterInTableText(this,e);break;case InsertionMode.IN_COLUMN_GROUP:tokenInColumnGroup(this,e);break;case InsertionMode.AFTER_BODY:tokenAfterBody(this,e);break;case InsertionMode.AFTER_AFTER_BODY:tokenAfterAfterBody(this,e)}}onNullCharacter(e){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode)!function(e,t){t.chars="�",e._insertCharacters(t)}(this,e);else switch(this.insertionMode){case InsertionMode.INITIAL:tokenInInitialMode(this,e);break;case InsertionMode.BEFORE_HTML:tokenBeforeHtml(this,e);break;case InsertionMode.BEFORE_HEAD:tokenBeforeHead(this,e);break;case InsertionMode.IN_HEAD:tokenInHead(this,e);break;case InsertionMode.IN_HEAD_NO_SCRIPT:tokenInHeadNoScript(this,e);break;case InsertionMode.AFTER_HEAD:tokenAfterHead(this,e);break;case InsertionMode.TEXT:this._insertCharacters(e);break;case InsertionMode.IN_TABLE:case InsertionMode.IN_TABLE_BODY:case InsertionMode.IN_ROW:characterInTable(this,e);break;case InsertionMode.IN_COLUMN_GROUP:tokenInColumnGroup(this,e);break;case InsertionMode.AFTER_BODY:tokenAfterBody(this,e);break;case InsertionMode.AFTER_AFTER_BODY:tokenAfterAfterBody(this,e)}}onComment(e){if(this.skipNextNewLine=!1,this.currentNotInHTML)appendComment(this,e);else switch(this.insertionMode){case InsertionMode.INITIAL:case InsertionMode.BEFORE_HTML:case InsertionMode.BEFORE_HEAD:case InsertionMode.IN_HEAD:case InsertionMode.IN_HEAD_NO_SCRIPT:case InsertionMode.AFTER_HEAD:case InsertionMode.IN_BODY:case InsertionMode.IN_TABLE:case InsertionMode.IN_CAPTION:case InsertionMode.IN_COLUMN_GROUP:case InsertionMode.IN_TABLE_BODY:case InsertionMode.IN_ROW:case InsertionMode.IN_CELL:case InsertionMode.IN_SELECT:case InsertionMode.IN_SELECT_IN_TABLE:case InsertionMode.IN_TEMPLATE:case InsertionMode.IN_FRAMESET:case InsertionMode.AFTER_FRAMESET:appendComment(this,e);break;case InsertionMode.IN_TABLE_TEXT:tokenInTableText(this,e);break;case InsertionMode.AFTER_BODY:!function(e,t){e._appendCommentNode(t,e.openElements.items[0])}(this,e);break;case InsertionMode.AFTER_AFTER_BODY:case InsertionMode.AFTER_AFTER_FRAMESET:!function(e,t){e._appendCommentNode(t,e.document)}(this,e)}}onDoctype(e){switch(this.skipNextNewLine=!1,this.insertionMode){case InsertionMode.INITIAL:!function(e,t){e._setDocumentType(t);const n=t.forceQuirks?DOCUMENT_MODE.QUIRKS:function(e){if("html"!==e.name)return DOCUMENT_MODE.QUIRKS;const{systemId:t}=e;if(t&&"http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd"===t.toLowerCase())return DOCUMENT_MODE.QUIRKS;let{publicId:n}=e;if(null!==n){if(n=n.toLowerCase(),QUIRKS_MODE_PUBLIC_IDS.has(n))return DOCUMENT_MODE.QUIRKS;let e=null===t?QUIRKS_MODE_NO_SYSTEM_ID_PUBLIC_ID_PREFIXES:QUIRKS_MODE_PUBLIC_ID_PREFIXES;if(hasPrefix(n,e))return DOCUMENT_MODE.QUIRKS;if(e=null===t?LIMITED_QUIRKS_PUBLIC_ID_PREFIXES:LIMITED_QUIRKS_WITH_SYSTEM_ID_PUBLIC_ID_PREFIXES,hasPrefix(n,e))return DOCUMENT_MODE.LIMITED_QUIRKS}return DOCUMENT_MODE.NO_QUIRKS}(t);(function(e){return"html"===e.name&&null===e.publicId&&(null===e.systemId||"about:legacy-compat"===e.systemId)})(t)||e._err(t,ERR.nonConformingDoctype),e.treeAdapter.setDocumentMode(e.document,n),e.insertionMode=InsertionMode.BEFORE_HTML}(this,e);break;case InsertionMode.BEFORE_HEAD:case InsertionMode.IN_HEAD:case InsertionMode.IN_HEAD_NO_SCRIPT:case InsertionMode.AFTER_HEAD:this._err(e,ERR.misplacedDoctype);break;case InsertionMode.IN_TABLE_TEXT:tokenInTableText(this,e)}}onStartTag(e){this.skipNextNewLine=!1,this.currentToken=e,this._processStartTag(e),e.selfClosing&&!e.ackSelfClosing&&this._err(e,ERR.nonVoidHtmlElementStartTagWithTrailingSolidus)}_processStartTag(e){this.shouldProcessStartTagTokenInForeignContent(e)?function(e,t){if(function(e){const t=e.tagID;return t===TAG_ID.FONT&&e.attrs.some(({name:e})=>e===ATTRS.COLOR||e===ATTRS.SIZE||e===ATTRS.FACE)||EXITS_FOREIGN_CONTENT.has(t)}(t))popUntilHtmlOrIntegrationPoint(e),e._startTagOutsideForeignContent(t);else{const n=e._getAdjustedCurrentElement(),r=e.treeAdapter.getNamespaceURI(n);r===NS.MATHML?adjustTokenMathMLAttrs(t):r===NS.SVG&&(function(e){const t=SVG_TAG_NAMES_ADJUSTMENT_MAP.get(e.tagName);null!=t&&(e.tagName=t,e.tagID=getTagID(e.tagName))}(t),adjustTokenSVGAttrs(t)),adjustTokenXMLAttrs(t),t.selfClosing?e._appendElement(t,r):e._insertElement(t,r),t.ackSelfClosing=!0}}(this,e):this._startTagOutsideForeignContent(e)}_startTagOutsideForeignContent(e){switch(this.insertionMode){case InsertionMode.INITIAL:tokenInInitialMode(this,e);break;case InsertionMode.BEFORE_HTML:!function(e,t){t.tagID===TAG_ID.HTML?(e._insertElement(t,NS.HTML),e.insertionMode=InsertionMode.BEFORE_HEAD):tokenBeforeHtml(e,t)}(this,e);break;case InsertionMode.BEFORE_HEAD:!function(e,t){switch(t.tagID){case TAG_ID.HTML:startTagInBody(e,t);break;case TAG_ID.HEAD:e._insertElement(t,NS.HTML),e.headElement=e.openElements.current,e.insertionMode=InsertionMode.IN_HEAD;break;default:tokenBeforeHead(e,t)}}(this,e);break;case InsertionMode.IN_HEAD:startTagInHead(this,e);break;case InsertionMode.IN_HEAD_NO_SCRIPT:!function(e,t){switch(t.tagID){case TAG_ID.HTML:startTagInBody(e,t);break;case TAG_ID.BASEFONT:case TAG_ID.BGSOUND:case TAG_ID.HEAD:case TAG_ID.LINK:case TAG_ID.META:case TAG_ID.NOFRAMES:case TAG_ID.STYLE:startTagInHead(e,t);break;case TAG_ID.NOSCRIPT:e._err(t,ERR.nestedNoscriptInHead);break;default:tokenInHeadNoScript(e,t)}}(this,e);break;case InsertionMode.AFTER_HEAD:!function(e,t){switch(t.tagID){case TAG_ID.HTML:startTagInBody(e,t);break;case TAG_ID.BODY:e._insertElement(t,NS.HTML),e.framesetOk=!1,e.insertionMode=InsertionMode.IN_BODY;break;case TAG_ID.FRAMESET:e._insertElement(t,NS.HTML),e.insertionMode=InsertionMode.IN_FRAMESET;break;case TAG_ID.BASE:case TAG_ID.BASEFONT:case TAG_ID.BGSOUND:case TAG_ID.LINK:case TAG_ID.META:case TAG_ID.NOFRAMES:case TAG_ID.SCRIPT:case TAG_ID.STYLE:case TAG_ID.TEMPLATE:case TAG_ID.TITLE:e._err(t,ERR.abandonedHeadElementChild),e.openElements.push(e.headElement,TAG_ID.HEAD),startTagInHead(e,t),e.openElements.remove(e.headElement);break;case TAG_ID.HEAD:e._err(t,ERR.misplacedStartTagForHeadElement);break;default:tokenAfterHead(e,t)}}(this,e);break;case InsertionMode.IN_BODY:startTagInBody(this,e);break;case InsertionMode.IN_TABLE:startTagInTable(this,e);break;case InsertionMode.IN_TABLE_TEXT:tokenInTableText(this,e);break;case InsertionMode.IN_CAPTION:!function(e,t){const n=t.tagID;TABLE_VOID_ELEMENTS.has(n)?e.openElements.hasInTableScope(TAG_ID.CAPTION)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(TAG_ID.CAPTION),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=InsertionMode.IN_TABLE,startTagInTable(e,t)):startTagInBody(e,t)}(this,e);break;case InsertionMode.IN_COLUMN_GROUP:startTagInColumnGroup(this,e);break;case InsertionMode.IN_TABLE_BODY:startTagInTableBody(this,e);break;case InsertionMode.IN_ROW:startTagInRow(this,e);break;case InsertionMode.IN_CELL:!function(e,t){const n=t.tagID;TABLE_VOID_ELEMENTS.has(n)?(e.openElements.hasInTableScope(TAG_ID.TD)||e.openElements.hasInTableScope(TAG_ID.TH))&&(e._closeTableCell(),startTagInRow(e,t)):startTagInBody(e,t)}(this,e);break;case InsertionMode.IN_SELECT:startTagInSelect(this,e);break;case InsertionMode.IN_SELECT_IN_TABLE:!function(e,t){const n=t.tagID;n===TAG_ID.CAPTION||n===TAG_ID.TABLE||n===TAG_ID.TBODY||n===TAG_ID.TFOOT||n===TAG_ID.THEAD||n===TAG_ID.TR||n===TAG_ID.TD||n===TAG_ID.TH?(e.openElements.popUntilTagNamePopped(TAG_ID.SELECT),e._resetInsertionMode(),e._processStartTag(t)):startTagInSelect(e,t)}(this,e);break;case InsertionMode.IN_TEMPLATE:!function(e,t){switch(t.tagID){case TAG_ID.BASE:case TAG_ID.BASEFONT:case TAG_ID.BGSOUND:case TAG_ID.LINK:case TAG_ID.META:case TAG_ID.NOFRAMES:case TAG_ID.SCRIPT:case TAG_ID.STYLE:case TAG_ID.TEMPLATE:case TAG_ID.TITLE:startTagInHead(e,t);break;case TAG_ID.CAPTION:case TAG_ID.COLGROUP:case TAG_ID.TBODY:case TAG_ID.TFOOT:case TAG_ID.THEAD:e.tmplInsertionModeStack[0]=InsertionMode.IN_TABLE,e.insertionMode=InsertionMode.IN_TABLE,startTagInTable(e,t);break;case TAG_ID.COL:e.tmplInsertionModeStack[0]=InsertionMode.IN_COLUMN_GROUP,e.insertionMode=InsertionMode.IN_COLUMN_GROUP,startTagInColumnGroup(e,t);break;case TAG_ID.TR:e.tmplInsertionModeStack[0]=InsertionMode.IN_TABLE_BODY,e.insertionMode=InsertionMode.IN_TABLE_BODY,startTagInTableBody(e,t);break;case TAG_ID.TD:case TAG_ID.TH:e.tmplInsertionModeStack[0]=InsertionMode.IN_ROW,e.insertionMode=InsertionMode.IN_ROW,startTagInRow(e,t);break;default:e.tmplInsertionModeStack[0]=InsertionMode.IN_BODY,e.insertionMode=InsertionMode.IN_BODY,startTagInBody(e,t)}}(this,e);break;case InsertionMode.AFTER_BODY:!function(e,t){t.tagID===TAG_ID.HTML?startTagInBody(e,t):tokenAfterBody(e,t)}(this,e);break;case InsertionMode.IN_FRAMESET:!function(e,t){switch(t.tagID){case TAG_ID.HTML:startTagInBody(e,t);break;case TAG_ID.FRAMESET:e._insertElement(t,NS.HTML);break;case TAG_ID.FRAME:e._appendElement(t,NS.HTML),t.ackSelfClosing=!0;break;case TAG_ID.NOFRAMES:startTagInHead(e,t)}}(this,e);break;case InsertionMode.AFTER_FRAMESET:!function(e,t){switch(t.tagID){case TAG_ID.HTML:startTagInBody(e,t);break;case TAG_ID.NOFRAMES:startTagInHead(e,t)}}(this,e);break;case InsertionMode.AFTER_AFTER_BODY:!function(e,t){t.tagID===TAG_ID.HTML?startTagInBody(e,t):tokenAfterAfterBody(e,t)}(this,e);break;case InsertionMode.AFTER_AFTER_FRAMESET:!function(e,t){switch(t.tagID){case TAG_ID.HTML:startTagInBody(e,t);break;case TAG_ID.NOFRAMES:startTagInHead(e,t)}}(this,e)}}onEndTag(e){this.skipNextNewLine=!1,this.currentToken=e,this.currentNotInHTML?function(e,t){if(t.tagID===TAG_ID.P||t.tagID===TAG_ID.BR)return popUntilHtmlOrIntegrationPoint(e),void e._endTagOutsideForeignContent(t);for(let n=e.openElements.stackTop;n>0;n--){const r=e.openElements.items[n];if(e.treeAdapter.getNamespaceURI(r)===NS.HTML){e._endTagOutsideForeignContent(t);break}const s=e.treeAdapter.getTagName(r);if(s.toLowerCase()===t.tagName){t.tagName=s,e.openElements.shortenToLength(n);break}}}(this,e):this._endTagOutsideForeignContent(e)}_endTagOutsideForeignContent(e){switch(this.insertionMode){case InsertionMode.INITIAL:tokenInInitialMode(this,e);break;case InsertionMode.BEFORE_HTML:!function(e,t){const n=t.tagID;n!==TAG_ID.HTML&&n!==TAG_ID.HEAD&&n!==TAG_ID.BODY&&n!==TAG_ID.BR||tokenBeforeHtml(e,t)}(this,e);break;case InsertionMode.BEFORE_HEAD:!function(e,t){const n=t.tagID;n===TAG_ID.HEAD||n===TAG_ID.BODY||n===TAG_ID.HTML||n===TAG_ID.BR?tokenBeforeHead(e,t):e._err(t,ERR.endTagWithoutMatchingOpenElement)}(this,e);break;case InsertionMode.IN_HEAD:!function(e,t){switch(t.tagID){case TAG_ID.HEAD:e.openElements.pop(),e.insertionMode=InsertionMode.AFTER_HEAD;break;case TAG_ID.BODY:case TAG_ID.BR:case TAG_ID.HTML:tokenInHead(e,t);break;case TAG_ID.TEMPLATE:templateEndTagInHead(e,t);break;default:e._err(t,ERR.endTagWithoutMatchingOpenElement)}}(this,e);break;case InsertionMode.IN_HEAD_NO_SCRIPT:!function(e,t){switch(t.tagID){case TAG_ID.NOSCRIPT:e.openElements.pop(),e.insertionMode=InsertionMode.IN_HEAD;break;case TAG_ID.BR:tokenInHeadNoScript(e,t);break;default:e._err(t,ERR.endTagWithoutMatchingOpenElement)}}(this,e);break;case InsertionMode.AFTER_HEAD:!function(e,t){switch(t.tagID){case TAG_ID.BODY:case TAG_ID.HTML:case TAG_ID.BR:tokenAfterHead(e,t);break;case TAG_ID.TEMPLATE:templateEndTagInHead(e,t);break;default:e._err(t,ERR.endTagWithoutMatchingOpenElement)}}(this,e);break;case InsertionMode.IN_BODY:endTagInBody(this,e);break;case InsertionMode.TEXT:!function(e,t){var n;t.tagID===TAG_ID.SCRIPT&&(null===(n=e.scriptHandler)||void 0===n||n.call(e,e.openElements.current)),e.openElements.pop(),e.insertionMode=e.originalInsertionMode}(this,e);break;case InsertionMode.IN_TABLE:endTagInTable(this,e);break;case InsertionMode.IN_TABLE_TEXT:tokenInTableText(this,e);break;case InsertionMode.IN_CAPTION:!function(e,t){const n=t.tagID;switch(n){case TAG_ID.CAPTION:case TAG_ID.TABLE:e.openElements.hasInTableScope(TAG_ID.CAPTION)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(TAG_ID.CAPTION),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=InsertionMode.IN_TABLE,n===TAG_ID.TABLE&&endTagInTable(e,t));break;case TAG_ID.BODY:case TAG_ID.COL:case TAG_ID.COLGROUP:case TAG_ID.HTML:case TAG_ID.TBODY:case TAG_ID.TD:case TAG_ID.TFOOT:case TAG_ID.TH:case TAG_ID.THEAD:case TAG_ID.TR:break;default:endTagInBody(e,t)}}(this,e);break;case InsertionMode.IN_COLUMN_GROUP:!function(e,t){switch(t.tagID){case TAG_ID.COLGROUP:e.openElements.currentTagId===TAG_ID.COLGROUP&&(e.openElements.pop(),e.insertionMode=InsertionMode.IN_TABLE);break;case TAG_ID.TEMPLATE:templateEndTagInHead(e,t);break;case TAG_ID.COL:break;default:tokenInColumnGroup(e,t)}}(this,e);break;case InsertionMode.IN_TABLE_BODY:endTagInTableBody(this,e);break;case InsertionMode.IN_ROW:endTagInRow(this,e);break;case InsertionMode.IN_CELL:!function(e,t){const n=t.tagID;switch(n){case TAG_ID.TD:case TAG_ID.TH:e.openElements.hasInTableScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=InsertionMode.IN_ROW);break;case TAG_ID.TABLE:case TAG_ID.TBODY:case TAG_ID.TFOOT:case TAG_ID.THEAD:case TAG_ID.TR:e.openElements.hasInTableScope(n)&&(e._closeTableCell(),endTagInRow(e,t));break;case TAG_ID.BODY:case TAG_ID.CAPTION:case TAG_ID.COL:case TAG_ID.COLGROUP:case TAG_ID.HTML:break;default:endTagInBody(e,t)}}(this,e);break;case InsertionMode.IN_SELECT:endTagInSelect(this,e);break;case InsertionMode.IN_SELECT_IN_TABLE:!function(e,t){const n=t.tagID;n===TAG_ID.CAPTION||n===TAG_ID.TABLE||n===TAG_ID.TBODY||n===TAG_ID.TFOOT||n===TAG_ID.THEAD||n===TAG_ID.TR||n===TAG_ID.TD||n===TAG_ID.TH?e.openElements.hasInTableScope(n)&&(e.openElements.popUntilTagNamePopped(TAG_ID.SELECT),e._resetInsertionMode(),e.onEndTag(t)):endTagInSelect(e,t)}(this,e);break;case InsertionMode.IN_TEMPLATE:!function(e,t){t.tagID===TAG_ID.TEMPLATE&&templateEndTagInHead(e,t)}(this,e);break;case InsertionMode.AFTER_BODY:endTagAfterBody(this,e);break;case InsertionMode.IN_FRAMESET:!function(e,t){t.tagID!==TAG_ID.FRAMESET||e.openElements.isRootHtmlElementCurrent()||(e.openElements.pop(),e.fragmentContext||e.openElements.currentTagId===TAG_ID.FRAMESET||(e.insertionMode=InsertionMode.AFTER_FRAMESET))}(this,e);break;case InsertionMode.AFTER_FRAMESET:!function(e,t){t.tagID===TAG_ID.HTML&&(e.insertionMode=InsertionMode.AFTER_AFTER_FRAMESET)}(this,e);break;case InsertionMode.AFTER_AFTER_BODY:tokenAfterAfterBody(this,e)}}onEof(e){switch(this.insertionMode){case InsertionMode.INITIAL:tokenInInitialMode(this,e);break;case InsertionMode.BEFORE_HTML:tokenBeforeHtml(this,e);break;case InsertionMode.BEFORE_HEAD:tokenBeforeHead(this,e);break;case InsertionMode.IN_HEAD:tokenInHead(this,e);break;case InsertionMode.IN_HEAD_NO_SCRIPT:tokenInHeadNoScript(this,e);break;case InsertionMode.AFTER_HEAD:tokenAfterHead(this,e);break;case InsertionMode.IN_BODY:case InsertionMode.IN_TABLE:case InsertionMode.IN_CAPTION:case InsertionMode.IN_COLUMN_GROUP:case InsertionMode.IN_TABLE_BODY:case InsertionMode.IN_ROW:case InsertionMode.IN_CELL:case InsertionMode.IN_SELECT:case InsertionMode.IN_SELECT_IN_TABLE:eofInBody(this,e);break;case InsertionMode.TEXT:!function(e,t){e._err(t,ERR.eofInElementThatCanContainOnlyText),e.openElements.pop(),e.insertionMode=e.originalInsertionMode,e.onEof(t)}(this,e);break;case InsertionMode.IN_TABLE_TEXT:tokenInTableText(this,e);break;case InsertionMode.IN_TEMPLATE:eofInTemplate(this,e);break;case InsertionMode.AFTER_BODY:case InsertionMode.IN_FRAMESET:case InsertionMode.AFTER_FRAMESET:case InsertionMode.AFTER_AFTER_BODY:case InsertionMode.AFTER_AFTER_FRAMESET:stopParsing(this,e)}}onWhitespaceCharacter(e){if(this.skipNextNewLine&&(this.skipNextNewLine=!1,e.chars.charCodeAt(0)===CODE_POINTS.LINE_FEED)){if(1===e.chars.length)return;e.chars=e.chars.substr(1)}if(this.tokenizer.inForeignNode)this._insertCharacters(e);else switch(this.insertionMode){case InsertionMode.IN_HEAD:case InsertionMode.IN_HEAD_NO_SCRIPT:case InsertionMode.AFTER_HEAD:case InsertionMode.TEXT:case InsertionMode.IN_COLUMN_GROUP:case InsertionMode.IN_SELECT:case InsertionMode.IN_SELECT_IN_TABLE:case InsertionMode.IN_FRAMESET:case InsertionMode.AFTER_FRAMESET:this._insertCharacters(e);break;case InsertionMode.IN_BODY:case InsertionMode.IN_CAPTION:case InsertionMode.IN_CELL:case InsertionMode.IN_TEMPLATE:case InsertionMode.AFTER_BODY:case InsertionMode.AFTER_AFTER_BODY:case InsertionMode.AFTER_AFTER_FRAMESET:whitespaceCharacterInBody(this,e);break;case InsertionMode.IN_TABLE:case InsertionMode.IN_TABLE_BODY:case InsertionMode.IN_ROW:characterInTable(this,e);break;case InsertionMode.IN_TABLE_TEXT:whitespaceCharacterInTableText(this,e)}}};function aaObtainFormattingElementEntry(e,t){let n=e.activeFormattingElements.getElementEntryInScopeWithTagName(t.tagName);return n?e.openElements.contains(n.element)?e.openElements.hasInScope(t.tagID)||(n=null):(e.activeFormattingElements.removeEntry(n),n=null):genericEndTagInBody(e,t),n}function aaObtainFurthestBlock(e,t){let n=null,r=e.openElements.stackTop;for(;r>=0;r--){const s=e.openElements.items[r];if(s===t.element)break;e._isSpecialElement(s,e.openElements.tagIDs[r])&&(n=s)}return n||(e.openElements.shortenToLength(Math.max(r,0)),e.activeFormattingElements.removeEntry(t)),n}function aaInnerLoop(e,t,n){let r=t,s=e.openElements.getCommonAncestor(t);for(let a=0,i=s;i!==n;a++,i=s){s=e.openElements.getCommonAncestor(i);const n=e.activeFormattingElements.getElementEntry(i),o=n&&a>=3;!n||o?(o&&e.activeFormattingElements.removeEntry(n),e.openElements.remove(i)):(i=aaRecreateElementFromEntry(e,n),r===t&&(e.activeFormattingElements.bookmark=n),e.treeAdapter.detachNode(r),e.treeAdapter.appendChild(i,r),r=i)}return r}function aaRecreateElementFromEntry(e,t){const n=e.treeAdapter.getNamespaceURI(t.element),r=e.treeAdapter.createElement(t.token.tagName,n,t.token.attrs);return e.openElements.replace(t.element,r),t.element=r,r}function aaInsertLastNodeInCommonAncestor(e,t,n){const r=getTagID(e.treeAdapter.getTagName(t));if(e._isElementCausesFosterParenting(r))e._fosterParentElement(n);else{const s=e.treeAdapter.getNamespaceURI(t);r===TAG_ID.TEMPLATE&&s===NS.HTML&&(t=e.treeAdapter.getTemplateContent(t)),e.treeAdapter.appendChild(t,n)}}function aaReplaceFormattingElement(e,t,n){const r=e.treeAdapter.getNamespaceURI(n.element),{token:s}=n,a=e.treeAdapter.createElement(s.tagName,r,s.attrs);e._adoptNodes(t,a),e.treeAdapter.appendChild(t,a),e.activeFormattingElements.insertElementAfterBookmark(a,s),e.activeFormattingElements.removeEntry(n),e.openElements.remove(n.element),e.openElements.insertAfter(t,a,s.tagID)}function callAdoptionAgency(e,t){for(let n=0;n<8;n++){const n=aaObtainFormattingElementEntry(e,t);if(!n)break;const r=aaObtainFurthestBlock(e,n);if(!r)break;e.activeFormattingElements.bookmark=n;const s=aaInnerLoop(e,r,n.element),a=e.openElements.getCommonAncestor(n.element);e.treeAdapter.detachNode(s),a&&aaInsertLastNodeInCommonAncestor(e,a,s),aaReplaceFormattingElement(e,r,n)}}function appendComment(e,t){e._appendCommentNode(t,e.openElements.currentTmplContentOrNode)}function stopParsing(e,t){if(e.stopped=!0,t.location){const n=e.fragmentContext?0:2;for(let r=e.openElements.stackTop;r>=n;r--)e._setEndLocation(e.openElements.items[r],t);if(!e.fragmentContext&&e.openElements.stackTop>=0){const n=e.openElements.items[0],r=e.treeAdapter.getNodeSourceCodeLocation(n);if(r&&!r.endTag&&(e._setEndLocation(n,t),e.openElements.stackTop>=1)){const n=e.openElements.items[1],r=e.treeAdapter.getNodeSourceCodeLocation(n);r&&!r.endTag&&e._setEndLocation(n,t)}}}}function tokenInInitialMode(e,t){e._err(t,ERR.missingDoctype,!0),e.treeAdapter.setDocumentMode(e.document,DOCUMENT_MODE.QUIRKS),e.insertionMode=InsertionMode.BEFORE_HTML,e._processToken(t)}function tokenBeforeHtml(e,t){e._insertFakeRootElement(),e.insertionMode=InsertionMode.BEFORE_HEAD,e._processToken(t)}function tokenBeforeHead(e,t){e._insertFakeElement(TAG_NAMES.HEAD,TAG_ID.HEAD),e.headElement=e.openElements.current,e.insertionMode=InsertionMode.IN_HEAD,e._processToken(t)}function startTagInHead(e,t){switch(t.tagID){case TAG_ID.HTML:startTagInBody(e,t);break;case TAG_ID.BASE:case TAG_ID.BASEFONT:case TAG_ID.BGSOUND:case TAG_ID.LINK:case TAG_ID.META:e._appendElement(t,NS.HTML),t.ackSelfClosing=!0;break;case TAG_ID.TITLE:e._switchToTextParsing(t,TokenizerMode.RCDATA);break;case TAG_ID.NOSCRIPT:e.options.scriptingEnabled?e._switchToTextParsing(t,TokenizerMode.RAWTEXT):(e._insertElement(t,NS.HTML),e.insertionMode=InsertionMode.IN_HEAD_NO_SCRIPT);break;case TAG_ID.NOFRAMES:case TAG_ID.STYLE:e._switchToTextParsing(t,TokenizerMode.RAWTEXT);break;case TAG_ID.SCRIPT:e._switchToTextParsing(t,TokenizerMode.SCRIPT_DATA);break;case TAG_ID.TEMPLATE:e._insertTemplate(t),e.activeFormattingElements.insertMarker(),e.framesetOk=!1,e.insertionMode=InsertionMode.IN_TEMPLATE,e.tmplInsertionModeStack.unshift(InsertionMode.IN_TEMPLATE);break;case TAG_ID.HEAD:e._err(t,ERR.misplacedStartTagForHeadElement);break;default:tokenInHead(e,t)}}function templateEndTagInHead(e,t){e.openElements.tmplCount>0?(e.openElements.generateImpliedEndTagsThoroughly(),e.openElements.currentTagId!==TAG_ID.TEMPLATE&&e._err(t,ERR.closingOfElementWithOpenChildElements),e.openElements.popUntilTagNamePopped(TAG_ID.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode()):e._err(t,ERR.endTagWithoutMatchingOpenElement)}function tokenInHead(e,t){e.openElements.pop(),e.insertionMode=InsertionMode.AFTER_HEAD,e._processToken(t)}function tokenInHeadNoScript(e,t){const n=t.type===TokenType.EOF?ERR.openElementsLeftAfterEof:ERR.disallowedContentInNoscriptInHead;e._err(t,n),e.openElements.pop(),e.insertionMode=InsertionMode.IN_HEAD,e._processToken(t)}function tokenAfterHead(e,t){e._insertFakeElement(TAG_NAMES.BODY,TAG_ID.BODY),e.insertionMode=InsertionMode.IN_BODY,modeInBody(e,t)}function modeInBody(e,t){switch(t.type){case TokenType.CHARACTER:characterInBody(e,t);break;case TokenType.WHITESPACE_CHARACTER:whitespaceCharacterInBody(e,t);break;case TokenType.COMMENT:appendComment(e,t);break;case TokenType.START_TAG:startTagInBody(e,t);break;case TokenType.END_TAG:endTagInBody(e,t);break;case TokenType.EOF:eofInBody(e,t)}}function whitespaceCharacterInBody(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t)}function characterInBody(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t),e.framesetOk=!1}function areaStartTagInBody(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,NS.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function isHiddenInput(e){const t=getTokenAttr(e,ATTRS.TYPE);return null!=t&&"hidden"===t.toLowerCase()}function rawTextStartTagInBody(e,t){e._switchToTextParsing(t,TokenizerMode.RAWTEXT)}function genericStartTagInBody(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,NS.HTML)}function startTagInBody(e,t){switch(t.tagID){case TAG_ID.I:case TAG_ID.S:case TAG_ID.B:case TAG_ID.U:case TAG_ID.EM:case TAG_ID.TT:case TAG_ID.BIG:case TAG_ID.CODE:case TAG_ID.FONT:case TAG_ID.SMALL:case TAG_ID.STRIKE:case TAG_ID.STRONG:!function(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,NS.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}(e,t);break;case TAG_ID.A:!function(e,t){const n=e.activeFormattingElements.getElementEntryInScopeWithTagName(TAG_NAMES.A);n&&(callAdoptionAgency(e,t),e.openElements.remove(n.element),e.activeFormattingElements.removeEntry(n)),e._reconstructActiveFormattingElements(),e._insertElement(t,NS.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}(e,t);break;case TAG_ID.H1:case TAG_ID.H2:case TAG_ID.H3:case TAG_ID.H4:case TAG_ID.H5:case TAG_ID.H6:!function(e,t){e.openElements.hasInButtonScope(TAG_ID.P)&&e._closePElement(),void 0!==e.openElements.currentTagId&&NUMBERED_HEADERS.has(e.openElements.currentTagId)&&e.openElements.pop(),e._insertElement(t,NS.HTML)}(e,t);break;case TAG_ID.P:case TAG_ID.DL:case TAG_ID.OL:case TAG_ID.UL:case TAG_ID.DIV:case TAG_ID.DIR:case TAG_ID.NAV:case TAG_ID.MAIN:case TAG_ID.MENU:case TAG_ID.ASIDE:case TAG_ID.CENTER:case TAG_ID.FIGURE:case TAG_ID.FOOTER:case TAG_ID.HEADER:case TAG_ID.HGROUP:case TAG_ID.DIALOG:case TAG_ID.DETAILS:case TAG_ID.ADDRESS:case TAG_ID.ARTICLE:case TAG_ID.SEARCH:case TAG_ID.SECTION:case TAG_ID.SUMMARY:case TAG_ID.FIELDSET:case TAG_ID.BLOCKQUOTE:case TAG_ID.FIGCAPTION:!function(e,t){e.openElements.hasInButtonScope(TAG_ID.P)&&e._closePElement(),e._insertElement(t,NS.HTML)}(e,t);break;case TAG_ID.LI:case TAG_ID.DD:case TAG_ID.DT:!function(e,t){e.framesetOk=!1;const n=t.tagID;for(let t=e.openElements.stackTop;t>=0;t--){const r=e.openElements.tagIDs[t];if(n===TAG_ID.LI&&r===TAG_ID.LI||(n===TAG_ID.DD||n===TAG_ID.DT)&&(r===TAG_ID.DD||r===TAG_ID.DT)){e.openElements.generateImpliedEndTagsWithExclusion(r),e.openElements.popUntilTagNamePopped(r);break}if(r!==TAG_ID.ADDRESS&&r!==TAG_ID.DIV&&r!==TAG_ID.P&&e._isSpecialElement(e.openElements.items[t],r))break}e.openElements.hasInButtonScope(TAG_ID.P)&&e._closePElement(),e._insertElement(t,NS.HTML)}(e,t);break;case TAG_ID.BR:case TAG_ID.IMG:case TAG_ID.WBR:case TAG_ID.AREA:case TAG_ID.EMBED:case TAG_ID.KEYGEN:areaStartTagInBody(e,t);break;case TAG_ID.HR:!function(e,t){e.openElements.hasInButtonScope(TAG_ID.P)&&e._closePElement(),e._appendElement(t,NS.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}(e,t);break;case TAG_ID.RB:case TAG_ID.RTC:!function(e,t){e.openElements.hasInScope(TAG_ID.RUBY)&&e.openElements.generateImpliedEndTags(),e._insertElement(t,NS.HTML)}(e,t);break;case TAG_ID.RT:case TAG_ID.RP:!function(e,t){e.openElements.hasInScope(TAG_ID.RUBY)&&e.openElements.generateImpliedEndTagsWithExclusion(TAG_ID.RTC),e._insertElement(t,NS.HTML)}(e,t);break;case TAG_ID.PRE:case TAG_ID.LISTING:!function(e,t){e.openElements.hasInButtonScope(TAG_ID.P)&&e._closePElement(),e._insertElement(t,NS.HTML),e.skipNextNewLine=!0,e.framesetOk=!1}(e,t);break;case TAG_ID.XMP:!function(e,t){e.openElements.hasInButtonScope(TAG_ID.P)&&e._closePElement(),e._reconstructActiveFormattingElements(),e.framesetOk=!1,e._switchToTextParsing(t,TokenizerMode.RAWTEXT)}(e,t);break;case TAG_ID.SVG:!function(e,t){e._reconstructActiveFormattingElements(),adjustTokenSVGAttrs(t),adjustTokenXMLAttrs(t),t.selfClosing?e._appendElement(t,NS.SVG):e._insertElement(t,NS.SVG),t.ackSelfClosing=!0}(e,t);break;case TAG_ID.HTML:!function(e,t){0===e.openElements.tmplCount&&e.treeAdapter.adoptAttributes(e.openElements.items[0],t.attrs)}(e,t);break;case TAG_ID.BASE:case TAG_ID.LINK:case TAG_ID.META:case TAG_ID.STYLE:case TAG_ID.TITLE:case TAG_ID.SCRIPT:case TAG_ID.BGSOUND:case TAG_ID.BASEFONT:case TAG_ID.TEMPLATE:startTagInHead(e,t);break;case TAG_ID.BODY:!function(e,t){const n=e.openElements.tryPeekProperlyNestedBodyElement();n&&0===e.openElements.tmplCount&&(e.framesetOk=!1,e.treeAdapter.adoptAttributes(n,t.attrs))}(e,t);break;case TAG_ID.FORM:!function(e,t){const n=e.openElements.tmplCount>0;e.formElement&&!n||(e.openElements.hasInButtonScope(TAG_ID.P)&&e._closePElement(),e._insertElement(t,NS.HTML),n||(e.formElement=e.openElements.current))}(e,t);break;case TAG_ID.NOBR:!function(e,t){e._reconstructActiveFormattingElements(),e.openElements.hasInScope(TAG_ID.NOBR)&&(callAdoptionAgency(e,t),e._reconstructActiveFormattingElements()),e._insertElement(t,NS.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}(e,t);break;case TAG_ID.MATH:!function(e,t){e._reconstructActiveFormattingElements(),adjustTokenMathMLAttrs(t),adjustTokenXMLAttrs(t),t.selfClosing?e._appendElement(t,NS.MATHML):e._insertElement(t,NS.MATHML),t.ackSelfClosing=!0}(e,t);break;case TAG_ID.TABLE:!function(e,t){e.treeAdapter.getDocumentMode(e.document)!==DOCUMENT_MODE.QUIRKS&&e.openElements.hasInButtonScope(TAG_ID.P)&&e._closePElement(),e._insertElement(t,NS.HTML),e.framesetOk=!1,e.insertionMode=InsertionMode.IN_TABLE}(e,t);break;case TAG_ID.INPUT:!function(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,NS.HTML),isHiddenInput(t)||(e.framesetOk=!1),t.ackSelfClosing=!0}(e,t);break;case TAG_ID.PARAM:case TAG_ID.TRACK:case TAG_ID.SOURCE:!function(e,t){e._appendElement(t,NS.HTML),t.ackSelfClosing=!0}(e,t);break;case TAG_ID.IMAGE:!function(e,t){t.tagName=TAG_NAMES.IMG,t.tagID=TAG_ID.IMG,areaStartTagInBody(e,t)}(e,t);break;case TAG_ID.BUTTON:!function(e,t){e.openElements.hasInScope(TAG_ID.BUTTON)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(TAG_ID.BUTTON)),e._reconstructActiveFormattingElements(),e._insertElement(t,NS.HTML),e.framesetOk=!1}(e,t);break;case TAG_ID.APPLET:case TAG_ID.OBJECT:case TAG_ID.MARQUEE:!function(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,NS.HTML),e.activeFormattingElements.insertMarker(),e.framesetOk=!1}(e,t);break;case TAG_ID.IFRAME:!function(e,t){e.framesetOk=!1,e._switchToTextParsing(t,TokenizerMode.RAWTEXT)}(e,t);break;case TAG_ID.SELECT:!function(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,NS.HTML),e.framesetOk=!1,e.insertionMode=e.insertionMode===InsertionMode.IN_TABLE||e.insertionMode===InsertionMode.IN_CAPTION||e.insertionMode===InsertionMode.IN_TABLE_BODY||e.insertionMode===InsertionMode.IN_ROW||e.insertionMode===InsertionMode.IN_CELL?InsertionMode.IN_SELECT_IN_TABLE:InsertionMode.IN_SELECT}(e,t);break;case TAG_ID.OPTION:case TAG_ID.OPTGROUP:!function(e,t){e.openElements.currentTagId===TAG_ID.OPTION&&e.openElements.pop(),e._reconstructActiveFormattingElements(),e._insertElement(t,NS.HTML)}(e,t);break;case TAG_ID.NOEMBED:case TAG_ID.NOFRAMES:rawTextStartTagInBody(e,t);break;case TAG_ID.FRAMESET:!function(e,t){const n=e.openElements.tryPeekProperlyNestedBodyElement();e.framesetOk&&n&&(e.treeAdapter.detachNode(n),e.openElements.popAllUpToHtmlElement(),e._insertElement(t,NS.HTML),e.insertionMode=InsertionMode.IN_FRAMESET)}(e,t);break;case TAG_ID.TEXTAREA:!function(e,t){e._insertElement(t,NS.HTML),e.skipNextNewLine=!0,e.tokenizer.state=TokenizerMode.RCDATA,e.originalInsertionMode=e.insertionMode,e.framesetOk=!1,e.insertionMode=InsertionMode.TEXT}(e,t);break;case TAG_ID.NOSCRIPT:e.options.scriptingEnabled?rawTextStartTagInBody(e,t):genericStartTagInBody(e,t);break;case TAG_ID.PLAINTEXT:!function(e,t){e.openElements.hasInButtonScope(TAG_ID.P)&&e._closePElement(),e._insertElement(t,NS.HTML),e.tokenizer.state=TokenizerMode.PLAINTEXT}(e,t);break;case TAG_ID.COL:case TAG_ID.TH:case TAG_ID.TD:case TAG_ID.TR:case TAG_ID.HEAD:case TAG_ID.FRAME:case TAG_ID.TBODY:case TAG_ID.TFOOT:case TAG_ID.THEAD:case TAG_ID.CAPTION:case TAG_ID.COLGROUP:break;default:genericStartTagInBody(e,t)}}function genericEndTagInBody(e,t){const n=t.tagName,r=t.tagID;for(let t=e.openElements.stackTop;t>0;t--){const s=e.openElements.items[t],a=e.openElements.tagIDs[t];if(r===a&&(r!==TAG_ID.UNKNOWN||e.treeAdapter.getTagName(s)===n)){e.openElements.generateImpliedEndTagsWithExclusion(r),e.openElements.stackTop>=t&&e.openElements.shortenToLength(t);break}if(e._isSpecialElement(s,a))break}}function endTagInBody(e,t){switch(t.tagID){case TAG_ID.A:case TAG_ID.B:case TAG_ID.I:case TAG_ID.S:case TAG_ID.U:case TAG_ID.EM:case TAG_ID.TT:case TAG_ID.BIG:case TAG_ID.CODE:case TAG_ID.FONT:case TAG_ID.NOBR:case TAG_ID.SMALL:case TAG_ID.STRIKE:case TAG_ID.STRONG:callAdoptionAgency(e,t);break;case TAG_ID.P:!function(e){e.openElements.hasInButtonScope(TAG_ID.P)||e._insertFakeElement(TAG_NAMES.P,TAG_ID.P),e._closePElement()}(e);break;case TAG_ID.DL:case TAG_ID.UL:case TAG_ID.OL:case TAG_ID.DIR:case TAG_ID.DIV:case TAG_ID.NAV:case TAG_ID.PRE:case TAG_ID.MAIN:case TAG_ID.MENU:case TAG_ID.ASIDE:case TAG_ID.BUTTON:case TAG_ID.CENTER:case TAG_ID.FIGURE:case TAG_ID.FOOTER:case TAG_ID.HEADER:case TAG_ID.HGROUP:case TAG_ID.DIALOG:case TAG_ID.ADDRESS:case TAG_ID.ARTICLE:case TAG_ID.DETAILS:case TAG_ID.SEARCH:case TAG_ID.SECTION:case TAG_ID.SUMMARY:case TAG_ID.LISTING:case TAG_ID.FIELDSET:case TAG_ID.BLOCKQUOTE:case TAG_ID.FIGCAPTION:!function(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n))}(e,t);break;case TAG_ID.LI:!function(e){e.openElements.hasInListItemScope(TAG_ID.LI)&&(e.openElements.generateImpliedEndTagsWithExclusion(TAG_ID.LI),e.openElements.popUntilTagNamePopped(TAG_ID.LI))}(e);break;case TAG_ID.DD:case TAG_ID.DT:!function(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTagsWithExclusion(n),e.openElements.popUntilTagNamePopped(n))}(e,t);break;case TAG_ID.H1:case TAG_ID.H2:case TAG_ID.H3:case TAG_ID.H4:case TAG_ID.H5:case TAG_ID.H6:!function(e){e.openElements.hasNumberedHeaderInScope()&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilNumberedHeaderPopped())}(e);break;case TAG_ID.BR:!function(e){e._reconstructActiveFormattingElements(),e._insertFakeElement(TAG_NAMES.BR,TAG_ID.BR),e.openElements.pop(),e.framesetOk=!1}(e);break;case TAG_ID.BODY:!function(e,t){if(e.openElements.hasInScope(TAG_ID.BODY)&&(e.insertionMode=InsertionMode.AFTER_BODY,e.options.sourceCodeLocationInfo)){const n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e._setEndLocation(n,t)}}(e,t);break;case TAG_ID.HTML:!function(e,t){e.openElements.hasInScope(TAG_ID.BODY)&&(e.insertionMode=InsertionMode.AFTER_BODY,endTagAfterBody(e,t))}(e,t);break;case TAG_ID.FORM:!function(e){const t=e.openElements.tmplCount>0,{formElement:n}=e;t||(e.formElement=null),(n||t)&&e.openElements.hasInScope(TAG_ID.FORM)&&(e.openElements.generateImpliedEndTags(),t?e.openElements.popUntilTagNamePopped(TAG_ID.FORM):n&&e.openElements.remove(n))}(e);break;case TAG_ID.APPLET:case TAG_ID.OBJECT:case TAG_ID.MARQUEE:!function(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n),e.activeFormattingElements.clearToLastMarker())}(e,t);break;case TAG_ID.TEMPLATE:templateEndTagInHead(e,t);break;default:genericEndTagInBody(e,t)}}function eofInBody(e,t){e.tmplInsertionModeStack.length>0?eofInTemplate(e,t):stopParsing(e,t)}function characterInTable(e,t){if(void 0!==e.openElements.currentTagId&&TABLE_STRUCTURE_TAGS.has(e.openElements.currentTagId))switch(e.pendingCharacterTokens.length=0,e.hasNonWhitespacePendingCharacterToken=!1,e.originalInsertionMode=e.insertionMode,e.insertionMode=InsertionMode.IN_TABLE_TEXT,t.type){case TokenType.CHARACTER:characterInTableText(e,t);break;case TokenType.WHITESPACE_CHARACTER:whitespaceCharacterInTableText(e,t)}else tokenInTable(e,t)}function startTagInTable(e,t){switch(t.tagID){case TAG_ID.TD:case TAG_ID.TH:case TAG_ID.TR:!function(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(TAG_NAMES.TBODY,TAG_ID.TBODY),e.insertionMode=InsertionMode.IN_TABLE_BODY,startTagInTableBody(e,t)}(e,t);break;case TAG_ID.STYLE:case TAG_ID.SCRIPT:case TAG_ID.TEMPLATE:startTagInHead(e,t);break;case TAG_ID.COL:!function(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(TAG_NAMES.COLGROUP,TAG_ID.COLGROUP),e.insertionMode=InsertionMode.IN_COLUMN_GROUP,startTagInColumnGroup(e,t)}(e,t);break;case TAG_ID.FORM:!function(e,t){e.formElement||0!==e.openElements.tmplCount||(e._insertElement(t,NS.HTML),e.formElement=e.openElements.current,e.openElements.pop())}(e,t);break;case TAG_ID.TABLE:!function(e,t){e.openElements.hasInTableScope(TAG_ID.TABLE)&&(e.openElements.popUntilTagNamePopped(TAG_ID.TABLE),e._resetInsertionMode(),e._processStartTag(t))}(e,t);break;case TAG_ID.TBODY:case TAG_ID.TFOOT:case TAG_ID.THEAD:!function(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,NS.HTML),e.insertionMode=InsertionMode.IN_TABLE_BODY}(e,t);break;case TAG_ID.INPUT:!function(e,t){isHiddenInput(t)?e._appendElement(t,NS.HTML):tokenInTable(e,t),t.ackSelfClosing=!0}(e,t);break;case TAG_ID.CAPTION:!function(e,t){e.openElements.clearBackToTableContext(),e.activeFormattingElements.insertMarker(),e._insertElement(t,NS.HTML),e.insertionMode=InsertionMode.IN_CAPTION}(e,t);break;case TAG_ID.COLGROUP:!function(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,NS.HTML),e.insertionMode=InsertionMode.IN_COLUMN_GROUP}(e,t);break;default:tokenInTable(e,t)}}function endTagInTable(e,t){switch(t.tagID){case TAG_ID.TABLE:e.openElements.hasInTableScope(TAG_ID.TABLE)&&(e.openElements.popUntilTagNamePopped(TAG_ID.TABLE),e._resetInsertionMode());break;case TAG_ID.TEMPLATE:templateEndTagInHead(e,t);break;case TAG_ID.BODY:case TAG_ID.CAPTION:case TAG_ID.COL:case TAG_ID.COLGROUP:case TAG_ID.HTML:case TAG_ID.TBODY:case TAG_ID.TD:case TAG_ID.TFOOT:case TAG_ID.TH:case TAG_ID.THEAD:case TAG_ID.TR:break;default:tokenInTable(e,t)}}function tokenInTable(e,t){const n=e.fosterParentingEnabled;e.fosterParentingEnabled=!0,modeInBody(e,t),e.fosterParentingEnabled=n}function whitespaceCharacterInTableText(e,t){e.pendingCharacterTokens.push(t)}function characterInTableText(e,t){e.pendingCharacterTokens.push(t),e.hasNonWhitespacePendingCharacterToken=!0}function tokenInTableText(e,t){let n=0;if(e.hasNonWhitespacePendingCharacterToken)for(;n<e.pendingCharacterTokens.length;n++)tokenInTable(e,e.pendingCharacterTokens[n]);else for(;n<e.pendingCharacterTokens.length;n++)e._insertCharacters(e.pendingCharacterTokens[n]);e.insertionMode=e.originalInsertionMode,e._processToken(t)}var TABLE_VOID_ELEMENTS=new Set([TAG_ID.CAPTION,TAG_ID.COL,TAG_ID.COLGROUP,TAG_ID.TBODY,TAG_ID.TD,TAG_ID.TFOOT,TAG_ID.TH,TAG_ID.THEAD,TAG_ID.TR]);function startTagInColumnGroup(e,t){switch(t.tagID){case TAG_ID.HTML:startTagInBody(e,t);break;case TAG_ID.COL:e._appendElement(t,NS.HTML),t.ackSelfClosing=!0;break;case TAG_ID.TEMPLATE:startTagInHead(e,t);break;default:tokenInColumnGroup(e,t)}}function tokenInColumnGroup(e,t){e.openElements.currentTagId===TAG_ID.COLGROUP&&(e.openElements.pop(),e.insertionMode=InsertionMode.IN_TABLE,e._processToken(t))}function startTagInTableBody(e,t){switch(t.tagID){case TAG_ID.TR:e.openElements.clearBackToTableBodyContext(),e._insertElement(t,NS.HTML),e.insertionMode=InsertionMode.IN_ROW;break;case TAG_ID.TH:case TAG_ID.TD:e.openElements.clearBackToTableBodyContext(),e._insertFakeElement(TAG_NAMES.TR,TAG_ID.TR),e.insertionMode=InsertionMode.IN_ROW,startTagInRow(e,t);break;case TAG_ID.CAPTION:case TAG_ID.COL:case TAG_ID.COLGROUP:case TAG_ID.TBODY:case TAG_ID.TFOOT:case TAG_ID.THEAD:e.openElements.hasTableBodyContextInTableScope()&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=InsertionMode.IN_TABLE,startTagInTable(e,t));break;default:startTagInTable(e,t)}}function endTagInTableBody(e,t){const n=t.tagID;switch(t.tagID){case TAG_ID.TBODY:case TAG_ID.TFOOT:case TAG_ID.THEAD:e.openElements.hasInTableScope(n)&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=InsertionMode.IN_TABLE);break;case TAG_ID.TABLE:e.openElements.hasTableBodyContextInTableScope()&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=InsertionMode.IN_TABLE,endTagInTable(e,t));break;case TAG_ID.BODY:case TAG_ID.CAPTION:case TAG_ID.COL:case TAG_ID.COLGROUP:case TAG_ID.HTML:case TAG_ID.TD:case TAG_ID.TH:case TAG_ID.TR:break;default:endTagInTable(e,t)}}function startTagInRow(e,t){switch(t.tagID){case TAG_ID.TH:case TAG_ID.TD:e.openElements.clearBackToTableRowContext(),e._insertElement(t,NS.HTML),e.insertionMode=InsertionMode.IN_CELL,e.activeFormattingElements.insertMarker();break;case TAG_ID.CAPTION:case TAG_ID.COL:case TAG_ID.COLGROUP:case TAG_ID.TBODY:case TAG_ID.TFOOT:case TAG_ID.THEAD:case TAG_ID.TR:e.openElements.hasInTableScope(TAG_ID.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=InsertionMode.IN_TABLE_BODY,startTagInTableBody(e,t));break;default:startTagInTable(e,t)}}function endTagInRow(e,t){switch(t.tagID){case TAG_ID.TR:e.openElements.hasInTableScope(TAG_ID.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=InsertionMode.IN_TABLE_BODY);break;case TAG_ID.TABLE:e.openElements.hasInTableScope(TAG_ID.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=InsertionMode.IN_TABLE_BODY,endTagInTableBody(e,t));break;case TAG_ID.TBODY:case TAG_ID.TFOOT:case TAG_ID.THEAD:(e.openElements.hasInTableScope(t.tagID)||e.openElements.hasInTableScope(TAG_ID.TR))&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=InsertionMode.IN_TABLE_BODY,endTagInTableBody(e,t));break;case TAG_ID.BODY:case TAG_ID.CAPTION:case TAG_ID.COL:case TAG_ID.COLGROUP:case TAG_ID.HTML:case TAG_ID.TD:case TAG_ID.TH:break;default:endTagInTable(e,t)}}function startTagInSelect(e,t){switch(t.tagID){case TAG_ID.HTML:startTagInBody(e,t);break;case TAG_ID.OPTION:e.openElements.currentTagId===TAG_ID.OPTION&&e.openElements.pop(),e._insertElement(t,NS.HTML);break;case TAG_ID.OPTGROUP:e.openElements.currentTagId===TAG_ID.OPTION&&e.openElements.pop(),e.openElements.currentTagId===TAG_ID.OPTGROUP&&e.openElements.pop(),e._insertElement(t,NS.HTML);break;case TAG_ID.HR:e.openElements.currentTagId===TAG_ID.OPTION&&e.openElements.pop(),e.openElements.currentTagId===TAG_ID.OPTGROUP&&e.openElements.pop(),e._appendElement(t,NS.HTML),t.ackSelfClosing=!0;break;case TAG_ID.INPUT:case TAG_ID.KEYGEN:case TAG_ID.TEXTAREA:case TAG_ID.SELECT:e.openElements.hasInSelectScope(TAG_ID.SELECT)&&(e.openElements.popUntilTagNamePopped(TAG_ID.SELECT),e._resetInsertionMode(),t.tagID!==TAG_ID.SELECT&&e._processStartTag(t));break;case TAG_ID.SCRIPT:case TAG_ID.TEMPLATE:startTagInHead(e,t)}}function endTagInSelect(e,t){switch(t.tagID){case TAG_ID.OPTGROUP:e.openElements.stackTop>0&&e.openElements.currentTagId===TAG_ID.OPTION&&e.openElements.tagIDs[e.openElements.stackTop-1]===TAG_ID.OPTGROUP&&e.openElements.pop(),e.openElements.currentTagId===TAG_ID.OPTGROUP&&e.openElements.pop();break;case TAG_ID.OPTION:e.openElements.currentTagId===TAG_ID.OPTION&&e.openElements.pop();break;case TAG_ID.SELECT:e.openElements.hasInSelectScope(TAG_ID.SELECT)&&(e.openElements.popUntilTagNamePopped(TAG_ID.SELECT),e._resetInsertionMode());break;case TAG_ID.TEMPLATE:templateEndTagInHead(e,t)}}function eofInTemplate(e,t){e.openElements.tmplCount>0?(e.openElements.popUntilTagNamePopped(TAG_ID.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode(),e.onEof(t)):stopParsing(e,t)}function endTagAfterBody(e,t){var n;if(t.tagID===TAG_ID.HTML){if(e.fragmentContext||(e.insertionMode=InsertionMode.AFTER_AFTER_BODY),e.options.sourceCodeLocationInfo&&e.openElements.tagIDs[0]===TAG_ID.HTML){e._setEndLocation(e.openElements.items[0],t);const r=e.openElements.items[1];r&&!(null===(n=e.treeAdapter.getNodeSourceCodeLocation(r))||void 0===n?void 0:n.endTag)&&e._setEndLocation(r,t)}}else tokenAfterBody(e,t)}function tokenAfterBody(e,t){e.insertionMode=InsertionMode.IN_BODY,modeInBody(e,t)}function tokenAfterAfterBody(e,t){e.insertionMode=InsertionMode.IN_BODY,modeInBody(e,t)}function popUntilHtmlOrIntegrationPoint(e){for(;e.treeAdapter.getNamespaceURI(e.openElements.current)!==NS.HTML&&void 0!==e.openElements.currentTagId&&!e._isIntegrationPoint(e.openElements.currentTagId,e.openElements.current);)e.openElements.pop()}function parse3(e,t){return Parser3.parse(e,t)}function parseFragment(e,t,n){"string"==typeof e&&(n=t,t=e,e=null);const r=Parser3.getFragmentParser(e,n);return r.tokenizer.write(t,!0),r.getFragment()}String.prototype.codePointAt,TAG_NAMES.AREA,TAG_NAMES.BASE,TAG_NAMES.BASEFONT,TAG_NAMES.BGSOUND,TAG_NAMES.BR,TAG_NAMES.COL,TAG_NAMES.EMBED,TAG_NAMES.FRAME,TAG_NAMES.HR,TAG_NAMES.IMG,TAG_NAMES.INPUT,TAG_NAMES.KEYGEN,TAG_NAMES.LINK,TAG_NAMES.META,TAG_NAMES.PARAM,TAG_NAMES.SOURCE,TAG_NAMES.TRACK,TAG_NAMES.WBR;var errors={abandonedHeadElementChild:{reason:"Unexpected metadata element after head",description:"Unexpected element after head. Expected the element before `</head>`",url:!1},abruptClosingOfEmptyComment:{reason:"Unexpected abruptly closed empty comment",description:"Unexpected `>` or `->`. Expected `--\x3e` to close comments"},abruptDoctypePublicIdentifier:{reason:"Unexpected abruptly closed public identifier",description:"Unexpected `>`. Expected a closing `\"` or `'` after the public identifier"},abruptDoctypeSystemIdentifier:{reason:"Unexpected abruptly closed system identifier",description:"Unexpected `>`. Expected a closing `\"` or `'` after the identifier identifier"},absenceOfDigitsInNumericCharacterReference:{reason:"Unexpected non-digit at start of numeric character reference",description:"Unexpected `%c`. Expected `[0-9]` for decimal references or `[0-9a-fA-F]` for hexadecimal references"},cdataInHtmlContent:{reason:"Unexpected CDATA section in HTML",description:"Unexpected `<![CDATA[` in HTML. Remove it, use a comment, or encode special characters instead"},characterReferenceOutsideUnicodeRange:{reason:"Unexpected too big numeric character reference",description:"Unexpectedly high character reference. Expected character references to be at most hexadecimal 10ffff (or decimal 1114111)"},closingOfElementWithOpenChildElements:{reason:"Unexpected closing tag with open child elements",description:"Unexpectedly closing tag. Expected other tags to be closed first",url:!1},controlCharacterInInputStream:{reason:"Unexpected control character",description:"Unexpected control character `%x`. Expected a non-control code point, 0x00, or ASCII whitespace"},controlCharacterReference:{reason:"Unexpected control character reference",description:"Unexpectedly control character in reference. Expected a non-control code point, 0x00, or ASCII whitespace"},disallowedContentInNoscriptInHead:{reason:"Disallowed content inside `<noscript>` in `<head>`",description:"Unexpected text character `%c`. Only use text in `<noscript>`s in `<body>`",url:!1},duplicateAttribute:{reason:"Unexpected duplicate attribute",description:"Unexpectedly double attribute. Expected attributes to occur only once"},endTagWithAttributes:{reason:"Unexpected attribute on closing tag",description:"Unexpected attribute. Expected `>` instead"},endTagWithTrailingSolidus:{reason:"Unexpected slash at end of closing tag",description:"Unexpected `%c-1`. Expected `>` instead"},endTagWithoutMatchingOpenElement:{reason:"Unexpected unopened end tag",description:"Unexpected end tag. Expected no end tag or another end tag",url:!1},eofBeforeTagName:{reason:"Unexpected end of file",description:"Unexpected end of file. Expected tag name instead"},eofInCdata:{reason:"Unexpected end of file in CDATA",description:"Unexpected end of file. Expected `]]>` to close the CDATA"},eofInComment:{reason:"Unexpected end of file in comment",description:"Unexpected end of file. Expected `--\x3e` to close the comment"},eofInDoctype:{reason:"Unexpected end of file in doctype",description:"Unexpected end of file. Expected a valid doctype (such as `<!doctype html>`)"},eofInElementThatCanContainOnlyText:{reason:"Unexpected end of file in element that can only contain text",description:"Unexpected end of file. Expected text or a closing tag",url:!1},eofInScriptHtmlCommentLikeText:{reason:"Unexpected end of file in comment inside script",description:"Unexpected end of file. Expected `--\x3e` to close the comment"},eofInTag:{reason:"Unexpected end of file in tag",description:"Unexpected end of file. Expected `>` to close the tag"},incorrectlyClosedComment:{reason:"Incorrectly closed comment",description:"Unexpected `%c-1`. Expected `--\x3e` to close the comment"},incorrectlyOpenedComment:{reason:"Incorrectly opened comment",description:"Unexpected `%c`. Expected `\x3c!--` to open the comment"},invalidCharacterSequenceAfterDoctypeName:{reason:"Invalid sequence after doctype name",description:"Unexpected sequence at `%c`. Expected `public` or `system`"},invalidFirstCharacterOfTagName:{reason:"Invalid first character in tag name",description:"Unexpected `%c`. Expected an ASCII letter instead"},misplacedDoctype:{reason:"Misplaced doctype",description:"Unexpected doctype. Expected doctype before head",url:!1},misplacedStartTagForHeadElement:{reason:"Misplaced `<head>` start tag",description:"Unexpected start tag `<head>`. Expected `<head>` directly after doctype",url:!1},missingAttributeValue:{reason:"Missing attribute value",description:"Unexpected `%c-1`. Expected an attribute value or no `%c-1` instead"},missingDoctype:{reason:"Missing doctype before other content",description:"Expected a `<!doctype html>` before anything else",url:!1},missingDoctypeName:{reason:"Missing doctype name",description:"Unexpected doctype end at `%c`. Expected `html` instead"},missingDoctypePublicIdentifier:{reason:"Missing public identifier in doctype",description:"Unexpected `%c`. Expected identifier for `public` instead"},missingDoctypeSystemIdentifier:{reason:"Missing system identifier in doctype",description:'Unexpected `%c`. Expected identifier for `system` instead (suggested: `"about:legacy-compat"`)'},missingEndTagName:{reason:"Missing name in end tag",description:"Unexpected `%c`. Expected an ASCII letter instead"},missingQuoteBeforeDoctypePublicIdentifier:{reason:"Missing quote before public identifier in doctype",description:"Unexpected `%c`. Expected `\"` or `'` instead"},missingQuoteBeforeDoctypeSystemIdentifier:{reason:"Missing quote before system identifier in doctype",description:"Unexpected `%c`. Expected `\"` or `'` instead"},missingSemicolonAfterCharacterReference:{reason:"Missing semicolon after character reference",description:"Unexpected `%c`. Expected `;` instead"},missingWhitespaceAfterDoctypePublicKeyword:{reason:"Missing whitespace after public identifier in doctype",description:"Unexpected `%c`. Expected ASCII whitespace instead"},missingWhitespaceAfterDoctypeSystemKeyword:{reason:"Missing whitespace after system identifier in doctype",description:"Unexpected `%c`. Expected ASCII whitespace instead"},missingWhitespaceBeforeDoctypeName:{reason:"Missing whitespace before doctype name",description:"Unexpected `%c`. Expected ASCII whitespace instead"},missingWhitespaceBetweenAttributes:{reason:"Missing whitespace between attributes",description:"Unexpected `%c`. Expected ASCII whitespace instead"},missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers:{reason:"Missing whitespace between public and system identifiers in doctype",description:"Unexpected `%c`. Expected ASCII whitespace instead"},nestedComment:{reason:"Unexpected nested comment",description:"Unexpected `\x3c!--`. Expected `--\x3e`"},nestedNoscriptInHead:{reason:"Unexpected nested `<noscript>` in `<head>`",description:"Unexpected `<noscript>`. Expected a closing tag or a meta element",url:!1},nonConformingDoctype:{reason:"Unexpected non-conforming doctype declaration",description:'Expected `<!doctype html>` or `<!doctype html system "about:legacy-compat">`',url:!1},nonVoidHtmlElementStartTagWithTrailingSolidus:{reason:"Unexpected trailing slash on start tag of non-void element",description:"Unexpected `/`. Expected `>` instead"},noncharacterCharacterReference:{reason:"Unexpected noncharacter code point referenced by character reference",description:"Unexpected code point. Do not use noncharacters in HTML"},noncharacterInInputStream:{reason:"Unexpected noncharacter character",description:"Unexpected code point `%x`. Do not use noncharacters in HTML"},nullCharacterReference:{reason:"Unexpected NULL character referenced by character reference",description:"Unexpected code point. Do not use NULL characters in HTML"},openElementsLeftAfterEof:{reason:"Unexpected end of file",description:"Unexpected end of file. Expected closing tag instead",url:!1},surrogateCharacterReference:{reason:"Unexpected surrogate character referenced by character reference",description:"Unexpected code point. Do not use lone surrogate characters in HTML"},surrogateInInputStream:{reason:"Unexpected surrogate character",description:"Unexpected code point `%x`. Do not use lone surrogate characters in HTML"},unexpectedCharacterAfterDoctypeSystemIdentifier:{reason:"Invalid character after system identifier in doctype",description:"Unexpected character at `%c`. Expected `>`"},unexpectedCharacterInAttributeName:{reason:"Unexpected character in attribute name",description:"Unexpected `%c`. Expected whitespace, `/`, `>`, `=`, or probably an ASCII letter"},unexpectedCharacterInUnquotedAttributeValue:{reason:"Unexpected character in unquoted attribute value",description:"Unexpected `%c`. Quote the attribute value to include it"},unexpectedEqualsSignBeforeAttributeName:{reason:"Unexpected equals sign before attribute name",description:"Unexpected `%c`. Add an attribute name before it"},unexpectedNullCharacter:{reason:"Unexpected NULL character",description:"Unexpected code point `%x`. Do not use NULL characters in HTML"},unexpectedQuestionMarkInsteadOfTagName:{reason:"Unexpected question mark instead of tag name",description:"Unexpected `%c`. Expected an ASCII letter instead"},unexpectedSolidusInTag:{reason:"Unexpected slash in tag",description:"Unexpected `%c-1`. Expected it followed by `>` or in a quoted attribute value"},unknownNamedCharacterReference:{reason:"Unexpected unknown named character reference",description:"Unexpected character reference. Expected known named character references"}},dashToCamelRe=/-[a-z]/g,formatCRe=/%c(?:([-+])(\d+))?/g,formatXRe=/%x/g,fatalities={2:!0,1:!1,0:null},emptyOptions={};function dashToCamel(e){return e.charAt(1).toUpperCase()}function rehypeParse(e){const{emitParseErrors:t,...n}={...this.data("settings"),...e};this.parser=function(e,r){return function(e,t){const n=t||emptyOptions,r=n.onerror,s=e instanceof VFile?e:new VFile(e),a=n.fragment?parseFragment:parse3,i=String(s),o=a(i,{sourceCodeLocationInfo:!0,onParseError:n.onerror?function(e){const t=e.code,a=function(e){return e.replace(dashToCamelRe,dashToCamel)}(t),o=n[a],l=null==o||o,c="number"==typeof l?l:l?1:0;if(c){const n=errors[a],i=new VFileMessage(u(n.reason),{place:{start:{line:e.startLine,column:e.startCol,offset:e.startOffset},end:{line:e.endLine,column:e.endCol,offset:e.endOffset}},ruleId:t,source:"hast-util-from-html"});s.path&&(i.file=s.path,i.name=s.path+":"+i.name),i.fatal=fatalities[c],i.note=u(n.description),i.url=!1===n.url?void 0:"https://html.spec.whatwg.org/multipage/parsing.html#parse-error-"+t,r(i)}function u(t){return t.replace(formatCRe,function(t,n,r){const s=(r?Number.parseInt(r,10):0)*("-"===n?-1:1);return"`"===(a=i.charAt(e.startOffset+s))?"` ` `":a;var a}).replace(formatXRe,function(){return"0x"+i.charCodeAt(e.startOffset).toString(16).toUpperCase()})}}:null,scriptingEnabled:!1});return function(e,t){const n=t||{};return one({file:n.file||void 0,location:!1,schema:"svg"===n.space?svg4:html4,verbose:n.verbose||!1},e)}(o,{file:s,space:n.space,verbose:n.verbose})}(e,{...n,onerror:t?function(e){r.path&&(e.name=r.path+":"+e.name,e.file=r.path),r.messages.push(e)}:void 0})}}var htmlVoidElements=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"],Schema3=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};function merge3(e,t){const n={},r={};for(const t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new Schema3(n,r,t)}function normalize4(e){return e.toLowerCase()}Schema3.prototype.normal={},Schema3.prototype.property={},Schema3.prototype.space=void 0;var Info6=class{constructor(e,t){this.attribute=t,this.property=e}};Info6.prototype.attribute="",Info6.prototype.booleanish=!1,Info6.prototype.boolean=!1,Info6.prototype.commaOrSpaceSeparated=!1,Info6.prototype.commaSeparated=!1,Info6.prototype.defined=!1,Info6.prototype.mustUseProperty=!1,Info6.prototype.number=!1,Info6.prototype.overloadedBoolean=!1,Info6.prototype.property="",Info6.prototype.spaceSeparated=!1,Info6.prototype.space=void 0;var types_exports3={};__export(types_exports3,{boolean:()=>boolean3,booleanish:()=>booleanish3,commaOrSpaceSeparated:()=>commaOrSpaceSeparated3,commaSeparated:()=>commaSeparated3,number:()=>number3,overloadedBoolean:()=>overloadedBoolean3,spaceSeparated:()=>spaceSeparated3});var powers3=0,boolean3=increment3(),booleanish3=increment3(),overloadedBoolean3=increment3(),number3=increment3(),spaceSeparated3=increment3(),commaSeparated3=increment3(),commaOrSpaceSeparated3=increment3();function increment3(){return 2**++powers3}var checks3=Object.keys(types_exports3),DefinedInfo3=class extends Info6{constructor(e,t,n,r){let s=-1;if(super(e,t),mark3(this,"space",r),"number"==typeof n)for(;++s<checks3.length;){const e=checks3[s];mark3(this,checks3[s],(n&types_exports3[e])===types_exports3[e])}}};function mark3(e,t,n){n&&(e[t]=n)}function create3(e){const t={},n={};for(const[r,s]of Object.entries(e.properties)){const a=new DefinedInfo3(r,e.transform(e.attributes||{},r),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[normalize4(r)]=r,n[normalize4(a.attribute)]=r}return new Schema3(t,n,e.space)}DefinedInfo3.prototype.defined=!0;var aria3=create3({properties:{ariaActiveDescendant:null,ariaAtomic:booleanish3,ariaAutoComplete:null,ariaBusy:booleanish3,ariaChecked:booleanish3,ariaColCount:number3,ariaColIndex:number3,ariaColSpan:number3,ariaControls:spaceSeparated3,ariaCurrent:null,ariaDescribedBy:spaceSeparated3,ariaDetails:null,ariaDisabled:booleanish3,ariaDropEffect:spaceSeparated3,ariaErrorMessage:null,ariaExpanded:booleanish3,ariaFlowTo:spaceSeparated3,ariaGrabbed:booleanish3,ariaHasPopup:null,ariaHidden:booleanish3,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:spaceSeparated3,ariaLevel:number3,ariaLive:null,ariaModal:booleanish3,ariaMultiLine:booleanish3,ariaMultiSelectable:booleanish3,ariaOrientation:null,ariaOwns:spaceSeparated3,ariaPlaceholder:null,ariaPosInSet:number3,ariaPressed:booleanish3,ariaReadOnly:booleanish3,ariaRelevant:null,ariaRequired:booleanish3,ariaRoleDescription:spaceSeparated3,ariaRowCount:number3,ariaRowIndex:number3,ariaRowSpan:number3,ariaSelected:booleanish3,ariaSetSize:number3,ariaSort:null,ariaValueMax:number3,ariaValueMin:number3,ariaValueNow:number3,ariaValueText:null,role:null},transform:(e,t)=>"role"===t?t:"aria-"+t.slice(4).toLowerCase()});function caseSensitiveTransform3(e,t){return t in e?e[t]:t}function caseInsensitiveTransform3(e,t){return caseSensitiveTransform3(e,t.toLowerCase())}var html5=create3({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:commaSeparated3,acceptCharset:spaceSeparated3,accessKey:spaceSeparated3,action:null,allow:null,allowFullScreen:boolean3,allowPaymentRequest:boolean3,allowUserMedia:boolean3,alt:null,as:null,async:boolean3,autoCapitalize:null,autoComplete:spaceSeparated3,autoFocus:boolean3,autoPlay:boolean3,blocking:spaceSeparated3,capture:null,charSet:null,checked:boolean3,cite:null,className:spaceSeparated3,cols:number3,colSpan:null,content:null,contentEditable:booleanish3,controls:boolean3,controlsList:spaceSeparated3,coords:number3|commaSeparated3,crossOrigin:null,data:null,dateTime:null,decoding:null,default:boolean3,defer:boolean3,dir:null,dirName:null,disabled:boolean3,download:overloadedBoolean3,draggable:booleanish3,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:boolean3,formTarget:null,headers:spaceSeparated3,height:number3,hidden:overloadedBoolean3,high:number3,href:null,hrefLang:null,htmlFor:spaceSeparated3,httpEquiv:spaceSeparated3,id:null,imageSizes:null,imageSrcSet:null,inert:boolean3,inputMode:null,integrity:null,is:null,isMap:boolean3,itemId:null,itemProp:spaceSeparated3,itemRef:spaceSeparated3,itemScope:boolean3,itemType:spaceSeparated3,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:boolean3,low:number3,manifest:null,max:null,maxLength:number3,media:null,method:null,min:null,minLength:number3,multiple:boolean3,muted:boolean3,name:null,nonce:null,noModule:boolean3,noValidate:boolean3,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:boolean3,optimum:number3,pattern:null,ping:spaceSeparated3,placeholder:null,playsInline:boolean3,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:boolean3,referrerPolicy:null,rel:spaceSeparated3,required:boolean3,reversed:boolean3,rows:number3,rowSpan:number3,sandbox:spaceSeparated3,scope:null,scoped:boolean3,seamless:boolean3,selected:boolean3,shadowRootClonable:boolean3,shadowRootDelegatesFocus:boolean3,shadowRootMode:null,shape:null,size:number3,sizes:null,slot:null,span:number3,spellCheck:booleanish3,src:null,srcDoc:null,srcLang:null,srcSet:null,start:number3,step:null,style:null,tabIndex:number3,target:null,title:null,translate:null,type:null,typeMustMatch:boolean3,useMap:null,value:booleanish3,width:number3,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:spaceSeparated3,axis:null,background:null,bgColor:null,border:number3,borderColor:null,bottomMargin:number3,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:boolean3,declare:boolean3,event:null,face:null,frame:null,frameBorder:null,hSpace:number3,leftMargin:number3,link:null,longDesc:null,lowSrc:null,marginHeight:number3,marginWidth:number3,noResize:boolean3,noHref:boolean3,noShade:boolean3,noWrap:boolean3,object:null,profile:null,prompt:null,rev:null,rightMargin:number3,rules:null,scheme:null,scrolling:booleanish3,standby:null,summary:null,text:null,topMargin:number3,valueType:null,version:null,vAlign:null,vLink:null,vSpace:number3,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:boolean3,disableRemotePlayback:boolean3,prefix:null,property:null,results:number3,security:null,unselectable:null},space:"html",transform:caseInsensitiveTransform3}),svg5=create3({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:commaOrSpaceSeparated3,accentHeight:number3,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:number3,amplitude:number3,arabicForm:null,ascent:number3,attributeName:null,attributeType:null,azimuth:number3,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:number3,by:null,calcMode:null,capHeight:number3,className:spaceSeparated3,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:number3,diffuseConstant:number3,direction:null,display:null,dur:null,divisor:number3,dominantBaseline:null,download:boolean3,dx:null,dy:null,edgeMode:null,editable:null,elevation:number3,enableBackground:null,end:null,event:null,exponent:number3,externalResourcesRequired:null,fill:null,fillOpacity:number3,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:commaSeparated3,g2:commaSeparated3,glyphName:commaSeparated3,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:number3,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:number3,horizOriginX:number3,horizOriginY:number3,id:null,ideographic:number3,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:number3,k:number3,k1:number3,k2:number3,k3:number3,k4:number3,kernelMatrix:commaOrSpaceSeparated3,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:number3,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:number3,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:number3,overlineThickness:number3,paintOrder:null,panose1:null,path:null,pathLength:number3,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:spaceSeparated3,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:number3,pointsAtY:number3,pointsAtZ:number3,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:commaOrSpaceSeparated3,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:commaOrSpaceSeparated3,rev:commaOrSpaceSeparated3,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:commaOrSpaceSeparated3,requiredFeatures:commaOrSpaceSeparated3,requiredFonts:commaOrSpaceSeparated3,requiredFormats:commaOrSpaceSeparated3,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:number3,specularExponent:number3,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:number3,strikethroughThickness:number3,string:null,stroke:null,strokeDashArray:commaOrSpaceSeparated3,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:number3,strokeOpacity:number3,strokeWidth:null,style:null,surfaceScale:number3,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:commaOrSpaceSeparated3,tabIndex:number3,tableValues:null,target:null,targetX:number3,targetY:number3,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:commaOrSpaceSeparated3,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:number3,underlineThickness:number3,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:number3,values:null,vAlphabetic:number3,vMathematical:number3,vectorEffect:null,vHanging:number3,vIdeographic:number3,version:null,vertAdvY:number3,vertOriginX:number3,vertOriginY:number3,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:number3,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:caseSensitiveTransform3}),xlink3=create3({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform:(e,t)=>"xlink:"+t.slice(5).toLowerCase()}),xmlns3=create3({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:caseInsensitiveTransform3}),xml3=create3({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform:(e,t)=>"xml:"+t.slice(3).toLowerCase()}),cap3=/[A-Z]/g,dash3=/-[a-z]/g,valid3=/^data[-\w.:]+$/i;function kebab3(e){return"-"+e.toLowerCase()}function camelcase4(e){return e.charAt(1).toUpperCase()}var html6=merge3([aria3,html5,xlink3,xmlns3,xml3],"html"),svg6=merge3([aria3,svg5,xlink3,xmlns3,xml3],"svg"),own3={}.hasOwnProperty,defaultSubsetRegex=/["&'<>`]/g,surrogatePairsRegex=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,controlCharactersRegex=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,regexEscapeRegex=/[|\\{}()[\]^$+*?.]/g,subsetToRegexCache=new WeakMap;var key,hexadecimalRegex=/[\dA-Fa-f]/,decimalRegex=/\d/,characterEntitiesLegacy=["AElig","AMP","Aacute","Acirc","Agrave","Aring","Atilde","Auml","COPY","Ccedil","ETH","Eacute","Ecirc","Egrave","Euml","GT","Iacute","Icirc","Igrave","Iuml","LT","Ntilde","Oacute","Ocirc","Ograve","Oslash","Otilde","Ouml","QUOT","REG","THORN","Uacute","Ucirc","Ugrave","Uuml","Yacute","aacute","acirc","acute","aelig","agrave","amp","aring","atilde","auml","brvbar","ccedil","cedil","cent","copy","curren","deg","divide","eacute","ecirc","egrave","eth","euml","frac12","frac14","frac34","gt","iacute","icirc","iexcl","igrave","iquest","iuml","laquo","lt","macr","micro","middot","nbsp","not","ntilde","oacute","ocirc","ograve","ordf","ordm","oslash","otilde","ouml","para","plusmn","pound","quot","raquo","reg","sect","shy","sup1","sup2","sup3","szlig","thorn","times","uacute","ucirc","ugrave","uml","uuml","yacute","yen","yuml"],characterEntitiesHtml4={nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"­",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",fnof:"ƒ",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",bull:"•",hellip:"…",prime:"′",Prime:"″",oline:"‾",frasl:"⁄",weierp:"℘",image:"ℑ",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦",quot:'"',amp:"&",lt:"<",gt:">",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",circ:"ˆ",tilde:"˜",ensp:" ",emsp:" ",thinsp:" ",zwnj:"‌",zwj:"‍",lrm:"‎",rlm:"‏",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",permil:"‰",lsaquo:"‹",rsaquo:"›",euro:"€"},dangerous=["cent","copy","divide","gt","lt","not","para","times"],own4={}.hasOwnProperty,characters={};for(key in characterEntitiesHtml4)own4.call(characterEntitiesHtml4,key)&&(characters[characterEntitiesHtml4[key]]=key);var notAlphanumericRegex=/[^\dA-Za-z]/;function formatSmart(e,t,n){let r,s=function(e,t,n){const r="&#x"+e.toString(16).toUpperCase();return n&&t&&!hexadecimalRegex.test(String.fromCharCode(t))?r:r+";"}(e,t,n.omitOptionalSemicolons);if((n.useNamedReferences||n.useShortestReferences)&&(r=function(e,t,n,r){const s=String.fromCharCode(e);if(own4.call(characters,s)){const e=characters[s],a="&"+e;return n&&characterEntitiesLegacy.includes(e)&&!dangerous.includes(e)&&(!r||t&&61!==t&&notAlphanumericRegex.test(String.fromCharCode(t)))?a:a+";"}return""}(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!r)&&n.useShortestReferences){const r=function(e,t,n){const r="&#"+String(e);return n&&t&&!decimalRegex.test(String.fromCharCode(t))?r:r+";"}(e,t,n.omitOptionalSemicolons);r.length<s.length&&(s=r)}return r&&(!n.useShortestReferences||r.length<s.length)?r:s}function stringifyEntities(e,t){return function(e,t){return e=e.replace(t.subset?function(e){let t=subsetToRegexCache.get(e);return t||(t=function(e){const t=[];let n=-1;for(;++n<e.length;)t.push(e[n].replace(regexEscapeRegex,"\\$&"));return new RegExp("(?:"+t.join("|")+")","g")}(e),subsetToRegexCache.set(e,t)),t}(t.subset):defaultSubsetRegex,n),t.subset||t.escapeOnly?e:e.replace(surrogatePairsRegex,function(e,n,r){return t.format(1024*(e.charCodeAt(0)-55296)+e.charCodeAt(1)-56320+65536,r.charCodeAt(n+2),t)}).replace(controlCharactersRegex,n);function n(e,n,r){return t.format(e.charCodeAt(0),r.charCodeAt(n+1),t)}}(e,Object.assign({format:formatSmart},t))}var htmlCommentRegex=/^>|^->|<!--|-->|--!>|<!-$/g,bogusCommentEntitySubset=[">"],commentEntitySubset=["<",">"];function ccount(e,t){const n=String(e);if("string"!=typeof t)throw new TypeError("Expected character");let r=0,s=n.indexOf(t);for(;-1!==s;)r++,s=n.indexOf(t,s+t.length);return r}var re=/[ \t\n\f\r]/g;function whitespace(e){return"object"==typeof e?"text"===e.type&&empty(e.value):empty(e)}function empty(e){return""===e.replace(re,"")}var siblingAfter=siblings(1),siblingBefore=siblings(-1),emptyChildren=[];function siblings(e){return function(t,n,r){const s=t?t.children:emptyChildren;let a=(n||0)+e,i=s[a];if(!r)for(;i&&whitespace(i);)a+=e,i=s[a];return i}}var own5={}.hasOwnProperty;function omission(e){return function(t,n,r){return own5.call(e,t.tagName)&&e[t.tagName](t,n,r)}}var closing=omission({body:function(e,t,n){const r=siblingAfter(n,t);return!r||"comment"!==r.type},caption:headOrColgroupOrCaption,colgroup:headOrColgroupOrCaption,dd:function(e,t,n){const r=siblingAfter(n,t);return!r||"element"===r.type&&("dt"===r.tagName||"dd"===r.tagName)},dt:function(e,t,n){const r=siblingAfter(n,t);return Boolean(r&&"element"===r.type&&("dt"===r.tagName||"dd"===r.tagName))},head:headOrColgroupOrCaption,html:function(e,t,n){const r=siblingAfter(n,t);return!r||"comment"!==r.type},li:function(e,t,n){const r=siblingAfter(n,t);return!r||"element"===r.type&&"li"===r.tagName},optgroup:function(e,t,n){const r=siblingAfter(n,t);return!r||"element"===r.type&&"optgroup"===r.tagName},option:function(e,t,n){const r=siblingAfter(n,t);return!r||"element"===r.type&&("option"===r.tagName||"optgroup"===r.tagName)},p:function(e,t,n){const r=siblingAfter(n,t);return r?"element"===r.type&&("address"===r.tagName||"article"===r.tagName||"aside"===r.tagName||"blockquote"===r.tagName||"details"===r.tagName||"div"===r.tagName||"dl"===r.tagName||"fieldset"===r.tagName||"figcaption"===r.tagName||"figure"===r.tagName||"footer"===r.tagName||"form"===r.tagName||"h1"===r.tagName||"h2"===r.tagName||"h3"===r.tagName||"h4"===r.tagName||"h5"===r.tagName||"h6"===r.tagName||"header"===r.tagName||"hgroup"===r.tagName||"hr"===r.tagName||"main"===r.tagName||"menu"===r.tagName||"nav"===r.tagName||"ol"===r.tagName||"p"===r.tagName||"pre"===r.tagName||"section"===r.tagName||"table"===r.tagName||"ul"===r.tagName):!n||!("element"===n.type&&("a"===n.tagName||"audio"===n.tagName||"del"===n.tagName||"ins"===n.tagName||"map"===n.tagName||"noscript"===n.tagName||"video"===n.tagName))},rp:rubyElement,rt:rubyElement,tbody:function(e,t,n){const r=siblingAfter(n,t);return!r||"element"===r.type&&("tbody"===r.tagName||"tfoot"===r.tagName)},td:cells,tfoot:function(e,t,n){return!siblingAfter(n,t)},th:cells,thead:function(e,t,n){const r=siblingAfter(n,t);return Boolean(r&&"element"===r.type&&("tbody"===r.tagName||"tfoot"===r.tagName))},tr:function(e,t,n){const r=siblingAfter(n,t);return!r||"element"===r.type&&"tr"===r.tagName}});function headOrColgroupOrCaption(e,t,n){const r=siblingAfter(n,t,!0);return!r||"comment"!==r.type&&!("text"===r.type&&whitespace(r.value.charAt(0)))}function rubyElement(e,t,n){const r=siblingAfter(n,t);return!r||"element"===r.type&&("rp"===r.tagName||"rt"===r.tagName)}function cells(e,t,n){const r=siblingAfter(n,t);return!r||"element"===r.type&&("td"===r.tagName||"th"===r.tagName)}var opening=omission({body:function(e){const t=siblingAfter(e,-1,!0);return!(t&&("comment"===t.type||"text"===t.type&&whitespace(t.value.charAt(0))||"element"===t.type&&("meta"===t.tagName||"link"===t.tagName||"script"===t.tagName||"style"===t.tagName||"template"===t.tagName)))},colgroup:function(e,t,n){const r=siblingBefore(n,t),s=siblingAfter(e,-1,!0);return!(n&&r&&"element"===r.type&&"colgroup"===r.tagName&&closing(r,n.children.indexOf(r),n))&&Boolean(s&&"element"===s.type&&"col"===s.tagName)},head:function(e){const t=new Set;for(const n of e.children)if("element"===n.type&&("base"===n.tagName||"title"===n.tagName)){if(t.has(n.tagName))return!1;t.add(n.tagName)}const n=e.children[0];return!n||"element"===n.type},html:function(e){const t=siblingAfter(e,-1);return!t||"comment"!==t.type},tbody:function(e,t,n){const r=siblingBefore(n,t),s=siblingAfter(e,-1);return(!n||!r||"element"!==r.type||"thead"!==r.tagName&&"tbody"!==r.tagName||!closing(r,n.children.indexOf(r),n))&&Boolean(s&&"element"===s.type&&"tr"===s.tagName)}}),constants={name:[["\t\n\f\r &/=>".split(""),"\t\n\f\r \"&'/=>`".split("")],["\0\t\n\f\r \"&'/<=>".split(""),"\0\t\n\f\r \"&'/<=>`".split("")]],unquoted:[["\t\n\f\r &>".split(""),"\0\t\n\f\r \"&'<=>`".split("")],["\0\t\n\f\r \"&'<=>`".split(""),"\0\t\n\f\r \"&'<=>`".split("")]],single:[["&'".split(""),"\"&'`".split("")],["\0&'".split(""),"\0\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\0"&'.split(""),"\0\"&'`".split("")]]};function serializeAttribute(e,t,n){const r=function(e,t){const n=normalize4(t);let r=t,s=Info6;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&"data"===n.slice(0,4)&&valid3.test(t)){if("-"===t.charAt(4)){const e=t.slice(5).replace(dash3,camelcase4);r="data"+e.charAt(0).toUpperCase()+e.slice(1)}else{const e=t.slice(4);if(!dash3.test(e)){let n=e.replace(cap3,kebab3);"-"!==n.charAt(0)&&(n="-"+n),t="data"+n}}s=DefinedInfo3}return new s(r,t)}(e.schema,t),s=e.settings.allowParseErrors&&"html"===e.schema.space?0:1,a=e.settings.allowDangerousCharacters?0:1;let i,o=e.quote;if(!r.overloadedBoolean||n!==r.attribute&&""!==n?!r.boolean&&!r.overloadedBoolean||"string"==typeof n&&n!==r.attribute&&""!==n||(n=Boolean(n)):n=!0,null==n||!1===n||"number"==typeof n&&Number.isNaN(n))return"";const l=stringifyEntities(r.attribute,Object.assign({},e.settings.characterReferences,{subset:constants.name[s][a]}));return!0===n?l:(n=Array.isArray(n)?(r.commaSeparated?stringify:stringify2)(n,{padLeft:!e.settings.tightCommaSeparatedLists}):String(n),e.settings.collapseEmptyAttributes&&!n?l:(e.settings.preferUnquoted&&(i=stringifyEntities(n,Object.assign({},e.settings.characterReferences,{attribute:!0,subset:constants.unquoted[s][a]}))),i!==n&&(e.settings.quoteSmart&&ccount(n,o)>ccount(n,e.alternative)&&(o=e.alternative),i=o+stringifyEntities(n,Object.assign({},e.settings.characterReferences,{subset:("'"===o?constants.single:constants.double)[s][a],attribute:!0}))+o),l+(i?"="+i:i)))}var textEntitySubset=["<","&"];function text(e,t,n,r){return!n||"element"!==n.type||"script"!==n.tagName&&"style"!==n.tagName?stringifyEntities(e.value,Object.assign({},r.settings.characterReferences,{subset:textEntitySubset})):e.value}var handle=function(e,t){const n=t||{};function r(t,...n){let s=r.invalid;const a=r.handlers;if(t&&own3.call(t,e)){const n=String(t[e]);s=own3.call(a,n)?a[n]:r.unknown}if(s)return s.call(this,t,...n)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}("type",{invalid:function(e){throw new Error("Expected node, not `"+e+"`")},unknown:function(e){throw new Error("Cannot compile unknown node `"+e.type+"`")},handlers:{comment:function(e,t,n,r){return r.settings.bogusComments?"<?"+stringifyEntities(e.value,Object.assign({},r.settings.characterReferences,{subset:bogusCommentEntitySubset}))+">":"\x3c!--"+e.value.replace(htmlCommentRegex,function(e){return stringifyEntities(e,Object.assign({},r.settings.characterReferences,{subset:commentEntitySubset}))})+"--\x3e"},doctype:function(e,t,n,r){return"<!"+(r.settings.upperDoctype?"DOCTYPE":"doctype")+(r.settings.tightDoctype?"":" ")+"html>"},element:function(e,t,n,r){const s=r.schema,a="svg"!==s.space&&r.settings.omitOptionalTags;let i="svg"===s.space?r.settings.closeEmptyElements:r.settings.voids.includes(e.tagName.toLowerCase());const o=[];let l;"html"===s.space&&"svg"===e.tagName&&(r.schema=svg6);const c=function(e,t){const n=[];let r,s=-1;if(t)for(r in t)if(null!==t[r]&&void 0!==t[r]){const s=serializeAttribute(e,r,t[r]);s&&n.push(s)}for(;++s<n.length;){const t=e.settings.tightAttributes?n[s].charAt(n[s].length-1):void 0;s!==n.length-1&&'"'!==t&&"'"!==t&&(n[s]+=" ")}return n.join("")}(r,e.properties),u=r.all("html"===s.space&&"template"===e.tagName?e.content:e);return r.schema=s,u&&(i=!1),!c&&a&&opening(e,t,n)||(o.push("<",e.tagName,c?" "+c:""),i&&("svg"===s.space||r.settings.closeSelfClosing)&&(l=c.charAt(c.length-1),(!r.settings.tightSelfClosing||"/"===l||l&&'"'!==l&&"'"!==l)&&o.push(" "),o.push("/")),o.push(">")),o.push(u),i||a&&closing(e,t,n)||o.push("</"+e.tagName+">"),o.join("")},raw:function(e,t,n,r){return r.settings.allowDangerousHtml?e.value:text(e,0,n,r)},root:function(e,t,n,r){return r.all(e)},text:text}}),emptyOptions2={},emptyCharacterReferences={},emptyChildren2=[];function one2(e,t,n){return handle(e,t,n,this)}function all2(e){const t=[],n=e&&e.children||emptyChildren2;let r=-1;for(;++r<n.length;)t[r]=this.one(n[r],r,e);return t.join("")}function rehypeStringify(e){const t={...this.data("settings"),...e};this.compiler=function(e){return function(e,t){const n=t||emptyOptions2,r=n.quote||'"',s='"'===r?"'":'"';if('"'!==r&&"'"!==r)throw new Error("Invalid quote `"+r+"`, expected `'` or `\"`");return{one:one2,all:all2,settings:{omitOptionalTags:n.omitOptionalTags||!1,allowParseErrors:n.allowParseErrors||!1,allowDangerousCharacters:n.allowDangerousCharacters||!1,quoteSmart:n.quoteSmart||!1,preferUnquoted:n.preferUnquoted||!1,tightAttributes:n.tightAttributes||!1,upperDoctype:n.upperDoctype||!1,tightDoctype:n.tightDoctype||!1,bogusComments:n.bogusComments||!1,tightCommaSeparatedLists:n.tightCommaSeparatedLists||!1,tightSelfClosing:n.tightSelfClosing||!1,collapseEmptyAttributes:n.collapseEmptyAttributes||!1,allowDangerousHtml:n.allowDangerousHtml||!1,voids:n.voids||htmlVoidElements,characterReferences:n.characterReferences||emptyCharacterReferences,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:"svg"===n.space?svg6:html6,quote:r,alternative:s}.one(Array.isArray(e)?{type:"root",children:e}:e,void 0,void 0)}(e,t)}}var convert=function(e){if(null==e)return ok2;if("function"==typeof e)return castFactory(e);if("object"==typeof e)return Array.isArray(e)?function(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=convert(e[n]);return castFactory(function(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1})}(e):function(e){const t=e;return castFactory(function(n){const r=n;let s;for(s in e)if(r[s]!==t[s])return!1;return!0})}(e);if("string"==typeof e)return t=e,castFactory(function(e){return e&&e.type===t});var t;throw new Error("Expected function, string, or object as test")};function castFactory(e){return function(t,n,r){return Boolean(function(e){return null!==e&&"object"==typeof e&&"type"in e}(t)&&e.call(this,t,"number"==typeof n?n:void 0,r||void 0))}}function ok2(){return!0}var empty2=[];var ABSOLUTE_URL_REGEX=/^[a-zA-Z][a-zA-Z\d+\-.]*?:/,WINDOWS_PATH_REGEX=/^[a-zA-Z]:\\/,HTTP_PROTOCOLS_REGEX=/^https?:/i;function isAbsoluteUrl(e,t={}){if("string"!=typeof e)throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);if(WINDOWS_PATH_REGEX.test(e))return!1;if(!ABSOLUTE_URL_REGEX.test(e))return!1;const{httpOnly:n=!0}=t;return!n||HTTP_PROTOCOLS_REGEX.test(e)}var import_path13=__toESM(require("path"));init_log();var log42=getDomainLogger("site",{component:"HtmlLinkProcessor"}),defaultOptions={markdownLinkResolution:"shortest",prettyLinks:!0,openLinksInNewTab:!1,lazyLoad:!1,externalLinkIcon:!0},HtmlLinkProcessor=class{constructor(e,t={}){this.graph=e,this.options={...defaultOptions,...t}}options;async processLinks(e,t){if(!t||"string"!=typeof t)return log42.error("[HtmlLinkProcessor] Invalid HTML input: "+typeof t),{html:t||"",outgoingLinks:[]};const n=this.options,r=simplifySlug(e),s=new Set,a=unified().use(rehypeParse,{fragment:!0}).use(()=>t=>{!function(e,t,n){let r,s,a;s=t,a=n,r=void 0,function(e,t,n,r){let s;"function"==typeof t&&"function"!=typeof n?(r=n,n=t):s=t;const a=convert(s),i=r?-1:1;!function e(s,o,l){const c=s&&"object"==typeof s?s:{};if("string"==typeof c.type){const e="string"==typeof c.tagName?c.tagName:"string"==typeof c.name?c.name:void 0;Object.defineProperty(h,"name",{value:"node ("+(u=s.type+(e?"<"+e+">":""),""+u+")")})}var u;return h;function h(){let c,u,h,d=empty2;if((!t||a(s,o,l[l.length-1]||void 0))&&(d=function(e){return Array.isArray(e)?e:"number"==typeof e?[!0,e]:null==e?empty2:[e]}(n(s,l)),!1===d[0]))return d;if("children"in s&&s.children){const t=s;if(t.children&&"skip"!==d[0])for(u=(r?t.children.length:-1)+i,h=l.concat(t);u>-1&&u<t.children.length;){const n=t.children[u];if(c=e(n,u,h)(),!1===c[0])return c;u="number"==typeof c[1]?c[1]:u+i}}return d}}(e,void 0,[])()}(e,s,function(e,t){const n=t[t.length-1],r=n?n.children.indexOf(e):void 0;return a(e,r,n)},r)}(t,"element",t=>{if("a"===t.tagName&&t.properties){const a=t.properties.dataWikilink||t.properties.dataSlug,i="string"==typeof t.properties.href;if(!i&&!a)return;let o;o=!i&&a?t.properties.dataWikilink||t.properties.dataSlug:t.properties.href;const l=t.properties.className??[],c=isAbsoluteUrl(o,{httpOnly:!1});l.includes("external")||l.includes("internal")||l.push(c?"external":"internal"),c&&n.externalLinkIcon&&t.children.push({type:"element",tagName:"svg",properties:{"aria-hidden":"true",class:"external-icon",style:"max-width:0.8em;max-height:0.8em",viewBox:"0 0 512 512"},children:[{type:"element",tagName:"path",properties:{d:"M320 0H288V64h32 82.7L201.4 265.4 178.7 288 224 333.3l22.6-22.6L448 109.3V192v32h64V192 32 0H480 320zM32 32H0V64 480v32H32 456h32V480 352 320H424v32 96H64V96h96 32V32H160 32z"},children:[]}]}),1===t.children.length&&"text"===t.children[0].type&&t.children[0].value!==o&&l.push("alias"),t.properties.className=l,c&&n.openLinksInNewTab&&(t.properties.target="_blank");const u=!(isAbsoluteUrl(o,{httpOnly:!1})||o.startsWith("#"));if(u){const a=transformLink(e,o,{strategy:n.markdownLinkResolution,allSlugs:this.graph.getAllSlugs()}),i=new URL(a,"https://base.com/"+stripSlashes2(r,!0)).pathname;let[l,c]=splitAnchor2(i);l.endsWith("/")&&(l+="index");const u=decodeURIComponent(stripSlashes2(l,!0)),h=simplifySlug(u);s.add(h);let d=a;if(d.startsWith("./")&&(d=d.slice(2)),d.startsWith("../")){const t=(d.match(/\.\.\//g)||[]).length,n=e.split("/").filter(e=>e).slice(0,-1),r=d.replace(/\.\.\//g,""),s=n.slice(0,n.length-t);r&&s.push(r),d=s.join("/")}d=n.baseURL?`${n.baseURL}/${d}`:`/${d}`;const[p,g]=splitAnchor2(d);let m=p;m.endsWith(".html")||m.endsWith("/")||(m+=".html"),d=m+g,o=t.properties.href=d,t.properties["data-slug"]=u}n.prettyLinks&&u&&1===t.children.length&&"text"===t.children[0].type&&!t.children[0].value.startsWith("#")&&(t.children[0].value=import_path13.default.basename(t.children[0].value))}if(["img","video","audio","iframe"].includes(t.tagName)&&t.properties&&"string"==typeof t.properties.src&&(n.lazyLoad&&(t.properties.loading="lazy"),!isAbsoluteUrl(t.properties.src,{httpOnly:!1}))){let r=t.properties.src;r=t.properties.src=transformLink(e,r,{strategy:n.markdownLinkResolution,allSlugs:this.graph.getAllSlugs()}),t.properties.src=r}})}).use(rehypeStringify),i=await a.process(t);return{html:String(i),outgoingLinks:Array.from(s)}}};init_log();var log43=getDomainLogger("pkg",{component:"page-filter"}),pageFilter=new class{filterSet=null;currentLanguage=null;setFilter(e){this.filterSet=new Set;for(const t of e){const e=`${t.language}:${t.pagePath}`;this.filterSet.add(e)}log43.debug(`Page filter set: ${e.length} tasks`)}setCurrentLanguage(e){this.currentLanguage=e}clearFilter(){this.filterSet=null,this.currentLanguage=null,log43.debug("Page filter cleared")}shouldProcess(e,t){if(!this.filterSet)return!0;const n=`${e}:${t}`;return this.filterSet.has(n)}getFilterSize(){return this.filterSet?.size??0}};function shouldProcessPage(e,t){return pageFilter.shouldProcess(e,t)}var log44=getDomainLogger("site",{component:"site"}),Site=class{configSvc;contentSvc;translationSvc;languageSvc;sitemap;staticCopySvc;publisher;template=null;author;organization;compiler;url;ref=null;language;navigation=null;title;home=null;pageGraph=null;get Title(){return this.title}get Description(){return this.home?.description()||""}get Compiler(){return this.compiler}get IsGoogleAnalyticsEnabled(){return this.configSvc.isGoogleAnalyticsEnabled()}get GoogleAnalyticsID(){return this.configSvc.googleAnalyticsID()}get IsGoogleAnalyticsRespectDoNotTrack(){return this.configSvc.isGoogleAnalyticsRespectDoNotTrack()}get IsDisqusEnabled(){return this.configSvc.isDisqusEnabled()}get DisqusShortname(){return this.configSvc.disqusShortname()}get IsXRespectDoNotTrack(){return this.configSvc.isXRespectDoNotTrack()}get IsXDisableInlineCSS(){return this.configSvc.isXDisableInlineCSS()}get ConfiguredSocialPlatforms(){return this.configSvc.getConfiguredSocialPlatforms()}GetSocialLink(e){return this.configSvc.getSocialLink(e)}GetSocialTitle(e){return this.configSvc.getSocialTitle(e)}async Pages(){const e=this.languageSvc.getLanguageIndex(this.language.getCurrentLanguage()),t=await this.contentSvc.globalPages(e);return this.sitePages(t)}async RegularPages(){const e=await this.contentSvc.globalRegularPages();return this.sitePages(e)}constructor(e,t,n,r,s,a,i,o,l,c,u,h,d,p,g){this.configSvc=e,this.contentSvc=t,this.translationSvc=n,this.languageSvc=r,this.sitemap=s,this.staticCopySvc=a,this.publisher=i,this.author=o,this.organization=l,this.compiler=c,this.url=u,this.ref=h,this.language=d,this.navigation=p,this.title=g}async build(e){try{this.template=e,await this.setup(),await this.copyStaticFiles();const t=this.languageSvc.languageKeys();for(const e of t)this.language.setCurrentLanguage(e),await this.generateNavigations(),await this.render()}catch(e){const t=e instanceof Error?e.message:String(e);throw log44.error(`❌ Site build failed: ${t}`),e}}async renderAllLanguages(){const e=this.languageSvc.languageKeys();for(const t of e)this.language.setCurrentLanguage(t),await this.generateNavigations(),await this.render()}async buildWithProgress(e,t){try{this.template=e,await this.setup(),await this.copyStaticFiles();const n=this.languageSvc.languageKeys();for(const e of n)this.language.setCurrentLanguage(e),await this.generateNavigations(),await this.renderWithProgress(t)}catch(e){const t=e instanceof Error?e.message:String(e);throw log44.error(`❌ Site build failed: ${t}`),e}}async setup(){try{await this.buildPageGraph()}catch(e){const t=e instanceof Error?e.message:String(e);throw log44.error(`❌ Setup failed: ${t}`),e}}async render(){try{await this.renderPages()}catch(e){throw e}}async renderWithProgress(e){try{await this.renderPagesWithProgress(e)}catch(e){throw e}}async renderPages(){const e=this.language.getCurrentLanguage(),t=this.languageSvc.getLanguageIndex(e),n=[];await this.contentSvc.walkPages(t,async e=>{const t=await this.sitePage(e);n.push(t);const r=await this.contentSvc.getPageSources(e);await t.processResources(r),e.isHome()&&(this.home=t)}),log44.info(`📊 Processing wikilinks for ${n.length} pages...`);for(const e of n)try{await e.WikilinkContent()}catch(t){const n=t instanceof Error?t.message:String(t);log44.warn(`⚠️ Failed to process wikilinks for ${e.slug()}: ${n}`)}log44.info("✅ Wikilink processing complete");for(let t=0;t<n.length;t++){const r=n[t];shouldProcessPage(e,r.file().paths().base())&&r.isStale()&&(await r.render(),r.clearStale())}}async renderPagesWithProgress(e){const t=this.languageSvc.getLanguageIndex(this.language.getCurrentLanguage()),n=[];await this.contentSvc.walkPages(t,async e=>{const t=await this.sitePage(e);n.push(t);const r=await this.contentSvc.getPageSources(e);await t.processResources(r),e.isHome()&&(this.home=t)}),log44.info(`📊 Processing wikilinks for ${n.length} pages...`);for(const e of n)try{await e.WikilinkContent()}catch(t){const n=t instanceof Error?t.message:String(t);log44.warn(`⚠️ Failed to process wikilinks for ${e.slug()}: ${n}`)}log44.info("✅ Wikilink processing complete");const r=n.length;for(let t=0;t<n.length;t++){const s=n[t];await s.render(),e?.({currentPage:t+1,totalPages:r})}}async pageOutput(e){return e.output()}clearSiteCache(){}translate(e){return this.translationSvc.translate(this.language.getCurrentLanguage(),e)}get Home(){return this.home}get Params(){return this.configSvc.configParams()}get Taxonomies(){return this.navigation&&this.navigation.getTaxonomies(this.language.getCurrentLanguage())||new TaxonomyList}get Menus(){return this.navigation?this.navigation.getMenus(this.language.getCurrentLanguage()):new Menus}getTitle(){return this.title}setTitle(e){this.title=e}getConfigService(){return this.configSvc}getContentService(){return this.contentSvc}getLanguageService(){return this.languageSvc}baseURL(){return this.url.base}get BaseURL(){return this.baseURL()}getURL(){return this.url}getRef(){return this.ref?this.ref:{}}getLanguage(){return this.language}get Language(){return this.getLanguage()}get LanguageCode(){return this.language.lang()}get Languages(){return this.language.languages()}getNavigation(){return this.navigation?this.navigation:{}}getPublisher(){return this.publisher}getTemplate(){return this.template}get Author(){return this.author.author(this.home?.author())}get Organization(){return this.organization.organization(this.home?.organization())}getCompiler(){return this.compiler}getSitemap(){return this.sitemap}isMultipleLanguage(){return this.language.isMultipleLanguage()}get IsMultilingual(){return this.isMultipleLanguage()}getCurrentLanguage(){return this.language.lang()}languagePrefix(){return this.language.languagePrefix()}async sitePage(e){return new Page2(this.template,this.languageSvc,this.publisher,e,this)}sitePages(e){const t=[];for(let n=0;n<e.length;n++){const r=e[n];try{const e=this.sitePageSync(r);t.push(e)}catch(e){log44.error(`❌ [Site.sitePages] Failed to convert page ${n}:`,e)}}return t}sitePageSync(e){return new Page2(this.template,this.languageSvc,this.publisher,e,this)}async generateNavigations(){const e=this.language.getCurrentLanguage(),t=this.languageSvc.getLanguageIndex(e);this.navigation&&(await this.navigation.generateMenusForLanguage(e,t),await this.navigation.generateTaxonomiesForLanguage(e,t,this))}GetPage(...e){if(e.length>1)throw new Error(`too many arguments to .Site.GetPage: ${e}. Use lookups on the form {{ .Site.GetPage "/posts/mypage-md" }}`);let t=e[0];t=t.replace(/\\/g,"/"),t.startsWith("/")||(t="/"+t);try{const e=this.languageSvc.getLanguageIndex(this.language.getCurrentLanguage()),n=this.contentSvc.getPageFromPathSync(e,t);return n?this.sitePageSync(n):(log44.warn(`⚠️ GetPage: No page found for key "${t}"`),null)}catch(e){return log44.error(`❌ Error getting page "${t}": ${e}`),null}}async copyStaticFiles(){try{await this.staticCopySvc.copyStaticFiles(this.staticCopySvc.staticFs(),this.staticCopySvc.publishFs())}catch(e){throw log44.error("❌ Static file copy failed:",e),e}}async siteWeightedPage(e){const t=await this.sitePage(e.page()),{WeightedPage:n}=await Promise.resolve().then(()=>(init_taxonomies_builder(),taxonomies_builder_exports));return new n(t,e)}async buildPageGraph(){if(this.pageGraph)log44.debug("PageGraph already built, skipping rebuild");else try{const e=[],t=this.languageSvc.languageKeys();for(const n of t){const t=this.languageSvc.getLanguageIndex(n);await this.contentSvc.walkPages(t,async t=>{e.push(t)})}const n=e.map(e=>e.slug());log44.info(`📄 Collected ${n.length} page slugs`);const r=await this.collectResourceSlugs(e);log44.info(`🖼️ Collected ${r.length} resource slugs`);const s=[...n,...r];this.pageGraph=new PageGraph(s),log44.info(`✅ PageGraph built: ${n.length} pages + ${r.length} resources = ${s.length} total`)}catch(e){const t=e instanceof Error?e.message:String(e);throw log44.error(`❌ Failed to build PageGraph: ${t}`),e}}async collectResourceSlugs(e){const t=[],n=new Set;try{for(const r of e)try{const e=await this.contentSvc.getPageSources(r);for(const r of e){const e=r.slug();n.has(e)||(n.add(e),t.push(e))}}catch(e){const t=e instanceof Error?e.message:String(e);log44.debug(`⚠️ Failed to get resources for page ${r.slug()}: ${t}`)}}catch(e){const t=e instanceof Error?e.message:String(e);log44.warn(`⚠️ Failed to collect resource slugs: ${t}`)}return t}async ProcessWikilinks(e,t){if(!this.pageGraph)return log44.warn("⚠️ PageGraph not built yet, returning original HTML"),t;try{let r="";if(this.url&&this.url.base){if(r=this.url.base.replace(/\/$/,""),r.startsWith("/"));else if(r)try{r=new URL2(r).pathname.replace(/\/$/,"")}catch(e){log44.warn(`Failed to parse baseURL as URL: ${r}, treating as path`)}"/"===r&&(r="")}const s=(n=this.pageGraph,new HtmlLinkProcessor(n,{markdownLinkResolution:"shortest",prettyLinks:!0,openLinksInNewTab:!1,lazyLoad:!0,externalLinkIcon:!0,baseURL:r})),a=await s.processLinks(e,t);return this.pageGraph.registerOutgoingLinks(e,a.outgoingLinks),a.html}catch(n){const r=n instanceof Error?n.message:String(n);return log44.error(`❌ Failed to process wikilinks for ${e}: ${r}`),t}var n}getPageGraph(){return this.pageGraph}GetBacklinks(e){return this.pageGraph?this.pageGraph.getBacklinks(e):(log44.warn(`⚠️ PageGraph not built yet, cannot get backlinks for ${e}`),[])}async GetContentIndex(){if(!this.pageGraph)return log44.warn("⚠️ PageGraph not built yet, cannot generate content index"),new Map;const e=new Map,t=await this.RegularPages();for(const n of t){const t=n.slug(),r=this.pageGraph.getOutgoingLinks(t),s=(n.Plain||"").substring(0,1e3);e.set(t,{slug:t,title:n.Title||n.File.OriginalBaseName,links:r,tags:n.Params?.tags||[],content:s})}return log44.debug(`[Site] Generated contentIndex with ${e.size} entries`),e}},import_path15=__toESM(require("path"));init_log(),getDomainLogger("site",{component:"publisher"});var Publisher=class{fs;constructor(e){this.fs=e}async publishSource(e,...t){const n=await this.openFilesForWriting(...t);try{const t="string"==typeof e?(new TextEncoder).encode(e):e;await this.copyToWriter(n,t)}finally{await n.close()}}async publishFiles(e,...t){const n=await this.openFilesForWriting(...t);try{await this.copyStreamToWriter(n,e)}finally{await n.close()}}async openFilesForWriting(...e){const t=[];for(const n of e){const e=await openFileForWriting(this.fs,n);t.push(e)}return new MultiWriter(t)}async copyToWriter(e,t){await e.write(t)}async copyStreamToWriter(e,t){const n=t.getReader();try{for(;;){const{done:t,value:r}=await n.read();if(t)break;await e.write(r)}}finally{n.releaseLock()}}},MultiWriter=class{files;constructor(e){this.files=e}async write(e){const t=this.files.map(t=>t.write(e));await Promise.all(t)}async close(){const e=this.files.map(e=>e.close());await Promise.all(e)}};async function openFileForWriting(e,t){const n=import_path15.default.normalize(t);try{return await e.create(n)}catch(t){if(!function(e){return e&&("ENOENT"===e.code||"FILE_NOT_FOUND"===e.code||e.message?.includes("not found")||e.message?.includes("no such file"))}(t))throw t;const r=import_path15.default.dirname(n);return await e.mkdirAll(r,511),await e.create(n)}}init_log();var log46=getDomainLogger("site",{component:"ref"}),Ref=class{site;contentSvc;notFoundURL;constructor(e,t,n="#ZgotmplZ"){this.site=e,this.contentSvc=t,this.notFoundURL=n}async relRefFrom(e,t){return this.relRef(e,t)}async relRef(e,t){try{const n=this.decodeRefArgs(e);return n.path?this.refLink(n.path,t,!0,n.outputFormat):""}catch(e){throw new Error(`Invalid arguments to Ref: ${e}`)}}decodeRefArgs(e){return{path:e.path||"",outputFormat:e.outputFormat||""}}async refLink(e,t,n,r){const s=t;if(!s||"function"!=typeof s.unwrapPage)throw new Error("source is not a PageWrapper");const a=s.unwrapPage();let i;const o=e.replace(/\\/g,"/");try{i=new globalThis.URL(o,"http://example.com")}catch(e){return log46.error(`Failed to parse ref URL: ${e}`),this.notFoundURL}let l=null,c="";if(""!==i.pathname)try{l=await this.contentSvc.getPageRef(a,i.pathname,this.site.home.page);let e=null;if(l||this.isPositioner(t)&&(e=t.position()),!l)return this.logNotFound(i.pathname,"page not found",a,e),this.notFoundURL;const r=await this.site.sitePage(l);c=n?r.relPermalink():r.permalink()}catch(t){return log46.error(`[${a.pageIdentity().pageLanguage()}] REF_NOT_FOUND: Ref "${e}": ${t}`),this.notFoundURL}return i.hash&&(c=c+"#"+i.hash),c}isPositioner(e){return e&&"function"==typeof e.position}logNotFound(e,t,n,r){const s=n.pageIdentity().pageLanguage();r&&r.isValid()?log46.error(`[${s}] REF_NOT_FOUND: Ref "${e}": ${r.toString()}: ${t}`):n?log46.error(`[${s}] REF_NOT_FOUND: Ref "${e}" from page "${n.path()}": ${t}`):log46.error(`[${s}] REF_NOT_FOUND: Ref "${e}": ${t}`)}};init_log(),getDomainLogger("site",{component:"language"});var CollatorWrapper=class{collator;constructor(e){this.collator=e}compare(e,t){return this.collator.compare(e,t)}},Language2=class e{langSvc;currentLocation;currentLanguage;collator=null;constructor(e){this.langSvc=e,this.currentLocation="UTC",this.currentLanguage=""}currentLanguageIndex(){try{return this.langSvc.getLanguageIndex(this.currentLanguage)}catch(e){throw new Error(`language "${this.currentLanguage}" not found`)}}async setup(){this.currentLocation="UTC"}languages(){const t=[];for(const n of this.langSvc.languageKeys()){const r=new e(this.langSvc);r.currentLocation=this.currentLocation,r.currentLanguage=n,r.collator=this.collator,t.push(r)}return t}getCollator(){if(!this.collator)try{const e=new Intl.Collator(this.currentLanguage||"en");this.collator=new CollatorWrapper({compare:(t,n)=>e.compare(t,n)})}catch(e){const t=new Intl.Collator("en");this.collator=new CollatorWrapper({compare:(e,n)=>t.compare(e,n)})}return this.collator}location(){return this.currentLocation}isMultipleLanguage(){return this.langSvc.languageKeys().length>1}languagePrefix(){return this.currentLanguage===this.langSvc.defaultLanguage()?"":this.currentLanguage}lang(){return this.currentLanguage}get Lang(){return this.lang()}languageName(){return this.langSvc.getLanguageName(this.currentLanguage)}get LanguageName(){return this.languageName()}defaultLanguageName(){return this.langSvc.getLanguageName(this.langSvc.defaultLanguage())}languageCode(){return this.currentLanguage}get LanguageCode(){return this.languageCode()}get LanguageDirection(){return"ltr"}languageDirection(){return"ltr"}setCurrentLanguage(e){this.currentLanguage=e}getCurrentLanguage(){return this.currentLanguage}setCurrentLocation(e){this.currentLocation=e}},Author2=class{_name;_email;_homeAuthor;constructor(e,t){this._name=e,this._email=t}name(){return this._name}email(){return this._email}author(e){return this._homeAuthor=e,this}get Name(){return this._homeAuthor?.name||this.name()}get Description(){return this._homeAuthor?.description||""}get Avatar(){return this._homeAuthor?.avatar||""}get Twitter(){return this._homeAuthor?.social?.twitter||""}get Socials(){const e=[];if(!this._homeAuthor?.social)return e;for(const[t,n]of Object.entries(this._homeAuthor.social))n&&e.push({ID:t,Link:n});return e}};init_log(),getDomainLogger("site",{component:"organization"});var Organization2=class{_name;_description;_website;_logo;_email;_address;_vision;_homeOrganization;constructor(){this._name="MDFriday",this._description="Turn markdown to website, in minutes.",this._website="https://mdfriday.com",this._logo="https://gohugo.net/mdfriday.svg",this._email="support@mdfriday.com",this._address="Cang long Street, Wuhan, China",this._vision="Make site generation easy and accessible for everyone."}name(){return this._name}description(){return this._description}website(){return this._website}organization(e){return this._homeOrganization=e,this}get Name(){return this._homeOrganization?.name||this.name()}get Description(){return this._homeOrganization?.description||this.description()}get Website(){return this._homeOrganization?.website||this.website()}get Vision(){return this._homeOrganization?.vision||this._vision}get Logo(){return this._homeOrganization?.logo||this._logo}get Address(){return this._homeOrganization?.contact?.address||this._address}get Email(){return this._homeOrganization?.contact?.email||this._email}get Social(){return this._homeOrganization?.social}SocialById(e){return this._homeOrganization?.social?.[e]||""}get Socials(){const e=[];if(!this._homeOrganization?.social)return e;for(const[t,n]of Object.entries(this._homeOrganization.social))n&&e.push({ID:t,Link:n});return e}},Compiler=class{ver;constructor(e){this.ver=e}version(){return this.ver}environment(){return"production"}};init_log();var log49=getDomainLogger("site",{component:"navigation"}),Navigation=class{taxonomies;taxonomiesBuilder=null;taxonomiesCache=new Map;menus;menuBuilder=null;menuCache=new Map;constructor(e){this.taxonomies=new Map,this.menus=new Map;for(const t of e.languageKeys())this.menus.set(t,newEmptyMenus()),this.menuCache.set(t,!1)}setMenuBuilder(e){this.menuBuilder=e}setTaxonomiesBuilder(e){this.taxonomiesBuilder=e}async generateMenusForLanguage(e,t){if(this.menuBuilder){if(!0!==this.menuCache.get(e))try{const n=await this.menuBuilder.buildMenusForLanguage(t);this.menus.set(e,n),this.menuCache.set(e,!0)}catch(t){log49.error(`Failed to generate menus for language ${e}: ${t}`)}}else log49.error("Menu builder not set, cannot generate menus")}async generateTaxonomiesForLanguage(e,t,n){if(this.taxonomiesBuilder){if(!0!==this.taxonomiesCache.get(e))try{const r=await this.taxonomiesBuilder.buildTaxonomiesForLanguage(t,n);this.taxonomies.set(e,r),this.taxonomiesCache.set(e,!0)}catch(t){log49.error(`Failed to generate taxonomies for language ${e}: ${t}`)}}else log49.error("Taxonomies builder not set, cannot generate taxonomies")}getMenus(e){let t=this.menus.get(e);return void 0===t&&(t=newEmptyMenus()),t}getTaxonomies(e){return this.taxonomies.get(e)}};init_log();var log50=getDomainLogger("site",{component:"menu-builder"}),MenuBuilder=class{contentService;site;constructor(e,t){this.contentService=e,this.site=t}async buildMenusForLanguage(e){const t=new Map;return await this.contentService.walkPages(e,async e=>{await this.processPage(e,t)}),this.convertToMenus(t)}async processPage(e,t){try{const n=e.menu();if(!n)return;const r=await this.generatePageUrl(e);for(const[s,a]of Object.entries(n))await this.processMenuSection(s,a,r,e,t)}catch(e){log50.error(`Error processing page for menu: ${e}`)}}async processMenuSection(e,t,n,r,s){if(!(!1===t||Array.isArray(t)&&0===t.length))if(Array.isArray(t))await this.processMenuItems(e,t,n,r,s);else if(t&&"object"==typeof t){let a=0;for(const[i,o]of Object.entries(t))if(!(!1===o||Array.isArray(o)&&0===o.length)&&Array.isArray(o)){const t=`${e}.${i}`;if(await this.processMenuItems(t,o,n,r,s),"footer"===e){const e=`${t}::__subsection__`;s.has(e)||s.set(e,{title:i,url:"",children:new Map,weight:1e3,level:0,menuName:t,order:a})}a++}}}async processMenuItems(e,t,n,r,s){for(let a=0;a<t.length;a++){const i=t[a];if(!i||"object"!=typeof i)continue;if(!i.title||"string"!=typeof i.title)continue;let o=i.url||"";o=""===o?n:await this.processMenuItemUrl(o);const l="number"==typeof i.weight?i.weight:1e3,c=`${e}::${i.title}`;let u=s.get(c);u?l<u.weight&&(u.weight=l,u.url=o):(u={title:i.title,url:o,children:new Map,weight:l,level:0,menuName:e||void 0,order:a},s.set(c,u)),Array.isArray(i.children)&&await this.processChildrenItems(c,i.children,n,r,s,u)}}async processChildrenItems(e,t,n,r,s,a){for(let i=0;i<t.length;i++){const o=t[i];if(!o||"object"!=typeof o)continue;if(!o.title||"string"!=typeof o.title)continue;let l=o.url||"";l=""===l?n:await this.processMenuItemUrl(l);const c="number"==typeof o.weight?o.weight:1e3,u=`${e}::${o.title}`,h={title:o.title,url:l,children:new Map,weight:c,level:a.level+1,menuName:a.menuName||void 0,order:i};s.set(u,h),a.children.set(u,h),Array.isArray(o.children)&&await this.processChildrenItems(u,o.children,n,r,s,h)}}async generatePageUrl(e){try{return(await this.site.sitePage(e)).RelPermalink}catch(t){return log50.error(`Error generating page URL for ${e.path()}: ${t}`),this.fallbackUrlFromPath(e.path())}}async processMenuItemUrl(e){try{return this.site.getURL().relURL(e)}catch(t){return log50.error(`Error processing menu item URL ${e}: ${t}`),e}}fallbackUrlFromPath(e){let t=e.replace(/\.md$/,"");return t.startsWith("/")||(t="/"+t),t.endsWith("/")||t.includes(".")||(t+="/"),t}convertToMenus(e){const t=new Map;for(const[n,r]of e.entries())if(!n.includes("::__subsection__")&&0===r.level){const e=r.menuName||"main";t.has(e)||t.set(e,[]),t.get(e).push(r)}const n=this.buildMenuItems(t.get("nav")||[],e),r=[],s=new Map,a=new Map;for(const[n,r]of t.entries())if(n.startsWith("footer.")){const t=n.substring(7),i=this.buildMenuItems(r,e,!1);s.set(t,i);const o=`${n}::__subsection__`,l=e.get(o);l&&a.set(t,l.order)}const i=Array.from(s.entries()).sort((e,t)=>(a.get(e[0])||0)-(a.get(t[0])||0));for(let e=0;e<i.length;e++){const[t,n]=i[e];if(n.length>0){const s=new Menu2({title:this.capitalizeFirstLetter(t),url:"",children:n,weight:e+1,identifier:`footer-${t}`});r.push(s)}}const o={};return n.length>0&&(o.nav=n),r.length>0&&(o.footer=r),new Menus(o)}capitalizeFirstLetter(e){return e.charAt(0).toUpperCase()+e.slice(1)}buildMenuItems(e,t,n=!0){const r=[];for(const s of e){const e=Array.from(s.children.values()),a=e.length>0?this.buildMenuItems(e,t,n):[],i=new Menu2({title:s.title,url:s.url,children:a,weight:s.weight,identifier:s.url});r.push(i)}return n?r.sort((e,t)=>e.weight()!==t.weight()?e.weight()-t.weight():e.title().localeCompare(t.title())):r.sort((t,n)=>{const r=e.find(e=>e.title===t.title()),s=e.find(e=>e.title===n.title());return(r?.order||0)-(s?.order||0)})}};init_taxonomies_builder(),init_log();var log51=getDomainLogger("site",{component:"navigation-factory"}),NavigationFactory=class{langService;contentService;site;constructor(e,t,n){this.langService=e,this.contentService=t,this.site=n}createNavigation(){try{const t=(e=this.langService,new Navigation(e)),n=new MenuBuilder(this.contentService,this.site);t.setMenuBuilder(n);const r=new TaxonomiesBuilder(this.contentService);return t.setTaxonomiesBuilder(r),t}catch(e){throw log51.error(`Failed to create Navigation entity: ${e}`),e}var e}};init_log(),getDomainLogger("site",{component:"factory"}),init_log();var import_path16=__toESM(require("path")),import_crypto=require("crypto"),import_stream=require("stream"),import_promises=require("stream/promises");init_log();var log53=getDomainLogger("resources",{component:"publisher"}),ResourceHash=class{value="";size=0;resource=null;async setup(e){if(this.value)return;this.resource=e;const t=await e.readSeekCloser(),n=(0,import_crypto.createHash)("sha256");let r=0;const s=[];t.on("data",e=>{n.update(e),r+=e.length,s.push(e)}),await new Promise((e,s)=>{t.on("end",()=>{this.value=n.digest("hex"),this.size=r,e()}),t.on("error",s)}),await t.close()}},PublishOnce=class{hasPublished=!1;publishPromise=null;async do(e){if(!this.hasPublished)return this.publishPromise||(this.publishPromise=e().then(()=>{this.hasPublished=!0})),this.publishPromise}},ResourceImpl=class e{h;openReadSeekCloser;_mediaType;paths;_data;publisher;publishOnce;constructor(e,t,n,r={},s){this.h=new ResourceHash,this.openReadSeekCloser=e,this._mediaType=t,this.paths=n,this._data=r,this.publisher=s,this.publishOnce=new PublishOnce}name(){return this.paths.pathFile()}nameNormalized(){return this.paths.targetPath().replace(/\\/g,"/")}mediaType(){return this._mediaType}resourceType(){return this._mediaType.mainType}relPermalink(){return this.publish(),this.paths.targetLink()}permalink(){return this.publish(),this.paths.targetPath()}async publish(){const e=this.targetPath();this.publisher?await this.publishOnce.do(async()=>{let t=null,n=null;try{t=await this.publisher.openPublishFileForWriting(this.paths.targetPath()),n=await this.readSeekCloser(),await this.copyStreamToFile(n,t)}catch(t){throw log53.errorf("❌ [Resource.publish] Error publishing %s: %s",e,t),t}finally{if(n)try{await n.close()}catch(t){log53.errorf("❌ [Resource.publish] Failed to close ReadSeekCloser %s: %s",e,t)}if(t)try{await t.file.close()}catch(t){log53.errorf("❌ [Resource.publish] Failed to close public writer %s: %s",e,t)}}}):log53.error("⚠️ [Resource.publish] No publisher for: %s",e)}async copyStreamToFile(e,t){const n=this.targetPath();try{await(0,import_promises.pipeline)(e,t)}catch(e){throw log53.errorf("❌ [copyStreamToFile] Error during pipeline for %s: %s",n,e),e}}targetPath(){return this.paths.targetPath()}data(){return this._data}async readSeekCloser(){const e=await this.openReadSeekCloser();if(e&&"function"==typeof e.read){const t=e.read();if(t){const n=new(0,require("stream").Readable);let r;for(n.push(t);null!==(r=e.read());)r&&n.push(r);return n.push(null),Object.assign(n,{seek:async(e,t)=>0,close:async()=>Promise.resolve()})}}return e}async content(e){const t=await this.readSeekCloser();return new Promise((e,n)=>{let r="";t.on("data",e=>{r+=e.toString()}),t.on("end",()=>{e(r)}),t.on("error",n)})}async hash(){return await this.h.setup(this),this.h.value}async size(){return await this.h.setup(this),this.h.size}cloneTo(e){const t=this.clone();return t.paths=t.paths.fromTargetPath(e),t}clone(){const t=new e(this.openReadSeekCloser,this._mediaType,this.paths,{...this._data},this.publisher);return t.h=this.h,t}key(){return this.paths.targetLink()}get RelPermalink(){return this.relPermalink()}get Permalink(){return this.permalink()}get Name(){return this.name()}get MediaType(){return this.mediaType()}get ResourceType(){return this.resourceType()}get TargetPath(){return this.targetPath()}get Data(){return this.data()}get Content(){return this.content()}get Hash(){return()=>this.hash()}get Size(){return()=>this.size()}meta(){return new ResourceMetadataImpl(this.paths.targetPath(),this._mediaType.type,this._data)}mergeData(e){if(e&&0!==Object.keys(e).length)for(const[t,n]of Object.entries(e))t in this._data||(this._data[t]=n)}async transform(...e){let t=this;for(let n=0;n<e.length;n++){const r=e[n];try{const e=await t.readSeekCloser(),n=new import_stream.PassThrough;let s="";const a=[],i={source:{from:e,inPath:t.targetPath(),inMediaType:t.mediaType()},target:{to:n},data:{...t.data()},addOutPathIdentifier:e=>{const n=t.targetPath(),r=PathDomain.parseBasic(n);let s=r.dir;s=s.replace(/\/+$/,"");let a="";s&&(a=s+"/"),a+=r.nameWithoutExt+e+r.ext,i.data.targetPath=a},updateBuffer:()=>{},updateSource:()=>{},close:()=>{e.close()}};n.on("data",e=>{a.push(e)});const o=new Promise((e,t)=>{n.on("end",()=>{s=Buffer.concat(a).toString(),e()}),n.on("error",e=>{t(e)})});await r.transform(i),await o;const l=i.data.targetPath||t.targetPath(),c=this.createTransformedResource(s,l,t.mediaType(),i.data);t=c,i.close()}catch(e){throw e}}return t}createTransformedResource(t,n,r,s){const a=this.paths.fromTargetPath(n);return new e(async()=>{const e=new import_stream.PassThrough;return e.end(t),Object.assign(e,{seek:async(e,t)=>0,close:async()=>Promise.resolve()})},r,a,s,this.publisher)}},import_terser=require("terser"),MinifierClient=class{minifiers=new Map;minifyOutput;constructor(e=!1){this.minifyOutput=e,this.setupMinifiers()}setupMinifiers(){this.minifiers.set("text/css",this.minifyCSS.bind(this)),this.minifiers.set("text/javascript",this.minifyJS.bind(this)),this.minifiers.set("application/javascript",this.minifyJS.bind(this)),this.minifiers.set("application/json",this.minifyJSON.bind(this)),this.minifiers.set("text/html",this.minifyHTML.bind(this)),this.minifiers.set("image/svg+xml",this.minifySVG.bind(this)),this.minifiers.set("application/xml",this.minifyXML.bind(this)),this.minifiers.set("text/xml",this.minifyXML.bind(this))}async minify(e){const t=new MinifyTransformation(this);return e.transform(t)}getMinifier(e){return this.minifiers.get(e)||null}async minifyCSS(e){return e}async minifyJS(e){try{return(await(0,import_terser.minify)(e,{compress:{drop_console:!1,drop_debugger:!0,passes:2},mangle:{toplevel:!1},format:{comments:!1}})).code||e}catch(t){return e}}async minifyJSON(e){try{return JSON.stringify(JSON.parse(e))}catch{return e}}async minifyHTML(e){return e}async minifySVG(e){return e}async minifyXML(e){return e}},MinifyTransformation=class{constructor(e){this.minifierClient=e}key(){return ResourceTransformationKey.newResourceTransformationKey("minify")}async transform(e){e.addOutPathIdentifier(".min");const t=e.source.inMediaType.type,n=this.minifierClient.getMinifier(t);if(!n)return void e.source.from.pipe(e.target.to);let r="";e.source.from.on("data",e=>{r+=e.toString()}),await new Promise((t,s)=>{e.source.from.on("end",async()=>{try{const s=await n(r);e.target.to.write(s),e.target.to.end(),t()}catch(e){s(e)}}),e.source.from.on("error",s)})}},import_crypto2=require("crypto"),IntegrityClient=class{async fingerprint(e,t="sha256"){const n=new FingerprintTransformation(t);return e.transform(n)}generateIntegrity(e){return`sha256-${(0,import_crypto2.createHash)("sha256").update(e,"utf8").digest("base64")}`}generateSHA384(e){return`sha384-${(0,import_crypto2.createHash)("sha384").update(e,"utf8").digest("base64")}`}generateSHA512(e){return`sha512-${(0,import_crypto2.createHash)("sha512").update(e,"utf8").digest("base64")}`}verifyIntegrity(e,t){const[n,r]=t.split("-",2);let s;switch(n){case"sha256":s=(0,import_crypto2.createHash)("sha256").update(e,"utf8").digest("base64");break;case"sha384":s=(0,import_crypto2.createHash)("sha384").update(e,"utf8").digest("base64");break;case"sha512":s=(0,import_crypto2.createHash)("sha512").update(e,"utf8").digest("base64");break;default:return!1}return s===r}},FingerprintTransformation=class{constructor(e){this.algo=e}key(){return ResourceTransformationKey.newResourceTransformationKey("fingerprint",this.algo)}async transform(e){const t=this.newHash(this.algo);let n="";const r=[];e.source.from.on("data",e=>{t.update(e),r.push(e),n+=e.toString()}),await new Promise((n,s)=>{e.source.from.on("end",()=>{try{const s=t.digest(),a=s.toString("hex");e.data.Integrity=this.integrity(this.algo,s);const i=a.substring(0,12);e.addOutPathIdentifier("."+i);for(const t of r)e.target.to.write(t);e.target.to.end(),n()}catch(e){s(e)}}),e.source.from.on("error",s)})}newHash(e){switch(e){case"md5":return(0,import_crypto2.createHash)("md5");case"sha256":return(0,import_crypto2.createHash)("sha256");case"sha384":return(0,import_crypto2.createHash)("sha384");case"sha512":return(0,import_crypto2.createHash)("sha512");default:throw new Error(`Unsupported hash algorithm: "${e}", use either md5, sha256, sha384 or sha512`)}}integrity(e,t){return`${e}-${t.toString("base64")}`}},ExecuteAsTemplateTransform=class{templateExecutor;_targetPath;data;constructor(e,t,n){this.templateExecutor=e,this._targetPath=t,this.data=n}key(){return ResourceTransformationKey.newResourceTransformationKey("execute-as-template",this._targetPath)}async transform(e){try{e.data.targetPath=this._targetPath;let t="";if("function"==typeof e.source.from.read){let n;const r=[];for(;null!==(n=e.source.from.read());)n&&r.push(n);if(r.length>0)t=Buffer.concat(r).toString();else if(e.source.from._readableState&&e.source.from._readableState.buffer){const n=e.source.from._readableState.buffer,r=[];for(const e of n)e&&e.chunk&&r.push(e.chunk);r.length>0&&(t=Buffer.concat(r).toString())}}if(!t)return new Promise((t,n)=>{const r=[];e.source.from.on("data",e=>{r.push(e)}),e.source.from.on("end",async()=>{try{const s=Buffer.concat(r).toString();await this.executeTemplate(s,e,t,n)}catch(t){n(new Error(`failed to parse Resource "${e.source.inPath}" as Template: ${t}`))}}),e.source.from.on("error",e=>{n(e)}),"function"==typeof e.source.from.resume&&e.source.from.resume()});await this.executeTemplateSync(t,e)}catch(t){throw new Error(`failed to parse Resource "${e.source.inPath}" as Template: ${t}`)}}async executeTemplateSync(e,t){const n=await this.templateExecutor.executeTemplate(t.source.inPath,e,this.data);t.target.to.write(n),t.target.to.end()}async executeTemplate(e,t,n,r){try{await this.executeTemplateSync(e,t),n()}catch(e){r(e instanceof Error?e:new Error(String(e)))}}},TemplateClient=class{templateExecutor;constructor(e){this.templateExecutor=e}async executeAsTemplate(e,t,n){try{if(!e)throw new Error("Resource is null or undefined");if("function"!=typeof e.transform)throw new Error("Resource does not implement Transformer interface. Resource type: "+typeof e);const r=new ExecuteAsTemplateTransform(this.templateExecutor,t.replace(/\\/g,"/").replace(/^\/+/,""),n);return await e.transform(r)}catch(e){throw e}}},path24=__toESM(require("path"));init_log();var import_stream2=require("stream"),log54=getDomainLogger("resources",{component:"publisher"}),Publisher2=class{pubFs;urlSvc;constructor(e,t){this.pubFs=e,this.urlSvc=t}async openPublishFileForWriting(e){const t=e.replace(/^\/+/,"");try{const e=await this.pubFs.create(t);return new FileWritable(e)}catch(e){if("ENOENT"===e.code||e.message.includes("ENOENT")){const e=path24.dirname(t);await this.pubFs.mkdirAll(e,511);const n=await this.pubFs.create(t),r=n.close.bind(n);return n.close=async()=>{try{await r()}catch(e){throw log54.errorf("❌ [Publisher.File.close] Error closing publish file (retry) %s, $s",t,e),e}},new FileWritable(n)}throw e}}async openFilesForWriting(...e){if(0===e.length)throw new Error("No filenames provided");const t=e[0];return await this.openFileForWriting(t)}async openFileForWriting(e){const t=path24.normalize(e);try{return await this.pubFs.create(t)}catch(e){if(!this.isFileNotFoundError(e))throw e;const n=path24.dirname(t);return await this.pubFs.mkdirAll(n,511),await this.pubFs.create(t)}}isFileNotFoundError(e){return e&&("ENOENT"===e.code||e.message?.includes("no such file or directory")||e.message?.includes("not found"))}},FileWritable=class extends import_stream2.Writable{file;constructor(e){super(),this.file=e}_write(e,t,n){this.file.write(e).then(()=>n()).catch(n)}_final(e){this.file.sync?.().then(()=>this.file.close()).then(()=>e()).catch(e)}};init_log();var http2=__toESM(require("http")),https2=__toESM(require("https")),log55=getDomainLogger("resources",{component:"http-client"}),HttpClient4=class{defaultTimeout=3e4;defaultHeaders={"User-Agent":"MDFriday-Resources/1.0.0"};async fromRemote(e,t){return new Promise(n=>{try{const r=new URL(e),s="https:"===r.protocol,a=s?https2:http2,i={...this.defaultHeaders,...t?.headers},o={hostname:r.hostname,port:r.port||(s?443:80),path:r.pathname+r.search,method:"GET",headers:i,timeout:t?.timeout||this.defaultTimeout},l=a.request(o,r=>{if(r.statusCode&&r.statusCode>=300&&r.statusCode<400&&r.headers.location)return log55.infof("🔄 [HttpClient.fromRemote] Redirecting from %s to %s",e,r.headers.location),void this.fromRemote(r.headers.location,t).then(n);if(!r.statusCode||r.statusCode<200||r.statusCode>=300)return log55.errorf("❌ [HttpClient.fromRemote] HTTP error %d when fetching %s: %s",r.statusCode||0,e,r.statusMessage||"Unknown error"),void n(null);const s=[];r.on("data",e=>{s.push(e)}),r.on("end",()=>{try{const t=Buffer.concat(s).toString("utf8");log55.infof("✅ [HttpClient.fromRemote] Successfully fetched %d bytes from %s",t.length,e),n(t)}catch(t){log55.errorf("❌ [HttpClient.fromRemote] Error converting response to string from %s: %s",e,t),n(null)}}),r.on("error",t=>{log55.errorf("❌ [HttpClient.fromRemote] Response error when fetching %s: %s",e,t.message),n(null)})});l.on("error",t=>{log55.errorf("❌ [HttpClient.fromRemote] Request error when fetching %s: %s",e,t.message),n(null)}),l.on("timeout",()=>{l.destroy(),log55.errorf("❌ [HttpClient.fromRemote] Request timeout when fetching %s",e),n(null)}),l.end()}catch(t){log55.errorf("❌ [HttpClient.fromRemote] Error fetching content from %s: %s",e,t),n(null)}})}},path25=__toESM(require("path")),import_crypto3=require("crypto");init_log();var log56=getDomainLogger("resources",{component:"resources"}),Resources=class{cache=new Map;workspace;fsSvc;urlSvc;templateSvc;publisher;minifierClient;integrityClient;templateClient=null;httpClient;constructor(e){this.workspace=e,this.fsSvc=e,this.urlSvc=e,this.templateSvc=e,this.publisher=new Publisher2(e.publishFs(),e),this.minifierClient=new MinifierClient,this.integrityClient=new IntegrityClient,this.templateClient=new TemplateClient(this.templateSvc),this.httpClient=new HttpClient4}setTemplateSvc(e){this.templateSvc=e,this.templateClient=new TemplateClient(e)}async getResource(e){const t=path25.posix.normalize(e),n=`${t}__get`;if(this.cache.has(n))return this.cache.get(n)||null;try{const e=this.workspace.assetsFs();if(!await e.stat(t))return null;const r=async()=>{const n=await e.open(t);return await this.createReadSeekCloser(n)},s=await this.buildResource(t,r);return s&&this.cache.set(n,s),s}catch(e){return log56.errorf("❌ [Resources.getResource] Error getting resource %s, %s",t,e),null}}async getResourceWithOpener(e,t){const n=path25.posix.normalize(e),r=`${n}__get_with_opener`;if(this.cache.has(r))return this.cache.get(r)||null;try{const e=await this.buildResource(n,t);return e&&this.cache.set(r,e),e}catch(e){return log56.errorf("❌ [Resources.getResourceWithOpener] Error getting resource with opener %s, %s",n,e),null}}async executeAsTemplate(e,t,n){if(!this.templateClient)throw new Error("Template client not available. Please set template client first.");const r=e.key()+"-template-"+t,s=this.cacheKey(r);if(this.cache.has(s))return this.cache.get(s);try{const r=await this.templateClient.executeAsTemplate(e,t,n);return r?this.cache.set(s,r):log56.warnf("⚠️ [Resources.executeAsTemplate] Template execution returned null for resource %s",e.key()),r}catch(t){throw log56.errorf("❌ [Resources.executeAsTemplate] Error executing template %s, %s",e.key(),t),t}}async minify(e){if(!this.minifierClient)throw new Error("Minifier client not available. Please set minifier client first.");const t=e.key()+"-minify",n=this.cacheKey(t);if(this.cache.has(n))return this.cache.get(n);try{const t=await this.minifierClient.minify(e);return t?this.cache.set(n,t):log56.warnf("⚠️ [Resources.minify] Minification returned null for resource %s",e.key()),t}catch(t){throw log56.errorf("❌ [Resources.minify] Error minifying resource %s, %s",e.key(),t),t}}async fingerprint(e){const t=e.key()+"-fingerprint",n=this.cacheKey(t);if(this.cache.has(n))return this.cache.get(n);try{const t=await this.integrityClient.fingerprint(e);return t?this.cache.set(n,t):log56.warnf("⚠️ [Resources.fingerprint] Fingerprint operation returned null for resource %s",e.key()),t}catch(t){throw log56.errorf("❌ [Resources.fingerprint] Error fingerprinting resource %s, %s",e.key(),t),t}}async getRemote(e){const t=`${e}__remote`;if(this.cache.has(t))return this.cache.get(t)||null;try{const n=await this.httpClient.fromRemote(e);if(!n)return null;const r=async()=>this.newReadSeekerNoOpCloserFromString(n),s=await this.buildResource(e,r);return s&&this.cache.set(t,s),s}catch(t){return log56.errorf("❌ [Resources.fromRemote] Error getting remote resource %s, %s",e,t),null}}cacheKey(e){return(0,import_crypto3.createHash)("sha256").update(e).digest("hex").substring(0,16)}getMinifierClient(){return this.minifierClient}getIntegrityClient(){return this.integrityClient}setTemplateClient(e){this.templateClient=e}async buildResource(e,t){try{const n=path25.extname(e),r=this.getMediaTypeFromExtension(n),s=ResourcePaths.newResourcePaths(e,this.workspace);return new ResourceImpl(t,r,s,{},this.publisher)}catch(t){return log56.errorf("❌ [Resources.buildResource] Error building resource for %s, %s",e,t),null}}getMediaTypeFromExtension(e){const t={".js":{type:"text/javascript",mainType:"text",subType:"javascript"},".css":{type:"text/css",mainType:"text",subType:"css"},".html":{type:"text/html",mainType:"text",subType:"html"},".json":{type:"application/json",mainType:"application",subType:"json"},".svg":{type:"image/svg+xml",mainType:"image",subType:"svg+xml"},".xml":{type:"application/xml",mainType:"application",subType:"xml"},".txt":{type:"text/plain",mainType:"text",subType:"plain"}},n=e?t[e]||t[".txt"]:t[".html"],r=e?e.substring(1):"html",s=e||".html";return new MediaType({type:n.type,mainType:n.mainType,subType:n.subType,delimiter:".",firstSuffix:{suffix:r,fullSuffix:s},mimeSuffix:"",suffixesCSV:r})}async createReadSeekCloser(e){try{const t=[];let n=0;try{for(;;){const r=new Uint8Array(8192),s=await e.read(r);if(0===s.bytesRead)break;n+=s.bytesRead,t.push(r.slice(0,s.bytesRead))}}finally{await e.close()}let r="";if(t.length>0){const e=new Uint8Array(n);let s=0;for(const n of t)e.set(n,s),s+=n.length;r=(new TextDecoder).decode(e)}return this.newReadSeekerNoOpCloserFromString(r)}catch(t){try{await e.close()}catch(t){log56.warnf("❌ [Resources.createReadSeekCloser] Error closing file after read error %s, %s",e.path,t)}return this.newReadSeekerNoOpCloserFromString("")}}newReadSeekerNoOpCloserFromString(e){const{Readable:t}=require("stream"),n=new t({read(){}});return n.push(e),n.push(null),Object.assign(n,{seek:async(e,t)=>0,close:async()=>Promise.resolve()})}},path26=__toESM(require("path")),ResourcePaths=class e{dir;baseDirTarget;baseDirLink;targetBasePaths;file;baseUrl="";constructor(e="",t="",n="",r="",s=[],a=""){this.dir=e,this.file=t,this.baseDirTarget=n,this.baseDirLink=r,this.targetBasePaths=s,this.baseUrl=a}static newResourcePaths(t,n){const r=t.replace(/\\/g,"/"),s=path26.posix.parse(r);let a=s.dir;return"/"===a&&(a=""),new e(a,s.base,n.baseUrl(),n.baseUrl(),[],n.baseUrl())}join(...e){let t="";for(let n=0;n<e.length;n++){const r=e[n];if(r)if(""===t)t=r;else{const e=!t.endsWith("/")&&!r.startsWith("/"),n=t.endsWith("/")&&r.startsWith("/");t+=n?r.substring(1):e?"/"+r:r}}return t.startsWith("/")&&(t=t.substring(1)),t.endsWith("/")&&t.length>1&&(t=t.substring(0,t.length-1)),t}targetLink(){let e=this.join(this.baseDirLink,this.dir,this.file);return e.startsWith("http://")||e.startsWith("https://")||e.startsWith("/")||(e="/"+e),e}targetPath(){return this.join(this.dir,this.file)}fromTargetPath(t){const n=t.replace(/\\/g,"/"),r=path26.posix.parse(n);let s=r.dir;return"/"===s&&(s=""),new e(s,r.base,this.baseUrl,this.baseUrl,this.targetBasePaths,this.baseUrl)}pathDir(){return this.dir}pathBaseDirTarget(){return this.baseDirTarget}pathBaseDirLink(){return this.baseDirLink}pathTargetBasePaths(){return this.targetBasePaths}pathFile(){return this.file}},import_crypto4=require("crypto"),ResourceTransformationKey=class e{constructor(e,t=[]){this.name=e,this.elements=t}static newResourceTransformationKey(t,...n){return new e(t,n)}value(){if(0===this.elements.length)return this.name;const e=this.hashElements(...this.elements);return`${this.name}_${e}`}hashElements(...e){const t=e.map(e=>String(e)).join("|");return(0,import_crypto4.createHash)("sha256").update(t).digest("hex").substring(0,16)}},ResourceMetadataImpl=class e{constructor(e,t,n){this.target=e,this.mediaType=t,this.metaData=n}marshal(){return JSON.stringify({Target:this.target,MediaType:this.mediaType,Data:this.metaData})}static unmarshal(t){const n=JSON.parse(t);return new e(n.Target,n.MediaType,n.Data||{})}};init_log(),init_log();var workerpool=__toESM(require("workerpool")),os=__toESM(require("os")),log57=getDomainLogger("application",{component:"pool-manager"}),WorkerPoolManager=class{pool=null;environment;workerCount;constructor(e={}){this.environment=this.detectEnvironment(),this.workerCount=e.workerCount||this.calculateOptimalWorkerCount(),log57.info("Worker pool manager created",{environment:this.environment,workerCount:this.workerCount})}detectEnvironment(){if("undefined"!=typeof process&&"renderer"===process.type){if(log57.info("🌐 Detected Electron Renderer Process (Obsidian plugin environment)"),log57.info("⚠️ worker_threads NOT available in renderer process"),log57.info("💡 Web Workers available but SSG requires Node.js fs access"),log57.info("💡 System will fall back to serial processing"),"undefined"!=typeof Worker)return"browser";throw new Error("No worker support in renderer process")}if("undefined"!=typeof process&&process.versions&&process.versions.node)try{return require.resolve("worker_threads"),log57.debug("Detected Node.js Worker Threads support"),process.versions.electron&&log57.info("✨ Detected Electron Main Process - using Node.js Worker Threads"),"node"}catch{if(log57.debug("Node.js detected but worker_threads unavailable"),"undefined"!=typeof Worker&&void 0!==globalThis.window)return log57.warn("⚠️ Falling back to Web Workers (limited: no Node.js API access)"),"browser";throw new Error("No worker support available (neither Worker Threads nor Web Workers)")}return"undefined"!=typeof Worker&&void 0!==globalThis.window?(log57.debug("Detected Web Worker support (pure browser environment)"),"browser"):(log57.warn("Unable to detect environment reliably, defaulting to browser mode"),"browser")}calculateOptimalWorkerCount(){if("node"===this.environment){const e=os.cpus().length;return Math.max(1,e-1)}{const e="undefined"!=typeof navigator&&navigator.hardwareConcurrency||4;return Math.max(2,Math.min(e-1,4))}}async initialize(){if(this.pool)return void log57.warn("Worker pool already initialized");const e=performance.now();log57.info(`🚀 Initializing ${this.environment} worker pool with ${this.workerCount} workers...`);try{"node"===this.environment?await this.initializeNodePool():await this.initializeBrowserPool();const t=performance.now()-e;log57.info(`✅ Worker pool initialized in ${t.toFixed(2)}ms`)}catch(t){const n=t instanceof Error?t.message:String(t);if("node"===this.environment){log57.warn(`❌ Node worker pool initialization failed: ${n}`),log57.warn("🔄 Attempting fallback to browser workers...");try{this.environment="browser",await this.initializeBrowserPool();const t=performance.now()-e;return void log57.info(`✅ Successfully initialized browser worker pool as fallback in ${t.toFixed(2)}ms`)}catch(e){const t=e instanceof Error?e.message:String(e);throw log57.error(`❌ Fallback to browser workers also failed: ${t}`),new Error(`Worker pool initialization failed. Node: ${n}, Browser: ${t}`)}}throw log57.error(`❌ Failed to initialize worker pool: ${n}`),t}}async initializeNodePool(){const e=require("path").join(__dirname,"worker","worker-node.js");log57.debug(`Initializing Node.js worker pool with path: ${e}`),this.pool=workerpool.pool(e,{minWorkers:this.workerCount,maxWorkers:this.workerCount,workerType:"thread"}),log57.debug(`Node.js worker pool created with ${this.workerCount} workers`,{workerPath:e})}async initializeBrowserPool(){throw log57.error("❌ Browser/Web Workers mode is not supported for SSG parallel processing"),log57.info("💡 Reason: SSG requires Node.js file system access (fs, path, etc.)"),log57.info("💡 Electron/Obsidian: Should use Node.js Worker Threads instead"),log57.info("💡 Pure browser: Parallel processing not available, use serial mode"),new Error("PARALLEL_NOT_SUPPORTED: SSG parallel processing requires Node.js file system access. Web Workers cannot access fs/path modules. System will fall back to serial processing.")}async exec(e){if(!this.pool)throw new Error("Worker pool not initialized. Call initialize() first.");log57.debug(`📤 Executing worker task: ${e.type}`,{environment:this.environment,taskType:e.type,hasProjectDir:!!e.projDir,hasModuleDir:!!e.moduleDir,pageTasksCount:e.pageTasks?.length||0});try{if("node"===this.environment){log57.debug("🔧 Using Node.js worker (processTask function)");const t=await this.pool.exec("processTask",[e]);return log57.debug("📥 Node worker response received",{success:t.success}),t}{log57.debug("🌐 Using browser worker (calling registered processTask)"),log57.debug("Task being sent to worker:",JSON.stringify({type:e.type,projDir:e.projDir,moduleDir:e.moduleDir,pageTasksCount:e.pageTasks?.length}));const t=await this.pool.exec("processTask",[e]);return log57.debug("📥 Browser worker response received",{success:t.success,hasData:!!t.data,error:t.error}),t}}catch(t){const n=t instanceof Error?t.message:String(t),r=t instanceof Error?t.stack:void 0;return log57.error(`❌ Worker task execution failed: ${n}`),log57.debug("Error details:",{message:n,stack:r,environment:this.environment,taskType:e.type}),{success:!1,error:n}}}getStats(){return this.pool?{environment:this.environment,workerCount:this.workerCount,poolStats:this.pool.stats()}:null}async terminate(){this.pool?(log57.info("🧹 Terminating worker pool..."),await this.pool.terminate(),this.pool=null,log57.info("✅ Worker pool terminated")):log57.warn("Worker pool already terminated")}};init_log();var log58=getDomainLogger("application",{component:"batch-task-queue"}),BatchTaskQueue=class{queue=[];currentIndex=0;totalBatches;constructor(e){this.queue=e,this.totalBatches=e.length,log58.info(`Task queue initialized with ${this.totalBatches} batches`)}nextBatch(){if(this.currentIndex>=this.queue.length)return null;const e=this.queue[this.currentIndex];return this.currentIndex++,e}getProgress(){const e=this.currentIndex,t=this.totalBatches;return{completed:e,total:t,percentage:0===t?100:Math.round(e/t*100)}}hasMore(){return this.currentIndex<this.queue.length}getRemainingCount(){return Math.max(0,this.queue.length-this.currentIndex)}},os2=__toESM(require("os")),log59=getDomainLogger("ssg",{component:"parallel"});async function runWorkerLoop(e,t,n,r,s,a){const i=[];for(log59.debug(`🚀 Worker ${n} loop started`);;){const o=t.nextBatch();if(!o){log59.debug(`Worker ${n} finished - no more tasks`);break}const l=t.getProgress();log59.info(`🔄 Worker ${n} processing batch ${l.completed}/${l.total} (${o.length} tasks)`);const c={type:"process-batch",pageTasks:o};log59.debug(`Worker ${n} sending task to pool manager`,{taskType:c.type,batchSize:o.length});const u=await e.exec(c);if(log59.debug(`Worker ${n} received response`,{success:u.success,hasData:!!u.data,error:u.error}),u.success&&u.data){const e=u.data;i.push(e),s.count+=e.processedCount;const t=70+Math.floor(s.count/r*29);a?.({stage:"build",message:`Rendering pages (${s.count}/${r})...`,percentage:t,pageRender:{currentPage:s.count,totalPages:r}}),log59.info(`✅ Worker ${n} completed batch: ${e.processedCount} tasks in ${e.duration.toFixed(2)}ms`)}else log59.error(`❌ Worker ${n} failed: ${u.error}`),log59.debug(`Worker ${n} error details:`,{batchSize:o.length,error:u.error}),i.push({success:!1,processedCount:0,totalCount:o.length,duration:0,errors:[u.error||"Unknown error"]})}return log59.debug(`Worker ${n} loop completed, processed ${i.length} batches`),i}async function processSSGParallel(e,t,n,r,s){const a=performance.now(),i=process.cwd();process.chdir(e);try{r?.({stage:"config",message:"Initializing parallel SSG...",percentage:5}),r?.({stage:"pages",message:"Collecting all page tasks...",percentage:10});const n=await collectAllPageTasks(e,t);if(0===n.length)return log59.warn("⚠️ No page tasks found to process"),r?.({stage:"completion",message:"No pages to process",percentage:100}),{totalPages:0,totalBatches:0,workerCount:0,batchSize:0,totalDuration:0,parallelSpeedup:0,pagesPerSecond:0};r?.({stage:"config",message:`Found ${n.length} pages, calculating optimal worker configuration...`,percentage:20});const s=os2.cpus().length,i=Math.max(2,Math.floor(.6*s)),o=function(e,t){const n=4*t,r=Math.ceil(e/n);return Math.max(5,Math.min(50,r))}(n.length,i);log59.info(`⚙️ Using ${i} workers with batch size ${o}`),r?.({stage:"config",message:`Creating worker pool with ${i} workers...`,percentage:30});const l=new WorkerPoolManager({workerCount:i});await l.initialize(),r?.({stage:"config",message:"Initializing workers...",percentage:50}),log59.info("🔧 Initializing workers...");const c=performance.now(),u=[];for(let n=0;n<i;n++){log59.debug(`Creating init task for worker ${n}`);const r={type:"init",projDir:e,moduleDir:t},s=l.exec(r);s.then(e=>log59.debug(`Worker ${n} init result:`,{success:e.success,error:e.error}),e=>log59.error(`Worker ${n} init failed:`,e)),u.push(s)}log59.info(`Waiting for ${i} workers to initialize...`);const h=await Promise.all(u),d=performance.now()-c,p=h.filter(e=>!e.success);if(p.length>0)throw log59.error(`❌ ${p.length} workers failed to initialize:`,p),new Error(`Failed to initialize ${p.length} workers: ${p.map(e=>e.error).join(", ")}`);log59.info(`✅ All workers initialized in ${d.toFixed(2)}ms`),r?.({stage:"build",message:`Creating ${Math.ceil(n.length/o)} task batches...`,percentage:65});const g=function(e,t){const n=[];for(let r=0;r<e.length;r+=t)n.push(e.slice(r,r+t));return log59.info(`📦 Created ${n.length} batches (${t} tasks per batch)`),n}(n,o),m=new BatchTaskQueue(g);r?.({stage:"build",message:"Starting parallel page rendering...",percentage:70}),log59.info("🏃 Starting worker loops...");const f=performance.now(),T={count:0},E=[];for(let e=0;e<i;e++)E.push(runWorkerLoop(l,m,e,n.length,T,r));const S=await Promise.all(E),_=performance.now()-f,A=S.flat(),I=A.filter(e=>e.success).length,y=A.reduce((e,t)=>e+t.processedCount,0),D=A.reduce((e,t)=>e+t.errors.length,0);await l.terminate();const w=performance.now()-a,b=y/w*1e3,C=_/y*y/_;return r?.({stage:"completion",message:`Parallel SSG completed! Processed ${y} pages with ${i} workers`,percentage:100}),log59.info("✨ Parallel SSG completed!"),log59.info("📊 Statistics:",{totalTasks:n.length,processedTasks:y,successfulBatches:I,failedBatches:A.length-I,totalErrors:D,totalDuration:`${w.toFixed(2)}ms`,processingDuration:`${_.toFixed(2)}ms`,pagesPerSecond:b.toFixed(2),parallelSpeedup:`${C.toFixed(2)}x`}),{totalPages:n.length,totalBatches:g.length,workerCount:i,batchSize:o,totalDuration:w,parallelSpeedup:C,pagesPerSecond:b}}catch(e){const t=e instanceof Error?e.message:String(e);throw log59.error(`❌ Parallel SSG failed: ${t}`),e}finally{process.chdir(i)}}var configCache,modulesCache,fsCache,contentCache,resourcesCache,siteCache,log60=getDomainLogger("ssg",{component:"application"}),createDomainInstances=(e,t,n,r,s,a)=>({site:e,content:t,fs:n,config:r,modules:s,resources:a});function setDomainInstances(e,t,n,r,s,a,i){siteCache=e,contentCache=t,fsCache=n,configCache=r,modulesCache=s,resourcesCache=a}function getDomainInstances(){return createDomainInstances(siteCache,contentCache,fsCache,configCache,modulesCache,resourcesCache)}async function loadConfiguration(e,t){const n=new OsFs,r=import_path16.default.join(e,"config.json");return await loadConfigWithParams(n,r,e,t)}async function createFileSystem(e,t){const n={path:e.getDir().getWorkingDir(),publish:e.getDir().getPublishDir(),osFs:e.fs()};return await createFs(n,t)}async function createContentEngine(e,t,n,r){const s={baseUrl:()=>t.getRoot().baseUrl(),markdown:()=>r,useInternalRenderer:()=>t.getMarkdown().useInternalRenderer(),isWikilinkEnabled:()=>t.getMarkdown().isWikilinkEnabled(),isTagEnabled:()=>t.getMarkdown().isTagEnabled(),isCalloutEnabled:()=>t.getMarkdown().isCalloutEnabled(),isLatexEnabled:()=>t.getMarkdown().isLatexEnabled(),isMermaidEnabled:()=>t.getMarkdown().isMermaidEnabled(),newFileMetaInfo:t=>e.newFileMetaInfo(t),newFileMetaInfoWithContent:t=>e.newFileMetaInfoWithContent(t),contentFs:()=>e.contentFs(),walkContent:(t,n,r,s)=>e.walkContent(t,n,r,s),walkI18n:(t,n,r)=>e.walkI18n(t,n,r),isLanguageValid:e=>t.getLanguage().isLanguageValid(e),getSourceLang:e=>n.getSourceLang(e),getLanguageIndex:e=>t.getLanguage().getLanguageIndex(e),getLanguageByIndex:e=>t.getLanguage().getLanguageByIndex(e),defaultLanguage:()=>t.getLanguage().defaultLanguage(),languageIndexes:()=>t.getLanguage().languageIndexes(),views:()=>t.getTaxonomy().getViews().map(e=>{const t=e.singular,n=e.plural;return{singular:()=>t||"",plural:()=>n||""}})};return await createContent(s)}function createResourcesEngine(e,t){return new Resources({assetsFs:()=>t.assetsFs(),publishFs:()=>t.publishFs(),baseUrl:()=>e.getProvider().getString("baseURL")||"http://localhost",executeTemplate:async(e,t,n)=>{throw new Error("Template execution not initialized. Please call resources.setTemplateSvc() first.")}})}async function createTemplateEngineFromFs(e,t,n,r){const s=function(e,t,n){const r=e.getProvider().getString("baseURL")||"http://localhost";return{relURL:e=>t.getURL().relURL(e),absURL:e=>t.getURL().absURL(e,t.isMultipleLanguage(),t.languagePrefix()),urlize:e=>t.getURL().urlize(e),translate:e=>t.translate(e),relRefFrom:async(e,t)=>[e.path||"",null],title:()=>e.getProvider().getString("title")||"My Site",baseURL:()=>r,params:()=>e.getProvider().getParams("params"),menus:()=>({}),isMultiLanguage:()=>e.getLanguage().languageKeys().length>1,version:()=>"0.1.0",environment:()=>"development",generator:()=>"AuPro Static Site Generator",defaultLanguage:()=>e.getLanguage().defaultLanguage(),languageKeys:()=>e.getLanguage().languageKeys(),Get:async function(e){try{return await n.getResource(e)}catch(t){return log60.warn(`Resource not found: ${e}`,t),Promise.resolve(null)}},GetRemote:async function(e){return await n.getRemote(e)},Minify:async function(e){return await n.minify(e)},Fingerprint:async function(e){return await n.fingerprint(e)},ExecuteAsTemplate:async function(e,t,r){return await n.executeAsTemplate(r,e,t)}}}(t,n,r),a={walk:e.walkLayouts.bind(e)};return await async function(e,t){return(new Factory2).createWithServices(e,t)}(a,s)}async function createTemplateAdapter(e,t){return{async lookupLayout(t){const[n,r,s,a]=await e.findFirst(t);return a?{preparer:null,found:!1}:s&&n&&r?{preparer:{name:()=>r,execute:async e=>{const[t,r]=await n.Execute(e);if(r)throw log60.errorf("template exec error: %s",r),r;return t}},found:!0}:{preparer:null,found:!1}},async executeWithContext(e,t){if(!e)return"<html><body>Default template - no preparer</body></html>";try{return await e.execute(t)}catch(e){return log60.error(`❌ Template execution error: ${e}`),`<html><body>Template execution error: ${e}</body></html>`}}}}function createSiteForSSG(e,t,n){return function(e){const t=new Publisher(e.publishFs()),n=new URL2(e.baseUrl(),!0),r=new Language2(e),s=new Author2("MDFriday","support@mdfriday.com"),a=new Organization2,i=new Compiler("0.1.0"),o=new Site(e,e,e,e,e,e,t,s,a,i,n,null,r,null,e.siteTitle()),l=function(e,t,n){return new NavigationFactory(e,t,n)}(e,e,o);return o.navigation=l.createNavigation(),o.ref=new Ref({home:{page:null},sitePage:async e=>{const t=await o.sitePage(e);return{relPermalink:()=>t.path?t.path():"",permalink:()=>t.path?t.path():""}}},e,"/404.html"),o}({configParams:()=>e.getProvider().getParams("params"),siteTitle:()=>e.getProvider().getString("title")||"My Site",menus:()=>({}),isGoogleAnalyticsEnabled:()=>e.getService().isGoogleAnalyticsEnabled(),googleAnalyticsID:()=>e.getService().googleAnalyticsID(),isGoogleAnalyticsRespectDoNotTrack:()=>e.getService().isGoogleAnalyticsRespectDoNotTrack(),isDisqusEnabled:()=>e.getService().isDisqusEnabled(),disqusShortname:()=>e.getService().disqusShortname(),isXRespectDoNotTrack:()=>e.getService().isXRespectDoNotTrack(),isXDisableInlineCSS:()=>e.getService().isXDisableInlineCSS(),getConfiguredSocialPlatforms:()=>e.getSocial().getConfiguredPlatforms(),getSocialLink:t=>{const n=e.getSocial().getSocialLink(t);return n?n.url:""},getSocialTitle:t=>{const n=e.getSocial().getSocialLink(t);return n?n.title:""},globalPages:async e=>await n.globalPages(e),globalRegularPages:async()=>await n.globalRegularPages(),walkPages:async(e,t)=>{await n.walkPages(e,t)},getPageSources:async e=>n.getPageSources(e),walkTaxonomies:async(e,t)=>{await n.walkTaxonomies(e,t)},searchPage:async(e,t)=>[],getPageFromPath:async(e,t)=>{try{const r=n.getPageFromPath(e,t);return r||log60.error(`⚠️ Application.getPageFromPath: content domain returned null for path: "${t}"`),r}catch(e){return log60.error("❌ Application.getPageFromPath error delegating to content domain:",e),null}},getPageFromPathSync:(e,t)=>{try{const r=n.getPageFromPath(e,t);return r||log60.warn(`⚠️ Application.getPageFromPathSync: content domain returned null for path: ${t}`),r}catch(e){return log60.error("❌ Application.getPageFromPathSync error delegating to content domain:",e),null}},getPageRef:async(e,t,n)=>null,translate:(e,t)=>n.translate(e,t),defaultLanguage:()=>e.getLanguage().defaultLanguage(),languageKeys:()=>e.getLanguage().languageKeys(),getLanguageIndex:t=>e.getLanguage().getLanguageIndex(t),getLanguageName:t=>e.getLanguage().getLanguageName(t),changeFreq:()=>"weekly",priority:()=>.5,generateSitemap:async()=>({urls:[]}),publishFs:()=>t.publishFs(),staticFs:()=>t.staticFs(),copyStaticFiles:(e,n)=>t.copyStatic([e],n),workingDir:()=>e.getProvider().getString("workingDir")||process.cwd(),getResource:async e=>null,getResourceWithOpener:async(e,t)=>({name:()=>e,readSeekCloser:t,targetPath:()=>e}),baseUrl:()=>e.getProvider().getString("baseURL")||"http://localhost"})}async function generateStaticSite(e,t,n){try{let r=performance.now();const s=await loadConfiguration(e,t);let a=performance.now();log60.info(`✅ Configuration loaded in ${(a-r).toFixed(2)} ms`);const i=n;r=performance.now();const o=await async function(e){const t={osFs:()=>e.fs(),projDir:()=>e.getDir().getWorkingDir(),moduleDir:()=>e.getDir().getThemesDir(),moduleCacheDir:()=>e.getDir().getThemesCacheDir(),importPaths:()=>e.getModule().importPaths(),defaultLanguageKey:()=>e.getLanguage().defaultLanguage(),otherLanguageKeys:()=>e.getLanguage().otherLanguageKeys(),getRelDir:(t,n)=>e.getLanguage().getRelDir(t,n)};return await async function(e){try{const t=e.httpClient?.(),n=newHttpClient(e.osFs(),void 0,void 0,t),r=newZipExtractor(e.osFs()),s=newModuleCache(e.osFs(),e.moduleCacheDir()),a=newModules(e,n,r,s);return await a.load(),a}catch(e){const t=e instanceof Error?e.message:String(e);throw log5.error(`Failed to create modules: ${t}`),new ModuleError(`Failed to create modules: ${t}`,"FACTORY_FAILED")}}(t)}(s);a=performance.now(),log60.info(`✅ Modules created in ${(a-r).toFixed(2)} ms`),r=performance.now();const l=await createFileSystem(s,o);a=performance.now(),log60.info(`✅ Filesystem created in ${(a-r).toFixed(2)} ms`);const c=await createContentEngine(l,s,o,i),u=createSiteForSSG(s,l,c),h=createResourcesEngine(s,l),d=await createTemplateEngineFromFs(l,s,u,h);h.setTemplateSvc({executeTemplate:async(e,t,n)=>await d.executeRaw(e,t,n)}),c.setTemplateSvc({execute:async(e,t)=>await d.executeShortcode(e,t)}),r=performance.now(),await c.collectPages(),a=performance.now(),log60.info(`✅ Pages collected in ${(a-r).toFixed(2)} ms`);const p=await createTemplateAdapter(d);r=performance.now(),await u.build(p),a=performance.now(),setDomainInstances(u,c,l,s,o,h),log60.info(`✅ Site built in ${(a-r).toFixed(2)} ms`)}catch(e){const t=e instanceof Error?e.message:String(e);throw log60.error(`❌ Static site generation failed: ${t}`),new Error(`Failed to generate static site: ${t}`)}}async function processSSG(e,t,n){try{const r=process.cwd();process.chdir(e);try{await generateStaticSite(e,t,n)}finally{process.chdir(r)}}catch(e){const t=e instanceof Error?e.message:String(e);throw log60.error(`❌ SSG processing failed: ${t}`),new Error(`Failed to process SSG: ${t}`)}}async function generateStaticSiteWithProgress(e,t,n,r,s){try{r?.({stage:"config",message:"Loading configuration...",percentage:5});const a=await loadConfiguration(e,t),i=n;r?.({stage:"modules",message:"Creating and downloading modules...",percentage:10});const o=await createModuleWithProgress(a,r,s);r?.({stage:"filesystem",message:"Creating filesystem...",percentage:30});const l=await createFileSystem(a,o);r?.({stage:"content",message:"Creating content engine...",percentage:40});const c=await createContentEngine(l,a,o,i);r?.({stage:"site",message:"Creating site...",percentage:50});const u=createSiteForSSG(a,l,c),h=createResourcesEngine(a,l);r?.({stage:"template",message:"Creating template engine...",percentage:60});const d=await createTemplateEngineFromFs(l,a,u,h);h.setTemplateSvc({executeTemplate:async(e,t,n)=>await d.executeRaw(e,t,n)}),c.setTemplateSvc({execute:async(e,t)=>await d.executeShortcode(e,t)}),r?.({stage:"pages",message:"Collecting pages...",percentage:65}),await c.collectPages(),r?.({stage:"build",message:"Building site...",percentage:70});const p=await createTemplateAdapter(d);return await async function(e,t,n){const r=n?e=>{const t=70+Math.floor(e.currentPage/e.totalPages*29);n({stage:"build",message:`Rendering pages (${e.currentPage}/${e.totalPages})...`,percentage:t,pageRender:e})}:void 0;await e.buildWithProgress(t,r)}(u,p,r),r?.({stage:"completion",message:"SSG generation completed",percentage:100}),setDomainInstances(u,c,l,a,o,h),getDomainInstances()}catch(e){const t=e instanceof Error?e.message:String(e);throw log60.error(`❌ Static site generation failed: ${t}`),new Error(`Failed to generate static site: ${t}`)}}async function createModuleWithProgress(e,t,n){const r={osFs:()=>e.fs(),projDir:()=>e.getDir().getWorkingDir(),moduleDir:()=>e.getDir().getThemesDir(),moduleCacheDir:()=>e.getDir().getThemesCacheDir(),importPaths:()=>e.getModule().importPaths(),defaultLanguageKey:()=>e.getLanguage().defaultLanguage(),otherLanguageKeys:()=>e.getLanguage().otherLanguageKeys(),getRelDir:(t,n)=>e.getLanguage().getRelDir(t,n),httpClient:n?()=>n:void 0};return await async function(e,t){const n=t?e=>{t({stage:"modules",message:`Downloading module: ${e.modulePath}`,percentage:10+Math.floor(.2*e.downloadPercentage),moduleDownload:{modulePath:e.modulePath,downloadPercentage:e.downloadPercentage}})}:void 0;return await async function(e,t){try{const n=e.httpClient?.(),r=newHttpClient(e.osFs(),void 0,void 0,n),s=newZipExtractor(e.osFs()),a=newModuleCache(e.osFs(),e.moduleCacheDir()),i=newModules(e,r,s,a);return await i.load(t),i}catch(e){const t=e instanceof Error?e.message:String(e);throw log5.error(`Failed to create modules: ${t}`),new ModuleError(`Failed to create modules: ${t}`,"FACTORY_FAILED")}}(e,n)}(r,t)}async function processSSGWithProgress(e,t,n,r,s){try{const a=process.cwd();process.chdir(e);try{await generateStaticSiteWithProgress(e,t,n,r,s)}finally{process.chdir(a)}}catch(e){const t=e instanceof Error?e.message:String(e);throw log60.error(`❌ SSG processing failed: ${t}`),new Error(`Failed to process SSG: ${t}`)}}var tasks=[];async function collectAllPageTasks(e,t,n,r,s){if(tasks.length>0)return log60.info("Page tasks already collected, returning cached tasks"),tasks;try{let a=performance.now();const i=await loadConfiguration(e,t);let o=performance.now();log60.info(`✅ Configuration loaded in ${(o-a).toFixed(2)} ms`);const l=n;a=performance.now();const c=await createModuleWithProgress(i,r,s);o=performance.now(),log60.info(`✅ Modules created in ${(o-a).toFixed(2)} ms`),a=performance.now();const u=await createFileSystem(i,c);o=performance.now(),log60.info(`✅ Filesystem created in ${(o-a).toFixed(2)} ms`);const h=await createContentEngine(u,i,c,l),d=createSiteForSSG(i,u,h),p=createResourcesEngine(i,u),g=await createTemplateEngineFromFs(u,i,d,p);p.setTemplateSvc({executeTemplate:async(e,t,n)=>await g.executeRaw(e,t,n)}),h.setTemplateSvc({execute:async(e,t)=>await g.executeShortcode(e,t)}),a=performance.now(),await h.collectPages(),o=performance.now(),log60.info(`✅ Pages collected in ${(o-a).toFixed(2)} ms`),a=performance.now();const m=i.getLanguage().languageKeys();for(const e of m){const t=i.getLanguage().getLanguageIndex(e);await h.walkPages(t,async t=>{const n=t.file().paths().base();tasks.push({language:e,pagePath:n}),t&&t.pageIdentity&&t.pageIdentity().clearStale()}),log60.debug(`Collected pages for language: ${e}`)}o=performance.now(),log60.info(`✅ Page tasks collected in ${(o-a).toFixed(2)} ms`);const f=await createTemplateAdapter(g);return a=performance.now(),await d.build(f),o=performance.now(),log60.info(`✅ Site built in ${(o-a).toFixed(2)} ms`),setDomainInstances(d,h,u,i,c,p),tasks}catch(e){const t=e instanceof Error?e.message:String(e);throw log60.error(`❌ Static site generation failed: ${t}`),new Error(`Failed to generate static site: ${t}`)}}init_log();var chokidar=__toESM(require("chokidar")),path28=__toESM(require("path"));init_log();var log61=getDomainLogger("web",{component:"content-file-watcher"}),ContentFileWatcher=class{constructor(e){this.config=e,this.batchDelay=e.batchDelay||500}watcher=null;eventQueue=[];batchTimer=null;batchDelay;callbacks=[];async startWatching(){this.watcher&&await this.stopWatching(),this.watcher=chokidar.watch(this.config.contentDirs,{ignored:[/(^|[\/\\])\../,/\.tmp$/,/\.swp$/,/~$/,/\.DS_Store$/,...this.config.ignorePatterns||[]],persistent:!0,ignoreInitial:!0,followSymlinks:!0,awaitWriteFinish:{stabilityThreshold:100,pollInterval:50}}),this.watcher.on("add",e=>this.queueEvent(e,"created")).on("change",e=>this.queueEvent(e,"modified")).on("unlink",e=>this.queueEvent(e,"deleted")).on("error",e=>{log61.error("File watcher error:",e)})}onFileChange(e){this.callbacks.push(e)}queueEvent(e,t){let n=e;const{projContentDirs:r,contentDirs:s}=this.config;for(let e=0;e<r.length;e++){const t=r[e];for(let e=0;e<s.length;e++){const r=s[e];if(t!==r&&n.startsWith(r)){n=t+n.slice(r.length);break}}}const a=path28.normalize(n);if(!this.isRelevantFile(a))return;const i={filePath:a,eventType:t,timestamp:Date.now(),isMarkdown:this.isMarkdownFile(a),isImage:this.isImageFile(a)};this.eventQueue.push(i),this.scheduleBatch()}isRelevantFile(e){return this.isMarkdownFile(e)||this.isImageFile(e)}isMarkdownFile(e){const t=path28.extname(e).toLowerCase();return".md"===t||".markdown"===t}isImageFile(e){const t=path28.extname(e).toLowerCase();return[".jpg",".jpeg",".png",".gif",".svg",".webp",".bmp"].includes(t)}scheduleBatch(){this.batchTimer&&clearTimeout(this.batchTimer),this.batchTimer=setTimeout(async()=>{if(this.eventQueue.length>0){const e=this.deduplicateEvents(this.eventQueue);this.eventQueue=[];for(const t of this.callbacks)try{await t(e)}catch(e){log61.error("Error processing file change events:",e)}}},this.batchDelay)}deduplicateEvents(e){const t=new Map;for(const n of e){const e=t.get(n.filePath);(!e||n.timestamp>e.timestamp)&&t.set(n.filePath,n)}return Array.from(t.values())}async stopWatching(){this.batchTimer&&(clearTimeout(this.batchTimer),this.batchTimer=null),this.watcher&&(await this.watcher.close(),this.watcher=null),this.eventQueue=[],this.callbacks=[]}},http3=__toESM(require("http")),path29=__toESM(require("path")),fs2=__toESM(require("fs/promises")),import_ws=require("ws");init_log();var log62=getDomainLogger("web",{component:"livereload-server"}),FoundryLiveReloadServer=class{httpServer=null;wsServer=null;clients=new Set;running=!1;config;constructor(e){this.config={port:e.port||8091,host:e.host||"localhost",livereloadPort:e.livereloadPort||35729,enableLiveReload:!1!==e.enableLiveReload,publicDir:e.publicDir}}async start(){if(this.running)log62.warn("LiveReloadServer already running");else try{await this.startHttpServer(),this.config.enableLiveReload&&await this.startLiveReloadServer(),this.running=!0}catch(e){throw log62.error("Failed to start LiveReloadServer:",e),e}}async stop(){if(this.running)try{for(const e of this.clients)e.close();this.clients.clear(),this.wsServer&&(this.wsServer.close(),this.wsServer=null),this.httpServer&&(await new Promise(e=>{this.httpServer.close(()=>e())}),this.httpServer=null),this.running=!1}catch(e){log62.error("Error stopping LiveReloadServer:",e)}}notifyReload(e){if(!this.config.enableLiveReload||0===this.clients.size)return;const t={command:"reload",liveCSS:this.shouldLiveReloadCSS(e),liveImg:this.shouldLiveReloadImages(e)};if(e&&1===e.length){const n=e[0],r=path29.extname(n).toLowerCase();".css"===r?(t.path=n,t.liveCSS=!0):[".jpg",".jpeg",".png",".gif",".svg",".webp"].includes(r)&&(t.path=n,t.liveImg=!0)}const n=JSON.stringify(t);for(const e of this.clients)e.readyState===import_ws.WebSocket.OPEN&&e.send(n)}getUrl(){return`http://${this.config.host}:${this.config.port}`}isServerRunning(){return this.running}async startHttpServer(){this.httpServer=http3.createServer(async(e,t)=>{try{await this.handleHttpRequest(e,t)}catch(e){log62.error("HTTP request error:",e),t.statusCode=500,t.end("Internal Server Error")}}),await new Promise((e,t)=>{this.httpServer.listen(this.config.port,this.config.host,()=>{e()}),this.httpServer.on("error",e=>{"EADDRINUSE"===e.code?(this.config.port++,this.config.port<8099?this.httpServer.listen(this.config.port,this.config.host):t(new Error("No available ports"))):t(e)})})}async startLiveReloadServer(){this.wsServer=new import_ws.WebSocketServer({port:this.config.livereloadPort,host:this.config.host}),this.wsServer.on("connection",e=>{this.clients.add(e),e.send(JSON.stringify({command:"hello",protocols:["http://livereload.com/protocols/official-7"],serverName:"foundry-livereload"})),e.on("close",()=>{this.clients.delete(e)}),e.on("message",e=>{try{JSON.parse(e.toString())}catch(t){log62.error("Invalid LiveReload message:",e.toString())}})}),this.wsServer.on("error",e=>{log62.error("LiveReload WebSocket server error:",e)})}async handleHttpRequest(e,t){const n=e.url||"/";let r=this.resolveFilePath(n);try{if((await fs2.stat(r)).isDirectory()){const e=path29.join(r,"index.html");try{await fs2.stat(e),r=e}catch{return t.statusCode=404,void t.end("Not Found")}}let e=await fs2.readFile(r);const n=this.getContentType(r);if(t.setHeader("Content-Type",n),n.includes("text/html")&&this.config.enableLiveReload){const t=e.toString(),n=this.getLiveReloadScript(),r=t.replace(/<\/body>/i,`${n}\n</body>`);e=Buffer.from(r,"utf8")}t.setHeader("Cache-Control","no-cache, no-store, must-revalidate"),t.setHeader("Pragma","no-cache"),t.setHeader("Expires","0"),t.statusCode=200,t.end(e)}catch(e){if("ENOENT"!==e.code)throw e;t.statusCode=404,t.end("Not Found")}}resolveFilePath(e){const t=e.split("?")[0].split("#")[0];let n;try{n=decodeURIComponent(t)}catch(e){log62.warn("Failed to decode URL:",t,e),n=t}const r=path29.normalize(n).replace(/^(\.\.[\/\\])+/,""),s=r.startsWith("/")?r.slice(1):r,a=path29.join(this.config.publicDir,s);return"win32"===process.platform&&a.length>260&&log62.warn("Path too long for Windows filesystem:",a),"win32"===process.platform&&/[<>:"|?*\x00-\x1f]/.test(s)&&log62.warn("Path contains invalid characters for Windows:",s),a}getContentType(e){return{".html":"text/html; charset=utf-8",".css":"text/css; charset=utf-8",".js":"application/javascript; charset=utf-8",".json":"application/json; charset=utf-8",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".svg":"image/svg+xml",".webp":"image/webp",".ico":"image/x-icon",".woff":"font/woff",".woff2":"font/woff2",".ttf":"font/ttf",".eot":"application/vnd.ms-fontobject",".xml":"application/xml; charset=utf-8",".txt":"text/plain; charset=utf-8"}[path29.extname(e).toLowerCase()]||"application/octet-stream"}getLiveReloadScript(){return`\n<script>\n(function() {\n 'use strict';\n \n var protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:';\n var address = protocol + '//${this.config.host}:${this.config.livereloadPort}/livereload';\n var socket = new WebSocket(address);\n \n socket.onmessage = function(event) {\n var data = JSON.parse(event.data);\n \n if (data.command === 'reload') {\n if (data.liveCSS) {\n // 热更新 CSS\n reloadCSS();\n } else if (data.liveImg) {\n // 热更新图片\n reloadImages();\n } else {\n // 完整页面刷新\n window.location.reload();\n }\n }\n };\n \n socket.onopen = function() {\n console.log('LiveReload connected');\n };\n \n socket.onclose = function() {\n console.log('LiveReload disconnected');\n // 尝试重连\n setTimeout(function() {\n window.location.reload();\n }, 1000);\n };\n \n function reloadCSS() {\n var links = document.querySelectorAll('link[rel="stylesheet"]');\n for (var i = 0; i < links.length; i++) {\n var link = links[i];\n var href = link.href;\n if (href) {\n var url = new URL(href);\n url.searchParams.set('_t', Date.now().toString());\n link.href = url.toString();\n }\n }\n console.log('CSS reloaded');\n }\n \n function reloadImages() {\n var images = document.querySelectorAll('img');\n for (var i = 0; i < images.length; i++) {\n var img = images[i];\n var src = img.src;\n if (src) {\n var url = new URL(src);\n url.searchParams.set('_t', Date.now().toString());\n img.src = url.toString();\n }\n }\n console.log('Images reloaded');\n }\n})();\n<\/script>`}shouldLiveReloadCSS(e){return!!e&&e.some(e=>".css"===path29.extname(e).toLowerCase())}shouldLiveReloadImages(e){if(!e)return!1;const t=[".jpg",".jpeg",".png",".gif",".svg",".webp"];return e.some(e=>t.includes(path29.extname(e).toLowerCase()))}},http4=__toESM(require("http")),path30=__toESM(require("path")),fs3=__toESM(require("fs/promises"));init_log();var log63=getDomainLogger("web",{component:"electron-livereload-server"}),ElectronLiveReloadServer=class{httpServer=null;running=!1;config;stateFilePath;constructor(e){this.config={port:e.port||8091,host:e.host||"localhost",livereloadPort:e.livereloadPort||35729,enableLiveReload:!1!==e.enableLiveReload,publicDir:e.publicDir},this.stateFilePath=path30.join(this.config.publicDir,".foundry-livereload-state.json")}async start(){if(this.running)log63.warn("ElectronLiveReloadServer already running");else try{await this.startHttpServer(),this.config.enableLiveReload&&await this.initStateFile(),this.running=!0,log63.info(`ElectronLiveReloadServer started at ${this.getUrl()}`)}catch(e){throw log63.error("Failed to start ElectronLiveReloadServer:",e),e}}async stop(){if(this.running)try{this.httpServer&&(await new Promise(e=>{this.httpServer.close(()=>e())}),this.httpServer=null);try{await fs3.unlink(this.stateFilePath)}catch(e){}this.running=!1,log63.info("ElectronLiveReloadServer stopped")}catch(e){log63.error("Error stopping ElectronLiveReloadServer:",e)}}notifyReload(e){if(!this.config.enableLiveReload)return;const t={timestamp:Date.now(),command:"reload",liveCSS:this.shouldLiveReloadCSS(e),liveImg:this.shouldLiveReloadImages(e),...e&&{changedFiles:e}};if(e&&1===e.length){const n=e[0],r=path30.extname(n).toLowerCase();(".css"===r||[".jpg",".jpeg",".png",".gif",".svg",".webp"].includes(r))&&(t.path=n)}this.writeStateFile(t).catch(e=>{log63.error("Failed to write state file:",e)})}getUrl(){return`http://${this.config.host}:${this.config.port}`}isServerRunning(){return this.running}async initStateFile(){const e={timestamp:Date.now(),command:"hello"};await this.writeStateFile(e)}async writeStateFile(e){try{await fs3.writeFile(this.stateFilePath,JSON.stringify(e),"utf8")}catch(e){log63.error("Failed to write LiveReload state file:",e)}}async startHttpServer(){this.httpServer=http4.createServer(async(e,t)=>{try{await this.handleHttpRequest(e,t)}catch(e){log63.error("HTTP request error:",e),t.statusCode=500,t.end("Internal Server Error")}}),await new Promise((e,t)=>{this.httpServer.listen(this.config.port,this.config.host,()=>{e()}),this.httpServer.on("error",e=>{"EADDRINUSE"===e.code?(this.config.port++,this.config.port<8099?this.httpServer.listen(this.config.port,this.config.host):t(new Error("No available ports"))):t(e)})})}async handleHttpRequest(e,t){const n=e.url||"/";if(n.startsWith("/.foundry-livereload-state.json"))try{const e=await fs3.readFile(this.stateFilePath,"utf8");return t.setHeader("Content-Type","application/json; charset=utf-8"),t.setHeader("Cache-Control","no-cache, no-store, must-revalidate"),t.setHeader("Pragma","no-cache"),t.setHeader("Expires","0"),t.statusCode=200,void t.end(e)}catch(e){return void("ENOENT"===e.code?(t.statusCode=404,t.end("State file not found")):(t.statusCode=500,t.end("Internal Server Error")))}let r=this.resolveFilePath(n);try{if((await fs3.stat(r)).isDirectory()){const e=path30.join(r,"index.html");try{await fs3.stat(e),r=e}catch{return t.statusCode=404,void t.end("Not Found")}}let e=await fs3.readFile(r);const n=this.getContentType(r);if(t.setHeader("Content-Type",n),n.includes("text/html")&&this.config.enableLiveReload){const t=e.toString(),n=this.getLiveReloadScript(),r=t.replace(/<\/body>/i,`${n}\n</body>`);e=Buffer.from(r,"utf8")}t.setHeader("Cache-Control","no-cache, no-store, must-revalidate"),t.setHeader("Pragma","no-cache"),t.setHeader("Expires","0"),t.statusCode=200,t.end(e)}catch(e){if("ENOENT"!==e.code)throw e;t.statusCode=404,t.end("Not Found")}}resolveFilePath(e){const t=e.split("?")[0].split("#")[0];let n;try{n=decodeURIComponent(t)}catch(e){log63.warn("Failed to decode URL:",t,e),n=t}const r=path30.normalize(n).replace(/^(\.\.[\/\\])+/,""),s=r.startsWith("/")?r.slice(1):r;return path30.join(this.config.publicDir,s)}getContentType(e){return{".html":"text/html; charset=utf-8",".css":"text/css; charset=utf-8",".js":"application/javascript; charset=utf-8",".json":"application/json; charset=utf-8",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".svg":"image/svg+xml",".webp":"image/webp",".ico":"image/x-icon",".woff":"font/woff",".woff2":"font/woff2",".ttf":"font/ttf",".eot":"application/vnd.ms-fontobject",".xml":"application/xml; charset=utf-8",".txt":"text/plain; charset=utf-8"}[path30.extname(e).toLowerCase()]||"application/octet-stream"}getLiveReloadScript(){return"\n<script>\n(function() {\n 'use strict';\n \n var stateFilePath = '/.foundry-livereload-state.json';\n var storageKey = 'foundry-livereload-last-timestamp';\n var lastTimestamp = 0;\n var pollInterval = 500; // 500ms 轮询间隔\n \n // 从 localStorage 恢复上次的时间戳,避免页面刷新后重复触发\n try {\n var stored = localStorage.getItem(storageKey);\n if (stored) {\n lastTimestamp = parseInt(stored, 10) || 0;\n }\n } catch (error) {\n // localStorage 可能不可用,使用默认值\n console.warn('LiveReload: localStorage not available, may cause duplicate reloads');\n }\n \n function checkForReload() {\n fetch(stateFilePath + '?_t=' + Date.now(), { cache: 'no-cache' })\n .then(function(response) {\n if (!response.ok) {\n throw new Error('Failed to fetch state file');\n }\n return response.json();\n })\n .then(function(state) {\n if (state.timestamp > lastTimestamp) {\n // 更新时间戳并保存到 localStorage\n lastTimestamp = state.timestamp;\n try {\n localStorage.setItem(storageKey, lastTimestamp.toString());\n } catch (error) {\n // localStorage 写入失败,忽略\n }\n \n if (state.command === 'reload') {\n if (state.liveCSS) {\n // 热更新 CSS\n reloadCSS();\n } else if (state.liveImg) {\n // 热更新图片\n reloadImages();\n } else {\n // 完整页面刷新\n window.location.reload();\n }\n }\n }\n })\n .catch(function(error) {\n // 静默处理错误,避免控制台噪音\n });\n }\n \n function reloadCSS() {\n var links = document.querySelectorAll('link[rel=\"stylesheet\"]');\n for (var i = 0; i < links.length; i++) {\n var link = links[i];\n var href = link.href;\n if (href) {\n var url = new URL(href);\n url.searchParams.set('_t', Date.now().toString());\n link.href = url.toString();\n }\n }\n console.log('CSS reloaded');\n }\n \n function reloadImages() {\n var images = document.querySelectorAll('img');\n for (var i = 0; i < images.length; i++) {\n var img = images[i];\n var src = img.src;\n if (src) {\n var url = new URL(src);\n url.searchParams.set('_t', Date.now().toString());\n img.src = url.toString();\n }\n }\n console.log('Images reloaded');\n }\n \n // 开始轮询\n setInterval(checkForReload, pollInterval);\n \n // 初始检查\n checkForReload();\n})();\n<\/script>"}shouldLiveReloadCSS(e){return!!e&&e.some(e=>".css"===path30.extname(e).toLowerCase())}shouldLiveReloadImages(e){if(!e)return!1;const t=[".jpg",".jpeg",".png",".gif",".svg",".webp"];return e.some(e=>t.includes(path30.extname(e).toLowerCase()))}};var log64=getDomainLogger("build",{component:"incremental-coordinator"}),IncrementalBuildCoordinator=class{constructor(e){if(this.config=e,e.enableWatching){const t={contentDirs:e.contentDirs,projContentDirs:e.projContentDirs||e.contentDirs,batchDelay:e.batchDelay||500};this.fileWatcher=new ContentFileWatcher(t),this.fileWatcher.onFileChange(e=>this.handleFileChanges(e))}if(!1!==e.liveReload?.enabled){const t={port:e.liveReload?.port||8091,host:e.liveReload?.host||"localhost",livereloadPort:e.liveReload?.livereloadPort||35729,publicDir:e.publicDir,enableLiveReload:!0};this.liveReloadServer=function(e){return function(){if("undefined"!=typeof globalThis&&globalThis.window&&globalThis.window.process&&globalThis.window.process.type)return!0;try{return require("electron"),!0}catch{}return!!(process.env.ELECTRON_RUN_AS_NODE||process.env.ELECTRON_NO_ATTACH_CONSOLE||process.versions&&process.versions.electron)}()?new ElectronLiveReloadServer(e):new FoundryLiveReloadServer(e)}(t)}}fileWatcher;liveReloadServer;buildInProgress=!1;initialized=!1;domainInstances;async initialize(){this.initialized?log64.warn("IncrementalBuildCoordinator already initialized"):(await this.performFullBuildAndCacheDomains(),this.initialized=!0)}async performFullBuildAndCacheDomains(){try{this.domainInstances=await async function(e,t,n,r,s){try{process.chdir(e);const a=await collectAllPageTasks(e,t,n,r,s);if(a.length>80){log60.info(`📊 Found ${a.length} pages, attempting parallel processing...`);try{return await processSSGParallel(e,t,0,r),getDomainInstances()}catch(i){if((i instanceof Error?i.message:String(i)).includes("PARALLEL_NOT_SUPPORTED"))return log60.warn("⚠️ Parallel processing not available, falling back to serial processing"),log60.info(`🔄 Processing ${a.length} pages in serial mode...`),await generateStaticSiteWithProgress(e,t,n,r,s);throw i}}return log60.info(`📊 Found ${a.length} pages, using serial processing...`),await generateStaticSiteWithProgress(e,t,n,r,s)}catch(e){const t=e instanceof Error?e.message:String(e);throw log60.error(`❌ SSG processing failed: ${t}`),new Error(`Failed to process SSG: ${t}`)}}(this.config.projDir,this.config.modulesDir,this.config.markdown,this.config.progressCallback,this.config.httpClient)}catch(e){throw log64.error("Failed to perform full build and cache domains:",e),e}}async startWatching(){if(!this.initialized)throw new Error("Must call initialize() before startWatching()");this.config.enableWatching&&this.fileWatcher&&await this.fileWatcher.startWatching(),this.liveReloadServer&&await this.liveReloadServer.start()}async stopWatching(){this.fileWatcher&&await this.fileWatcher.stopWatching(),this.liveReloadServer&&await this.liveReloadServer.stop()}async handleFileChanges(e){if(this.buildInProgress)setTimeout(()=>this.handleFileChanges(e),1e3);else try{if(this.buildInProgress=!0,this.needFullRebuild(e))return void await this.performFullRebuild(e);await this.performIncrementalBuild(e)}finally{this.buildInProgress=!1}}needFullRebuild(e){return e.some(e=>"deleted"===e.eventType||"created"===e.eventType)}async performIncrementalBuild(e){if(!this.domainInstances)return log64.error("Domain instances not available, falling back to full rebuild"),void await this.performFullRebuild(e);try{const t=await this.domainInstances.fs.getFileMetaInfos(this.getEventsFilePaths(e));if(await this.domainInstances.content.handleChangeFiles(t),await this.domainInstances.site.renderAllLanguages(),this.liveReloadServer){const t=e.map(e=>e.filePath);this.liveReloadServer.notifyReload(t)}}catch(t){log64.error("Incremental build failed, falling back to full rebuild:",t),await this.performFullRebuild(e)}}getEventsFilePaths(e){return e.map(e=>e.filePath)}async performFullRebuild(e){if(await processSSGWithProgress(this.config.projDir,this.config.modulesDir,this.config.markdown,e=>{log64.info(`Rebuild progress: ${e.stage} - ${e.percentage}%`)},this.config.httpClient),this.liveReloadServer){const t=e.map(e=>e.filePath);this.liveReloadServer.notifyReload(t)}}isInitialized(){return this.initialized}isBuildInProgress(){return this.buildInProgress}getConfig(){return{...this.config}}getServerUrl(){return this.liveReloadServer?this.liveReloadServer.getUrl():""}getLiveReloadStatus(){if(!this.liveReloadServer)return{running:!1};const e=this.liveReloadServer.isServerRunning();return{running:e,...e&&{url:this.liveReloadServer.getUrl()}}}};async function startIncrementalBuild(e){const t=new IncrementalBuildCoordinator(e);return await t.initialize(),e.enableWatching&&await t.startWatching(),t}init_log(),getDomainLogger("build",{component:"incremental-ssg"});