xmlui 0.5.2-beta.1 → 0.5.2-beta.2

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.
@@ -12,7 +12,7 @@ var Q = (e, t, r) => (ve(e, t, "read from private field"), r ? r.call(e) : t.get
12
12
  var ie = (e, t, r) => (ve(e, t, "access private method"), r);
13
13
  import { isArray as Rt, isObject as It, mapValues as Lr } from "lodash-es";
14
14
  import { delay as Sr, HttpResponse as K, http as Dr } from "msw";
15
- import { r as Cr, d as qr, m as Mr, a as $r, g as Ur, o as we, T as jr } from "./index-oYnnL7tW.mjs";
15
+ import { r as Cr, d as qr, m as Mr, a as $r, g as Ur, o as we, T as jr } from "./index-DnAEgnWl.mjs";
16
16
  import Ve from "dexie";
17
17
  var Fr = /(%?)(%([sdijo]))/g;
18
18
  function Br(e, t) {
@@ -73026,7 +73026,7 @@ function wN({
73026
73026
  let i;
73027
73027
  return (async () => {
73028
73028
  if (process.env.VITE_MOCK_ENABLED) {
73029
- const { createApiInterceptorWorker: a } = await import("./apiInterceptorWorker-BXj8VrKM.mjs");
73029
+ const { createApiInterceptorWorker: a } = await import("./apiInterceptorWorker-CLcJFUAE.mjs");
73030
73030
  e && (i = await a(e), i.start({
73031
73031
  onUnhandledRequest: "bypass",
73032
73032
  waitUntilReady: !0,
@@ -74691,9 +74691,17 @@ function oB(e, t = Pe) {
74691
74691
  return;
74692
74692
  }
74693
74693
  if (process.env.VITE_BUILD_MODE === "CONFIG_ONLY") {
74694
- const k = await (await fetch(Or("config.json"))).json(), _ = [];
74694
+ const k = await (await fetch(Or("config.json"), {
74695
+ headers: {
74696
+ "Cache-Control": "no-cache, no-store"
74697
+ }
74698
+ })).json(), _ = [];
74695
74699
  (N = k.themes) == null || N.forEach(($) => {
74696
- _.push(fetch(Or($)).then((O) => O.json()));
74700
+ _.push(fetch(Or($), {
74701
+ headers: {
74702
+ "Cache-Control": "no-cache, no-store"
74703
+ }
74704
+ }).then((O) => O.json()));
74697
74705
  });
74698
74706
  const A = await Promise.all(_);
74699
74707
  o({
@@ -74707,11 +74715,19 @@ function oB(e, t = Pe) {
74707
74715
  });
74708
74716
  return;
74709
74717
  }
74710
- const s = fetch(Or("Main.xmlui")).then(
74718
+ const s = fetch(Or("Main.xmlui"), {
74719
+ headers: {
74720
+ "Cache-Control": "no-cache, no-store"
74721
+ }
74722
+ }).then(
74711
74723
  (C) => Yn(C)
74712
74724
  ), l = new Promise(async (C, k) => {
74713
74725
  try {
74714
- const _ = await fetch(Or("Main.xmlui.xs")), A = await Yn(_);
74726
+ const _ = await fetch(Or("Main.xmlui.xs"), {
74727
+ headers: {
74728
+ "Cache-Control": "no-cache, no-store"
74729
+ }
74730
+ }), A = await Yn(_);
74715
74731
  C(A.codeBehind);
74716
74732
  } catch {
74717
74733
  C(null);
@@ -74719,12 +74735,27 @@ function oB(e, t = Pe) {
74719
74735
  });
74720
74736
  let u;
74721
74737
  try {
74722
- u = await (await fetch(Or("config.json"))).json();
74738
+ u = await (await fetch(Or("config.json"), {
74739
+ headers: {
74740
+ "Cache-Control": "no-cache, no-store"
74741
+ }
74742
+ })).json();
74723
74743
  } catch {
74724
74744
  }
74725
- const d = (I = u == null ? void 0 : u.themes) == null ? void 0 : I.map((C) => fetch(Or(C)).then(
74745
+ const d = (I = u == null ? void 0 : u.themes) == null ? void 0 : I.map((C) => fetch(
74746
+ Or(C),
74747
+ {
74748
+ headers: {
74749
+ "Cache-Control": "no-cache, no-store"
74750
+ }
74751
+ }
74752
+ ).then(
74726
74753
  (k) => k.json()
74727
- )), p = (B = u == null ? void 0 : u.components) == null ? void 0 : B.map((C) => fetch(Or(C)).then((k) => Yn(k))), [m, h, g, f] = await Promise.all([
74754
+ )), p = (B = u == null ? void 0 : u.components) == null ? void 0 : B.map((C) => fetch(Or(C), {
74755
+ headers: {
74756
+ "Cache-Control": "no-cache, no-store"
74757
+ }
74758
+ }).then((k) => Yn(k))), [m, h, g, f] = await Promise.all([
74728
74759
  s,
74729
74760
  l,
74730
74761
  Promise.all(p || []),
@@ -74768,9 +74799,17 @@ function oB(e, t = Pe) {
74768
74799
  for (; S.size > 0; ) {
74769
74800
  const C = [...S].map(async (_) => {
74770
74801
  try {
74771
- const A = fetch(Or("/components/" + _ + ".xmlui")), $ = new Promise(async (L, H) => {
74802
+ const A = fetch(Or("/components/" + _ + ".xmlui"), {
74803
+ headers: {
74804
+ "Cache-Control": "no-cache, no-store"
74805
+ }
74806
+ }), $ = new Promise(async (L, H) => {
74772
74807
  try {
74773
- const G = (await Yn(await fetch(Or("/components/" + _ + ".xmlui.xs")))).codeBehind;
74808
+ const G = (await Yn(await fetch(Or("/components/" + _ + ".xmlui.xs"), {
74809
+ headers: {
74810
+ "Cache-Control": "no-cache, no-store"
74811
+ }
74812
+ }))).codeBehind;
74774
74813
  L(G);
74775
74814
  } catch {
74776
74815
  L(null);
@@ -450,7 +450,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
450
450
  `&&rA.push(lA);const aA=addPositions(nA,rA).map(lA=>`Error at line: ${lA.line}, column: ${lA.col}:
451
451
  ${lA.message}
452
452
  `).join(`
453
- `);throw new Error(aA)}return nodeToComponentDef(oA,iA,eA,tA)}function addPositions(AA,eA){if(eA.length===0){for(let tA of AA)tA.line=1,tA.col=tA.pos+1;return AA}for(let tA of AA){let gA=0;for(;gA<eA.length;++gA){const oA=eA[gA];if(tA.pos<oA){tA.line=gA+1,tA.col=tA.pos-(eA[gA-1]??0)+1;break}}const iA=eA[eA.length-1];tA.pos>=iA&&(tA.line=eA.length+1,tA.col=tA.pos-iA+0)}return AA}const componentFileExtension="xmlui",codeBehindFileExtension="xmlui.xs";function checkXmlUiMarkup(AA,eA,tA,gA){const iA=[],oA={},nA=new Set,rA=new Set;if(AA&&visitComponent(AA,null,IA,oA,tA),!oA.abort)for(const dA of eA)aA(dA.name)||lA("M007","Component",dA.name),dA.name==="Component"&&lA("M008","Component",dA.name),tA.componentRegistered(dA.name)&&lA("M009","Component",dA.name),rA.has(dA.name)?lA("M010","Component",dA.name):rA.add(dA.name),nA.clear(),visitComponent(dA.component,null,IA,oA,tA);return iA;function IA(dA,hA,pA,bA){if(!pA)return;if(!tA.componentRegistered(dA.type)){lA("M001",(hA==null?void 0:hA.type)??"Root",dA.type);return}dA.uid&&(aA(dA.uid)?nA.has(dA.uid)?lA("M003",dA.type,dA.uid):nA.add(dA.uid):lA("M002",dA.type,dA.type,dA.uid));const fA=tA.getComponentProps(dA.type)??{},ZA=dA.props??{};for(const NA of Object.keys(ZA))if(fA[NA]){const vA=ZA[NA];if(typeof vA=="string")try{parseParameterString(vA)}catch(VA){lA("M006",dA.type,NA,VA.message)}}else{const vA=NA.split("-");vA.length===1&&layoutOptionKeys.includes(NA)||vA.length===2&&layoutOptionKeys.includes(vA[0])&&viewportSizeNames.includes(vA[1])||tA.acceptArbitraryProps(dA.type)||lA("M005",dA.type,dA.type,NA)}const GA=tA.getComponentEvents(dA.type)??{},RA=dA.events??{};for(const NA of Object.keys(RA))if(GA[NA]){const vA=RA[NA];if(typeof vA=="string"){const VA=new Parser$1(vA);try{VA.parseStatements(),VA.errors.length>0&&lA("M012",dA.type,NA,VA.errors[0].text)}catch(QA){lA("M012",dA.type,NA,QA.message)}}}else lA("M011",dA.type,dA.type,NA);const MA=tA.getComponentValidator(dA.type);if(MA){const NA=MA(dA,gA);if(NA)if(Array.isArray(NA))for(const EA of NA)lA("M013",dA.type,EA);else lA("M013",dA.type,NA)}}function aA(dA){return/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(dA)}function lA(dA,hA,...pA){cA(dA,hA,!1,...pA)}function cA(dA,hA,pA,...bA){let fA=errorMessages[dA]??"Unkonwn error";bA&&bA.forEach((GA,RA)=>fA=ZA(fA,`{${RA}}`,bA[RA].toString())),iA.push({name:hA,code:dA,message:fA,isWarning:pA,args:bA});function ZA(GA,RA,MA){do GA=GA.replace(RA,MA);while(GA.includes(RA));return GA}}}function visitComponent(AA,eA,tA,gA={},iA){if(tA(AA,eA,!0,gA),gA.abort||gA.cancel)return;const oA=iA.getComponentProps(AA.type)??{},nA=AA.props??{};for(const aA of Object.keys(nA)){const lA=oA[aA];if(!lA)continue;const cA=nA[aA];if(lA.type==="ComponentDef"&&cA.type&&(visitComponent(cA,AA,tA,gA,iA),gA.abort||gA.cancel))return}const rA=iA.getComponentEvents(AA.type)??{},IA=AA.events??{};for(const aA of Object.keys(IA)){if(!rA[aA])continue;const cA=IA[aA];if(typeof cA=="object"&&cA.type){if(visitComponent(cA,AA,tA,gA,iA),gA.abort)return;if(gA.cancel)break}}if(AA.children)for(const aA of AA.children){if(visitComponent(aA,AA,tA,gA,iA),gA.abort)return;if(gA.cancel)break}tA(AA,void 0,!1,gA)}const errorMessages={M001:"The component '{0}' is not registered",M002:"The '{0}' element has an invalid id: '{1}'",M003:"Invalid component identifier: '{0}'",M004:"Duplicated component identifier: '{0}'",M005:"The '{0}' element has an invalid property: '{1}'",M006:"Parsing property value of '{0}' failed: {1}",M007:"The name of a reusable component is invalid: '{0}'",M008:"The name of a reusable component must not be '{0}', as it is a reserved name",M009:"A reusable component cannot have the name of a registered component: '{0}'",M010:"Duplicated reusable component name: '{0}'",M011:"The '{0}' element has an invalid event: '{1}'",M012:"Parsing event value of '{0}' failed: {1}",M013:"Component validation failed: '{0}'"};var define_process_env_default$2={NODE_ENV:"production",VITE_MOCK_ENABLED:!0};function StandaloneApp({appDef:AA,decorateComponentsWithTestId:eA,debugEnabled:tA=!0,runtime:gA,components:iA}){const oA=reactExports.useMemo(()=>typeof window<"u"&&window.location.href.startsWith("file"),[]),nA=useStandalone(AA,gA);if(usePrintVersionNumber(nA),!nA)return null;const{apiInterceptor:rA,name:IA,globals:aA,defaultTheme:lA,defaultTone:cA,resources:dA,resourceMap:hA,entryPoint:pA,components:bA,themes:fA,sources:ZA}=nA,GA=rA||(typeof window<"u"?window.XMLUI_MOCK_API:void 0);return jsxRuntimeExports.jsx(ApiInterceptorProvider,{interceptor:GA,children:jsxRuntimeExports.jsx(AppRoot,{servedFromSingleFile:oA,decorateComponentsWithTestId:eA,node:pA,standalone:!0,debugEnabled:tA,baseName:typeof window<"u"&&window.__PUBLIC_PATH||"",globalProps:{name:IA,...aA||{}},defaultTheme:lA,defaultTone:cA,resources:dA,resourceMap:hA,sources:ZA,contributes:{compoundComponents:bA,components:iA,themes:fA}})})}async function parseComponentResp(AA){if(AA.url.toLowerCase().endsWith(".xmlui")){const eA=await AA.text(),tA=AA.url;return{component:parseXmlUiMarkup(eA,tA),src:eA,file:tA}}if(AA.url.toLowerCase().endsWith(".xmlui.xs")){const eA=await AA.text();new Parser$1(eA).parseStatements();const gA=collectCodeBehindFromSource("Main",eA,()=>"");return removeCodeBehindTokensFromTree(gA),{codeBehind:gA,file:AA.url}}return{component:await AA.json()}}function matchesFileName(AA,eA){return AA.endsWith(`/${eA}.ts`)||AA.endsWith(`/${eA}.js`)||AA.endsWith(`/${eA}.${componentFileExtension}`)||AA.endsWith(`/${eA}.${codeBehindFileExtension}`)}function matchesFolder(AA,eA){return AA.includes(`/${eA}/`)}function resolveRuntime(AA){let eA,tA,gA,iA=[],oA;const nA={},rA={},IA={};for(const[dA,hA]of Object.entries(AA))matchesFileName(dA,"config")&&(eA=hA.default),(matchesFileName(dA,"Main")||matchesFileName(dA,"App"))&&(dA.endsWith(codeBehindFileExtension)?gA=hA.default:(tA=hA.default.component,hA.default.file&&(nA[hA.default.file]=hA.default.src))),matchesFileName(dA,"api")&&(oA=hA.default),matchesFolder(dA,"components")&&(dA.endsWith(codeBehindFileExtension)?IA[dA]=hA.default:(rA[dA]=hA.default.component,nA[hA.default.file]=hA.default.src)),matchesFolder(dA,"themes")&&iA.push(hA.default);const aA=(eA==null?void 0:eA.entryPoint)||tA,lA={...aA,vars:{...gA==null?void 0:gA.vars,...aA==null?void 0:aA.vars},functions:gA==null?void 0:gA.functions,scriptError:gA==null?void 0:gA.moduleErrors};let cA=[];return eA!=null&&eA.components?cA=eA.components:Object.entries(rA).forEach(([dA,hA])=>{const pA=IA[`${dA}.xs`],bA={...hA,component:{...hA.component,vars:{...hA.component.vars,...pA==null?void 0:pA.vars},functions:pA==null?void 0:pA.functions,scriptError:pA==null?void 0:pA.moduleErrors}};cA.push(bA)}),{...eA,entryPoint:lA,components:cA,themes:(eA==null?void 0:eA.themes)||iA,apiInterceptor:(eA==null?void 0:eA.apiInterceptor)||oA,sources:nA}}function mergeGivenAppDefWithRuntime(AA,eA){return eA?{...eA,entryPoint:eA.entryPoint||AA.entryPoint,components:eA.components||AA.components,themes:eA.themes||AA.themes,apiInterceptor:eA.apiInterceptor||AA.apiInterceptor}:AA}function getStandalone(AA,eA=EMPTY_OBJECT){if(typeof document<"u"&&document.querySelector('script[type="text/xmlui"]')!==null){let oA=null;const nA=document.querySelectorAll('script[type="text/xmlui"]'),rA=[];for(let hA=0;hA<nA.length;hA++){const pA=nA[hA],bA=parseXmlUiMarkup(pA.textContent);bA&&("type"in bA&&bA.type==="App"?oA=bA:rA.push(bA))}if(oA===null)throw new Error("No App component specified");const IA=document.querySelector('script[type="text/xmlui-config"]'),aA=IA===null?{}:JSON.parse(IA.textContent),lA=[];return document.querySelectorAll('script[type="text/xmlui-theme"]').forEach(hA=>{lA.push(JSON.parse(hA.textContent))}),{...aA,entryPoint:oA,components:rA,themes:lA}}const gA=resolveRuntime(eA),iA=mergeGivenAppDefWithRuntime(gA,AA);if((define_process_env_default$2.VITE_DEV_MODE||define_process_env_default$2.VITE_BUILD_MODE==="INLINE_ALL")&&!define_process_env_default$2.VITE_STANDALONE){if(!iA)throw new Error("couldn't find the application metadata");return iA}return null}function useStandalone(AA,eA=EMPTY_OBJECT){const[tA,gA]=reactExports.useState(getStandalone(AA,eA));return useIsomorphicLayoutEffect$6(()=>{(async function(){var EA,vA,VA;if(document.querySelector('script[type="text/xmlui"]')!==null){let QA=null;const KA=document.querySelectorAll('script[type="text/xmlui"]'),XA=[];for(let eg=0;eg<KA.length;eg++){const Ag=KA[eg],gg=parseXmlUiMarkup(Ag.textContent);gg&&("type"in gg&&gg.type==="App"?QA=gg:XA.push(gg))}if(QA===null)throw new Error("No App component specified");const $A=document.querySelector('script[type="text/xmlui-config"]'),JA=$A===null?{}:JSON.parse($A.textContent),PA=[];document.querySelectorAll('script[type="text/xmlui-theme"]').forEach(eg=>{PA.push(JSON.parse(eg.textContent))});const ig={...JA,entryPoint:QA,components:XA,themes:PA};gA(ig);return}const oA=resolveRuntime(eA),nA=mergeGivenAppDefWithRuntime(oA,AA);if((define_process_env_default$2.VITE_DEV_MODE||define_process_env_default$2.VITE_BUILD_MODE==="INLINE_ALL")&&!define_process_env_default$2.VITE_STANDALONE){if(!nA)throw new Error("couldn't find the application metadata");gA(nA);return}if(define_process_env_default$2.VITE_BUILD_MODE==="CONFIG_ONLY"){const KA=await(await fetch(normalizePath$1("config.json"))).json(),XA=[];(EA=KA.themes)==null||EA.forEach(JA=>{XA.push(fetch(normalizePath$1(JA)).then(PA=>PA.json()))});const $A=await Promise.all(XA);gA({...nA,name:KA.name,globals:KA.globals,defaultTheme:KA.defaultTheme,resources:KA.resources,resourceMap:KA.resourceMap,themes:$A});return}const rA=fetch(normalizePath$1("Main.xmlui")).then(QA=>parseComponentResp(QA)),IA=new Promise(async(QA,KA)=>{try{const XA=await fetch(normalizePath$1("Main.xmlui.xs")),$A=await parseComponentResp(XA);QA($A.codeBehind)}catch{QA(null)}});let aA;try{aA=await(await fetch(normalizePath$1("config.json"))).json()}catch{}const lA=(vA=aA==null?void 0:aA.themes)==null?void 0:vA.map(QA=>fetch(normalizePath$1(QA)).then(KA=>KA.json())),cA=(VA=aA==null?void 0:aA.components)==null?void 0:VA.map(QA=>fetch(normalizePath$1(QA)).then(KA=>parseComponentResp(KA))),[dA,hA,pA,bA]=await Promise.all([rA,IA,Promise.all(cA||[]),Promise.all(lA||[])]),fA={},ZA={};dA.file&&(fA[dA.file]=dA.src),pA.forEach(QA=>{var KA;(KA=QA==null?void 0:QA.file)!=null&&KA.endsWith(".xmlui.xs")?ZA[QA.file]=QA.codeBehind:QA.file&&(fA[QA.file]=QA.src)});const GA={...dA.component,vars:{...hA==null?void 0:hA.vars,...dA.component.vars},functions:hA==null?void 0:hA.functions,scriptError:hA==null?void 0:hA.moduleErrors},RA=pA.filter(QA=>{var KA;return!((KA=QA==null?void 0:QA.file)!=null&&KA.endsWith(".xmlui.xs"))}).map(QA=>{const KA=ZA[QA.file+".xs"];return{...QA.component,component:{...QA.component.component,vars:{...QA.component.component.vars,...KA==null?void 0:KA.vars},functions:KA==null?void 0:KA.functions,scriptError:KA==null?void 0:KA.moduleErrors}}});let MA=collectMissingComponents(GA,RA);const NA=new Set;for(;MA.size>0;){const QA=[...MA].map(async XA=>{try{const $A=fetch(normalizePath$1("/components/"+XA+".xmlui")),JA=new Promise(async(eg,Ag)=>{try{const HA=(await parseComponentResp(await fetch(normalizePath$1("/components/"+XA+".xmlui.xs")))).codeBehind;eg(HA)}catch{eg(null)}}),[PA,tg]=await Promise.all([$A,JA]),ig=await parseComponentResp(PA);return fA[ig.file]=ig.src,{...ig.component,component:{...ig.component.component,vars:{...ig.component.component.vars,...tg==null?void 0:tg.vars},functions:tg==null?void 0:tg.functions,scriptError:tg==null?void 0:tg.moduleErrors}}}catch{return NA.add(XA),null}}),KA=await Promise.all(QA);RA.push(...KA.filter(XA=>!!XA)),MA=collectMissingComponents(GA,RA,NA)}gA({...aA,themes:bA,sources:fA,components:RA,entryPoint:GA})})()},[eA,AA]),tA}function collectMissingComponents(AA,eA,tA=new Set){const gA=new ComponentRegistry({compoundComponents:eA}),iA=checkXmlUiMarkup(AA,eA,{getComponentProps:oA=>{var nA,rA;return(rA=(nA=gA.lookupComponentRenderer(oA))==null?void 0:nA.descriptor)==null?void 0:rA.props},acceptArbitraryProps:oA=>!0,getComponentValidator:oA=>null,getComponentEvents:oA=>null,componentRegistered:oA=>gA.hasComponent(oA)});return new Set(iA.filter(oA=>oA.code==="M001").map(oA=>oA.args[0]).filter(oA=>!tA.has(oA)))}function usePrintVersionNumber(AA){const eA=reactExports.useRef(!1);reactExports.useEffect(()=>{AA!=null&&AA.name&&!eA.current&&(console.log(`${AA.name} version: `,define_process_env_default$2.VITE_APP_VERSION||"dev"),eA.current=!0)},[AA==null?void 0:AA.name])}let contentRoot=null;function startApp(AA,eA){let tA=document.getElementById("root");return tA||(tA=document.createElement("div"),tA.setAttribute("id","root"),document.body.appendChild(tA)),contentRoot||(contentRoot=client.createRoot(tA)),contentRoot.render(jsxRuntimeExports.jsx(StandaloneApp,{runtime:AA,components:eA})),contentRoot}document.addEventListener("DOMContentLoaded",function(){if(!document.getElementById("root")){const AA=document.createElement("div");AA.id="root",document.getElementsByTagName("body")[0].appendChild(AA)}startApp()});let ShikiError$2=class extends Error{constructor(eA){super(eA),this.name="ShikiError"}};function clone(AA){return doClone(AA)}function doClone(AA){return Array.isArray(AA)?cloneArray(AA):typeof AA=="object"?cloneObj(AA):AA}function cloneArray(AA){let eA=[];for(let tA=0,gA=AA.length;tA<gA;tA++)eA[tA]=doClone(AA[tA]);return eA}function cloneObj(AA){let eA={};for(let tA in AA)eA[tA]=doClone(AA[tA]);return eA}function mergeObjects(AA,...eA){return eA.forEach(tA=>{for(let gA in tA)AA[gA]=tA[gA]}),AA}function basename(AA){const eA=~AA.lastIndexOf("/")||~AA.lastIndexOf("\\");return eA===0?AA:~eA===AA.length-1?basename(AA.substring(0,AA.length-1)):AA.substr(~eA+1)}var CAPTURING_REGEX_SOURCE=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,RegexSource=class{static hasCaptures(AA){return AA===null?!1:(CAPTURING_REGEX_SOURCE.lastIndex=0,CAPTURING_REGEX_SOURCE.test(AA))}static replaceCaptures(AA,eA,tA){return AA.replace(CAPTURING_REGEX_SOURCE,(gA,iA,oA,nA)=>{let rA=tA[parseInt(iA||oA,10)];if(rA){let IA=eA.substring(rA.start,rA.end);for(;IA[0]===".";)IA=IA.substring(1);switch(nA){case"downcase":return IA.toLowerCase();case"upcase":return IA.toUpperCase();default:return IA}}else return gA})}};function strcmp(AA,eA){return AA<eA?-1:AA>eA?1:0}function strArrCmp(AA,eA){if(AA===null&&eA===null)return 0;if(!AA)return-1;if(!eA)return 1;let tA=AA.length,gA=eA.length;if(tA===gA){for(let iA=0;iA<tA;iA++){let oA=strcmp(AA[iA],eA[iA]);if(oA!==0)return oA}return 0}return tA-gA}function isValidHexColor(AA){return!!(/^#[0-9a-f]{6}$/i.test(AA)||/^#[0-9a-f]{8}$/i.test(AA)||/^#[0-9a-f]{3}$/i.test(AA)||/^#[0-9a-f]{4}$/i.test(AA))}function escapeRegExpCharacters(AA){return AA.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var CachedFn=class{constructor(AA){this.fn=AA,this.cache=new Map}get(AA){if(this.cache.has(AA))return this.cache.get(AA);const eA=this.fn(AA);return this.cache.set(AA,eA),eA}},Theme=class{constructor(AA,eA,tA){this._colorMap=AA,this._defaults=eA,this._root=tA,this._cachedMatchRoot=new CachedFn(gA=>this._root.match(gA))}static createFromRawTheme(AA,eA){return this.createFromParsedTheme(parseTheme(AA),eA)}static createFromParsedTheme(AA,eA){return resolveParsedThemeRules(AA,eA)}getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(AA){if(AA===null)return this._defaults;const eA=AA.scopeName,gA=this._cachedMatchRoot.get(eA).find(iA=>_scopePathMatchesParentScopes(AA.parent,iA.parentScopes));return gA?new StyleAttributes(gA.fontStyle,gA.foreground,gA.background):null}},ScopeStack=class Ml{constructor(eA,tA){this.parent=eA,this.scopeName=tA}static push(eA,tA){for(const gA of tA)eA=new Ml(eA,gA);return eA}static from(...eA){let tA=null;for(let gA=0;gA<eA.length;gA++)tA=new Ml(tA,eA[gA]);return tA}push(eA){return new Ml(this,eA)}getSegments(){let eA=this;const tA=[];for(;eA;)tA.push(eA.scopeName),eA=eA.parent;return tA.reverse(),tA}toString(){return this.getSegments().join(" ")}extends(eA){return this===eA?!0:this.parent===null?!1:this.parent.extends(eA)}getExtensionIfDefined(eA){const tA=[];let gA=this;for(;gA&&gA!==eA;)tA.push(gA.scopeName),gA=gA.parent;return gA===eA?tA.reverse():void 0}};function _scopePathMatchesParentScopes(AA,eA){if(eA.length===0)return!0;for(let tA=0;tA<eA.length;tA++){let gA=eA[tA],iA=!1;if(gA===">"){if(tA===eA.length-1)return!1;gA=eA[++tA],iA=!0}for(;AA&&!_matchesScope(AA.scopeName,gA);){if(iA)return!1;AA=AA.parent}if(!AA)return!1;AA=AA.parent}return!0}function _matchesScope(AA,eA){return eA===AA||AA.startsWith(eA)&&AA[eA.length]==="."}var StyleAttributes=class{constructor(AA,eA,tA){this.fontStyle=AA,this.foregroundId=eA,this.backgroundId=tA}};function parseTheme(AA){if(!AA)return[];if(!AA.settings||!Array.isArray(AA.settings))return[];let eA=AA.settings,tA=[],gA=0;for(let iA=0,oA=eA.length;iA<oA;iA++){let nA=eA[iA];if(!nA.settings)continue;let rA;if(typeof nA.scope=="string"){let cA=nA.scope;cA=cA.replace(/^[,]+/,""),cA=cA.replace(/[,]+$/,""),rA=cA.split(",")}else Array.isArray(nA.scope)?rA=nA.scope:rA=[""];let IA=-1;if(typeof nA.settings.fontStyle=="string"){IA=0;let cA=nA.settings.fontStyle.split(" ");for(let dA=0,hA=cA.length;dA<hA;dA++)switch(cA[dA]){case"italic":IA=IA|1;break;case"bold":IA=IA|2;break;case"underline":IA=IA|4;break;case"strikethrough":IA=IA|8;break}}let aA=null;typeof nA.settings.foreground=="string"&&isValidHexColor(nA.settings.foreground)&&(aA=nA.settings.foreground);let lA=null;typeof nA.settings.background=="string"&&isValidHexColor(nA.settings.background)&&(lA=nA.settings.background);for(let cA=0,dA=rA.length;cA<dA;cA++){let pA=rA[cA].trim().split(" "),bA=pA[pA.length-1],fA=null;pA.length>1&&(fA=pA.slice(0,pA.length-1),fA.reverse()),tA[gA++]=new ParsedThemeRule(bA,fA,iA,IA,aA,lA)}}return tA}var ParsedThemeRule=class{constructor(AA,eA,tA,gA,iA,oA){this.scope=AA,this.parentScopes=eA,this.index=tA,this.fontStyle=gA,this.foreground=iA,this.background=oA}},FontStyle=(AA=>(AA[AA.NotSet=-1]="NotSet",AA[AA.None=0]="None",AA[AA.Italic=1]="Italic",AA[AA.Bold=2]="Bold",AA[AA.Underline=4]="Underline",AA[AA.Strikethrough=8]="Strikethrough",AA))(FontStyle||{});function resolveParsedThemeRules(AA,eA){AA.sort((IA,aA)=>{let lA=strcmp(IA.scope,aA.scope);return lA!==0||(lA=strArrCmp(IA.parentScopes,aA.parentScopes),lA!==0)?lA:IA.index-aA.index});let tA=0,gA="#000000",iA="#ffffff";for(;AA.length>=1&&AA[0].scope==="";){let IA=AA.shift();IA.fontStyle!==-1&&(tA=IA.fontStyle),IA.foreground!==null&&(gA=IA.foreground),IA.background!==null&&(iA=IA.background)}let oA=new ColorMap(eA),nA=new StyleAttributes(tA,oA.getId(gA),oA.getId(iA)),rA=new ThemeTrieElement(new ThemeTrieElementRule(0,null,-1,0,0),[]);for(let IA=0,aA=AA.length;IA<aA;IA++){let lA=AA[IA];rA.insert(0,lA.scope,lA.parentScopes,lA.fontStyle,oA.getId(lA.foreground),oA.getId(lA.background))}return new Theme(oA,nA,rA)}var ColorMap=class{constructor(AA){if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(AA)){this._isFrozen=!0;for(let eA=0,tA=AA.length;eA<tA;eA++)this._color2id[AA[eA]]=eA,this._id2color[eA]=AA[eA]}else this._isFrozen=!1}getId(AA){if(AA===null)return 0;AA=AA.toUpperCase();let eA=this._color2id[AA];if(eA)return eA;if(this._isFrozen)throw new Error(`Missing color in color map - ${AA}`);return eA=++this._lastColorId,this._color2id[AA]=eA,this._id2color[eA]=AA,eA}getColorMap(){return this._id2color.slice(0)}},emptyParentScopes=Object.freeze([]),ThemeTrieElementRule=class Ku{constructor(eA,tA,gA,iA,oA){this.scopeDepth=eA,this.parentScopes=tA||emptyParentScopes,this.fontStyle=gA,this.foreground=iA,this.background=oA}clone(){return new Ku(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(eA){let tA=[];for(let gA=0,iA=eA.length;gA<iA;gA++)tA[gA]=eA[gA].clone();return tA}acceptOverwrite(eA,tA,gA,iA){this.scopeDepth>eA?console.log("how did this happen?"):this.scopeDepth=eA,tA!==-1&&(this.fontStyle=tA),gA!==0&&(this.foreground=gA),iA!==0&&(this.background=iA)}},ThemeTrieElement=class Pc{constructor(eA,tA=[],gA={}){this._mainRule=eA,this._children=gA,this._rulesWithParentScopes=tA}static _cmpBySpecificity(eA,tA){if(eA.scopeDepth!==tA.scopeDepth)return tA.scopeDepth-eA.scopeDepth;let gA=0,iA=0;for(;eA.parentScopes[gA]===">"&&gA++,tA.parentScopes[iA]===">"&&iA++,!(gA>=eA.parentScopes.length||iA>=tA.parentScopes.length);){const oA=tA.parentScopes[iA].length-eA.parentScopes[gA].length;if(oA!==0)return oA;gA++,iA++}return tA.parentScopes.length-eA.parentScopes.length}match(eA){if(eA!==""){let gA=eA.indexOf("."),iA,oA;if(gA===-1?(iA=eA,oA=""):(iA=eA.substring(0,gA),oA=eA.substring(gA+1)),this._children.hasOwnProperty(iA))return this._children[iA].match(oA)}const tA=this._rulesWithParentScopes.concat(this._mainRule);return tA.sort(Pc._cmpBySpecificity),tA}insert(eA,tA,gA,iA,oA,nA){if(tA===""){this._doInsertHere(eA,gA,iA,oA,nA);return}let rA=tA.indexOf("."),IA,aA;rA===-1?(IA=tA,aA=""):(IA=tA.substring(0,rA),aA=tA.substring(rA+1));let lA;this._children.hasOwnProperty(IA)?lA=this._children[IA]:(lA=new Pc(this._mainRule.clone(),ThemeTrieElementRule.cloneArr(this._rulesWithParentScopes)),this._children[IA]=lA),lA.insert(eA+1,aA,gA,iA,oA,nA)}_doInsertHere(eA,tA,gA,iA,oA){if(tA===null){this._mainRule.acceptOverwrite(eA,gA,iA,oA);return}for(let nA=0,rA=this._rulesWithParentScopes.length;nA<rA;nA++){let IA=this._rulesWithParentScopes[nA];if(strArrCmp(IA.parentScopes,tA)===0){IA.acceptOverwrite(eA,gA,iA,oA);return}}gA===-1&&(gA=this._mainRule.fontStyle),iA===0&&(iA=this._mainRule.foreground),oA===0&&(oA=this._mainRule.background),this._rulesWithParentScopes.push(new ThemeTrieElementRule(eA,tA,gA,iA,oA))}},EncodedTokenMetadata=class mI{static toBinaryStr(eA){return eA.toString(2).padStart(32,"0")}static print(eA){const tA=mI.getLanguageId(eA),gA=mI.getTokenType(eA),iA=mI.getFontStyle(eA),oA=mI.getForeground(eA),nA=mI.getBackground(eA);console.log({languageId:tA,tokenType:gA,fontStyle:iA,foreground:oA,background:nA})}static getLanguageId(eA){return(eA&255)>>>0}static getTokenType(eA){return(eA&768)>>>8}static containsBalancedBrackets(eA){return(eA&1024)!==0}static getFontStyle(eA){return(eA&30720)>>>11}static getForeground(eA){return(eA&16744448)>>>15}static getBackground(eA){return(eA&4278190080)>>>24}static set(eA,tA,gA,iA,oA,nA,rA){let IA=mI.getLanguageId(eA),aA=mI.getTokenType(eA),lA=mI.containsBalancedBrackets(eA)?1:0,cA=mI.getFontStyle(eA),dA=mI.getForeground(eA),hA=mI.getBackground(eA);return tA!==0&&(IA=tA),gA!==8&&(aA=gA),iA!==null&&(lA=iA?1:0),oA!==-1&&(cA=oA),nA!==0&&(dA=nA),rA!==0&&(hA=rA),(IA<<0|aA<<8|lA<<10|cA<<11|dA<<15|hA<<24)>>>0}};function toOptionalTokenType(AA){return AA}function fromOptionalTokenType(AA){return AA}function createMatchers(AA,eA){const tA=[],gA=newTokenizer(AA);let iA=gA.next();for(;iA!==null;){let IA=0;if(iA.length===2&&iA.charAt(1)===":"){switch(iA.charAt(0)){case"R":IA=1;break;case"L":IA=-1;break;default:console.log(`Unknown priority ${iA} in scope selector`)}iA=gA.next()}let aA=nA();if(tA.push({matcher:aA,priority:IA}),iA!==",")break;iA=gA.next()}return tA;function oA(){if(iA==="-"){iA=gA.next();const IA=oA();return aA=>!!IA&&!IA(aA)}if(iA==="("){iA=gA.next();const IA=rA();return iA===")"&&(iA=gA.next()),IA}if(isIdentifier(iA)){const IA=[];do IA.push(iA),iA=gA.next();while(isIdentifier(iA));return aA=>eA(IA,aA)}return null}function nA(){const IA=[];let aA=oA();for(;aA;)IA.push(aA),aA=oA();return lA=>IA.every(cA=>cA(lA))}function rA(){const IA=[];let aA=nA();for(;aA&&(IA.push(aA),iA==="|"||iA===",");){do iA=gA.next();while(iA==="|"||iA===",");aA=nA()}return lA=>IA.some(cA=>cA(lA))}}function isIdentifier(AA){return!!AA&&!!AA.match(/[\w\.:]+/)}function newTokenizer(AA){let eA=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,tA=eA.exec(AA);return{next:()=>{if(!tA)return null;const gA=tA[0];return tA=eA.exec(AA),gA}}}function disposeOnigString(AA){typeof AA.dispose=="function"&&AA.dispose()}var TopLevelRuleReference=class{constructor(AA){this.scopeName=AA}toKey(){return this.scopeName}},TopLevelRepositoryRuleReference=class{constructor(AA,eA){this.scopeName=AA,this.ruleName=eA}toKey(){return`${this.scopeName}#${this.ruleName}`}},ExternalReferenceCollector=class{constructor(){this._references=[],this._seenReferenceKeys=new Set,this.visitedRule=new Set}get references(){return this._references}add(AA){const eA=AA.toKey();this._seenReferenceKeys.has(eA)||(this._seenReferenceKeys.add(eA),this._references.push(AA))}},ScopeDependencyProcessor=class{constructor(AA,eA){this.repo=AA,this.initialScopeName=eA,this.seenFullScopeRequests=new Set,this.seenPartialScopeRequests=new Set,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new TopLevelRuleReference(this.initialScopeName)]}processQueue(){const AA=this.Q;this.Q=[];const eA=new ExternalReferenceCollector;for(const tA of AA)collectReferencesOfReference(tA,this.initialScopeName,this.repo,eA);for(const tA of eA.references)if(tA instanceof TopLevelRuleReference){if(this.seenFullScopeRequests.has(tA.scopeName))continue;this.seenFullScopeRequests.add(tA.scopeName),this.Q.push(tA)}else{if(this.seenFullScopeRequests.has(tA.scopeName)||this.seenPartialScopeRequests.has(tA.toKey()))continue;this.seenPartialScopeRequests.add(tA.toKey()),this.Q.push(tA)}}};function collectReferencesOfReference(AA,eA,tA,gA){const iA=tA.lookup(AA.scopeName);if(!iA){if(AA.scopeName===eA)throw new Error(`No grammar provided for <${eA}>`);return}const oA=tA.lookup(eA);AA instanceof TopLevelRuleReference?collectExternalReferencesInTopLevelRule({baseGrammar:oA,selfGrammar:iA},gA):collectExternalReferencesInTopLevelRepositoryRule(AA.ruleName,{baseGrammar:oA,selfGrammar:iA,repository:iA.repository},gA);const nA=tA.injections(AA.scopeName);if(nA)for(const rA of nA)gA.add(new TopLevelRuleReference(rA))}function collectExternalReferencesInTopLevelRepositoryRule(AA,eA,tA){if(eA.repository&&eA.repository[AA]){const gA=eA.repository[AA];collectExternalReferencesInRules([gA],eA,tA)}}function collectExternalReferencesInTopLevelRule(AA,eA){AA.selfGrammar.patterns&&Array.isArray(AA.selfGrammar.patterns)&&collectExternalReferencesInRules(AA.selfGrammar.patterns,{...AA,repository:AA.selfGrammar.repository},eA),AA.selfGrammar.injections&&collectExternalReferencesInRules(Object.values(AA.selfGrammar.injections),{...AA,repository:AA.selfGrammar.repository},eA)}function collectExternalReferencesInRules(AA,eA,tA){for(const gA of AA){if(tA.visitedRule.has(gA))continue;tA.visitedRule.add(gA);const iA=gA.repository?mergeObjects({},eA.repository,gA.repository):eA.repository;Array.isArray(gA.patterns)&&collectExternalReferencesInRules(gA.patterns,{...eA,repository:iA},tA);const oA=gA.include;if(!oA)continue;const nA=parseInclude(oA);switch(nA.kind){case 0:collectExternalReferencesInTopLevelRule({...eA,selfGrammar:eA.baseGrammar},tA);break;case 1:collectExternalReferencesInTopLevelRule(eA,tA);break;case 2:collectExternalReferencesInTopLevelRepositoryRule(nA.ruleName,{...eA,repository:iA},tA);break;case 3:case 4:const rA=nA.scopeName===eA.selfGrammar.scopeName?eA.selfGrammar:nA.scopeName===eA.baseGrammar.scopeName?eA.baseGrammar:void 0;if(rA){const IA={baseGrammar:eA.baseGrammar,selfGrammar:rA,repository:iA};nA.kind===4?collectExternalReferencesInTopLevelRepositoryRule(nA.ruleName,IA,tA):collectExternalReferencesInTopLevelRule(IA,tA)}else nA.kind===4?tA.add(new TopLevelRepositoryRuleReference(nA.scopeName,nA.ruleName)):tA.add(new TopLevelRuleReference(nA.scopeName));break}}}var BaseReference=class{constructor(){this.kind=0}},SelfReference=class{constructor(){this.kind=1}},RelativeReference=class{constructor(AA){this.ruleName=AA,this.kind=2}},TopLevelReference=class{constructor(AA){this.scopeName=AA,this.kind=3}},TopLevelRepositoryReference=class{constructor(AA,eA){this.scopeName=AA,this.ruleName=eA,this.kind=4}};function parseInclude(AA){if(AA==="$base")return new BaseReference;if(AA==="$self")return new SelfReference;const eA=AA.indexOf("#");if(eA===-1)return new TopLevelReference(AA);if(eA===0)return new RelativeReference(AA.substring(1));{const tA=AA.substring(0,eA),gA=AA.substring(eA+1);return new TopLevelRepositoryReference(tA,gA)}}var HAS_BACK_REFERENCES=/\\(\d+)/,BACK_REFERENCING_END=/\\(\d+)/g,endRuleId=-1,whileRuleId=-2;function ruleIdFromNumber(AA){return AA}function ruleIdToNumber(AA){return AA}var Rule=class{constructor(AA,eA,tA,gA){this.$location=AA,this.id=eA,this._name=tA||null,this._nameIsCapturing=RegexSource.hasCaptures(this._name),this._contentName=gA||null,this._contentNameIsCapturing=RegexSource.hasCaptures(this._contentName)}get debugName(){const AA=this.$location?`${basename(this.$location.filename)}:${this.$location.line}`:"unknown";return`${this.constructor.name}#${this.id} @ ${AA}`}getName(AA,eA){return!this._nameIsCapturing||this._name===null||AA===null||eA===null?this._name:RegexSource.replaceCaptures(this._name,AA,eA)}getContentName(AA,eA){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:RegexSource.replaceCaptures(this._contentName,AA,eA)}},CaptureRule=class extends Rule{constructor(AA,eA,tA,gA,iA){super(AA,eA,tA,gA),this.retokenizeCapturedWithRuleId=iA}dispose(){}collectPatterns(AA,eA){throw new Error("Not supported!")}compile(AA,eA){throw new Error("Not supported!")}compileAG(AA,eA,tA,gA){throw new Error("Not supported!")}},MatchRule=class extends Rule{constructor(AA,eA,tA,gA,iA){super(AA,eA,tA,null),this._match=new RegExpSource(gA,this.id),this.captures=iA,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(AA,eA){eA.push(this._match)}compile(AA,eA){return this._getCachedCompiledPatterns(AA).compile(AA)}compileAG(AA,eA,tA,gA){return this._getCachedCompiledPatterns(AA).compileAG(AA,tA,gA)}_getCachedCompiledPatterns(AA){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new RegExpSourceList,this.collectPatterns(AA,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},IncludeOnlyRule=class extends Rule{constructor(AA,eA,tA,gA,iA){super(AA,eA,tA,gA),this.patterns=iA.patterns,this.hasMissingPatterns=iA.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}collectPatterns(AA,eA){for(const tA of this.patterns)AA.getRule(tA).collectPatterns(AA,eA)}compile(AA,eA){return this._getCachedCompiledPatterns(AA).compile(AA)}compileAG(AA,eA,tA,gA){return this._getCachedCompiledPatterns(AA).compileAG(AA,tA,gA)}_getCachedCompiledPatterns(AA){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new RegExpSourceList,this.collectPatterns(AA,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},BeginEndRule=class extends Rule{constructor(AA,eA,tA,gA,iA,oA,nA,rA,IA,aA){super(AA,eA,tA,gA),this._begin=new RegExpSource(iA,this.id),this.beginCaptures=oA,this._end=new RegExpSource(nA||"￿",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=rA,this.applyEndPatternLast=IA||!1,this.patterns=aA.patterns,this.hasMissingPatterns=aA.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(AA,eA){return this._end.resolveBackReferences(AA,eA)}collectPatterns(AA,eA){eA.push(this._begin)}compile(AA,eA){return this._getCachedCompiledPatterns(AA,eA).compile(AA)}compileAG(AA,eA,tA,gA){return this._getCachedCompiledPatterns(AA,eA).compileAG(AA,tA,gA)}_getCachedCompiledPatterns(AA,eA){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new RegExpSourceList;for(const tA of this.patterns)AA.getRule(tA).collectPatterns(AA,this._cachedCompiledPatterns);this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,eA):this._cachedCompiledPatterns.setSource(0,eA)),this._cachedCompiledPatterns}},BeginWhileRule=class extends Rule{constructor(AA,eA,tA,gA,iA,oA,nA,rA,IA){super(AA,eA,tA,gA),this._begin=new RegExpSource(iA,this.id),this.beginCaptures=oA,this.whileCaptures=rA,this._while=new RegExpSource(nA,whileRuleId),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=IA.patterns,this.hasMissingPatterns=IA.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null),this._cachedCompiledWhilePatterns&&(this._cachedCompiledWhilePatterns.dispose(),this._cachedCompiledWhilePatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(AA,eA){return this._while.resolveBackReferences(AA,eA)}collectPatterns(AA,eA){eA.push(this._begin)}compile(AA,eA){return this._getCachedCompiledPatterns(AA).compile(AA)}compileAG(AA,eA,tA,gA){return this._getCachedCompiledPatterns(AA).compileAG(AA,tA,gA)}_getCachedCompiledPatterns(AA){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new RegExpSourceList;for(const eA of this.patterns)AA.getRule(eA).collectPatterns(AA,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(AA,eA){return this._getCachedCompiledWhilePatterns(AA,eA).compile(AA)}compileWhileAG(AA,eA,tA,gA){return this._getCachedCompiledWhilePatterns(AA,eA).compileAG(AA,tA,gA)}_getCachedCompiledWhilePatterns(AA,eA){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new RegExpSourceList,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,eA||"￿"),this._cachedCompiledWhilePatterns}},RuleFactory=class Nr{static createCaptureRule(eA,tA,gA,iA,oA){return eA.registerRule(nA=>new CaptureRule(tA,nA,gA,iA,oA))}static getCompiledRuleId(eA,tA,gA){return eA.id||tA.registerRule(iA=>{if(eA.id=iA,eA.match)return new MatchRule(eA.$vscodeTextmateLocation,eA.id,eA.name,eA.match,Nr._compileCaptures(eA.captures,tA,gA));if(typeof eA.begin>"u"){eA.repository&&(gA=mergeObjects({},gA,eA.repository));let oA=eA.patterns;return typeof oA>"u"&&eA.include&&(oA=[{include:eA.include}]),new IncludeOnlyRule(eA.$vscodeTextmateLocation,eA.id,eA.name,eA.contentName,Nr._compilePatterns(oA,tA,gA))}return eA.while?new BeginWhileRule(eA.$vscodeTextmateLocation,eA.id,eA.name,eA.contentName,eA.begin,Nr._compileCaptures(eA.beginCaptures||eA.captures,tA,gA),eA.while,Nr._compileCaptures(eA.whileCaptures||eA.captures,tA,gA),Nr._compilePatterns(eA.patterns,tA,gA)):new BeginEndRule(eA.$vscodeTextmateLocation,eA.id,eA.name,eA.contentName,eA.begin,Nr._compileCaptures(eA.beginCaptures||eA.captures,tA,gA),eA.end,Nr._compileCaptures(eA.endCaptures||eA.captures,tA,gA),eA.applyEndPatternLast,Nr._compilePatterns(eA.patterns,tA,gA))}),eA.id}static _compileCaptures(eA,tA,gA){let iA=[];if(eA){let oA=0;for(const nA in eA){if(nA==="$vscodeTextmateLocation")continue;const rA=parseInt(nA,10);rA>oA&&(oA=rA)}for(let nA=0;nA<=oA;nA++)iA[nA]=null;for(const nA in eA){if(nA==="$vscodeTextmateLocation")continue;const rA=parseInt(nA,10);let IA=0;eA[nA].patterns&&(IA=Nr.getCompiledRuleId(eA[nA],tA,gA)),iA[rA]=Nr.createCaptureRule(tA,eA[nA].$vscodeTextmateLocation,eA[nA].name,eA[nA].contentName,IA)}}return iA}static _compilePatterns(eA,tA,gA){let iA=[];if(eA)for(let oA=0,nA=eA.length;oA<nA;oA++){const rA=eA[oA];let IA=-1;if(rA.include){const aA=parseInclude(rA.include);switch(aA.kind){case 0:case 1:IA=Nr.getCompiledRuleId(gA[rA.include],tA,gA);break;case 2:let lA=gA[aA.ruleName];lA&&(IA=Nr.getCompiledRuleId(lA,tA,gA));break;case 3:case 4:const cA=aA.scopeName,dA=aA.kind===4?aA.ruleName:null,hA=tA.getExternalGrammar(cA,gA);if(hA)if(dA){let pA=hA.repository[dA];pA&&(IA=Nr.getCompiledRuleId(pA,tA,hA.repository))}else IA=Nr.getCompiledRuleId(hA.repository.$self,tA,hA.repository);break}}else IA=Nr.getCompiledRuleId(rA,tA,gA);if(IA!==-1){const aA=tA.getRule(IA);let lA=!1;if((aA instanceof IncludeOnlyRule||aA instanceof BeginEndRule||aA instanceof BeginWhileRule)&&aA.hasMissingPatterns&&aA.patterns.length===0&&(lA=!0),lA)continue;iA.push(IA)}}return{patterns:iA,hasMissingPatterns:(eA?eA.length:0)!==iA.length}}},RegExpSource=class Xu{constructor(eA,tA){if(eA){const gA=eA.length;let iA=0,oA=[],nA=!1;for(let rA=0;rA<gA;rA++)if(eA.charAt(rA)==="\\"&&rA+1<gA){const aA=eA.charAt(rA+1);aA==="z"?(oA.push(eA.substring(iA,rA)),oA.push("$(?!\\n)(?<!\\n)"),iA=rA+2):(aA==="A"||aA==="G")&&(nA=!0),rA++}this.hasAnchor=nA,iA===0?this.source=eA:(oA.push(eA.substring(iA,gA)),this.source=oA.join(""))}else this.hasAnchor=!1,this.source=eA;this.hasAnchor?this._anchorCache=this._buildAnchorCache():this._anchorCache=null,this.ruleId=tA,this.hasBackReferences=HAS_BACK_REFERENCES.test(this.source)}clone(){return new Xu(this.source,this.ruleId)}setSource(eA){this.source!==eA&&(this.source=eA,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(eA,tA){let gA=tA.map(iA=>eA.substring(iA.start,iA.end));return BACK_REFERENCING_END.lastIndex=0,this.source.replace(BACK_REFERENCING_END,(iA,oA)=>escapeRegExpCharacters(gA[parseInt(oA,10)]||""))}_buildAnchorCache(){let eA=[],tA=[],gA=[],iA=[],oA,nA,rA,IA;for(oA=0,nA=this.source.length;oA<nA;oA++)rA=this.source.charAt(oA),eA[oA]=rA,tA[oA]=rA,gA[oA]=rA,iA[oA]=rA,rA==="\\"&&oA+1<nA&&(IA=this.source.charAt(oA+1),IA==="A"?(eA[oA+1]="￿",tA[oA+1]="￿",gA[oA+1]="A",iA[oA+1]="A"):IA==="G"?(eA[oA+1]="￿",tA[oA+1]="G",gA[oA+1]="￿",iA[oA+1]="G"):(eA[oA+1]=IA,tA[oA+1]=IA,gA[oA+1]=IA,iA[oA+1]=IA),oA++);return{A0_G0:eA.join(""),A0_G1:tA.join(""),A1_G0:gA.join(""),A1_G1:iA.join("")}}resolveAnchors(eA,tA){return!this.hasAnchor||!this._anchorCache?this.source:eA?tA?this._anchorCache.A1_G1:this._anchorCache.A1_G0:tA?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},RegExpSourceList=class{constructor(){this._items=[],this._hasAnchors=!1,this._cached=null,this._anchorCache={A0_G0:null,A0_G1:null,A1_G0:null,A1_G1:null}}dispose(){this._disposeCaches()}_disposeCaches(){this._cached&&(this._cached.dispose(),this._cached=null),this._anchorCache.A0_G0&&(this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null),this._anchorCache.A0_G1&&(this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null),this._anchorCache.A1_G0&&(this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null),this._anchorCache.A1_G1&&(this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null)}push(AA){this._items.push(AA),this._hasAnchors=this._hasAnchors||AA.hasAnchor}unshift(AA){this._items.unshift(AA),this._hasAnchors=this._hasAnchors||AA.hasAnchor}length(){return this._items.length}setSource(AA,eA){this._items[AA].source!==eA&&(this._disposeCaches(),this._items[AA].setSource(eA))}compile(AA){if(!this._cached){let eA=this._items.map(tA=>tA.source);this._cached=new CompiledRule(AA,eA,this._items.map(tA=>tA.ruleId))}return this._cached}compileAG(AA,eA,tA){return this._hasAnchors?eA?tA?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(AA,eA,tA)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(AA,eA,tA)),this._anchorCache.A1_G0):tA?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(AA,eA,tA)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(AA,eA,tA)),this._anchorCache.A0_G0):this.compile(AA)}_resolveAnchors(AA,eA,tA){let gA=this._items.map(iA=>iA.resolveAnchors(eA,tA));return new CompiledRule(AA,gA,this._items.map(iA=>iA.ruleId))}},CompiledRule=class{constructor(AA,eA,tA){this.regExps=eA,this.rules=tA,this.scanner=AA.createOnigScanner(eA)}dispose(){typeof this.scanner.dispose=="function"&&this.scanner.dispose()}toString(){const AA=[];for(let eA=0,tA=this.rules.length;eA<tA;eA++)AA.push(" - "+this.rules[eA]+": "+this.regExps[eA]);return AA.join(`
453
+ `);throw new Error(aA)}return nodeToComponentDef(oA,iA,eA,tA)}function addPositions(AA,eA){if(eA.length===0){for(let tA of AA)tA.line=1,tA.col=tA.pos+1;return AA}for(let tA of AA){let gA=0;for(;gA<eA.length;++gA){const oA=eA[gA];if(tA.pos<oA){tA.line=gA+1,tA.col=tA.pos-(eA[gA-1]??0)+1;break}}const iA=eA[eA.length-1];tA.pos>=iA&&(tA.line=eA.length+1,tA.col=tA.pos-iA+0)}return AA}const componentFileExtension="xmlui",codeBehindFileExtension="xmlui.xs";function checkXmlUiMarkup(AA,eA,tA,gA){const iA=[],oA={},nA=new Set,rA=new Set;if(AA&&visitComponent(AA,null,IA,oA,tA),!oA.abort)for(const dA of eA)aA(dA.name)||lA("M007","Component",dA.name),dA.name==="Component"&&lA("M008","Component",dA.name),tA.componentRegistered(dA.name)&&lA("M009","Component",dA.name),rA.has(dA.name)?lA("M010","Component",dA.name):rA.add(dA.name),nA.clear(),visitComponent(dA.component,null,IA,oA,tA);return iA;function IA(dA,hA,pA,bA){if(!pA)return;if(!tA.componentRegistered(dA.type)){lA("M001",(hA==null?void 0:hA.type)??"Root",dA.type);return}dA.uid&&(aA(dA.uid)?nA.has(dA.uid)?lA("M003",dA.type,dA.uid):nA.add(dA.uid):lA("M002",dA.type,dA.type,dA.uid));const fA=tA.getComponentProps(dA.type)??{},ZA=dA.props??{};for(const NA of Object.keys(ZA))if(fA[NA]){const vA=ZA[NA];if(typeof vA=="string")try{parseParameterString(vA)}catch(VA){lA("M006",dA.type,NA,VA.message)}}else{const vA=NA.split("-");vA.length===1&&layoutOptionKeys.includes(NA)||vA.length===2&&layoutOptionKeys.includes(vA[0])&&viewportSizeNames.includes(vA[1])||tA.acceptArbitraryProps(dA.type)||lA("M005",dA.type,dA.type,NA)}const GA=tA.getComponentEvents(dA.type)??{},RA=dA.events??{};for(const NA of Object.keys(RA))if(GA[NA]){const vA=RA[NA];if(typeof vA=="string"){const VA=new Parser$1(vA);try{VA.parseStatements(),VA.errors.length>0&&lA("M012",dA.type,NA,VA.errors[0].text)}catch(QA){lA("M012",dA.type,NA,QA.message)}}}else lA("M011",dA.type,dA.type,NA);const MA=tA.getComponentValidator(dA.type);if(MA){const NA=MA(dA,gA);if(NA)if(Array.isArray(NA))for(const EA of NA)lA("M013",dA.type,EA);else lA("M013",dA.type,NA)}}function aA(dA){return/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(dA)}function lA(dA,hA,...pA){cA(dA,hA,!1,...pA)}function cA(dA,hA,pA,...bA){let fA=errorMessages[dA]??"Unkonwn error";bA&&bA.forEach((GA,RA)=>fA=ZA(fA,`{${RA}}`,bA[RA].toString())),iA.push({name:hA,code:dA,message:fA,isWarning:pA,args:bA});function ZA(GA,RA,MA){do GA=GA.replace(RA,MA);while(GA.includes(RA));return GA}}}function visitComponent(AA,eA,tA,gA={},iA){if(tA(AA,eA,!0,gA),gA.abort||gA.cancel)return;const oA=iA.getComponentProps(AA.type)??{},nA=AA.props??{};for(const aA of Object.keys(nA)){const lA=oA[aA];if(!lA)continue;const cA=nA[aA];if(lA.type==="ComponentDef"&&cA.type&&(visitComponent(cA,AA,tA,gA,iA),gA.abort||gA.cancel))return}const rA=iA.getComponentEvents(AA.type)??{},IA=AA.events??{};for(const aA of Object.keys(IA)){if(!rA[aA])continue;const cA=IA[aA];if(typeof cA=="object"&&cA.type){if(visitComponent(cA,AA,tA,gA,iA),gA.abort)return;if(gA.cancel)break}}if(AA.children)for(const aA of AA.children){if(visitComponent(aA,AA,tA,gA,iA),gA.abort)return;if(gA.cancel)break}tA(AA,void 0,!1,gA)}const errorMessages={M001:"The component '{0}' is not registered",M002:"The '{0}' element has an invalid id: '{1}'",M003:"Invalid component identifier: '{0}'",M004:"Duplicated component identifier: '{0}'",M005:"The '{0}' element has an invalid property: '{1}'",M006:"Parsing property value of '{0}' failed: {1}",M007:"The name of a reusable component is invalid: '{0}'",M008:"The name of a reusable component must not be '{0}', as it is a reserved name",M009:"A reusable component cannot have the name of a registered component: '{0}'",M010:"Duplicated reusable component name: '{0}'",M011:"The '{0}' element has an invalid event: '{1}'",M012:"Parsing event value of '{0}' failed: {1}",M013:"Component validation failed: '{0}'"};var define_process_env_default$2={NODE_ENV:"production",VITE_MOCK_ENABLED:!0};function StandaloneApp({appDef:AA,decorateComponentsWithTestId:eA,debugEnabled:tA=!0,runtime:gA,components:iA}){const oA=reactExports.useMemo(()=>typeof window<"u"&&window.location.href.startsWith("file"),[]),nA=useStandalone(AA,gA);if(usePrintVersionNumber(nA),!nA)return null;const{apiInterceptor:rA,name:IA,globals:aA,defaultTheme:lA,defaultTone:cA,resources:dA,resourceMap:hA,entryPoint:pA,components:bA,themes:fA,sources:ZA}=nA,GA=rA||(typeof window<"u"?window.XMLUI_MOCK_API:void 0);return jsxRuntimeExports.jsx(ApiInterceptorProvider,{interceptor:GA,children:jsxRuntimeExports.jsx(AppRoot,{servedFromSingleFile:oA,decorateComponentsWithTestId:eA,node:pA,standalone:!0,debugEnabled:tA,baseName:typeof window<"u"&&window.__PUBLIC_PATH||"",globalProps:{name:IA,...aA||{}},defaultTheme:lA,defaultTone:cA,resources:dA,resourceMap:hA,sources:ZA,contributes:{compoundComponents:bA,components:iA,themes:fA}})})}async function parseComponentResp(AA){if(AA.url.toLowerCase().endsWith(".xmlui")){const eA=await AA.text(),tA=AA.url;return{component:parseXmlUiMarkup(eA,tA),src:eA,file:tA}}if(AA.url.toLowerCase().endsWith(".xmlui.xs")){const eA=await AA.text();new Parser$1(eA).parseStatements();const gA=collectCodeBehindFromSource("Main",eA,()=>"");return removeCodeBehindTokensFromTree(gA),{codeBehind:gA,file:AA.url}}return{component:await AA.json()}}function matchesFileName(AA,eA){return AA.endsWith(`/${eA}.ts`)||AA.endsWith(`/${eA}.js`)||AA.endsWith(`/${eA}.${componentFileExtension}`)||AA.endsWith(`/${eA}.${codeBehindFileExtension}`)}function matchesFolder(AA,eA){return AA.includes(`/${eA}/`)}function resolveRuntime(AA){let eA,tA,gA,iA=[],oA;const nA={},rA={},IA={};for(const[dA,hA]of Object.entries(AA))matchesFileName(dA,"config")&&(eA=hA.default),(matchesFileName(dA,"Main")||matchesFileName(dA,"App"))&&(dA.endsWith(codeBehindFileExtension)?gA=hA.default:(tA=hA.default.component,hA.default.file&&(nA[hA.default.file]=hA.default.src))),matchesFileName(dA,"api")&&(oA=hA.default),matchesFolder(dA,"components")&&(dA.endsWith(codeBehindFileExtension)?IA[dA]=hA.default:(rA[dA]=hA.default.component,nA[hA.default.file]=hA.default.src)),matchesFolder(dA,"themes")&&iA.push(hA.default);const aA=(eA==null?void 0:eA.entryPoint)||tA,lA={...aA,vars:{...gA==null?void 0:gA.vars,...aA==null?void 0:aA.vars},functions:gA==null?void 0:gA.functions,scriptError:gA==null?void 0:gA.moduleErrors};let cA=[];return eA!=null&&eA.components?cA=eA.components:Object.entries(rA).forEach(([dA,hA])=>{const pA=IA[`${dA}.xs`],bA={...hA,component:{...hA.component,vars:{...hA.component.vars,...pA==null?void 0:pA.vars},functions:pA==null?void 0:pA.functions,scriptError:pA==null?void 0:pA.moduleErrors}};cA.push(bA)}),{...eA,entryPoint:lA,components:cA,themes:(eA==null?void 0:eA.themes)||iA,apiInterceptor:(eA==null?void 0:eA.apiInterceptor)||oA,sources:nA}}function mergeGivenAppDefWithRuntime(AA,eA){return eA?{...eA,entryPoint:eA.entryPoint||AA.entryPoint,components:eA.components||AA.components,themes:eA.themes||AA.themes,apiInterceptor:eA.apiInterceptor||AA.apiInterceptor}:AA}function getStandalone(AA,eA=EMPTY_OBJECT){if(typeof document<"u"&&document.querySelector('script[type="text/xmlui"]')!==null){let oA=null;const nA=document.querySelectorAll('script[type="text/xmlui"]'),rA=[];for(let hA=0;hA<nA.length;hA++){const pA=nA[hA],bA=parseXmlUiMarkup(pA.textContent);bA&&("type"in bA&&bA.type==="App"?oA=bA:rA.push(bA))}if(oA===null)throw new Error("No App component specified");const IA=document.querySelector('script[type="text/xmlui-config"]'),aA=IA===null?{}:JSON.parse(IA.textContent),lA=[];return document.querySelectorAll('script[type="text/xmlui-theme"]').forEach(hA=>{lA.push(JSON.parse(hA.textContent))}),{...aA,entryPoint:oA,components:rA,themes:lA}}const gA=resolveRuntime(eA),iA=mergeGivenAppDefWithRuntime(gA,AA);if((define_process_env_default$2.VITE_DEV_MODE||define_process_env_default$2.VITE_BUILD_MODE==="INLINE_ALL")&&!define_process_env_default$2.VITE_STANDALONE){if(!iA)throw new Error("couldn't find the application metadata");return iA}return null}function useStandalone(AA,eA=EMPTY_OBJECT){const[tA,gA]=reactExports.useState(getStandalone(AA,eA));return useIsomorphicLayoutEffect$6(()=>{(async function(){var EA,vA,VA;if(document.querySelector('script[type="text/xmlui"]')!==null){let QA=null;const KA=document.querySelectorAll('script[type="text/xmlui"]'),XA=[];for(let eg=0;eg<KA.length;eg++){const Ag=KA[eg],gg=parseXmlUiMarkup(Ag.textContent);gg&&("type"in gg&&gg.type==="App"?QA=gg:XA.push(gg))}if(QA===null)throw new Error("No App component specified");const $A=document.querySelector('script[type="text/xmlui-config"]'),JA=$A===null?{}:JSON.parse($A.textContent),PA=[];document.querySelectorAll('script[type="text/xmlui-theme"]').forEach(eg=>{PA.push(JSON.parse(eg.textContent))});const ig={...JA,entryPoint:QA,components:XA,themes:PA};gA(ig);return}const oA=resolveRuntime(eA),nA=mergeGivenAppDefWithRuntime(oA,AA);if((define_process_env_default$2.VITE_DEV_MODE||define_process_env_default$2.VITE_BUILD_MODE==="INLINE_ALL")&&!define_process_env_default$2.VITE_STANDALONE){if(!nA)throw new Error("couldn't find the application metadata");gA(nA);return}if(define_process_env_default$2.VITE_BUILD_MODE==="CONFIG_ONLY"){const KA=await(await fetch(normalizePath$1("config.json"),{headers:{"Cache-Control":"no-cache, no-store"}})).json(),XA=[];(EA=KA.themes)==null||EA.forEach(JA=>{XA.push(fetch(normalizePath$1(JA),{headers:{"Cache-Control":"no-cache, no-store"}}).then(PA=>PA.json()))});const $A=await Promise.all(XA);gA({...nA,name:KA.name,globals:KA.globals,defaultTheme:KA.defaultTheme,resources:KA.resources,resourceMap:KA.resourceMap,themes:$A});return}const rA=fetch(normalizePath$1("Main.xmlui"),{headers:{"Cache-Control":"no-cache, no-store"}}).then(QA=>parseComponentResp(QA)),IA=new Promise(async(QA,KA)=>{try{const XA=await fetch(normalizePath$1("Main.xmlui.xs"),{headers:{"Cache-Control":"no-cache, no-store"}}),$A=await parseComponentResp(XA);QA($A.codeBehind)}catch{QA(null)}});let aA;try{aA=await(await fetch(normalizePath$1("config.json"),{headers:{"Cache-Control":"no-cache, no-store"}})).json()}catch{}const lA=(vA=aA==null?void 0:aA.themes)==null?void 0:vA.map(QA=>fetch(normalizePath$1(QA),{headers:{"Cache-Control":"no-cache, no-store"}}).then(KA=>KA.json())),cA=(VA=aA==null?void 0:aA.components)==null?void 0:VA.map(QA=>fetch(normalizePath$1(QA),{headers:{"Cache-Control":"no-cache, no-store"}}).then(KA=>parseComponentResp(KA))),[dA,hA,pA,bA]=await Promise.all([rA,IA,Promise.all(cA||[]),Promise.all(lA||[])]),fA={},ZA={};dA.file&&(fA[dA.file]=dA.src),pA.forEach(QA=>{var KA;(KA=QA==null?void 0:QA.file)!=null&&KA.endsWith(".xmlui.xs")?ZA[QA.file]=QA.codeBehind:QA.file&&(fA[QA.file]=QA.src)});const GA={...dA.component,vars:{...hA==null?void 0:hA.vars,...dA.component.vars},functions:hA==null?void 0:hA.functions,scriptError:hA==null?void 0:hA.moduleErrors},RA=pA.filter(QA=>{var KA;return!((KA=QA==null?void 0:QA.file)!=null&&KA.endsWith(".xmlui.xs"))}).map(QA=>{const KA=ZA[QA.file+".xs"];return{...QA.component,component:{...QA.component.component,vars:{...QA.component.component.vars,...KA==null?void 0:KA.vars},functions:KA==null?void 0:KA.functions,scriptError:KA==null?void 0:KA.moduleErrors}}});let MA=collectMissingComponents(GA,RA);const NA=new Set;for(;MA.size>0;){const QA=[...MA].map(async XA=>{try{const $A=fetch(normalizePath$1("/components/"+XA+".xmlui"),{headers:{"Cache-Control":"no-cache, no-store"}}),JA=new Promise(async(eg,Ag)=>{try{const HA=(await parseComponentResp(await fetch(normalizePath$1("/components/"+XA+".xmlui.xs"),{headers:{"Cache-Control":"no-cache, no-store"}}))).codeBehind;eg(HA)}catch{eg(null)}}),[PA,tg]=await Promise.all([$A,JA]),ig=await parseComponentResp(PA);return fA[ig.file]=ig.src,{...ig.component,component:{...ig.component.component,vars:{...ig.component.component.vars,...tg==null?void 0:tg.vars},functions:tg==null?void 0:tg.functions,scriptError:tg==null?void 0:tg.moduleErrors}}}catch{return NA.add(XA),null}}),KA=await Promise.all(QA);RA.push(...KA.filter(XA=>!!XA)),MA=collectMissingComponents(GA,RA,NA)}gA({...aA,themes:bA,sources:fA,components:RA,entryPoint:GA})})()},[eA,AA]),tA}function collectMissingComponents(AA,eA,tA=new Set){const gA=new ComponentRegistry({compoundComponents:eA}),iA=checkXmlUiMarkup(AA,eA,{getComponentProps:oA=>{var nA,rA;return(rA=(nA=gA.lookupComponentRenderer(oA))==null?void 0:nA.descriptor)==null?void 0:rA.props},acceptArbitraryProps:oA=>!0,getComponentValidator:oA=>null,getComponentEvents:oA=>null,componentRegistered:oA=>gA.hasComponent(oA)});return new Set(iA.filter(oA=>oA.code==="M001").map(oA=>oA.args[0]).filter(oA=>!tA.has(oA)))}function usePrintVersionNumber(AA){const eA=reactExports.useRef(!1);reactExports.useEffect(()=>{AA!=null&&AA.name&&!eA.current&&(console.log(`${AA.name} version: `,define_process_env_default$2.VITE_APP_VERSION||"dev"),eA.current=!0)},[AA==null?void 0:AA.name])}let contentRoot=null;function startApp(AA,eA){let tA=document.getElementById("root");return tA||(tA=document.createElement("div"),tA.setAttribute("id","root"),document.body.appendChild(tA)),contentRoot||(contentRoot=client.createRoot(tA)),contentRoot.render(jsxRuntimeExports.jsx(StandaloneApp,{runtime:AA,components:eA})),contentRoot}document.addEventListener("DOMContentLoaded",function(){if(!document.getElementById("root")){const AA=document.createElement("div");AA.id="root",document.getElementsByTagName("body")[0].appendChild(AA)}startApp()});let ShikiError$2=class extends Error{constructor(eA){super(eA),this.name="ShikiError"}};function clone(AA){return doClone(AA)}function doClone(AA){return Array.isArray(AA)?cloneArray(AA):typeof AA=="object"?cloneObj(AA):AA}function cloneArray(AA){let eA=[];for(let tA=0,gA=AA.length;tA<gA;tA++)eA[tA]=doClone(AA[tA]);return eA}function cloneObj(AA){let eA={};for(let tA in AA)eA[tA]=doClone(AA[tA]);return eA}function mergeObjects(AA,...eA){return eA.forEach(tA=>{for(let gA in tA)AA[gA]=tA[gA]}),AA}function basename(AA){const eA=~AA.lastIndexOf("/")||~AA.lastIndexOf("\\");return eA===0?AA:~eA===AA.length-1?basename(AA.substring(0,AA.length-1)):AA.substr(~eA+1)}var CAPTURING_REGEX_SOURCE=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,RegexSource=class{static hasCaptures(AA){return AA===null?!1:(CAPTURING_REGEX_SOURCE.lastIndex=0,CAPTURING_REGEX_SOURCE.test(AA))}static replaceCaptures(AA,eA,tA){return AA.replace(CAPTURING_REGEX_SOURCE,(gA,iA,oA,nA)=>{let rA=tA[parseInt(iA||oA,10)];if(rA){let IA=eA.substring(rA.start,rA.end);for(;IA[0]===".";)IA=IA.substring(1);switch(nA){case"downcase":return IA.toLowerCase();case"upcase":return IA.toUpperCase();default:return IA}}else return gA})}};function strcmp(AA,eA){return AA<eA?-1:AA>eA?1:0}function strArrCmp(AA,eA){if(AA===null&&eA===null)return 0;if(!AA)return-1;if(!eA)return 1;let tA=AA.length,gA=eA.length;if(tA===gA){for(let iA=0;iA<tA;iA++){let oA=strcmp(AA[iA],eA[iA]);if(oA!==0)return oA}return 0}return tA-gA}function isValidHexColor(AA){return!!(/^#[0-9a-f]{6}$/i.test(AA)||/^#[0-9a-f]{8}$/i.test(AA)||/^#[0-9a-f]{3}$/i.test(AA)||/^#[0-9a-f]{4}$/i.test(AA))}function escapeRegExpCharacters(AA){return AA.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var CachedFn=class{constructor(AA){this.fn=AA,this.cache=new Map}get(AA){if(this.cache.has(AA))return this.cache.get(AA);const eA=this.fn(AA);return this.cache.set(AA,eA),eA}},Theme=class{constructor(AA,eA,tA){this._colorMap=AA,this._defaults=eA,this._root=tA,this._cachedMatchRoot=new CachedFn(gA=>this._root.match(gA))}static createFromRawTheme(AA,eA){return this.createFromParsedTheme(parseTheme(AA),eA)}static createFromParsedTheme(AA,eA){return resolveParsedThemeRules(AA,eA)}getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(AA){if(AA===null)return this._defaults;const eA=AA.scopeName,gA=this._cachedMatchRoot.get(eA).find(iA=>_scopePathMatchesParentScopes(AA.parent,iA.parentScopes));return gA?new StyleAttributes(gA.fontStyle,gA.foreground,gA.background):null}},ScopeStack=class Ml{constructor(eA,tA){this.parent=eA,this.scopeName=tA}static push(eA,tA){for(const gA of tA)eA=new Ml(eA,gA);return eA}static from(...eA){let tA=null;for(let gA=0;gA<eA.length;gA++)tA=new Ml(tA,eA[gA]);return tA}push(eA){return new Ml(this,eA)}getSegments(){let eA=this;const tA=[];for(;eA;)tA.push(eA.scopeName),eA=eA.parent;return tA.reverse(),tA}toString(){return this.getSegments().join(" ")}extends(eA){return this===eA?!0:this.parent===null?!1:this.parent.extends(eA)}getExtensionIfDefined(eA){const tA=[];let gA=this;for(;gA&&gA!==eA;)tA.push(gA.scopeName),gA=gA.parent;return gA===eA?tA.reverse():void 0}};function _scopePathMatchesParentScopes(AA,eA){if(eA.length===0)return!0;for(let tA=0;tA<eA.length;tA++){let gA=eA[tA],iA=!1;if(gA===">"){if(tA===eA.length-1)return!1;gA=eA[++tA],iA=!0}for(;AA&&!_matchesScope(AA.scopeName,gA);){if(iA)return!1;AA=AA.parent}if(!AA)return!1;AA=AA.parent}return!0}function _matchesScope(AA,eA){return eA===AA||AA.startsWith(eA)&&AA[eA.length]==="."}var StyleAttributes=class{constructor(AA,eA,tA){this.fontStyle=AA,this.foregroundId=eA,this.backgroundId=tA}};function parseTheme(AA){if(!AA)return[];if(!AA.settings||!Array.isArray(AA.settings))return[];let eA=AA.settings,tA=[],gA=0;for(let iA=0,oA=eA.length;iA<oA;iA++){let nA=eA[iA];if(!nA.settings)continue;let rA;if(typeof nA.scope=="string"){let cA=nA.scope;cA=cA.replace(/^[,]+/,""),cA=cA.replace(/[,]+$/,""),rA=cA.split(",")}else Array.isArray(nA.scope)?rA=nA.scope:rA=[""];let IA=-1;if(typeof nA.settings.fontStyle=="string"){IA=0;let cA=nA.settings.fontStyle.split(" ");for(let dA=0,hA=cA.length;dA<hA;dA++)switch(cA[dA]){case"italic":IA=IA|1;break;case"bold":IA=IA|2;break;case"underline":IA=IA|4;break;case"strikethrough":IA=IA|8;break}}let aA=null;typeof nA.settings.foreground=="string"&&isValidHexColor(nA.settings.foreground)&&(aA=nA.settings.foreground);let lA=null;typeof nA.settings.background=="string"&&isValidHexColor(nA.settings.background)&&(lA=nA.settings.background);for(let cA=0,dA=rA.length;cA<dA;cA++){let pA=rA[cA].trim().split(" "),bA=pA[pA.length-1],fA=null;pA.length>1&&(fA=pA.slice(0,pA.length-1),fA.reverse()),tA[gA++]=new ParsedThemeRule(bA,fA,iA,IA,aA,lA)}}return tA}var ParsedThemeRule=class{constructor(AA,eA,tA,gA,iA,oA){this.scope=AA,this.parentScopes=eA,this.index=tA,this.fontStyle=gA,this.foreground=iA,this.background=oA}},FontStyle=(AA=>(AA[AA.NotSet=-1]="NotSet",AA[AA.None=0]="None",AA[AA.Italic=1]="Italic",AA[AA.Bold=2]="Bold",AA[AA.Underline=4]="Underline",AA[AA.Strikethrough=8]="Strikethrough",AA))(FontStyle||{});function resolveParsedThemeRules(AA,eA){AA.sort((IA,aA)=>{let lA=strcmp(IA.scope,aA.scope);return lA!==0||(lA=strArrCmp(IA.parentScopes,aA.parentScopes),lA!==0)?lA:IA.index-aA.index});let tA=0,gA="#000000",iA="#ffffff";for(;AA.length>=1&&AA[0].scope==="";){let IA=AA.shift();IA.fontStyle!==-1&&(tA=IA.fontStyle),IA.foreground!==null&&(gA=IA.foreground),IA.background!==null&&(iA=IA.background)}let oA=new ColorMap(eA),nA=new StyleAttributes(tA,oA.getId(gA),oA.getId(iA)),rA=new ThemeTrieElement(new ThemeTrieElementRule(0,null,-1,0,0),[]);for(let IA=0,aA=AA.length;IA<aA;IA++){let lA=AA[IA];rA.insert(0,lA.scope,lA.parentScopes,lA.fontStyle,oA.getId(lA.foreground),oA.getId(lA.background))}return new Theme(oA,nA,rA)}var ColorMap=class{constructor(AA){if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(AA)){this._isFrozen=!0;for(let eA=0,tA=AA.length;eA<tA;eA++)this._color2id[AA[eA]]=eA,this._id2color[eA]=AA[eA]}else this._isFrozen=!1}getId(AA){if(AA===null)return 0;AA=AA.toUpperCase();let eA=this._color2id[AA];if(eA)return eA;if(this._isFrozen)throw new Error(`Missing color in color map - ${AA}`);return eA=++this._lastColorId,this._color2id[AA]=eA,this._id2color[eA]=AA,eA}getColorMap(){return this._id2color.slice(0)}},emptyParentScopes=Object.freeze([]),ThemeTrieElementRule=class Ku{constructor(eA,tA,gA,iA,oA){this.scopeDepth=eA,this.parentScopes=tA||emptyParentScopes,this.fontStyle=gA,this.foreground=iA,this.background=oA}clone(){return new Ku(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(eA){let tA=[];for(let gA=0,iA=eA.length;gA<iA;gA++)tA[gA]=eA[gA].clone();return tA}acceptOverwrite(eA,tA,gA,iA){this.scopeDepth>eA?console.log("how did this happen?"):this.scopeDepth=eA,tA!==-1&&(this.fontStyle=tA),gA!==0&&(this.foreground=gA),iA!==0&&(this.background=iA)}},ThemeTrieElement=class Pc{constructor(eA,tA=[],gA={}){this._mainRule=eA,this._children=gA,this._rulesWithParentScopes=tA}static _cmpBySpecificity(eA,tA){if(eA.scopeDepth!==tA.scopeDepth)return tA.scopeDepth-eA.scopeDepth;let gA=0,iA=0;for(;eA.parentScopes[gA]===">"&&gA++,tA.parentScopes[iA]===">"&&iA++,!(gA>=eA.parentScopes.length||iA>=tA.parentScopes.length);){const oA=tA.parentScopes[iA].length-eA.parentScopes[gA].length;if(oA!==0)return oA;gA++,iA++}return tA.parentScopes.length-eA.parentScopes.length}match(eA){if(eA!==""){let gA=eA.indexOf("."),iA,oA;if(gA===-1?(iA=eA,oA=""):(iA=eA.substring(0,gA),oA=eA.substring(gA+1)),this._children.hasOwnProperty(iA))return this._children[iA].match(oA)}const tA=this._rulesWithParentScopes.concat(this._mainRule);return tA.sort(Pc._cmpBySpecificity),tA}insert(eA,tA,gA,iA,oA,nA){if(tA===""){this._doInsertHere(eA,gA,iA,oA,nA);return}let rA=tA.indexOf("."),IA,aA;rA===-1?(IA=tA,aA=""):(IA=tA.substring(0,rA),aA=tA.substring(rA+1));let lA;this._children.hasOwnProperty(IA)?lA=this._children[IA]:(lA=new Pc(this._mainRule.clone(),ThemeTrieElementRule.cloneArr(this._rulesWithParentScopes)),this._children[IA]=lA),lA.insert(eA+1,aA,gA,iA,oA,nA)}_doInsertHere(eA,tA,gA,iA,oA){if(tA===null){this._mainRule.acceptOverwrite(eA,gA,iA,oA);return}for(let nA=0,rA=this._rulesWithParentScopes.length;nA<rA;nA++){let IA=this._rulesWithParentScopes[nA];if(strArrCmp(IA.parentScopes,tA)===0){IA.acceptOverwrite(eA,gA,iA,oA);return}}gA===-1&&(gA=this._mainRule.fontStyle),iA===0&&(iA=this._mainRule.foreground),oA===0&&(oA=this._mainRule.background),this._rulesWithParentScopes.push(new ThemeTrieElementRule(eA,tA,gA,iA,oA))}},EncodedTokenMetadata=class mI{static toBinaryStr(eA){return eA.toString(2).padStart(32,"0")}static print(eA){const tA=mI.getLanguageId(eA),gA=mI.getTokenType(eA),iA=mI.getFontStyle(eA),oA=mI.getForeground(eA),nA=mI.getBackground(eA);console.log({languageId:tA,tokenType:gA,fontStyle:iA,foreground:oA,background:nA})}static getLanguageId(eA){return(eA&255)>>>0}static getTokenType(eA){return(eA&768)>>>8}static containsBalancedBrackets(eA){return(eA&1024)!==0}static getFontStyle(eA){return(eA&30720)>>>11}static getForeground(eA){return(eA&16744448)>>>15}static getBackground(eA){return(eA&4278190080)>>>24}static set(eA,tA,gA,iA,oA,nA,rA){let IA=mI.getLanguageId(eA),aA=mI.getTokenType(eA),lA=mI.containsBalancedBrackets(eA)?1:0,cA=mI.getFontStyle(eA),dA=mI.getForeground(eA),hA=mI.getBackground(eA);return tA!==0&&(IA=tA),gA!==8&&(aA=gA),iA!==null&&(lA=iA?1:0),oA!==-1&&(cA=oA),nA!==0&&(dA=nA),rA!==0&&(hA=rA),(IA<<0|aA<<8|lA<<10|cA<<11|dA<<15|hA<<24)>>>0}};function toOptionalTokenType(AA){return AA}function fromOptionalTokenType(AA){return AA}function createMatchers(AA,eA){const tA=[],gA=newTokenizer(AA);let iA=gA.next();for(;iA!==null;){let IA=0;if(iA.length===2&&iA.charAt(1)===":"){switch(iA.charAt(0)){case"R":IA=1;break;case"L":IA=-1;break;default:console.log(`Unknown priority ${iA} in scope selector`)}iA=gA.next()}let aA=nA();if(tA.push({matcher:aA,priority:IA}),iA!==",")break;iA=gA.next()}return tA;function oA(){if(iA==="-"){iA=gA.next();const IA=oA();return aA=>!!IA&&!IA(aA)}if(iA==="("){iA=gA.next();const IA=rA();return iA===")"&&(iA=gA.next()),IA}if(isIdentifier(iA)){const IA=[];do IA.push(iA),iA=gA.next();while(isIdentifier(iA));return aA=>eA(IA,aA)}return null}function nA(){const IA=[];let aA=oA();for(;aA;)IA.push(aA),aA=oA();return lA=>IA.every(cA=>cA(lA))}function rA(){const IA=[];let aA=nA();for(;aA&&(IA.push(aA),iA==="|"||iA===",");){do iA=gA.next();while(iA==="|"||iA===",");aA=nA()}return lA=>IA.some(cA=>cA(lA))}}function isIdentifier(AA){return!!AA&&!!AA.match(/[\w\.:]+/)}function newTokenizer(AA){let eA=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,tA=eA.exec(AA);return{next:()=>{if(!tA)return null;const gA=tA[0];return tA=eA.exec(AA),gA}}}function disposeOnigString(AA){typeof AA.dispose=="function"&&AA.dispose()}var TopLevelRuleReference=class{constructor(AA){this.scopeName=AA}toKey(){return this.scopeName}},TopLevelRepositoryRuleReference=class{constructor(AA,eA){this.scopeName=AA,this.ruleName=eA}toKey(){return`${this.scopeName}#${this.ruleName}`}},ExternalReferenceCollector=class{constructor(){this._references=[],this._seenReferenceKeys=new Set,this.visitedRule=new Set}get references(){return this._references}add(AA){const eA=AA.toKey();this._seenReferenceKeys.has(eA)||(this._seenReferenceKeys.add(eA),this._references.push(AA))}},ScopeDependencyProcessor=class{constructor(AA,eA){this.repo=AA,this.initialScopeName=eA,this.seenFullScopeRequests=new Set,this.seenPartialScopeRequests=new Set,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new TopLevelRuleReference(this.initialScopeName)]}processQueue(){const AA=this.Q;this.Q=[];const eA=new ExternalReferenceCollector;for(const tA of AA)collectReferencesOfReference(tA,this.initialScopeName,this.repo,eA);for(const tA of eA.references)if(tA instanceof TopLevelRuleReference){if(this.seenFullScopeRequests.has(tA.scopeName))continue;this.seenFullScopeRequests.add(tA.scopeName),this.Q.push(tA)}else{if(this.seenFullScopeRequests.has(tA.scopeName)||this.seenPartialScopeRequests.has(tA.toKey()))continue;this.seenPartialScopeRequests.add(tA.toKey()),this.Q.push(tA)}}};function collectReferencesOfReference(AA,eA,tA,gA){const iA=tA.lookup(AA.scopeName);if(!iA){if(AA.scopeName===eA)throw new Error(`No grammar provided for <${eA}>`);return}const oA=tA.lookup(eA);AA instanceof TopLevelRuleReference?collectExternalReferencesInTopLevelRule({baseGrammar:oA,selfGrammar:iA},gA):collectExternalReferencesInTopLevelRepositoryRule(AA.ruleName,{baseGrammar:oA,selfGrammar:iA,repository:iA.repository},gA);const nA=tA.injections(AA.scopeName);if(nA)for(const rA of nA)gA.add(new TopLevelRuleReference(rA))}function collectExternalReferencesInTopLevelRepositoryRule(AA,eA,tA){if(eA.repository&&eA.repository[AA]){const gA=eA.repository[AA];collectExternalReferencesInRules([gA],eA,tA)}}function collectExternalReferencesInTopLevelRule(AA,eA){AA.selfGrammar.patterns&&Array.isArray(AA.selfGrammar.patterns)&&collectExternalReferencesInRules(AA.selfGrammar.patterns,{...AA,repository:AA.selfGrammar.repository},eA),AA.selfGrammar.injections&&collectExternalReferencesInRules(Object.values(AA.selfGrammar.injections),{...AA,repository:AA.selfGrammar.repository},eA)}function collectExternalReferencesInRules(AA,eA,tA){for(const gA of AA){if(tA.visitedRule.has(gA))continue;tA.visitedRule.add(gA);const iA=gA.repository?mergeObjects({},eA.repository,gA.repository):eA.repository;Array.isArray(gA.patterns)&&collectExternalReferencesInRules(gA.patterns,{...eA,repository:iA},tA);const oA=gA.include;if(!oA)continue;const nA=parseInclude(oA);switch(nA.kind){case 0:collectExternalReferencesInTopLevelRule({...eA,selfGrammar:eA.baseGrammar},tA);break;case 1:collectExternalReferencesInTopLevelRule(eA,tA);break;case 2:collectExternalReferencesInTopLevelRepositoryRule(nA.ruleName,{...eA,repository:iA},tA);break;case 3:case 4:const rA=nA.scopeName===eA.selfGrammar.scopeName?eA.selfGrammar:nA.scopeName===eA.baseGrammar.scopeName?eA.baseGrammar:void 0;if(rA){const IA={baseGrammar:eA.baseGrammar,selfGrammar:rA,repository:iA};nA.kind===4?collectExternalReferencesInTopLevelRepositoryRule(nA.ruleName,IA,tA):collectExternalReferencesInTopLevelRule(IA,tA)}else nA.kind===4?tA.add(new TopLevelRepositoryRuleReference(nA.scopeName,nA.ruleName)):tA.add(new TopLevelRuleReference(nA.scopeName));break}}}var BaseReference=class{constructor(){this.kind=0}},SelfReference=class{constructor(){this.kind=1}},RelativeReference=class{constructor(AA){this.ruleName=AA,this.kind=2}},TopLevelReference=class{constructor(AA){this.scopeName=AA,this.kind=3}},TopLevelRepositoryReference=class{constructor(AA,eA){this.scopeName=AA,this.ruleName=eA,this.kind=4}};function parseInclude(AA){if(AA==="$base")return new BaseReference;if(AA==="$self")return new SelfReference;const eA=AA.indexOf("#");if(eA===-1)return new TopLevelReference(AA);if(eA===0)return new RelativeReference(AA.substring(1));{const tA=AA.substring(0,eA),gA=AA.substring(eA+1);return new TopLevelRepositoryReference(tA,gA)}}var HAS_BACK_REFERENCES=/\\(\d+)/,BACK_REFERENCING_END=/\\(\d+)/g,endRuleId=-1,whileRuleId=-2;function ruleIdFromNumber(AA){return AA}function ruleIdToNumber(AA){return AA}var Rule=class{constructor(AA,eA,tA,gA){this.$location=AA,this.id=eA,this._name=tA||null,this._nameIsCapturing=RegexSource.hasCaptures(this._name),this._contentName=gA||null,this._contentNameIsCapturing=RegexSource.hasCaptures(this._contentName)}get debugName(){const AA=this.$location?`${basename(this.$location.filename)}:${this.$location.line}`:"unknown";return`${this.constructor.name}#${this.id} @ ${AA}`}getName(AA,eA){return!this._nameIsCapturing||this._name===null||AA===null||eA===null?this._name:RegexSource.replaceCaptures(this._name,AA,eA)}getContentName(AA,eA){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:RegexSource.replaceCaptures(this._contentName,AA,eA)}},CaptureRule=class extends Rule{constructor(AA,eA,tA,gA,iA){super(AA,eA,tA,gA),this.retokenizeCapturedWithRuleId=iA}dispose(){}collectPatterns(AA,eA){throw new Error("Not supported!")}compile(AA,eA){throw new Error("Not supported!")}compileAG(AA,eA,tA,gA){throw new Error("Not supported!")}},MatchRule=class extends Rule{constructor(AA,eA,tA,gA,iA){super(AA,eA,tA,null),this._match=new RegExpSource(gA,this.id),this.captures=iA,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(AA,eA){eA.push(this._match)}compile(AA,eA){return this._getCachedCompiledPatterns(AA).compile(AA)}compileAG(AA,eA,tA,gA){return this._getCachedCompiledPatterns(AA).compileAG(AA,tA,gA)}_getCachedCompiledPatterns(AA){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new RegExpSourceList,this.collectPatterns(AA,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},IncludeOnlyRule=class extends Rule{constructor(AA,eA,tA,gA,iA){super(AA,eA,tA,gA),this.patterns=iA.patterns,this.hasMissingPatterns=iA.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}collectPatterns(AA,eA){for(const tA of this.patterns)AA.getRule(tA).collectPatterns(AA,eA)}compile(AA,eA){return this._getCachedCompiledPatterns(AA).compile(AA)}compileAG(AA,eA,tA,gA){return this._getCachedCompiledPatterns(AA).compileAG(AA,tA,gA)}_getCachedCompiledPatterns(AA){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new RegExpSourceList,this.collectPatterns(AA,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},BeginEndRule=class extends Rule{constructor(AA,eA,tA,gA,iA,oA,nA,rA,IA,aA){super(AA,eA,tA,gA),this._begin=new RegExpSource(iA,this.id),this.beginCaptures=oA,this._end=new RegExpSource(nA||"￿",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=rA,this.applyEndPatternLast=IA||!1,this.patterns=aA.patterns,this.hasMissingPatterns=aA.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(AA,eA){return this._end.resolveBackReferences(AA,eA)}collectPatterns(AA,eA){eA.push(this._begin)}compile(AA,eA){return this._getCachedCompiledPatterns(AA,eA).compile(AA)}compileAG(AA,eA,tA,gA){return this._getCachedCompiledPatterns(AA,eA).compileAG(AA,tA,gA)}_getCachedCompiledPatterns(AA,eA){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new RegExpSourceList;for(const tA of this.patterns)AA.getRule(tA).collectPatterns(AA,this._cachedCompiledPatterns);this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,eA):this._cachedCompiledPatterns.setSource(0,eA)),this._cachedCompiledPatterns}},BeginWhileRule=class extends Rule{constructor(AA,eA,tA,gA,iA,oA,nA,rA,IA){super(AA,eA,tA,gA),this._begin=new RegExpSource(iA,this.id),this.beginCaptures=oA,this.whileCaptures=rA,this._while=new RegExpSource(nA,whileRuleId),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=IA.patterns,this.hasMissingPatterns=IA.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null),this._cachedCompiledWhilePatterns&&(this._cachedCompiledWhilePatterns.dispose(),this._cachedCompiledWhilePatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(AA,eA){return this._while.resolveBackReferences(AA,eA)}collectPatterns(AA,eA){eA.push(this._begin)}compile(AA,eA){return this._getCachedCompiledPatterns(AA).compile(AA)}compileAG(AA,eA,tA,gA){return this._getCachedCompiledPatterns(AA).compileAG(AA,tA,gA)}_getCachedCompiledPatterns(AA){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new RegExpSourceList;for(const eA of this.patterns)AA.getRule(eA).collectPatterns(AA,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(AA,eA){return this._getCachedCompiledWhilePatterns(AA,eA).compile(AA)}compileWhileAG(AA,eA,tA,gA){return this._getCachedCompiledWhilePatterns(AA,eA).compileAG(AA,tA,gA)}_getCachedCompiledWhilePatterns(AA,eA){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new RegExpSourceList,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,eA||"￿"),this._cachedCompiledWhilePatterns}},RuleFactory=class Nr{static createCaptureRule(eA,tA,gA,iA,oA){return eA.registerRule(nA=>new CaptureRule(tA,nA,gA,iA,oA))}static getCompiledRuleId(eA,tA,gA){return eA.id||tA.registerRule(iA=>{if(eA.id=iA,eA.match)return new MatchRule(eA.$vscodeTextmateLocation,eA.id,eA.name,eA.match,Nr._compileCaptures(eA.captures,tA,gA));if(typeof eA.begin>"u"){eA.repository&&(gA=mergeObjects({},gA,eA.repository));let oA=eA.patterns;return typeof oA>"u"&&eA.include&&(oA=[{include:eA.include}]),new IncludeOnlyRule(eA.$vscodeTextmateLocation,eA.id,eA.name,eA.contentName,Nr._compilePatterns(oA,tA,gA))}return eA.while?new BeginWhileRule(eA.$vscodeTextmateLocation,eA.id,eA.name,eA.contentName,eA.begin,Nr._compileCaptures(eA.beginCaptures||eA.captures,tA,gA),eA.while,Nr._compileCaptures(eA.whileCaptures||eA.captures,tA,gA),Nr._compilePatterns(eA.patterns,tA,gA)):new BeginEndRule(eA.$vscodeTextmateLocation,eA.id,eA.name,eA.contentName,eA.begin,Nr._compileCaptures(eA.beginCaptures||eA.captures,tA,gA),eA.end,Nr._compileCaptures(eA.endCaptures||eA.captures,tA,gA),eA.applyEndPatternLast,Nr._compilePatterns(eA.patterns,tA,gA))}),eA.id}static _compileCaptures(eA,tA,gA){let iA=[];if(eA){let oA=0;for(const nA in eA){if(nA==="$vscodeTextmateLocation")continue;const rA=parseInt(nA,10);rA>oA&&(oA=rA)}for(let nA=0;nA<=oA;nA++)iA[nA]=null;for(const nA in eA){if(nA==="$vscodeTextmateLocation")continue;const rA=parseInt(nA,10);let IA=0;eA[nA].patterns&&(IA=Nr.getCompiledRuleId(eA[nA],tA,gA)),iA[rA]=Nr.createCaptureRule(tA,eA[nA].$vscodeTextmateLocation,eA[nA].name,eA[nA].contentName,IA)}}return iA}static _compilePatterns(eA,tA,gA){let iA=[];if(eA)for(let oA=0,nA=eA.length;oA<nA;oA++){const rA=eA[oA];let IA=-1;if(rA.include){const aA=parseInclude(rA.include);switch(aA.kind){case 0:case 1:IA=Nr.getCompiledRuleId(gA[rA.include],tA,gA);break;case 2:let lA=gA[aA.ruleName];lA&&(IA=Nr.getCompiledRuleId(lA,tA,gA));break;case 3:case 4:const cA=aA.scopeName,dA=aA.kind===4?aA.ruleName:null,hA=tA.getExternalGrammar(cA,gA);if(hA)if(dA){let pA=hA.repository[dA];pA&&(IA=Nr.getCompiledRuleId(pA,tA,hA.repository))}else IA=Nr.getCompiledRuleId(hA.repository.$self,tA,hA.repository);break}}else IA=Nr.getCompiledRuleId(rA,tA,gA);if(IA!==-1){const aA=tA.getRule(IA);let lA=!1;if((aA instanceof IncludeOnlyRule||aA instanceof BeginEndRule||aA instanceof BeginWhileRule)&&aA.hasMissingPatterns&&aA.patterns.length===0&&(lA=!0),lA)continue;iA.push(IA)}}return{patterns:iA,hasMissingPatterns:(eA?eA.length:0)!==iA.length}}},RegExpSource=class Xu{constructor(eA,tA){if(eA){const gA=eA.length;let iA=0,oA=[],nA=!1;for(let rA=0;rA<gA;rA++)if(eA.charAt(rA)==="\\"&&rA+1<gA){const aA=eA.charAt(rA+1);aA==="z"?(oA.push(eA.substring(iA,rA)),oA.push("$(?!\\n)(?<!\\n)"),iA=rA+2):(aA==="A"||aA==="G")&&(nA=!0),rA++}this.hasAnchor=nA,iA===0?this.source=eA:(oA.push(eA.substring(iA,gA)),this.source=oA.join(""))}else this.hasAnchor=!1,this.source=eA;this.hasAnchor?this._anchorCache=this._buildAnchorCache():this._anchorCache=null,this.ruleId=tA,this.hasBackReferences=HAS_BACK_REFERENCES.test(this.source)}clone(){return new Xu(this.source,this.ruleId)}setSource(eA){this.source!==eA&&(this.source=eA,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(eA,tA){let gA=tA.map(iA=>eA.substring(iA.start,iA.end));return BACK_REFERENCING_END.lastIndex=0,this.source.replace(BACK_REFERENCING_END,(iA,oA)=>escapeRegExpCharacters(gA[parseInt(oA,10)]||""))}_buildAnchorCache(){let eA=[],tA=[],gA=[],iA=[],oA,nA,rA,IA;for(oA=0,nA=this.source.length;oA<nA;oA++)rA=this.source.charAt(oA),eA[oA]=rA,tA[oA]=rA,gA[oA]=rA,iA[oA]=rA,rA==="\\"&&oA+1<nA&&(IA=this.source.charAt(oA+1),IA==="A"?(eA[oA+1]="￿",tA[oA+1]="￿",gA[oA+1]="A",iA[oA+1]="A"):IA==="G"?(eA[oA+1]="￿",tA[oA+1]="G",gA[oA+1]="￿",iA[oA+1]="G"):(eA[oA+1]=IA,tA[oA+1]=IA,gA[oA+1]=IA,iA[oA+1]=IA),oA++);return{A0_G0:eA.join(""),A0_G1:tA.join(""),A1_G0:gA.join(""),A1_G1:iA.join("")}}resolveAnchors(eA,tA){return!this.hasAnchor||!this._anchorCache?this.source:eA?tA?this._anchorCache.A1_G1:this._anchorCache.A1_G0:tA?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},RegExpSourceList=class{constructor(){this._items=[],this._hasAnchors=!1,this._cached=null,this._anchorCache={A0_G0:null,A0_G1:null,A1_G0:null,A1_G1:null}}dispose(){this._disposeCaches()}_disposeCaches(){this._cached&&(this._cached.dispose(),this._cached=null),this._anchorCache.A0_G0&&(this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null),this._anchorCache.A0_G1&&(this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null),this._anchorCache.A1_G0&&(this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null),this._anchorCache.A1_G1&&(this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null)}push(AA){this._items.push(AA),this._hasAnchors=this._hasAnchors||AA.hasAnchor}unshift(AA){this._items.unshift(AA),this._hasAnchors=this._hasAnchors||AA.hasAnchor}length(){return this._items.length}setSource(AA,eA){this._items[AA].source!==eA&&(this._disposeCaches(),this._items[AA].setSource(eA))}compile(AA){if(!this._cached){let eA=this._items.map(tA=>tA.source);this._cached=new CompiledRule(AA,eA,this._items.map(tA=>tA.ruleId))}return this._cached}compileAG(AA,eA,tA){return this._hasAnchors?eA?tA?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(AA,eA,tA)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(AA,eA,tA)),this._anchorCache.A1_G0):tA?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(AA,eA,tA)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(AA,eA,tA)),this._anchorCache.A0_G0):this.compile(AA)}_resolveAnchors(AA,eA,tA){let gA=this._items.map(iA=>iA.resolveAnchors(eA,tA));return new CompiledRule(AA,gA,this._items.map(iA=>iA.ruleId))}},CompiledRule=class{constructor(AA,eA,tA){this.regExps=eA,this.rules=tA,this.scanner=AA.createOnigScanner(eA)}dispose(){typeof this.scanner.dispose=="function"&&this.scanner.dispose()}toString(){const AA=[];for(let eA=0,tA=this.rules.length;eA<tA;eA++)AA.push(" - "+this.rules[eA]+": "+this.regExps[eA]);return AA.join(`
454
454
  `)}findNextMatchSync(AA,eA,tA){const gA=this.scanner.findNextMatchSync(AA,eA,tA);return gA?{ruleId:this.rules[gA.index],captureIndices:gA.captureIndices}:null}},BasicScopeAttributes=class{constructor(AA,eA){this.languageId=AA,this.tokenType=eA}},_BasicScopeAttributesProvider=class $c{constructor(eA,tA){this._getBasicScopeAttributes=new CachedFn(gA=>{const iA=this._scopeToLanguage(gA),oA=this._toStandardTokenType(gA);return new BasicScopeAttributes(iA,oA)}),this._defaultAttributes=new BasicScopeAttributes(eA,8),this._embeddedLanguagesMatcher=new ScopeMatcher(Object.entries(tA||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(eA){return eA===null?$c._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(eA)}_scopeToLanguage(eA){return this._embeddedLanguagesMatcher.match(eA)||0}_toStandardTokenType(eA){const tA=eA.match($c.STANDARD_TOKEN_TYPE_REGEXP);if(!tA)return 8;switch(tA[1]){case"comment":return 1;case"string":return 2;case"regex":return 3;case"meta.embedded":return 0}throw new Error("Unexpected match for standard token type!")}};_BasicScopeAttributesProvider._NULL_SCOPE_METADATA=new BasicScopeAttributes(0,0),_BasicScopeAttributesProvider.STANDARD_TOKEN_TYPE_REGEXP=/\b(comment|string|regex|meta\.embedded)\b/;var BasicScopeAttributesProvider=_BasicScopeAttributesProvider,ScopeMatcher=class{constructor(AA){if(AA.length===0)this.values=null,this.scopesRegExp=null;else{this.values=new Map(AA);const eA=AA.map(([tA,gA])=>escapeRegExpCharacters(tA));eA.sort(),eA.reverse(),this.scopesRegExp=new RegExp(`^((${eA.join(")|(")}))($|\\.)`,"")}}match(AA){if(!this.scopesRegExp)return;const eA=AA.match(this.scopesRegExp);if(eA)return this.values.get(eA[1])}},TokenizeStringResult=class{constructor(AA,eA){this.stack=AA,this.stoppedEarly=eA}};function _tokenizeString(AA,eA,tA,gA,iA,oA,nA,rA){const IA=eA.content.length;let aA=!1,lA=-1;if(nA){const hA=_checkWhileConditions(AA,eA,tA,gA,iA,oA);iA=hA.stack,gA=hA.linePos,tA=hA.isFirstLine,lA=hA.anchorPosition}const cA=Date.now();for(;!aA;){if(rA!==0&&Date.now()-cA>rA)return new TokenizeStringResult(iA,!0);dA()}return new TokenizeStringResult(iA,!1);function dA(){const hA=matchRuleOrInjections(AA,eA,tA,gA,iA,lA);if(!hA){oA.produce(iA,IA),aA=!0;return}const pA=hA.captureIndices,bA=hA.matchedRuleId,fA=pA&&pA.length>0?pA[0].end>gA:!1;if(bA===endRuleId){const ZA=iA.getRule(AA);oA.produce(iA,pA[0].start),iA=iA.withContentNameScopesList(iA.nameScopesList),handleCaptures(AA,eA,tA,iA,oA,ZA.endCaptures,pA),oA.produce(iA,pA[0].end);const GA=iA;if(iA=iA.parent,lA=GA.getAnchorPos(),!fA&&GA.getEnterPos()===gA){iA=GA,oA.produce(iA,IA),aA=!0;return}}else{const ZA=AA.getRule(bA);oA.produce(iA,pA[0].start);const GA=iA,RA=ZA.getName(eA.content,pA),MA=iA.contentNameScopesList.pushAttributed(RA,AA);if(iA=iA.push(bA,gA,lA,pA[0].end===IA,null,MA,MA),ZA instanceof BeginEndRule){const NA=ZA;handleCaptures(AA,eA,tA,iA,oA,NA.beginCaptures,pA),oA.produce(iA,pA[0].end),lA=pA[0].end;const EA=NA.getContentName(eA.content,pA),vA=MA.pushAttributed(EA,AA);if(iA=iA.withContentNameScopesList(vA),NA.endHasBackReferences&&(iA=iA.withEndRule(NA.getEndWithResolvedBackReferences(eA.content,pA))),!fA&&GA.hasSameRuleAs(iA)){iA=iA.pop(),oA.produce(iA,IA),aA=!0;return}}else if(ZA instanceof BeginWhileRule){const NA=ZA;handleCaptures(AA,eA,tA,iA,oA,NA.beginCaptures,pA),oA.produce(iA,pA[0].end),lA=pA[0].end;const EA=NA.getContentName(eA.content,pA),vA=MA.pushAttributed(EA,AA);if(iA=iA.withContentNameScopesList(vA),NA.whileHasBackReferences&&(iA=iA.withEndRule(NA.getWhileWithResolvedBackReferences(eA.content,pA))),!fA&&GA.hasSameRuleAs(iA)){iA=iA.pop(),oA.produce(iA,IA),aA=!0;return}}else if(handleCaptures(AA,eA,tA,iA,oA,ZA.captures,pA),oA.produce(iA,pA[0].end),iA=iA.pop(),!fA){iA=iA.safePop(),oA.produce(iA,IA),aA=!0;return}}pA[0].end>gA&&(gA=pA[0].end,tA=!1)}}function _checkWhileConditions(AA,eA,tA,gA,iA,oA){let nA=iA.beginRuleCapturedEOL?0:-1;const rA=[];for(let IA=iA;IA;IA=IA.pop()){const aA=IA.getRule(AA);aA instanceof BeginWhileRule&&rA.push({rule:aA,stack:IA})}for(let IA=rA.pop();IA;IA=rA.pop()){const{ruleScanner:aA,findOptions:lA}=prepareRuleWhileSearch(IA.rule,AA,IA.stack.endRule,tA,gA===nA),cA=aA.findNextMatchSync(eA,gA,lA);if(cA){if(cA.ruleId!==whileRuleId){iA=IA.stack.pop();break}cA.captureIndices&&cA.captureIndices.length&&(oA.produce(IA.stack,cA.captureIndices[0].start),handleCaptures(AA,eA,tA,IA.stack,oA,IA.rule.whileCaptures,cA.captureIndices),oA.produce(IA.stack,cA.captureIndices[0].end),nA=cA.captureIndices[0].end,cA.captureIndices[0].end>gA&&(gA=cA.captureIndices[0].end,tA=!1))}else{iA=IA.stack.pop();break}}return{stack:iA,linePos:gA,anchorPosition:nA,isFirstLine:tA}}function matchRuleOrInjections(AA,eA,tA,gA,iA,oA){const nA=matchRule(AA,eA,tA,gA,iA,oA),rA=AA.getInjections();if(rA.length===0)return nA;const IA=matchInjections(rA,AA,eA,tA,gA,iA,oA);if(!IA)return nA;if(!nA)return IA;const aA=nA.captureIndices[0].start,lA=IA.captureIndices[0].start;return lA<aA||IA.priorityMatch&&lA===aA?IA:nA}function matchRule(AA,eA,tA,gA,iA,oA){const nA=iA.getRule(AA),{ruleScanner:rA,findOptions:IA}=prepareRuleSearch(nA,AA,iA.endRule,tA,gA===oA),aA=rA.findNextMatchSync(eA,gA,IA);return aA?{captureIndices:aA.captureIndices,matchedRuleId:aA.ruleId}:null}function matchInjections(AA,eA,tA,gA,iA,oA,nA){let rA=Number.MAX_VALUE,IA=null,aA,lA=0;const cA=oA.contentNameScopesList.getScopeNames();for(let dA=0,hA=AA.length;dA<hA;dA++){const pA=AA[dA];if(!pA.matcher(cA))continue;const bA=eA.getRule(pA.ruleId),{ruleScanner:fA,findOptions:ZA}=prepareRuleSearch(bA,eA,null,gA,iA===nA),GA=fA.findNextMatchSync(tA,iA,ZA);if(!GA)continue;const RA=GA.captureIndices[0].start;if(!(RA>=rA)&&(rA=RA,IA=GA.captureIndices,aA=GA.ruleId,lA=pA.priority,rA===iA))break}return IA?{priorityMatch:lA===-1,captureIndices:IA,matchedRuleId:aA}:null}function prepareRuleSearch(AA,eA,tA,gA,iA){return{ruleScanner:AA.compileAG(eA,tA,gA,iA),findOptions:0}}function prepareRuleWhileSearch(AA,eA,tA,gA,iA){return{ruleScanner:AA.compileWhileAG(eA,tA,gA,iA),findOptions:0}}function handleCaptures(AA,eA,tA,gA,iA,oA,nA){if(oA.length===0)return;const rA=eA.content,IA=Math.min(oA.length,nA.length),aA=[],lA=nA[0].end;for(let cA=0;cA<IA;cA++){const dA=oA[cA];if(dA===null)continue;const hA=nA[cA];if(hA.length===0)continue;if(hA.start>lA)break;for(;aA.length>0&&aA[aA.length-1].endPos<=hA.start;)iA.produceFromScopes(aA[aA.length-1].scopes,aA[aA.length-1].endPos),aA.pop();if(aA.length>0?iA.produceFromScopes(aA[aA.length-1].scopes,hA.start):iA.produce(gA,hA.start),dA.retokenizeCapturedWithRuleId){const bA=dA.getName(rA,nA),fA=gA.contentNameScopesList.pushAttributed(bA,AA),ZA=dA.getContentName(rA,nA),GA=fA.pushAttributed(ZA,AA),RA=gA.push(dA.retokenizeCapturedWithRuleId,hA.start,-1,!1,null,fA,GA),MA=AA.createOnigString(rA.substring(0,hA.end));_tokenizeString(AA,MA,tA&&hA.start===0,hA.start,RA,iA,!1,0),disposeOnigString(MA);continue}const pA=dA.getName(rA,nA);if(pA!==null){const fA=(aA.length>0?aA[aA.length-1].scopes:gA.contentNameScopesList).pushAttributed(pA,AA);aA.push(new LocalStackElement(fA,hA.end))}}for(;aA.length>0;)iA.produceFromScopes(aA[aA.length-1].scopes,aA[aA.length-1].endPos),aA.pop()}var LocalStackElement=class{constructor(AA,eA){this.scopes=AA,this.endPos=eA}};function createGrammar(AA,eA,tA,gA,iA,oA,nA,rA){return new Grammar(AA,eA,tA,gA,iA,oA,nA,rA)}function collectInjections(AA,eA,tA,gA,iA){const oA=createMatchers(eA,nameMatcher),nA=RuleFactory.getCompiledRuleId(tA,gA,iA.repository);for(const rA of oA)AA.push({debugSelector:eA,matcher:rA.matcher,ruleId:nA,grammar:iA,priority:rA.priority})}function nameMatcher(AA,eA){if(eA.length<AA.length)return!1;let tA=0;return AA.every(gA=>{for(let iA=tA;iA<eA.length;iA++)if(scopesAreMatching(eA[iA],gA))return tA=iA+1,!0;return!1})}function scopesAreMatching(AA,eA){if(!AA)return!1;if(AA===eA)return!0;const tA=eA.length;return AA.length>tA&&AA.substr(0,tA)===eA&&AA[tA]==="."}var Grammar=class{constructor(AA,eA,tA,gA,iA,oA,nA,rA){if(this._rootScopeName=AA,this.balancedBracketSelectors=oA,this._onigLib=rA,this._basicScopeAttributesProvider=new BasicScopeAttributesProvider(tA,gA),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=nA,this._grammar=initGrammar(eA,null),this._injections=null,this._tokenTypeMatchers=[],iA)for(const IA of Object.keys(iA)){const aA=createMatchers(IA,nameMatcher);for(const lA of aA)this._tokenTypeMatchers.push({matcher:lA.matcher,type:iA[IA]})}}get themeProvider(){return this._grammarRepository}dispose(){for(const AA of this._ruleId2desc)AA&&AA.dispose()}createOnigScanner(AA){return this._onigLib.createOnigScanner(AA)}createOnigString(AA){return this._onigLib.createOnigString(AA)}getMetadataForScope(AA){return this._basicScopeAttributesProvider.getBasicScopeAttributes(AA)}_collectInjections(){const AA={lookup:iA=>iA===this._rootScopeName?this._grammar:this.getExternalGrammar(iA),injections:iA=>this._grammarRepository.injections(iA)},eA=[],tA=this._rootScopeName,gA=AA.lookup(tA);if(gA){const iA=gA.injections;if(iA)for(let nA in iA)collectInjections(eA,nA,iA[nA],this,gA);const oA=this._grammarRepository.injections(tA);oA&&oA.forEach(nA=>{const rA=this.getExternalGrammar(nA);if(rA){const IA=rA.injectionSelector;IA&&collectInjections(eA,IA,rA,this,rA)}})}return eA.sort((iA,oA)=>iA.priority-oA.priority),eA}getInjections(){return this._injections===null&&(this._injections=this._collectInjections()),this._injections}registerRule(AA){const eA=++this._lastRuleId,tA=AA(eA);return this._ruleId2desc[eA]=tA,tA}getRule(AA){return this._ruleId2desc[AA]}getExternalGrammar(AA,eA){if(this._includedGrammars[AA])return this._includedGrammars[AA];if(this._grammarRepository){const tA=this._grammarRepository.lookup(AA);if(tA)return this._includedGrammars[AA]=initGrammar(tA,eA&&eA.$base),this._includedGrammars[AA]}}tokenizeLine(AA,eA,tA=0){const gA=this._tokenize(AA,eA,!1,tA);return{tokens:gA.lineTokens.getResult(gA.ruleStack,gA.lineLength),ruleStack:gA.ruleStack,stoppedEarly:gA.stoppedEarly}}tokenizeLine2(AA,eA,tA=0){const gA=this._tokenize(AA,eA,!0,tA);return{tokens:gA.lineTokens.getBinaryResult(gA.ruleStack,gA.lineLength),ruleStack:gA.ruleStack,stoppedEarly:gA.stoppedEarly}}_tokenize(AA,eA,tA,gA){this._rootId===-1&&(this._rootId=RuleFactory.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let iA;if(!eA||eA===StateStackImpl.NULL){iA=!0;const aA=this._basicScopeAttributesProvider.getDefaultAttributes(),lA=this.themeProvider.getDefaults(),cA=EncodedTokenMetadata.set(0,aA.languageId,aA.tokenType,null,lA.fontStyle,lA.foregroundId,lA.backgroundId),dA=this.getRule(this._rootId).getName(null,null);let hA;dA?hA=AttributedScopeStack.createRootAndLookUpScopeName(dA,cA,this):hA=AttributedScopeStack.createRoot("unknown",cA),eA=new StateStackImpl(null,this._rootId,-1,-1,!1,null,hA,hA)}else iA=!1,eA.reset();AA=AA+`
455
455
  `;const oA=this.createOnigString(AA),nA=oA.content.length,rA=new LineTokens(tA,AA,this._tokenTypeMatchers,this.balancedBracketSelectors),IA=_tokenizeString(this,oA,iA,0,eA,rA,!0,gA);return disposeOnigString(oA),{lineLength:nA,lineTokens:rA,ruleStack:IA.stack,stoppedEarly:IA.stoppedEarly}}};function initGrammar(AA,eA){return AA=clone(AA),AA.repository=AA.repository||{},AA.repository.$self={$vscodeTextmateLocation:AA.$vscodeTextmateLocation,patterns:AA.patterns,name:AA.scopeName},AA.repository.$base=eA||AA.repository.$self,AA}var AttributedScopeStack=class VI{constructor(eA,tA,gA){this.parent=eA,this.scopePath=tA,this.tokenAttributes=gA}static fromExtension(eA,tA){let gA=eA,iA=(eA==null?void 0:eA.scopePath)??null;for(const oA of tA)iA=ScopeStack.push(iA,oA.scopeNames),gA=new VI(gA,iA,oA.encodedTokenAttributes);return gA}static createRoot(eA,tA){return new VI(null,new ScopeStack(null,eA),tA)}static createRootAndLookUpScopeName(eA,tA,gA){const iA=gA.getMetadataForScope(eA),oA=new ScopeStack(null,eA),nA=gA.themeProvider.themeMatch(oA),rA=VI.mergeAttributes(tA,iA,nA);return new VI(null,oA,rA)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(" ")}equals(eA){return VI.equals(this,eA)}static equals(eA,tA){do{if(eA===tA||!eA&&!tA)return!0;if(!eA||!tA||eA.scopeName!==tA.scopeName||eA.tokenAttributes!==tA.tokenAttributes)return!1;eA=eA.parent,tA=tA.parent}while(!0)}static mergeAttributes(eA,tA,gA){let iA=-1,oA=0,nA=0;return gA!==null&&(iA=gA.fontStyle,oA=gA.foregroundId,nA=gA.backgroundId),EncodedTokenMetadata.set(eA,tA.languageId,tA.tokenType,null,iA,oA,nA)}pushAttributed(eA,tA){if(eA===null)return this;if(eA.indexOf(" ")===-1)return VI._pushAttributed(this,eA,tA);const gA=eA.split(/ /g);let iA=this;for(const oA of gA)iA=VI._pushAttributed(iA,oA,tA);return iA}static _pushAttributed(eA,tA,gA){const iA=gA.getMetadataForScope(tA),oA=eA.scopePath.push(tA),nA=gA.themeProvider.themeMatch(oA),rA=VI.mergeAttributes(eA.tokenAttributes,iA,nA);return new VI(eA,oA,rA)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(eA){var iA;const tA=[];let gA=this;for(;gA&&gA!==eA;)tA.push({encodedTokenAttributes:gA.tokenAttributes,scopeNames:gA.scopePath.getExtensionIfDefined(((iA=gA.parent)==null?void 0:iA.scopePath)??null)}),gA=gA.parent;return gA===eA?tA.reverse():void 0}},_StateStackImpl=class Ss{constructor(eA,tA,gA,iA,oA,nA,rA,IA){this.parent=eA,this.ruleId=tA,this.beginRuleCapturedEOL=oA,this.endRule=nA,this.nameScopesList=rA,this.contentNameScopesList=IA,this._stackElementBrand=void 0,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=gA,this._anchorPos=iA}equals(eA){return eA===null?!1:Ss._equals(this,eA)}static _equals(eA,tA){return eA===tA?!0:this._structuralEquals(eA,tA)?AttributedScopeStack.equals(eA.contentNameScopesList,tA.contentNameScopesList):!1}static _structuralEquals(eA,tA){do{if(eA===tA||!eA&&!tA)return!0;if(!eA||!tA||eA.depth!==tA.depth||eA.ruleId!==tA.ruleId||eA.endRule!==tA.endRule)return!1;eA=eA.parent,tA=tA.parent}while(!0)}clone(){return this}static _reset(eA){for(;eA;)eA._enterPos=-1,eA._anchorPos=-1,eA=eA.parent}reset(){Ss._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(eA,tA,gA,iA,oA,nA,rA){return new Ss(this,eA,tA,gA,iA,oA,nA,rA)}getEnterPos(){return this._enterPos}getAnchorPos(){return this._anchorPos}getRule(eA){return eA.getRule(this.ruleId)}toString(){const eA=[];return this._writeString(eA,0),"["+eA.join(",")+"]"}_writeString(eA,tA){var gA,iA;return this.parent&&(tA=this.parent._writeString(eA,tA)),eA[tA++]=`(${this.ruleId}, ${(gA=this.nameScopesList)==null?void 0:gA.toString()}, ${(iA=this.contentNameScopesList)==null?void 0:iA.toString()})`,tA}withContentNameScopesList(eA){return this.contentNameScopesList===eA?this:this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,eA)}withEndRule(eA){return this.endRule===eA?this:new Ss(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,eA,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(eA){let tA=this;for(;tA&&tA._enterPos===eA._enterPos;){if(tA.ruleId===eA.ruleId)return!0;tA=tA.parent}return!1}toStateStackFrame(){var eA,tA,gA;return{ruleId:this.ruleId,beginRuleCapturedEOL:this.beginRuleCapturedEOL,endRule:this.endRule,nameScopesList:((tA=this.nameScopesList)==null?void 0:tA.getExtensionIfDefined(((eA=this.parent)==null?void 0:eA.nameScopesList)??null))??[],contentNameScopesList:((gA=this.contentNameScopesList)==null?void 0:gA.getExtensionIfDefined(this.nameScopesList))??[]}}static pushFrame(eA,tA){const gA=AttributedScopeStack.fromExtension((eA==null?void 0:eA.nameScopesList)??null,tA.nameScopesList);return new Ss(eA,tA.ruleId,tA.enterPos??-1,tA.anchorPos??-1,tA.beginRuleCapturedEOL,tA.endRule,gA,AttributedScopeStack.fromExtension(gA,tA.contentNameScopesList))}};_StateStackImpl.NULL=new _StateStackImpl(null,0,0,0,!1,null,null,null);var StateStackImpl=_StateStackImpl,BalancedBracketSelectors=class{constructor(AA,eA){this.allowAny=!1,this.balancedBracketScopes=AA.flatMap(tA=>tA==="*"?(this.allowAny=!0,[]):createMatchers(tA,nameMatcher).map(gA=>gA.matcher)),this.unbalancedBracketScopes=eA.flatMap(tA=>createMatchers(tA,nameMatcher).map(gA=>gA.matcher))}get matchesAlways(){return this.allowAny&&this.unbalancedBracketScopes.length===0}get matchesNever(){return this.balancedBracketScopes.length===0&&!this.allowAny}match(AA){for(const eA of this.unbalancedBracketScopes)if(eA(AA))return!1;for(const eA of this.balancedBracketScopes)if(eA(AA))return!0;return this.allowAny}},LineTokens=class{constructor(AA,eA,tA,gA){this.balancedBracketSelectors=gA,this._emitBinaryTokens=AA,this._tokenTypeOverrides=tA,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}produce(AA,eA){this.produceFromScopes(AA.contentNameScopesList,eA)}produceFromScopes(AA,eA){var gA;if(this._lastTokenEndIndex>=eA)return;if(this._emitBinaryTokens){let iA=(AA==null?void 0:AA.tokenAttributes)??0,oA=!1;if((gA=this.balancedBracketSelectors)!=null&&gA.matchesAlways&&(oA=!0),this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){const nA=(AA==null?void 0:AA.getScopeNames())??[];for(const rA of this._tokenTypeOverrides)rA.matcher(nA)&&(iA=EncodedTokenMetadata.set(iA,0,rA.type,null,-1,0,0));this.balancedBracketSelectors&&(oA=this.balancedBracketSelectors.match(nA))}if(oA&&(iA=EncodedTokenMetadata.set(iA,0,8,oA,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===iA){this._lastTokenEndIndex=eA;return}this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(iA),this._lastTokenEndIndex=eA;return}const tA=(AA==null?void 0:AA.getScopeNames())??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:eA,scopes:tA}),this._lastTokenEndIndex=eA}getResult(AA,eA){return this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===eA-1&&this._tokens.pop(),this._tokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(AA,eA),this._tokens[this._tokens.length-1].startIndex=0),this._tokens}getBinaryResult(AA,eA){this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===eA-1&&(this._binaryTokens.pop(),this._binaryTokens.pop()),this._binaryTokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(AA,eA),this._binaryTokens[this._binaryTokens.length-2]=0);const tA=new Uint32Array(this._binaryTokens.length);for(let gA=0,iA=this._binaryTokens.length;gA<iA;gA++)tA[gA]=this._binaryTokens[gA];return tA}},SyncRegistry=class{constructor(AA,eA){this._onigLib=eA,this._grammars=new Map,this._rawGrammars=new Map,this._injectionGrammars=new Map,this._theme=AA}dispose(){for(const AA of this._grammars.values())AA.dispose()}setTheme(AA){this._theme=AA}getColorMap(){return this._theme.getColorMap()}addGrammar(AA,eA){this._rawGrammars.set(AA.scopeName,AA),eA&&this._injectionGrammars.set(AA.scopeName,eA)}lookup(AA){return this._rawGrammars.get(AA)}injections(AA){return this._injectionGrammars.get(AA)}getDefaults(){return this._theme.getDefaults()}themeMatch(AA){return this._theme.match(AA)}grammarForScopeName(AA,eA,tA,gA,iA){if(!this._grammars.has(AA)){let oA=this._rawGrammars.get(AA);if(!oA)return null;this._grammars.set(AA,createGrammar(AA,oA,eA,tA,gA,iA,this,this._onigLib))}return this._grammars.get(AA)}},Registry$1=class{constructor(eA){this._options=eA,this._syncRegistry=new SyncRegistry(Theme.createFromRawTheme(eA.theme,eA.colorMap),eA.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(eA,tA){this._syncRegistry.setTheme(Theme.createFromRawTheme(eA,tA))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(eA,tA,gA){return this.loadGrammarWithConfiguration(eA,tA,{embeddedLanguages:gA})}loadGrammarWithConfiguration(eA,tA,gA){return this._loadGrammar(eA,tA,gA.embeddedLanguages,gA.tokenTypes,new BalancedBracketSelectors(gA.balancedBracketSelectors||[],gA.unbalancedBracketSelectors||[]))}loadGrammar(eA){return this._loadGrammar(eA,0,null,null,null)}_loadGrammar(eA,tA,gA,iA,oA){const nA=new ScopeDependencyProcessor(this._syncRegistry,eA);for(;nA.Q.length>0;)nA.Q.map(rA=>this._loadSingleGrammar(rA.scopeName)),nA.processQueue();return this._grammarForScopeName(eA,tA,gA,iA,oA)}_loadSingleGrammar(eA){this._ensureGrammarCache.has(eA)||(this._doLoadSingleGrammar(eA),this._ensureGrammarCache.set(eA,!0))}_doLoadSingleGrammar(eA){const tA=this._options.loadGrammar(eA);if(tA){const gA=typeof this._options.getInjections=="function"?this._options.getInjections(eA):void 0;this._syncRegistry.addGrammar(tA,gA)}}addGrammar(eA,tA=[],gA=0,iA=null){return this._syncRegistry.addGrammar(eA,tA),this._grammarForScopeName(eA.scopeName,gA,iA)}_grammarForScopeName(eA,tA=0,gA=null,iA=null,oA=null){return this._syncRegistry.grammarForScopeName(eA,tA,gA,iA,oA)}},INITIAL=StateStackImpl.NULL;const htmlVoidElements=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"],own$2={}.hasOwnProperty;function zwitch(AA,eA){const tA=eA||{};function gA(iA,...oA){let nA=gA.invalid;const rA=gA.handlers;if(iA&&own$2.call(iA,AA)){const IA=String(iA[AA]);nA=own$2.call(rA,IA)?rA[IA]:gA.unknown}if(nA)return nA.call(this,iA,...oA)}return gA.handlers=tA.handlers||{},gA.invalid=tA.invalid,gA.unknown=tA.unknown,gA}const 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;function core$1(AA,eA){if(AA=AA.replace(eA.subset?charactersToExpressionCached(eA.subset):defaultSubsetRegex,gA),eA.subset||eA.escapeOnly)return AA;return AA.replace(surrogatePairsRegex,tA).replace(controlCharactersRegex,gA);function tA(iA,oA,nA){return eA.format((iA.charCodeAt(0)-55296)*1024+iA.charCodeAt(1)-56320+65536,nA.charCodeAt(oA+2),eA)}function gA(iA,oA,nA){return eA.format(iA.charCodeAt(0),nA.charCodeAt(oA+1),eA)}}function charactersToExpressionCached(AA){let eA=subsetToRegexCache.get(AA);return eA||(eA=charactersToExpression(AA),subsetToRegexCache.set(AA,eA)),eA}function charactersToExpression(AA){const eA=[];let tA=-1;for(;++tA<AA.length;)eA.push(AA[tA].replace(regexEscapeRegex,"\\$&"));return new RegExp("(?:"+eA.join("|")+")","g")}const hexadecimalRegex=/[\dA-Fa-f]/;function toHexadecimal(AA,eA,tA){const gA="&#x"+AA.toString(16).toUpperCase();return tA&&eA&&!hexadecimalRegex.test(String.fromCharCode(eA))?gA:gA+";"}const decimalRegex=/\d/;function toDecimal(AA,eA,tA){const gA="&#"+String(AA);return tA&&eA&&!decimalRegex.test(String.fromCharCode(eA))?gA:gA+";"}const 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"],own$1={}.hasOwnProperty,characters={};let key;for(key in characterEntitiesHtml4)own$1.call(characterEntitiesHtml4,key)&&(characters[characterEntitiesHtml4[key]]=key);const notAlphanumericRegex=/[^\dA-Za-z]/;function toNamed(AA,eA,tA,gA){const iA=String.fromCharCode(AA);if(own$1.call(characters,iA)){const oA=characters[iA],nA="&"+oA;return tA&&characterEntitiesLegacy.includes(oA)&&!dangerous.includes(oA)&&(!gA||eA&&eA!==61&&notAlphanumericRegex.test(String.fromCharCode(eA)))?nA:nA+";"}return""}function formatSmart(AA,eA,tA){let gA=toHexadecimal(AA,eA,tA.omitOptionalSemicolons),iA;if((tA.useNamedReferences||tA.useShortestReferences)&&(iA=toNamed(AA,eA,tA.omitOptionalSemicolons,tA.attribute)),(tA.useShortestReferences||!iA)&&tA.useShortestReferences){const oA=toDecimal(AA,eA,tA.omitOptionalSemicolons);oA.length<gA.length&&(gA=oA)}return iA&&(!tA.useShortestReferences||iA.length<gA.length)?iA:gA}function stringifyEntities(AA,eA){return core$1(AA,Object.assign({format:formatSmart},eA))}const htmlCommentRegex=/^>|^->|<!--|-->|--!>|<!-$/g,bogusCommentEntitySubset=[">"],commentEntitySubset=["<",">"];function comment(AA,eA,tA,gA){return gA.settings.bogusComments?"<?"+stringifyEntities(AA.value,Object.assign({},gA.settings.characterReferences,{subset:bogusCommentEntitySubset}))+">":"<!--"+AA.value.replace(htmlCommentRegex,iA)+"-->";function iA(oA){return stringifyEntities(oA,Object.assign({},gA.settings.characterReferences,{subset:commentEntitySubset}))}}function doctype(AA,eA,tA,gA){return"<!"+(gA.settings.upperDoctype?"DOCTYPE":"doctype")+(gA.settings.tightDoctype?"":" ")+"html>"}function ccount(AA,eA){const tA=String(AA);if(typeof eA!="string")throw new TypeError("Expected character");let gA=0,iA=tA.indexOf(eA);for(;iA!==-1;)gA++,iA=tA.indexOf(eA,iA+eA.length);return gA}const re$4=/[ \t\n\f\r]/g;function whitespace(AA){return typeof AA=="object"?AA.type==="text"?empty(AA.value):!1:empty(AA)}function empty(AA){return AA.replace(re$4,"")===""}const siblingAfter=siblings(1),siblingBefore=siblings(-1),emptyChildren$1=[];function siblings(AA){return eA;function eA(tA,gA,iA){const oA=tA?tA.children:emptyChildren$1;let nA=(gA||0)+AA,rA=oA[nA];if(!iA)for(;rA&&whitespace(rA);)nA+=AA,rA=oA[nA];return rA}}const own={}.hasOwnProperty;function omission(AA){return eA;function eA(tA,gA,iA){return own.call(AA,tA.tagName)&&AA[tA.tagName](tA,gA,iA)}}const closing=omission({body:body$1,caption:headOrColgroupOrCaption,colgroup:headOrColgroupOrCaption,dd,dt:dt$1,head:headOrColgroupOrCaption,html:html$1,li,optgroup,option,p:p$3,rp:rubyElement,rt:rubyElement,tbody:tbody$1,td:cells,tfoot,th:cells,thead,tr:tr$2});function headOrColgroupOrCaption(AA,eA,tA){const gA=siblingAfter(tA,eA,!0);return!gA||gA.type!=="comment"&&!(gA.type==="text"&&whitespace(gA.value.charAt(0)))}function html$1(AA,eA,tA){const gA=siblingAfter(tA,eA);return!gA||gA.type!=="comment"}function body$1(AA,eA,tA){const gA=siblingAfter(tA,eA);return!gA||gA.type!=="comment"}function p$3(AA,eA,tA){const gA=siblingAfter(tA,eA);return gA?gA.type==="element"&&(gA.tagName==="address"||gA.tagName==="article"||gA.tagName==="aside"||gA.tagName==="blockquote"||gA.tagName==="details"||gA.tagName==="div"||gA.tagName==="dl"||gA.tagName==="fieldset"||gA.tagName==="figcaption"||gA.tagName==="figure"||gA.tagName==="footer"||gA.tagName==="form"||gA.tagName==="h1"||gA.tagName==="h2"||gA.tagName==="h3"||gA.tagName==="h4"||gA.tagName==="h5"||gA.tagName==="h6"||gA.tagName==="header"||gA.tagName==="hgroup"||gA.tagName==="hr"||gA.tagName==="main"||gA.tagName==="menu"||gA.tagName==="nav"||gA.tagName==="ol"||gA.tagName==="p"||gA.tagName==="pre"||gA.tagName==="section"||gA.tagName==="table"||gA.tagName==="ul"):!tA||!(tA.type==="element"&&(tA.tagName==="a"||tA.tagName==="audio"||tA.tagName==="del"||tA.tagName==="ins"||tA.tagName==="map"||tA.tagName==="noscript"||tA.tagName==="video"))}function li(AA,eA,tA){const gA=siblingAfter(tA,eA);return!gA||gA.type==="element"&&gA.tagName==="li"}function dt$1(AA,eA,tA){const gA=siblingAfter(tA,eA);return!!(gA&&gA.type==="element"&&(gA.tagName==="dt"||gA.tagName==="dd"))}function dd(AA,eA,tA){const gA=siblingAfter(tA,eA);return!gA||gA.type==="element"&&(gA.tagName==="dt"||gA.tagName==="dd")}function rubyElement(AA,eA,tA){const gA=siblingAfter(tA,eA);return!gA||gA.type==="element"&&(gA.tagName==="rp"||gA.tagName==="rt")}function optgroup(AA,eA,tA){const gA=siblingAfter(tA,eA);return!gA||gA.type==="element"&&gA.tagName==="optgroup"}function option(AA,eA,tA){const gA=siblingAfter(tA,eA);return!gA||gA.type==="element"&&(gA.tagName==="option"||gA.tagName==="optgroup")}function thead(AA,eA,tA){const gA=siblingAfter(tA,eA);return!!(gA&&gA.type==="element"&&(gA.tagName==="tbody"||gA.tagName==="tfoot"))}function tbody$1(AA,eA,tA){const gA=siblingAfter(tA,eA);return!gA||gA.type==="element"&&(gA.tagName==="tbody"||gA.tagName==="tfoot")}function tfoot(AA,eA,tA){return!siblingAfter(tA,eA)}function tr$2(AA,eA,tA){const gA=siblingAfter(tA,eA);return!gA||gA.type==="element"&&gA.tagName==="tr"}function cells(AA,eA,tA){const gA=siblingAfter(tA,eA);return!gA||gA.type==="element"&&(gA.tagName==="td"||gA.tagName==="th")}const opening=omission({body,colgroup,head,html,tbody});function html(AA){const eA=siblingAfter(AA,-1);return!eA||eA.type!=="comment"}function head(AA){const eA=AA.children,tA=[];let gA=-1;for(;++gA<eA.length;){const iA=eA[gA];if(iA.type==="element"&&(iA.tagName==="title"||iA.tagName==="base")){if(tA.includes(iA.tagName))return!1;tA.push(iA.tagName)}}return eA.length>0}function body(AA){const eA=siblingAfter(AA,-1,!0);return!eA||eA.type!=="comment"&&!(eA.type==="text"&&whitespace(eA.value.charAt(0)))&&!(eA.type==="element"&&(eA.tagName==="meta"||eA.tagName==="link"||eA.tagName==="script"||eA.tagName==="style"||eA.tagName==="template"))}function colgroup(AA,eA,tA){const gA=siblingBefore(tA,eA),iA=siblingAfter(AA,-1,!0);return tA&&gA&&gA.type==="element"&&gA.tagName==="colgroup"&&closing(gA,tA.children.indexOf(gA),tA)?!1:!!(iA&&iA.type==="element"&&iA.tagName==="col")}function tbody(AA,eA,tA){const gA=siblingBefore(tA,eA),iA=siblingAfter(AA,-1);return tA&&gA&&gA.type==="element"&&(gA.tagName==="thead"||gA.tagName==="tbody")&&closing(gA,tA.children.indexOf(gA),tA)?!1:!!(iA&&iA.type==="element"&&iA.tagName==="tr")}const constants$1={name:[[`
456
456
  \f\r &/=>`.split(""),`
package/dist/xmlui.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { B as e, E as o, I as r, A as t, e as p, b as n, S as u, c as l, f as m, p as C, s as c, t as S, h as d, u as A } from "./index-oYnnL7tW.mjs";
1
+ import { B as e, E as o, I as r, A as t, e as p, b as n, S as u, c as l, f as m, p as C, s as c, t as S, h as d, u as A } from "./index-DnAEgnWl.mjs";
2
2
  export {
3
3
  e as Button,
4
4
  o as ErrorBoundary,
package/dist/xmlui.umd.js CHANGED
@@ -83,7 +83,7 @@ ${A.errorObject}`,C=["color: red","color: inherited"]);throw I&&console.log(I,..
83
83
  `&&e.push(d);const c=Ap(l,e).map(d=>`Error at line: ${d.line}, column: ${d.col}:
84
84
  ${d.message}
85
85
  `).join(`
86
- `);throw new Error(c)}return PM(i,o,g,I)}function Ap(A,g){if(g.length===0){for(let I of A)I.line=1,I.col=I.pos+1;return A}for(let I of A){let C=0;for(;C<g.length;++C){const i=g[C];if(I.pos<i){I.line=C+1,I.col=I.pos-(g[C-1]??0)+1;break}}const o=g[g.length-1];I.pos>=o&&(I.line=g.length+1,I.col=I.pos-o+0)}return A}const gp="xmlui",rB="xmlui.xs";function Ip(A,g,I,C){const o=[],i={},l=new Set,e=new Set;if(A&&il(A,null,s,i,I),!i.abort)for(const t of g)c(t.name)||d("M007","Component",t.name),t.name==="Component"&&d("M008","Component",t.name),I.componentRegistered(t.name)&&d("M009","Component",t.name),e.has(t.name)?d("M010","Component",t.name):e.add(t.name),l.clear(),il(t.component,null,s,i,I);return o;function s(t,n,b,m){if(!b)return;if(!I.componentRegistered(t.type)){d("M001",(n==null?void 0:n.type)??"Root",t.type);return}t.uid&&(c(t.uid)?l.has(t.uid)?d("M003",t.type,t.uid):l.add(t.uid):d("M002",t.type,t.type,t.uid));const r=I.getComponentProps(t.type)??{},Z=t.props??{};for(const R of Object.keys(Z))if(r[R]){const y=Z[R];if(typeof y=="string")try{jl(y)}catch(K){d("M006",t.type,R,K.message)}}else{const y=R.split("-");y.length===1&&Zc.includes(R)||y.length===2&&Zc.includes(y[0])&&J1.includes(y[1])||I.acceptArbitraryProps(t.type)||d("M005",t.type,t.type,R)}const G=I.getComponentEvents(t.type)??{},W=t.events??{};for(const R of Object.keys(W))if(G[R]){const y=W[R];if(typeof y=="string"){const K=new po(y);try{K.parseStatements(),K.errors.length>0&&d("M012",t.type,R,K.errors[0].text)}catch(p){d("M012",t.type,R,p.message)}}}else d("M011",t.type,t.type,R);const N=I.getComponentValidator(t.type);if(N){const R=N(t,C);if(R)if(Array.isArray(R))for(const M of R)d("M013",t.type,M);else d("M013",t.type,R)}}function c(t){return/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(t)}function d(t,n,...b){a(t,n,!1,...b)}function a(t,n,b,...m){let r=Cp[t]??"Unkonwn error";m&&m.forEach((G,W)=>r=Z(r,`{${W}}`,m[W].toString())),o.push({name:n,code:t,message:r,isWarning:b,args:m});function Z(G,W,N){do G=G.replace(W,N);while(G.includes(W));return G}}}function il(A,g,I,C={},o){if(I(A,g,!0,C),C.abort||C.cancel)return;const i=o.getComponentProps(A.type)??{},l=A.props??{};for(const c of Object.keys(l)){const d=i[c];if(!d)continue;const a=l[c];if(d.type==="ComponentDef"&&a.type&&(il(a,A,I,C,o),C.abort||C.cancel))return}const e=o.getComponentEvents(A.type)??{},s=A.events??{};for(const c of Object.keys(s)){if(!e[c])continue;const a=s[c];if(typeof a=="object"&&a.type){if(il(a,A,I,C,o),C.abort)return;if(C.cancel)break}}if(A.children)for(const c of A.children){if(il(c,A,I,C,o),C.abort)return;if(C.cancel)break}I(A,void 0,!1,C)}const Cp={M001:"The component '{0}' is not registered",M002:"The '{0}' element has an invalid id: '{1}'",M003:"Invalid component identifier: '{0}'",M004:"Duplicated component identifier: '{0}'",M005:"The '{0}' element has an invalid property: '{1}'",M006:"Parsing property value of '{0}' failed: {1}",M007:"The name of a reusable component is invalid: '{0}'",M008:"The name of a reusable component must not be '{0}', as it is a reserved name",M009:"A reusable component cannot have the name of a registered component: '{0}'",M010:"Duplicated reusable component name: '{0}'",M011:"The '{0}' element has an invalid event: '{1}'",M012:"Parsing event value of '{0}' failed: {1}",M013:"Component validation failed: '{0}'"};function rn({appDef:A,decorateComponentsWithTestId:g,debugEnabled:I=!0,runtime:C,components:o}){const i=w.useMemo(()=>typeof window<"u"&&window.location.href.startsWith("file"),[]),l=ip(A,C);if(lp(l),!l)return null;const{apiInterceptor:e,name:s,globals:c,defaultTheme:d,defaultTone:a,resources:t,resourceMap:n,entryPoint:b,components:m,themes:r,sources:Z}=l,G=e||(typeof window<"u"?window.XMLUI_MOCK_API:void 0);return B.jsx(YM,{interceptor:G,children:B.jsx(en,{servedFromSingleFile:i,decorateComponentsWithTestId:g,node:b,standalone:!0,debugEnabled:I,baseName:typeof window<"u"&&window.__PUBLIC_PATH||"",globalProps:{name:s,...c||{}},defaultTheme:d,defaultTone:a,resources:t,resourceMap:n,sources:Z,contributes:{compoundComponents:m,components:o,themes:r}})})}async function ll(A){if(A.url.toLowerCase().endsWith(".xmlui")){const g=await A.text(),I=A.url;return{component:_e(g,I),src:g,file:I}}if(A.url.toLowerCase().endsWith(".xmlui.xs")){const g=await A.text();new po(g).parseStatements();const C=Fd("Main",g,()=>"");return c2(C),{codeBehind:C,file:A.url}}return{component:await A.json()}}function qe(A,g){return A.endsWith(`/${g}.ts`)||A.endsWith(`/${g}.js`)||A.endsWith(`/${g}.${gp}`)||A.endsWith(`/${g}.${rB}`)}function Zn(A,g){return A.includes(`/${g}/`)}function Gn(A){let g,I,C,o=[],i;const l={},e={},s={};for(const[t,n]of Object.entries(A))qe(t,"config")&&(g=n.default),(qe(t,"Main")||qe(t,"App"))&&(t.endsWith(rB)?C=n.default:(I=n.default.component,n.default.file&&(l[n.default.file]=n.default.src))),qe(t,"api")&&(i=n.default),Zn(t,"components")&&(t.endsWith(rB)?s[t]=n.default:(e[t]=n.default.component,l[n.default.file]=n.default.src)),Zn(t,"themes")&&o.push(n.default);const c=(g==null?void 0:g.entryPoint)||I,d={...c,vars:{...C==null?void 0:C.vars,...c==null?void 0:c.vars},functions:C==null?void 0:C.functions,scriptError:C==null?void 0:C.moduleErrors};let a=[];return g!=null&&g.components?a=g.components:Object.entries(e).forEach(([t,n])=>{const b=s[`${t}.xs`],m={...n,component:{...n.component,vars:{...n.component.vars,...b==null?void 0:b.vars},functions:b==null?void 0:b.functions,scriptError:b==null?void 0:b.moduleErrors}};a.push(m)}),{...g,entryPoint:d,components:a,themes:(g==null?void 0:g.themes)||o,apiInterceptor:(g==null?void 0:g.apiInterceptor)||i,sources:l}}function hn(A,g){return g?{...g,entryPoint:g.entryPoint||A.entryPoint,components:g.components||A.components,themes:g.themes||A.themes,apiInterceptor:g.apiInterceptor||A.apiInterceptor}:A}function op(A,g=XA){if(typeof document<"u"&&document.querySelector('script[type="text/xmlui"]')!==null){let i=null;const l=document.querySelectorAll('script[type="text/xmlui"]'),e=[];for(let n=0;n<l.length;n++){const b=l[n],m=_e(b.textContent);m&&("type"in m&&m.type==="App"?i=m:e.push(m))}if(i===null)throw new Error("No App component specified");const s=document.querySelector('script[type="text/xmlui-config"]'),c=s===null?{}:JSON.parse(s.textContent),d=[];return document.querySelectorAll('script[type="text/xmlui-theme"]').forEach(n=>{d.push(JSON.parse(n.textContent))}),{...c,entryPoint:i,components:e,themes:d}}const C=Gn(g),o=hn(C,A);if((process.env.VITE_DEV_MODE||process.env.VITE_BUILD_MODE==="INLINE_ALL")&&!process.env.VITE_STANDALONE){if(!o)throw new Error("couldn't find the application metadata");return o}return null}function ip(A,g=XA){const[I,C]=w.useState(op(A,g));return UI(()=>{(async function(){var M,y,K;if(document.querySelector('script[type="text/xmlui"]')!==null){let p=null;const Y=document.querySelectorAll('script[type="text/xmlui"]'),Q=[];for(let X=0;X<Y.length;X++){const J=Y[X],k=_e(J.textContent);k&&("type"in k&&k.type==="App"?p=k:Q.push(k))}if(p===null)throw new Error("No App component specified");const E=document.querySelector('script[type="text/xmlui-config"]'),V=E===null?{}:JSON.parse(E.textContent),S=[];document.querySelectorAll('script[type="text/xmlui-theme"]').forEach(X=>{S.push(JSON.parse(X.textContent))});const H={...V,entryPoint:p,components:Q,themes:S};C(H);return}const i=Gn(g),l=hn(i,A);if((process.env.VITE_DEV_MODE||process.env.VITE_BUILD_MODE==="INLINE_ALL")&&!process.env.VITE_STANDALONE){if(!l)throw new Error("couldn't find the application metadata");C(l);return}if(process.env.VITE_BUILD_MODE==="CONFIG_ONLY"){const Y=await(await fetch(fI("config.json"))).json(),Q=[];(M=Y.themes)==null||M.forEach(V=>{Q.push(fetch(fI(V)).then(S=>S.json()))});const E=await Promise.all(Q);C({...l,name:Y.name,globals:Y.globals,defaultTheme:Y.defaultTheme,resources:Y.resources,resourceMap:Y.resourceMap,themes:E});return}const e=fetch(fI("Main.xmlui")).then(p=>ll(p)),s=new Promise(async(p,Y)=>{try{const Q=await fetch(fI("Main.xmlui.xs")),E=await ll(Q);p(E.codeBehind)}catch{p(null)}});let c;try{c=await(await fetch(fI("config.json"))).json()}catch{}const d=(y=c==null?void 0:c.themes)==null?void 0:y.map(p=>fetch(fI(p)).then(Y=>Y.json())),a=(K=c==null?void 0:c.components)==null?void 0:K.map(p=>fetch(fI(p)).then(Y=>ll(Y))),[t,n,b,m]=await Promise.all([e,s,Promise.all(a||[]),Promise.all(d||[])]),r={},Z={};t.file&&(r[t.file]=t.src),b.forEach(p=>{var Y;(Y=p==null?void 0:p.file)!=null&&Y.endsWith(".xmlui.xs")?Z[p.file]=p.codeBehind:p.file&&(r[p.file]=p.src)});const G={...t.component,vars:{...n==null?void 0:n.vars,...t.component.vars},functions:n==null?void 0:n.functions,scriptError:n==null?void 0:n.moduleErrors},W=b.filter(p=>{var Y;return!((Y=p==null?void 0:p.file)!=null&&Y.endsWith(".xmlui.xs"))}).map(p=>{const Y=Z[p.file+".xs"];return{...p.component,component:{...p.component.component,vars:{...p.component.component.vars,...Y==null?void 0:Y.vars},functions:Y==null?void 0:Y.functions,scriptError:Y==null?void 0:Y.moduleErrors}}});let N=un(G,W);const R=new Set;for(;N.size>0;){const p=[...N].map(async Q=>{try{const E=fetch(fI("/components/"+Q+".xmlui")),V=new Promise(async(X,J)=>{try{const U=(await ll(await fetch(fI("/components/"+Q+".xmlui.xs")))).codeBehind;X(U)}catch{X(null)}}),[S,v]=await Promise.all([E,V]),H=await ll(S);return r[H.file]=H.src,{...H.component,component:{...H.component.component,vars:{...H.component.component.vars,...v==null?void 0:v.vars},functions:v==null?void 0:v.functions,scriptError:v==null?void 0:v.moduleErrors}}}catch{return R.add(Q),null}}),Y=await Promise.all(p);W.push(...Y.filter(Q=>!!Q)),N=un(G,W,R)}C({...c,themes:m,sources:r,components:W,entryPoint:G})})()},[g,A]),I}function un(A,g,I=new Set){const C=new wB({compoundComponents:g}),o=Ip(A,g,{getComponentProps:i=>{var l,e;return(e=(l=C.lookupComponentRenderer(i))==null?void 0:l.descriptor)==null?void 0:e.props},acceptArbitraryProps:i=>!0,getComponentValidator:i=>null,getComponentEvents:i=>null,componentRegistered:i=>C.hasComponent(i)});return new Set(o.filter(i=>i.code==="M001").map(i=>i.args[0]).filter(i=>!I.has(i)))}function lp(A){const g=w.useRef(!1);w.useEffect(()=>{A!=null&&A.name&&!g.current&&(console.log(`${A.name} version: `,process.env.VITE_APP_VERSION||"dev"),g.current=!0)},[A==null?void 0:A.name])}let $e=null;function ep(A,g){let I=document.getElementById("root");return I||(I=document.createElement("div"),I.setAttribute("id","root"),document.body.appendChild(I)),$e||($e=ri.createRoot(I)),$e.render(B.jsx(rn,{runtime:A,components:g})),$e}let el=class extends Error{constructor(g){super(g),this.name="ShikiError"}};function sp(A){return ZB(A)}function ZB(A){return Array.isArray(A)?cp(A):typeof A=="object"?Bp(A):A}function cp(A){let g=[];for(let I=0,C=A.length;I<C;I++)g[I]=ZB(A[I]);return g}function Bp(A){let g={};for(let I in A)g[I]=ZB(A[I]);return g}function Dn(A,...g){return g.forEach(I=>{for(let C in I)A[C]=I[C]}),A}function Yn(A){const g=~A.lastIndexOf("/")||~A.lastIndexOf("\\");return g===0?A:~g===A.length-1?Yn(A.substring(0,A.length-1)):A.substr(~g+1)}var GB=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,As=class{static hasCaptures(A){return A===null?!1:(GB.lastIndex=0,GB.test(A))}static replaceCaptures(A,g,I){return A.replace(GB,(C,o,i,l)=>{let e=I[parseInt(o||i,10)];if(e){let s=g.substring(e.start,e.end);for(;s[0]===".";)s=s.substring(1);switch(l){case"downcase":return s.toLowerCase();case"upcase":return s.toUpperCase();default:return s}}else return C})}};function Wn(A,g){return A<g?-1:A>g?1:0}function Nn(A,g){if(A===null&&g===null)return 0;if(!A)return-1;if(!g)return 1;let I=A.length,C=g.length;if(I===C){for(let o=0;o<I;o++){let i=Wn(A[o],g[o]);if(i!==0)return i}return 0}return I-C}function Qn(A){return!!(/^#[0-9a-f]{6}$/i.test(A)||/^#[0-9a-f]{8}$/i.test(A)||/^#[0-9a-f]{3}$/i.test(A)||/^#[0-9a-f]{4}$/i.test(A))}function yn(A){return A.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var Mn=class{constructor(A){this.fn=A,this.cache=new Map}get(A){if(this.cache.has(A))return this.cache.get(A);const g=this.fn(A);return this.cache.set(A,g),g}},gs=class{constructor(A,g,I){this._colorMap=A,this._defaults=g,this._root=I,this._cachedMatchRoot=new Mn(C=>this._root.match(C))}static createFromRawTheme(A,g){return this.createFromParsedTheme(tp(A),g)}static createFromParsedTheme(A,g){return wp(A,g)}getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(A){if(A===null)return this._defaults;const g=A.scopeName,C=this._cachedMatchRoot.get(g).find(o=>dp(A.parent,o.parentScopes));return C?new pn(C.fontStyle,C.foreground,C.background):null}},hB=class Rs{constructor(g,I){this.parent=g,this.scopeName=I}static push(g,I){for(const C of I)g=new Rs(g,C);return g}static from(...g){let I=null;for(let C=0;C<g.length;C++)I=new Rs(I,g[C]);return I}push(g){return new Rs(this,g)}getSegments(){let g=this;const I=[];for(;g;)I.push(g.scopeName),g=g.parent;return I.reverse(),I}toString(){return this.getSegments().join(" ")}extends(g){return this===g?!0:this.parent===null?!1:this.parent.extends(g)}getExtensionIfDefined(g){const I=[];let C=this;for(;C&&C!==g;)I.push(C.scopeName),C=C.parent;return C===g?I.reverse():void 0}};function dp(A,g){if(g.length===0)return!0;for(let I=0;I<g.length;I++){let C=g[I],o=!1;if(C===">"){if(I===g.length-1)return!1;C=g[++I],o=!0}for(;A&&!ap(A.scopeName,C);){if(o)return!1;A=A.parent}if(!A)return!1;A=A.parent}return!0}function ap(A,g){return g===A||A.startsWith(g)&&A[g.length]==="."}var pn=class{constructor(A,g,I){this.fontStyle=A,this.foregroundId=g,this.backgroundId=I}};function tp(A){if(!A)return[];if(!A.settings||!Array.isArray(A.settings))return[];let g=A.settings,I=[],C=0;for(let o=0,i=g.length;o<i;o++){let l=g[o];if(!l.settings)continue;let e;if(typeof l.scope=="string"){let a=l.scope;a=a.replace(/^[,]+/,""),a=a.replace(/[,]+$/,""),e=a.split(",")}else Array.isArray(l.scope)?e=l.scope:e=[""];let s=-1;if(typeof l.settings.fontStyle=="string"){s=0;let a=l.settings.fontStyle.split(" ");for(let t=0,n=a.length;t<n;t++)switch(a[t]){case"italic":s=s|1;break;case"bold":s=s|2;break;case"underline":s=s|4;break;case"strikethrough":s=s|8;break}}let c=null;typeof l.settings.foreground=="string"&&Qn(l.settings.foreground)&&(c=l.settings.foreground);let d=null;typeof l.settings.background=="string"&&Qn(l.settings.background)&&(d=l.settings.background);for(let a=0,t=e.length;a<t;a++){let b=e[a].trim().split(" "),m=b[b.length-1],r=null;b.length>1&&(r=b.slice(0,b.length-1),r.reverse()),I[C++]=new np(m,r,o,s,c,d)}}return I}var np=class{constructor(A,g,I,C,o,i){this.scope=A,this.parentScopes=g,this.index=I,this.fontStyle=C,this.foreground=o,this.background=i}},BC=(A=>(A[A.NotSet=-1]="NotSet",A[A.None=0]="None",A[A.Italic=1]="Italic",A[A.Bold=2]="Bold",A[A.Underline=4]="Underline",A[A.Strikethrough=8]="Strikethrough",A))(BC||{});function wp(A,g){A.sort((s,c)=>{let d=Wn(s.scope,c.scope);return d!==0||(d=Nn(s.parentScopes,c.parentScopes),d!==0)?d:s.index-c.index});let I=0,C="#000000",o="#ffffff";for(;A.length>=1&&A[0].scope==="";){let s=A.shift();s.fontStyle!==-1&&(I=s.fontStyle),s.foreground!==null&&(C=s.foreground),s.background!==null&&(o=s.background)}let i=new bp(g),l=new pn(I,i.getId(C),i.getId(o)),e=new rp(new uB(0,null,-1,0,0),[]);for(let s=0,c=A.length;s<c;s++){let d=A[s];e.insert(0,d.scope,d.parentScopes,d.fontStyle,i.getId(d.foreground),i.getId(d.background))}return new gs(i,l,e)}var bp=class{constructor(A){if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(A)){this._isFrozen=!0;for(let g=0,I=A.length;g<I;g++)this._color2id[A[g]]=g,this._id2color[g]=A[g]}else this._isFrozen=!1}getId(A){if(A===null)return 0;A=A.toUpperCase();let g=this._color2id[A];if(g)return g;if(this._isFrozen)throw new Error(`Missing color in color map - ${A}`);return g=++this._lastColorId,this._color2id[A]=g,this._id2color[g]=A,g}getColorMap(){return this._id2color.slice(0)}},mp=Object.freeze([]),uB=class Rm{constructor(g,I,C,o,i){this.scopeDepth=g,this.parentScopes=I||mp,this.fontStyle=C,this.foreground=o,this.background=i}clone(){return new Rm(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(g){let I=[];for(let C=0,o=g.length;C<o;C++)I[C]=g[C].clone();return I}acceptOverwrite(g,I,C,o){this.scopeDepth>g?console.log("how did this happen?"):this.scopeDepth=g,I!==-1&&(this.fontStyle=I),C!==0&&(this.foreground=C),o!==0&&(this.background=o)}},rp=class G0{constructor(g,I=[],C={}){this._mainRule=g,this._children=C,this._rulesWithParentScopes=I}static _cmpBySpecificity(g,I){if(g.scopeDepth!==I.scopeDepth)return I.scopeDepth-g.scopeDepth;let C=0,o=0;for(;g.parentScopes[C]===">"&&C++,I.parentScopes[o]===">"&&o++,!(C>=g.parentScopes.length||o>=I.parentScopes.length);){const i=I.parentScopes[o].length-g.parentScopes[C].length;if(i!==0)return i;C++,o++}return I.parentScopes.length-g.parentScopes.length}match(g){if(g!==""){let C=g.indexOf("."),o,i;if(C===-1?(o=g,i=""):(o=g.substring(0,C),i=g.substring(C+1)),this._children.hasOwnProperty(o))return this._children[o].match(i)}const I=this._rulesWithParentScopes.concat(this._mainRule);return I.sort(G0._cmpBySpecificity),I}insert(g,I,C,o,i,l){if(I===""){this._doInsertHere(g,C,o,i,l);return}let e=I.indexOf("."),s,c;e===-1?(s=I,c=""):(s=I.substring(0,e),c=I.substring(e+1));let d;this._children.hasOwnProperty(s)?d=this._children[s]:(d=new G0(this._mainRule.clone(),uB.cloneArr(this._rulesWithParentScopes)),this._children[s]=d),d.insert(g+1,c,C,o,i,l)}_doInsertHere(g,I,C,o,i){if(I===null){this._mainRule.acceptOverwrite(g,C,o,i);return}for(let l=0,e=this._rulesWithParentScopes.length;l<e;l++){let s=this._rulesWithParentScopes[l];if(Nn(s.parentScopes,I)===0){s.acceptOverwrite(g,C,o,i);return}}C===-1&&(C=this._mainRule.fontStyle),o===0&&(o=this._mainRule.foreground),i===0&&(i=this._mainRule.background),this._rulesWithParentScopes.push(new uB(g,I,C,o,i))}},to=class XI{static toBinaryStr(g){return g.toString(2).padStart(32,"0")}static print(g){const I=XI.getLanguageId(g),C=XI.getTokenType(g),o=XI.getFontStyle(g),i=XI.getForeground(g),l=XI.getBackground(g);console.log({languageId:I,tokenType:C,fontStyle:o,foreground:i,background:l})}static getLanguageId(g){return(g&255)>>>0}static getTokenType(g){return(g&768)>>>8}static containsBalancedBrackets(g){return(g&1024)!==0}static getFontStyle(g){return(g&30720)>>>11}static getForeground(g){return(g&16744448)>>>15}static getBackground(g){return(g&4278190080)>>>24}static set(g,I,C,o,i,l,e){let s=XI.getLanguageId(g),c=XI.getTokenType(g),d=XI.containsBalancedBrackets(g)?1:0,a=XI.getFontStyle(g),t=XI.getForeground(g),n=XI.getBackground(g);return I!==0&&(s=I),C!==8&&(c=C),o!==null&&(d=o?1:0),i!==-1&&(a=i),l!==0&&(t=l),e!==0&&(n=e),(s<<0|c<<8|d<<10|a<<11|t<<15|n<<24)>>>0}};function TT(A){return A}function vT(A){return A}function Is(A,g){const I=[],C=Zp(A);let o=C.next();for(;o!==null;){let s=0;if(o.length===2&&o.charAt(1)===":"){switch(o.charAt(0)){case"R":s=1;break;case"L":s=-1;break;default:console.log(`Unknown priority ${o} in scope selector`)}o=C.next()}let c=l();if(I.push({matcher:c,priority:s}),o!==",")break;o=C.next()}return I;function i(){if(o==="-"){o=C.next();const s=i();return c=>!!s&&!s(c)}if(o==="("){o=C.next();const s=e();return o===")"&&(o=C.next()),s}if(Vn(o)){const s=[];do s.push(o),o=C.next();while(Vn(o));return c=>g(s,c)}return null}function l(){const s=[];let c=i();for(;c;)s.push(c),c=i();return d=>s.every(a=>a(d))}function e(){const s=[];let c=l();for(;c&&(s.push(c),o==="|"||o===",");){do o=C.next();while(o==="|"||o===",");c=l()}return d=>s.some(a=>a(d))}}function Vn(A){return!!A&&!!A.match(/[\w\.:]+/)}function Zp(A){let g=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,I=g.exec(A);return{next:()=>{if(!I)return null;const C=I[0];return I=g.exec(A),C}}}function Rn(A){typeof A.dispose=="function"&&A.dispose()}var sl=class{constructor(A){this.scopeName=A}toKey(){return this.scopeName}},Gp=class{constructor(A,g){this.scopeName=A,this.ruleName=g}toKey(){return`${this.scopeName}#${this.ruleName}`}},hp=class{constructor(){this._references=[],this._seenReferenceKeys=new Set,this.visitedRule=new Set}get references(){return this._references}add(A){const g=A.toKey();this._seenReferenceKeys.has(g)||(this._seenReferenceKeys.add(g),this._references.push(A))}},up=class{constructor(A,g){this.repo=A,this.initialScopeName=g,this.seenFullScopeRequests=new Set,this.seenPartialScopeRequests=new Set,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new sl(this.initialScopeName)]}processQueue(){const A=this.Q;this.Q=[];const g=new hp;for(const I of A)Dp(I,this.initialScopeName,this.repo,g);for(const I of g.references)if(I instanceof sl){if(this.seenFullScopeRequests.has(I.scopeName))continue;this.seenFullScopeRequests.add(I.scopeName),this.Q.push(I)}else{if(this.seenFullScopeRequests.has(I.scopeName)||this.seenPartialScopeRequests.has(I.toKey()))continue;this.seenPartialScopeRequests.add(I.toKey()),this.Q.push(I)}}};function Dp(A,g,I,C){const o=I.lookup(A.scopeName);if(!o){if(A.scopeName===g)throw new Error(`No grammar provided for <${g}>`);return}const i=I.lookup(g);A instanceof sl?Cs({baseGrammar:i,selfGrammar:o},C):DB(A.ruleName,{baseGrammar:i,selfGrammar:o,repository:o.repository},C);const l=I.injections(A.scopeName);if(l)for(const e of l)C.add(new sl(e))}function DB(A,g,I){if(g.repository&&g.repository[A]){const C=g.repository[A];os([C],g,I)}}function Cs(A,g){A.selfGrammar.patterns&&Array.isArray(A.selfGrammar.patterns)&&os(A.selfGrammar.patterns,{...A,repository:A.selfGrammar.repository},g),A.selfGrammar.injections&&os(Object.values(A.selfGrammar.injections),{...A,repository:A.selfGrammar.repository},g)}function os(A,g,I){for(const C of A){if(I.visitedRule.has(C))continue;I.visitedRule.add(C);const o=C.repository?Dn({},g.repository,C.repository):g.repository;Array.isArray(C.patterns)&&os(C.patterns,{...g,repository:o},I);const i=C.include;if(!i)continue;const l=Kn(i);switch(l.kind){case 0:Cs({...g,selfGrammar:g.baseGrammar},I);break;case 1:Cs(g,I);break;case 2:DB(l.ruleName,{...g,repository:o},I);break;case 3:case 4:const e=l.scopeName===g.selfGrammar.scopeName?g.selfGrammar:l.scopeName===g.baseGrammar.scopeName?g.baseGrammar:void 0;if(e){const s={baseGrammar:g.baseGrammar,selfGrammar:e,repository:o};l.kind===4?DB(l.ruleName,s,I):Cs(s,I)}else l.kind===4?I.add(new Gp(l.scopeName,l.ruleName)):I.add(new sl(l.scopeName));break}}}var Yp=class{constructor(){this.kind=0}},Wp=class{constructor(){this.kind=1}},Np=class{constructor(A){this.ruleName=A,this.kind=2}},Qp=class{constructor(A){this.scopeName=A,this.kind=3}},yp=class{constructor(A,g){this.scopeName=A,this.ruleName=g,this.kind=4}};function Kn(A){if(A==="$base")return new Yp;if(A==="$self")return new Wp;const g=A.indexOf("#");if(g===-1)return new Qp(A);if(g===0)return new Np(A.substring(1));{const I=A.substring(0,g),C=A.substring(g+1);return new yp(I,C)}}var Mp=/\\(\d+)/,Xn=/\\(\d+)/g,pp=-1,En=-2;function fT(A){return A}function UT(A){return A}var cl=class{constructor(A,g,I,C){this.$location=A,this.id=g,this._name=I||null,this._nameIsCapturing=As.hasCaptures(this._name),this._contentName=C||null,this._contentNameIsCapturing=As.hasCaptures(this._contentName)}get debugName(){const A=this.$location?`${Yn(this.$location.filename)}:${this.$location.line}`:"unknown";return`${this.constructor.name}#${this.id} @ ${A}`}getName(A,g){return!this._nameIsCapturing||this._name===null||A===null||g===null?this._name:As.replaceCaptures(this._name,A,g)}getContentName(A,g){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:As.replaceCaptures(this._contentName,A,g)}},Vp=class extends cl{constructor(A,g,I,C,o){super(A,g,I,C),this.retokenizeCapturedWithRuleId=o}dispose(){}collectPatterns(A,g){throw new Error("Not supported!")}compile(A,g){throw new Error("Not supported!")}compileAG(A,g,I,C){throw new Error("Not supported!")}},Rp=class extends cl{constructor(A,g,I,C,o){super(A,g,I,null),this._match=new Bl(C,this.id),this.captures=o,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(A,g){g.push(this._match)}compile(A,g){return this._getCachedCompiledPatterns(A).compile(A)}compileAG(A,g,I,C){return this._getCachedCompiledPatterns(A).compileAG(A,I,C)}_getCachedCompiledPatterns(A){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new dl,this.collectPatterns(A,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Hn=class extends cl{constructor(A,g,I,C,o){super(A,g,I,C),this.patterns=o.patterns,this.hasMissingPatterns=o.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}collectPatterns(A,g){for(const I of this.patterns)A.getRule(I).collectPatterns(A,g)}compile(A,g){return this._getCachedCompiledPatterns(A).compile(A)}compileAG(A,g,I,C){return this._getCachedCompiledPatterns(A).compileAG(A,I,C)}_getCachedCompiledPatterns(A){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new dl,this.collectPatterns(A,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},YB=class extends cl{constructor(A,g,I,C,o,i,l,e,s,c){super(A,g,I,C),this._begin=new Bl(o,this.id),this.beginCaptures=i,this._end=new Bl(l||"￿",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=e,this.applyEndPatternLast=s||!1,this.patterns=c.patterns,this.hasMissingPatterns=c.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(A,g){return this._end.resolveBackReferences(A,g)}collectPatterns(A,g){g.push(this._begin)}compile(A,g){return this._getCachedCompiledPatterns(A,g).compile(A)}compileAG(A,g,I,C){return this._getCachedCompiledPatterns(A,g).compileAG(A,I,C)}_getCachedCompiledPatterns(A,g){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new dl;for(const I of this.patterns)A.getRule(I).collectPatterns(A,this._cachedCompiledPatterns);this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,g):this._cachedCompiledPatterns.setSource(0,g)),this._cachedCompiledPatterns}},is=class extends cl{constructor(A,g,I,C,o,i,l,e,s){super(A,g,I,C),this._begin=new Bl(o,this.id),this.beginCaptures=i,this.whileCaptures=e,this._while=new Bl(l,En),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=s.patterns,this.hasMissingPatterns=s.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null),this._cachedCompiledWhilePatterns&&(this._cachedCompiledWhilePatterns.dispose(),this._cachedCompiledWhilePatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(A,g){return this._while.resolveBackReferences(A,g)}collectPatterns(A,g){g.push(this._begin)}compile(A,g){return this._getCachedCompiledPatterns(A).compile(A)}compileAG(A,g,I,C){return this._getCachedCompiledPatterns(A).compileAG(A,I,C)}_getCachedCompiledPatterns(A){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new dl;for(const g of this.patterns)A.getRule(g).collectPatterns(A,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(A,g){return this._getCachedCompiledWhilePatterns(A,g).compile(A)}compileWhileAG(A,g,I,C){return this._getCachedCompiledWhilePatterns(A,g).compileAG(A,I,C)}_getCachedCompiledWhilePatterns(A,g){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new dl,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,g||"￿"),this._cachedCompiledWhilePatterns}},Sn=class jg{static createCaptureRule(g,I,C,o,i){return g.registerRule(l=>new Vp(I,l,C,o,i))}static getCompiledRuleId(g,I,C){return g.id||I.registerRule(o=>{if(g.id=o,g.match)return new Rp(g.$vscodeTextmateLocation,g.id,g.name,g.match,jg._compileCaptures(g.captures,I,C));if(typeof g.begin>"u"){g.repository&&(C=Dn({},C,g.repository));let i=g.patterns;return typeof i>"u"&&g.include&&(i=[{include:g.include}]),new Hn(g.$vscodeTextmateLocation,g.id,g.name,g.contentName,jg._compilePatterns(i,I,C))}return g.while?new is(g.$vscodeTextmateLocation,g.id,g.name,g.contentName,g.begin,jg._compileCaptures(g.beginCaptures||g.captures,I,C),g.while,jg._compileCaptures(g.whileCaptures||g.captures,I,C),jg._compilePatterns(g.patterns,I,C)):new YB(g.$vscodeTextmateLocation,g.id,g.name,g.contentName,g.begin,jg._compileCaptures(g.beginCaptures||g.captures,I,C),g.end,jg._compileCaptures(g.endCaptures||g.captures,I,C),g.applyEndPatternLast,jg._compilePatterns(g.patterns,I,C))}),g.id}static _compileCaptures(g,I,C){let o=[];if(g){let i=0;for(const l in g){if(l==="$vscodeTextmateLocation")continue;const e=parseInt(l,10);e>i&&(i=e)}for(let l=0;l<=i;l++)o[l]=null;for(const l in g){if(l==="$vscodeTextmateLocation")continue;const e=parseInt(l,10);let s=0;g[l].patterns&&(s=jg.getCompiledRuleId(g[l],I,C)),o[e]=jg.createCaptureRule(I,g[l].$vscodeTextmateLocation,g[l].name,g[l].contentName,s)}}return o}static _compilePatterns(g,I,C){let o=[];if(g)for(let i=0,l=g.length;i<l;i++){const e=g[i];let s=-1;if(e.include){const c=Kn(e.include);switch(c.kind){case 0:case 1:s=jg.getCompiledRuleId(C[e.include],I,C);break;case 2:let d=C[c.ruleName];d&&(s=jg.getCompiledRuleId(d,I,C));break;case 3:case 4:const a=c.scopeName,t=c.kind===4?c.ruleName:null,n=I.getExternalGrammar(a,C);if(n)if(t){let b=n.repository[t];b&&(s=jg.getCompiledRuleId(b,I,n.repository))}else s=jg.getCompiledRuleId(n.repository.$self,I,n.repository);break}}else s=jg.getCompiledRuleId(e,I,C);if(s!==-1){const c=I.getRule(s);let d=!1;if((c instanceof Hn||c instanceof YB||c instanceof is)&&c.hasMissingPatterns&&c.patterns.length===0&&(d=!0),d)continue;o.push(s)}}return{patterns:o,hasMissingPatterns:(g?g.length:0)!==o.length}}},Bl=class Km{constructor(g,I){if(g){const C=g.length;let o=0,i=[],l=!1;for(let e=0;e<C;e++)if(g.charAt(e)==="\\"&&e+1<C){const c=g.charAt(e+1);c==="z"?(i.push(g.substring(o,e)),i.push("$(?!\\n)(?<!\\n)"),o=e+2):(c==="A"||c==="G")&&(l=!0),e++}this.hasAnchor=l,o===0?this.source=g:(i.push(g.substring(o,C)),this.source=i.join(""))}else this.hasAnchor=!1,this.source=g;this.hasAnchor?this._anchorCache=this._buildAnchorCache():this._anchorCache=null,this.ruleId=I,this.hasBackReferences=Mp.test(this.source)}clone(){return new Km(this.source,this.ruleId)}setSource(g){this.source!==g&&(this.source=g,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(g,I){let C=I.map(o=>g.substring(o.start,o.end));return Xn.lastIndex=0,this.source.replace(Xn,(o,i)=>yn(C[parseInt(i,10)]||""))}_buildAnchorCache(){let g=[],I=[],C=[],o=[],i,l,e,s;for(i=0,l=this.source.length;i<l;i++)e=this.source.charAt(i),g[i]=e,I[i]=e,C[i]=e,o[i]=e,e==="\\"&&i+1<l&&(s=this.source.charAt(i+1),s==="A"?(g[i+1]="￿",I[i+1]="￿",C[i+1]="A",o[i+1]="A"):s==="G"?(g[i+1]="￿",I[i+1]="G",C[i+1]="￿",o[i+1]="G"):(g[i+1]=s,I[i+1]=s,C[i+1]=s,o[i+1]=s),i++);return{A0_G0:g.join(""),A0_G1:I.join(""),A1_G0:C.join(""),A1_G1:o.join("")}}resolveAnchors(g,I){return!this.hasAnchor||!this._anchorCache?this.source:g?I?this._anchorCache.A1_G1:this._anchorCache.A1_G0:I?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},dl=class{constructor(){this._items=[],this._hasAnchors=!1,this._cached=null,this._anchorCache={A0_G0:null,A0_G1:null,A1_G0:null,A1_G1:null}}dispose(){this._disposeCaches()}_disposeCaches(){this._cached&&(this._cached.dispose(),this._cached=null),this._anchorCache.A0_G0&&(this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null),this._anchorCache.A0_G1&&(this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null),this._anchorCache.A1_G0&&(this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null),this._anchorCache.A1_G1&&(this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null)}push(A){this._items.push(A),this._hasAnchors=this._hasAnchors||A.hasAnchor}unshift(A){this._items.unshift(A),this._hasAnchors=this._hasAnchors||A.hasAnchor}length(){return this._items.length}setSource(A,g){this._items[A].source!==g&&(this._disposeCaches(),this._items[A].setSource(g))}compile(A){if(!this._cached){let g=this._items.map(I=>I.source);this._cached=new Fn(A,g,this._items.map(I=>I.ruleId))}return this._cached}compileAG(A,g,I){return this._hasAnchors?g?I?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(A,g,I)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(A,g,I)),this._anchorCache.A1_G0):I?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(A,g,I)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(A,g,I)),this._anchorCache.A0_G0):this.compile(A)}_resolveAnchors(A,g,I){let C=this._items.map(o=>o.resolveAnchors(g,I));return new Fn(A,C,this._items.map(o=>o.ruleId))}},Fn=class{constructor(A,g,I){this.regExps=g,this.rules=I,this.scanner=A.createOnigScanner(g)}dispose(){typeof this.scanner.dispose=="function"&&this.scanner.dispose()}toString(){const A=[];for(let g=0,I=this.rules.length;g<I;g++)A.push(" - "+this.rules[g]+": "+this.regExps[g]);return A.join(`
86
+ `);throw new Error(c)}return PM(i,o,g,I)}function Ap(A,g){if(g.length===0){for(let I of A)I.line=1,I.col=I.pos+1;return A}for(let I of A){let C=0;for(;C<g.length;++C){const i=g[C];if(I.pos<i){I.line=C+1,I.col=I.pos-(g[C-1]??0)+1;break}}const o=g[g.length-1];I.pos>=o&&(I.line=g.length+1,I.col=I.pos-o+0)}return A}const gp="xmlui",rB="xmlui.xs";function Ip(A,g,I,C){const o=[],i={},l=new Set,e=new Set;if(A&&il(A,null,s,i,I),!i.abort)for(const t of g)c(t.name)||d("M007","Component",t.name),t.name==="Component"&&d("M008","Component",t.name),I.componentRegistered(t.name)&&d("M009","Component",t.name),e.has(t.name)?d("M010","Component",t.name):e.add(t.name),l.clear(),il(t.component,null,s,i,I);return o;function s(t,n,b,m){if(!b)return;if(!I.componentRegistered(t.type)){d("M001",(n==null?void 0:n.type)??"Root",t.type);return}t.uid&&(c(t.uid)?l.has(t.uid)?d("M003",t.type,t.uid):l.add(t.uid):d("M002",t.type,t.type,t.uid));const r=I.getComponentProps(t.type)??{},Z=t.props??{};for(const R of Object.keys(Z))if(r[R]){const y=Z[R];if(typeof y=="string")try{jl(y)}catch(K){d("M006",t.type,R,K.message)}}else{const y=R.split("-");y.length===1&&Zc.includes(R)||y.length===2&&Zc.includes(y[0])&&J1.includes(y[1])||I.acceptArbitraryProps(t.type)||d("M005",t.type,t.type,R)}const G=I.getComponentEvents(t.type)??{},W=t.events??{};for(const R of Object.keys(W))if(G[R]){const y=W[R];if(typeof y=="string"){const K=new po(y);try{K.parseStatements(),K.errors.length>0&&d("M012",t.type,R,K.errors[0].text)}catch(p){d("M012",t.type,R,p.message)}}}else d("M011",t.type,t.type,R);const N=I.getComponentValidator(t.type);if(N){const R=N(t,C);if(R)if(Array.isArray(R))for(const M of R)d("M013",t.type,M);else d("M013",t.type,R)}}function c(t){return/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(t)}function d(t,n,...b){a(t,n,!1,...b)}function a(t,n,b,...m){let r=Cp[t]??"Unkonwn error";m&&m.forEach((G,W)=>r=Z(r,`{${W}}`,m[W].toString())),o.push({name:n,code:t,message:r,isWarning:b,args:m});function Z(G,W,N){do G=G.replace(W,N);while(G.includes(W));return G}}}function il(A,g,I,C={},o){if(I(A,g,!0,C),C.abort||C.cancel)return;const i=o.getComponentProps(A.type)??{},l=A.props??{};for(const c of Object.keys(l)){const d=i[c];if(!d)continue;const a=l[c];if(d.type==="ComponentDef"&&a.type&&(il(a,A,I,C,o),C.abort||C.cancel))return}const e=o.getComponentEvents(A.type)??{},s=A.events??{};for(const c of Object.keys(s)){if(!e[c])continue;const a=s[c];if(typeof a=="object"&&a.type){if(il(a,A,I,C,o),C.abort)return;if(C.cancel)break}}if(A.children)for(const c of A.children){if(il(c,A,I,C,o),C.abort)return;if(C.cancel)break}I(A,void 0,!1,C)}const Cp={M001:"The component '{0}' is not registered",M002:"The '{0}' element has an invalid id: '{1}'",M003:"Invalid component identifier: '{0}'",M004:"Duplicated component identifier: '{0}'",M005:"The '{0}' element has an invalid property: '{1}'",M006:"Parsing property value of '{0}' failed: {1}",M007:"The name of a reusable component is invalid: '{0}'",M008:"The name of a reusable component must not be '{0}', as it is a reserved name",M009:"A reusable component cannot have the name of a registered component: '{0}'",M010:"Duplicated reusable component name: '{0}'",M011:"The '{0}' element has an invalid event: '{1}'",M012:"Parsing event value of '{0}' failed: {1}",M013:"Component validation failed: '{0}'"};function rn({appDef:A,decorateComponentsWithTestId:g,debugEnabled:I=!0,runtime:C,components:o}){const i=w.useMemo(()=>typeof window<"u"&&window.location.href.startsWith("file"),[]),l=ip(A,C);if(lp(l),!l)return null;const{apiInterceptor:e,name:s,globals:c,defaultTheme:d,defaultTone:a,resources:t,resourceMap:n,entryPoint:b,components:m,themes:r,sources:Z}=l,G=e||(typeof window<"u"?window.XMLUI_MOCK_API:void 0);return B.jsx(YM,{interceptor:G,children:B.jsx(en,{servedFromSingleFile:i,decorateComponentsWithTestId:g,node:b,standalone:!0,debugEnabled:I,baseName:typeof window<"u"&&window.__PUBLIC_PATH||"",globalProps:{name:s,...c||{}},defaultTheme:d,defaultTone:a,resources:t,resourceMap:n,sources:Z,contributes:{compoundComponents:m,components:o,themes:r}})})}async function ll(A){if(A.url.toLowerCase().endsWith(".xmlui")){const g=await A.text(),I=A.url;return{component:_e(g,I),src:g,file:I}}if(A.url.toLowerCase().endsWith(".xmlui.xs")){const g=await A.text();new po(g).parseStatements();const C=Fd("Main",g,()=>"");return c2(C),{codeBehind:C,file:A.url}}return{component:await A.json()}}function qe(A,g){return A.endsWith(`/${g}.ts`)||A.endsWith(`/${g}.js`)||A.endsWith(`/${g}.${gp}`)||A.endsWith(`/${g}.${rB}`)}function Zn(A,g){return A.includes(`/${g}/`)}function Gn(A){let g,I,C,o=[],i;const l={},e={},s={};for(const[t,n]of Object.entries(A))qe(t,"config")&&(g=n.default),(qe(t,"Main")||qe(t,"App"))&&(t.endsWith(rB)?C=n.default:(I=n.default.component,n.default.file&&(l[n.default.file]=n.default.src))),qe(t,"api")&&(i=n.default),Zn(t,"components")&&(t.endsWith(rB)?s[t]=n.default:(e[t]=n.default.component,l[n.default.file]=n.default.src)),Zn(t,"themes")&&o.push(n.default);const c=(g==null?void 0:g.entryPoint)||I,d={...c,vars:{...C==null?void 0:C.vars,...c==null?void 0:c.vars},functions:C==null?void 0:C.functions,scriptError:C==null?void 0:C.moduleErrors};let a=[];return g!=null&&g.components?a=g.components:Object.entries(e).forEach(([t,n])=>{const b=s[`${t}.xs`],m={...n,component:{...n.component,vars:{...n.component.vars,...b==null?void 0:b.vars},functions:b==null?void 0:b.functions,scriptError:b==null?void 0:b.moduleErrors}};a.push(m)}),{...g,entryPoint:d,components:a,themes:(g==null?void 0:g.themes)||o,apiInterceptor:(g==null?void 0:g.apiInterceptor)||i,sources:l}}function hn(A,g){return g?{...g,entryPoint:g.entryPoint||A.entryPoint,components:g.components||A.components,themes:g.themes||A.themes,apiInterceptor:g.apiInterceptor||A.apiInterceptor}:A}function op(A,g=XA){if(typeof document<"u"&&document.querySelector('script[type="text/xmlui"]')!==null){let i=null;const l=document.querySelectorAll('script[type="text/xmlui"]'),e=[];for(let n=0;n<l.length;n++){const b=l[n],m=_e(b.textContent);m&&("type"in m&&m.type==="App"?i=m:e.push(m))}if(i===null)throw new Error("No App component specified");const s=document.querySelector('script[type="text/xmlui-config"]'),c=s===null?{}:JSON.parse(s.textContent),d=[];return document.querySelectorAll('script[type="text/xmlui-theme"]').forEach(n=>{d.push(JSON.parse(n.textContent))}),{...c,entryPoint:i,components:e,themes:d}}const C=Gn(g),o=hn(C,A);if((process.env.VITE_DEV_MODE||process.env.VITE_BUILD_MODE==="INLINE_ALL")&&!process.env.VITE_STANDALONE){if(!o)throw new Error("couldn't find the application metadata");return o}return null}function ip(A,g=XA){const[I,C]=w.useState(op(A,g));return UI(()=>{(async function(){var M,y,K;if(document.querySelector('script[type="text/xmlui"]')!==null){let p=null;const Y=document.querySelectorAll('script[type="text/xmlui"]'),Q=[];for(let X=0;X<Y.length;X++){const J=Y[X],k=_e(J.textContent);k&&("type"in k&&k.type==="App"?p=k:Q.push(k))}if(p===null)throw new Error("No App component specified");const E=document.querySelector('script[type="text/xmlui-config"]'),V=E===null?{}:JSON.parse(E.textContent),S=[];document.querySelectorAll('script[type="text/xmlui-theme"]').forEach(X=>{S.push(JSON.parse(X.textContent))});const H={...V,entryPoint:p,components:Q,themes:S};C(H);return}const i=Gn(g),l=hn(i,A);if((process.env.VITE_DEV_MODE||process.env.VITE_BUILD_MODE==="INLINE_ALL")&&!process.env.VITE_STANDALONE){if(!l)throw new Error("couldn't find the application metadata");C(l);return}if(process.env.VITE_BUILD_MODE==="CONFIG_ONLY"){const Y=await(await fetch(fI("config.json"),{headers:{"Cache-Control":"no-cache, no-store"}})).json(),Q=[];(M=Y.themes)==null||M.forEach(V=>{Q.push(fetch(fI(V),{headers:{"Cache-Control":"no-cache, no-store"}}).then(S=>S.json()))});const E=await Promise.all(Q);C({...l,name:Y.name,globals:Y.globals,defaultTheme:Y.defaultTheme,resources:Y.resources,resourceMap:Y.resourceMap,themes:E});return}const e=fetch(fI("Main.xmlui"),{headers:{"Cache-Control":"no-cache, no-store"}}).then(p=>ll(p)),s=new Promise(async(p,Y)=>{try{const Q=await fetch(fI("Main.xmlui.xs"),{headers:{"Cache-Control":"no-cache, no-store"}}),E=await ll(Q);p(E.codeBehind)}catch{p(null)}});let c;try{c=await(await fetch(fI("config.json"),{headers:{"Cache-Control":"no-cache, no-store"}})).json()}catch{}const d=(y=c==null?void 0:c.themes)==null?void 0:y.map(p=>fetch(fI(p),{headers:{"Cache-Control":"no-cache, no-store"}}).then(Y=>Y.json())),a=(K=c==null?void 0:c.components)==null?void 0:K.map(p=>fetch(fI(p),{headers:{"Cache-Control":"no-cache, no-store"}}).then(Y=>ll(Y))),[t,n,b,m]=await Promise.all([e,s,Promise.all(a||[]),Promise.all(d||[])]),r={},Z={};t.file&&(r[t.file]=t.src),b.forEach(p=>{var Y;(Y=p==null?void 0:p.file)!=null&&Y.endsWith(".xmlui.xs")?Z[p.file]=p.codeBehind:p.file&&(r[p.file]=p.src)});const G={...t.component,vars:{...n==null?void 0:n.vars,...t.component.vars},functions:n==null?void 0:n.functions,scriptError:n==null?void 0:n.moduleErrors},W=b.filter(p=>{var Y;return!((Y=p==null?void 0:p.file)!=null&&Y.endsWith(".xmlui.xs"))}).map(p=>{const Y=Z[p.file+".xs"];return{...p.component,component:{...p.component.component,vars:{...p.component.component.vars,...Y==null?void 0:Y.vars},functions:Y==null?void 0:Y.functions,scriptError:Y==null?void 0:Y.moduleErrors}}});let N=un(G,W);const R=new Set;for(;N.size>0;){const p=[...N].map(async Q=>{try{const E=fetch(fI("/components/"+Q+".xmlui"),{headers:{"Cache-Control":"no-cache, no-store"}}),V=new Promise(async(X,J)=>{try{const U=(await ll(await fetch(fI("/components/"+Q+".xmlui.xs"),{headers:{"Cache-Control":"no-cache, no-store"}}))).codeBehind;X(U)}catch{X(null)}}),[S,v]=await Promise.all([E,V]),H=await ll(S);return r[H.file]=H.src,{...H.component,component:{...H.component.component,vars:{...H.component.component.vars,...v==null?void 0:v.vars},functions:v==null?void 0:v.functions,scriptError:v==null?void 0:v.moduleErrors}}}catch{return R.add(Q),null}}),Y=await Promise.all(p);W.push(...Y.filter(Q=>!!Q)),N=un(G,W,R)}C({...c,themes:m,sources:r,components:W,entryPoint:G})})()},[g,A]),I}function un(A,g,I=new Set){const C=new wB({compoundComponents:g}),o=Ip(A,g,{getComponentProps:i=>{var l,e;return(e=(l=C.lookupComponentRenderer(i))==null?void 0:l.descriptor)==null?void 0:e.props},acceptArbitraryProps:i=>!0,getComponentValidator:i=>null,getComponentEvents:i=>null,componentRegistered:i=>C.hasComponent(i)});return new Set(o.filter(i=>i.code==="M001").map(i=>i.args[0]).filter(i=>!I.has(i)))}function lp(A){const g=w.useRef(!1);w.useEffect(()=>{A!=null&&A.name&&!g.current&&(console.log(`${A.name} version: `,process.env.VITE_APP_VERSION||"dev"),g.current=!0)},[A==null?void 0:A.name])}let $e=null;function ep(A,g){let I=document.getElementById("root");return I||(I=document.createElement("div"),I.setAttribute("id","root"),document.body.appendChild(I)),$e||($e=ri.createRoot(I)),$e.render(B.jsx(rn,{runtime:A,components:g})),$e}let el=class extends Error{constructor(g){super(g),this.name="ShikiError"}};function sp(A){return ZB(A)}function ZB(A){return Array.isArray(A)?cp(A):typeof A=="object"?Bp(A):A}function cp(A){let g=[];for(let I=0,C=A.length;I<C;I++)g[I]=ZB(A[I]);return g}function Bp(A){let g={};for(let I in A)g[I]=ZB(A[I]);return g}function Dn(A,...g){return g.forEach(I=>{for(let C in I)A[C]=I[C]}),A}function Yn(A){const g=~A.lastIndexOf("/")||~A.lastIndexOf("\\");return g===0?A:~g===A.length-1?Yn(A.substring(0,A.length-1)):A.substr(~g+1)}var GB=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,As=class{static hasCaptures(A){return A===null?!1:(GB.lastIndex=0,GB.test(A))}static replaceCaptures(A,g,I){return A.replace(GB,(C,o,i,l)=>{let e=I[parseInt(o||i,10)];if(e){let s=g.substring(e.start,e.end);for(;s[0]===".";)s=s.substring(1);switch(l){case"downcase":return s.toLowerCase();case"upcase":return s.toUpperCase();default:return s}}else return C})}};function Wn(A,g){return A<g?-1:A>g?1:0}function Nn(A,g){if(A===null&&g===null)return 0;if(!A)return-1;if(!g)return 1;let I=A.length,C=g.length;if(I===C){for(let o=0;o<I;o++){let i=Wn(A[o],g[o]);if(i!==0)return i}return 0}return I-C}function Qn(A){return!!(/^#[0-9a-f]{6}$/i.test(A)||/^#[0-9a-f]{8}$/i.test(A)||/^#[0-9a-f]{3}$/i.test(A)||/^#[0-9a-f]{4}$/i.test(A))}function yn(A){return A.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var Mn=class{constructor(A){this.fn=A,this.cache=new Map}get(A){if(this.cache.has(A))return this.cache.get(A);const g=this.fn(A);return this.cache.set(A,g),g}},gs=class{constructor(A,g,I){this._colorMap=A,this._defaults=g,this._root=I,this._cachedMatchRoot=new Mn(C=>this._root.match(C))}static createFromRawTheme(A,g){return this.createFromParsedTheme(tp(A),g)}static createFromParsedTheme(A,g){return wp(A,g)}getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(A){if(A===null)return this._defaults;const g=A.scopeName,C=this._cachedMatchRoot.get(g).find(o=>dp(A.parent,o.parentScopes));return C?new pn(C.fontStyle,C.foreground,C.background):null}},hB=class Rs{constructor(g,I){this.parent=g,this.scopeName=I}static push(g,I){for(const C of I)g=new Rs(g,C);return g}static from(...g){let I=null;for(let C=0;C<g.length;C++)I=new Rs(I,g[C]);return I}push(g){return new Rs(this,g)}getSegments(){let g=this;const I=[];for(;g;)I.push(g.scopeName),g=g.parent;return I.reverse(),I}toString(){return this.getSegments().join(" ")}extends(g){return this===g?!0:this.parent===null?!1:this.parent.extends(g)}getExtensionIfDefined(g){const I=[];let C=this;for(;C&&C!==g;)I.push(C.scopeName),C=C.parent;return C===g?I.reverse():void 0}};function dp(A,g){if(g.length===0)return!0;for(let I=0;I<g.length;I++){let C=g[I],o=!1;if(C===">"){if(I===g.length-1)return!1;C=g[++I],o=!0}for(;A&&!ap(A.scopeName,C);){if(o)return!1;A=A.parent}if(!A)return!1;A=A.parent}return!0}function ap(A,g){return g===A||A.startsWith(g)&&A[g.length]==="."}var pn=class{constructor(A,g,I){this.fontStyle=A,this.foregroundId=g,this.backgroundId=I}};function tp(A){if(!A)return[];if(!A.settings||!Array.isArray(A.settings))return[];let g=A.settings,I=[],C=0;for(let o=0,i=g.length;o<i;o++){let l=g[o];if(!l.settings)continue;let e;if(typeof l.scope=="string"){let a=l.scope;a=a.replace(/^[,]+/,""),a=a.replace(/[,]+$/,""),e=a.split(",")}else Array.isArray(l.scope)?e=l.scope:e=[""];let s=-1;if(typeof l.settings.fontStyle=="string"){s=0;let a=l.settings.fontStyle.split(" ");for(let t=0,n=a.length;t<n;t++)switch(a[t]){case"italic":s=s|1;break;case"bold":s=s|2;break;case"underline":s=s|4;break;case"strikethrough":s=s|8;break}}let c=null;typeof l.settings.foreground=="string"&&Qn(l.settings.foreground)&&(c=l.settings.foreground);let d=null;typeof l.settings.background=="string"&&Qn(l.settings.background)&&(d=l.settings.background);for(let a=0,t=e.length;a<t;a++){let b=e[a].trim().split(" "),m=b[b.length-1],r=null;b.length>1&&(r=b.slice(0,b.length-1),r.reverse()),I[C++]=new np(m,r,o,s,c,d)}}return I}var np=class{constructor(A,g,I,C,o,i){this.scope=A,this.parentScopes=g,this.index=I,this.fontStyle=C,this.foreground=o,this.background=i}},BC=(A=>(A[A.NotSet=-1]="NotSet",A[A.None=0]="None",A[A.Italic=1]="Italic",A[A.Bold=2]="Bold",A[A.Underline=4]="Underline",A[A.Strikethrough=8]="Strikethrough",A))(BC||{});function wp(A,g){A.sort((s,c)=>{let d=Wn(s.scope,c.scope);return d!==0||(d=Nn(s.parentScopes,c.parentScopes),d!==0)?d:s.index-c.index});let I=0,C="#000000",o="#ffffff";for(;A.length>=1&&A[0].scope==="";){let s=A.shift();s.fontStyle!==-1&&(I=s.fontStyle),s.foreground!==null&&(C=s.foreground),s.background!==null&&(o=s.background)}let i=new bp(g),l=new pn(I,i.getId(C),i.getId(o)),e=new rp(new uB(0,null,-1,0,0),[]);for(let s=0,c=A.length;s<c;s++){let d=A[s];e.insert(0,d.scope,d.parentScopes,d.fontStyle,i.getId(d.foreground),i.getId(d.background))}return new gs(i,l,e)}var bp=class{constructor(A){if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(A)){this._isFrozen=!0;for(let g=0,I=A.length;g<I;g++)this._color2id[A[g]]=g,this._id2color[g]=A[g]}else this._isFrozen=!1}getId(A){if(A===null)return 0;A=A.toUpperCase();let g=this._color2id[A];if(g)return g;if(this._isFrozen)throw new Error(`Missing color in color map - ${A}`);return g=++this._lastColorId,this._color2id[A]=g,this._id2color[g]=A,g}getColorMap(){return this._id2color.slice(0)}},mp=Object.freeze([]),uB=class Rm{constructor(g,I,C,o,i){this.scopeDepth=g,this.parentScopes=I||mp,this.fontStyle=C,this.foreground=o,this.background=i}clone(){return new Rm(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(g){let I=[];for(let C=0,o=g.length;C<o;C++)I[C]=g[C].clone();return I}acceptOverwrite(g,I,C,o){this.scopeDepth>g?console.log("how did this happen?"):this.scopeDepth=g,I!==-1&&(this.fontStyle=I),C!==0&&(this.foreground=C),o!==0&&(this.background=o)}},rp=class G0{constructor(g,I=[],C={}){this._mainRule=g,this._children=C,this._rulesWithParentScopes=I}static _cmpBySpecificity(g,I){if(g.scopeDepth!==I.scopeDepth)return I.scopeDepth-g.scopeDepth;let C=0,o=0;for(;g.parentScopes[C]===">"&&C++,I.parentScopes[o]===">"&&o++,!(C>=g.parentScopes.length||o>=I.parentScopes.length);){const i=I.parentScopes[o].length-g.parentScopes[C].length;if(i!==0)return i;C++,o++}return I.parentScopes.length-g.parentScopes.length}match(g){if(g!==""){let C=g.indexOf("."),o,i;if(C===-1?(o=g,i=""):(o=g.substring(0,C),i=g.substring(C+1)),this._children.hasOwnProperty(o))return this._children[o].match(i)}const I=this._rulesWithParentScopes.concat(this._mainRule);return I.sort(G0._cmpBySpecificity),I}insert(g,I,C,o,i,l){if(I===""){this._doInsertHere(g,C,o,i,l);return}let e=I.indexOf("."),s,c;e===-1?(s=I,c=""):(s=I.substring(0,e),c=I.substring(e+1));let d;this._children.hasOwnProperty(s)?d=this._children[s]:(d=new G0(this._mainRule.clone(),uB.cloneArr(this._rulesWithParentScopes)),this._children[s]=d),d.insert(g+1,c,C,o,i,l)}_doInsertHere(g,I,C,o,i){if(I===null){this._mainRule.acceptOverwrite(g,C,o,i);return}for(let l=0,e=this._rulesWithParentScopes.length;l<e;l++){let s=this._rulesWithParentScopes[l];if(Nn(s.parentScopes,I)===0){s.acceptOverwrite(g,C,o,i);return}}C===-1&&(C=this._mainRule.fontStyle),o===0&&(o=this._mainRule.foreground),i===0&&(i=this._mainRule.background),this._rulesWithParentScopes.push(new uB(g,I,C,o,i))}},to=class XI{static toBinaryStr(g){return g.toString(2).padStart(32,"0")}static print(g){const I=XI.getLanguageId(g),C=XI.getTokenType(g),o=XI.getFontStyle(g),i=XI.getForeground(g),l=XI.getBackground(g);console.log({languageId:I,tokenType:C,fontStyle:o,foreground:i,background:l})}static getLanguageId(g){return(g&255)>>>0}static getTokenType(g){return(g&768)>>>8}static containsBalancedBrackets(g){return(g&1024)!==0}static getFontStyle(g){return(g&30720)>>>11}static getForeground(g){return(g&16744448)>>>15}static getBackground(g){return(g&4278190080)>>>24}static set(g,I,C,o,i,l,e){let s=XI.getLanguageId(g),c=XI.getTokenType(g),d=XI.containsBalancedBrackets(g)?1:0,a=XI.getFontStyle(g),t=XI.getForeground(g),n=XI.getBackground(g);return I!==0&&(s=I),C!==8&&(c=C),o!==null&&(d=o?1:0),i!==-1&&(a=i),l!==0&&(t=l),e!==0&&(n=e),(s<<0|c<<8|d<<10|a<<11|t<<15|n<<24)>>>0}};function TT(A){return A}function vT(A){return A}function Is(A,g){const I=[],C=Zp(A);let o=C.next();for(;o!==null;){let s=0;if(o.length===2&&o.charAt(1)===":"){switch(o.charAt(0)){case"R":s=1;break;case"L":s=-1;break;default:console.log(`Unknown priority ${o} in scope selector`)}o=C.next()}let c=l();if(I.push({matcher:c,priority:s}),o!==",")break;o=C.next()}return I;function i(){if(o==="-"){o=C.next();const s=i();return c=>!!s&&!s(c)}if(o==="("){o=C.next();const s=e();return o===")"&&(o=C.next()),s}if(Vn(o)){const s=[];do s.push(o),o=C.next();while(Vn(o));return c=>g(s,c)}return null}function l(){const s=[];let c=i();for(;c;)s.push(c),c=i();return d=>s.every(a=>a(d))}function e(){const s=[];let c=l();for(;c&&(s.push(c),o==="|"||o===",");){do o=C.next();while(o==="|"||o===",");c=l()}return d=>s.some(a=>a(d))}}function Vn(A){return!!A&&!!A.match(/[\w\.:]+/)}function Zp(A){let g=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,I=g.exec(A);return{next:()=>{if(!I)return null;const C=I[0];return I=g.exec(A),C}}}function Rn(A){typeof A.dispose=="function"&&A.dispose()}var sl=class{constructor(A){this.scopeName=A}toKey(){return this.scopeName}},Gp=class{constructor(A,g){this.scopeName=A,this.ruleName=g}toKey(){return`${this.scopeName}#${this.ruleName}`}},hp=class{constructor(){this._references=[],this._seenReferenceKeys=new Set,this.visitedRule=new Set}get references(){return this._references}add(A){const g=A.toKey();this._seenReferenceKeys.has(g)||(this._seenReferenceKeys.add(g),this._references.push(A))}},up=class{constructor(A,g){this.repo=A,this.initialScopeName=g,this.seenFullScopeRequests=new Set,this.seenPartialScopeRequests=new Set,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new sl(this.initialScopeName)]}processQueue(){const A=this.Q;this.Q=[];const g=new hp;for(const I of A)Dp(I,this.initialScopeName,this.repo,g);for(const I of g.references)if(I instanceof sl){if(this.seenFullScopeRequests.has(I.scopeName))continue;this.seenFullScopeRequests.add(I.scopeName),this.Q.push(I)}else{if(this.seenFullScopeRequests.has(I.scopeName)||this.seenPartialScopeRequests.has(I.toKey()))continue;this.seenPartialScopeRequests.add(I.toKey()),this.Q.push(I)}}};function Dp(A,g,I,C){const o=I.lookup(A.scopeName);if(!o){if(A.scopeName===g)throw new Error(`No grammar provided for <${g}>`);return}const i=I.lookup(g);A instanceof sl?Cs({baseGrammar:i,selfGrammar:o},C):DB(A.ruleName,{baseGrammar:i,selfGrammar:o,repository:o.repository},C);const l=I.injections(A.scopeName);if(l)for(const e of l)C.add(new sl(e))}function DB(A,g,I){if(g.repository&&g.repository[A]){const C=g.repository[A];os([C],g,I)}}function Cs(A,g){A.selfGrammar.patterns&&Array.isArray(A.selfGrammar.patterns)&&os(A.selfGrammar.patterns,{...A,repository:A.selfGrammar.repository},g),A.selfGrammar.injections&&os(Object.values(A.selfGrammar.injections),{...A,repository:A.selfGrammar.repository},g)}function os(A,g,I){for(const C of A){if(I.visitedRule.has(C))continue;I.visitedRule.add(C);const o=C.repository?Dn({},g.repository,C.repository):g.repository;Array.isArray(C.patterns)&&os(C.patterns,{...g,repository:o},I);const i=C.include;if(!i)continue;const l=Kn(i);switch(l.kind){case 0:Cs({...g,selfGrammar:g.baseGrammar},I);break;case 1:Cs(g,I);break;case 2:DB(l.ruleName,{...g,repository:o},I);break;case 3:case 4:const e=l.scopeName===g.selfGrammar.scopeName?g.selfGrammar:l.scopeName===g.baseGrammar.scopeName?g.baseGrammar:void 0;if(e){const s={baseGrammar:g.baseGrammar,selfGrammar:e,repository:o};l.kind===4?DB(l.ruleName,s,I):Cs(s,I)}else l.kind===4?I.add(new Gp(l.scopeName,l.ruleName)):I.add(new sl(l.scopeName));break}}}var Yp=class{constructor(){this.kind=0}},Wp=class{constructor(){this.kind=1}},Np=class{constructor(A){this.ruleName=A,this.kind=2}},Qp=class{constructor(A){this.scopeName=A,this.kind=3}},yp=class{constructor(A,g){this.scopeName=A,this.ruleName=g,this.kind=4}};function Kn(A){if(A==="$base")return new Yp;if(A==="$self")return new Wp;const g=A.indexOf("#");if(g===-1)return new Qp(A);if(g===0)return new Np(A.substring(1));{const I=A.substring(0,g),C=A.substring(g+1);return new yp(I,C)}}var Mp=/\\(\d+)/,Xn=/\\(\d+)/g,pp=-1,En=-2;function fT(A){return A}function UT(A){return A}var cl=class{constructor(A,g,I,C){this.$location=A,this.id=g,this._name=I||null,this._nameIsCapturing=As.hasCaptures(this._name),this._contentName=C||null,this._contentNameIsCapturing=As.hasCaptures(this._contentName)}get debugName(){const A=this.$location?`${Yn(this.$location.filename)}:${this.$location.line}`:"unknown";return`${this.constructor.name}#${this.id} @ ${A}`}getName(A,g){return!this._nameIsCapturing||this._name===null||A===null||g===null?this._name:As.replaceCaptures(this._name,A,g)}getContentName(A,g){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:As.replaceCaptures(this._contentName,A,g)}},Vp=class extends cl{constructor(A,g,I,C,o){super(A,g,I,C),this.retokenizeCapturedWithRuleId=o}dispose(){}collectPatterns(A,g){throw new Error("Not supported!")}compile(A,g){throw new Error("Not supported!")}compileAG(A,g,I,C){throw new Error("Not supported!")}},Rp=class extends cl{constructor(A,g,I,C,o){super(A,g,I,null),this._match=new Bl(C,this.id),this.captures=o,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(A,g){g.push(this._match)}compile(A,g){return this._getCachedCompiledPatterns(A).compile(A)}compileAG(A,g,I,C){return this._getCachedCompiledPatterns(A).compileAG(A,I,C)}_getCachedCompiledPatterns(A){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new dl,this.collectPatterns(A,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Hn=class extends cl{constructor(A,g,I,C,o){super(A,g,I,C),this.patterns=o.patterns,this.hasMissingPatterns=o.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}collectPatterns(A,g){for(const I of this.patterns)A.getRule(I).collectPatterns(A,g)}compile(A,g){return this._getCachedCompiledPatterns(A).compile(A)}compileAG(A,g,I,C){return this._getCachedCompiledPatterns(A).compileAG(A,I,C)}_getCachedCompiledPatterns(A){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new dl,this.collectPatterns(A,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},YB=class extends cl{constructor(A,g,I,C,o,i,l,e,s,c){super(A,g,I,C),this._begin=new Bl(o,this.id),this.beginCaptures=i,this._end=new Bl(l||"￿",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=e,this.applyEndPatternLast=s||!1,this.patterns=c.patterns,this.hasMissingPatterns=c.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(A,g){return this._end.resolveBackReferences(A,g)}collectPatterns(A,g){g.push(this._begin)}compile(A,g){return this._getCachedCompiledPatterns(A,g).compile(A)}compileAG(A,g,I,C){return this._getCachedCompiledPatterns(A,g).compileAG(A,I,C)}_getCachedCompiledPatterns(A,g){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new dl;for(const I of this.patterns)A.getRule(I).collectPatterns(A,this._cachedCompiledPatterns);this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,g):this._cachedCompiledPatterns.setSource(0,g)),this._cachedCompiledPatterns}},is=class extends cl{constructor(A,g,I,C,o,i,l,e,s){super(A,g,I,C),this._begin=new Bl(o,this.id),this.beginCaptures=i,this.whileCaptures=e,this._while=new Bl(l,En),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=s.patterns,this.hasMissingPatterns=s.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null),this._cachedCompiledWhilePatterns&&(this._cachedCompiledWhilePatterns.dispose(),this._cachedCompiledWhilePatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(A,g){return this._while.resolveBackReferences(A,g)}collectPatterns(A,g){g.push(this._begin)}compile(A,g){return this._getCachedCompiledPatterns(A).compile(A)}compileAG(A,g,I,C){return this._getCachedCompiledPatterns(A).compileAG(A,I,C)}_getCachedCompiledPatterns(A){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new dl;for(const g of this.patterns)A.getRule(g).collectPatterns(A,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(A,g){return this._getCachedCompiledWhilePatterns(A,g).compile(A)}compileWhileAG(A,g,I,C){return this._getCachedCompiledWhilePatterns(A,g).compileAG(A,I,C)}_getCachedCompiledWhilePatterns(A,g){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new dl,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,g||"￿"),this._cachedCompiledWhilePatterns}},Sn=class jg{static createCaptureRule(g,I,C,o,i){return g.registerRule(l=>new Vp(I,l,C,o,i))}static getCompiledRuleId(g,I,C){return g.id||I.registerRule(o=>{if(g.id=o,g.match)return new Rp(g.$vscodeTextmateLocation,g.id,g.name,g.match,jg._compileCaptures(g.captures,I,C));if(typeof g.begin>"u"){g.repository&&(C=Dn({},C,g.repository));let i=g.patterns;return typeof i>"u"&&g.include&&(i=[{include:g.include}]),new Hn(g.$vscodeTextmateLocation,g.id,g.name,g.contentName,jg._compilePatterns(i,I,C))}return g.while?new is(g.$vscodeTextmateLocation,g.id,g.name,g.contentName,g.begin,jg._compileCaptures(g.beginCaptures||g.captures,I,C),g.while,jg._compileCaptures(g.whileCaptures||g.captures,I,C),jg._compilePatterns(g.patterns,I,C)):new YB(g.$vscodeTextmateLocation,g.id,g.name,g.contentName,g.begin,jg._compileCaptures(g.beginCaptures||g.captures,I,C),g.end,jg._compileCaptures(g.endCaptures||g.captures,I,C),g.applyEndPatternLast,jg._compilePatterns(g.patterns,I,C))}),g.id}static _compileCaptures(g,I,C){let o=[];if(g){let i=0;for(const l in g){if(l==="$vscodeTextmateLocation")continue;const e=parseInt(l,10);e>i&&(i=e)}for(let l=0;l<=i;l++)o[l]=null;for(const l in g){if(l==="$vscodeTextmateLocation")continue;const e=parseInt(l,10);let s=0;g[l].patterns&&(s=jg.getCompiledRuleId(g[l],I,C)),o[e]=jg.createCaptureRule(I,g[l].$vscodeTextmateLocation,g[l].name,g[l].contentName,s)}}return o}static _compilePatterns(g,I,C){let o=[];if(g)for(let i=0,l=g.length;i<l;i++){const e=g[i];let s=-1;if(e.include){const c=Kn(e.include);switch(c.kind){case 0:case 1:s=jg.getCompiledRuleId(C[e.include],I,C);break;case 2:let d=C[c.ruleName];d&&(s=jg.getCompiledRuleId(d,I,C));break;case 3:case 4:const a=c.scopeName,t=c.kind===4?c.ruleName:null,n=I.getExternalGrammar(a,C);if(n)if(t){let b=n.repository[t];b&&(s=jg.getCompiledRuleId(b,I,n.repository))}else s=jg.getCompiledRuleId(n.repository.$self,I,n.repository);break}}else s=jg.getCompiledRuleId(e,I,C);if(s!==-1){const c=I.getRule(s);let d=!1;if((c instanceof Hn||c instanceof YB||c instanceof is)&&c.hasMissingPatterns&&c.patterns.length===0&&(d=!0),d)continue;o.push(s)}}return{patterns:o,hasMissingPatterns:(g?g.length:0)!==o.length}}},Bl=class Km{constructor(g,I){if(g){const C=g.length;let o=0,i=[],l=!1;for(let e=0;e<C;e++)if(g.charAt(e)==="\\"&&e+1<C){const c=g.charAt(e+1);c==="z"?(i.push(g.substring(o,e)),i.push("$(?!\\n)(?<!\\n)"),o=e+2):(c==="A"||c==="G")&&(l=!0),e++}this.hasAnchor=l,o===0?this.source=g:(i.push(g.substring(o,C)),this.source=i.join(""))}else this.hasAnchor=!1,this.source=g;this.hasAnchor?this._anchorCache=this._buildAnchorCache():this._anchorCache=null,this.ruleId=I,this.hasBackReferences=Mp.test(this.source)}clone(){return new Km(this.source,this.ruleId)}setSource(g){this.source!==g&&(this.source=g,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(g,I){let C=I.map(o=>g.substring(o.start,o.end));return Xn.lastIndex=0,this.source.replace(Xn,(o,i)=>yn(C[parseInt(i,10)]||""))}_buildAnchorCache(){let g=[],I=[],C=[],o=[],i,l,e,s;for(i=0,l=this.source.length;i<l;i++)e=this.source.charAt(i),g[i]=e,I[i]=e,C[i]=e,o[i]=e,e==="\\"&&i+1<l&&(s=this.source.charAt(i+1),s==="A"?(g[i+1]="￿",I[i+1]="￿",C[i+1]="A",o[i+1]="A"):s==="G"?(g[i+1]="￿",I[i+1]="G",C[i+1]="￿",o[i+1]="G"):(g[i+1]=s,I[i+1]=s,C[i+1]=s,o[i+1]=s),i++);return{A0_G0:g.join(""),A0_G1:I.join(""),A1_G0:C.join(""),A1_G1:o.join("")}}resolveAnchors(g,I){return!this.hasAnchor||!this._anchorCache?this.source:g?I?this._anchorCache.A1_G1:this._anchorCache.A1_G0:I?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},dl=class{constructor(){this._items=[],this._hasAnchors=!1,this._cached=null,this._anchorCache={A0_G0:null,A0_G1:null,A1_G0:null,A1_G1:null}}dispose(){this._disposeCaches()}_disposeCaches(){this._cached&&(this._cached.dispose(),this._cached=null),this._anchorCache.A0_G0&&(this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null),this._anchorCache.A0_G1&&(this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null),this._anchorCache.A1_G0&&(this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null),this._anchorCache.A1_G1&&(this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null)}push(A){this._items.push(A),this._hasAnchors=this._hasAnchors||A.hasAnchor}unshift(A){this._items.unshift(A),this._hasAnchors=this._hasAnchors||A.hasAnchor}length(){return this._items.length}setSource(A,g){this._items[A].source!==g&&(this._disposeCaches(),this._items[A].setSource(g))}compile(A){if(!this._cached){let g=this._items.map(I=>I.source);this._cached=new Fn(A,g,this._items.map(I=>I.ruleId))}return this._cached}compileAG(A,g,I){return this._hasAnchors?g?I?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(A,g,I)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(A,g,I)),this._anchorCache.A1_G0):I?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(A,g,I)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(A,g,I)),this._anchorCache.A0_G0):this.compile(A)}_resolveAnchors(A,g,I){let C=this._items.map(o=>o.resolveAnchors(g,I));return new Fn(A,C,this._items.map(o=>o.ruleId))}},Fn=class{constructor(A,g,I){this.regExps=g,this.rules=I,this.scanner=A.createOnigScanner(g)}dispose(){typeof this.scanner.dispose=="function"&&this.scanner.dispose()}toString(){const A=[];for(let g=0,I=this.rules.length;g<I;g++)A.push(" - "+this.rules[g]+": "+this.regExps[g]);return A.join(`
87
87
  `)}findNextMatchSync(A,g,I){const C=this.scanner.findNextMatchSync(A,g,I);return C?{ruleId:this.rules[C.index],captureIndices:C.captureIndices}:null}},WB=class{constructor(A,g){this.languageId=A,this.tokenType=g}},NB=class h0{constructor(g,I){this._getBasicScopeAttributes=new Mn(C=>{const o=this._scopeToLanguage(C),i=this._toStandardTokenType(C);return new WB(o,i)}),this._defaultAttributes=new WB(g,8),this._embeddedLanguagesMatcher=new Xp(Object.entries(I||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(g){return g===null?h0._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(g)}_scopeToLanguage(g){return this._embeddedLanguagesMatcher.match(g)||0}_toStandardTokenType(g){const I=g.match(h0.STANDARD_TOKEN_TYPE_REGEXP);if(!I)return 8;switch(I[1]){case"comment":return 1;case"string":return 2;case"regex":return 3;case"meta.embedded":return 0}throw new Error("Unexpected match for standard token type!")}};NB._NULL_SCOPE_METADATA=new WB(0,0),NB.STANDARD_TOKEN_TYPE_REGEXP=/\b(comment|string|regex|meta\.embedded)\b/;var Kp=NB,Xp=class{constructor(A){if(A.length===0)this.values=null,this.scopesRegExp=null;else{this.values=new Map(A);const g=A.map(([I,C])=>yn(I));g.sort(),g.reverse(),this.scopesRegExp=new RegExp(`^((${g.join(")|(")}))($|\\.)`,"")}}match(A){if(!this.scopesRegExp)return;const g=A.match(this.scopesRegExp);if(g)return this.values.get(g[1])}};typeof process<"u"&&process.env.VSCODE_TEXTMATE_DEBUG;var kn=class{constructor(A,g){this.stack=A,this.stoppedEarly=g}};function xn(A,g,I,C,o,i,l,e){const s=g.content.length;let c=!1,d=-1;if(l){const n=Ep(A,g,I,C,o,i);o=n.stack,C=n.linePos,I=n.isFirstLine,d=n.anchorPosition}const a=Date.now();for(;!c;){if(e!==0&&Date.now()-a>e)return new kn(o,!0);t()}return new kn(o,!1);function t(){const n=Hp(A,g,I,C,o,d);if(!n){i.produce(o,s),c=!0;return}const b=n.captureIndices,m=n.matchedRuleId,r=b&&b.length>0?b[0].end>C:!1;if(m===pp){const Z=o.getRule(A);i.produce(o,b[0].start),o=o.withContentNameScopesList(o.nameScopesList),al(A,g,I,o,i,Z.endCaptures,b),i.produce(o,b[0].end);const G=o;if(o=o.parent,d=G.getAnchorPos(),!r&&G.getEnterPos()===C){o=G,i.produce(o,s),c=!0;return}}else{const Z=A.getRule(m);i.produce(o,b[0].start);const G=o,W=Z.getName(g.content,b),N=o.contentNameScopesList.pushAttributed(W,A);if(o=o.push(m,C,d,b[0].end===s,null,N,N),Z instanceof YB){const R=Z;al(A,g,I,o,i,R.beginCaptures,b),i.produce(o,b[0].end),d=b[0].end;const M=R.getContentName(g.content,b),y=N.pushAttributed(M,A);if(o=o.withContentNameScopesList(y),R.endHasBackReferences&&(o=o.withEndRule(R.getEndWithResolvedBackReferences(g.content,b))),!r&&G.hasSameRuleAs(o)){o=o.pop(),i.produce(o,s),c=!0;return}}else if(Z instanceof is){const R=Z;al(A,g,I,o,i,R.beginCaptures,b),i.produce(o,b[0].end),d=b[0].end;const M=R.getContentName(g.content,b),y=N.pushAttributed(M,A);if(o=o.withContentNameScopesList(y),R.whileHasBackReferences&&(o=o.withEndRule(R.getWhileWithResolvedBackReferences(g.content,b))),!r&&G.hasSameRuleAs(o)){o=o.pop(),i.produce(o,s),c=!0;return}}else if(al(A,g,I,o,i,Z.captures,b),i.produce(o,b[0].end),o=o.pop(),!r){o=o.safePop(),i.produce(o,s),c=!0;return}}b[0].end>C&&(C=b[0].end,I=!1)}}function Ep(A,g,I,C,o,i){let l=o.beginRuleCapturedEOL?0:-1;const e=[];for(let s=o;s;s=s.pop()){const c=s.getRule(A);c instanceof is&&e.push({rule:c,stack:s})}for(let s=e.pop();s;s=e.pop()){const{ruleScanner:c,findOptions:d}=kp(s.rule,A,s.stack.endRule,I,C===l),a=c.findNextMatchSync(g,C,d);if(a){if(a.ruleId!==En){o=s.stack.pop();break}a.captureIndices&&a.captureIndices.length&&(i.produce(s.stack,a.captureIndices[0].start),al(A,g,I,s.stack,i,s.rule.whileCaptures,a.captureIndices),i.produce(s.stack,a.captureIndices[0].end),l=a.captureIndices[0].end,a.captureIndices[0].end>C&&(C=a.captureIndices[0].end,I=!1))}else{o=s.stack.pop();break}}return{stack:o,linePos:C,anchorPosition:l,isFirstLine:I}}function Hp(A,g,I,C,o,i){const l=Sp(A,g,I,C,o,i),e=A.getInjections();if(e.length===0)return l;const s=Fp(e,A,g,I,C,o,i);if(!s)return l;if(!l)return s;const c=l.captureIndices[0].start,d=s.captureIndices[0].start;return d<c||s.priorityMatch&&d===c?s:l}function Sp(A,g,I,C,o,i){const l=o.getRule(A),{ruleScanner:e,findOptions:s}=Ln(l,A,o.endRule,I,C===i),c=e.findNextMatchSync(g,C,s);return c?{captureIndices:c.captureIndices,matchedRuleId:c.ruleId}:null}function Fp(A,g,I,C,o,i,l){let e=Number.MAX_VALUE,s=null,c,d=0;const a=i.contentNameScopesList.getScopeNames();for(let t=0,n=A.length;t<n;t++){const b=A[t];if(!b.matcher(a))continue;const m=g.getRule(b.ruleId),{ruleScanner:r,findOptions:Z}=Ln(m,g,null,C,o===l),G=r.findNextMatchSync(I,o,Z);if(!G)continue;const W=G.captureIndices[0].start;if(!(W>=e)&&(e=W,s=G.captureIndices,c=G.ruleId,d=b.priority,e===o))break}return s?{priorityMatch:d===-1,captureIndices:s,matchedRuleId:c}:null}function Ln(A,g,I,C,o){return{ruleScanner:A.compileAG(g,I,C,o),findOptions:0}}function kp(A,g,I,C,o){return{ruleScanner:A.compileWhileAG(g,I,C,o),findOptions:0}}function al(A,g,I,C,o,i,l){if(i.length===0)return;const e=g.content,s=Math.min(i.length,l.length),c=[],d=l[0].end;for(let a=0;a<s;a++){const t=i[a];if(t===null)continue;const n=l[a];if(n.length===0)continue;if(n.start>d)break;for(;c.length>0&&c[c.length-1].endPos<=n.start;)o.produceFromScopes(c[c.length-1].scopes,c[c.length-1].endPos),c.pop();if(c.length>0?o.produceFromScopes(c[c.length-1].scopes,n.start):o.produce(C,n.start),t.retokenizeCapturedWithRuleId){const m=t.getName(e,l),r=C.contentNameScopesList.pushAttributed(m,A),Z=t.getContentName(e,l),G=r.pushAttributed(Z,A),W=C.push(t.retokenizeCapturedWithRuleId,n.start,-1,!1,null,r,G),N=A.createOnigString(e.substring(0,n.end));xn(A,N,I&&n.start===0,n.start,W,o,!1,0),Rn(N);continue}const b=t.getName(e,l);if(b!==null){const r=(c.length>0?c[c.length-1].scopes:C.contentNameScopesList).pushAttributed(b,A);c.push(new xp(r,n.end))}}for(;c.length>0;)o.produceFromScopes(c[c.length-1].scopes,c[c.length-1].endPos),c.pop()}var xp=class{constructor(A,g){this.scopes=A,this.endPos=g}};function Lp(A,g,I,C,o,i,l,e){return new zp(A,g,I,C,o,i,l,e)}function Jn(A,g,I,C,o){const i=Is(g,ls),l=Sn.getCompiledRuleId(I,C,o.repository);for(const e of i)A.push({debugSelector:g,matcher:e.matcher,ruleId:l,grammar:o,priority:e.priority})}function ls(A,g){if(g.length<A.length)return!1;let I=0;return A.every(C=>{for(let o=I;o<g.length;o++)if(Jp(g[o],C))return I=o+1,!0;return!1})}function Jp(A,g){if(!A)return!1;if(A===g)return!0;const I=g.length;return A.length>I&&A.substr(0,I)===g&&A[I]==="."}var zp=class{constructor(A,g,I,C,o,i,l,e){if(this._rootScopeName=A,this.balancedBracketSelectors=i,this._onigLib=e,this._basicScopeAttributesProvider=new Kp(I,C),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=l,this._grammar=zn(g,null),this._injections=null,this._tokenTypeMatchers=[],o)for(const s of Object.keys(o)){const c=Is(s,ls);for(const d of c)this._tokenTypeMatchers.push({matcher:d.matcher,type:o[s]})}}get themeProvider(){return this._grammarRepository}dispose(){for(const A of this._ruleId2desc)A&&A.dispose()}createOnigScanner(A){return this._onigLib.createOnigScanner(A)}createOnigString(A){return this._onigLib.createOnigString(A)}getMetadataForScope(A){return this._basicScopeAttributesProvider.getBasicScopeAttributes(A)}_collectInjections(){const A={lookup:o=>o===this._rootScopeName?this._grammar:this.getExternalGrammar(o),injections:o=>this._grammarRepository.injections(o)},g=[],I=this._rootScopeName,C=A.lookup(I);if(C){const o=C.injections;if(o)for(let l in o)Jn(g,l,o[l],this,C);const i=this._grammarRepository.injections(I);i&&i.forEach(l=>{const e=this.getExternalGrammar(l);if(e){const s=e.injectionSelector;s&&Jn(g,s,e,this,e)}})}return g.sort((o,i)=>o.priority-i.priority),g}getInjections(){return this._injections===null&&(this._injections=this._collectInjections()),this._injections}registerRule(A){const g=++this._lastRuleId,I=A(g);return this._ruleId2desc[g]=I,I}getRule(A){return this._ruleId2desc[A]}getExternalGrammar(A,g){if(this._includedGrammars[A])return this._includedGrammars[A];if(this._grammarRepository){const I=this._grammarRepository.lookup(A);if(I)return this._includedGrammars[A]=zn(I,g&&g.$base),this._includedGrammars[A]}}tokenizeLine(A,g,I=0){const C=this._tokenize(A,g,!1,I);return{tokens:C.lineTokens.getResult(C.ruleStack,C.lineLength),ruleStack:C.ruleStack,stoppedEarly:C.stoppedEarly}}tokenizeLine2(A,g,I=0){const C=this._tokenize(A,g,!0,I);return{tokens:C.lineTokens.getBinaryResult(C.ruleStack,C.lineLength),ruleStack:C.ruleStack,stoppedEarly:C.stoppedEarly}}_tokenize(A,g,I,C){this._rootId===-1&&(this._rootId=Sn.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let o;if(!g||g===yB.NULL){o=!0;const c=this._basicScopeAttributesProvider.getDefaultAttributes(),d=this.themeProvider.getDefaults(),a=to.set(0,c.languageId,c.tokenType,null,d.fontStyle,d.foregroundId,d.backgroundId),t=this.getRule(this._rootId).getName(null,null);let n;t?n=tl.createRootAndLookUpScopeName(t,a,this):n=tl.createRoot("unknown",a),g=new yB(null,this._rootId,-1,-1,!1,null,n,n)}else o=!1,g.reset();A=A+`
88
88
  `;const i=this.createOnigString(A),l=i.content.length,e=new vp(I,A,this._tokenTypeMatchers,this.balancedBracketSelectors),s=xn(this,i,o,0,g,e,!0,C);return Rn(i),{lineLength:l,lineTokens:e,ruleStack:s.stack,stoppedEarly:s.stoppedEarly}}};function zn(A,g){return A=sp(A),A.repository=A.repository||{},A.repository.$self={$vscodeTextmateLocation:A.$vscodeTextmateLocation,patterns:A.patterns,name:A.scopeName},A.repository.$base=g||A.repository.$self,A}var tl=class nC{constructor(g,I,C){this.parent=g,this.scopePath=I,this.tokenAttributes=C}static fromExtension(g,I){let C=g,o=(g==null?void 0:g.scopePath)??null;for(const i of I)o=hB.push(o,i.scopeNames),C=new nC(C,o,i.encodedTokenAttributes);return C}static createRoot(g,I){return new nC(null,new hB(null,g),I)}static createRootAndLookUpScopeName(g,I,C){const o=C.getMetadataForScope(g),i=new hB(null,g),l=C.themeProvider.themeMatch(i),e=nC.mergeAttributes(I,o,l);return new nC(null,i,e)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(" ")}equals(g){return nC.equals(this,g)}static equals(g,I){do{if(g===I||!g&&!I)return!0;if(!g||!I||g.scopeName!==I.scopeName||g.tokenAttributes!==I.tokenAttributes)return!1;g=g.parent,I=I.parent}while(!0)}static mergeAttributes(g,I,C){let o=-1,i=0,l=0;return C!==null&&(o=C.fontStyle,i=C.foregroundId,l=C.backgroundId),to.set(g,I.languageId,I.tokenType,null,o,i,l)}pushAttributed(g,I){if(g===null)return this;if(g.indexOf(" ")===-1)return nC._pushAttributed(this,g,I);const C=g.split(/ /g);let o=this;for(const i of C)o=nC._pushAttributed(o,i,I);return o}static _pushAttributed(g,I,C){const o=C.getMetadataForScope(I),i=g.scopePath.push(I),l=C.themeProvider.themeMatch(i),e=nC.mergeAttributes(g.tokenAttributes,o,l);return new nC(g,i,e)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(g){var o;const I=[];let C=this;for(;C&&C!==g;)I.push({encodedTokenAttributes:C.tokenAttributes,scopeNames:C.scopePath.getExtensionIfDefined(((o=C.parent)==null?void 0:o.scopePath)??null)}),C=C.parent;return C===g?I.reverse():void 0}},QB=class ti{constructor(g,I,C,o,i,l,e,s){this.parent=g,this.ruleId=I,this.beginRuleCapturedEOL=i,this.endRule=l,this.nameScopesList=e,this.contentNameScopesList=s,this._stackElementBrand=void 0,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=C,this._anchorPos=o}equals(g){return g===null?!1:ti._equals(this,g)}static _equals(g,I){return g===I?!0:this._structuralEquals(g,I)?tl.equals(g.contentNameScopesList,I.contentNameScopesList):!1}static _structuralEquals(g,I){do{if(g===I||!g&&!I)return!0;if(!g||!I||g.depth!==I.depth||g.ruleId!==I.ruleId||g.endRule!==I.endRule)return!1;g=g.parent,I=I.parent}while(!0)}clone(){return this}static _reset(g){for(;g;)g._enterPos=-1,g._anchorPos=-1,g=g.parent}reset(){ti._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(g,I,C,o,i,l,e){return new ti(this,g,I,C,o,i,l,e)}getEnterPos(){return this._enterPos}getAnchorPos(){return this._anchorPos}getRule(g){return g.getRule(this.ruleId)}toString(){const g=[];return this._writeString(g,0),"["+g.join(",")+"]"}_writeString(g,I){var C,o;return this.parent&&(I=this.parent._writeString(g,I)),g[I++]=`(${this.ruleId}, ${(C=this.nameScopesList)==null?void 0:C.toString()}, ${(o=this.contentNameScopesList)==null?void 0:o.toString()})`,I}withContentNameScopesList(g){return this.contentNameScopesList===g?this:this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,g)}withEndRule(g){return this.endRule===g?this:new ti(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,g,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(g){let I=this;for(;I&&I._enterPos===g._enterPos;){if(I.ruleId===g.ruleId)return!0;I=I.parent}return!1}toStateStackFrame(){var g,I,C;return{ruleId:this.ruleId,beginRuleCapturedEOL:this.beginRuleCapturedEOL,endRule:this.endRule,nameScopesList:((I=this.nameScopesList)==null?void 0:I.getExtensionIfDefined(((g=this.parent)==null?void 0:g.nameScopesList)??null))??[],contentNameScopesList:((C=this.contentNameScopesList)==null?void 0:C.getExtensionIfDefined(this.nameScopesList))??[]}}static pushFrame(g,I){const C=tl.fromExtension((g==null?void 0:g.nameScopesList)??null,I.nameScopesList);return new ti(g,I.ruleId,I.enterPos??-1,I.anchorPos??-1,I.beginRuleCapturedEOL,I.endRule,C,tl.fromExtension(C,I.contentNameScopesList))}};QB.NULL=new QB(null,0,0,0,!1,null,null,null);var yB=QB,Tp=class{constructor(A,g){this.allowAny=!1,this.balancedBracketScopes=A.flatMap(I=>I==="*"?(this.allowAny=!0,[]):Is(I,ls).map(C=>C.matcher)),this.unbalancedBracketScopes=g.flatMap(I=>Is(I,ls).map(C=>C.matcher))}get matchesAlways(){return this.allowAny&&this.unbalancedBracketScopes.length===0}get matchesNever(){return this.balancedBracketScopes.length===0&&!this.allowAny}match(A){for(const g of this.unbalancedBracketScopes)if(g(A))return!1;for(const g of this.balancedBracketScopes)if(g(A))return!0;return this.allowAny}},vp=class{constructor(A,g,I,C){this.balancedBracketSelectors=C,this._emitBinaryTokens=A,this._tokenTypeOverrides=I,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}produce(A,g){this.produceFromScopes(A.contentNameScopesList,g)}produceFromScopes(A,g){var C;if(this._lastTokenEndIndex>=g)return;if(this._emitBinaryTokens){let o=(A==null?void 0:A.tokenAttributes)??0,i=!1;if((C=this.balancedBracketSelectors)!=null&&C.matchesAlways&&(i=!0),this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){const l=(A==null?void 0:A.getScopeNames())??[];for(const e of this._tokenTypeOverrides)e.matcher(l)&&(o=to.set(o,0,e.type,null,-1,0,0));this.balancedBracketSelectors&&(i=this.balancedBracketSelectors.match(l))}if(i&&(o=to.set(o,0,8,i,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===o){this._lastTokenEndIndex=g;return}this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(o),this._lastTokenEndIndex=g;return}const I=(A==null?void 0:A.getScopeNames())??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:g,scopes:I}),this._lastTokenEndIndex=g}getResult(A,g){return this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===g-1&&this._tokens.pop(),this._tokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(A,g),this._tokens[this._tokens.length-1].startIndex=0),this._tokens}getBinaryResult(A,g){this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===g-1&&(this._binaryTokens.pop(),this._binaryTokens.pop()),this._binaryTokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(A,g),this._binaryTokens[this._binaryTokens.length-2]=0);const I=new Uint32Array(this._binaryTokens.length);for(let C=0,o=this._binaryTokens.length;C<o;C++)I[C]=this._binaryTokens[C];return I}},fp=class{constructor(A,g){this._onigLib=g,this._grammars=new Map,this._rawGrammars=new Map,this._injectionGrammars=new Map,this._theme=A}dispose(){for(const A of this._grammars.values())A.dispose()}setTheme(A){this._theme=A}getColorMap(){return this._theme.getColorMap()}addGrammar(A,g){this._rawGrammars.set(A.scopeName,A),g&&this._injectionGrammars.set(A.scopeName,g)}lookup(A){return this._rawGrammars.get(A)}injections(A){return this._injectionGrammars.get(A)}getDefaults(){return this._theme.getDefaults()}themeMatch(A){return this._theme.match(A)}grammarForScopeName(A,g,I,C,o){if(!this._grammars.has(A)){let i=this._rawGrammars.get(A);if(!i)return null;this._grammars.set(A,Lp(A,i,g,I,C,o,this,this._onigLib))}return this._grammars.get(A)}},Up=class{constructor(g){this._options=g,this._syncRegistry=new fp(gs.createFromRawTheme(g.theme,g.colorMap),g.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(g,I){this._syncRegistry.setTheme(gs.createFromRawTheme(g,I))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(g,I,C){return this.loadGrammarWithConfiguration(g,I,{embeddedLanguages:C})}loadGrammarWithConfiguration(g,I,C){return this._loadGrammar(g,I,C.embeddedLanguages,C.tokenTypes,new Tp(C.balancedBracketSelectors||[],C.unbalancedBracketSelectors||[]))}loadGrammar(g){return this._loadGrammar(g,0,null,null,null)}_loadGrammar(g,I,C,o,i){const l=new up(this._syncRegistry,g);for(;l.Q.length>0;)l.Q.map(e=>this._loadSingleGrammar(e.scopeName)),l.processQueue();return this._grammarForScopeName(g,I,C,o,i)}_loadSingleGrammar(g){this._ensureGrammarCache.has(g)||(this._doLoadSingleGrammar(g),this._ensureGrammarCache.set(g,!0))}_doLoadSingleGrammar(g){const I=this._options.loadGrammar(g);if(I){const C=typeof this._options.getInjections=="function"?this._options.getInjections(g):void 0;this._syncRegistry.addGrammar(I,C)}}addGrammar(g,I=[],C=0,o=null){return this._syncRegistry.addGrammar(g,I),this._grammarForScopeName(g.scopeName,C,o)}_grammarForScopeName(g,I=0,C=null,o=null,i=null){return this._syncRegistry.grammarForScopeName(g,I,C,o,i)}},Tn=yB.NULL;const Op=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"];class nl{constructor(g,I,C){this.property=g,this.normal=I,C&&(this.space=C)}}nl.prototype.property={},nl.prototype.normal={},nl.prototype.space=null;function vn(A,g){const I={},C={};let o=-1;for(;++o<A.length;)Object.assign(I,A[o].property),Object.assign(C,A[o].normal);return new nl(I,C,g)}function MB(A){return A.toLowerCase()}class VI{constructor(g,I){this.property=g,this.attribute=I}}VI.prototype.space=null,VI.prototype.boolean=!1,VI.prototype.booleanish=!1,VI.prototype.overloadedBoolean=!1,VI.prototype.number=!1,VI.prototype.commaSeparated=!1,VI.prototype.spaceSeparated=!1,VI.prototype.commaOrSpaceSeparated=!1,VI.prototype.mustUseProperty=!1,VI.prototype.defined=!1;let jp=0;const RA=no(),Gg=no(),fn=no(),eA=no(),ig=no(),Ai=no(),rI=no();function no(){return 2**++jp}const pB=Object.freeze(Object.defineProperty({__proto__:null,boolean:RA,booleanish:Gg,commaOrSpaceSeparated:rI,commaSeparated:Ai,number:eA,overloadedBoolean:fn,spaceSeparated:ig},Symbol.toStringTag,{value:"Module"})),VB=Object.keys(pB);class RB extends VI{constructor(g,I,C,o){let i=-1;if(super(g,I),Un(this,"space",o),typeof C=="number")for(;++i<VB.length;){const l=VB[i];Un(this,VB[i],(C&pB[l])===pB[l])}}}RB.prototype.defined=!0;function Un(A,g,I){I&&(A[g]=I)}const Pp={}.hasOwnProperty;function gi(A){const g={},I={};let C;for(C in A.properties)if(Pp.call(A.properties,C)){const o=A.properties[C],i=new RB(C,A.transform(A.attributes||{},C),o,A.space);A.mustUseProperty&&A.mustUseProperty.includes(C)&&(i.mustUseProperty=!0),g[C]=i,I[MB(C)]=C,I[MB(i.attribute)]=C}return new nl(g,I,A.space)}const On=gi({space:"xlink",transform(A,g){return"xlink:"+g.slice(5).toLowerCase()},properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null}}),jn=gi({space:"xml",transform(A,g){return"xml:"+g.slice(3).toLowerCase()},properties:{xmlLang:null,xmlBase:null,xmlSpace:null}});function Pn(A,g){return g in A?A[g]:g}function _n(A,g){return Pn(A,g.toLowerCase())}const qn=gi({space:"xmlns",attributes:{xmlnsxlink:"xmlns:xlink"},transform:_n,properties:{xmlns:null,xmlnsXLink:null}}),$n=gi({transform(A,g){return g==="role"?g:"aria-"+g.slice(4).toLowerCase()},properties:{ariaActiveDescendant:null,ariaAtomic:Gg,ariaAutoComplete:null,ariaBusy:Gg,ariaChecked:Gg,ariaColCount:eA,ariaColIndex:eA,ariaColSpan:eA,ariaControls:ig,ariaCurrent:null,ariaDescribedBy:ig,ariaDetails:null,ariaDisabled:Gg,ariaDropEffect:ig,ariaErrorMessage:null,ariaExpanded:Gg,ariaFlowTo:ig,ariaGrabbed:Gg,ariaHasPopup:null,ariaHidden:Gg,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:ig,ariaLevel:eA,ariaLive:null,ariaModal:Gg,ariaMultiLine:Gg,ariaMultiSelectable:Gg,ariaOrientation:null,ariaOwns:ig,ariaPlaceholder:null,ariaPosInSet:eA,ariaPressed:Gg,ariaReadOnly:Gg,ariaRelevant:null,ariaRequired:Gg,ariaRoleDescription:ig,ariaRowCount:eA,ariaRowIndex:eA,ariaRowSpan:eA,ariaSelected:Gg,ariaSetSize:eA,ariaSort:null,ariaValueMax:eA,ariaValueMin:eA,ariaValueNow:eA,ariaValueText:null,role:null}}),_p=gi({space:"html",attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},transform:_n,mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Ai,acceptCharset:ig,accessKey:ig,action:null,allow:null,allowFullScreen:RA,allowPaymentRequest:RA,allowUserMedia:RA,alt:null,as:null,async:RA,autoCapitalize:null,autoComplete:ig,autoFocus:RA,autoPlay:RA,blocking:ig,capture:null,charSet:null,checked:RA,cite:null,className:ig,cols:eA,colSpan:null,content:null,contentEditable:Gg,controls:RA,controlsList:ig,coords:eA|Ai,crossOrigin:null,data:null,dateTime:null,decoding:null,default:RA,defer:RA,dir:null,dirName:null,disabled:RA,download:fn,draggable:Gg,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:RA,formTarget:null,headers:ig,height:eA,hidden:RA,high:eA,href:null,hrefLang:null,htmlFor:ig,httpEquiv:ig,id:null,imageSizes:null,imageSrcSet:null,inert:RA,inputMode:null,integrity:null,is:null,isMap:RA,itemId:null,itemProp:ig,itemRef:ig,itemScope:RA,itemType:ig,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:RA,low:eA,manifest:null,max:null,maxLength:eA,media:null,method:null,min:null,minLength:eA,multiple:RA,muted:RA,name:null,nonce:null,noModule:RA,noValidate:RA,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:RA,optimum:eA,pattern:null,ping:ig,placeholder:null,playsInline:RA,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:RA,referrerPolicy:null,rel:ig,required:RA,reversed:RA,rows:eA,rowSpan:eA,sandbox:ig,scope:null,scoped:RA,seamless:RA,selected:RA,shadowRootClonable:RA,shadowRootDelegatesFocus:RA,shadowRootMode:null,shape:null,size:eA,sizes:null,slot:null,span:eA,spellCheck:Gg,src:null,srcDoc:null,srcLang:null,srcSet:null,start:eA,step:null,style:null,tabIndex:eA,target:null,title:null,translate:null,type:null,typeMustMatch:RA,useMap:null,value:Gg,width:eA,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:ig,axis:null,background:null,bgColor:null,border:eA,borderColor:null,bottomMargin:eA,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:RA,declare:RA,event:null,face:null,frame:null,frameBorder:null,hSpace:eA,leftMargin:eA,link:null,longDesc:null,lowSrc:null,marginHeight:eA,marginWidth:eA,noResize:RA,noHref:RA,noShade:RA,noWrap:RA,object:null,profile:null,prompt:null,rev:null,rightMargin:eA,rules:null,scheme:null,scrolling:Gg,standby:null,summary:null,text:null,topMargin:eA,valueType:null,version:null,vAlign:null,vLink:null,vSpace:eA,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:RA,disableRemotePlayback:RA,prefix:null,property:null,results:eA,security:null,unselectable:null}}),qp=gi({space:"svg",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"},transform:Pn,properties:{about:rI,accentHeight:eA,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:eA,amplitude:eA,arabicForm:null,ascent:eA,attributeName:null,attributeType:null,azimuth:eA,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:eA,by:null,calcMode:null,capHeight:eA,className:ig,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:eA,diffuseConstant:eA,direction:null,display:null,dur:null,divisor:eA,dominantBaseline:null,download:RA,dx:null,dy:null,edgeMode:null,editable:null,elevation:eA,enableBackground:null,end:null,event:null,exponent:eA,externalResourcesRequired:null,fill:null,fillOpacity:eA,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:Ai,g2:Ai,glyphName:Ai,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:eA,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:eA,horizOriginX:eA,horizOriginY:eA,id:null,ideographic:eA,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:eA,k:eA,k1:eA,k2:eA,k3:eA,k4:eA,kernelMatrix:rI,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:eA,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:eA,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:eA,overlineThickness:eA,paintOrder:null,panose1:null,path:null,pathLength:eA,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:ig,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:eA,pointsAtY:eA,pointsAtZ:eA,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:rI,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:rI,rev:rI,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:rI,requiredFeatures:rI,requiredFonts:rI,requiredFormats:rI,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:eA,specularExponent:eA,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:eA,strikethroughThickness:eA,string:null,stroke:null,strokeDashArray:rI,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:eA,strokeOpacity:eA,strokeWidth:null,style:null,surfaceScale:eA,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:rI,tabIndex:eA,tableValues:null,target:null,targetX:eA,targetY:eA,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:rI,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:eA,underlineThickness:eA,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:eA,values:null,vAlphabetic:eA,vMathematical:eA,vectorEffect:null,vHanging:eA,vIdeographic:eA,version:null,vertAdvY:eA,vertOriginX:eA,vertOriginY:eA,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:eA,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null}}),$p=/^data[-\w.:]+$/i,Aw=/-[a-z]/g,AV=/[A-Z]/g;function gV(A,g){const I=MB(g);let C=g,o=VI;if(I in A.normal)return A.property[A.normal[I]];if(I.length>4&&I.slice(0,4)==="data"&&$p.test(g)){if(g.charAt(4)==="-"){const i=g.slice(5).replace(Aw,CV);C="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=g.slice(4);if(!Aw.test(i)){let l=i.replace(AV,IV);l.charAt(0)!=="-"&&(l="-"+l),g="data"+l}}o=RB}return new o(C,g)}function IV(A){return"-"+A.toLowerCase()}function CV(A){return A.charAt(1).toUpperCase()}const oV=vn([jn,On,qn,$n,_p],"html"),gw=vn([jn,On,qn,$n,qp],"svg"),Iw={}.hasOwnProperty;function iV(A,g){const I=g||{};function C(o,...i){let l=C.invalid;const e=C.handlers;if(o&&Iw.call(o,A)){const s=String(o[A]);l=Iw.call(e,s)?e[s]:C.unknown}if(l)return l.call(this,o,...i)}return C.handlers=I.handlers||{},C.invalid=I.invalid,C.unknown=I.unknown,C}const lV=/["&'<>`]/g,eV=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,sV=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,cV=/[|\\{}()[\]^$+*?.]/g,Cw=new WeakMap;function BV(A,g){if(A=A.replace(g.subset?dV(g.subset):lV,C),g.subset||g.escapeOnly)return A;return A.replace(eV,I).replace(sV,C);function I(o,i,l){return g.format((o.charCodeAt(0)-55296)*1024+o.charCodeAt(1)-56320+65536,l.charCodeAt(i+2),g)}function C(o,i,l){return g.format(o.charCodeAt(0),l.charCodeAt(i+1),g)}}function dV(A){let g=Cw.get(A);return g||(g=aV(A),Cw.set(A,g)),g}function aV(A){const g=[];let I=-1;for(;++I<A.length;)g.push(A[I].replace(cV,"\\$&"));return new RegExp("(?:"+g.join("|")+")","g")}const tV=/[\dA-Fa-f]/;function nV(A,g,I){const C="&#x"+A.toString(16).toUpperCase();return I&&g&&!tV.test(String.fromCharCode(g))?C:C+";"}const wV=/\d/;function bV(A,g,I){const C="&#"+String(A);return I&&g&&!wV.test(String.fromCharCode(g))?C:C+";"}const mV=["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"],KB={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:"€"},rV=["cent","copy","divide","gt","lt","not","para","times"],ow={}.hasOwnProperty,XB={};let es;for(es in KB)ow.call(KB,es)&&(XB[KB[es]]=es);const ZV=/[^\dA-Za-z]/;function GV(A,g,I,C){const o=String.fromCharCode(A);if(ow.call(XB,o)){const i=XB[o],l="&"+i;return I&&mV.includes(i)&&!rV.includes(i)&&(!C||g&&g!==61&&ZV.test(String.fromCharCode(g)))?l:l+";"}return""}function hV(A,g,I){let C=nV(A,g,I.omitOptionalSemicolons),o;if((I.useNamedReferences||I.useShortestReferences)&&(o=GV(A,g,I.omitOptionalSemicolons,I.attribute)),(I.useShortestReferences||!o)&&I.useShortestReferences){const i=bV(A,g,I.omitOptionalSemicolons);i.length<C.length&&(C=i)}return o&&(!I.useShortestReferences||o.length<C.length)?o:C}function Ii(A,g){return BV(A,Object.assign({format:hV},g))}const uV=/^>|^->|<!--|-->|--!>|<!-$/g,DV=[">"],YV=["<",">"];function WV(A,g,I,C){return C.settings.bogusComments?"<?"+Ii(A.value,Object.assign({},C.settings.characterReferences,{subset:DV}))+">":"<!--"+A.value.replace(uV,o)+"-->";function o(i){return Ii(i,Object.assign({},C.settings.characterReferences,{subset:YV}))}}function NV(A,g,I,C){return"<!"+(C.settings.upperDoctype?"DOCTYPE":"doctype")+(C.settings.tightDoctype?"":" ")+"html>"}function iw(A,g){const I=String(A);if(typeof g!="string")throw new TypeError("Expected character");let C=0,o=I.indexOf(g);for(;o!==-1;)C++,o=I.indexOf(g,o+g.length);return C}function QV(A,g){const I=g||{};return(A[A.length-1]===""?[...A,""]:A).join((I.padRight?" ":"")+","+(I.padLeft===!1?"":" ")).trim()}function yV(A){return A.join(" ").trim()}const MV=/[ \t\n\f\r]/g;function EB(A){return typeof A=="object"?A.type==="text"?lw(A.value):!1:lw(A)}function lw(A){return A.replace(MV,"")===""}const Ng=sw(1),ew=sw(-1),pV=[];function sw(A){return g;function g(I,C,o){const i=I?I.children:pV;let l=(C||0)+A,e=i[l];if(!o)for(;e&&EB(e);)l+=A,e=i[l];return e}}const VV={}.hasOwnProperty;function cw(A){return g;function g(I,C,o){return VV.call(A,I.tagName)&&A[I.tagName](I,C,o)}}const HB=cw({body:KV,caption:SB,colgroup:SB,dd:SV,dt:HV,head:SB,html:RV,li:EV,optgroup:FV,option:kV,p:XV,rp:Bw,rt:Bw,tbody:LV,td:dw,tfoot:JV,th:dw,thead:xV,tr:zV});function SB(A,g,I){const C=Ng(I,g,!0);return!C||C.type!=="comment"&&!(C.type==="text"&&EB(C.value.charAt(0)))}function RV(A,g,I){const C=Ng(I,g);return!C||C.type!=="comment"}function KV(A,g,I){const C=Ng(I,g);return!C||C.type!=="comment"}function XV(A,g,I){const C=Ng(I,g);return C?C.type==="element"&&(C.tagName==="address"||C.tagName==="article"||C.tagName==="aside"||C.tagName==="blockquote"||C.tagName==="details"||C.tagName==="div"||C.tagName==="dl"||C.tagName==="fieldset"||C.tagName==="figcaption"||C.tagName==="figure"||C.tagName==="footer"||C.tagName==="form"||C.tagName==="h1"||C.tagName==="h2"||C.tagName==="h3"||C.tagName==="h4"||C.tagName==="h5"||C.tagName==="h6"||C.tagName==="header"||C.tagName==="hgroup"||C.tagName==="hr"||C.tagName==="main"||C.tagName==="menu"||C.tagName==="nav"||C.tagName==="ol"||C.tagName==="p"||C.tagName==="pre"||C.tagName==="section"||C.tagName==="table"||C.tagName==="ul"):!I||!(I.type==="element"&&(I.tagName==="a"||I.tagName==="audio"||I.tagName==="del"||I.tagName==="ins"||I.tagName==="map"||I.tagName==="noscript"||I.tagName==="video"))}function EV(A,g,I){const C=Ng(I,g);return!C||C.type==="element"&&C.tagName==="li"}function HV(A,g,I){const C=Ng(I,g);return!!(C&&C.type==="element"&&(C.tagName==="dt"||C.tagName==="dd"))}function SV(A,g,I){const C=Ng(I,g);return!C||C.type==="element"&&(C.tagName==="dt"||C.tagName==="dd")}function Bw(A,g,I){const C=Ng(I,g);return!C||C.type==="element"&&(C.tagName==="rp"||C.tagName==="rt")}function FV(A,g,I){const C=Ng(I,g);return!C||C.type==="element"&&C.tagName==="optgroup"}function kV(A,g,I){const C=Ng(I,g);return!C||C.type==="element"&&(C.tagName==="option"||C.tagName==="optgroup")}function xV(A,g,I){const C=Ng(I,g);return!!(C&&C.type==="element"&&(C.tagName==="tbody"||C.tagName==="tfoot"))}function LV(A,g,I){const C=Ng(I,g);return!C||C.type==="element"&&(C.tagName==="tbody"||C.tagName==="tfoot")}function JV(A,g,I){return!Ng(I,g)}function zV(A,g,I){const C=Ng(I,g);return!C||C.type==="element"&&C.tagName==="tr"}function dw(A,g,I){const C=Ng(I,g);return!C||C.type==="element"&&(C.tagName==="td"||C.tagName==="th")}const TV=cw({body:UV,colgroup:OV,head:fV,html:vV,tbody:jV});function vV(A){const g=Ng(A,-1);return!g||g.type!=="comment"}function fV(A){const g=A.children,I=[];let C=-1;for(;++C<g.length;){const o=g[C];if(o.type==="element"&&(o.tagName==="title"||o.tagName==="base")){if(I.includes(o.tagName))return!1;I.push(o.tagName)}}return g.length>0}function UV(A){const g=Ng(A,-1,!0);return!g||g.type!=="comment"&&!(g.type==="text"&&EB(g.value.charAt(0)))&&!(g.type==="element"&&(g.tagName==="meta"||g.tagName==="link"||g.tagName==="script"||g.tagName==="style"||g.tagName==="template"))}function OV(A,g,I){const C=ew(I,g),o=Ng(A,-1,!0);return I&&C&&C.type==="element"&&C.tagName==="colgroup"&&HB(C,I.children.indexOf(C),I)?!1:!!(o&&o.type==="element"&&o.tagName==="col")}function jV(A,g,I){const C=ew(I,g),o=Ng(A,-1);return I&&C&&C.type==="element"&&(C.tagName==="thead"||C.tagName==="tbody")&&HB(C,I.children.indexOf(C),I)?!1:!!(o&&o.type==="element"&&o.tagName==="tr")}const ss={name:[[`
89
89
  \f\r &/=>`.split(""),`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xmlui",
3
- "version": "0.5.2-beta.1",
3
+ "version": "0.5.2-beta.2",
4
4
  "sideEffects": false,
5
5
  "scripts": {
6
6
  "build:bin": "tsc -p tsconfig.bin.json",