xmlui 0.12.19 → 0.12.21

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.
Files changed (37) hide show
  1. package/dist/lib/{index-WVT6bIgM.js → index-CznbWBUF.js} +3224 -4066
  2. package/dist/lib/index.css +1 -1
  3. package/dist/lib/{initMock-r2IRBsLf.js → initMock-Dj__hABf.js} +2 -2
  4. package/dist/lib/{parser-DpwXEUNb.js → parser-zOoMLvLx.js} +120 -139
  5. package/dist/lib/testing.d.ts +18 -19
  6. package/dist/lib/testing.js +2 -2
  7. package/dist/lib/{xmlui-parser-Cs8kB0VK.js → xmlui-parser-CtU8O3Av.js} +43 -19
  8. package/dist/lib/xmlui-parser.d.ts +23 -19
  9. package/dist/lib/xmlui-parser.js +2 -2
  10. package/dist/lib/{xmlui-serializer-3MPLSsOp.js → xmlui-serializer-C-Iuczzr.js} +9 -8
  11. package/dist/lib/xmlui.d.ts +130 -125
  12. package/dist/lib/xmlui.js +38 -36
  13. package/dist/metadata/TextBox-B-GWiq0J.cjs +1 -0
  14. package/dist/metadata/{TextBox-CwicjBJI.js → TextBox-DHSTy0g0.js} +3407 -4256
  15. package/dist/metadata/behaviors.cjs +1 -1
  16. package/dist/metadata/behaviors.js +1 -1
  17. package/dist/metadata/{initMock-BMq6JN4I.js → initMock-SQIcDMzP.js} +1 -1
  18. package/dist/metadata/{initMock-BKBkbEgr.cjs → initMock-wSFvfKcr.cjs} +1 -1
  19. package/dist/metadata/metadata-utils.cjs +1 -1
  20. package/dist/metadata/metadata-utils.js +1 -1
  21. package/dist/metadata/transform-BOf-UbgP.cjs +1 -0
  22. package/dist/metadata/{transform-D0SWbm8g.js → transform-fGDqiHwH.js} +120 -139
  23. package/dist/metadata/xmlui-metadata.cjs +1 -1
  24. package/dist/metadata/xmlui-metadata.js +12 -8
  25. package/dist/metadata/xmlui.css +2 -2
  26. package/dist/nodejs/bin/index.mjs +63 -79
  27. package/dist/nodejs/index.cjs +63 -79
  28. package/dist/nodejs/index.mjs +63 -79
  29. package/dist/nodejs/server.cjs +1886 -1053
  30. package/dist/nodejs/server.mjs +1886 -1053
  31. package/dist/nodejs/vite-xmlui-plugin.cjs +63 -79
  32. package/dist/nodejs/vite-xmlui-plugin.mjs +63 -79
  33. package/dist/standalone/xmlui-standalone.es.d.ts +192 -179
  34. package/dist/standalone/xmlui-standalone.umd.js +11 -11
  35. package/package.json +1 -1
  36. package/dist/metadata/TextBox-C-4gnBpw.cjs +0 -1
  37. package/dist/metadata/transform-CkTQ-Bfe.cjs +0 -1
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./TextBox-C-4gnBpw.cjs"),t={animation:a.animationBehavior.metadata,bookmark:a.bookmarkBehavior.metadata,displayWhen:a.displayWhenBehavior.metadata,formBinding:a.formBindingBehavior.metadata,label:a.labelBehavior.metadata,tooltip:a.tooltipBehavior.metadata,validation:a.validationBehavior.metadata,variant:a.variantBehavior.metadata};exports.collectedBehaviorMetadata=t;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./TextBox-B-GWiq0J.cjs"),t={animation:a.animationBehavior.metadata,bookmark:a.bookmarkBehavior.metadata,displayWhen:a.displayWhenBehavior.metadata,formBinding:a.formBindingBehavior.metadata,label:a.labelBehavior.metadata,tooltip:a.tooltipBehavior.metadata,validation:a.validationBehavior.metadata,variant:a.variantBehavior.metadata};exports.collectedBehaviorMetadata=t;
@@ -1,4 +1,4 @@
1
- import { cv as variantBehavior, cw as validationBehavior, cx as tooltipBehavior, cy as labelBehavior, cz as formBindingBehavior, cA as displayWhenBehavior, cB as bookmarkBehavior, cC as animationBehavior } from "./TextBox-CwicjBJI.js";
1
+ import { cu as variantBehavior, cv as validationBehavior, cw as tooltipBehavior, cx as labelBehavior, cy as formBindingBehavior, cz as displayWhenBehavior, cA as bookmarkBehavior, cB as animationBehavior } from "./TextBox-DHSTy0g0.js";
2
2
  const collectedBehaviorMetadata = {
3
3
  animation: animationBehavior.metadata,
4
4
  bookmark: bookmarkBehavior.metadata,
@@ -1,6 +1,6 @@
1
1
  import { delay as delay$1, HttpResponse, matchRequestUrl } from "msw";
2
2
  import { isArray, isObject, mapValues } from "lodash-es";
3
- import { cD as runEventHandlerCode, cE as getDate, cF as delay, cG as miscellaneousUtils, cH as dateFunctions, cI as orderBy, cJ as ThrowStatementError } from "./TextBox-CwicjBJI.js";
3
+ import { cC as runEventHandlerCode, cD as getDate, cE as delay, cF as miscellaneousUtils, cG as dateFunctions, cH as orderBy, cI as ThrowStatementError } from "./TextBox-DHSTy0g0.js";
4
4
  import Dexie from "dexie";
5
5
  var HttpStatusCode = /* @__PURE__ */ ((HttpStatusCode2) => {
6
6
  HttpStatusCode2[HttpStatusCode2["Continue"] = 100] = "Continue";
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("msw"),t=require("lodash-es"),a=require("./TextBox-C-4gnBpw.cjs"),r=require("dexie");var s=(e=>(e[e.Continue=100]="Continue",e[e.SwitchingProtocols=101]="SwitchingProtocols",e[e.Processing=102]="Processing",e[e.EarlyHints=103]="EarlyHints",e[e.Ok=200]="Ok",e[e.Created=201]="Created",e[e.Accepted=202]="Accepted",e[e.NonAuthoritativeInformation=203]="NonAuthoritativeInformation",e[e.NoContent=204]="NoContent",e[e.ResetContent=205]="ResetContent",e[e.PartialContent=206]="PartialContent",e[e.MultiStatus=207]="MultiStatus",e[e.AlreadyReported=208]="AlreadyReported",e[e.ImUsed=226]="ImUsed",e[e.MultipleChoices=300]="MultipleChoices",e[e.MovedPermanently=301]="MovedPermanently",e[e.Found=302]="Found",e[e.SeeOther=303]="SeeOther",e[e.NotModified=304]="NotModified",e[e.UseProxy=305]="UseProxy",e[e.Unused=306]="Unused",e[e.TemporaryRedirect=307]="TemporaryRedirect",e[e.PermanentRedirect=308]="PermanentRedirect",e[e.BadRequest=400]="BadRequest",e[e.Unauthorized=401]="Unauthorized",e[e.PaymentRequired=402]="PaymentRequired",e[e.Forbidden=403]="Forbidden",e[e.NotFound=404]="NotFound",e[e.MethodNotAllowed=405]="MethodNotAllowed",e[e.NotAcceptable=406]="NotAcceptable",e[e.ProxyAuthenticationRequired=407]="ProxyAuthenticationRequired",e[e.RequestTimeout=408]="RequestTimeout",e[e.Conflict=409]="Conflict",e[e.Gone=410]="Gone",e[e.LengthRequired=411]="LengthRequired",e[e.PreconditionFailed=412]="PreconditionFailed",e[e.PayloadTooLarge=413]="PayloadTooLarge",e[e.UriTooLong=414]="UriTooLong",e[e.UnsupportedMediaType=415]="UnsupportedMediaType",e[e.RangeNotSatisfiable=416]="RangeNotSatisfiable",e[e.ExpectationFailed=417]="ExpectationFailed",e[e.ImATeapot=418]="ImATeapot",e[e.MisdirectedRequest=421]="MisdirectedRequest",e[e.UnprocessableEntity=422]="UnprocessableEntity",e[e.Locked=423]="Locked",e[e.FailedDependency=424]="FailedDependency",e[e.TooEarly=425]="TooEarly",e[e.UpgradeRequired=426]="UpgradeRequired",e[e.PreconditionRequired=428]="PreconditionRequired",e[e.TooManyRequests=429]="TooManyRequests",e[e.RequestHeaderFieldsTooLarge=431]="RequestHeaderFieldsTooLarge",e[e.UnavailableForLegalReasons=451]="UnavailableForLegalReasons",e[e.InternalServerError=500]="InternalServerError",e[e.NotImplemented=501]="NotImplemented",e[e.BadGateway=502]="BadGateway",e[e.ServiceUnavailable=503]="ServiceUnavailable",e[e.GatewayTimeout=504]="GatewayTimeout",e[e.HttpVersionNotSupported=505]="HttpVersionNotSupported",e[e.VariantAlsoNegotiates=506]="VariantAlsoNegotiates",e[e.InsufficientStorage=507]="InsufficientStorage",e[e.LoopDetected=508]="LoopDetected",e[e.NotExtended=510]="NotExtended",e[e.NetworkAuthenticationRequired=511]="NetworkAuthenticationRequired",e))(s||{});class i extends Error{constructor(e,t){super(t?.message||"Not found"),this.details=t,this.status=e,Object.setPrototypeOf(this,i.prototype)}}class n extends i{constructor(e){super(404,e),Object.setPrototypeOf(this,n.prototype)}}class o extends i{constructor(e){super(401,e),Object.setPrototypeOf(this,o.prototype)}}class c extends i{constructor(e){super(409,e),Object.setPrototypeOf(this,c.prototype)}}function l(e){let t;return e&&(t="string"==typeof e?{message:e}:e),t}const d={NotFound404:e=>new n(l(e)),Unauthorized401:e=>new o(l(e)),HttpError:(e,t)=>new i(e,l(t)),Conflict409:e=>new c(l(e))},h={getDate:e=>e?new Date(e):new Date},u=(e,a)=>t.isArray(e)?e.map(e=>u(e,a)):t.isObject(e)?t.mapValues(e,e=>u(e,a)):a(e);class p{constructor(){this.cookies={}}setCookie(e,t){this.cookies[e]=t}getCookieHeader(){const e=[];return Object.entries(this.cookies).forEach(([t,a])=>{Array.isArray(a)?a.forEach(a=>e.push(["Set-Cookie",`${t}=${a}`])):e.push(["Set-Cookie",`${t}=${a}`])}),new Headers(e)}}class w{constructor(){this.headers={}}setHeader(e,t){this.headers[e]=t}getHeaders(){const e=[];return Object.entries(this.headers).forEach(([t,a])=>{e.push([t,a])}),new Headers(e)}}class y{constructor(e,t,a){this.definition=e,this.db=t,this.authService=a,this.apiStateHash={},this.resolvedHelpers=u(e.helpers,e=>"string"==typeof e?(...t)=>this.runFn(e,...t):e),e.initialize&&this.runFn(e.initialize)}async executeOperation(e,t,a,r){const s=this.definition.operations?.[e];if(!s)throw new Error(`Unknown backend operation: ${e}`);return await this.runFn(s,t,a,r)}async runFn(e,...t){let r={...this.resolvedHelpers,$db:this.db,$state:this.apiStateHash,$authService:this.authService,$env:h,$loggedInUser:this.authService.getLoggedInUser(),$pathParams:t[0]?.pathParams,$queryParams:t[0]?.queryParams,$requestBody:t[0]?.requestBody,$cookies:t[0]?.cookies,$requestHeaders:t[0]?.requestHeaders,$cookieService:t[1],$headerService:t[2]};const s=(i={localContext:r,eventArgs:t,appContext:{...a.dateFunctions,...a.miscellaneousUtils,delay:a.delay,Errors:d,createFile:(...e)=>new File(e[0],e[1],e[2]),appendBlob:(e,t)=>e&&t?new Blob([e,t],{type:e.type||t.type}):e||t||null,getDate:a.getDate}},{mainThread:{childThreads:[],blocks:[{vars:{}}],loops:[],breakLabelValue:-1},...i});var i;return await a.runEventHandlerCode(e,s),s.mainThread?.blocks?.length?s.mainThread.blocks[s.mainThread.blocks.length-1].returnValue:void 0}}class g{constructor(e){this.list=[];for(const t of e)this.list.push(t)}get length(){return this.list.length}toArray(){return this.list.slice(0)}at(e){if(e<0||e>this.list.length-1)throw new Error(`Index (${e}) is out of range [0..${Math.max(this.list.length-1,0)}]`);return this.list[e]}all(){return new g(this.list)}async single(e){const t=await this.where(e);if(0===t.length)throw new Error("No items found with the specified predicate");if(t.length>1)throw new Error("Multiple items found with the specified predicate");return t.at(0)}async singleOrDefault(e,t){const a=await this.where(e);if(0===a.length)return t;if(a.length>1)throw new Error("Multiple items found with the specified predicate");return a.at(0)}async where(e){return new g(await this.whereAsArray(e))}async whereAsArray(e){const t=await Promise.all(this.list.map(e??(async()=>!0)));return this.list.filter((e,a)=>t[a])}async orderBy(...e){return new g(await a.orderBy(this.list,...e))}async orderByAsArray(...e){return await a.orderBy(this.list,...e)}async groupBy(e){return new g(await this.groupByAsArray(e))}async groupByAsArray(e){const t=new Map;for(const r of this.list){const a=await e(r),s=t.get(a);void 0===s?t.set(a,[r]):s.push(r)}const a=[];for(const[r,s]of t.entries())a.push({key:r,items:s});return a}async distinct(e){e??(e=async e=>e);const t=new Set;for(const a of this.list)t.add(await e(a));return new g(t.values())}async distinctAsArray(e){return(await this.distinct(e)).toArray()}async maxValue(e="id",t){let r=t?(await new g(this.list).where(t)).toArray():this.list;return r=await a.orderBy(r,t=>t[e],!0),0===r.length?void 0:r[0][e]}async skip(e){return new g(this.list.slice(e))}async take(e){return new g(this.list.slice(0,e))}async skipTake(e,t){return new g(this.list.slice(e,t+e))}}class m{constructor(e,t={},a){this.tables=e,this.initialData=t,this.config=a,this.db=null,this.getItems=e=>this.getDb().table(e).toArray(),this.findItems=async(e,t)=>{const a=await this.getItems(e),r=await Promise.all(a.map(t));return a.filter((e,t)=>r[t])},this.getItem=async(e,t)=>{const a=await this.getItems(e),r=await Promise.all(a.map(t));return a.find((e,t)=>r[t])},this.getItemById=async(e,t)=>await this.getItem(e,e=>Promise.resolve(e.id+""==t+"")),this.deleteItems=async(e,t)=>{},this.insertItem=async(e,t)=>{const a=await this.getDb().table(e).add(t);return this.getItemById(e,a)},this.updateItem=async(e,t)=>(await this.getDb().table(e).update(t.id,t),await this.getItemById(e,t.id))}getDb(){if(null===this.db)throw new Error("Db is not initialized yet");return this.db}async initialize(){const e="function"==typeof this.initialData?await this.initialData():this.initialData,t={},a=new Set;this.tables?this.tables.forEach(e=>{const r=[];1===e.pk.length?r.push(e.pk[0]):r.push(`[${e.pk.join("+")}]`),e.indexes&&r.push(...e.indexes),t[e.name]=r.join(", "),a.add(e.name)}):Object.entries(e).forEach(([e])=>{t[e]="++id",a.add(e)});const r=void 0!==this.config?.version&&"number"==typeof this.config?.version?this.config?.version:1,s=await this.dropDbOnVersionChange(r);this.db=this.createDbInstance(),this.db.version(r).stores(t),s&&await Promise.all(Object.entries(e).map(async([e,t])=>{try{await this.getDb().table(e).bulkAdd(t)}catch(a){console.error(a)}})),a.forEach(e=>{this[`$${e}`]=function(e){const t=()=>e.db.table(e.name),a=async t=>{const a=await e.toArray(),r=await Promise.all(a.map(t??(()=>Promise.resolve(!0))));return a.filter((e,t)=>r[t])};return{native:t,insert:async a=>{const r=await e.add(a);return t().get(r)},update:async a=>(await e.update(a.id,a),t().get(a.id)),save:async t=>{const a=await e.put(t);return e.get(a)},deleteById:async t=>{await e.delete(t)},byId:async t=>{if(null==t)return null;let a=t;return"++id"===e.schema.primKey.src&&(a=Number(t)),await e.get(a)},toArray:async()=>await e.toArray(),single:async t=>await new g(await e.toArray()).single(t),singleOrDefault:async(t,a)=>await new g(await e.toArray()).singleOrDefault(t,a),where:async e=>new g(await a(e)),whereAsArray:async e=>await a(e),orderBy:async(...t)=>await new g(await e.toArray()).orderBy(...t),orderByAsArray:async(...t)=>await new g(await e.toArray()).orderByAsArray(...t),groupBy:async t=>await new g(await e.toArray()).groupBy(t),groupByAsArray:async t=>await new g(await e.toArray()).groupByAsArray(t),distinct:async t=>await new g(await e.toArray()).distinct(t),distinctAsArray:async t=>await new g(await e.toArray()).distinctAsArray(t),maxValue:async(t="id",a)=>await new g(await e.toArray()).maxValue(t,a),skip:async t=>await new g(await e.toArray()).skip(t),take:async t=>await new g(await e.toArray()).take(t),skipTake:async(t,a)=>await new g(await e.toArray()).skipTake(t,a)}}(this.getDb().table(e))})}createDbInstance(){return new r(this.config?.database??"defaultIndexDb")}async dropDbOnVersionChange(e){const t=this.createDbInstance();return!(await r.exists(t.name))||(await t.open(),t.verno!==e?(await t.delete(),!0):(t.close(),!1))}async transaction(e){if(!this.db)return;const t=this.db.tables;await this.db.transaction("rw",t,e)}}function f(e,t){if(!t)return e;const a={...e};return Object.keys(e).forEach(r=>{if(!(r in t))return;const s=e[r],i=typeof s;switch(t[r]){case"integer":switch(i){case"number":a[r]=Math.round(s);break;case"string":a[r]=parseInt(s,10);break;case"boolean":a[r]=s?1:0}break;case"float":case"real":case"double":switch(i){case"number":a[r]=s;break;case"string":a[r]=parseFloat(s);break;case"boolean":a[r]=s?1:0}break;case"boolean":switch(i){case"string":switch(s.toLowerCase()){case"true":case"yes":case"on":a[r]=!0;break;case"false":case"no":case"off":a[r]=!1}break;case"number":a[r]=!!s}}}),a}class b{constructor(e,t={},a){this.tables=e,this.initialData=t,this.config=a}getItems(e){throw new Error("Method not implemented.")}getItem(e,t){throw new Error("Method not implemented.")}getItemById(e,t){throw new Error("Method not implemented.")}deleteItems(e,t){throw new Error("Method not implemented.")}insertItem(e,t){throw new Error("Method not implemented.")}updateItem(e,t){throw new Error("Method not implemented.")}async initialize(){}}class k{constructor(e){const t=JSON.parse(sessionStorage.getItem("session-logged-in-user"));this.loggedInUser=t||e?.defaultLoggedInUser}login(e){this.loggedInUser=e,sessionStorage.setItem("session-logged-in-user",JSON.stringify(e))}logout(){this.loggedInUser=null,sessionStorage.removeItem("session-logged-in-user")}getCookieToken(){return sessionStorage.getItem("session-anonymous-token")}setCookieToken(e){sessionStorage.setItem("session-anonymous-token",e)}getLoggedInUser(){return this.loggedInUser}}class A{constructor(e){this.apiDef=e,this.backend=null}async initialize(){const e={};Object.entries(this.apiDef.operations||{}).forEach(([t,a])=>{e[t]=a.handler});const t=await async function(e){if("in-memory"===e.type)return new b(e.schemaDescriptor?.tables,e.initialData,e.config);{const t=new m(e.schemaDescriptor?.tables,e.initialData,e.config);return await t.initialize(),t}}(this.apiDef),a=new k(this.apiDef.auth),r={operations:e,initialize:this.apiDef.initialize,helpers:this.apiDef.helpers};this.backend=new y(r,t,a)}getOperations(){return this.apiDef.operations||{}}getApiUrl(){return this.apiDef.apiUrl||""}async executeOperation(r,n,o,c){if(null===this.backend)throw new Error("Interceptor not initialized");const l=this.apiDef.operations?.[r];if(!l)throw new Error(`Unknown API interceptor operation: ${r}`);let d;try{if("formData"===l.requestShape){const e=await n.formData(),t={};for(const a of e.keys()){const r=e.getAll(a);1===r.length?t[a]=r[0]:t[a]=r}d=t}else d="blob"===l.requestShape?await n.blob():await n.json()}catch(g){}const h=this.convertRequestParams({pathParams:c,queryParams:Object.fromEntries(new URL(n.url).searchParams),requestBody:d,cookies:o,requestHeaders:Object.fromEntries(n.headers.entries())||{}},l);void 0===this.apiDef.artificialDelay?await e.delay("real"):0!==this.apiDef.artificialDelay&&await e.delay(this.apiDef.artificialDelay);const u=new p,y=new w;try{const a=await this.backend.executeOperation(r,h,u,y),i=null==a,n=l.successStatusCode??(i?s.NoContent:s.Ok),o=function(...e){const a={};for(const r of e){if(!t.isObject(r))throw new TypeError("All arguments must be of type object");const e=new Headers(r);for(const[t,r]of e.entries())void 0===r||"undefined"===r?delete a[t]:a[t]=r}return new Headers(a)}(u.getCookieHeader(),y.getHeaders());if(a instanceof File){o.append("Content-type",a.type),o.append("Content-Length",a.size+"");const t=encodeURIComponent(a.name);return o.append("Content-Disposition",`attachment; filename*=UTF-8''${t}`),e.HttpResponse.arrayBuffer(await a.arrayBuffer(),{headers:o,status:n})}return i?new e.HttpResponse(null,{headers:o,status:n}):"string"==typeof a?e.HttpResponse.text(a,{headers:o,status:n}):e.HttpResponse.json(a,{headers:o,status:n})}catch(g){return console.error(g),g instanceof a.ThrowStatementError&&g.errorObject instanceof i?e.HttpResponse.json(g.errorObject.details,{headers:u.getCookieHeader(),status:g.errorObject.status}):e.HttpResponse.json({message:g?.message},{headers:u.getCookieHeader(),status:s.InternalServerError})}}convertRequestParams(e,t){return{...e,pathParams:f(e.pathParams,t.pathParamTypes),queryParams:f(e.queryParams,t.queryParamTypes)}}hasMockForRequest(e,t){return void 0!==this.getMockForRequest(e,t)}getMockForRequest(t,a){return Object.entries(this.getOperations()).find(([r,s])=>!(!e.matchRequestUrl(new URL(t,window.location.href),`${this.getApiUrl()}${s.url}`,`${window.location.href}`).matches||(a.method||"get").toLowerCase()!==s.method.toLowerCase()))}executeMockedFetch(t,a){const r=this.getMockForRequest(t,a);if(!r)throw new Error(`No mock found for request: ${t} with options: ${JSON.stringify(a)}`);const[s,i]=r,n=e.matchRequestUrl(new URL(t,window.location.href),`${this.getApiUrl()}${i.url}`,`${window.location.href}`);return this.executeOperation(s,new Request(t,a),function(){const e=document.cookie;if(""===e)return{};const t=e.split("; ");return t.reduce((e,t)=>{const[a,r]=t.split("=");return e[decodeURIComponent(a)]=decodeURIComponent(r),e},{})}(),n.params)}}exports.initMock=async e=>{const t=new A(e);return await t.initialize(),t};
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("msw"),t=require("lodash-es"),a=require("./TextBox-B-GWiq0J.cjs"),r=require("dexie");var s=(e=>(e[e.Continue=100]="Continue",e[e.SwitchingProtocols=101]="SwitchingProtocols",e[e.Processing=102]="Processing",e[e.EarlyHints=103]="EarlyHints",e[e.Ok=200]="Ok",e[e.Created=201]="Created",e[e.Accepted=202]="Accepted",e[e.NonAuthoritativeInformation=203]="NonAuthoritativeInformation",e[e.NoContent=204]="NoContent",e[e.ResetContent=205]="ResetContent",e[e.PartialContent=206]="PartialContent",e[e.MultiStatus=207]="MultiStatus",e[e.AlreadyReported=208]="AlreadyReported",e[e.ImUsed=226]="ImUsed",e[e.MultipleChoices=300]="MultipleChoices",e[e.MovedPermanently=301]="MovedPermanently",e[e.Found=302]="Found",e[e.SeeOther=303]="SeeOther",e[e.NotModified=304]="NotModified",e[e.UseProxy=305]="UseProxy",e[e.Unused=306]="Unused",e[e.TemporaryRedirect=307]="TemporaryRedirect",e[e.PermanentRedirect=308]="PermanentRedirect",e[e.BadRequest=400]="BadRequest",e[e.Unauthorized=401]="Unauthorized",e[e.PaymentRequired=402]="PaymentRequired",e[e.Forbidden=403]="Forbidden",e[e.NotFound=404]="NotFound",e[e.MethodNotAllowed=405]="MethodNotAllowed",e[e.NotAcceptable=406]="NotAcceptable",e[e.ProxyAuthenticationRequired=407]="ProxyAuthenticationRequired",e[e.RequestTimeout=408]="RequestTimeout",e[e.Conflict=409]="Conflict",e[e.Gone=410]="Gone",e[e.LengthRequired=411]="LengthRequired",e[e.PreconditionFailed=412]="PreconditionFailed",e[e.PayloadTooLarge=413]="PayloadTooLarge",e[e.UriTooLong=414]="UriTooLong",e[e.UnsupportedMediaType=415]="UnsupportedMediaType",e[e.RangeNotSatisfiable=416]="RangeNotSatisfiable",e[e.ExpectationFailed=417]="ExpectationFailed",e[e.ImATeapot=418]="ImATeapot",e[e.MisdirectedRequest=421]="MisdirectedRequest",e[e.UnprocessableEntity=422]="UnprocessableEntity",e[e.Locked=423]="Locked",e[e.FailedDependency=424]="FailedDependency",e[e.TooEarly=425]="TooEarly",e[e.UpgradeRequired=426]="UpgradeRequired",e[e.PreconditionRequired=428]="PreconditionRequired",e[e.TooManyRequests=429]="TooManyRequests",e[e.RequestHeaderFieldsTooLarge=431]="RequestHeaderFieldsTooLarge",e[e.UnavailableForLegalReasons=451]="UnavailableForLegalReasons",e[e.InternalServerError=500]="InternalServerError",e[e.NotImplemented=501]="NotImplemented",e[e.BadGateway=502]="BadGateway",e[e.ServiceUnavailable=503]="ServiceUnavailable",e[e.GatewayTimeout=504]="GatewayTimeout",e[e.HttpVersionNotSupported=505]="HttpVersionNotSupported",e[e.VariantAlsoNegotiates=506]="VariantAlsoNegotiates",e[e.InsufficientStorage=507]="InsufficientStorage",e[e.LoopDetected=508]="LoopDetected",e[e.NotExtended=510]="NotExtended",e[e.NetworkAuthenticationRequired=511]="NetworkAuthenticationRequired",e))(s||{});class i extends Error{constructor(e,t){super(t?.message||"Not found"),this.details=t,this.status=e,Object.setPrototypeOf(this,i.prototype)}}class n extends i{constructor(e){super(404,e),Object.setPrototypeOf(this,n.prototype)}}class o extends i{constructor(e){super(401,e),Object.setPrototypeOf(this,o.prototype)}}class c extends i{constructor(e){super(409,e),Object.setPrototypeOf(this,c.prototype)}}function l(e){let t;return e&&(t="string"==typeof e?{message:e}:e),t}const d={NotFound404:e=>new n(l(e)),Unauthorized401:e=>new o(l(e)),HttpError:(e,t)=>new i(e,l(t)),Conflict409:e=>new c(l(e))},h={getDate:e=>e?new Date(e):new Date},u=(e,a)=>t.isArray(e)?e.map(e=>u(e,a)):t.isObject(e)?t.mapValues(e,e=>u(e,a)):a(e);class p{constructor(){this.cookies={}}setCookie(e,t){this.cookies[e]=t}getCookieHeader(){const e=[];return Object.entries(this.cookies).forEach(([t,a])=>{Array.isArray(a)?a.forEach(a=>e.push(["Set-Cookie",`${t}=${a}`])):e.push(["Set-Cookie",`${t}=${a}`])}),new Headers(e)}}class w{constructor(){this.headers={}}setHeader(e,t){this.headers[e]=t}getHeaders(){const e=[];return Object.entries(this.headers).forEach(([t,a])=>{e.push([t,a])}),new Headers(e)}}class y{constructor(e,t,a){this.definition=e,this.db=t,this.authService=a,this.apiStateHash={},this.resolvedHelpers=u(e.helpers,e=>"string"==typeof e?(...t)=>this.runFn(e,...t):e),e.initialize&&this.runFn(e.initialize)}async executeOperation(e,t,a,r){const s=this.definition.operations?.[e];if(!s)throw new Error(`Unknown backend operation: ${e}`);return await this.runFn(s,t,a,r)}async runFn(e,...t){let r={...this.resolvedHelpers,$db:this.db,$state:this.apiStateHash,$authService:this.authService,$env:h,$loggedInUser:this.authService.getLoggedInUser(),$pathParams:t[0]?.pathParams,$queryParams:t[0]?.queryParams,$requestBody:t[0]?.requestBody,$cookies:t[0]?.cookies,$requestHeaders:t[0]?.requestHeaders,$cookieService:t[1],$headerService:t[2]};const s=(i={localContext:r,eventArgs:t,appContext:{...a.dateFunctions,...a.miscellaneousUtils,delay:a.delay,Errors:d,createFile:(...e)=>new File(e[0],e[1],e[2]),appendBlob:(e,t)=>e&&t?new Blob([e,t],{type:e.type||t.type}):e||t||null,getDate:a.getDate}},{mainThread:{childThreads:[],blocks:[{vars:{}}],loops:[],breakLabelValue:-1},...i});var i;return await a.runEventHandlerCode(e,s),s.mainThread?.blocks?.length?s.mainThread.blocks[s.mainThread.blocks.length-1].returnValue:void 0}}class g{constructor(e){this.list=[];for(const t of e)this.list.push(t)}get length(){return this.list.length}toArray(){return this.list.slice(0)}at(e){if(e<0||e>this.list.length-1)throw new Error(`Index (${e}) is out of range [0..${Math.max(this.list.length-1,0)}]`);return this.list[e]}all(){return new g(this.list)}async single(e){const t=await this.where(e);if(0===t.length)throw new Error("No items found with the specified predicate");if(t.length>1)throw new Error("Multiple items found with the specified predicate");return t.at(0)}async singleOrDefault(e,t){const a=await this.where(e);if(0===a.length)return t;if(a.length>1)throw new Error("Multiple items found with the specified predicate");return a.at(0)}async where(e){return new g(await this.whereAsArray(e))}async whereAsArray(e){const t=await Promise.all(this.list.map(e??(async()=>!0)));return this.list.filter((e,a)=>t[a])}async orderBy(...e){return new g(await a.orderBy(this.list,...e))}async orderByAsArray(...e){return await a.orderBy(this.list,...e)}async groupBy(e){return new g(await this.groupByAsArray(e))}async groupByAsArray(e){const t=new Map;for(const r of this.list){const a=await e(r),s=t.get(a);void 0===s?t.set(a,[r]):s.push(r)}const a=[];for(const[r,s]of t.entries())a.push({key:r,items:s});return a}async distinct(e){e??(e=async e=>e);const t=new Set;for(const a of this.list)t.add(await e(a));return new g(t.values())}async distinctAsArray(e){return(await this.distinct(e)).toArray()}async maxValue(e="id",t){let r=t?(await new g(this.list).where(t)).toArray():this.list;return r=await a.orderBy(r,t=>t[e],!0),0===r.length?void 0:r[0][e]}async skip(e){return new g(this.list.slice(e))}async take(e){return new g(this.list.slice(0,e))}async skipTake(e,t){return new g(this.list.slice(e,t+e))}}class m{constructor(e,t={},a){this.tables=e,this.initialData=t,this.config=a,this.db=null,this.getItems=e=>this.getDb().table(e).toArray(),this.findItems=async(e,t)=>{const a=await this.getItems(e),r=await Promise.all(a.map(t));return a.filter((e,t)=>r[t])},this.getItem=async(e,t)=>{const a=await this.getItems(e),r=await Promise.all(a.map(t));return a.find((e,t)=>r[t])},this.getItemById=async(e,t)=>await this.getItem(e,e=>Promise.resolve(e.id+""==t+"")),this.deleteItems=async(e,t)=>{},this.insertItem=async(e,t)=>{const a=await this.getDb().table(e).add(t);return this.getItemById(e,a)},this.updateItem=async(e,t)=>(await this.getDb().table(e).update(t.id,t),await this.getItemById(e,t.id))}getDb(){if(null===this.db)throw new Error("Db is not initialized yet");return this.db}async initialize(){const e="function"==typeof this.initialData?await this.initialData():this.initialData,t={},a=new Set;this.tables?this.tables.forEach(e=>{const r=[];1===e.pk.length?r.push(e.pk[0]):r.push(`[${e.pk.join("+")}]`),e.indexes&&r.push(...e.indexes),t[e.name]=r.join(", "),a.add(e.name)}):Object.entries(e).forEach(([e])=>{t[e]="++id",a.add(e)});const r=void 0!==this.config?.version&&"number"==typeof this.config?.version?this.config?.version:1,s=await this.dropDbOnVersionChange(r);this.db=this.createDbInstance(),this.db.version(r).stores(t),s&&await Promise.all(Object.entries(e).map(async([e,t])=>{try{await this.getDb().table(e).bulkAdd(t)}catch(a){console.error(a)}})),a.forEach(e=>{this[`$${e}`]=function(e){const t=()=>e.db.table(e.name),a=async t=>{const a=await e.toArray(),r=await Promise.all(a.map(t??(()=>Promise.resolve(!0))));return a.filter((e,t)=>r[t])};return{native:t,insert:async a=>{const r=await e.add(a);return t().get(r)},update:async a=>(await e.update(a.id,a),t().get(a.id)),save:async t=>{const a=await e.put(t);return e.get(a)},deleteById:async t=>{await e.delete(t)},byId:async t=>{if(null==t)return null;let a=t;return"++id"===e.schema.primKey.src&&(a=Number(t)),await e.get(a)},toArray:async()=>await e.toArray(),single:async t=>await new g(await e.toArray()).single(t),singleOrDefault:async(t,a)=>await new g(await e.toArray()).singleOrDefault(t,a),where:async e=>new g(await a(e)),whereAsArray:async e=>await a(e),orderBy:async(...t)=>await new g(await e.toArray()).orderBy(...t),orderByAsArray:async(...t)=>await new g(await e.toArray()).orderByAsArray(...t),groupBy:async t=>await new g(await e.toArray()).groupBy(t),groupByAsArray:async t=>await new g(await e.toArray()).groupByAsArray(t),distinct:async t=>await new g(await e.toArray()).distinct(t),distinctAsArray:async t=>await new g(await e.toArray()).distinctAsArray(t),maxValue:async(t="id",a)=>await new g(await e.toArray()).maxValue(t,a),skip:async t=>await new g(await e.toArray()).skip(t),take:async t=>await new g(await e.toArray()).take(t),skipTake:async(t,a)=>await new g(await e.toArray()).skipTake(t,a)}}(this.getDb().table(e))})}createDbInstance(){return new r(this.config?.database??"defaultIndexDb")}async dropDbOnVersionChange(e){const t=this.createDbInstance();return!(await r.exists(t.name))||(await t.open(),t.verno!==e?(await t.delete(),!0):(t.close(),!1))}async transaction(e){if(!this.db)return;const t=this.db.tables;await this.db.transaction("rw",t,e)}}function f(e,t){if(!t)return e;const a={...e};return Object.keys(e).forEach(r=>{if(!(r in t))return;const s=e[r],i=typeof s;switch(t[r]){case"integer":switch(i){case"number":a[r]=Math.round(s);break;case"string":a[r]=parseInt(s,10);break;case"boolean":a[r]=s?1:0}break;case"float":case"real":case"double":switch(i){case"number":a[r]=s;break;case"string":a[r]=parseFloat(s);break;case"boolean":a[r]=s?1:0}break;case"boolean":switch(i){case"string":switch(s.toLowerCase()){case"true":case"yes":case"on":a[r]=!0;break;case"false":case"no":case"off":a[r]=!1}break;case"number":a[r]=!!s}}}),a}class b{constructor(e,t={},a){this.tables=e,this.initialData=t,this.config=a}getItems(e){throw new Error("Method not implemented.")}getItem(e,t){throw new Error("Method not implemented.")}getItemById(e,t){throw new Error("Method not implemented.")}deleteItems(e,t){throw new Error("Method not implemented.")}insertItem(e,t){throw new Error("Method not implemented.")}updateItem(e,t){throw new Error("Method not implemented.")}async initialize(){}}class k{constructor(e){const t=JSON.parse(sessionStorage.getItem("session-logged-in-user"));this.loggedInUser=t||e?.defaultLoggedInUser}login(e){this.loggedInUser=e,sessionStorage.setItem("session-logged-in-user",JSON.stringify(e))}logout(){this.loggedInUser=null,sessionStorage.removeItem("session-logged-in-user")}getCookieToken(){return sessionStorage.getItem("session-anonymous-token")}setCookieToken(e){sessionStorage.setItem("session-anonymous-token",e)}getLoggedInUser(){return this.loggedInUser}}class A{constructor(e){this.apiDef=e,this.backend=null}async initialize(){const e={};Object.entries(this.apiDef.operations||{}).forEach(([t,a])=>{e[t]=a.handler});const t=await async function(e){if("in-memory"===e.type)return new b(e.schemaDescriptor?.tables,e.initialData,e.config);{const t=new m(e.schemaDescriptor?.tables,e.initialData,e.config);return await t.initialize(),t}}(this.apiDef),a=new k(this.apiDef.auth),r={operations:e,initialize:this.apiDef.initialize,helpers:this.apiDef.helpers};this.backend=new y(r,t,a)}getOperations(){return this.apiDef.operations||{}}getApiUrl(){return this.apiDef.apiUrl||""}async executeOperation(r,n,o,c){if(null===this.backend)throw new Error("Interceptor not initialized");const l=this.apiDef.operations?.[r];if(!l)throw new Error(`Unknown API interceptor operation: ${r}`);let d;try{if("formData"===l.requestShape){const e=await n.formData(),t={};for(const a of e.keys()){const r=e.getAll(a);1===r.length?t[a]=r[0]:t[a]=r}d=t}else d="blob"===l.requestShape?await n.blob():await n.json()}catch(g){}const h=this.convertRequestParams({pathParams:c,queryParams:Object.fromEntries(new URL(n.url).searchParams),requestBody:d,cookies:o,requestHeaders:Object.fromEntries(n.headers.entries())||{}},l);void 0===this.apiDef.artificialDelay?await e.delay("real"):0!==this.apiDef.artificialDelay&&await e.delay(this.apiDef.artificialDelay);const u=new p,y=new w;try{const a=await this.backend.executeOperation(r,h,u,y),i=null==a,n=l.successStatusCode??(i?s.NoContent:s.Ok),o=function(...e){const a={};for(const r of e){if(!t.isObject(r))throw new TypeError("All arguments must be of type object");const e=new Headers(r);for(const[t,r]of e.entries())void 0===r||"undefined"===r?delete a[t]:a[t]=r}return new Headers(a)}(u.getCookieHeader(),y.getHeaders());if(a instanceof File){o.append("Content-type",a.type),o.append("Content-Length",a.size+"");const t=encodeURIComponent(a.name);return o.append("Content-Disposition",`attachment; filename*=UTF-8''${t}`),e.HttpResponse.arrayBuffer(await a.arrayBuffer(),{headers:o,status:n})}return i?new e.HttpResponse(null,{headers:o,status:n}):"string"==typeof a?e.HttpResponse.text(a,{headers:o,status:n}):e.HttpResponse.json(a,{headers:o,status:n})}catch(g){return console.error(g),g instanceof a.ThrowStatementError&&g.errorObject instanceof i?e.HttpResponse.json(g.errorObject.details,{headers:u.getCookieHeader(),status:g.errorObject.status}):e.HttpResponse.json({message:g?.message},{headers:u.getCookieHeader(),status:s.InternalServerError})}}convertRequestParams(e,t){return{...e,pathParams:f(e.pathParams,t.pathParamTypes),queryParams:f(e.queryParams,t.queryParamTypes)}}hasMockForRequest(e,t){return void 0!==this.getMockForRequest(e,t)}getMockForRequest(t,a){return Object.entries(this.getOperations()).find(([r,s])=>!(!e.matchRequestUrl(new URL(t,window.location.href),`${this.getApiUrl()}${s.url}`,`${window.location.href}`).matches||(a.method||"get").toLowerCase()!==s.method.toLowerCase()))}executeMockedFetch(t,a){const r=this.getMockForRequest(t,a);if(!r)throw new Error(`No mock found for request: ${t} with options: ${JSON.stringify(a)}`);const[s,i]=r,n=e.matchRequestUrl(new URL(t,window.location.href),`${this.getApiUrl()}${i.url}`,`${window.location.href}`);return this.executeOperation(s,new Request(t,a),function(){const e=document.cookie;if(""===e)return{};const t=e.split("; ");return t.reduce((e,t)=>{const[a,r]=t.split("=");return e[decodeURIComponent(a)]=decodeURIComponent(r),e},{})}(),n.params)}}exports.initMock=async e=>{const t=new A(e);return await t.initialize(),t};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./transform-CkTQ-Bfe.cjs");class e{constructor(t){this.metadata=t}getProp(t){return this.metadata.props[t]??n[t]}getAttr(e){if(t.onPrefixRegex.test(e)){const a=t.stripOnPrefix(e),n=this.metadata.events?.[a];if(n)return n}const r=this.metadata.props?.[e];if(r)return r;const s=this.metadata.apis?.[e];if(s)return s;const o=a(e);return o||n[e]}getAttrForKind({name:t,kind:e}){switch(e){case"api":return this.metadata.apis[t];case"event":return this.metadata.events[t];case"prop":return this.metadata.props[t];case"implicit":return n[t];case"layout":return a(t)}}getAllAttributes(){const e=[];for(const t of Object.keys(this.metadata.props??{}))e.push({name:t,kind:"prop"});for(const t of Object.keys(this.metadata.events??{}))e.push({name:t,kind:"event"});for(const t of Object.keys(this.metadata.apis??{}))e.push({name:t,kind:"api"});for(const a of t.layoutOptionKeys)e.push({name:a,kind:"layout"});for(const t of Object.keys(n))e.push({name:t,kind:"implicit"});return e}getEvent(t){return this.metadata.events?.[t]}getApi(t){return this.metadata.apis?.[t]}get events(){return this.metadata.events}get apis(){return this.metadata.apis}get contextVars(){return this.metadata.contextVars}get allowArbitraryProps(){return this.metadata.allowArbitraryProps}get shortDescription(){return this.metadata.shortDescription}getMetadata(){return this.metadata}}function a(e){const a={description:"Layout property. Not yet documented"};if(t.layoutOptionKeys.includes(e))return a;for(const n of t.viewportSizeMd){const r="-"+n.value;if(e.endsWith(r)){const n=e.slice(0,-r.length);if(t.layoutOptionKeys.includes(n))return a}}return null}const n={inspect:{description:"Determines whether the component can be inspected or not",defaultValue:!1,valueType:"boolean"},data:{description:"Specifies the data source for a component. Can be a URL string (fetched automatically), a DataSource or an expression to evaluate. Changes to this property trigger UI updates once data is loaded."},when:{description:"Specifies a condition that must be met for the component to be displayed",defaultValue:!0,valueType:"boolean"}};exports.ComponentMetadataProvider=e,exports.MetadataProvider=class{constructor(t){this.metadataCollection=t}componentNames(){return Object.keys(this.metadataCollection)}getComponent(t){const a=this.metadataCollection[t];return a?new e(a):null}},exports.addOnPrefix=function(t){return"on"+t[0].toUpperCase()+t.substring(1)};
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./transform-BOf-UbgP.cjs");class e{constructor(t){this.metadata=t}getProp(t){return this.metadata.props[t]??n[t]}getAttr(e){if(t.onPrefixRegex.test(e)){const a=t.stripOnPrefix(e),n=this.metadata.events?.[a];if(n)return n}const r=this.metadata.props?.[e];if(r)return r;const s=this.metadata.apis?.[e];if(s)return s;const o=a(e);return o||n[e]}getAttrForKind({name:t,kind:e}){switch(e){case"api":return this.metadata.apis[t];case"event":return this.metadata.events[t];case"prop":return this.metadata.props[t];case"implicit":return n[t];case"layout":return a(t)}}getAllAttributes(){const e=[];for(const t of Object.keys(this.metadata.props??{}))e.push({name:t,kind:"prop"});for(const t of Object.keys(this.metadata.events??{}))e.push({name:t,kind:"event"});for(const t of Object.keys(this.metadata.apis??{}))e.push({name:t,kind:"api"});for(const a of t.layoutOptionKeys)e.push({name:a,kind:"layout"});for(const t of Object.keys(n))e.push({name:t,kind:"implicit"});return e}getEvent(t){return this.metadata.events?.[t]}getApi(t){return this.metadata.apis?.[t]}get events(){return this.metadata.events}get apis(){return this.metadata.apis}get contextVars(){return this.metadata.contextVars}get allowArbitraryProps(){return this.metadata.allowArbitraryProps}get shortDescription(){return this.metadata.shortDescription}getMetadata(){return this.metadata}}function a(e){const a={description:"Layout property. Not yet documented"};if(t.layoutOptionKeys.includes(e))return a;for(const n of t.viewportSizeMd){const r="-"+n.value;if(e.endsWith(r)){const n=e.slice(0,-r.length);if(t.layoutOptionKeys.includes(n))return a}}return null}const n={inspect:{description:"Determines whether the component can be inspected or not",defaultValue:!1,valueType:"boolean"},data:{description:"Specifies the data source for a component. Can be a URL string (fetched automatically), a DataSource or an expression to evaluate. Changes to this property trigger UI updates once data is loaded."},when:{description:"Specifies a condition that must be met for the component to be displayed",defaultValue:!0,valueType:"boolean"}};exports.ComponentMetadataProvider=e,exports.MetadataProvider=class{constructor(t){this.metadataCollection=t}componentNames(){return Object.keys(this.metadataCollection)}getComponent(t){const a=this.metadataCollection[t];return a?new e(a):null}},exports.addOnPrefix=function(t){return"on"+t[0].toUpperCase()+t.substring(1)};
@@ -1,4 +1,4 @@
1
- import { ay as onPrefixRegex, az as stripOnPrefix, l as layoutOptionKeys, aA as viewportSizeMd } from "./transform-D0SWbm8g.js";
1
+ import { ay as onPrefixRegex, az as stripOnPrefix, l as layoutOptionKeys, aA as viewportSizeMd } from "./transform-fGDqiHwH.js";
2
2
  class MetadataProvider {
3
3
  constructor(metadataCollection) {
4
4
  this.metadataCollection = metadataCollection;
@@ -0,0 +1 @@
1
+ "use strict";const e=require("@eslint-community/regexpp"),t=["xs","sm","md","lg","xl"];const r=["attention","primary","secondary"],n=["solid","outlined","ghost"],s=[...n],i=["start","end"],a=["start","end"],o=["title","cite","dateTime"],l=["xs","sm","md","lg","xl","xxl"],c="__PARSED__",p="_ARROW_EXPR_";const d=Object.freeze(Object.defineProperty({__proto__:null,T_ARRAY_DESTRUCTURE:202,T_ARRAY_LITERAL:110,T_ARROW_EXPRESSION:115,T_ARROW_EXPRESSION_STATEMENT:4,T_ASSIGNMENT_EXPRESSION:113,T_ASYNC_FUNCTION_DECLARATION:21,T_AWAIT_EXPRESSION:119,T_BINARY_EXPRESSION:101,T_BLOCK_STATEMENT:1,T_BREAK_STATEMENT:10,T_CALCULATED_MEMBER_ACCESS_EXPRESSION:106,T_CONDITIONAL_EXPRESSION:103,T_CONST_STATEMENT:6,T_CONTINUE_STATEMENT:11,T_DESTRUCTURE:201,T_DO_WHILE_STATEMENT:13,T_EMPTY_STATEMENT:2,T_EXPRESSION_STATEMENT:3,T_FOR_IN_STATEMENT:15,T_FOR_OF_STATEMENT:16,T_FOR_STATEMENT:14,T_FUNCTION_DECLARATION:20,T_FUNCTION_INVOCATION_EXPRESSION:104,T_IDENTIFIER:107,T_IF_STATEMENT:8,T_IMPORT_DECLARATION:22,T_IMPORT_SPECIFIER:205,T_LET_STATEMENT:5,T_LITERAL:109,T_MEMBER_ACCESS_EXPRESSION:105,T_NEW_EXPRESSION:120,T_NO_ARG_EXPRESSION:114,T_OBJECT_DESTRUCTURE:203,T_OBJECT_LITERAL:111,T_POSTFIX_OP_EXPRESSION:117,T_PREFIX_OP_EXPRESSION:116,T_REACTIVE_VAR_DECLARATION:118,T_RETURN_STATEMENT:9,T_SEQUENCE_EXPRESSION:102,T_SPREAD_EXPRESSION:112,T_SWITCH_CASE:204,T_SWITCH_STATEMENT:19,T_TEMPLATE_LITERAL_EXPRESSION:108,T_THROW_STATEMENT:17,T_TRY_STATEMENT:18,T_UNARY_EXPRESSION:100,T_VAR_DECLARATION:200,T_VAR_STATEMENT:7,T_WHILE_STATEMENT:12},Symbol.toStringTag,{value:"Module"})),{T_BLOCK_STATEMENT:u,T_EMPTY_STATEMENT:h,T_EXPRESSION_STATEMENT:f,T_ARROW_EXPRESSION_STATEMENT:m,T_LET_STATEMENT:x,T_CONST_STATEMENT:E,T_VAR_STATEMENT:g,T_IF_STATEMENT:T,T_RETURN_STATEMENT:k,T_BREAK_STATEMENT:_,T_CONTINUE_STATEMENT:S,T_WHILE_STATEMENT:N,T_DO_WHILE_STATEMENT:A,T_FOR_STATEMENT:b,T_FOR_IN_STATEMENT:y,T_FOR_OF_STATEMENT:I,T_THROW_STATEMENT:v,T_TRY_STATEMENT:C,T_SWITCH_STATEMENT:R,T_FUNCTION_DECLARATION:L,T_ASYNC_FUNCTION_DECLARATION:O,T_IMPORT_DECLARATION:w,T_UNARY_EXPRESSION:D,T_BINARY_EXPRESSION:P,T_SEQUENCE_EXPRESSION:W,T_CONDITIONAL_EXPRESSION:B,T_FUNCTION_INVOCATION_EXPRESSION:U,T_MEMBER_ACCESS_EXPRESSION:M,T_CALCULATED_MEMBER_ACCESS_EXPRESSION:F,T_IDENTIFIER:q,T_TEMPLATE_LITERAL_EXPRESSION:X,T_LITERAL:V,T_ARRAY_LITERAL:$,T_OBJECT_LITERAL:j,T_SPREAD_EXPRESSION:H,T_ASSIGNMENT_EXPRESSION:z,T_NO_ARG_EXPRESSION:G,T_ARROW_EXPRESSION:K,T_PREFIX_OP_EXPRESSION:Q,T_POSTFIX_OP_EXPRESSION:Y,T_REACTIVE_VAR_DECLARATION:J,T_AWAIT_EXPRESSION:Z,T_NEW_EXPRESSION:ee,T_VAR_DECLARATION:te,T_DESTRUCTURE:re,T_ARRAY_DESTRUCTURE:ne,T_OBJECT_DESTRUCTURE:se,T_SWITCH_CASE:ie,T_IMPORT_SPECIFIER:ae}=d;class oe{constructor(e){this.source=e,this._pos=0,this._line=1,this._column=0}get position(){return this._pos}get line(){return this._line}get column(){return this._column}peek(){return this.ahead(0)}ahead(e=1){return this._pos+e>this.source.length-1?null:this.source[this._pos+e]}get(){if(this._pos>=this.source.length)return null;const e=this.source[this._pos++];return"\n"===e?(this._line++,this._column=0):this._column++,e}getTail(e){return this.source?.substring(e)??""}}var le=(e=>(e[e.Eof=-1]="Eof",e[e.Ws=-2]="Ws",e[e.BlockComment=-3]="BlockComment",e[e.EolComment=-4]="EolComment",e[e.Unknown=0]="Unknown",e[e.LParent=1]="LParent",e[e.RParent=2]="RParent",e[e.Identifier=3]="Identifier",e[e.Exponent=4]="Exponent",e[e.Divide=5]="Divide",e[e.Multiply=6]="Multiply",e[e.Remainder=7]="Remainder",e[e.Plus=8]="Plus",e[e.Minus=9]="Minus",e[e.BitwiseXor=10]="BitwiseXor",e[e.BitwiseOr=11]="BitwiseOr",e[e.LogicalOr=12]="LogicalOr",e[e.BitwiseAnd=13]="BitwiseAnd",e[e.LogicalAnd=14]="LogicalAnd",e[e.IncOp=15]="IncOp",e[e.DecOp=16]="DecOp",e[e.Assignment=17]="Assignment",e[e.AddAssignment=18]="AddAssignment",e[e.SubtractAssignment=19]="SubtractAssignment",e[e.ExponentAssignment=20]="ExponentAssignment",e[e.MultiplyAssignment=21]="MultiplyAssignment",e[e.DivideAssignment=22]="DivideAssignment",e[e.RemainderAssignment=23]="RemainderAssignment",e[e.ShiftLeftAssignment=24]="ShiftLeftAssignment",e[e.ShiftRightAssignment=25]="ShiftRightAssignment",e[e.SignedShiftRightAssignment=26]="SignedShiftRightAssignment",e[e.BitwiseAndAssignment=27]="BitwiseAndAssignment",e[e.BitwiseXorAssignment=28]="BitwiseXorAssignment",e[e.BitwiseOrAssignment=29]="BitwiseOrAssignment",e[e.LogicalAndAssignment=30]="LogicalAndAssignment",e[e.LogicalOrAssignment=31]="LogicalOrAssignment",e[e.NullCoalesceAssignment=32]="NullCoalesceAssignment",e[e.Semicolon=33]="Semicolon",e[e.Comma=34]="Comma",e[e.Colon=35]="Colon",e[e.LSquare=36]="LSquare",e[e.RSquare=37]="RSquare",e[e.QuestionMark=38]="QuestionMark",e[e.NullCoalesce=39]="NullCoalesce",e[e.OptionalChaining=40]="OptionalChaining",e[e.BinaryNot=41]="BinaryNot",e[e.LBrace=42]="LBrace",e[e.RBrace=43]="RBrace",e[e.Equal=44]="Equal",e[e.StrictEqual=45]="StrictEqual",e[e.LogicalNot=46]="LogicalNot",e[e.NotEqual=47]="NotEqual",e[e.StrictNotEqual=48]="StrictNotEqual",e[e.LessThan=49]="LessThan",e[e.LessThanOrEqual=50]="LessThanOrEqual",e[e.ShiftLeft=51]="ShiftLeft",e[e.GreaterThan=52]="GreaterThan",e[e.GreaterThanOrEqual=53]="GreaterThanOrEqual",e[e.ShiftRight=54]="ShiftRight",e[e.SignedShiftRight=55]="SignedShiftRight",e[e.Dot=56]="Dot",e[e.Spread=57]="Spread",e[e.Backtick=58]="Backtick",e[e.DollarLBrace=59]="DollarLBrace",e[e.Arrow=60]="Arrow",e[e.DecimalLiteral=61]="DecimalLiteral",e[e.HexadecimalLiteral=62]="HexadecimalLiteral",e[e.BinaryLiteral=63]="BinaryLiteral",e[e.RealLiteral=64]="RealLiteral",e[e.StringLiteral=65]="StringLiteral",e[e[1/0]=66]="Infinity",e[e.NaN=67]="NaN",e[e.True=68]="True",e[e.False=69]="False",e[e.Typeof=70]="Typeof",e[e.Null=71]="Null",e[e.Undefined=72]="Undefined",e[e.In=73]="In",e[e.Instanceof=74]="Instanceof",e[e.Let=75]="Let",e[e.Const=76]="Const",e[e.Var=77]="Var",e[e.If=78]="If",e[e.Else=79]="Else",e[e.Return=80]="Return",e[e.Break=81]="Break",e[e.Continue=82]="Continue",e[e.Do=83]="Do",e[e.While=84]="While",e[e.For=85]="For",e[e.Of=86]="Of",e[e.Try=87]="Try",e[e.Catch=88]="Catch",e[e.Finally=89]="Finally",e[e.Throw=90]="Throw",e[e.Switch=91]="Switch",e[e.Case=92]="Case",e[e.Default=93]="Default",e[e.Delete=94]="Delete",e[e.Function=95]="Function",e[e.New=96]="New",e[e.As=97]="As",e[e.Import=98]="Import",e[e.From=99]="From",e))(le||{});class ce{constructor(e){this.input=e,this._ahead=[],this._prefetched=null,this._prefetchedPos=null,this._prefetchedColumn=null,this._lastFetchPosition=0,this._phaseExternallySet=null}peek(e=!1){return this.ahead(0,e)}ahead(e=1,t=!1){if(e>16)throw new Error("Cannot look ahead more than 16 tokens");for(;this._ahead.length<=e;){const e=this.fetch();if(de(e))return e;(t||!t&&!ue(e))&&this._ahead.push(e)}return this._ahead[e]}get(e=!1){if(this._ahead.length>0){const e=this._ahead.shift();if(!e)throw new Error("Token expected");return e}for(;;){const t=this.fetch();if(de(t)||e||!e&&!ue(t))return t}}getRegEx(){return this.fetchRegEx()}getTail(){return this._ahead.length>0?this.input.getTail(this._ahead[0].startPosition):this.input.getTail(this._lastFetchPosition)}setStartingPhaseToTemplateLiteral(){this._phaseExternallySet=33}fetchNextChar(){return this._prefetched||(this._prefetchedPos=this.input.position,this._prefetchedColumn=this.input.column,this._prefetched=this.input.get()),this._prefetched}fetch(){const e=this.input,t=this._prefetchedPos||e.position,r=e.line,n=this._prefetchedColumn||e.column;this._lastFetchPosition=this.input.position;let s=null,i="",a=le.Eof,o=e.position,l=e.column,c=null,p=!1;const d=()=>{i+=c,this._prefetched=null,this._prefetchedPos=null,this._prefetchedColumn=null,o=e.position,l=e.position};let u=this.getStartingPhaseThenReset();for(;;){if(c=this.fetchNextChar(),null===c)return h();a===le.Eof&&(a=le.Unknown);e:switch(u){case 0:switch(c){case" ":case"\t":case"\n":case"\r":u=1,a=le.Ws;break;case"/":u=5,a=le.Divide;break;case"$":u=6,a=le.Identifier;break;case"*":u=8,a=le.Multiply;break;case"%":u=53,a=le.Remainder;break;case"+":u=50,a=le.Plus;break;case"-":u=51,a=le.Minus;break;case"^":u=57,a=le.BitwiseXor;break;case"|":u=7,a=le.BitwiseOr;break;case"&":u=9,a=le.BitwiseAnd;break;case"?":u=21,a=le.QuestionMark;break;case";":return f(le.Semicolon);case",":return f(le.Comma);case"(":return f(le.LParent);case")":return f(le.RParent);case":":return f(le.Colon);case"`":return f(le.Backtick);case"[":return f(le.LSquare);case"]":return f(le.RSquare);case"~":return f(le.BinaryNot);case"{":return f(le.LBrace);case"}":return f(le.RBrace);case"=":u=10,a=le.Assignment;break;case"!":u=13,a=le.LogicalNot;break;case"<":u=14,a=le.LessThan;break;case">":u=15,a=le.GreaterThan;break;case"0":u=20,a=le.DecimalLiteral;break;case".":u=18,a=le.Dot;break;case'"':case"'":s=c,u=34;break;default:he(c)?(p=!0,u=17,a=le.Identifier):xe(c)?(u=26,a=le.DecimalLiteral):f(le.Unknown)}break;case 1:if(" "!==c&&"\t"!==c&&"\r"!==c&&"\n"!==c)return h();break;case 3:"*"===c&&(u=4);break;case 4:if("/"===c)return f(le.BlockComment);break;case 2:if("\n"===c)return f();break;case 17:if(!fe(c))return h();break;case 5:if("*"===c)u=3;else{if("/"!==c)return"="===c?f(le.DivideAssignment):h();u=2,a=le.EolComment}break;case 50:return"+"===c?f(le.IncOp):"="===c?f(le.AddAssignment):h();case 51:return"-"===c?f(le.DecOp):"="===c?f(le.SubtractAssignment):h();case 53:return"="===c?f(le.RemainderAssignment):h();case 57:return"="===c?f(le.BitwiseXorAssignment):h();case 7:if("="===c)return f(le.BitwiseOrAssignment);if("|"===c){u=58,a=le.LogicalOr;break}return h();case 58:return"="===c?f(le.LogicalOrAssignment):h();case 9:if("="===c)return f(le.BitwiseAndAssignment);if("&"===c){u=56,a=le.LogicalAnd;break}return h();case 56:return"="===c?f(le.LogicalAndAssignment):h();case 8:if("*"===c){u=49,a=le.Exponent;break}return"="===c?f(le.MultiplyAssignment):h();case 49:return"="===c?f(le.ExponentAssignment):h();case 21:if("?"===c){u=59,a=le.NullCoalesce;break}return"."===c?f(le.OptionalChaining):h();case 59:return"="===c?f(le.NullCoalesceAssignment):h();case 10:if(">"===c)return f(le.Arrow);if("="===c){u=11,a=le.Equal;break}return h();case 11:return"="===c?f(le.StrictEqual):h();case 13:if("="===c){u=12,a=le.NotEqual;break}return h();case 12:return"="===c?f(le.StrictNotEqual):h();case 14:if("="===c)return f(le.LessThanOrEqual);if("<"===c){u=54,a=le.ShiftLeft;break}return h();case 54:return"="===c?f(le.ShiftLeftAssignment):h();case 15:if("="===c)return f(le.GreaterThanOrEqual);if(">"===c){u=16,a=le.SignedShiftRight;break}return h();case 16:if(">"===c){u=55,a=le.ShiftRight;break}return"="===c?f(le.SignedShiftRightAssignment):h();case 55:return"="===c?f(le.ShiftRightAssignment):h();case 20:if("x"===c)u=22,a=le.Unknown;else if("b"===c)u=24,a=le.Unknown;else if(xe(c)||"_"===c)u=26;else if("."===c)u=27,a=le.Unknown;else{if("e"!==c&&"E"!==c)return h();u=29,a=le.Unknown}break;case 18:if("."===c){u=19,a=le.Unknown;break}if(!xe(c))return h();u=28,a=le.RealLiteral;break;case 19:return"."===c?f(le.Spread):h();case 22:if("_"===c)break;if(!Ee(c))return h();u=23,a=le.HexadecimalLiteral;break;case 23:if(!Ee(c)&&"_"!==c)return h();break;case 24:if("_"===c)break;if(!me(c))return h();u=25,a=le.BinaryLiteral;break;case 25:if(!me(c)&&"_"!==c)return h();a=le.BinaryLiteral;break;case 26:if(xe(c)||"_"===c)break;if("."!==c||null!==this.input.peek()&&!xe(this.input.peek())){if("e"!==c&&"E"!==c)return h();u=29,a=le.Unknown}else u=27,a=le.Unknown;break;case 27:if(xe(c))u=28,a=le.RealLiteral;else{if("e"!==c&&"E"!==c)return h();u=29}break;case 28:if("e"===c||"E"===c)u=29,a=le.Unknown;else if(!xe(c)&&"_"!==c)return h();break;case 29:if("+"===c||"-"===c)u=30;else{if(!xe(c))return h();u=31,a=le.RealLiteral}break;case 30:if(!xe(c))return h();u=31,a=le.RealLiteral;break;case 31:if(!xe(c))return h();break;case 6:if("{"===c)return f(le.DollarLBrace);u=17,p=!0,a=le.Identifier,fe(c)||h();break;case 32:{u=33;const e=this.input.ahead(0),t=this.input.ahead(1);if("`"===e||"$"===e&&"{"===t)return f(le.StringLiteral);break}case 33:switch(c){case"\\":u=32,a=le.Unknown;break e;case"`":return f(le.Backtick);case"$":if("{"===this.input.ahead(0))return d(),this.fetchNextChar(),f(le.DollarLBrace)}const e=this.input.ahead(0),t=this.input.ahead(1);if("`"===e||"$"===e&&"{"===t)return f(le.StringLiteral);break;case 34:if(c===s)return f(le.StringLiteral);if(ge(c))return f(le.Unknown);"\\"===c&&(u=35,a=le.Unknown);break;case 35:switch(c){case"b":case"f":case"n":case"r":case"t":case"v":case"S":case"0":case"'":case'"':case"`":case"\\":default:u=34;break;case"x":u=36;break;case"u":u=38}break;case 36:if(!Ee(c))return f(le.Unknown);u=37;break;case 37:case 41:if(!Ee(c))return f(le.Unknown);u=34;break;case 38:if("{"===c){u=42;break}if(!Ee(c))return f(le.Unknown);u=39;break;case 39:if(!Ee(c))return f(le.Unknown);u=40;break;case 40:if(!Ee(c))return f(le.Unknown);u=41;break;case 42:if(!Ee(c))return f(le.Unknown);u=43;break;case 43:if("}"===c)u=34;else{if(!Ee(c))return f(le.Unknown);u=44}break;case 44:if("}"===c)u=34;else{if(!Ee(c))return f(le.Unknown);u=45}break;case 45:if("}"===c)u=34;else{if(!Ee(c))return f(le.Unknown);u=46}break;case 46:if("}"===c)u=34;else{if(!Ee(c))return f(le.Unknown);u=47}break;case 47:if("}"===c)u=34;else{if(!Ee(c))return f(le.Unknown);u=48}break;case 48:if("}"!==c)return f(le.Unknown);u=34;break;default:return h()}d()}function h(){return p&&(a=pe.get(i)??(he(i[0])&&"'"!==i[i.length-1]?le.Identifier:le.Unknown)),{text:i,type:a,startPosition:t,endPosition:o,startLine:r,endLine:r,startColumn:n,endColumn:l}}function f(e){return d(),void 0!==e&&(a=e),h()}}getStartingPhaseThenReset(){if(null!==this._phaseExternallySet){const e=this._phaseExternallySet;return this._phaseExternallySet=null,e}return 0}fetchRegEx(){const t=this._ahead.length>0?this._ahead[0].startPosition:this._lastFetchPosition,r=this.input.getTail(t);try{const t=e.parseRegExpLiteral(r),n=t.raw;for(let e=1;e<n.length;e++)this.fetchNextChar(),this._prefetched=null,this._prefetchedPos=null,this._prefetchedColumn=null;return this._ahead.length=0,{success:!0,pattern:t.pattern.raw,flags:t.flags.raw,length:n.length}}catch(n){let t=n.index;if(n.toString().includes("Invalid flag"))for(;t<r.length&&"dgimsuy".includes(r[t]);)t++;if(void 0===t)return{success:!1,pattern:r[0]};const i=r.substring(0,t);try{const t=e.parseRegExpLiteral(i),r=t.raw;for(let e=1;e<r.length;e++)this.fetchNextChar(),this._prefetched=null,this._prefetchedPos=null,this._prefetchedColumn=null;return this._ahead.length=0,{success:!0,pattern:t.pattern.raw,flags:t.flags.raw,length:r.length}}catch(s){return{success:!1,pattern:i}}}}}const pe=new Map;function de(e){return e.type===le.Eof}function ue(e){return e.type<=le.Ws}function he(e){return e>="a"&&e<="z"||e>="A"&&e<="Z"||"_"===e||"$"===e}function fe(e){return e>="a"&&e<="z"||e>="A"&&e<="Z"||e>="0"&&e<="9"||"_"===e||"$"===e}function me(e){return"0"===e||"1"===e}function xe(e){return e>="0"&&e<="9"}function Ee(e){return e>="0"&&e<="9"||e>="A"&&e<="F"||e>="a"&&e<="f"}function ge(e){return"\r"===e||"\n"===e||"…"===e||"\u2028"===e||"\u2029"===e}pe.set("typeof",le.Typeof),pe.set("Infinity",le.Infinity),pe.set("NaN",le.NaN),pe.set("true",le.True),pe.set("false",le.False),pe.set("undefined",le.Undefined),pe.set("null",le.Null),pe.set("in",le.In),pe.set("instanceof",le.Instanceof),pe.set("let",le.Let),pe.set("const",le.Const),pe.set("var",le.Var),pe.set("if",le.If),pe.set("else",le.Else),pe.set("return",le.Return),pe.set("break",le.Break),pe.set("continue",le.Continue),pe.set("do",le.Do),pe.set("while",le.While),pe.set("for",le.For),pe.set("of",le.Of),pe.set("try",le.Try),pe.set("catch",le.Catch),pe.set("finally",le.Finally),pe.set("throw",le.Throw),pe.set("switch",le.Switch),pe.set("case",le.Case),pe.set("default",le.Default),pe.set("delete",le.Delete),pe.set("function",le.Function),pe.set("new",le.New),pe.set("as",le.As),pe.set("import",le.Import),pe.set("from",le.From);class Te extends Error{constructor(e,t){super(e),this.code=t,Object.setPrototypeOf(this,Te.prototype)}}const ke={expressionExpected:"W001",unexpectedToken:"W002",identifierExpected:"W003",closeBraceExpected:"W004",closeBracketExpected:"W005",closeParenExpected:"W006",invalidPropName:"W007",colonExpected:"W008",equalExpected:"W009",invalidArgList:"W010",forLoopVarRequired:"W011",openBraceExpected:"W012",catchOrFinallyExpected:"W013",openParenExpected:"W014",caseOrDefaultExpected:"W015",defaultCaseOnce:"W016",invalidSequence:"W017",invalidObjLiteral:"W018",alreadyImported:"W019",funcAlreadyDefined:"W020",alreadyExported:"W021",moduleNotFound:"W022",exportNotFound:"W023",functionExpected:"W024",fromExpected:"W025",stringLiteralExpected:"W026",varInImportedModule:"W027",invalidModuleStatement:"W028",moduleOnlyExports:"W029",nestedExport:"W030",dollarIdentifier:"W031",openBraceImportExpected:"W032",identifierInImportExpected:"W033",identifierAfterAsExpected:"W034",commaOrCloseBraceExpected:"W035",importFromExpected:"W036",importPathExpected:"W037",importNotAtTop:"W040",importedFunctionNotFound:"W039",circularImport:"W041",circularImportDetailed:"W042",reactiveVarInImportedModule:"W043",constLetInImportedModule:"W044",invalidStatementInImportedModule:"W045"},_e={[ke.expressionExpected]:"An expression expected",[ke.unexpectedToken]:"Unexpected token: {0}",[ke.identifierExpected]:"An identifier expected",[ke.closeBraceExpected]:"'}' expected",[ke.closeBracketExpected]:"']' expected",[ke.closeParenExpected]:"')' expected",[ke.invalidPropName]:"Invalid object property name type",[ke.colonExpected]:"':' expected",[ke.equalExpected]:"'=' expected",[ke.invalidArgList]:"Invalid argument list",[ke.forLoopVarRequired]:"For loop variable must be initialized",[ke.openBraceExpected]:"'{' expected",[ke.catchOrFinallyExpected]:"'catch' or 'finally' expected",[ke.openParenExpected]:"'(' or expected",[ke.caseOrDefaultExpected]:"'case' or 'default' expected",[ke.defaultCaseOnce]:"'default' case can be used only once within a switch statement",[ke.invalidSequence]:"Invalid sequence expression",[ke.invalidObjLiteral]:"Invalid object literal",[ke.alreadyImported]:"Identifier '{0}' is already imported",[ke.funcAlreadyDefined]:"Function '{0}' is already defined in the module",[ke.alreadyExported]:"'{0}' is already exported from the module",[ke.moduleNotFound]:"Cannot find module '{0}'",[ke.exportNotFound]:"Module '{0}' does not export '{1}'",[ke.functionExpected]:"'function' expected",[ke.fromExpected]:"'from' expected",[ke.stringLiteralExpected]:"A string literal expected",[ke.varInImportedModule]:"Cannot declare var ('{0}') in an imported module",[ke.invalidModuleStatement]:"Invalid statement used in a module.",[ke.moduleOnlyExports]:"An imported module can contain only exported functions",[ke.nestedExport]:"Nested declarations cannot be exported",[ke.dollarIdentifier]:"An identifier in a declaration cannot start with '$'",[ke.openBraceImportExpected]:"'{' expected in import statement",[ke.identifierInImportExpected]:"Identifier expected in import specifier",[ke.identifierAfterAsExpected]:"Identifier expected after 'as'",[ke.commaOrCloseBraceExpected]:"',' or '}' expected in import statement",[ke.importFromExpected]:"'from' expected in import statement",[ke.importPathExpected]:"String literal expected for import path",[ke.importNotAtTop]:"Import statements must appear at the top of the file, before any other statements",[ke.importedFunctionNotFound]:"Module '{0}' does not export '{1}'",[ke.circularImport]:"Circular import detected: {0}",[ke.circularImportDetailed]:"Circular import chain: {0}",[ke.reactiveVarInImportedModule]:"Reactive variable declarations are not allowed in imported modules. Found: '{0}'",[ke.constLetInImportedModule]:"const/let variable declarations are not allowed in imported modules. Found: '{0}'",[ke.invalidStatementInImportedModule]:"Only function declarations are allowed in imported modules. Found: {0}"},Se={[le.Eof]:{},[le.Ws]:{},[le.DollarLBrace]:{},[le.Backtick]:{expressionStart:!0},[le.BlockComment]:{},[le.EolComment]:{},[le.Unknown]:{},[le.LParent]:{expressionStart:!0},[le.RParent]:{},[le.Identifier]:{expressionStart:!0,keywordLike:!0,isPropLiteral:!0},[le.Exponent]:{},[le.Divide]:{},[le.Multiply]:{},[le.Remainder]:{},[le.Plus]:{expressionStart:!0,canBeUnary:!0},[le.Minus]:{expressionStart:!0,canBeUnary:!0},[le.BitwiseXor]:{},[le.BitwiseOr]:{},[le.LogicalOr]:{},[le.BitwiseAnd]:{},[le.LogicalAnd]:{},[le.Assignment]:{isAssignment:!0},[le.AddAssignment]:{isAssignment:!0},[le.SubtractAssignment]:{isAssignment:!0},[le.ExponentAssignment]:{isAssignment:!0},[le.MultiplyAssignment]:{isAssignment:!0},[le.DivideAssignment]:{isAssignment:!0},[le.RemainderAssignment]:{isAssignment:!0},[le.ShiftLeftAssignment]:{isAssignment:!0},[le.ShiftRightAssignment]:{isAssignment:!0},[le.SignedShiftRightAssignment]:{isAssignment:!0},[le.BitwiseAndAssignment]:{isAssignment:!0},[le.BitwiseXorAssignment]:{isAssignment:!0},[le.BitwiseOrAssignment]:{isAssignment:!0},[le.LogicalAndAssignment]:{isAssignment:!0},[le.LogicalOrAssignment]:{isAssignment:!0},[le.NullCoalesceAssignment]:{isAssignment:!0},[le.Semicolon]:{},[le.Comma]:{},[le.Colon]:{},[le.LSquare]:{expressionStart:!0},[le.RSquare]:{},[le.QuestionMark]:{},[le.NullCoalesce]:{},[le.OptionalChaining]:{},[le.BinaryNot]:{expressionStart:!0,canBeUnary:!0},[le.LBrace]:{expressionStart:!0},[le.RBrace]:{},[le.Equal]:{},[le.StrictEqual]:{},[le.LogicalNot]:{expressionStart:!0,canBeUnary:!0},[le.NotEqual]:{},[le.StrictNotEqual]:{},[le.LessThan]:{},[le.LessThanOrEqual]:{},[le.ShiftLeft]:{},[le.GreaterThan]:{},[le.GreaterThanOrEqual]:{},[le.ShiftRight]:{},[le.SignedShiftRight]:{},[le.Dot]:{},[le.Spread]:{expressionStart:!0,isPropLiteral:!0},[le.DecimalLiteral]:{expressionStart:!0,isPropLiteral:!0},[le.HexadecimalLiteral]:{expressionStart:!0,isPropLiteral:!0},[le.BinaryLiteral]:{expressionStart:!0,isPropLiteral:!0},[le.RealLiteral]:{expressionStart:!0,isPropLiteral:!0},[le.StringLiteral]:{expressionStart:!0,isPropLiteral:!0},[le.IncOp]:{expressionStart:!0},[le.DecOp]:{expressionStart:!0},[le.Infinity]:{expressionStart:!0,keywordLike:!0},[le.NaN]:{expressionStart:!0,keywordLike:!0},[le.True]:{expressionStart:!0,keywordLike:!0,isPropLiteral:!0},[le.False]:{expressionStart:!0,keywordLike:!0,isPropLiteral:!0},[le.Typeof]:{expressionStart:!0,canBeUnary:!0,keywordLike:!0},[le.Null]:{expressionStart:!0,keywordLike:!0},[le.Undefined]:{expressionStart:!0,keywordLike:!0},[le.In]:{keywordLike:!0},[le.Instanceof]:{keywordLike:!0},[le.Let]:{keywordLike:!0},[le.Const]:{keywordLike:!0},[le.Var]:{keywordLike:!0},[le.If]:{keywordLike:!0},[le.Else]:{keywordLike:!0},[le.Arrow]:{keywordLike:!0},[le.Return]:{keywordLike:!0},[le.Break]:{keywordLike:!0},[le.Continue]:{keywordLike:!0},[le.Do]:{keywordLike:!0},[le.While]:{keywordLike:!0},[le.For]:{keywordLike:!0},[le.Of]:{keywordLike:!0},[le.Throw]:{keywordLike:!0},[le.Try]:{keywordLike:!0},[le.Catch]:{keywordLike:!0},[le.Finally]:{keywordLike:!0},[le.Switch]:{keywordLike:!0},[le.Case]:{keywordLike:!0},[le.Default]:{keywordLike:!0},[le.Delete]:{expressionStart:!0,canBeUnary:!0,keywordLike:!0},[le.Function]:{keywordLike:!0,expressionStart:!0},[le.New]:{keywordLike:!0,expressionStart:!0},[le.As]:{keywordLike:!0},[le.Import]:{keywordLike:!0},[le.From]:{keywordLike:!0}};let Ne=0;function Ae(){return++Ne}class be{constructor(e){this._parseErrors=[],this._statementLevel=0,this._hasNonImportStatement=!1,this._destrCounter=0,this._lexer=new ce(new oe(e??""))}setSource(e){this._lexer=new ce(new oe(e)),this._hasNonImportStatement=!1}get errors(){return this._parseErrors}get current(){return this._lexer.peek()}get isEof(){return this._lexer.peek().type===le.Eof}getTail(){return this._lexer.getTail()}parseStatements(){this._statementLevel=0,this._hasNonImportStatement=!1;const e=[];for(;!this.isEof;){const t=this.parseStatement();if(!t)return null;e.push(t),t.type!==h&&this.skipToken(le.Semicolon)}return e}parseStatement(e=!0){this._statementLevel++;try{const t=this._lexer.peek();switch(t.type){case le.Import:return this._hasNonImportStatement?(this.reportError("W040",t),null):this.parseImportStatement();case le.Semicolon:return this.parseEmptyStatement();case le.Let:return this._hasNonImportStatement=!0,this.parseLetStatement();case le.Const:return this._hasNonImportStatement=!0,this.parseConstStatement();case le.Var:return this._hasNonImportStatement=!0,this.parseVarStatement();case le.LBrace:return this._hasNonImportStatement=!0,this.parseBlockStatement();case le.If:return this._hasNonImportStatement=!0,this.parseIfStatement();case le.Do:return this._hasNonImportStatement=!0,this.parseDoWhileStatement();case le.While:return this._hasNonImportStatement=!0,this.parseWhileStatement();case le.Return:return this._hasNonImportStatement=!0,this.parseReturnStatement();case le.Break:return this._hasNonImportStatement=!0,this._lexer.get(),this.createStatementNode(_,{},t,t);case le.Continue:return this._hasNonImportStatement=!0,this._lexer.get(),this.createStatementNode(S,{},t,t);case le.For:return this._hasNonImportStatement=!0,this.parseForStatement();case le.Throw:return this._hasNonImportStatement=!0,this.parseThrowStatement();case le.Try:return this._hasNonImportStatement=!0,this.parseTryStatement();case le.Switch:return this._hasNonImportStatement=!0,this.parseSwitchStatement();case le.Function:return this._hasNonImportStatement=!0,this.parseFunctionDeclaration();default:if(t.type===le.Identifier&&"async"===t.text){const e=this._lexer.ahead(1);if(e&&e.type===le.Function)return this._hasNonImportStatement=!0,this.parseFunctionDeclaration(!1,!0)}return this.isExpressionStart(t)?(this._hasNonImportStatement=!0,this.parseExpressionStatement(e)):(this.reportError("W002",t,t.text),null)}}finally{this._statementLevel--}}parseEmptyStatement(){const e=this._lexer.get();return this.createStatementNode(h,{},e,e)}parseExpressionStatement(e=!0){const t=this._lexer.peek(),r=this.getExpression(e);return r?this.createStatementNode(f,{expr:r},t,r.endToken):null}parseLetStatement(){const e=this._lexer.get();let t=e;const r=[];for(;;){const e=this._lexer.peek();let n={};if(e.type===le.LBrace){t=this._lexer.ahead(1);const e=this.parseObjectDestructure();if(null===e)return null;n={oDestr:e},t=e.length>0?e[e.length-1].endToken:t}else if(e.type===le.LSquare){t=this._lexer.ahead(1);const e=this.parseArrayDestructure();if(null===e)return null;n={aDestr:e},t=e.length>0?e[e.length-1].endToken:t}else{if(e.type!==le.Identifier)return this.reportError("W003"),null;if(e.text.startsWith("$"))return this.reportError("W031"),null;t=this._lexer.get(),n={id:e.text}}const s=this._lexer.peek();let i=null;if(s.type===le.Assignment){if(this._lexer.get(),i=this.getExpression(!1),null===i)return null;n.expr=i,t=i.endToken}else if(n.aDestr||n.oDestr)return this.reportError("W009",s),null;if(r.push(this.createExpressionNode(te,n,e,t)),this._lexer.peek().type!==le.Comma)break;this._lexer.get()}return this.createStatementNode(x,{decls:r},e,t)}parseConstStatement(){const e=this._lexer.get();let t=e;const r=[];for(;;){const e=this._lexer.peek();let n={};if(e.type===le.LBrace){t=this._lexer.ahead(1);const e=this.parseObjectDestructure();if(null===e)return null;n={oDestr:e},t=e.length>0?e[e.length-1].endToken:t}else if(e.type===le.LSquare){t=this._lexer.ahead(1);const e=this.parseArrayDestructure();if(null===e)return null;n={aDestr:e},t=e.length>0?e[e.length-1].endToken:t}else{if(e.type!==le.Identifier)return this.reportError("W003"),null;if(e.text.startsWith("$"))return this.reportError("W031"),null;t=this._lexer.get(),n={id:e.text}}this.expectToken(le.Assignment);const s=this.getExpression(!1);if(null===s)return null;if(n.expr=s,t=s.endToken,r.push(this.createExpressionNode(te,n,e,t)),this._lexer.peek().type!==le.Comma)break;this._lexer.get()}return this.createStatementNode(E,{decls:r},e,t)}parseVarStatement(){const e=this._lexer.get();let t=e;const r=[];for(;;){const e=this._lexer.peek();let n={};if(e.type===le.LBrace){t=this._lexer.ahead(1);const n=this.parseObjectDestructure();if(null===n)return null;t=n.length>0?n[n.length-1].endToken:t,this.expectToken(le.Assignment);const s=this.getExpression(!1);if(null===s)return null;t=s.endToken,this.expandObjectDestructureToReactiveVars(n,s,r,e,t)}else if(e.type===le.LSquare){t=this._lexer.ahead(1);const n=this.parseArrayDestructure();if(null===n)return null;t=n.length>0?n[n.length-1].endToken:t,this.expectToken(le.Assignment);const s=this.getExpression(!1);if(null===s)return null;t=s.endToken,this.expandArrayDestructureToReactiveVars(n,s,r,e,t)}else{if(e.type!==le.Identifier)return this.reportError("W003"),null;{if(e.text.startsWith("$"))return this.reportError("W031"),null;t=this._lexer.get(),n={id:{type:q,name:e.text,startToken:e,endToken:t}},this.expectToken(le.Assignment);const s=this.getExpression(!1);if(null===s)return null;n.expr=s,t=s.endToken,r.push(this.createExpressionNode(J,n,e,t))}}if(this._lexer.peek().type!==le.Comma)break;this._lexer.get()}return this.createStatementNode(g,{decls:r},e,t)}expandObjectDestructureToReactiveVars(e,t,r,n,s){const i="__destr_"+ ++this._destrCounter,a=this.createExpressionNode(q,{name:i},n,s);r.push(this.createExpressionNode(J,{id:a,expr:t},n,s));for(const o of e){const e=this.createExpressionNode(M,{obj:this.createExpressionNode(q,{name:i},n,s),member:o.id},n,s);if(o.oDestr)this.expandObjectDestructureToReactiveVars(o.oDestr,e,r,n,s);else if(o.aDestr)this.expandArrayDestructureToReactiveVars(o.aDestr,e,r,n,s);else{const t=o.alias||o.id,i=this.createExpressionNode(q,{name:t},n,s);r.push(this.createExpressionNode(J,{id:i,expr:e},n,s))}}}expandArrayDestructureToReactiveVars(e,t,r,n,s){const i="__destr_"+ ++this._destrCounter,a=this.createExpressionNode(q,{name:i},n,s);r.push(this.createExpressionNode(J,{id:a,expr:t},n,s));for(let o=0;o<e.length;o++){const t=e[o];if(!t.id&&!t.oDestr&&!t.aDestr)continue;const a=this.createExpressionNode(F,{obj:this.createExpressionNode(q,{name:i},n,s),member:this.createExpressionNode(V,{value:o},n,s)},n,s);if(t.oDestr)this.expandObjectDestructureToReactiveVars(t.oDestr,a,r,n,s);else if(t.aDestr)this.expandArrayDestructureToReactiveVars(t.aDestr,a,r,n,s);else{const e=this.createExpressionNode(q,{name:t.id},n,s);r.push(this.createExpressionNode(J,{id:e,expr:a},n,s))}}}parseObjectDestructure(){const e=[],t=this._lexer.get();let r=t,n=this._lexer.peek();for(;n.type===le.Identifier;){const s=n.text;if(s.startsWith("$"))return this.reportError("W031"),null;let i,a,o;if(this._lexer.get(),n=this._lexer.peek(),n.type===le.Colon)if(this._lexer.get(),n=this._lexer.peek(),n.type===le.Identifier)i=n.text,r=n,this._lexer.get();else if(n.type===le.LSquare){if(a=this.parseArrayDestructure(),null===a)return null;r=a[a.length-1].endToken}else if(n.type===le.LBrace){if(o=this.parseObjectDestructure(),null===o)return null;r=o[o.length-1].endToken}n=this._lexer.peek(),n.type!==le.Comma&&n.type!==le.RBrace||(e.push(this.createExpressionNode(se,{id:s,alias:i,aDestr:a,oDestr:o},t,r)),n.type===le.Comma&&(this._lexer.get(),n=this._lexer.peek()))}return this.expectToken(le.RBrace,"W004"),e}parseArrayDestructure(){const e=[],t=this._lexer.get();let r=t;for(;;){let n,s,i,a=this._lexer.peek();if(a.type===le.Identifier){if(n=a.text,n.startsWith("$"))return this.reportError("W031"),null;r=a,a=this._lexer.get()}else if(a.type===le.LSquare){if(s=this.parseArrayDestructure(),null===s)return null;r=s[s.length-1].endToken}else if(a.type===le.LBrace){if(i=this.parseObjectDestructure(),null===i)return null;r=i[i.length-1].endToken}if(a=this._lexer.peek(),a.type!==le.Comma){if(a.type===le.RSquare){(n||s||i)&&e.push(this.createExpressionNode(ne,{id:n,aDestr:s,oDestr:i},t,r));break}return this.reportError("W002",a),null}e.push(this.createExpressionNode(ne,{id:n,aDestr:s,oDestr:i},t,r)),this._lexer.get()}return this.expectToken(le.RSquare,"W005"),e}parseBlockStatement(){const e=this._lexer.get(),t=[];for(;this._lexer.peek().type!==le.RBrace;){const e=this.parseStatement();if(!e)return null;t.push(e),e.type!==h&&this.skipToken(le.Semicolon)}const r=this._lexer.get();return this.createStatementNode(u,{stmts:t},e,r)}parseIfStatement(){const e=this._lexer.get();let t=e;this.expectToken(le.LParent,"W014");const r=this.getExpression();if(!r)return null;this.expectToken(le.RParent,"W006");const n=this.parseStatement();if(!n)return null;t=n.endToken;let s=!0;n.type!==u&&(this._lexer.peek().type===le.Semicolon?this._lexer.get():s=!1);let i=null;if(s&&this._lexer.peek().type===le.Else){if(this._lexer.get(),i=this.parseStatement(),!i)return null;t=i.endToken}return this.createStatementNode(T,{cond:r,thenB:n,elseB:i},e,t)}parseWhileStatement(){const e=this._lexer.get();this.expectToken(le.LParent,"W014");const t=this.getExpression();if(!t)return null;this.expectToken(le.RParent,"W006");const r=this.parseStatement();return r?this.createStatementNode(N,{cond:t,body:r},e,r.endToken):null}parseDoWhileStatement(){const e=this._lexer.get(),t=this.parseStatement();if(!t)return null;t.type!==u&&t.type!==h&&this.expectToken(le.Semicolon),this.expectToken(le.While),this.expectToken(le.LParent,"W014");const r=this.getExpression();if(!r)return null;const n=this._lexer.peek();return this.expectToken(le.RParent,"W006"),this.createStatementNode(A,{cond:r,body:t},e,n)}parseReturnStatement(){const e=this._lexer.peek();let t,r=this._lexer.get();if(Se[this._lexer.peek().type].expressionStart){if(t=this.getExpression(),null===t)return null;r=t.endToken}return this.createStatementNode(k,{expr:t},e,r)}parseForStatement(){const e=this._lexer.peek();this._lexer.get(),this.expectToken(le.LParent,"W014");let t,r,n,s=this._lexer.peek();if(s.type===le.Identifier){if(this._lexer.ahead(1).type===le.In)return this.parseForInOfStatement(e,"none",s,y);if(this._lexer.ahead(1).type===le.Of)return this.parseForInOfStatement(e,"none",s,I)}else if(s.type===le.Let){const t=this._lexer.ahead(1);if(t.type===le.Identifier){const r=this._lexer.ahead(2);if(r.type===le.In)return this.parseForInOfStatement(e,"let",t,y);if(r.type===le.Of)return this.parseForInOfStatement(e,"let",t,I)}}else if(s.type===le.Const){const t=this._lexer.ahead(1);if(t.type===le.Identifier){const r=this._lexer.ahead(2);if(r.type===le.In)return this.parseForInOfStatement(e,"const",t,y);if(r.type===le.Of)return this.parseForInOfStatement(e,"const",t,I)}}if(s=this._lexer.peek(),s.type===le.Semicolon)this._lexer.get();else if(s.type===le.Let){const e=this.parseLetStatement();if(null===e)return null;if(t=e,t.decls.some(e=>!e.expr))return this.reportError("W011"),null;this.expectToken(le.Semicolon)}else if(Se[s.type].expressionStart){const e=this.parseExpressionStatement();if(null===e)return null;t=e,this.expectToken(le.Semicolon)}if(s=this._lexer.peek(),s.type===le.Semicolon)this._lexer.get();else{if(r=this.getExpression(),null===r)return null;this.expectToken(le.Semicolon)}if(s=this._lexer.peek(),s.type!==le.RParent&&(n=this.getExpression(),null===n))return null;this.expectToken(le.RParent,"W006");const i=this.parseStatement();return i?this.createStatementNode(b,{init:t,cond:r,upd:n,body:i},e,i.endToken):null}parseForInOfStatement(e,t,r,n){if("none"!==t){if(r.text.startsWith("$"))return this.reportError("W031"),null;this._lexer.get()}this._lexer.get(),this._lexer.get();const s=this.getExpression(!0);this.expectToken(le.RParent,"W006");const i=this.parseStatement();return i?n===y?this.createStatementNode(y,{varB:t,id:{type:q,name:r.text,startToken:r,endToken:r},expr:s,body:i},e,i.endToken):this.createStatementNode(I,{varB:t,id:{type:q,name:r.text,startToken:r,endToken:r},expr:s,body:i},e,i.endToken):null}parseThrowStatement(){const e=this._lexer.peek();let t;return this._lexer.get(),t=this.getExpression(),null===t?null:this.createStatementNode(v,{expr:t},e,t.endToken)}parseTryStatement(){const e=()=>{const e=this._lexer.peek();return e.type!==le.LBrace?(this.reportError("W012",e),null):this.parseBlockStatement()},t=this._lexer.peek();let r=this._lexer.get();const n=e();let s,i,a,o=this._lexer.peek();if(o.type===le.Catch){if(this._lexer.get(),o=this._lexer.peek(),o.type===le.LParent){if(this._lexer.get(),o=this._lexer.peek(),o.type!==le.Identifier)return this.reportError("W003",o),null;i={type:q,nodeId:Ae(),name:o.text,startToken:o,endToken:o},this._lexer.get(),this.expectToken(le.RParent,"W006")}s=e(),r=s.endToken,this._lexer.peek().type===le.Finally&&(this._lexer.get(),a=e(),r=a.endToken)}else{if(o.type!==le.Finally)return this.reportError("W013",o),null;this._lexer.get(),a=e(),r=a.endToken}return this.createStatementNode(C,{tryB:n,catchB:s,catchV:i,finallyB:a},t,r)}parseSwitchStatement(){const e=this._lexer.get();this.expectToken(le.LParent,"W014");const t=this.getExpression();if(!t)return null;this.expectToken(le.RParent,"W006"),this.expectToken(le.LBrace,"W012");const r=[];let n=!1;for(;;){let t,s=this._lexer.peek();if(s.type===le.Case){if(this._lexer.get(),t=this.getExpression(),!t)return null}else{if(s.type!==le.Default){if(s.type===le.RBrace)break;return this.reportError("W015"),null}if(n)return this.reportError("W016"),null;n=!0,this._lexer.get()}this.expectToken(le.Colon,"W008");let i=[],a=!1;for(;!a;){switch(this._lexer.peek().type){case le.Case:case le.Default:case le.RBrace:a=!0;break;default:const e=this.parseStatement();if(null===e){a=!0;break}i.push(e),e.type!==h&&this.skipToken(le.Semicolon)}}r.push(this.createNode(ie,{caseE:t,stmts:i},e))}const s=this._lexer.peek();return this.expectToken(le.RBrace,"W004"),this.createStatementNode(R,{expr:t,cases:r},e,s)}parseImportStatement(){const e=this._lexer.get(),t=this._lexer.peek();if(t.type!==le.LBrace)return this.reportError("W032",t),null;this._lexer.get();const r=[];for(;;){const e=this._lexer.peek();if(e.type!==le.Identifier)return this.reportError("W033",e),null;const t=e.text;this._lexer.get();const n={type:ae,nodeId:Ae(),imported:{type:q,nodeId:Ae(),name:t,startToken:e,endToken:e},startToken:e,endToken:e};if(this._lexer.peek().type===le.As){this._lexer.get();const e=this._lexer.peek();if(e.type!==le.Identifier)return this.reportError("W034",e),null;n.local={type:q,nodeId:Ae(),name:e.text,startToken:e,endToken:e},n.endToken=e,this._lexer.get()}r.push(n);const s=this._lexer.peek();if(s.type===le.RBrace){this._lexer.get();break}if(s.type!==le.Comma)return this.reportError("W035",s),null;this._lexer.get()}const n=this._lexer.peek();if(n.type!==le.From)return this.reportError("W036",n),null;this._lexer.get();const s=this._lexer.peek();if(s.type!==le.StringLiteral)return this.reportError("W037",s),null;this._lexer.get();const i=this.parseStringLiteral(s,!0);return this._lexer.peek().type===le.Semicolon&&this._lexer.get(),this.createStatementNode(w,{specifiers:r,source:i},e,s)}parseFunctionDeclaration(e=!1,t=!1){let r,n=this._lexer.peek();t&&(n=this._lexer.get()),this._lexer.get();const s=this._lexer.peek();if(e){if(s.type!==le.LParent){if(s.type!==le.Identifier)return this.reportError("W003",s),null;r=s.text,this._lexer.get()}}else{if(s.type!==le.Identifier)return this.reportError("W003",s),null;r=s.text,this._lexer.get()}const i=this._lexer.peek();if(i.type!==le.LParent)return this.reportError("W014",i),null;const a=this.getExpression(!0);let o;const l=[];switch(a.type){case G:o=!0;break;case q:o=(a.parenthesized??0)<=1,l.push(a);break;case W:o=1===a.parenthesized;let e=!1;if(o)for(const t of a.exprs){if(e){o=!1;break}switch(t.type){case q:o=!t.parenthesized,l.push(t);break;case j:if(o=!t.parenthesized,o){const e=this.convertToObjectDestructure(t);e&&l.push(e)}break;case $:if(o=!t.parenthesized,o){const e=this.convertToArrayDestructure(t);e&&l.push(e)}break;case H:if(e=!0,t.expr.type!==q){o=!1;break}l.push(t);break;default:o=!1}}break;case j:if(o=1===a.parenthesized,o){const e=this.convertToObjectDestructure(a);e&&l.push(e)}break;case $:if(o=1===a.parenthesized,o){const e=this.convertToArrayDestructure(a);e&&l.push(e)}break;case H:if(a.expr.type!==q){o=!1;break}o=!0,l.push(a);break;default:o=!1}if(!o)return this.reportError("W010",n),null;if(this._lexer.peek().type!==le.LBrace)return this.reportError("W012",this._lexer.peek()),null;const c=this.parseBlockStatement();if(!c)return null;const p={id:{type:q,name:r},args:l,stmt:c};return t&&(p.async=!0),this.createStatementNode(t?O:L,p,n,c.endToken)}parseExpr(e=!0){return e?this.parseSequenceExpression():this.parseCondOrSpreadOrAsgnOrArrowExpr()}parseSequenceExpression(){const e=this._lexer.peek();let t=e,r=this.parseCondOrSpreadOrAsgnOrArrowExpr();if(!r)return null;t=r.endToken;const n=[];let s=!1;if(this._lexer.peek().type===le.Comma)for(n.push(r);this.skipToken(le.Comma);)if(this._lexer.peek().type===le.Comma)s=!0,t=this._lexer.peek(),n.push(this.createExpressionNode(G,{},t,t));else{const e=this.parseCondOrSpreadOrAsgnOrArrowExpr();if(!e)break;t=e.endToken,n.push(e)}return n.length?(r=this.createExpressionNode(W,{exprs:n,loose:s},e,t),s&&(r=this.convertToArrayDestructure(r)),r):r}parseCondOrSpreadOrAsgnOrArrowExpr(){const e=this._lexer.peek();if(e.type===le.Spread){this._lexer.get();const t=this.parseNullCoalescingExpr();return t?this.createExpressionNode(H,{expr:t},e,t.endToken):null}if(e.type===le.Function){const t=this.parseFunctionDeclaration(!0);if(!t)return null;const r={name:t.id.name,args:t.args,statement:t.stmt};return t.async&&(r.async=!0),this.createExpressionNode(K,r,e,t.endToken)}if(e.type===le.Identifier&&"async"===e.text){const t=this._lexer.ahead(1);if(t&&t.type===le.Function){const t=this.parseFunctionDeclaration(!0,!0);if(!t)return null;const r={name:t.id.name,args:t.args,statement:t.stmt};return t.async&&(r.async=!0),this.createExpressionNode(K,r,e,t.endToken)}if(t&&(t.type===le.LParent||t.type===le.Identifier)){if(t.type!==le.Identifier){this._lexer.get();const t=this.parseNullCoalescingExpr();if(!t)return null;const r=this._lexer.peek();return r.type===le.Arrow?this.parseArrowExpression(e,t,!0):(this.reportError("W002",r,r.text),null)}{const t=this._lexer.ahead(2);if(t&&t.type===le.Arrow){this._lexer.get();const t=this.parseNullCoalescingExpr();if(!t)return null;if(this._lexer.peek().type===le.Arrow)return this.parseArrowExpression(e,t,!0)}else;}}}const t=this.parseNullCoalescingExpr();if(!t)return null;const r=this._lexer.peek();if(r.type===le.Arrow)return this.parseArrowExpression(e,t);if(r.type===le.QuestionMark){this._lexer.get();const r=this.getExpression(!1);this.expectToken(le.Colon);const n=this.getExpression(!1);return this.createExpressionNode(B,{cond:t,thenE:r,elseE:n},e,n.endToken)}if(Se[r.type].isAssignment){this._lexer.get();const n=this.getExpression();return n?this.createExpressionNode(z,{leftValue:t,op:r.text,expr:n},e,n.endToken):null}return t}parseArrowExpression(e,t,r=!1){let n;const s=[];switch(t.type){case G:n=!0;break;case q:n=(t.parenthesized??0)<=1,s.push(t);break;case W:n=1===t.parenthesized;let e=!1;if(n)for(const r of t.exprs){if(e){n=!1;break}switch(r.type){case q:n=!r.parenthesized,s.push(r);break;case j:if(n=!r.parenthesized,n){const e=this.convertToObjectDestructure(r);e&&s.push(e)}break;case $:if(n=!r.parenthesized,n){const e=this.convertToArrayDestructure(r);e&&s.push(e)}break;case H:if(e=!0,r.expr.type!==q){n=!1;break}s.push(r);break;default:n=!1}}break;case j:if(n=1===t.parenthesized,n){const e=this.convertToObjectDestructure(t);e&&s.push(e)}break;case $:if(n=1===t.parenthesized,n){const e=this.convertToArrayDestructure(t);e&&s.push(e)}break;case H:n=t.expr.type===q,n&&s.push(t);break;default:n=!1}if(!n)return this.reportError("W010",e),null;this._lexer.get();const i=this.parseStatement(!1);if(!i)return null;const a={args:s,statement:i};return r&&(a.async=!0),this.createExpressionNode(K,a,e,i.endToken)}parseNullCoalescingExpr(){const e=this._lexer.peek();let t=this.parseLogicalOrExpr();if(!t)return null;for(;this.skipToken(le.NullCoalesce);){const r=this.parseLogicalOrExpr();if(!r)return this.reportError("W001"),null;let n=r.endToken;t=this.createExpressionNode(P,{op:"??",left:t,right:r},e,n)}return t}parseLogicalOrExpr(){const e=this._lexer.peek();let t=this.parseLogicalAndExpr();if(!t)return null;for(;this.skipToken(le.LogicalOr);){const r=this.parseLogicalAndExpr();if(!r)return this.reportError("W001"),null;let n=r.endToken;t=this.createExpressionNode(P,{op:"||",left:t,right:r},e,n)}return t}parseLogicalAndExpr(){const e=this._lexer.peek();let t=this.parseBitwiseOrExpr();if(!t)return null;for(;this.skipToken(le.LogicalAnd);){const r=this.parseBitwiseOrExpr();if(!r)return this.reportError("W001"),null;let n=r.endToken;t=this.createExpressionNode(P,{op:"&&",left:t,right:r},e,n)}return t}parseBitwiseOrExpr(){const e=this._lexer.peek();let t=this.parseBitwiseXorExpr();if(!t)return null;for(;this.skipToken(le.BitwiseOr);){const r=this.parseBitwiseXorExpr();if(!r)return this.reportError("W001"),null;let n=r.endToken;t=this.createExpressionNode(P,{op:"|",left:t,right:r},e,n)}return t}parseBitwiseXorExpr(){const e=this._lexer.peek();let t=this.parseBitwiseAndExpr();if(!t)return null;for(;this.skipToken(le.BitwiseXor);){const r=this.parseBitwiseAndExpr();if(!r)return this.reportError("W001"),null;let n=r.endToken;t=this.createExpressionNode(P,{op:"^",left:t,right:r},e,n)}return t}parseBitwiseAndExpr(){const e=this._lexer.peek();let t=this.parseEquExpr();if(!t)return null;for(;this.skipToken(le.BitwiseAnd);){const r=this.parseEquExpr();if(!r)return this.reportError("W001"),null;let n=r.endToken;t=this.createExpressionNode(P,{op:"&",left:t,right:r},e,n)}return t}parseEquExpr(){const e=this._lexer.peek();let t,r=this.parseRelOrInExpr();if(!r)return null;for(;t=this.skipTokens(le.Equal,le.StrictEqual,le.NotEqual,le.StrictNotEqual);){const n=this.parseRelOrInExpr();if(!n)return this.reportError("W001"),null;let s=n.endToken;r=this.createExpressionNode(P,{op:t.text,left:r,right:n},e,s)}return r}parseRelOrInExpr(){const e=this._lexer.peek();let t,r=this.parseShiftExpr();if(!r)return null;for(;t=this.skipTokens(le.LessThan,le.LessThanOrEqual,le.GreaterThan,le.GreaterThanOrEqual,le.In,le.Instanceof);){const n=this.parseShiftExpr();if(!n)return this.reportError("W001"),null;let s=n.endToken;r=this.createExpressionNode(P,{op:t.text,left:r,right:n},e,s)}return r}parseShiftExpr(){const e=this._lexer.peek();let t,r=this.parseAddExpr();if(!r)return null;for(;t=this.skipTokens(le.ShiftLeft,le.ShiftRight,le.SignedShiftRight);){const n=this.parseAddExpr();if(!n)return this.reportError("W001"),null;let s=n.endToken;r=this.createExpressionNode(P,{op:t.text,left:r,right:n},e,s)}return r}parseAddExpr(){const e=this._lexer.peek();let t,r=this.parseMultExpr();if(!r)return null;for(;t=this.skipTokens(le.Plus,le.Minus);){const n=this.parseMultExpr();if(!n)return this.reportError("W001"),null;let s=n.endToken;r=this.createExpressionNode(P,{op:t.text,left:r,right:n},e,s)}return r}parseMultExpr(){const e=this._lexer.peek();let t,r=this.parseExponentialExpr();if(!r)return null;for(;t=this.skipTokens(le.Multiply,le.Divide,le.Remainder);){const n=this.parseExponentialExpr();if(!n)return this.reportError("W001"),null;let s=n.endToken;r=this.createExpressionNode(P,{op:t.text,left:r,right:n},e,s)}return r}parseExponentialExpr(){const e=this._lexer.peek();let t,r=this.parseUnaryOrPrefixExpr();if(!r)return null;let n=0;for(;t=this.skipToken(le.Exponent);){let s=this.parseUnaryOrPrefixExpr();if(!s)return this.reportError("W001"),null;let i=s.endToken;if(0===n)r=this.createExpressionNode(P,{op:t.text,left:r,right:s},e,i);else{const n=r;r=this.createExpressionNode(P,{op:t.text,left:n.left,right:{type:P,op:t.text,left:n.right,right:s}},e,i)}n++}return r}parseUnaryOrPrefixExpr(){const e=this._lexer.peek();if(e.type===le.New){this._lexer.get();let t=this.parsePrimaryExpr();if(!t)return null;let r=!1;do{const n=this._lexer.peek();switch(n.type){case le.Dot:case le.OptionalChaining:{this._lexer.get();const r=this._lexer.peek();if(r.type!==le.Identifier)return this.reportError("W003"),null;this._lexer.get(),t=this.createExpressionNode(M,{obj:t,member:r.text,opt:n.type===le.OptionalChaining},e,r);break}case le.LSquare:{this._lexer.get();const r=this.parseExpr();if(!r)return null;const n=this._lexer.peek();this.expectToken(le.RSquare,"W005"),t=this.createExpressionNode(F,{obj:t,member:r},e,n);break}default:r=!0}}while(!r);let n=[],s=t.endToken;if(this._lexer.peek().type===le.LParent){if(this._lexer.get(),this._lexer.peek().type!==le.RParent){const e=this.parseExpr();if(!e)return this.reportError("W001"),null;n=e.type===W?e.exprs:[e]}s=this._lexer.peek(),this.expectToken(le.RParent,"W006")}let i=this.createExpressionNode(ee,{callee:t,arguments:n},e,s),a=!1;do{const t=this._lexer.peek();switch(t.type){case le.LParent:{this._lexer.get();let t=[];if(this._lexer.peek().type!==le.RParent){const e=this.parseExpr();if(!e)return this.reportError("W001"),null;t=e.type===W?e.exprs:[e]}const r=this._lexer.peek();this.expectToken(le.RParent,"W006"),i=this.createExpressionNode(U,{obj:i,arguments:t},e,r);break}case le.Dot:case le.OptionalChaining:{this._lexer.get();const r=this._lexer.get();if(!Se[r.type].keywordLike)return this.reportError("W003"),null;i=this.createExpressionNode(M,{obj:i,member:r.text,opt:t.type===le.OptionalChaining},e,r);break}case le.LSquare:{this._lexer.get();const t=this.getExpression();if(!t)return null;const r=this._lexer.peek();this.expectToken(le.RSquare,"W005"),i=this.createExpressionNode(F,{obj:i,member:t},e,r);break}default:a=!0}}while(!a);return i}if(e.type===le.Identifier&&"await"===e.text){this._lexer.get();const t=this.parseUnaryOrPrefixExpr();return t?this.createExpressionNode(Z,{expr:t},e,t.endToken):null}if(Se[e.type].canBeUnary){this._lexer.get();const t=this.parseUnaryOrPrefixExpr();return t?this.createExpressionNode(D,{op:e.text,expr:t},e,t.endToken):null}if(e.type===le.IncOp||e.type===le.DecOp){this._lexer.get();const t=this.parseMemberOrInvocationExpr();return t?this.createExpressionNode(Q,{op:e.text,expr:t},e,t.endToken):null}return this.parseMemberOrInvocationExpr()}parseMemberOrInvocationExpr(){const e=this._lexer.peek();let t=this.parsePrimaryExpr();if(!t)return null;let r=!1;do{const n=this._lexer.peek();switch(n.type){case le.LParent:{this._lexer.get();let r=[];if(this._lexer.peek().type!==le.RParent){const e=this.parseExpr();if(!e)return this.reportError("W001"),null;r=e.type===W?e.exprs:[e]}const n=this._lexer.peek();this.expectToken(le.RParent,"W006"),t=this.createExpressionNode(U,{obj:t,arguments:r},e,n);break}case le.Dot:case le.OptionalChaining:this._lexer.get();const s=this._lexer.get();if(!Se[s.type].keywordLike)return this.reportError("W003"),null;t=this.createExpressionNode(M,{obj:t,member:s.text,opt:n.type===le.OptionalChaining},e,s);break;case le.LSquare:this._lexer.get();const i=this.getExpression();if(!i)return null;const a=this._lexer.peek();this.expectToken(le.RSquare,"W005"),t=this.createExpressionNode(F,{obj:t,member:i},e,a);break;default:r=!0}}while(!r);const n=this._lexer.peek();return n.type===le.IncOp||n.type===le.DecOp?(this._lexer.get(),this.createExpressionNode(Y,{op:n.text,expr:t},e,n)):t}parsePrimaryExpr(){const e=this._lexer.peek();switch(e.type){case le.LParent:if(this._lexer.get(),this._lexer.peek().type===le.RParent){const t=this._lexer.get();return this.createExpressionNode(G,{},e,t)}let t=this.parseExpr();if(!t)return null;const r=this._lexer.peek();return this.expectToken(le.RParent,"W006"),{...t,parenthesized:(t.parenthesized??0)+1,startToken:e,endToken:r};case le.Identifier:{const e=this._lexer.get();return this.createExpressionNode(q,{name:e.text},e,e)}case le.Backtick:return this.parseTemplateLiteral();case le.False:case le.True:return this._lexer.get(),this.createExpressionNode(V,{value:e.type===le.True},e,e);case le.BinaryLiteral:return this._lexer.get(),this.parseBinaryLiteral(e);case le.DecimalLiteral:return this._lexer.get(),this.parseDecimalLiteral(e);case le.HexadecimalLiteral:return this._lexer.get(),this.parseHexadecimalLiteral(e);case le.RealLiteral:return this._lexer.get(),this.parseRealLiteral(e);case le.StringLiteral:return this._lexer.get(),this.parseStringLiteral(e);case le.Infinity:return this._lexer.get(),this.createExpressionNode(V,{value:1/0},e,e);case le.NaN:return this._lexer.get(),this.createExpressionNode(V,{value:NaN},e,e);case le.Null:return this._lexer.get(),this.createExpressionNode(V,{value:null},e,e);case le.Undefined:return this._lexer.get(),this.createExpressionNode(V,{value:void 0},e,e);case le.LSquare:return this.parseArrayLiteral();case le.LBrace:return this.parseObjectLiteral();case le.Divide:return this.parseRegExpLiteral()}return null}parseTemplateLiteral(){const e=this._lexer.get();this._lexer.setStartingPhaseToTemplateLiteral();const t=[];e:for(;;){let e=this._lexer.peek();switch(e.type){case le.StringLiteral:this._lexer.get();const r=this.parseStringLiteral(e,!1);t.push(r);break;case le.DollarLBrace:this._lexer.get();const n=this.parseExpr();t.push(n),this.expectToken(le.RBrace,"W004"),this._lexer.setStartingPhaseToTemplateLiteral();break;case le.Backtick:break e;default:this.reportError("W004")}}const r=this._lexer.get();return this.createExpressionNode(X,{segments:t},e,r)}parseArrayLiteral(){const e=this._lexer.get();let t=[];if(this._lexer.peek().type!==le.RSquare){const e=this.getExpression();e&&(t=e.type===W?e.exprs:[e])}const r=this._lexer.peek();return this.expectToken(le.RSquare),this.createExpressionNode($,{items:t},e,r)}parseObjectLiteral(){const e=this._lexer.get();let t=[];if(this._lexer.peek().type!==le.RBrace)for(;this._lexer.peek().type!==le.RBrace;){const r=this._lexer.peek(),n=Se[r.type];let s;if(n.keywordLike)s={type:q,nodeId:Ae(),name:r.text,startToken:r,endToken:r},this._lexer.get();else{if(!n.expressionStart)return this.reportError("W001"),null;if(r.type===le.LSquare){if(this._lexer.get(),s=this.getExpression(),!s)return null;this.expectToken(le.RSquare,"W005"),s=this.createExpressionNode(W,{exprs:[s]},e)}else{if(!n.isPropLiteral)return this.reportError("W007"),null;if(s=this.getExpression(!1),!s)return null;if(s.type!==q&&s.type!==V&&s.type!==H)return this.reportError("W007"),null}}const i=s.type;if(i===H)t.push(s);else{if(i===V){const e=s.value;if("number"!=typeof e&&"string"!=typeof e)return this.expectToken(le.RBrace,"W007"),null}let e=null;if(i===q){const t=this._lexer.peek();t.type!==le.Comma&&t.type!==le.RBrace||(e={...s})}if(!e&&(this.expectToken(le.Colon,"W008"),e=this.getExpression(!1),!e))return null;t.push([s,e])}const a=this._lexer.peek().type;if(a===le.Comma)this._lexer.get();else if(a!==le.RBrace)break}const r=this._lexer.peek();return this.expectToken(le.RBrace,"W004"),this.createExpressionNode(j,{props:t},e,r)}parseRegExpLiteral(){const e=this._lexer.peek(),t=this._lexer.getRegEx();return t.success?this.createExpressionNode(V,{value:new RegExp(t.pattern,t.flags)},e,this._lexer.peek()):(this.reportError("W002",e,t.pattern??""),null)}getExpression(e=!0){const t=this.parseExpr(e);return t||(this.reportError("W001"),null)}expectToken(e,t,r){const n=this._lexer.peek();return n.type===e||r&&n.type===le.Eof?this._lexer.get():(this.reportError(t??"W002",n,n.text),null)}skipToken(e){const t=this._lexer.peek();return t.type===e?(this._lexer.get(),t):null}skipTokens(...e){const t=this._lexer.peek();for(const r of e)if(t.type===r)return this._lexer.get(),t;return null}reportError(e,t,...r){let n=_e[e]??"Unkonwn error";throw r&&r.forEach((e,t)=>n=function(e,t,r){do{e=e.replace(t,r)}while(e.includes(t));return e}(n,`{${t}}`,r[t].toString())),t||(t=this._lexer.peek()),this._parseErrors.push({code:e,text:n,line:t.startLine,column:t.startColumn,position:t.startPosition,end:t.endPosition}),new Te(n,e)}createNode(e,t,r,n){return n||(n=this._lexer.peek()),Object.assign({},t,{type:e,startToken:r,endToken:n})}createExpressionNode(e,t={},r,n){let s;if(n||(n=this._lexer.peek()),r||(r=n),r&&n&&this._lexer.input.source){const e=r.startPosition,t=n.endPosition;e<=t&&(s=this._lexer.input.source.substring(e,t))}return Object.assign({},t,{type:e,nodeId:Ae(),startToken:r,endToken:n,source:s})}createStatementNode(e,t,r,n){return Object.assign({},t,{type:e,nodeId:Ae(),startToken:r,endToken:n})}parseBinaryLiteral(e){let t;const r=BigInt(e.text.replace(/[_']/g,""));return t=r<Number.MIN_SAFE_INTEGER||r>Number.MAX_SAFE_INTEGER?r:parseInt(e.text.substring(2).replace(/[_']/g,""),2),this.createExpressionNode(V,{value:t},e,e)}parseDecimalLiteral(e){let t;const r=BigInt(e.text.replace(/[_']/g,""));return t=r<Number.MIN_SAFE_INTEGER||r>Number.MAX_SAFE_INTEGER?r:parseInt(e.text.replace(/[_']/g,""),10),this.createExpressionNode(V,{value:t},e,e)}parseHexadecimalLiteral(e){let t;const r=BigInt(e.text.replace(/[_']/g,""));return t=r<Number.MIN_SAFE_INTEGER||r>Number.MAX_SAFE_INTEGER?r:parseInt(e.text.substring(2).replace(/[_']/g,""),16),this.createExpressionNode(V,{value:t},e,e)}parseRealLiteral(e){let t=parseFloat(e.text.replace(/[_']/g,""));return this.createExpressionNode(V,{value:t},e,e)}parseStringLiteral(e,t=!0){let r=e.text;t&&(r=e.text.length<2?"":r.substring(1,r.length-1));let n="",s=0,i=0;for(const o of r)switch(s){case 0:"\\"===o?s=1:n+=o;break;case 1:switch(s=0,o){case"b":n+="\b";break;case"f":n+="\f";break;case"n":n+="\n";break;case"r":n+="\r";break;case"t":n+="\t";break;case"v":n+="\v";break;case"S":n+=" ";break;case"0":n+=String.fromCharCode(0);break;case"'":n+="'";break;case'"':n+='"';break;case"\\":n+="\\";break;case"x":s=2;break;case"u":s=4;break;default:n+=o}break;case 2:a(o)?(i=parseInt(o,16),s=3):(n+="x",s=0);break;case 3:case 7:a(o)?(i=16*i+parseInt(o,16),n+=String.fromCharCode(i),s=0):(n+=String.fromCharCode(i),n+=o,s=0);break;case 4:if("{"===o){s=8;break}a(o)?(i=parseInt(o,16),s=5):(n+="x",s=0);break;case 5:a(o)?(i=16*i+parseInt(o,16),s=6):(n+=String.fromCharCode(i),n+=o,s=0);break;case 6:a(o)?(i=16*i+parseInt(o,16),s=7):(n+=String.fromCharCode(i),n+=o,s=0);break;case 8:a(o)?(i=parseInt(o,16),s=9):(n+="x",s=0);break;case 9:a(o)?(i=16*i+parseInt(o,16),s=10):(n+=String.fromCharCode(i),n+=o,s=0);break;case 10:a(o)?(i=16*i+parseInt(o,16),s=11):(n+=String.fromCharCode(i),n+=o,s=0);break;case 11:a(o)?(i=16*i+parseInt(o,16),s=12):(n+=String.fromCharCode(i),n+=o,s=0);break;case 12:a(o)?(i=16*i+parseInt(o,16),s=13):(n+=String.fromCharCode(i),n+=o,s=0);break;case 13:a(o)?(i=16*i+parseInt(o,16),s=14):(n+=String.fromCharCode(i),n+=o,s=0);break;case 14:n+=String.fromCharCode(i),"}"!==o&&(n+=o),s=0}switch(s){case 1:n+="\\";break;case 2:n+="x";break;case 3:n+=String.fromCharCode(i)}return this.createExpressionNode(V,{value:n},e,e);function a(e){return e>="0"&&e<="9"||e>="a"&&e<="f"||e>="A"&&e<="F"}}convertToArrayDestructure(e){const t=e.type===W?e.exprs:e.items,r=this.createExpressionNode(re,{aDestr:[]},e.startToken,e.endToken);for(const n of t){let e;switch(n.type){case G:e=this.createExpressionNode(ne,{},n.startToken,n.endToken);break;case q:e=this.createExpressionNode(ne,{id:n.name},n.startToken,n.endToken);break;case re:r.aDestr.push(...n.aDestr);break;case ne:e=n;break;case $:{const t=this.convertToArrayDestructure(n);t&&(e=this.createExpressionNode(ne,{aDestr:t.aDestr},n.startToken,n.endToken));break}case se:e=this.createExpressionNode(ne,{oDestr:n},n.startToken,n.endToken);break;case j:{const t=this.convertToObjectDestructure(n);t&&(e=this.createExpressionNode(ne,{oDestr:t.oDestr},n.startToken,n.endToken));break}default:return this.reportError("W017"),null}e&&r.aDestr?.push(e)}return r}convertToObjectDestructure(e){const t=this.createExpressionNode(re,{oDestr:[]},e.startToken,e.endToken);for(const r of e.props){if(!Array.isArray(r))return this.reportError("W018"),null;const[e,n]=r;if(e.type!==q)return this.reportError("W018"),null;let s;switch(n.type){case q:s=n.name===e.name?this.createExpressionNode(se,{id:e.name},n.startToken,n.endToken):this.createExpressionNode(se,{id:e.name,alias:n.name},n.startToken,n.endToken);break;case ne:s=this.createExpressionNode(se,{id:e.name,aDestr:n},e.startToken,n.endToken);break;case $:{const t=this.convertToArrayDestructure(n);t&&(s=this.createExpressionNode(se,{id:e.name,aDestr:t.aDestr},e.startToken,n.endToken));break}case se:s=n;break;case j:{const t=this.convertToObjectDestructure(n);t&&(s=this.createExpressionNode(se,{id:e.name,oDestr:t.oDestr},e.startToken,n.endToken));break}default:return this.reportError("W018"),null}s&&t.oDestr?.push(s)}return t}isExpressionStart(e){return Se[e.type]?.expressionStart??!1}}var ye=(e=>(e[e.Unknown=0]="Unknown",e[e.EndOfFileToken=1]="EndOfFileToken",e[e.CommentTrivia=2]="CommentTrivia",e[e.NewLineTrivia=3]="NewLineTrivia",e[e.WhitespaceTrivia=4]="WhitespaceTrivia",e[e.Identifier=5]="Identifier",e[e.OpenNodeStart=6]="OpenNodeStart",e[e.CloseNodeStart=7]="CloseNodeStart",e[e.NodeEnd=8]="NodeEnd",e[e.NodeClose=9]="NodeClose",e[e.Colon=10]="Colon",e[e.Equal=11]="Equal",e[e.StringLiteral=12]="StringLiteral",e[e.CData=13]="CData",e[e.Script=14]="Script",e[e.TextNode=15]="TextNode",e[e.AmpersandEntity=16]="AmpersandEntity",e[e.LessThanEntity=17]="LessThanEntity",e[e.GreaterThanEntity=18]="GreaterThanEntity",e[e.SingleQuoteEntity=19]="SingleQuoteEntity",e[e.DoubleQuoteEntity=20]="DoubleQuoteEntity",e[e.ElementNode=21]="ElementNode",e[e.AttributeNode=22]="AttributeNode",e[e.AttributeKeyNode=23]="AttributeKeyNode",e[e.ContentListNode=24]="ContentListNode",e[e.AttributeListNode=25]="AttributeListNode",e[e.TagNameNode=26]="TagNameNode",e[e.ErrorNode=27]="ErrorNode",e))(ye||{});function Ie(e){const t=[e];for(;void 0!==e.children&&e.children.length>0;)e=e.children[0],t.push(e);return t}function ve(e){const t=[e];for(;void 0!==e.children&&e.children.length>0;)e=e.children[e.children.length-1],t.push(e);return t}class Ce{constructor(e,t,r,n,s){this.kind=e,this.pos=t,this.end=r,this.triviaBefore=n,this.children=s,this.start=n?n[0]?.start??t:s?s[0]?.start??t:t}isElementNode(){return this.kind===ye.ElementNode}isAttributeNode(){return this.kind===ye.AttributeNode}isTagLike(){return this.kind===ye.ElementNode||this.kind===ye.CData||this.kind==ye.Script}isAttributeKeyNode(){return this.kind===ye.AttributeKeyNode}isContentListNode(){return this.kind===ye.ContentListNode}isAttributeListNode(){return this.kind===ye.AttributeListNode}isTagNameNode(){return this.kind===ye.TagNameNode}findTokenAtOffset(e){return function(e,t){const r=[e];let n;if(e.start>t||t>e.end)return;const s={chainAtPos:r,chainBeforePos:void 0,sharedParents:void 0};for(;void 0!==e.children&&e.children.length>0;){const i=e.children.findIndex(e=>e.start<=t&&(t<e.end||e.kind===ye.EndOfFileToken&&e.start<=e.end)),a=e.children[i],o=e.children[i-1];if(void 0!==o&&t<=a.pos)return n=r.length,{chainBeforePos:r.concat(ve(o)),sharedParents:n,chainAtPos:r.concat(Ie(a))};e=a,s.chainAtPos.push(e)}return s}(this,e)}getTriviaNodes(){return this.pos===this.start?null:this.triviaBefore?this.triviaBefore:this.children[0].getTriviaNodes()}}var Re=(e=>(e[e.EOF=-1]="EOF",e[e.nullCharacter=0]="nullCharacter",e[e.maxAsciiCharacter=127]="maxAsciiCharacter",e[e.lineFeed=10]="lineFeed",e[e.carriageReturn=13]="carriageReturn",e[e.lineSeparator=8232]="lineSeparator",e[e.paragraphSeparator=8233]="paragraphSeparator",e[e.nextLine=133]="nextLine",e[e.space=32]="space",e[e.nonBreakingSpace=160]="nonBreakingSpace",e[e.enQuad=8192]="enQuad",e[e.emQuad=8193]="emQuad",e[e.enSpace=8194]="enSpace",e[e.emSpace=8195]="emSpace",e[e.threePerEmSpace=8196]="threePerEmSpace",e[e.fourPerEmSpace=8197]="fourPerEmSpace",e[e.sixPerEmSpace=8198]="sixPerEmSpace",e[e.figureSpace=8199]="figureSpace",e[e.punctuationSpace=8200]="punctuationSpace",e[e.thinSpace=8201]="thinSpace",e[e.hairSpace=8202]="hairSpace",e[e.zeroWidthSpace=8203]="zeroWidthSpace",e[e.narrowNoBreakSpace=8239]="narrowNoBreakSpace",e[e.ideographicSpace=12288]="ideographicSpace",e[e.mathematicalSpace=8287]="mathematicalSpace",e[e.ogham=5760]="ogham",e[e.replacementCharacter=65533]="replacementCharacter",e[e._=95]="_",e[e.$=36]="$",e[e._0=48]="_0",e[e._1=49]="_1",e[e._2=50]="_2",e[e._3=51]="_3",e[e._4=52]="_4",e[e._5=53]="_5",e[e._6=54]="_6",e[e._7=55]="_7",e[e._8=56]="_8",e[e._9=57]="_9",e[e.a=97]="a",e[e.b=98]="b",e[e.c=99]="c",e[e.d=100]="d",e[e.e=101]="e",e[e.f=102]="f",e[e.g=103]="g",e[e.h=104]="h",e[e.i=105]="i",e[e.j=106]="j",e[e.k=107]="k",e[e.l=108]="l",e[e.m=109]="m",e[e.n=110]="n",e[e.o=111]="o",e[e.p=112]="p",e[e.q=113]="q",e[e.r=114]="r",e[e.s=115]="s",e[e.t=116]="t",e[e.u=117]="u",e[e.v=118]="v",e[e.w=119]="w",e[e.x=120]="x",e[e.y=121]="y",e[e.z=122]="z",e[e.A=65]="A",e[e.B=66]="B",e[e.C=67]="C",e[e.D=68]="D",e[e.E=69]="E",e[e.F=70]="F",e[e.G=71]="G",e[e.H=72]="H",e[e.I=73]="I",e[e.J=74]="J",e[e.K=75]="K",e[e.L=76]="L",e[e.M=77]="M",e[e.N=78]="N",e[e.O=79]="O",e[e.P=80]="P",e[e.Q=81]="Q",e[e.R=82]="R",e[e.S=83]="S",e[e.T=84]="T",e[e.U=85]="U",e[e.V=86]="V",e[e.W=87]="W",e[e.X=88]="X",e[e.Y=89]="Y",e[e.Z=90]="Z",e[e.ampersand=38]="ampersand",e[e.asterisk=42]="asterisk",e[e.at=64]="at",e[e.backslash=92]="backslash",e[e.backtick=96]="backtick",e[e.bar=124]="bar",e[e.caret=94]="caret",e[e.closeBrace=125]="closeBrace",e[e.closeBracket=93]="closeBracket",e[e.closeParen=41]="closeParen",e[e.colon=58]="colon",e[e.comma=44]="comma",e[e.dot=46]="dot",e[e.doubleQuote=34]="doubleQuote",e[e.equals=61]="equals",e[e.exclamation=33]="exclamation",e[e.greaterThan=62]="greaterThan",e[e.hash=35]="hash",e[e.lessThan=60]="lessThan",e[e.minus=45]="minus",e[e.openBrace=123]="openBrace",e[e.openBracket=91]="openBracket",e[e.openParen=40]="openParen",e[e.percent=37]="percent",e[e.plus=43]="plus",e[e.question=63]="question",e[e.semicolon=59]="semicolon",e[e.singleQuote=39]="singleQuote",e[e.slash=47]="slash",e[e.tilde=126]="tilde",e[e.backspace=8]="backspace",e[e.formFeed=12]="formFeed",e[e.byteOrderMark=65279]="byteOrderMark",e[e.tab=9]="tab",e[e.verticalTab=11]="verticalTab",e))(Re||{});class Le extends Error{constructor(e,t,r,n,s){super(e.message),this.code=e.code,this.message=e.message,this.pos=t,this.end=r,this.contextPos=n,this.contextEnd=s}toString(){return`${this.code}: ${this.message}`}}var Oe=(e=>(e.onlyOneElem="U002",e.expTagOpen="U003",e.expTagName="U004",e.expCloseStart="U005",e.expEndOrClose="U006",e.tagNameMismatch="U007",e.expEnd="U008",e.expAttrName="U009",e.expEq="U010",e.expAttrValue="U011",e.duplAttr="U012",e.uppercaseAttr="U013",e.expTagNameAfterNamespace="U014",e.expCloseStartWithName="U015",e.expAttrNameAfterNamespace="U016",e.unexpectedCloseTag="U017",e.expTagNameAfterCloseStart="U019",e.expAttrNameBeforeEq="U020",e.nestedCompDefs="U021",e.invalidNodeName="U022",e.multipleScriptTags="U023",e.compDefNameExp="U024",e.compDefNameUppercase="U025",e.globalNotAllowedInComponent="U026",e.invalidReusableCompAttr="U027",e.eventNoOnPrefix="U028",e.onlyNameValueAttrs="U029",e.nameAttrRequired="U030",e.usesValueOnly="U031",e.cantHaveNameAttr="U032",e.onlyFieldOrItemChild="U033",e.cannotMixFieldItem="U034",e.singleRootElem="U035",e.compDefNesedElem="U036",e.duplXmlns="U037",e.rootCompNoNamespace="U038",e.nsNotFound="U039",e.nsValueIncorrect="U040",e.nsSchemeIncorrect="U041",e.invalidChar="W001",e.untermStr="W002",e.untermComment="W007",e.untermCData="W008",e.untermScript="W009",e))(Oe||{});const we={unexpectedCloseTag:{code:"U017",message:"Read '</', but there's no opening tag to close."},expCloseStartWithName:function(e){return{code:"U015",message:`Opened tag has no closing pair. Expected to see '</${e}>'.`}},expCloseStart:{code:"U005",message:"A '</' token expected."},uppercaseAttr:function(e){return{code:"U013",message:`Attribute name '${e}' cannot start with an uppercase letter.`}},duplAttr:function(e){return{code:"U012",message:`Duplicated attribute: '${e}'.`}},tagNameMismatch:function(e,t){return{code:"U007",message:`Opening and closing tag names should match. Opening tag has a name '${e}', but the closing tag name is '${t}'.`}},invalidChar:function(e){return{code:"W001",message:`Invalid character '${e}'.`}},expEnd:{code:"U008",message:"A '>' token expected."},expTagName:{code:"U004",message:"A tag name expected."},expAttrStr:{code:"U011",message:"A string expected as an attribute value after '='."},expEq:{code:"U010",message:"An '=' token expected."},expTagOpen:{code:"U003",message:"A '<' token expected."},expEndOrClose:{code:"U006",message:"A '>' or '/>' token expected."},expAttrName:{code:"U009",message:"An attribute name expected."},expAttrNameAfterNamespace:function(e){return{code:"U016",message:`An attribute name expected after namespace '${e}'.`}},expTagNameAfterNamespace:function(e){return{code:"U014",message:`A tag name expected after namespace '${e}'.`}},expTagNameAfterCloseStart:{code:"U019",message:"Expected tag name after '</'."},expAttrNameBeforeEq:{code:"U020",message:"Expected attribute name before '='."},nestedCompDefs:{code:"U021",message:"A reusable component definition cannot nest another one."},invalidNodeName:function(e){return{code:"U022",message:`Invalid node name '${e}' in a component definition.`}},multipleScriptTags:{code:"U023",message:"Cannot have multiple <script> tags in the same tag."},compDefNameExp:{code:"U024",message:"A reusable component must have a non-empty name."},compDefNameUppercase:{code:"U025",message:"A component definition's name must start with an uppercase letter."},globalNotAllowedInComponent:{code:"U026",message:"Global variables cannot be declared in component definitions. Use Globals.xs or declare them in Main.xmlui instead."},invalidReusableCompAttr:function(e){return{code:"U027",message:`Invalid reusable component attribute '${e}'.`}},eventNoOnPrefix:function(e){return{code:"U028",message:`Event attribute names should not start with 'on' prefix: '${e}'.`}},onlyNameValueAttrs:function(e){return{code:"U029",message:`Only 'name', 'value', and type hint attributes are accepted in '${e}'.`}},nameAttrRequired:function(e){return{code:"U030",message:`The 'name' attribute in '${e}' is required.`}},usesValueOnly:{code:"U031",message:"The uses element must define only a non-empty 'value' attribute."},cantHaveNameAttr:function(e){return{code:"U032",message:`The '${e}' node cannot have a 'name' attribute.`}},onlyFieldOrItemChild:{code:"U033",message:"Only 'field' or 'item' are accepted as a child element."},cannotMixFieldItem:{code:"U034",message:"Cannot mix 'field' and 'item' nodes within an element."},singleRootElem:{code:"U035",message:"A component definition must have exactly one XMLUI element."},compDefNesedElem:{code:"U036",message:"A reusable component must have at least one nested component definition."},duplXmlns:function(e){return{code:"U037",message:`Duplicate xmlns found: '${e}'.`}},rootCompNoNamespace:{code:"U038",message:"The top level component's name cannot have a namespace."},nsNotFound:function(e){return{code:"U039",message:`Cannot resolve namespace '${e}'. It was not defined in any of the ancestor components.`}},nsValueIncorrect:function(e,t){return{code:"U040",message:`Incorrect namespace value '${e}'. ${t}`}},nsSchemeIncorrect:function(e,t){return{code:"U041",message:`Incorrect scheme specified before ':' (colon) in namespace ${e}. Delete it to get the default '${t}'.`}}},De={invalidAttrName:"T007",noTextChild:"T010",loaderIdRequired:"T013",loaderCantHave:"T014",valueAttrRequired:"T019",cannotMixCompNonComp:"T020",scriptNoAttrs:"T022",cantPutReusableDefInSlot:"T024",globalNotAllowedInNested:"T031",...ke},Pe={invalidAttrName:function(e){return{code:De.invalidAttrName,message:`Invalid attribute name: '${e}'.`}},noTextChild:function(e){return{code:De.noTextChild,message:`The '${e}' element does not accept a text child.`}},loaderIdRequired:{code:De.loaderIdRequired,message:"A loader element must have an id."},loaderCantHave:function(e){return{code:De.loaderCantHave,message:`A loader element must not have '${e}'.`}},valueAttrRequired:function(e){return{code:De.valueAttrRequired,message:`The 'value' attribute in '${e}' is required.`}},cannotMixCompNonComp:{code:De.cannotMixCompNonComp,message:"Cannot mix nested components and non-component children."},scriptNoAttrs:{code:De.scriptNoAttrs,message:"The 'script' tag must not have any attribute."},cantPutReusableDefInSlot:{code:De.cantPutReusableDefInSlot,message:"Cannot put a reusable component definitions into a slot."},globalNotAllowedInNested:{code:De.globalNotAllowedInNested,message:"Global variables can only be declared in the root element of Main.xmlui, not in nested components."}};function We(e,t){const r=new Map,n={},s=function(e,t){if(r.has(e))return r.get(e);const s=new be(t);let i=[];try{i=s.parseStatements()}catch(p){return n[e]=s.errors,null}const a=s.current;if(a.type!==le.Eof)return n[e]??(n[e]=[]),n[e].push({code:ke.unexpectedToken,text:_e[ke.unexpectedToken].replace(/\{(\d+)}/g,()=>a.text),position:a.startPosition,end:a.endPosition,line:a.startLine,column:a.startColumn}),null;const o=[],l={};i.filter(e=>e.type===L).forEach(e=>{const t=e;l[t.id.name]?function(e,t,...r){let n=_e[e];r&&r.forEach((e,t)=>n=n.replaceAll(`{${t}}`,r[t].toString()));o.push({code:e,text:_e[e].replace(/\{(\d+)}/g,(e,t)=>r[t]),position:t.startToken?.startPosition??0,end:t.startToken?.endPosition??0,line:t.startToken?.startLine??1,column:t.startToken?.startColumn??1})}(ke.funcAlreadyDefined,e,t.id.name):l[t.id.name]=t});const c={type:"ScriptModule",name:e,functions:l,statements:i,sources:new Map};if(r.set(e,c),o.length>0)return n[e]=o,null;return c}(e,t);return!s||Object.keys(n).length>0?n:s}function Be(e,t){const r={vars:{},moduleErrors:{},functions:{},hasInvalidStatements:!1},n={},s=We(e,t);return function(e){return"ScriptModule"!==e.type}(s)?{...r,moduleErrors:s}:(s.statements.forEach(e=>{!function(e,t,r){switch(e.type){case g:e.decls.forEach(e=>{if(e.id.name in t.vars)throw new Error(`Duplicated var declaration: '${e.id.name}'`);t.vars[e.id.name]={[c]:!0,tree:e.expr}});break;case L:!function(e,t,r){if(void 0!==r?.[e.id.name])return;if(e.id.name in t.functions)throw new Error(`Duplicated function declaration: '${e.id.name}'`);const n={type:K,args:e.args.slice(),statement:e.stmt,[p]:!0,closureContext:[]};r[e.id.name]=n,t.functions[e.id.name]=n}(e,t,r);break;default:t.hasInvalidStatements=!0}}(e,r,n)}),r)}const Ue=/^[A-Z]/,Me=/^on[A-Z]/,Fe=["name","value"],qe="component-ns",Xe={property:"property",template:"template",event:"event",variable:"variable",global:"global",loaders:"loaders",uses:"uses",method:"method",item:"item",field:"field"};let Ve=0;function $e(e,t){return{kind:ye.ElementNode,originalKind:t,children:[{kind:ye.OpenNodeStart},{kind:ye.TagNameNode,children:[{kind:ye.Identifier,text:"TextNodeCData"}]},{kind:ye.AttributeListNode,children:[{kind:ye.AttributeNode,children:[{kind:ye.AttributeKeyNode,children:[{kind:ye.Identifier,text:"value"}]},{kind:ye.Equal},{kind:ye.Identifier,text:`"${e}"`}]}]},{kind:ye.NodeClose}]}}function je(e,t){return{kind:ye.ElementNode,originalKind:t,children:[{kind:ye.OpenNodeStart},{kind:ye.TagNameNode,children:[{kind:ye.Identifier,text:"TextNode"}]},{kind:ye.AttributeListNode,children:[{kind:ye.AttributeNode,children:[{kind:ye.AttributeKeyNode,children:[{kind:ye.Identifier,text:"value"}]},{kind:ye.Equal},{kind:ye.Identifier,text:`"${e}"`}]}]},{kind:ye.NodeClose}]}}function He(e,t,r,n,s){throw new Le(e,t,r,n,s)}function ze(e){return e.type}function Ge(e,t){return e?Array.isArray(e)?"string"==typeof e?[e,t]:(e.push(t),e):[e,t]:t}function Ke(e){const t={kind:ye.TagNameNode,children:[{kind:ye.Identifier,text:"Fragment"}]};return{kind:ye.ElementNode,start:e[0].start,pos:e[0].pos,end:e[e.length-1].end,children:[{kind:ye.OpenNodeStart},t,{kind:ye.NodeEnd},{kind:ye.ContentListNode,children:e},{kind:ye.CloseNodeStart},t,{kind:ye.NodeEnd}]}}function Qe(e){if(e.children&&Array.isArray(e.children))for(const t of e.children)if("Fragment"===t.type&&t.scriptCollected){const r=t.script?.includes("$");r||(e.scriptCollected?(e.scriptCollected.vars={...e.scriptCollected.vars,...t.scriptCollected.vars},e.scriptCollected.functions={...e.scriptCollected.functions,...t.scriptCollected.functions}):e.scriptCollected=t.scriptCollected,delete t.scriptCollected)}}function Ye(e){return e.children?.find(e=>e.kind===ye.AttributeListNode)?.children??[]}function Je(e){return e.children?.find(e=>e.kind===ye.ContentListNode)?.children??[]}function Ze(e,t){const r=e.children?.findIndex(e=>e.kind===ye.ContentListNode);if(void 0===r||-1===r)return e;const n=e.children[r];return new Ce(e.kind,e.pos??0,e.end??0,e.triviaBefore,[...e.children.slice(0,r),new Ce(n.kind,n.pos??0,n.end??0,void 0,t),...e.children.slice(r)])}function et(e,t,r,n){let s=n.split(":");if(s.length>2)return;let i=n;if(2===s.length){if(s[0]!=qe)return;i=s[1]}if(i.includes("#"))return;switch(i){case qe:i=r;break;case"app-ns":i="#app-ns";break;case"core-ns":i="#xmlui-core-ns"}const a=e[e.length-1];a.has(r)||a.set(r,i)}function tt(e,t){return t(e.children.find(e=>e.kind===ye.TagNameNode).children.at(-1))}function rt(e,t,r){const n=e.children.find(e=>e.kind===ye.TagNameNode).children,s=t(n.at(-1));if(1===n.length)return s;const i=t(n[0]);if(0===r.length)return i+"."+s;let a;for(let o=r.length-1;o>=0&&(a=r[o].get(i),void 0===a);--o);return void 0===a?i+"."+s:a+"."+s}function nt(e){return e.split(",").map(e=>e.trim())}exports.CharacterCodes=Re,exports.DIAGS_PARSER=we,exports.Diag_Invalid_Character={code:"W001",message:"Invalid character."},exports.Diag_Unterminated_CData={code:"W008",message:"Unterminated CDATA section"},exports.Diag_Unterminated_Comment={code:"W007",message:"Unterminated comment"},exports.Diag_Unterminated_Script={code:"W009",message:"Unterminated script section"},exports.Diag_Unterminated_String_Literal={code:"W002",message:"Unterminated string literal."},exports.ErrCodesParser=Oe,exports.LinkTargetMd=[{value:"_self",description:"The link will open in the same frame as it was clicked."},{value:"_blank",description:"The link will open in a new window or tab."},{value:"_parent",description:"The link will open in the parent frame. If no parent, behaves as _self."},{value:"_top",description:"The topmost browsing context. The link will open in the full body of the window. If no ancestors, behaves as _self."},{value:"_unfencedTop",description:"Allows embedded fenced frames to navigate the top-level frame, i.e. traversing beyond the root of the fenced frame."}],exports.MediaBreakpointKeys=l,exports.Node=Ce,exports.Parser=be,exports.SyntaxKind=ye,exports.T_ARRAY_LITERAL=$,exports.T_ARROW_EXPRESSION=K,exports.T_ARROW_EXPRESSION_STATEMENT=m,exports.T_ASSIGNMENT_EXPRESSION=z,exports.T_ASYNC_FUNCTION_DECLARATION=O,exports.T_AWAIT_EXPRESSION=Z,exports.T_BINARY_EXPRESSION=P,exports.T_BLOCK_STATEMENT=u,exports.T_BREAK_STATEMENT=_,exports.T_CALCULATED_MEMBER_ACCESS_EXPRESSION=F,exports.T_CONDITIONAL_EXPRESSION=B,exports.T_CONST_STATEMENT=E,exports.T_CONTINUE_STATEMENT=S,exports.T_DESTRUCTURE=re,exports.T_DO_WHILE_STATEMENT=A,exports.T_EMPTY_STATEMENT=h,exports.T_EXPRESSION_STATEMENT=f,exports.T_FOR_IN_STATEMENT=y,exports.T_FOR_OF_STATEMENT=I,exports.T_FOR_STATEMENT=b,exports.T_FUNCTION_DECLARATION=L,exports.T_FUNCTION_INVOCATION_EXPRESSION=U,exports.T_IDENTIFIER=q,exports.T_IF_STATEMENT=T,exports.T_LET_STATEMENT=x,exports.T_LITERAL=V,exports.T_MEMBER_ACCESS_EXPRESSION=M,exports.T_NEW_EXPRESSION=ee,exports.T_OBJECT_LITERAL=j,exports.T_POSTFIX_OP_EXPRESSION=Y,exports.T_PREFIX_OP_EXPRESSION=Q,exports.T_REACTIVE_VAR_DECLARATION=J,exports.T_RETURN_STATEMENT=k,exports.T_SEQUENCE_EXPRESSION=W,exports.T_SPREAD_EXPRESSION=H,exports.T_SWITCH_STATEMENT=R,exports.T_TEMPLATE_LITERAL_EXPRESSION=X,exports.T_THROW_STATEMENT=v,exports.T_TRY_STATEMENT=C,exports.T_UNARY_EXPRESSION=D,exports.T_VAR_DECLARATION=te,exports.T_VAR_STATEMENT=g,exports.T_WHILE_STATEMENT=N,exports.TextVariantElement={abbr:"abbr",cite:"cite",code:"code",deleted:"del",inherit:"span",inserted:"ins",keyboard:"kbd",marked:"mark",sample:"samp",sub:"sub",sup:"sup",var:"var",mono:"pre",strong:"strong",em:"em",title:"span",subtitle:"span",small:"span",caption:"span",placeholder:"span",paragraph:"p",subheading:"h6",tableheading:"h6",secondary:"span"},exports.TransformDiag=Le,exports.VariantPropsKeys=o,exports.alignmentOptionMd=[{value:"center",description:"Place the content in the middle"},{value:"start",description:"Justify the content to the left (to the right if in right-to-left)"},{value:"end",description:"Justify the content to the right (to the left if in right-to-left)"}],exports.alignmentOptionValues=["start","center","end"],exports.buttonThemeMd=[{value:"attention",description:"Attention state theme color"},{value:"primary",description:"Primary theme color"},{value:"secondary",description:"Secondary theme color"}],exports.buttonThemeNames=r,exports.buttonTypesMd=[{value:"button",description:"Regular behavior that only executes logic if explicitly determined."},{value:"submit",description:"The button submits the form data to the server. This is the default for buttons in a Form or NativeForm component."},{value:"reset",description:"Resets all the controls to their initial values. Using it is ill advised for UX reasons."}],exports.buttonVariantMd=[{value:"solid",description:"A button with a border and a filled background."},{value:"outlined",description:"The button is displayed with a border and a transparent background."},{value:"ghost",description:"A button with no border and fill. Only the label is visible; the background is colored when hovered or clicked."}],exports.buttonVariantNames=s,exports.buttonVariantValues=n,exports.createXmlUiTreeNodeId=Ae,exports.getSyntaxKindStrRepr=function(e){switch(e){case 0:return"Unknown";case 1:return"EndOfFileToken";case 2:return"CommentTrivia";case 3:return"NewLineTrivia";case 4:return"WhitespaceTrivia";case 5:return"Identifier";case 6:return"OpenNodeStart";case 7:return"CloseNodeStart";case 8:return"NodeEnd";case 9:return"NodeClose";case 10:return"Colon";case 11:return"Equal";case 12:return"StringLiteral";case 13:return"CData";case 14:return"Script";case 16:return"AmpersandEntity";case 17:return"LessThanEntity";case 18:return"GreaterThanEntity";case 19:return"SingleQuoteEntity";case 20:return"DoubleQuoteEntity";case 21:return"ElementNode";case 22:return"AttributeNode";case 15:return"TextNode";case 24:return"ContentListNode";case 25:return"AttributeListNode";case 26:return"TagNameNode";case 27:return"ErrorNode";case 23:return"AttributeKeyNode"}return function(){throw new Error("Didn't expect to get here")}()},exports.httpMethodNames=["get","post","put","delete","patch","head","options","trace","connect"],exports.iconPositionMd=[{value:"start",description:"The icon will appear at the start (left side when the left-to-right direction is set)"},{value:"end",description:"The icon will appear at the end (right side when the left-to-right direction is set)"}],exports.iconPositionNames=i,exports.isArrowExpressionObject=function(e){return"object"==typeof e&&null!==e&&p in e&&!0===e[p]},exports.isParsedCodeDeclaration=function(e){return"object"==typeof e&&null!==e&&c in e&&!0===e[c]},exports.isSizeType=function(e){return t.includes(e)},exports.isTrivia=function(e){return e>=2&&e<=4},exports.labelPositionMd=[{value:"start",description:"The left side of the input (left-to-right) or the right side of the input (right-to-left)"},{value:"end",description:"The right side of the input (left-to-right) or the left side of the input (right-to-left)"},{value:"top",description:"The top of the input"},{value:"bottom",description:"The bottom of the input"},{value:"before",description:"The label is placed directly before the input with fit-content width. Similar to 'start' but the label does not stretch."},{value:"after",description:"The label is placed directly after the input with fit-content width. Similar to 'end' but the label does not stretch."}],exports.layoutOptionKeys=["horizontalAlignment","verticalAlignment","orientation","width","minWidth","maxWidth","height","minHeight","maxHeight","gap","border","borderTop","borderRight","borderBottom","borderLeft","borderColor","borderStyle","borderWidth","borderHorizontal","borderVertical","borderRadius","radiusTopLeft","radiusTopRight","radiusBottomLeft","radiusBottomRight","padding","paddingHorizontal","paddingVertical","paddingTop","paddingRight","paddingBottom","paddingLeft","backgroundColor","background","boxShadow","direction","overflowX","overflowY","zIndex","scrollSnapType","scrollSnapAlign","scrollSnapStop","scrollPadding","scrollPaddingTop","scrollPaddingRight","scrollPaddingBottom","scrollPaddingLeft","scrollMargin","scrollMarginTop","scrollMarginRight","scrollMarginBottom","scrollMarginLeft","color","fontFamily","fontSize","fontWeight","fontStyle","textDecoration","wrapContent","canShrink","margin","marginHorizontal","marginVertical","marginTop","marginRight","marginBottom","marginLeft","userSelect","letterSpacing","textTransform","lineHeight","opacity","cursor","textWrap","textAlign","textAlignLast","top","right","bottom","left","zoom","whiteSpace","textDecoration","textDecorationLine","textDecorationColor","textDecorationStyle","textDecorationThickness","textUnderlineOffset","outline","outlineWidth","outlineColor","outlineStyle","outlineOffset","fontVariant","lineBreak","textIndent","textShadow","wordBreak","wordSpacing","wordWrap","writingMode","transition","transform"],exports.nodeToComponentDef=function(e,t,r,n){const s=e=>e.text??t(e),i=function e(t){const r=Je(t),n=tt(t,s),i=!(n in Xe)||"property"===n||"template"===n,a="event"!==n&&"method"!==n,o=Ye(t);(function(e){for(let t of e)if(1===t.children?.length){const e={kind:ye.Equal},r={kind:ye.StringLiteral,text:'"true"'};t.children.push(e,r)}})(o),function(e){for(let t of e){const e=t.children[t.children.length-1],r=m(s(e));null!==r&&(e.text=r)}}(o),function(e){for(let t of e)if(t.kind===ye.TextNode){const e=m(s(t));null!==e&&(t.text=e)}}(r),function(e,t){t&&function(e){for(let t=0;t<e.length;++t)if(e[t].kind===ye.TextNode){const r=/[\f\n\r\t\v\u0020\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/g;e[t].text=s(e[t]).replace(r," ")}}(e);!function(e){for(let t=0;t<e.length;++t)e[t].kind===ye.CData&&(e[t].text=s(e[t]).slice(9,-3))}(e);for(let r=e.length-1;r>0;--r){const t=e[r-1],n=e[r];t.kind===ye.CData&&n.kind===ye.TextNode||t.kind===ye.CData&&n.kind===ye.CData?(e[r-1]={pos:t.pos,end:n.end,kind:ye.CData,text:s(t)+s(n)},e.pop()):t.kind===ye.TextNode&&n.kind===ye.TextNode?(s(t).endsWith(" ")&&s(n).startsWith(" ")&&(t.text=s(t).trimEnd()),e[r-1]={pos:t.pos,end:n.end,kind:ye.TextNode,text:s(t)+s(n)},e.pop()):t.kind===ye.TextNode&&n.kind===ye.CData&&(e[r-1]={pos:t.pos,end:n.end,kind:ye.CData,text:s(t)+s(n)},e.pop())}}(r,a);let l=!1,c=!1;for(let h=0;h<r.length;++h){const t=r[h];let n;if(t.kind==ye.Script){c=!0;continue}if(t.kind===ye.ElementNode){n=e(t),r[h]=n;continue}let a=s(t);t.kind===ye.CData&&(l=!0),n=i?l?$e(a,t.kind):je(a,t.kind):{kind:ye.TextNode,text:a,pos:t.pos,end:t.end,originalKind:t.kind},r[h]=n}const p=[],d=[];let u=!1;for(const h of r){if(h.kind===ye.ElementNode){if((tt(h,s)??void 0)in Xe){p.push(h);continue}u=!0}d.push(h)}if(c&&u){const e=Ke(d);return p.push(e),Ze(t,p)}return t}(e.children[0]),a=[],o=[];return function(e,t){const n=rt(t,s,o);if("Component"===n)return function(e){const t=Ye(e),n=t.map(f),i=n.find(e=>"name"===e.name),l=n.find(e=>"codeBehind"===e.name);let d;const u=t.map(e=>({attrNode:e,segmented:f(e)})).filter(({segmented:e})=>"method"===e.startSegment);u.length>0&&(d={},u.forEach(({attrNode:e,segmented:t})=>{d[t.name]=x(t.value,e.children?.[2])}));let h;const m=n.filter(e=>"var"===e.startSegment);m.length>0&&(h={},m.forEach(e=>{h[e.name]=e.value}));n.filter(e=>"global"===e.startSegment);const E=Je(e),g=E.filter(e=>e.kind===ye.ElementNode&&!(tt(e,s)in Xe)),T=[],k=[];for(let r of E)if(r.kind===ye.ElementNode){const e=tt(r,s);e===Xe.variable?k.push(r):e===Xe.global||e in Xe&&T.push(r)}let _;_=g.length>1||k.length>0?Ke([...k,...g]):g[0];o.push(new Map),n.filter(e=>"xmlns"===e.namespace).forEach(e=>{et(o,_,e.unsegmentedName,e.value)});let S=c(a,_,!1);o.pop();const N={name:i.value,component:S,debug:{source:{start:e.start,end:e.end,fileId:r}}};d&&(N.api=d);h&&(S.vars={...S.vars,...h});l&&(N.codeBehind=l.value);S.debug={source:{start:_.start,end:_.end,fileId:r}};const A=Ze(e,T);return p(a,N,A,!1),N}(t);let i={type:n,debug:{source:{start:t.start,end:t.end,fileId:r}}};return p(e,i,t,!0),Qe(i),i}(a,i);function c(e,t,n=!1){let i={type:rt(t,s,o),debug:{source:{start:t.start,end:t.end,fileId:r}}};return p(e,i,t,n),Qe(i),i}function p(e,t,r,n=!1){const i=!ze(t),a=Ye(r);o.push(new Map),a.forEach(e=>{!function(e,t,r=!1){const{namespace:n,startSegment:s,name:i,value:a,unsegmentedName:c}=f(t),p=t.children[2];if("xmlns"===n)return et(o,e,c,a);const d=!ze(e);if(d){if("name"===i&&!s)return;return void 0}switch(i){case"id":return void(e.uid=a);case"testId":return void(e.testId=a);case"when":return void(e.when=a);case"uses":return void(e.uses=nt(a));default:if(i.startsWith("when-")){const t=i.slice(5);if(l.includes(t))return e.responsiveWhen??(e.responsiveWhen={}),void(e.responsiveWhen[t]=a)}if("var"===s)e.vars??(e.vars={}),e.vars[i]=a;else if("global"===s){if(!r)return void He(Pe.globalNotAllowedInNested);e.globalVars??(e.globalVars={}),e.globalVars[i]=a}else if("method"===s)e.api??(e.api={}),e.api[i]=x(a,p);else if("event"===s)e.events??(e.events={}),e.events[i]=x(a,p);else if(Me.test(i)){e.events??(e.events={});const t=i[2].toLowerCase()+i.substring(3);e.events[t]=x(a,p)}else e.props??(e.props={}),e.props[i]=a}}(t,e,n)});Je(r).forEach(r=>{if(r.kind===ye.Script)return void function(e,t,r){Ye(t).length>0&&He(Pe.scriptNoAttrs);const n=r(t),s=n.indexOf(">")+1,i=n.slice(s,n.lastIndexOf("</"));if(0===i.trim().length)return;e.script=i;const a=new be(i);try{a.parseStatements(),e.scriptCollected=Be("Main",i),e.scriptCollected.hasInvalidStatements&&(e.scriptError=new Error("Only reactive variable and function definitions are allowed in a code-behind module."))}catch(l){if(a.errors&&a.errors.length>0){const e=a.errors[0];He({code:e.code,message:e.text},t.pos+s+e.position,t.pos+s+e.end)}else e.scriptError=l}const o=e.scriptCollected?.moduleErrors??{};Object.keys(o).length>0&&(e.scriptError=o)}(t,r,s);if(r.kind===ye.TextNode&&!i)return void(t.children=Ge(t.children,s(r)));const a=tt(r,s);if(!i||r.kind!==ye.ElementNode||a in Xe){if(!(a in Xe)&&!i){const n=c(e,r);return void(n&&(t.children?"string"==typeof t.children?t.children=[t.children,n]:Array.isArray(t.children)&&t.children.push(n):t.children=[n]))}switch(a){case"property":case"template":return void h(e,t,r,e=>ze(t)?t.props?.[e]:void 0,(e,r)=>{ze(t)&&(t.props??(t.props={}),t.props[e]=r)});case"event":return void h(e,t,r,e=>ze(t)?t.events?.[e]:void 0,(e,r,n)=>{ze(t)&&(t.events??(t.events={}),t.events[e]=x(r,n))});case Xe.variable:return void h(e,t,r,e=>ze(t)?t.vars?.[e]:void 0,(e,r)=>{ze(t)&&(t.vars??(t.vars={}),t.vars[e]=r)});case Xe.global:return n?void h(e,t,r,e=>ze(t)?t.globalVars?.[e]:void 0,(e,r)=>{ze(t)&&(t.globalVars??(t.globalVars={}),t.globalVars[e]=r)}):void He(Pe.globalNotAllowedInNested);case"loaders":return void function(e,t,r){if(!ze(t))return;const n=Je(r);0===n.length&&(t.loaders??(t.loaders=[]));const s=r.children?.some(e=>e.kind===ye.AttributeListNode);if(s)return void He(Pe.loaderCantHave("attributes"));n.forEach(r=>{if(r.kind===ye.TextNode)return void He(Pe.noTextChild("loader"));const n=c(e,r);n.uid?n.vars?He(Pe.loaderCantHave("vars")):n.loaders?He(Pe.loaderCantHave("loaders")):n.uses?He(Pe.loaderCantHave("uses")):(t.loaders??(t.loaders=[]),t.loaders.push(n)):He(Pe.loaderIdRequired)})}(e,t,r);case"uses":return void function(e,t){if(!ze(e))return;const r=Ye(t).map(f),n=r.find(e=>"value"===e.name);if(!n?.value||1!==r.length)return;const s=nt(n.value);e.uses?e.uses.push(...s):e.uses=s}(t,r);case"method":return void h(e,t,r,e=>ze(t)?t.api?.[e]:void 0,(e,r,n)=>{const s=Array.isArray(r)?r.map(e=>x(e,n)):x(r,n);t.api??(t.api={}),t.api[e]=s});default:return}}}),o.pop()}function d(e,t){let r=null;if(!t)return r;let n=null;return t.forEach(t=>{if(t.kind===ye.TextNode)return void(r=Ge(r,s(t)));if(t.kind!==ye.ElementNode)return;const i=tt(t,s);if("field"!==i&&"item"!==i)return;"field"===i?n||(n=i,r={}):"item"===i&&(n||(n=i,r=[]));let a=u(e,t,"field"===i);if(!a)return null;"field"===n?r[a.name]=a.value:r.push(a.value)}),r}function u(e,t,r=!0,n=[]){const i=tt(t,s),a=Je(t),o=a.filter(e=>e.kind===ye.ElementNode&&Ue.test(tt(e,s))),l=a.filter(e=>e.kind===ye.ElementNode&&!Ue.test(tt(e,s))),p=Ye(t),u=p.map(f),h=n.length>0?[...Fe,...n]:Fe,m=u.filter(e=>h.indexOf(e.name)>=0);if(u.length>m.length)return null;const x=m.find(e=>"name"===e.name);if(r){if(!x?.value)return null}else if(x)return null;const E=x?.value,g=m.find(e=>"value"===e.name);if(g&&void 0===g.value)return He(Pe.valueAttrRequired(i)),null;if(E&&o.length>=1){if(l.length>0)return He(Pe.cannotMixCompNonComp),null;const t=o.map(t=>c(e,t));return{name:E,value:1===t.length?t[0]:t}}let T,k=g?.value;if(null===k)return null;if("string"==typeof k){return{name:E,value:k,valueContentNode:p[m.findIndex(e=>"value"===e.name)]}}return a?.[0]?.kind===ye.TextNode&&(T=a[0]),{name:E,value:d(e,a),valueContentNode:T}}function h(e,t,r,n,s,i,a=[]){const o=u(e,r,!0,a);if(!o)return;const l=o.name,c=o.value;if(void 0!==o?.value)s(l,Ge(n(l),c),o.valueContentNode);else{const t=d(e,Je(r));let i=n(l);i=Ge(i,t),s(l,i)}}function f(e){let t=e.children[0];let r;3===t.children.length&&(r=s(t.children[0]));let n=s(t.children[t.children.length-1]);const i=n.split(".");let a,o;i.length>2&&He(Pe.invalidAttrName(n)),2===i.length?(o=i[0],a=i[1],""===a.trim()&&He(Pe.invalidAttrName(a))):a=n;const l=s(e.children[2]);return{namespace:r,startSegment:o,name:a,value:l.substring(1,l.length-1),unsegmentedName:n}}function m(e){let t="",r=0;for(let n=0;n<e.length;++n)if(e.charCodeAt(n)===Re.ampersand)switch(e.charCodeAt(n+1)){case Re.a:switch(e.charCodeAt(n+2)){case Re.m:e.charCodeAt(n+3)===Re.p&&e.charCodeAt(n+4)===Re.semicolon&&(t=t+e.substring(r,n)+"&",n+=4,r=n+1);break;case Re.p:e.charCodeAt(n+3)===Re.o&&e.charCodeAt(n+4)===Re.s&&e.charCodeAt(n+5)===Re.semicolon&&(t=t+e.substring(r,n)+"'",n+=5,r=n+1)}break;case Re.g:e.charCodeAt(n+2)===Re.t&&e.charCodeAt(n+3)===Re.semicolon&&(t=t+e.substring(r,n)+">",n+=3,r=n+1);break;case Re.l:e.charCodeAt(n+2)===Re.t&&e.charCodeAt(n+3)===Re.semicolon&&(t=t+e.substring(r,n)+"<",n+=3,r=n+1);break;case Re.q:e.charCodeAt(n+2)===Re.u&&e.charCodeAt(n+3)===Re.o&&e.charCodeAt(n+4)===Re.t&&e.charCodeAt(n+5)===Re.semicolon&&(t=t+e.substring(r,n)+'"',n+=5,r=n+1);break;case Re.n:e.charCodeAt(n+2)===Re.b&&e.charCodeAt(n+3)===Re.s&&e.charCodeAt(n+4)===Re.p&&e.charCodeAt(n+5)===Re.semicolon&&(t=t+e.substring(r,n)+" ",n+=5,r=n+1)}return 0===r?null:(t+=e.substring(r),t)}function x(e,t){if("string"!=typeof e)return e;const r=new be(e);try{return{__PARSED:!0,statements:r.parseStatements(),parseId:++Ve,source:e}}catch{if(r.errors.length>0){const e=r.errors[0],n={code:e.code,message:e.text};if(t){let r,s;const i=t;if(void 0!==i.originalKind)if(i.originalKind===ye.CData){const t=i.pos+9;r=t+e.position,s=t+e.end}else{const t=i.pos;r=t+e.position,s=t+e.end}else if(t.kind===ye.StringLiteral){const n=t.pos+1;r=n+e.position,s=n+e.end}else if(t.kind===ye.TextNode){const n=t.pos;r=n+e.position,s=n+e.end}He(n,r,s)}else He(n)}}}},exports.onPrefixRegex=Me,exports.orientationOptionMd=[{value:"horizontal",description:"The component will fill the available space horizontally"},{value:"vertical",description:"The component will fill the available space vertically"}],exports.orientationOptionValues=["horizontal","vertical"],exports.requireLabelModeMd=[{value:"markRequired",description:'Show "*" for required fields'},{value:"markOptional",description:'Show "(Optional)" for optional fields'},{value:"markBoth",description:'Show "*" for required AND "(Optional)" for optional fields'}],exports.scrollAnchoringValues=["top","bottom"],exports.sizeMd=[{value:"xs",description:"Extra small"},{value:"sm",description:"Small"},{value:"md",description:"Medium"},{value:"lg",description:"Large"},{value:"xl",description:"Extra large"}],exports.stripOnPrefix=function(e){return e[2].toLowerCase()+e.substring(3)},exports.tagNameNodesWithoutErrorsMatch=function(e,t,r){const n=e.children?.filter(e=>e.kind!==ye.ErrorNode)??[],s=t.children?.filter(e=>e.kind!==ye.ErrorNode)??[];if(n.length!==s.length)return!1;for(let i=0;i<n.length;++i)if(r(n[i])!==r(s[i]))return!1;return!0},exports.triggerPositionNames=a,exports.validationStatusMd=[{value:"valid",description:"Visual indicator for an input that is accepted"},{value:"warning",description:"Visual indicator for an input that produced a warning"},{value:"error",description:"Visual indicator for an input that produced an error"}],exports.variantOptionsMd=[{value:"abbr",description:"Represents an abbreviation or acronym"},{value:"caption",description:"Represents the caption (or title) of a table"},{value:"cite",description:"Is used to mark up the title of a cited work"},{value:"code",description:"Represents a line of code"},{value:"deleted",description:"Represents text that has been deleted"},{value:"em",description:"Marks text to stress emphasis"},{value:"inherit",description:"Represents text that inherits the style from its parent element"},{value:"inserted",description:"Represents a range of text that has been added to a document"},{value:"keyboard",description:"Represents a span of text denoting textual user input from a keyboard or voice input"},{value:"marked",description:"Represents text which is marked or highlighted for reference or notation"},{value:"mono",description:"Text using a mono style font family"},{value:"paragraph",description:"Represents a paragraph"},{value:"placeholder",description:"Text that is mostly used as the placeholder style in input controls"},{value:"sample",description:"Represents sample (or quoted) output from a computer program"},{value:"secondary",description:"Represents a bit dimmed secondary text"},{value:"small",description:"Represents side-comments and small print"},{value:"sub",description:"Specifies inline text as subscript"},{value:"strong",description:"Contents have strong importance"},{value:"subheading",description:"Indicates that the text is the subtitle in a heading"},{value:"subtitle",description:"Indicates that the text is the subtitle of some other content"},{value:"sup",description:"Specifies inline text as superscript"},{value:"tableheading",description:"Indicates that the text is a table heading"},{value:"title",description:"Indicates that the text is the title of some other content"},{value:"var",description:"Represents the name of a variable in a mathematical expression"}],exports.viewportSizeMd=[{value:"xs",description:"Extra small devices (e.g., a small smartphone with low screen resolution)"},{value:"sm",description:"Small devices (e.g., a smartphone in landscape view)"},{value:"md",description:"Medium devices (e.g., a tablet)"},{value:"lg",description:"Large devices (e.g., a laptop)"},{value:"xl",description:'Extra large devices (e.g., a standard 20" monitor)'},{value:"xxl",description:'Extra extra large devices (e.g., a large 29" monitor)'}];