@yannosay/sinth 5.3.1 → 5.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +40 -0
- package/README.md +13 -3
- package/dist/browser/sinth.js +84 -66
- package/dist/cli/index.js +17 -7
- package/dist/compiler/codegen.js +47 -11
- package/dist/compiler/prerender.d.ts +1 -0
- package/dist/compiler/prerender.js +12 -5
- package/dist/deploy/cloudflare.d.ts +2 -0
- package/dist/deploy/cloudflare.js +103 -18
- package/dist/deploy/platforms.d.ts +20 -0
- package/dist/deploy/platforms.js +203 -0
- package/dist/project/build.js +62 -18
- package/dist/project/config.d.ts +13 -0
- package/dist/project/config.js +51 -6
- package/dist/project/project.d.ts +7 -1
- package/dist/project/project.js +24 -10
- package/dist/runtime/index.js +41 -23
- package/dist/runtime/router.js +17 -1
- package/dist/server/dev.js +3 -2
- package/dist/server/functions-router.d.ts +60 -0
- package/dist/server/functions-router.js +161 -0
- package/dist/server/functions.d.ts +6 -11
- package/dist/server/functions.js +28 -116
- package/package.json +2 -1
- package/schema/sinth.config.schema.json +3 -1
- package/skills/agents.md +56 -0
- package/skills/sinth/SKILL.md +83 -0
- package/skills/sinth/references/language.md +174 -0
- package/skills/sinth/references/project-and-deploy.md +71 -0
package/dist/browser/sinth.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
var
|
|
2
|
-
`)}var Mt;function
|
|
3
|
-
`)}function st(t,e){if(t===e)return 0;if(!t.length)return e.length;if(!e.length)return t.length;let n=Array.from({length:e.length+1},(i,s)=>s);for(let i=1;i<=t.length;i++){let s=[i];for(let r=1;r<=e.length;r++){let a=t[i-1]===e[r-1]?0:1;s[r]=Math.min(n[r]+1,s[r-1]+1,n[r-1]+a)}n=s}return n[e.length]}function
|
|
1
|
+
var ri=Object.defineProperty;var ai=(t,e,n)=>e in t?ri(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var $=(t,e,n)=>ai(t,typeof e!="symbol"?e+"":e,n);var Ut=new Map;function Ht(t,e){Ut.set(t,e)}var P=class t extends Error{constructor(n,i,s,r){super(i);$(this,"diagnostic");this.name="SinthError",this.diagnostic={severity:"error",code:n,message:i,loc:s,hint:r},Object.setPrototypeOf(this,t.prototype)}get loc(){return this.diagnostic.loc}get code(){return this.diagnostic.code}format(n=!1){return Wt(this.diagnostic,n)}},Fe=class{constructor(){$(this,"items",[])}warn(e,n,i,s){let r=`${e}|${n}|${i?.file}|${i?.line}|${i?.col}`;this.items.some(a=>`${a.code}|${a.message}|${a.loc?.file}|${a.loc?.line}|${a.loc?.col}`===r)||this.items.push({severity:"warning",code:e,message:n,loc:i,hint:s})}error(e,n,i,s){throw new P(e,n,i,s)}get warnings(){return this.items.filter(e=>e.severity==="warning")}},J={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",yellow:"\x1B[33m",cyan:"\x1B[36m",gray:"\x1B[90m"};function oi(t,e=!1,n=2){let i=Ut.get(t.file);if(i===void 0)return"";let s=i.split(/\r?\n/),r=Math.max(1,t.line-n),a=Math.min(s.length,t.line+n),o=String(a).length,c=(u,f)=>e?u+f+J.reset:f,h=[];for(let u=r;u<=a;u++){let x=`${u===t.line?">":" "} ${String(u).padStart(o)} | `,d=(s[u-1]??"").replace(/\t/g," ");if(h.push(u===t.line?c(J.bold,x)+d:c(J.gray,x+d)),u===t.line){let g=(s[u-1]??"").slice(0,Math.max(0,t.col-1)).replace(/\t/g," "),w="^".repeat(Math.max(1,t.length??1));h.push(" ".repeat(o+2)+c(J.gray,"| ")+" ".repeat(g.length)+c(J.red,w))}}return h.join(`
|
|
2
|
+
`)}var Mt;function li(t){if(!Mt)return t;let e=s=>s.replace(/\\/g,"/"),n=e(t),i=e(Mt).replace(/\/$/,"")+"/";return n.startsWith(i)?n.slice(i.length):t}function Wt(t,e=!1){let n=(r,a)=>e?r+a+J.reset:a,s=[`${t.severity==="error"?n(J.red+J.bold,`error[${t.code}]`):n(J.yellow+J.bold,`warning[${t.code}]`)}: ${t.message}`];if(t.loc){s.push(n(J.cyan,` --> ${li(t.loc.file)}:${t.loc.line}:${t.loc.col}`));let r=oi(t.loc,e);r&&s.push(r)}return t.hint&&s.push(n(J.dim,` hint: ${t.hint}`)),s.join(`
|
|
3
|
+
`)}function st(t,e){if(t===e)return 0;if(!t.length)return e.length;if(!e.length)return t.length;let n=Array.from({length:e.length+1},(i,s)=>s);for(let i=1;i<=t.length;i++){let s=[i];for(let r=1;r<=e.length;r++){let a=t[i-1]===e[r-1]?0:1;s[r]=Math.min(n[r]+1,s[r-1]+1,n[r-1]+a)}n=s}return n[e.length]}function ke(t,e){let n,i=1/0,s=Math.max(2,Math.floor(t.length/3));for(let r of e){let a=st(t.toLowerCase(),r.toLowerCase());a<i&&a<=s&&(n=r,i=a)}return n}var p=(t,e={})=>({tag:t,...e}),Z={Main:p("main"),Header:p("header"),Footer:p("footer"),Nav:p("nav"),Section:p("section"),Article:p("article"),Aside:p("aside"),Div:p("div"),Span:p("span"),Search:p("search"),Hgroup:p("hgroup"),Hero:p("section",{className:"hero"}),Container:p("div",{className:"container"}),Grid:p("div",{className:"grid"}),Flex:p("div",{className:"flex"}),Stack:p("div",{className:"stack"}),Row:p("div",{className:"row"}),Column:p("div",{className:"col"}),CardGrid:p("div",{className:"card-grid"}),Heading:p("h1"),H1:p("h1"),H2:p("h2"),H3:p("h3"),H4:p("h4"),H5:p("h5"),H6:p("h6"),SubHeading:p("p",{className:"subheading"}),Paragraph:p("p"),P:p("p"),Lead:p("p",{className:"lead"}),Small:p("small"),Strong:p("strong"),Bold:p("b"),Em:p("em"),Italic:p("i"),Underline:p("u"),Code:p("code"),Pre:p("pre"),Blockquote:p("blockquote"),Quote:p("q"),Mark:p("mark"),Label:p("label"),Abbr:p("abbr"),Del:p("del"),Ins:p("ins"),Sub:p("sub"),Sup:p("sup"),Data:p("data"),Time:p("time"),Bdi:p("bdi"),Bdo:p("bdo"),Cite:p("cite"),Dfn:p("dfn"),Kbd:p("kbd"),Samp:p("samp"),Var:p("var"),Address:p("address"),Ruby:p("ruby"),Rt:p("rt"),Rp:p("rp"),S:p("s"),Button:p("button",{attrs:{type:"button"}}),SubmitButton:p("button",{attrs:{type:"submit"}}),Link:p("a"),NavLink:p("a",{className:"nav-link"}),A:p("a"),Select:p("select"),Form:p("form"),Fieldset:p("fieldset"),Legend:p("legend"),Details:p("details"),Summary:p("summary"),Dialog:p("dialog"),Textarea:p("textarea"),TextArea:p("textarea"),Datalist:p("datalist"),Optgroup:p("optgroup"),Option:p("option"),Progress:p("progress"),Meter:p("meter"),Output:p("output"),Menu:p("menu"),Picture:p("picture"),Video:p("video"),Audio:p("audio"),Figure:p("figure"),Figcaption:p("figcaption"),Canvas:p("canvas"),IFrame:p("iframe"),Iframe:p("iframe"),Object:p("object"),Map:p("map"),Img:p("img",{void:!0}),Image:p("img",{void:!0}),Logo:p("img",{void:!0,className:"logo"}),Input:p("input",{void:!0}),Checkbox:p("input",{void:!0,attrs:{type:"checkbox"}}),Radio:p("input",{void:!0,attrs:{type:"radio"}}),Hr:p("hr",{void:!0}),Br:p("br",{void:!0}),Wbr:p("wbr",{void:!0}),Source:p("source",{void:!0}),Track:p("track",{void:!0}),Embed:p("embed",{void:!0}),Col:p("col",{void:!0}),Area:p("area",{void:!0}),Ul:p("ul"),Ol:p("ol"),Li:p("li"),ListItem:p("li"),List:p("ul"),Dl:p("dl"),Dt:p("dt"),Dd:p("dd"),Table:p("table"),Caption:p("caption"),Thead:p("thead"),Tbody:p("tbody"),Tfoot:p("tfoot"),Tr:p("tr"),Th:p("th"),Td:p("td"),Colgroup:p("colgroup"),Template:p("template"),Slot:p("slot"),NoScript:p("noscript"),Svg:p("svg",{svg:!0}),Path:p("path",{svg:!0}),Circle:p("circle",{svg:!0}),Rect:p("rect",{svg:!0}),Line:p("line",{svg:!0}),Polyline:p("polyline",{svg:!0}),Polygon:p("polygon",{svg:!0}),Ellipse:p("ellipse",{svg:!0}),G:p("g",{svg:!0}),Use:p("use",{svg:!0}),Defs:p("defs",{svg:!0}),Text:p("text",{svg:!0}),LinearGradient:p("linearGradient",{svg:!0}),RadialGradient:p("radialGradient",{svg:!0}),Stop:p("stop",{svg:!0}),Symbol:p("symbol",{svg:!0}),ClipPath:p("clipPath",{svg:!0}),Mask:p("mask",{svg:!0}),TSpan:p("tspan",{svg:!0})},zt=new Set(["RawHTML","Html","Fragment","Head","Portal"]),Pe=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Me=new Set(["color","backgroundColor","background","backgroundImage","backgroundSize","backgroundPosition","fontSize","fontWeight","fontFamily","fontStyle","lineHeight","letterSpacing","textAlign","textDecoration","textTransform","whiteSpace","wordBreak","textOverflow","margin","marginTop","marginBottom","marginLeft","marginRight","padding","paddingTop","paddingBottom","paddingLeft","paddingRight","width","height","minWidth","maxWidth","minHeight","maxHeight","display","flexDirection","flexWrap","flex","flexGrow","flexShrink","flexBasis","justifyContent","alignItems","alignContent","alignSelf","gap","rowGap","columnGap","gridTemplateColumns","gridTemplateRows","gridColumn","gridRow","gridArea","position","top","right","bottom","left","zIndex","border","borderTop","borderBottom","borderLeft","borderRight","borderWidth","borderStyle","borderColor","borderRadius","outline","boxShadow","textShadow","opacity","visibility","overflow","overflowX","overflowY","objectFit","objectPosition","cursor","userSelect","pointerEvents","transform","transition","animation","aspectRatio","inset","filter","backdropFilter"]);var Ue=new Set(["allowfullscreen","async","autofocus","autoplay","checked","controls","default","defer","disabled","formnovalidate","hidden","inert","ismap","itemscope","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","selected"]);function ce(t){return/^(aria|data)[A-Z]/.test(t)?t.replace(/[A-Z]/g,n=>"-"+n.toLowerCase()):{className:"class",htmlFor:"for",tabIndex:"tabindex",readOnly:"readonly",maxLength:"maxlength",minLength:"minlength",autoComplete:"autocomplete",autoFocus:"autofocus",autoPlay:"autoplay",colSpan:"colspan",rowSpan:"rowspan",contentEditable:"contenteditable",crossOrigin:"crossorigin",spellCheck:"spellcheck",srcSet:"srcset",inputMode:"inputmode",enterKeyHint:"enterkeyhint",noValidate:"novalidate",playsInline:"playsinline",referrerPolicy:"referrerpolicy",fetchPriority:"fetchpriority",accessKey:"accesskey"}[t]??t}var rt=new Set(["globalThis","window","document","navigator","location","history","screen","console","performance","localStorage","sessionStorage","indexedDB","crypto","fetch","Request","Response","Headers","FormData","URL","URLSearchParams","AbortController","AbortSignal","Blob","File","FileReader","WebSocket","EventSource","Worker","BroadcastChannel","MessageChannel","Notification","IntersectionObserver","ResizeObserver","MutationObserver","matchMedia","getComputedStyle","requestAnimationFrame","cancelAnimationFrame","requestIdleCallback","setTimeout","clearTimeout","setInterval","clearInterval","queueMicrotask","structuredClone","alert","confirm","prompt","open","close","print","scrollTo","scrollBy","atob","btoa","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","escape","unescape","isNaN","isFinite","parseInt","parseFloat","Math","JSON","Date","Number","String","Boolean","BigInt","Symbol","Array","Object","Map","Set","WeakMap","WeakSet","WeakRef","Promise","Proxy","Reflect","RegExp","Error","TypeError","RangeError","SyntaxError","Intl","ArrayBuffer","DataView","Uint8Array","Int8Array","Uint16Array","Int16Array","Uint32Array","Int32Array","Float32Array","Float64Array","Uint8ClampedArray","TextEncoder","TextDecoder","Event","CustomEvent","KeyboardEvent","MouseEvent","EventTarget","Element","HTMLElement","Node","NodeList","DOMParser","XMLHttpRequest","Image","Audio","Option","CSS","customElements","visualViewport","devicePixelRatio","innerWidth","innerHeight","outerWidth","outerHeight","scrollX","scrollY","origin","isSecureContext","caches","clipboard","Infinity","NaN","undefined","Clipboard","AudioContext","speechSynthesis","SpeechSynthesisUtterance","Intl","sinthRender","sinth"]),qt=new Map([["range","$$.range"],["sinthRender","$$.update"],["render","$$.update"]]);var He=new Set(["str","num","int","bool","obj","ui","any","void","fn"]);var ci=["...","**=","??=","&&=","||=","=>","->","==","!=","<=",">=","&&","||","??","?.","+=","-=","*=","/=","%=","++","**","+","-","*","/","%","=","<",">","!","?",":",".",",",";","(",")","{","}","[","]","&","|","^","~","@","#"],ui=new Set(["style","script"]);function hi(t){return/[A-Za-z_$À-]/.test(t)}function pi(t){return/[A-Za-z0-9_$À-]/.test(t)}function me(t){return t>="0"&&t<="9"}var at=class{constructor(e,n,i){this.src=e;this.file=n;this.baseLoc=i;$(this,"pos",0);$(this,"line",1);$(this,"col",1);$(this,"sawNewline",!1);$(this,"rawPending",!1);$(this,"tokens",[])}tokenize(){for(;this.skipTrivia(),!(this.pos>=this.src.length);){let e=this.next();this.tokens.push(e),this.sawNewline=!1}return this.tokens.push(this.make("eof","",this.here(),this.pos)),this.tokens}here(){return this.baseLoc?{file:this.file,line:this.baseLoc.line+this.line-1,col:this.line===1?this.baseLoc.col+this.col-1:this.col}:{file:this.file,line:this.line,col:this.col}}make(e,n,i,s,r){return{kind:e,value:n,loc:i,start:s,end:this.pos,newlineBefore:this.sawNewline,...r}}advance(e=1){for(let n=0;n<e&&this.pos<this.src.length;n++)this.src[this.pos]===`
|
|
4
4
|
`?(this.line++,this.col=1):this.col++,this.pos++}peekChar(e=0){return this.src[this.pos+e]??""}fail(e,n=this.here()){throw new P("E0001",e,n)}skipTrivia(){for(;this.pos<this.src.length;){let e=this.peekChar();if(e===`
|
|
5
5
|
`)this.sawNewline=!0,this.advance();else if(e===" "||e===" "||e==="\r"||e==="\uFEFF")this.advance();else if(e==="-"&&this.peekChar(1)==="-"){if(/[\w)\]]/.test(this.src[this.pos-1]??"")&&/^--\s*[;)}\n]|^--$/.test(this.src.slice(this.pos,this.pos+4).replace(/\r/g,"")))throw new P("E0001","'--' starts a comment in Sinth, so it cannot decrement",{...this.here(),length:2},"Write 'x -= 1' instead of 'x--'");if(this.peekChar(2)==="[")this.skipBlockComment();else for(;this.pos<this.src.length&&this.peekChar()!==`
|
|
6
6
|
`;)this.advance()}else if(e==="/"&&this.peekChar(1)==="/")for(;this.pos<this.src.length&&this.peekChar()!==`
|
|
7
|
-
`;)this.advance();else if(e==="/"&&this.peekChar(1)==="*"){let n=this.here();for(this.advance(2);this.pos<this.src.length&&!(this.peekChar()==="*"&&this.peekChar(1)==="/");)this.advance();this.pos>=this.src.length&&this.fail("Unterminated block comment '/* ... */'",n),this.advance(2)}else break}}skipBlockComment(){let e=this.here();this.advance(3);let n=1;for(;this.pos<this.src.length&&n>0;)this.peekChar()==="-"&&this.peekChar(1)==="-"&&this.peekChar(2)==="["?(n++,this.advance(3)):this.peekChar()==="]"&&this.peekChar(1)==="-"&&this.peekChar(2)==="-"?(n--,this.advance(3)):this.advance();n>0&&this.fail("Unterminated block comment '--[ ... ]--'",e)}next(){let e=this.here(),n=this.pos,i=this.peekChar();if(i==="{"&&this.rawPending)return this.rawPending=!1,this.readRawBlock(e,n);if((i==="f"||i==="F")&&(this.peekChar(1)==='"'||this.peekChar(1)==="'"))return this.advance(),this.readString(e,n,!0);if(i==='"'||i==="'")return this.readString(e,n,!1);if(i==="`")return this.readTemplate(e,n);if(me(i)||i==="."&&me(this.peekChar(1)))return this.readNumber(e,n);if(
|
|
7
|
+
`;)this.advance();else if(e==="/"&&this.peekChar(1)==="*"){let n=this.here();for(this.advance(2);this.pos<this.src.length&&!(this.peekChar()==="*"&&this.peekChar(1)==="/");)this.advance();this.pos>=this.src.length&&this.fail("Unterminated block comment '/* ... */'",n),this.advance(2)}else break}}skipBlockComment(){let e=this.here();this.advance(3);let n=1;for(;this.pos<this.src.length&&n>0;)this.peekChar()==="-"&&this.peekChar(1)==="-"&&this.peekChar(2)==="["?(n++,this.advance(3)):this.peekChar()==="]"&&this.peekChar(1)==="-"&&this.peekChar(2)==="-"?(n--,this.advance(3)):this.advance();n>0&&this.fail("Unterminated block comment '--[ ... ]--'",e)}next(){let e=this.here(),n=this.pos,i=this.peekChar();if(i==="{"&&this.rawPending)return this.rawPending=!1,this.readRawBlock(e,n);if((i==="f"||i==="F")&&(this.peekChar(1)==='"'||this.peekChar(1)==="'"))return this.advance(),this.readString(e,n,!0);if(i==='"'||i==="'")return this.readString(e,n,!1);if(i==="`")return this.readTemplate(e,n);if(me(i)||i==="."&&me(this.peekChar(1)))return this.readNumber(e,n);if(hi(i))return this.readIdent(e,n);for(let s of ci)if(this.src.startsWith(s,this.pos))return this.advance(s.length),this.make("punct",s,e,n);return this.fail(`Unexpected character '${i}'`,e)}readIdent(e,n){for(;this.pos<this.src.length&&pi(this.peekChar());)this.advance();let i=this.src.slice(n,this.pos);if(i==="custom"&&this.src.startsWith("-element",this.pos)&&(this.advance(8),i="custom-element"),ui.has(i)&&this.atStatementStart()){let r=this.src.slice(this.pos).match(/^[ \t]*(\S)/)?.[1]??"";r!==":"&&r!=="="&&r!=="."&&r!=="("&&r!==","&&(this.rawPending=!0)}return this.make("ident",i,e,n)}atStatementStart(){let e=this.tokens[this.tokens.length-1];return!e||e.kind==="raw"?!0:e.kind==="punct"?e.value==="{"||e.value==="}"||e.value===";"?!0:this.sawNewline&&(e.value===")"||e.value==="]"):this.sawNewline&&(e.kind==="string"||e.kind==="number"||e.kind==="ident"||e.kind==="template")}readNumber(e,n){if(this.peekChar()==="0"&&/[xXbBoO]/.test(this.peekChar(1)))for(this.advance(2);/[0-9a-fA-F_]/.test(this.peekChar());)this.advance();else{for(;me(this.peekChar())||this.peekChar()==="_";)this.advance();if(this.peekChar()==="."&&me(this.peekChar(1)))for(this.advance();me(this.peekChar())||this.peekChar()==="_";)this.advance();if(/[eE]/.test(this.peekChar())&&(me(this.peekChar(1))||/[+-]/.test(this.peekChar(1))&&me(this.peekChar(2))))for(this.advance(2);me(this.peekChar());)this.advance()}let i=this.src.slice(n,this.pos).replace(/_/g,"");return Number.isNaN(Number(i))&&this.fail(`Invalid number literal '${i}'`,e),this.make("number",i,e,n)}readEscape(e){this.advance();let n=this.peekChar();switch(this.advance(),n){case"n":return`
|
|
8
8
|
`;case"r":return"\r";case"t":return" ";case"0":return"\0";case"b":return"\b";case"f":return"\f";case"v":return"\v";case"\\":case'"':case"'":case"`":case"$":case"{":case"}":return n;case`
|
|
9
9
|
`:return"";case"x":{let i=this.src.slice(this.pos,this.pos+2);return/^[0-9a-fA-F]{2}$/.test(i)||this.fail("Invalid \\x escape sequence",e),this.advance(2),String.fromCharCode(parseInt(i,16))}case"u":{if(this.peekChar()==="{"){let s=this.src.indexOf("}",this.pos),r=s===-1?"":this.src.slice(this.pos+1,s);return(!/^[0-9a-fA-F]{1,6}$/.test(r)||parseInt(r,16)>1114111)&&this.fail("Invalid \\u{...} escape sequence",e),this.advance(r.length+2),String.fromCodePoint(parseInt(r,16))}let i=this.src.slice(this.pos,this.pos+4);return/^[0-9a-fA-F]{4}$/.test(i)||this.fail("Invalid \\u escape sequence",e),this.advance(4),String.fromCharCode(parseInt(i,16))}default:return this.fail(`Unknown escape sequence '\\${n}'`,e)}}readString(e,n,i){let s=this.peekChar();this.advance();let r="";for(;this.pos<this.src.length&&this.peekChar()!==s;){let a=this.peekChar();if(a===`
|
|
10
10
|
`&&this.fail("Unterminated string literal (strings cannot span lines; use \\n or a `template`)",e),a==="\\"){if(i&&(this.peekChar(1)==="{"||this.peekChar(1)==="}")){r+="\\"+this.peekChar(1),this.advance(2);continue}r+=this.readEscape(e);continue}r+=a,this.advance()}return this.pos>=this.src.length&&this.fail("Unterminated string literal",e),this.advance(),i?this.make("template",r,e,n,{quote:s,formatted:!0}):this.make("string",r,e,n,{quote:s})}readTemplate(e,n){this.advance();let i="";for(;this.pos<this.src.length&&this.peekChar()!=="`";){let s=this.peekChar();if(s==="\\"){if(this.peekChar(1)==="$"||this.peekChar(1)==="{"||this.peekChar(1)==="}"){i+="\\"+this.peekChar(1),this.advance(2);continue}i+=this.readEscape(e);continue}if(s==="$"&&this.peekChar(1)==="{"){let r=0,a=this.pos;this.advance();do{let o=this.peekChar();o==="{"?r++:o==="}"&&r--,this.advance()}while(r>0&&this.pos<this.src.length);i+="{"+this.src.slice(a+2,this.pos-1)+"}";continue}if(s==="{"||s==="}"){i+="\\"+s,this.advance();continue}i+=s,this.advance()}return this.pos>=this.src.length&&this.fail("Unterminated template literal",e),this.advance(),this.make("template",i,e,n,{quote:"`",formatted:!0})}readRawBlock(e,n){this.advance();let i=this.pos,s=1;for(;this.pos<this.src.length;){let o=this.peekChar();if(o==='"'||o==="'"||o==="`"){this.skipQuoted(o);continue}if(o==="/"&&this.peekChar(1)==="/"&&(this.pos===i||/\s|[;{}]/.test(this.src[this.pos-1]))){for(;this.pos<this.src.length&&this.peekChar()!==`
|
|
11
11
|
`;)this.advance();continue}if(o==="/"&&this.peekChar(1)==="*"){for(this.advance(2);this.pos<this.src.length&&!(this.peekChar()==="*"&&this.peekChar(1)==="/");)this.advance();this.advance(2);continue}if(o==="-"&&this.peekChar(1)==="-"&&this.peekChar(2)==="["){this.skipBlockComment();continue}if(o==="{"&&s++,o==="}"&&(s--,s===0))break;this.advance()}s!==0&&this.fail("Unterminated block: missing '}'",e);let r=this.src.slice(i,this.pos);this.advance();let a={...e,col:e.col+1};return this.make("raw",r,a,n)}skipQuoted(e){for(this.advance();this.pos<this.src.length;){let n=this.peekChar();if(n==="\\"){this.advance(2);continue}if(n===e){this.advance();return}if(n===`
|
|
12
|
-
`&&e!=="`")return;if(e==="`"&&n==="$"&&this.peekChar(1)==="{"){this.advance(2);let i=1;for(;this.pos<this.src.length&&i>0;){let s=this.peekChar();s==="{"?i++:s==="}"&&i--,this.advance()}continue}this.advance()}}};function ge(t,e,n){return new at(t,e,n).tokenize()}var pi=new Set(["title","descr","description","fav","favicon","lang","charset","viewport","author","keywords","robots","themeColor","colorScheme","canonical","generator","manifest","appleTouchIcon","base","bodyClass","htmlClass","paths","jsonLd"]);function fi(t){return pi.has(t)||/^(og|twitter)[A-Z]/.test(t)}var di=new Set(["String","Number","Boolean","BigInt","Symbol","Array","Object","Date","Error","RegExp","Promise"]),mi=new Set(["Infinity","NaN"]),gi=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","enum","export","extends","false","finally","for","function","if","import","in","instanceof","new","null","return","super","switch","this","throw","true","try","typeof","var","void","while","with","yield","let","static","await","implements","interface","package","private","protected","public","and","or","not","arguments","eval"]),vi=new Set(["=","+=","-=","*=","/=","%=","**=","??=","&&=","||="]),ye=class t{constructor(e,n){this.source=e;this.file=n;E(this,"pos",0);E(this,"tokens");Ht(n,e),this.tokens=ge(e,n)}static fromTokens(e,n){let i=Object.create(t.prototype);return Object.assign(i,{pos:0,tokens:e,file:n,source:""}),i}peek(e=0){return this.tokens[Math.min(this.pos+e,this.tokens.length-1)]}get tok(){return this.peek()}next(){let e=this.tokens[this.pos];return this.pos<this.tokens.length-1&&this.pos++,e}isPunct(e,n=0){let i=this.peek(n);return i.kind==="punct"&&i.value===e}isIdent(e,n=0){let i=this.peek(n);return i.kind==="ident"&&(e===void 0||i.value===e)}eat(e){return this.isPunct(e)?(this.next(),!0):!1}eatIdent(e){return this.isIdent(e)?(this.next(),!0):!1}describe(e){return e.kind==="eof"?"end of file":e.kind==="string"?`string "${e.value}"`:e.kind==="raw"?"block":`'${e.value}'`}fail(e,n=this.tok,i,s="E0100"){throw new P(s,e,{...n.loc,length:Math.max(1,n.end-n.start)},i)}expect(e,n){return this.isPunct(e)||this.fail(`Expected '${e}'${n?" "+n:""}, found ${this.describe(this.tok)}`),this.next()}expectIdent(e){return this.tok.kind!=="ident"&&this.fail(`Expected ${e}, found ${this.describe(this.tok)}`),this.next()}sameLine(){return!this.tok.newlineBefore}adjacent(){let e=this.tokens[this.pos-1];return!!e&&e.end===this.tok.start}parseFile(){let e={path:this.file,source:this.source,isPage:!1,imports:[],meta:[],externs:[],vars:[],functions:[],components:[],styles:[],scripts:[],lifecycle:[],watchers:[],body:[]};if(this.isIdent("page")&&(this.peek(1).kind==="eof"||this.peek(1).newlineBefore))throw new P("E0104","The 'page' keyword was removed",this.tok.loc,"Delete this line. Files in pages/ (or in the project root when there is no pages/ folder) are pages automatically");let n=new Set;for(;this.tok.kind!=="eof";){let i=this.tok;if(i.kind==="ident"){switch(i.value){case"import":e.imports.push(this.parseImport());continue;case"extern":this.next();do{let s=this.expectIdent("a name after 'extern'");e.externs.push({name:s.value,loc:s.loc})}while(this.eat(","));continue;case"private":case"export":if(this.isIdent("component",1)||this.isIdent("custom-element",1)){let s=i.value==="export";this.next();let r=this.isIdent("component")?this.parseComponent():this.parseLegacyCustomElement();r.exported=s,e.components.push(r);continue}break;case"component":e.components.push(this.parseComponent());continue;case"custom-element":case"custom":if(this.peek(1).kind==="ident"){e.components.push(this.parseLegacyCustomElement());continue}break;default:break}if(this.tryParseOwnerItem(e,n))continue;if(i.value!=="var"&&this.isPunct("=",1)&&!n.has(i.value)&&fi(i.value)){this.next(),this.next(),e.meta.push({key:i.value,value:this.parseExpr(),loc:i.loc});continue}}e.body.push(...this.parseNode(e))}return e}tryParseOwnerItem(e,n){let i=this.tok;if(i.kind!=="ident")return!1;if(i.value==="var"||i.value==="const"||i.value==="computed"||i.value==="persist"&&this.isIdent("var",1)){let s=this.parseVarDecl();return e.vars.push(s),n?.add(s.name),!0}return i.value==="function"||i.value==="async"&&this.isIdent("function",1)?(e.functions.push(this.parseFunction()),!0):i.value==="style"&&this.peekPastModifiersIsRaw()?(e.styles.push(this.parseStyle()),!0):i.value==="script"&&this.peekPastModifiersIsRaw()?(e.scripts.push(this.parseScript()),!0):(i.value==="onMount"||i.value==="onDestroy")&&this.isPunct("{",1)?(this.next(),e.lifecycle.push({kind:i.value==="onMount"?"mount":"destroy",body:this.parseStmtBlock(),loc:i.loc}),!0):i.value==="watch"&&!this.peek(1).newlineBefore&&(this.peek(1).kind!=="punct"||this.isPunct("(",1))?this.parseWatch(e):!1}parseWatch(e){let n=this.next(),i=this.parseExpr();return e.watchers.push({expr:i,body:this.parseStmtBlock(),loc:n.loc}),!0}peekPastModifiersIsRaw(){for(let e=1;e<32;e++){let n=this.peek(e);if(n.kind==="raw")return!0;if(n.kind==="eof"||n.kind==="punct"&&n.value!=="=")return!1}return!1}parseImport(){let n=this.next().loc,i={kind:"module",source:"",named:[],attrs:{},sideEffect:!1,loc:n},s;if(this.isIdent("css")||this.isIdent("style")?(this.next(),s="style"):this.isIdent("js")||this.isIdent("script")?(this.next(),s="script"):this.isIdent("font")&&(this.next(),s="font"),this.tok.kind==="string")i.source=this.next().value,i.sideEffect=!0;else{if(this.eat("*"))this.eatIdent("as")||this.fail("Expected 'as' after '*' in import"),i.namespace=this.expectIdent("a namespace name").value;else if(this.isPunct("{"))i.named=this.parseImportSpecifiers();else if(this.tok.kind==="ident"&&!this.isIdent("from")){let a=this.next().value;if(this.isIdent("as")){if(this.next(),i.defaultName=this.expectIdent("an alias").value,i.named.push({name:a,alias:i.defaultName,loc:n}),i.defaultName=void 0,!this.isIdent("from"))return i.source=a,i.kind="library",i}else i.defaultName=a;if(this.eat(",")&&(this.eat("*")?(this.eatIdent("as"),i.namespace=this.expectIdent("a namespace name").value):i.named.push(...this.parseImportSpecifiers())),!this.isIdent("from"))return i.source=a,i.defaultName=void 0,i.kind="library",i.sideEffect=!0,i}this.eatIdent("from")||this.fail(`Expected 'from' in import, found ${this.describe(this.tok)}`),this.peek().kind!=="string"&&this.fail("Expected a module path string after 'from'"),i.source=this.next().value}let r;return this.isIdent("as")&&i.sideEffect&&(this.next(),r=this.expectIdent("an alias").value,i.sideEffect=!1),this.isPunct("{")&&this.sameLine()&&(i.attrs=this.parseImportAttrs()),i.kind=s??bi(i.source),r&&(i.kind==="sinth"?i.defaultName=r:i.namespace=r),i}parseImportSpecifiers(){let e=[];for(this.expect("{");!this.isPunct("}");){let n=this.expectIdent("an imported name"),i=n.value;if(this.eatIdent("as")&&(i=this.expectIdent("an alias").value),e.push({name:n.value,alias:i,loc:n.loc}),!this.eat(","))break}return this.expect("}","to close the import list"),e}parseImportAttrs(){let e={};for(this.expect("{");!this.isPunct("}");){let n=this.expectIdent("an attribute name").value;if(this.eat(":")){let i=this.next();e[n]=i.kind==="string"?i.value:i.value==="true"?!0:i.value==="false"?!1:i.value}else e[n]=!0;this.eat(",")}return this.expect("}"),e}parseTypeRef(){let e=this.expectIdent("a type");He.has(e.value)||this.fail(`Unknown type '${e.value}'`,e,"Valid types: str, num, bool, obj, ui, any, void (add [] for arrays, ? for nullable)","E0201");let n={base:e.value,array:0,nullable:!1};for(;this.isPunct("[")&&this.isPunct("]",1)&&this.adjacent();)this.next(),this.next(),n.array++;return this.isPunct("?")&&this.adjacent()&&(this.next(),n.nullable=!0),n}looksLikeType(e=0){let n=this.peek(e);return n.kind==="ident"&&He.has(n.value)}parseVarDecl(){let e=this.tok,n=!1;this.isIdent("persist")&&(this.next(),n=!0);let i=this.next(),s=i.value==="const"?"const":i.value==="computed"?"computed":"var",r;this.looksLikeType()&&(this.peek(1).kind==="ident"||this.isPunct("[",1)&&this.isPunct("]",2)||this.isPunct("?",1))&&(r=this.parseTypeRef());let a=this.expectIdent("a variable name");this.checkName(a),!r&&this.isPunct(":")&&(this.next(),r=this.parseTypeRef());let o;return this.eat("=")&&(o=this.parseExpr()),s!=="var"&&!o&&this.fail(`'${s}' declarations need an initial value`,a),this.eat(";"),{kind:s,name:a.value,type:r,init:o,persist:n,loc:e.loc}}checkName(e){gi.has(e.value)&&this.fail(`'${e.value}' is a reserved word and cannot be used as a name`,e,void 0,"E0102"),e.value.startsWith("$$")&&this.fail("Names starting with '$$' are reserved for the Sinth runtime",e,void 0,"E0102")}parseParams(){let e=[];if(!this.eat("("))return e;for(;!this.isPunct(")");){let n=this.tok,i=this.eat("..."),s=this.isIdent("bind")&&this.peek(1).kind==="ident"&&!this.isPunct(":",1);s&&this.next();let r;this.looksLikeType()&&(this.peek(1).kind==="ident"||this.isPunct("[",1)&&this.isPunct("]",2)||this.isPunct("?",1))&&(r=this.parseTypeRef());let a=this.expectIdent("a parameter name");this.checkName(a);let o=!1;this.isPunct("?")&&this.adjacent()&&(this.next(),o=!0),!r&&this.eat(":")&&(r=this.parseTypeRef());let c;if(this.eat("=")&&(c=this.parseExpr()),r?.nullable&&!c&&(o=!0),e.push({name:a.value,type:r,defaultValue:c,optional:o||!!c,rest:i,bindable:s,loc:n.loc}),!this.eat(","))break}return this.expect(")","to close the parameter list"),e}parseFunction(){let e=this.tok,n=this.eatIdent("async");this.next();let i=this.expectIdent("a function name");this.checkName(i),/^[A-Z]/.test(i.value)&&this.fail(`Function '${i.value}' must start with a lowercase letter`,i,"Use 'component' for reusable UI with a capitalized name");let s=this.parseParams(),r;(this.eat("->")||this.eat(":"))&&(r=this.parseTypeRef());let a={name:i.value,params:s,returnType:r,body:[],async:n,loc:e.loc};if(r?.base==="ui"){this.expect("{","to open the function body");let o=xi();a.view=this.parseNodesUntilClose(o,!0),this.expect("}","to close the function body"),a.body=o.vars.map(c=>({k:"var",decl:c,loc:c.loc}))}else a.body=this.parseStmtBlock();return a}parseComponent(){let e=this.next(),n=this.expectIdent("a component name");/^[A-Z]/.test(n.value)||this.fail(`Component '${n.value}' must start with an uppercase letter`,n);let i=this.parseParams(),s;this.eatIdent("as")&&(s=this.parseTagLiteral());let r={name:n.value,params:i,vars:[],functions:[],body:[],styles:[],scripts:[],lifecycle:[],watchers:[],customTag:s,exported:!0,file:this.file,loc:e.loc};return this.expect("{",`to open the body of component '${n.value}'`),r.body=this.parseNodesUntilClose(r,!1),this.expect("}",`to close component '${n.value}'`),r}parseTagLiteral(){this.expect("<","to start a tag name like <my-element/>");let e=this.expectIdent("a tag name").value;for(;this.isPunct("-")&&this.adjacent();)this.next(),e+="-"+this.expectIdent("a tag name segment").value;return this.eat("/"),this.expect(">","to close the tag literal"),/^[a-z][a-z0-9]*-[a-z0-9-]+$/.test(e)||this.fail(`'${e}' is not a valid custom element name (it must be lowercase and contain a dash)`),e}parseLegacyCustomElement(){let e=this.next(),n=this.expectIdent("an element name"),i,s=[];if(this.eat("(")){for(;!this.isPunct(")");){let o=this.expectIdent("an option").value;if(o==="export"?(this.expect(":"),i=this.parseTagLiteral()):s.push({name:o,optional:!0,rest:!1,loc:this.tok.loc,defaultValue:this.eat("=")?this.parseExpr():void 0}),!this.eat(","))break}this.expect(")")}let a={name:/^[A-Z]/.test(n.value)?n.value:n.value[0].toUpperCase()+n.value.slice(1),params:s,vars:[],functions:[],body:[],styles:[],scripts:[],lifecycle:[],watchers:[],customTag:i??`sinth-${n.value.toLowerCase()}`,exported:!0,file:this.file,loc:e.loc};if(this.tok.kind==="raw"){let o=this.next(),c=t.fromTokens(ge(o.value,this.file,o.loc),this.file);a.body=c.parseNodesUntilClose(a,!1)}else this.expect("{"),a.body=this.parseNodesUntilClose(a,!1),this.expect("}");return a}parseStyle(){let e=this.next(),n=!1,i="sinth";for(;this.tok.kind!=="raw";)if(this.eatIdent("global"))n=!0;else if(this.eatIdent("scoped"))n=!1;else if(this.isIdent("lang")){this.next(),this.expect("=");let r=this.next();r.value!=="css"&&r.value!=="scss"&&r.value!=="sinth"&&this.fail(`Unsupported style language '${r.value}'`,r,'Use lang="css", lang="scss" or omit it'),i=r.value}else this.fail(`Unexpected ${this.describe(this.tok)} in style block header`);let s=this.next();return{global:n,lang:i,raw:s.value,loc:{...s.loc,line:s.loc.line,col:e.loc.col}}}parseScript(){this.next();let e={};for(;this.tok.kind!=="raw";){let i=this.expectIdent("a script attribute").value;e[i]=this.eat("=")?this.next().value:"true"}let n=this.next();return{raw:n.value,attrs:e,loc:n.loc}}parseNodesUntilClose(e,n){let i=[];for(;!this.isPunct("}")&&this.tok.kind!=="eof";)this.tryParseOwnerItem(e)||n&&this.isIdent("return")&&(this.next(),this.isPunct("}"))||i.push(...this.parseNode(e));return i}startsElement(){let e=this.tok;if(e.kind!=="ident"||!/^[A-Z]/.test(e.value)||mi.has(e.value))return!1;if(this.isPunct(".",1)){let n=this.peek(2);return n.kind==="ident"&&/^[A-Z]/.test(n.value)}return!(di.has(e.value)&&this.isPunct("(",1))}parseNode(e){let n=this.tok;if(n.kind==="ident"){if(n.value==="if")return[this.parseIfNode(e)];if(n.value==="for")return[this.parseForNode(e)];if(n.value==="$slot")return[this.parseSlotOutlet(e)];if(n.value==="var"||n.value==="const"||n.value==="computed"){let c=this.parseVarDecl();return[{k:"var",decl:c,loc:c.loc}]}if(n.value==="slot"&&this.isPunct("(",1)&&this.fail("'slot(...) { }' can only be used directly inside a component usage to fill a named slot"),this.startsElement())return[this.parseElement(e)]}n.kind==="raw"&&this.fail("Unexpected block");let i=n.loc,s=this.parseExpr();if(this.eat(";"),Kt(s))return[{k:"stmt",stmt:{k:"expr",expr:s,loc:i},loc:i}];let r={k:"text",expr:s,loc:i},a=this.tok,o=a.kind==="ident"&&(/^[A-Z]/.test(a.value)||["if","for","var","const","computed","$slot","slot"].includes(a.value));return!a.newlineBefore&&(a.kind==="string"||a.kind==="number"||a.kind==="template"||a.kind==="ident"&&!o)&&this.fail(`Unexpected ${this.describe(this.tok)} after expression`,this.tok,"Use '+' to join values, or put each child on its own line"),[r]}parseSlotOutlet(e){let n=this.next(),i="default",s=[];if(this.isPunct("(")&&this.adjacent()){for(this.next();!this.isPunct(")");){let r=this.expectIdent("'name' or 'fallback'");if(this.expect(":"),r.value==="name"){let a=this.next();a.kind!=="string"&&this.fail("Slot names must be string literals",a),i=a.value}else if(r.value==="fallback"){let a=this.parseExpr();s=[{k:"text",expr:a,loc:a.loc}]}else this.fail(`Unknown slot option '${r.value}'`,r);if(!this.eat(","))break}this.expect(")")}return this.isPunct("{")&&this.sameLine()&&(this.next(),s=this.parseNodesUntilClose(e,!1),this.expect("}")),{k:"slot",name:i,fallback:s,loc:n.loc}}parseElement(e){let n=this.next(),i=n.value;for(;this.isPunct(".")&&this.peek(1).kind==="ident";)this.next(),i+="."+this.next().value;let s={k:"element",name:i,attrs:[],children:[],slots:[],hasBody:!1,loc:n.loc};if(this.isPunct("(")&&this.sameLine()&&(s.attrs=this.parseAttrs()),this.isPunct("{")){for(this.next(),s.hasBody=!0;!this.isPunct("}")&&this.tok.kind!=="eof";){if(this.isIdent("slot")&&this.isPunct("(",1)){s.slots.push(this.parseSlotFill(e));continue}this.tryParseOwnerItem(e)||s.children.push(...this.parseNode(e))}this.expect("}",`to close '${i}'`)}return s}parseSlotFill(e){let n=this.next();this.expect("(");let i="default";for(;!this.isPunct(")");){let r=this.expectIdent("'name'");this.expect(":");let a=this.next();if((r.value!=="name"||a.kind!=="string")&&this.fail('Expected slot(name: "...")',a),i=a.value,!this.eat(","))break}this.expect(")"),this.expect("{","to open the slot content");let s=this.parseNodesUntilClose(e,!1);return this.expect("}"),{name:i,children:s,loc:n.loc}}parseAttrName(){let e=this.tok;e.kind!=="ident"&&e.kind!=="string"&&this.fail(`Expected an attribute name, found ${this.describe(e)}`),this.next();let n=e.value;for(;e.kind==="ident"&&this.isPunct("-")&&this.adjacent()&&this.peek(1).kind==="ident"&&this.peek(1).start===this.tok.end;)this.next(),n+="-"+this.next().value;return{full:n,loc:e.loc}}parseAttrs(){let e=[];for(this.expect("(");!this.isPunct(")")&&this.tok.kind!=="eof";){if(this.isPunct("...")){let r=this.next();e.push({name:"...",modifiers:[],value:this.parseExpr(),loc:r.loc}),this.eat(",");continue}let n=this.parseAttrName(),i=[];for(;this.isPunct(".")&&this.adjacent();)this.next(),i.push(this.expectIdent("an event modifier").value);let s={name:n.full,modifiers:i,value:null,loc:n.loc};this.eat(":")&&(/^on[A-Z]/.test(s.name)?s.handler=this.parseHandler():s.value=this.parseExpr()),e.push(s),this.eat(",")}return this.expect(")","to close the attribute list"),e}atAttrBoundary(){return this.isPunct(",")||this.isPunct(")")?!0:this.tok.kind==="ident"&&this.isPunct(":",1)&&!this.isIdent("else")}parseHandler(){let e=[];for(;!(this.atAttrBoundary()||(e.push(this.parseStmt()),!this.eat(";"))););return e.length===0&&this.fail("Expected an event handler"),e}parseIfNode(e){let n=this.next(),i={k:"if",branches:[],persist:!1,loc:n.loc},s=this.parseExpr();for(this.parseIfModifiers(i),i.branches.push({test:s,body:this.parseNodeBlock(e),loc:n.loc});;){if(this.isIdent("elif")){let r=this.next(),a=this.parseExpr();this.parseIfModifiers(i),i.branches.push({test:a,body:this.parseNodeBlock(e),loc:r.loc});continue}if(this.isIdent("else")){let r=this.next();if(this.eatIdent("if")){let a=this.parseExpr();this.parseIfModifiers(i),i.branches.push({test:a,body:this.parseNodeBlock(e),loc:r.loc});continue}this.parseIfModifiers(i),i.branches.push({body:this.parseNodeBlock(e),loc:r.loc})}break}return i}parseIfModifiers(e){for(;;)if(this.eatIdent("persist"))e.persist=!0;else{if(this.eatIdent("replace"))continue;if(this.isIdent("delay")&&this.isPunct("(",1))this.next(),this.next(),e.delay=this.parseExpr(),this.expect(")");else if(this.isIdent("hide")&&this.isPunct("(",1)){this.next(),this.next();let n=this.parseExpr();this.expect(")"),n.k==="lit"&&n.value===!0&&(e.persist=!0)}else if(this.isIdent("transition")&&this.isPunct("(",1)){this.next(),this.next();let n=this.next();n.kind!=="string"&&this.fail('transition(...) expects a string name like "fade"',n),e.transition=n.value,this.expect(")")}else break}}parseNodeBlock(e){this.expect("{","to open the block");let n=this.parseNodesUntilClose(e,!1);return this.expect("}","to close the block"),n}parseLoopHead(){let e=this.isPunct("(")&&this.loopHeadIsParenthesized();e&&this.next();let n=[];do{let a=this.expectIdent("a loop variable name");this.checkName(a),n.push(a.value)}while(this.eat(","));n.length>3&&this.fail("A for loop can declare at most three names: item, index, key"),this.eatIdent("in")||this.fail(`Expected 'in' after loop variable${n.length>1?"s":""}`);let i=this.parseExpr();e&&this.expect(")","to close the loop header");let s,r;for(;;)if(this.isIdent("key"))this.next(),s=this.parseExpr();else if(this.isIdent("if"))this.next(),r=this.parseExpr();else break;return{names:n,iter:i,keyExpr:s,filter:r}}loopHeadIsParenthesized(){let e=0;for(let n=0;n<4096;n++){let i=this.peek(n);if(i.kind==="eof")return!1;if(i.kind==="punct"&&(i.value==="("||i.value==="["||i.value==="{")&&e++,i.kind==="punct"&&(i.value===")"||i.value==="]"||i.value==="}")&&e--,e===1&&i.kind==="ident"&&i.value==="in")return!0;if(e===0)return!1}return!1}parseForNode(e){let n=this.next(),i=this.parseLoopHead();this.eatIdent("persist");let s={k:"for",...i,body:this.parseNodeBlock(e),loc:n.loc};return this.isIdent("else")&&this.isPunct("{",1)&&(this.next(),s.empty=this.parseNodeBlock(e)),s}parseStmtBlock(){this.expect("{","to open the block");let e=[];for(;!this.isPunct("}")&&this.tok.kind!=="eof";)e.push(this.parseStmt()),this.eat(";");return this.expect("}","to close the block"),e}parseStmt(){let e=this.tok;if(e.kind==="ident")switch(e.value){case"var":case"const":case"computed":{let i=this.parseVarDecl();return{k:"var",decl:i,loc:i.loc}}case"if":{this.next();let i=this.parseExpr(),s=this.isPunct("{")?this.parseStmtBlock():[this.parseStmt()],r;return this.isIdent("elif")?r=[this.parseStmt()]:this.isIdent("else")&&(this.next(),r=this.isPunct("{")?this.parseStmtBlock():[this.parseStmt()]),{k:"if",test:i,then:s,else:r,loc:e.loc}}case"elif":{this.next();let i=this.parseExpr(),s=this.parseStmtBlock(),r;return this.isIdent("elif")?r=[this.parseStmt()]:this.eatIdent("else")&&(r=this.isPunct("{")?this.parseStmtBlock():[this.parseStmt()]),{k:"if",test:i,then:s,else:r,loc:e.loc}}case"for":{this.next();let i=this.parseLoopHead();return{k:"for",names:i.names,iter:i.iter,filter:i.filter,body:this.parseStmtBlock(),loc:e.loc}}case"while":return this.next(),{k:"while",test:this.parseExpr(),body:this.parseStmtBlock(),loc:e.loc};case"try":{this.next();let i=this.parseStmtBlock(),s,r,a;return this.eatIdent("catch")&&(this.isPunct("(")?(this.next(),s=this.expectIdent("a name for the caught error").value,this.expect(")","after the caught error name")):this.tok.kind==="ident"&&(s=this.expectIdent("a name for the caught error").value),r=this.parseStmtBlock()),this.eatIdent("finally")&&(a=this.parseStmtBlock()),!r&&!a&&this.fail("'try' needs a 'catch' or 'finally' block",e),{k:"try",body:i,param:s,handler:r,finalizer:a,loc:e.loc}}case"throw":return this.next(),{k:"throw",value:this.parseExpr(),loc:e.loc};case"return":return this.next(),this.isPunct("}")||this.isPunct(";")||this.tok.newlineBefore||this.tok.kind==="eof"||this.atAttrBoundary()?{k:"return",loc:e.loc}:{k:"return",value:this.parseExpr(),loc:e.loc};case"break":return this.next(),{k:"break",loc:e.loc};case"continue":return this.next(),{k:"continue",loc:e.loc};default:break}return{k:"expr",expr:this.parseExpr(),loc:e.loc}}parseExpr(){return this.parseAssign()}parseAssign(){let e=this.tryParseArrow();if(e)return e;let n=this.parseTernary(),i=this.tok;if(i.kind==="punct"&&vi.has(i.value)){n.k!=="id"&&n.k!=="member"&&n.k!=="index"&&this.fail("Invalid assignment target",i,void 0,"E0103"),this.next();let s=this.parseAssign();return{k:"assign",op:i.value,target:n,value:s,loc:n.loc}}return n}tryParseArrow(){let e=this.tok,n=this.isIdent("async")&&(this.isPunct("(",1)||this.peek(1).kind==="ident"&&this.isPunct("=>",2)),i=n?1:0;if(this.peek(i).kind==="ident"&&this.isPunct("=>",i+1)){n&&this.next();let h=this.next();return this.next(),{k:"arrow",params:[{name:h.value,optional:!1,rest:!1,loc:h.loc}],body:this.parseArrowBody(),async:n,loc:e.loc}}if(!this.isPunct("(",i))return;let s=0,r=i;for(;r<4096;r++){let h=this.peek(r);if(h.kind==="eof")return;if(h.kind==="punct"&&(h.value==="("||h.value==="["||h.value==="{")&&s++,h.kind==="punct"&&(h.value===")"||h.value==="]"||h.value==="}")&&s--,s===0)break}let a=this.peek(r+1);if(!(a.kind==="punct"&&(a.value==="=>"||a.value==="->"&&this.peek(r+2).kind==="ident"&&He.has(this.peek(r+2).value))))return;n&&this.next();let c=this.parseParams();return this.eat("->")?(this.parseTypeRef(),this.eat("=>")?{k:"arrow",params:c,body:this.parseArrowBody(),async:n,loc:e.loc}:{k:"arrow",params:c,body:this.parseStmtBlock(),async:n,loc:e.loc}):(this.expect("=>"),{k:"arrow",params:c,body:this.parseArrowBody(),async:n,loc:e.loc})}parseArrowBody(){return this.isPunct("{")?this.parseStmtBlock():this.parseAssign()}parseTernary(){let e=this.parseNullish();if(this.isPunct("?")){this.next();let n=this.parseAssign();this.expect(":","in conditional expression");let i=this.parseAssign();return{k:"cond",test:e,then:n,else:i,loc:e.loc}}return e}binaryLevel(e,n,i={}){let s=e();for(;;){let r=this.tok,a;if(r.kind==="punct"?a=n[r.value]:r.kind==="ident"&&(a=i[r.value]),!a)return s;this.next();let o=e();s={k:"binary",op:a,left:s,right:o,loc:s.loc}}}parseNullish(){return this.binaryLevel(()=>this.parseOr(),{"??":"??"})}parseOr(){return this.binaryLevel(()=>this.parseAnd(),{"||":"||"},{or:"||"})}parseAnd(){return this.binaryLevel(()=>this.parseEquality(),{"&&":"&&"},{and:"&&"})}parseEquality(){return this.binaryLevel(()=>this.parseRelational(),{"==":"==","!=":"!="})}parseRelational(){return this.binaryLevel(()=>this.parseAdditive(),{"<":"<",">":">","<=":"<=",">=":">="})}parseAdditive(){return this.binaryLevel(()=>this.parseMultiplicative(),{"+":"+","-":"-"})}parseMultiplicative(){return this.binaryLevel(()=>this.parseExponent(),{"*":"*","/":"/","%":"%"})}parseExponent(){let e=this.parseUnary();if(this.isPunct("**")){this.next();let n=this.parseExponent();return{k:"binary",op:"**",left:e,right:n,loc:e.loc}}return e}parseUnary(){let e=this.tok;return e.kind==="punct"&&(e.value==="!"||e.value==="-"||e.value==="+"||e.value==="~")?(this.next(),{k:"unary",op:e.value,arg:this.parseUnary(),loc:e.loc}):e.kind==="ident"&&(e.value==="not"||e.value==="typeof"||e.value==="await")?(this.next(),{k:"unary",op:e.value==="not"?"!":e.value,arg:this.parseUnary(),loc:e.loc}):this.isPunct("++")?(this.next(),{k:"update",op:"++",prefix:!0,target:this.parseUnary(),loc:e.loc}):this.parsePostfix()}parsePostfix(){let e=this.parseCallMember();return this.isPunct("++")&&this.sameLine()&&(this.next(),e={k:"update",op:"++",prefix:!1,target:e,loc:e.loc}),e}parseArgs(){let e=[];for(this.expect("(");!this.isPunct(")")&&this.tok.kind!=="eof";){let n=this.tok.loc;if(this.eat("..."))e.push({value:this.parseExpr(),spread:!0,loc:n});else if(this.tok.kind==="ident"&&this.isPunct(":",1)&&!this.isPunct(":",2)){let i=this.next().value;this.next(),e.push({name:i,value:this.parseExpr(),spread:!1,loc:n})}else e.push({value:this.parseExpr(),spread:!1,loc:n});if(!this.eat(","))break}return this.expect(")","to close the argument list"),e}parseCallMember(){let e;if(this.isIdent("new")){let n=this.next(),i=this.parsePrimary();for(;this.isPunct(".");){this.next();let r=this.expectIdent("a property name");i={k:"member",object:i,prop:r.value,optional:!1,loc:i.loc}}let s=this.isPunct("(")?this.parseArgs():[];e={k:"new",callee:i,args:s,loc:n.loc}}else e=this.parsePrimary();for(;;)if(this.isPunct(".")){this.next();let n=this.tok;n.kind!=="ident"&&this.fail(`Expected a property name after '.', found ${this.describe(n)}`),this.next(),e={k:"member",object:e,prop:n.value,optional:!1,loc:e.loc}}else if(this.isPunct("?."))if(this.next(),this.isPunct("("))e={k:"call",callee:e,args:this.parseArgs(),optional:!0,memo:!1,loc:e.loc};else if(this.isPunct("[")){this.next();let n=this.parseExpr();this.expect("]"),e={k:"index",object:e,index:n,optional:!0,loc:e.loc}}else{let n=this.expectIdent("a property name");e={k:"member",object:e,prop:n.value,optional:!0,loc:e.loc}}else if(this.isPunct("(")&&this.sameLine()){let n=!1,i=e;i.k==="id"&&i.name.startsWith("$")&&i.name.length>1&&i.name!=="$slot"&&(n=!0,i={...i,name:i.name.slice(1)}),e={k:"call",callee:i,args:this.parseArgs(),optional:!1,memo:n,loc:e.loc}}else if(this.isPunct("[")&&this.sameLine()){this.next();let n=this.parseExpr();this.expect("]"),e={k:"index",object:e,index:n,optional:!1,loc:e.loc}}else if(this.tok.kind==="template"&&this.tok.quote==="`"&&this.adjacent())this.fail("Tagged templates are not supported");else return e}parsePrimary(){let e=this.tok;switch(e.kind){case"number":return this.next(),{k:"lit",value:Number(e.value),loc:e.loc};case"string":return this.next(),{k:"lit",value:e.value,loc:e.loc};case"template":return this.next(),this.parseTemplate(e);case"ident":return this.next(),e.value==="true"||e.value==="false"?{k:"lit",value:e.value==="true",loc:e.loc}:e.value==="null"||e.value==="undefined"?{k:"lit",value:null,loc:e.loc}:{k:"id",name:e.value,loc:e.loc};case"punct":if(e.value==="("){this.next();let n=this.parseExpr();return this.expect(")","to close the parenthesized expression"),n}if(e.value==="[")return this.parseArray();if(e.value==="{")return this.parseObject();break;default:break}return this.fail(`Expected an expression, found ${this.describe(e)}`)}parseArray(){let e=this.next(),n=[];for(;!this.isPunct("]")&&this.tok.kind!=="eof";){let i=this.eat("...");if(n.push({value:this.parseExpr(),spread:i}),!this.eat(",")&&!this.tok.newlineBefore)break}return this.expect("]","to close the array"),{k:"array",items:n,loc:e.loc}}parseObject(){let e=this.next(),n=[];for(;!this.isPunct("}")&&this.tok.kind!=="eof";){let i=this.tok.loc;if(this.eat("..."))n.push({key:"",value:this.parseExpr(),spread:!0,loc:i});else if(this.isPunct("[")){this.next();let s=this.parseExpr();this.expect("]"),this.expect(":"),n.push({key:"",computedKey:s,value:this.parseExpr(),spread:!1,loc:i})}else{let s=this.tok;s.kind!=="ident"&&s.kind!=="string"&&s.kind!=="number"&&this.fail(`Expected an object key, found ${this.describe(s)}`),this.next();let r=s.value;for(;s.kind==="ident"&&this.isPunct("-")&&this.adjacent()&&this.peek(1).kind==="ident";)this.next(),r+="-"+this.next().value;this.eat(":")?n.push({key:r,value:this.parseExpr(),spread:!1,loc:i}):s.kind==="ident"?n.push({key:r,value:{k:"id",name:r,loc:s.loc},spread:!1,loc:i}):this.fail("Expected ':' after object key")}if(!this.eat(",")&&!this.eat(";")&&!this.tok.newlineBefore)break}return this.expect("}","to close the object"),{k:"object",props:n,loc:e.loc}}parseTemplate(e){let n=[],i=e.value,s="",r=0;for(;r<i.length;){let a=i[r];if(a==="\\"&&(i[r+1]==="{"||i[r+1]==="}")){s+=i[r+1],r+=2;continue}if(a==="{"){let o=1,c=r+1,h="";for(;c<i.length;c++){let d=i[c];if(h){d==="\\"?c++:d===h&&(h="");continue}if(d==='"'||d==="'")h=d;else if(d==="{")o++;else if(d==="}"&&--o===0)break}o!==0&&this.fail("Unmatched '{' in formatted string",e,"Escape literal braces as \\{ and \\}");let u=i.slice(r+1,c);s&&n.push(s),s="";let f=t.fromTokens(ge(u,this.file,{...e.loc,col:e.loc.col+2+r}),this.file),x=f.parseExpr();f.tok.kind!=="eof"&&f.fail(`Unexpected ${f.describe(f.tok)} inside formatted string`),n.push(x),r=c+1;continue}s+=a,r++}return s&&n.push(s),n.every(a=>typeof a=="string")?{k:"lit",value:n.join(""),loc:e.loc}:{k:"tpl",parts:n,loc:e.loc}}};function xi(){return{vars:[],functions:[],styles:[],scripts:[],lifecycle:[],watchers:[]}}function Kt(t){if(t.k==="assign"||t.k==="update"||t.k==="unary"&&t.op==="await")return!0;if(t.k==="call"){let e=Gt(t.callee);return e==="console"||e==="alert"||e==="localStorage"||e==="sessionStorage"||e==="history"}return!1}function Gt(t){if(t.k==="id")return t.name;if(t.k==="member")return Gt(t.object)}function bi(t){let e=t.split(/[?#]/)[0].toLowerCase();return/\.(css|scss|sass)$/.test(e)?"style":e.endsWith(".sinth")?"sinth":e.endsWith(".json")?"json":/^https?:\/\//.test(e)||e.startsWith("//")?"script":/\.(m?js|ts|mts|jsx|tsx)$/.test(e)?"module":e.startsWith("sinth:")||e.startsWith(".")||e.startsWith("/")?"sinth":"module"}function Jt(t,e){return new ye(t,e).parseFile()}var yi=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,7,9,32,4,318,1,31,4,33,15,71,10,50,3,123,2,54,14,32,10,3,1,11,3,46,10,8,0,46,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,3,0,158,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,68,8,2,0,3,0,2,3,2,4,2,0,15,1,83,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,7,19,58,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,199,7,137,9,54,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,55,9,7,0,259,3,10,1,2,0,49,6,4,4,14,10,5350,0,7,14,11465,27,2343,9,87,9,39,4,60,6,26,9,535,9,470,0,2,54,8,3,82,0,12,1,19628,1,4178,9,519,45,3,22,481,1,61,4,4,5,9,7,3,6,31,3,149,2,12,2,9,1,3,0,33,1,1357,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,101,0,161,6,10,9,357,0,62,13,499,13,245,1,2,9,233,0,3,0,8,1,6,0,475,6,110,6,6,9,4759,9,787719,239],tn=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,4,51,13,310,10,21,11,7,25,5,2,41,2,13,65,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,7,25,39,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,39,27,10,22,251,41,7,1,17,5,18,21,18,28,11,0,9,21,43,17,47,20,28,22,13,52,58,1,3,0,14,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,20,1,64,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,31,9,2,0,3,0,2,37,2,0,26,0,2,0,45,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,38,6,186,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,19,72,18,0,182,32,32,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,24,43,22,0,239,18,16,0,2,12,2,33,125,0,80,921,103,111,6,206,13,310,2314,96,16,1071,18,5,26,3994,6,582,6842,29,1763,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,433,44,212,63,33,24,3,24,45,74,6,0,67,12,65,1,2,0,15,4,10,7386,37,33,96,114,14,913,15,50,7710,3,2,6,2,1,2,296,10,0,30,2,3,0,15,4,8,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,340,2,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,1845,129,15,6,55,50,49,61,147,44,11,6,17,0,322,29,19,43,485,27,229,29,3,0,208,30,2,2,2,1,2,6,3,4,10,1,225,6,2,3,2,1,2,14,2,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42719,33,4382,2,5773,3,7472,16,621,2467,541,1507,4938,6,8489,39815,11327],ki="\u200C\u200D\xB7\u0300-\u036F\u0387\u0483-\u0487\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7-\u05C9\u0610-\u061A\u064B-\u0669\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u06F0-\u06F9\u0711\u0730-\u074A\u07A6-\u07B0\u07C0-\u07C9\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0897-\u089F\u08CA-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0966-\u096F\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09E6-\u09EF\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A66-\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AE6-\u0AEF\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B53-\u0B57\u0B62\u0B63\u0B66-\u0B6F\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0BE6-\u0BEF\u0C00-\u0C04\u0C3C\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0CE6-\u0CEF\u0CF3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D66-\u0D6F\u0D81-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0E50-\u0E59\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECE\u0ED0-\u0ED9\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1040-\u1049\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F-\u109D\u135D-\u135F\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u17E0-\u17E9\u180B-\u180D\u180F-\u1819\u18A9\u1920-\u192B\u1930-\u193B\u1946-\u194F\u19D0-\u19DA\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AB0-\u1ABD\u1ABF-\u1AF0\u1B00-\u1B04\u1B34-\u1B44\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BB0-\u1BB9\u1BE6-\u1BF3\u1C24-\u1C37\u1C40-\u1C49\u1C50-\u1C59\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DFF\u200C\u200D\u203F\u2040\u2054\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\u30FB\uA620-\uA629\uA66F\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA82C\uA880\uA881\uA8B4-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F1\uA8FF-\uA909\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9D0-\uA9D9\uA9E5\uA9F0-\uA9F9\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA50-\uAA59\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uABF0-\uABF9\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFF10-\uFF19\uFF3F\uFF65",nn="\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0558\u0559\u0560-\u0588\u058B\u058C\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088F\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5C\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDC-\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C8A\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u208F-\u209F\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7DD\uA7E2\uA7F1-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB6C\uAB6D\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC",ot={3:"abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile",5:"class enum extends super const export import",6:"enum",strict:"implements interface let package private protected public static yield",strictBind:"eval arguments"},lt="break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this",wi={5:lt,"5module":lt+" export import",6:lt+" const class extends export import super"},sn=/^in(stanceof)?$/,Si=new RegExp("["+nn+"]"),Ci=new RegExp("["+nn+ki+"]");function ut(t,e){for(var n=65536,i=0;i<e.length;i+=2){if(n+=e[i],n>t)return!1;if(n+=e[i+1],n>=t)return!0}return!1}function ae(t,e){return t<65?t===36:t<91?!0:t<97?t===95:t<123?!0:t<=65535?t>=170&&Si.test(String.fromCharCode(t)):e===!1?!1:ut(t,tn)}function ue(t,e){return t<48?t===36:t<58?!0:t<65?!1:t<91?!0:t<97?t===95:t<123?!0:t<=65535?t>=170&&Ci.test(String.fromCharCode(t)):e===!1?!1:ut(t,tn)||ut(t,yi)}var I=function(e,n){n===void 0&&(n={}),this.label=e,this.keyword=n.keyword,this.beforeExpr=!!n.beforeExpr,this.startsExpr=!!n.startsExpr,this.isLoop=!!n.isLoop,this.isAssign=!!n.isAssign,this.prefix=!!n.prefix,this.postfix=!!n.postfix,this.binop=n.binop||null,this.updateContext=null};function Z(t,e){return new I(t,{beforeExpr:!0,binop:e})}var Q={beforeExpr:!0},W={startsExpr:!0},dt={};function $(t,e){return e===void 0&&(e={}),e.keyword=t,dt[t]=new I(t,e)}var l={num:new I("num",W),regexp:new I("regexp",W),string:new I("string",W),name:new I("name",W),privateId:new I("privateId",W),eof:new I("eof"),bracketL:new I("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new I("]"),braceL:new I("{",{beforeExpr:!0,startsExpr:!0}),braceR:new I("}"),parenL:new I("(",{beforeExpr:!0,startsExpr:!0}),parenR:new I(")"),comma:new I(",",Q),semi:new I(";",Q),colon:new I(":",Q),dot:new I("."),question:new I("?",Q),questionDot:new I("?."),arrow:new I("=>",Q),template:new I("template"),invalidTemplate:new I("invalidTemplate"),ellipsis:new I("...",Q),backQuote:new I("`",W),dollarBraceL:new I("${",{beforeExpr:!0,startsExpr:!0}),eq:new I("=",{beforeExpr:!0,isAssign:!0}),assign:new I("_=",{beforeExpr:!0,isAssign:!0}),incDec:new I("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new I("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:Z("||",1),logicalAND:Z("&&",2),bitwiseOR:Z("|",3),bitwiseXOR:Z("^",4),bitwiseAND:Z("&",5),equality:Z("==/!=/===/!==",6),relational:Z("</>/<=/>=",7),bitShift:Z("<</>>/>>>",8),plusMin:new I("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:Z("%",10),star:Z("*",10),slash:Z("/",10),starstar:new I("**",{beforeExpr:!0}),coalesce:Z("??",1),_break:$("break"),_case:$("case",Q),_catch:$("catch"),_continue:$("continue"),_debugger:$("debugger"),_default:$("default",Q),_do:$("do",{isLoop:!0,beforeExpr:!0}),_else:$("else",Q),_finally:$("finally"),_for:$("for",{isLoop:!0}),_function:$("function",W),_if:$("if"),_return:$("return",Q),_switch:$("switch"),_throw:$("throw",Q),_try:$("try"),_var:$("var"),_const:$("const"),_while:$("while",{isLoop:!0}),_with:$("with"),_new:$("new",{beforeExpr:!0,startsExpr:!0}),_this:$("this",W),_super:$("super",W),_class:$("class",W),_extends:$("extends",Q),_export:$("export"),_import:$("import",W),_null:$("null",W),_true:$("true",W),_false:$("false",W),_in:$("in",{beforeExpr:!0,binop:7}),_instanceof:$("instanceof",{beforeExpr:!0,binop:7}),_typeof:$("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:$("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:$("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},z=/\r\n?|\n|\u2028|\u2029/,Ei=new RegExp(z.source,"g");function $e(t){return t===10||t===13||t===8232||t===8233}function rn(t,e,n){n===void 0&&(n=t.length);for(var i=e;i<n;i++){var s=t.charCodeAt(i);if($e(s))return i<n-1&&s===13&&t.charCodeAt(i+1)===10?i+2:i+1}return-1}var an=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,M=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,on=Object.prototype,_i=on.hasOwnProperty,$i=on.toString,Ie=Object.hasOwn||(function(t,e){return _i.call(t,e)}),Zt=Array.isArray||(function(t){return $i.call(t)==="[object Array]"}),Qt=Object.create(null);function ve(t){return Qt[t]||(Qt[t]=new RegExp("^(?:"+t.replace(/ /g,"|")+")$"))}function he(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode((t>>10)+55296,(t&1023)+56320))}var Ii=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,Le=function(e,n){this.line=e,this.column=n};Le.prototype.offset=function(e){return new Le(this.line,this.column+e)};var Je=function(e,n,i){this.start=n,this.end=i,e.sourceFile!==null&&(this.source=e.sourceFile)};function ln(t,e){for(var n=1,i=0;;){var s=rn(t,i,e);if(s<0)return new Le(n,e-i);++n,i=s}}var ht={ecmaVersion:null,sourceType:"script",strict:!1,onInsertedSemicolon:null,onTrailingComma:null,allowReserved:null,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowAwaitOutsideFunction:null,allowSuperOutsideMethod:null,allowHashBang:!1,checkPrivateFields:!0,locations:!1,startLocation:null,onToken:null,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null,preserveParens:!1},Yt=!1;function Ai(t){var e={};for(var n in ht)e[n]=t&&Ie(t,n)?t[n]:ht[n];if(e.ecmaVersion==="latest"?e.ecmaVersion=1e8:e.ecmaVersion==null?(!Yt&&typeof console=="object"&&console.warn&&(Yt=!0,console.warn(`Since Acorn 8.0.0, options.ecmaVersion is required.
|
|
13
|
-
Defaulting to 2020, but this will stop working in the future.`)),e.ecmaVersion=11):e.ecmaVersion>=2015&&(e.ecmaVersion-=2009),e.allowReserved==null&&(e.allowReserved=e.ecmaVersion<5),(!t||t.allowHashBang==null)&&(e.allowHashBang=e.ecmaVersion>=14),Zt(e.onToken)){var i=e.onToken;e.onToken=function(s){return i.push(s)}}if(Zt(e.onComment)&&(e.onComment=
|
|
14
|
-
`,i-1)+1,this.options.locations&&(this.curLine=this.input.slice(0,this.lineStart).split(z).length)):this.lineStart=0,this.type=l.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=this.initialContext(),this.exprAllowed=!0,this.inModule=e.sourceType==="module",this.strict=this.inModule||e.strict===!0||this.strictDirective(this.pos),this.potentialArrowAt=-1,this.potentialArrowInForAwait=!1,this.yieldPos=this.awaitPos=this.awaitIdentPos=0,this.labels=[],this.undefinedExports=Object.create(null),this.pos===0&&e.allowHashBang&&this.input.slice(0,2)==="#!"&&this.skipLineComment(2),this.scopeStack=[],this.enterScope(this.options.sourceType==="commonjs"?we:ke),this.regexpState=null,this.privateNameStack=[]},X={inFunction:{configurable:!0},inGenerator:{configurable:!0},inAsync:{configurable:!0},canAwait:{configurable:!0},allowReturn:{configurable:!0},allowSuper:{configurable:!0},allowDirectSuper:{configurable:!0},treatFunctionsAsVar:{configurable:!0},allowNewDotTarget:{configurable:!0},allowUsing:{configurable:!0},inClassStaticBlock:{configurable:!0}};j.prototype.parse=function(){var e=this,n=this.options.program||this.startNode();return this.nextToken(),this.catchStackOverflow(function(){return e.parseTopLevel(n)})};X.inFunction.get=function(){return(this.currentVarScope().flags&we)>0};X.inGenerator.get=function(){return(this.currentVarScope().flags&cn)>0};X.inAsync.get=function(){return(this.currentVarScope().flags&mt)>0};X.canAwait.get=function(){for(var t=this.scopeStack.length-1;t>=0;t--){var e=this.scopeStack[t],n=e.flags;if(n&(Se|Re))return!1;if(n&we)return(n&mt)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction};X.allowReturn.get=function(){return!!(this.inFunction||this.options.allowReturnOutsideFunction&&this.currentVarScope().flags&ke)};X.allowSuper.get=function(){var t=this.currentThisScope(),e=t.flags;return(e&Ze)>0||this.options.allowSuperOutsideMethod};X.allowDirectSuper.get=function(){return(this.currentThisScope().flags&hn)>0};X.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())};X.allowNewDotTarget.get=function(){for(var t=this.scopeStack.length-1;t>=0;t--){var e=this.scopeStack[t],n=e.flags;if(n&(Se|Re)||n&we&&!(n>))return!0}return!1};X.allowUsing.get=function(){var t=this.currentScope(),e=t.flags;return!(e&pn||!this.inModule&&e&ke)};X.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&Se)>0};j.extend=function(){for(var e=[],n=arguments.length;n--;)e[n]=arguments[n];for(var i=this,s=0;s<e.length;s++)i=e[s](i);return i};j.parse=function(e,n){return new this(n,e).parse()};j.parseExpressionAt=function(e,n,i){var s=new this(i,e,n);return s.nextToken(),s.parseExpression()};j.tokenizer=function(e,n){return new this(n,e)};Object.defineProperties(j.prototype,X);var U=j.prototype,Pi=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;U.strictDirective=function(t){if(this.options.ecmaVersion<5)return!1;for(;;){M.lastIndex=t,t+=M.exec(this.input)[0].length;var e=Pi.exec(this.input.slice(t));if(!e)return!1;if((e[1]||e[2])==="use strict"){M.lastIndex=t+e[0].length;var n=M.exec(this.input),i=n.index+n[0].length,s=this.input.charAt(i);return s===";"||s==="}"||z.test(n[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(s)||s==="!"&&this.input.charAt(i+1)==="="||s==="i"&&Ti(this,i))}t+=e[0].length,M.lastIndex=t,t+=M.exec(this.input)[0].length,this.input[t]===";"&&t++}};function Ti(t,e){for(var n=e+1,i=Math.min(t.input.length,e+11);n<i;){var s=t.fullCharCodeAt(n);if(!ue(s,!0))break;n+=s<=65535?1:2}return n===e+2&&t.input.slice(e,n)==="in"||n===e+10&&t.input.slice(e,n)==="instanceof"}U.eat=function(t){return this.type===t?(this.next(),!0):!1};U.isContextual=function(t){return this.type===l.name&&this.value===t&&!this.containsEsc};U.eatContextual=function(t){return this.isContextual(t)?(this.next(),!0):!1};U.catchStackOverflow=function(t){try{return t()}catch(e){if(e instanceof Error&&(/\bstack\b.*\b(exceeded|overflow)\b/i.test(e.message)||/\btoo much recursion\b/i.test(e.message)))this.raise(this.start,"Not enough stack space to parse input");else throw e}};U.expectContextual=function(t){this.eatContextual(t)||this.unexpected()};U.canInsertSemicolon=function(){return this.type===l.eof||this.type===l.braceR||z.test(this.input.slice(this.lastTokEnd,this.start))};U.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0};U.semicolon=function(){!this.eat(l.semi)&&!this.insertSemicolon()&&this.unexpected()};U.afterTrailingComma=function(t,e){if(this.type===t)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),e||this.next(),!0};U.expect=function(t){this.eat(t)||this.unexpected()};U.unexpected=function(t){this.raise(t??this.start,"Unexpected token")};var Ye=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};U.checkPatternErrors=function(t,e){if(t){t.trailingComma>-1&&this.raiseRecoverable(t.trailingComma,"Comma is not permitted after the rest element");var n=e?t.parenthesizedAssign:t.parenthesizedBind;n>-1&&this.raiseRecoverable(n,e?"Assigning to rvalue":"Parenthesized pattern")}};U.checkExpressionErrors=function(t,e){if(!t)return!1;var n=t.shorthandAssign,i=t.doubleProto;if(!e)return n>=0||i>=0;n>=0&&this.raise(n,"Shorthand property assignments are valid only in destructuring patterns"),i>=0&&this.raiseRecoverable(i,"Redefinition of __proto__ property")};U.checkYieldAwaitInDefaultParams=function(){this.yieldPos&&(!this.awaitPos||this.yieldPos<this.awaitPos)&&this.raise(this.yieldPos,"Yield expression cannot be a default value"),this.awaitPos&&this.raise(this.awaitPos,"Await expression cannot be a default value")};U.isSimpleAssignTarget=function(t){return t.type==="ParenthesizedExpression"?this.isSimpleAssignTarget(t.expression):t.type==="Identifier"||t.type==="MemberExpression"};var y=j.prototype;y.parseTopLevel=function(t){var e=Object.create(null);for(t.body||(t.body=[]);this.type!==l.eof;){var n=this.parseStatement(null,!0,e);t.body.push(n)}if(this.inModule)for(var i=0,s=Object.keys(this.undefinedExports);i<s.length;i+=1){var r=s[i];this.raiseRecoverable(this.undefinedExports[r].start,"Export '"+r+"' is not defined")}return this.adaptDirectivePrologue(t.body),this.next(),t.sourceType=this.options.sourceType==="commonjs"?"script":this.options.sourceType,this.finishNode(t,"Program")};var bt={kind:"loop"},Li={kind:"switch"};y.isLet=function(t){if(this.options.ecmaVersion<6||!this.isContextual("let"))return!1;M.lastIndex=this.pos;var e=M.exec(this.input),n=this.pos+e[0].length,i=this.fullCharCodeAt(n);if(i===91||i===92)return!0;if(t)return!1;if(i===123)return!0;if(ae(i)){var s=n;do n+=i<=65535?1:2;while(ue(i=this.fullCharCodeAt(n)));if(i===92)return!0;var r=this.input.slice(s,n);if(!sn.test(r))return!0}return!1};y.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;M.lastIndex=this.pos;var t=M.exec(this.input),e=this.pos+t[0].length,n;return!z.test(this.input.slice(this.pos,e))&&this.input.slice(e,e+8)==="function"&&(e+8===this.input.length||!(ue(n=this.fullCharCodeAt(e+8))||n===92))};y.isUsingKeyword=function(t,e){if(this.options.ecmaVersion<17||!this.isContextual(t?"await":"using"))return!1;M.lastIndex=this.pos;var n=M.exec(this.input),i=this.pos+n[0].length;if(z.test(this.input.slice(this.pos,i)))return!1;if(t){var s=i+5,r;if(this.input.slice(i,s)!=="using"||s===this.input.length||ue(r=this.fullCharCodeAt(s))||r===92)return!1;M.lastIndex=s;var a=M.exec(this.input);if(i=s+a[0].length,a&&z.test(this.input.slice(s,i)))return!1}var o=this.fullCharCodeAt(i);if(!ae(o)&&o!==92)return!1;var c=i;do i+=o<=65535?1:2;while(ue(o=this.fullCharCodeAt(i)));if(o===92)return!0;var h=this.input.slice(c,i);if(sn.test(h))return!1;if(e&&!t&&h==="of"){M.lastIndex=i;var u=M.exec(this.input);if(i=i+u[0].length,this.input.charCodeAt(i)!==61||(o=this.input.charCodeAt(i+1))===61||o===62)return!1}return!0};y.isAwaitUsing=function(t){return this.isUsingKeyword(!0,t)};y.isUsing=function(t){return this.isUsingKeyword(!1,t)};y.parseStatement=function(t,e,n){var i=this.type,s=this.startNode(),r;switch(this.isLet(t)&&(i=l._var,r="let"),i){case l._break:case l._continue:return this.parseBreakContinueStatement(s,i.keyword);case l._debugger:return this.parseDebuggerStatement(s);case l._do:return this.parseDoStatement(s);case l._for:return this.parseForStatement(s);case l._function:return t&&(this.strict||t!=="if"&&t!=="label")&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(s,!1,!t);case l._class:return t&&this.unexpected(),this.parseClass(s,!0);case l._if:return this.parseIfStatement(s);case l._return:return this.parseReturnStatement(s);case l._switch:return this.parseSwitchStatement(s);case l._throw:return this.parseThrowStatement(s);case l._try:return this.parseTryStatement(s);case l._const:case l._var:return r=r||this.value,t&&r!=="var"&&this.unexpected(),this.parseVarStatement(s,r);case l._while:return this.parseWhileStatement(s);case l._with:return this.parseWithStatement(s);case l.braceL:return this.parseBlock(!0,s);case l.semi:return this.parseEmptyStatement(s);case l._export:case l._import:if(this.options.ecmaVersion>10&&i===l._import){M.lastIndex=this.pos;var a=M.exec(this.input),o=this.pos+a[0].length,c=this.input.charCodeAt(o);if(c===40||c===46)return this.parseExpressionStatement(s,this.parseExpression())}return this.options.allowImportExportEverywhere||(e||this.raise(this.start,"'import' and 'export' may only appear at the top level"),this.inModule||this.raise(this.start,"'import' and 'export' may appear only with 'sourceType: module'")),i===l._import?this.parseImport(s):this.parseExport(s,n);default:if(this.isAsyncFunction())return t&&this.unexpected(),this.next(),this.parseFunctionStatement(s,!0,!t);var h=this.isAwaitUsing(!1)?"await using":this.isUsing(!1)?"using":null;if(h)return this.allowUsing||this.raise(this.start,"Using declaration cannot appear in the top level when source type is `script` or in the bare case statement"),t&&this.raise(this.start,"Using declaration is not allowed in single-statement positions"),h==="await using"&&(this.canAwait||this.raise(this.start,"Await using cannot appear outside of async function"),this.next()),this.next(),this.parseVar(s,!1,h),this.semicolon(),this.finishNode(s,"VariableDeclaration");var u=this.value,f=this.parseExpression();return i===l.name&&f.type==="Identifier"&&this.eat(l.colon)?this.parseLabeledStatement(s,u,f,t):this.parseExpressionStatement(s,f)}};y.parseBreakContinueStatement=function(t,e){var n=e==="break";this.next(),this.eat(l.semi)||this.insertSemicolon()?t.label=null:this.type!==l.name?this.unexpected():(t.label=this.parseIdent(),this.semicolon());for(var i=0;i<this.labels.length;++i){var s=this.labels[i];if((t.label==null||s.name===t.label.name)&&(s.kind!=null&&(n||s.kind==="loop")||t.label&&n))break}return i===this.labels.length&&this.raise(t.start,"Unsyntactic "+e),this.finishNode(t,n?"BreakStatement":"ContinueStatement")};y.parseDebuggerStatement=function(t){return this.next(),this.semicolon(),this.finishNode(t,"DebuggerStatement")};y.parseDoStatement=function(t){return this.next(),this.labels.push(bt),t.body=this.parseStatement("do"),this.labels.pop(),this.expect(l._while),t.test=this.parseParenExpression(),this.options.ecmaVersion>=6?this.eat(l.semi):this.semicolon(),this.finishNode(t,"DoWhileStatement")};y.parseForStatement=function(t){this.next();var e=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(bt),this.enterScope(0),this.expect(l.parenL),this.type===l.semi)return e>-1&&this.unexpected(e),this.parseFor(t,null);var n=this.isLet();if(this.type===l._var||this.type===l._const||n){var i=this.startNode(),s=n?"let":this.value;return this.next(),this.parseVar(i,!0,s),this.finishNode(i,"VariableDeclaration"),this.parseForAfterInit(t,i,e)}var r=this.isContextual("let"),a=!1,o=this.isUsing(!0)?"using":this.isAwaitUsing(!0)?"await using":null;if(o){var c=this.startNode();return this.next(),o==="await using"&&(this.canAwait||this.raise(this.start,"Await using cannot appear outside of async function"),this.next()),this.parseVar(c,!0,o),this.finishNode(c,"VariableDeclaration"),this.parseForAfterInit(t,c,e)}var h=this.containsEsc,u=new Ye,f=this.start,x=e>-1?this.parseExprSubscripts(u,"await"):this.parseExpression(!0,u);return this.type===l._in||(a=this.options.ecmaVersion>=6&&this.isContextual("of"))?(e>-1?(this.type===l._in&&this.unexpected(e),t.await=!0):a&&this.options.ecmaVersion>=8&&(x.start===f&&!h&&x.type==="Identifier"&&x.name==="async"?this.unexpected():this.options.ecmaVersion>=9&&(t.await=!1)),r&&a&&this.raise(x.start,"The left-hand side of a for-of loop may not start with 'let'."),this.toAssignable(x,!1,u),this.checkLValPattern(x),this.parseForIn(t,x)):(this.checkExpressionErrors(u,!0),e>-1&&this.unexpected(e),this.parseFor(t,x))};y.parseForAfterInit=function(t,e,n){return(this.type===l._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&e.declarations.length===1?(this.type===l._in?((e.kind==="using"||e.kind==="await using")&&!e.declarations[0].init&&this.raise(this.start,"Using declaration is not allowed in for-in loops"),this.options.ecmaVersion>=9&&n>-1&&this.unexpected(n)):this.options.ecmaVersion>=9&&(t.await=n>-1),this.parseForIn(t,e)):(n>-1&&this.unexpected(n),this.parseFor(t,e))};y.parseFunctionStatement=function(t,e,n){return this.next(),this.parseFunction(t,Te|(n?0:pt),!1,e)};y.parseIfStatement=function(t){return this.next(),t.test=this.parseParenExpression(),t.consequent=this.parseStatement("if"),t.alternate=this.eat(l._else)?this.parseStatement("if"):null,this.finishNode(t,"IfStatement")};y.parseReturnStatement=function(t){return this.allowReturn||this.raise(this.start,"'return' outside of function"),this.next(),this.eat(l.semi)||this.insertSemicolon()?t.argument=null:(t.argument=this.parseExpression(),this.semicolon()),this.finishNode(t,"ReturnStatement")};y.parseSwitchStatement=function(t){this.next(),t.discriminant=this.parseParenExpression(),t.cases=[],this.expect(l.braceL),this.labels.push(Li),this.enterScope(pn);for(var e,n=!1;this.type!==l.braceR;)if(this.type===l._case||this.type===l._default){var i=this.type===l._case;e&&this.finishNode(e,"SwitchCase"),t.cases.push(e=this.startNode()),e.consequent=[],this.next(),i?e.test=this.parseExpression():(n&&this.raiseRecoverable(this.lastTokStart,"Multiple default clauses"),n=!0,e.test=null),this.expect(l.colon)}else e||this.unexpected(),e.consequent.push(this.parseStatement(null));return this.exitScope(),e&&this.finishNode(e,"SwitchCase"),this.next(),this.labels.pop(),this.finishNode(t,"SwitchStatement")};y.parseThrowStatement=function(t){return this.next(),z.test(this.input.slice(this.lastTokEnd,this.start))&&this.raise(this.lastTokEnd,"Illegal newline after throw"),t.argument=this.parseExpression(),this.semicolon(),this.finishNode(t,"ThrowStatement")};var Ri=[];y.parseCatchClauseParam=function(){var t=this.parseBindingAtom(),e=t.type==="Identifier";return this.enterScope(e?un:0),this.checkLValPattern(t,e?dn:fe),this.expect(l.parenR),t};y.parseTryStatement=function(t){if(this.next(),t.block=this.parseBlock(),t.handler=null,this.type===l._catch){var e=this.startNode();this.next(),this.eat(l.parenL)?e.param=this.parseCatchClauseParam():(this.options.ecmaVersion<10&&this.unexpected(),e.param=null,this.enterScope(0)),e.body=this.parseBlock(!1),this.exitScope(),t.handler=this.finishNode(e,"CatchClause")}return t.finalizer=this.eat(l._finally)?this.parseBlock():null,!t.handler&&!t.finalizer&&this.raise(t.start,"Missing catch or finally clause"),this.finishNode(t,"TryStatement")};y.parseVarStatement=function(t,e,n){return this.next(),this.parseVar(t,!1,e,n),this.semicolon(),this.finishNode(t,"VariableDeclaration")};y.parseWhileStatement=function(t){return this.next(),t.test=this.parseParenExpression(),this.labels.push(bt),t.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(t,"WhileStatement")};y.parseWithStatement=function(t){return this.strict&&this.raise(this.start,"'with' in strict mode"),this.next(),t.object=this.parseParenExpression(),t.body=this.parseStatement("with"),this.finishNode(t,"WithStatement")};y.parseEmptyStatement=function(t){return this.next(),this.finishNode(t,"EmptyStatement")};y.parseLabeledStatement=function(t,e,n,i){for(var s=0,r=this.labels;s<r.length;s+=1){var a=r[s];a.name===e&&this.raise(n.start,"Label '"+e+"' is already declared")}for(var o=this.type.isLoop?"loop":this.type===l._switch?"switch":null,c=this.labels.length-1;c>=0;c--){var h=this.labels[c];if(h.statementStart===t.start)h.statementStart=this.start,h.kind=o;else break}return this.labels.push({name:e,kind:o,statementStart:this.start}),t.body=this.parseStatement(i?i.indexOf("label")===-1?i+"label":i:"label"),this.labels.pop(),t.label=n,this.finishNode(t,"LabeledStatement")};y.parseExpressionStatement=function(t,e){return t.expression=e,this.semicolon(),this.finishNode(t,"ExpressionStatement")};y.parseBlock=function(t,e,n){for(t===void 0&&(t=!0),e===void 0&&(e=this.startNode()),e.body=[],this.expect(l.braceL),t&&this.enterScope(0);this.type!==l.braceR;){var i=this.parseStatement(null);e.body.push(i)}return n&&(this.strict=!1),this.next(),t&&this.exitScope(),this.finishNode(e,"BlockStatement")};y.parseFor=function(t,e){return t.init=e,this.expect(l.semi),t.test=this.type===l.semi?null:this.parseExpression(),this.expect(l.semi),t.update=this.type===l.parenR?null:this.parseExpression(),this.expect(l.parenR),t.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(t,"ForStatement")};y.parseForIn=function(t,e){var n=this.type===l._in;return this.next(),e.type==="VariableDeclaration"&&e.declarations[0].init!=null&&(!n||this.options.ecmaVersion<8||this.strict||e.kind!=="var"||e.declarations[0].id.type!=="Identifier")&&this.raise(e.start,(n?"for-in":"for-of")+" loop variable declaration may not have an initializer"),t.left=e,t.right=n?this.parseExpression():this.parseMaybeAssign(),this.expect(l.parenR),t.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(t,n?"ForInStatement":"ForOfStatement")};y.parseVar=function(t,e,n,i){for(t.declarations=[],t.kind=n;;){var s=this.startNode();if(this.parseVarId(s,n),this.eat(l.eq)?s.init=this.parseMaybeAssign(e):!i&&n==="const"&&!(this.type===l._in||this.options.ecmaVersion>=6&&this.isContextual("of"))?this.unexpected():!i&&(n==="using"||n==="await using")&&this.options.ecmaVersion>=17&&this.type!==l._in&&!this.isContextual("of")?this.raise(this.lastTokEnd,"Missing initializer in "+n+" declaration"):!i&&s.id.type!=="Identifier"&&!(e&&(this.type===l._in||this.isContextual("of")))?this.raise(this.lastTokEnd,"Complex binding patterns require an initialization value"):s.init=null,t.declarations.push(this.finishNode(s,"VariableDeclarator")),!this.eat(l.comma))break}return t};y.parseVarId=function(t,e){t.id=e==="using"||e==="await using"?this.parseIdent():this.parseBindingAtom(),this.checkLValPattern(t.id,e==="var"?xt:fe,!1)};var Te=1,pt=2,gn=4;y.parseFunction=function(t,e,n,i,s){this.initFunction(t),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!i)&&(this.type===l.star&&e&pt&&this.unexpected(),t.generator=this.eat(l.star)),this.options.ecmaVersion>=8&&(t.async=!!i),e&Te&&(t.id=e&gn&&this.type!==l.name?null:this.parseIdent(),t.id&&!(e&pt)&&this.checkLValSimple(t.id,this.strict||t.generator||t.async?this.treatFunctionsAsVar?xt:fe:fn));var r=this.yieldPos,a=this.awaitPos,o=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(vt(t.async,t.generator)),e&Te||(t.id=this.type===l.name?this.parseIdent():null),this.parseFunctionParams(t),this.parseFunctionBody(t,n,!1,s),this.yieldPos=r,this.awaitPos=a,this.awaitIdentPos=o,this.finishNode(t,e&Te?"FunctionDeclaration":"FunctionExpression")};y.parseFunctionParams=function(t){this.expect(l.parenL),t.params=this.parseBindingList(l.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()};y.parseClass=function(t,e){this.next();var n=this.strict;this.strict=!0,this.parseClassId(t,e),this.parseClassSuper(t);var i=this.enterClassBody(),s=this.startNode(),r=!1;for(s.body=[],this.expect(l.braceL);this.type!==l.braceR;){var a=this.parseClassElement(t.superClass!==null);a&&(s.body.push(a),a.type==="MethodDefinition"&&a.kind==="constructor"?(r&&this.raiseRecoverable(a.start,"Duplicate constructor in the same class"),r=!0):a.key&&a.key.type==="PrivateIdentifier"&&Oi(i,a)&&this.raiseRecoverable(a.key.start,"Identifier '#"+a.key.name+"' has already been declared"))}return this.strict=n,this.next(),t.body=this.finishNode(s,"ClassBody"),this.exitClassBody(),this.finishNode(t,e?"ClassDeclaration":"ClassExpression")};y.parseClassElement=function(t){if(this.eat(l.semi))return null;var e=this.options.ecmaVersion,n=this.startNode(),i="",s=!1,r=!1,a="method",o=!1;if(this.eatContextual("static")){if(e>=13&&this.eat(l.braceL))return this.parseClassStaticBlock(n),n;this.isClassElementNameStart()||this.type===l.star?o=!0:i="static"}if(n.static=o,!i&&e>=8&&this.eatContextual("async")&&((this.isClassElementNameStart()||this.type===l.star)&&!this.canInsertSemicolon()?r=!0:i="async"),!i&&(e>=9||!r)&&this.eat(l.star)&&(s=!0),!i&&!r&&!s){var c=this.value;(this.eatContextual("get")||this.eatContextual("set"))&&(this.isClassElementNameStart()?a=c:i=c)}if(i?(n.computed=!1,n.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),n.key.name=i,this.finishNode(n.key,"Identifier")):this.parseClassElementName(n),e<13||this.type===l.parenL||a!=="method"||s||r){var h=!n.static&&qe(n,"constructor"),u=h&&t;h&&a!=="method"&&this.raise(n.key.start,"Constructor can't have get/set modifier"),n.kind=h?"constructor":a,this.parseClassMethod(n,s,r,u)}else this.parseClassField(n);return n};y.isClassElementNameStart=function(){return this.type===l.name||this.type===l.privateId||this.type===l.num||this.type===l.string||this.type===l.bracketL||this.type.keyword};y.parseClassElementName=function(t){this.type===l.privateId?(this.value==="constructor"&&this.raise(this.start,"Classes can't have an element named '#constructor'"),t.computed=!1,t.key=this.parsePrivateIdent()):this.parsePropertyName(t)};y.parseClassMethod=function(t,e,n,i){var s=t.key;t.kind==="constructor"?(e&&this.raise(s.start,"Constructor can't be a generator"),n&&this.raise(s.start,"Constructor can't be an async method")):t.static&&qe(t,"prototype")&&this.raise(s.start,"Classes may not have a static property named prototype");var r=t.value=this.parseMethod(e,n,i);return t.kind==="get"&&r.params.length!==0&&this.raiseRecoverable(r.start,"getter should have no params"),t.kind==="set"&&r.params.length!==1&&this.raiseRecoverable(r.start,"setter should have exactly one param"),t.kind==="set"&&r.params[0].type==="RestElement"&&this.raiseRecoverable(r.params[0].start,"Setter cannot use rest params"),this.finishNode(t,"MethodDefinition")};y.parseClassField=function(t){return qe(t,"constructor")?this.raise(t.key.start,"Classes can't have a field named 'constructor'"):t.static&&qe(t,"prototype")&&this.raise(t.key.start,"Classes can't have a static field named 'prototype'"),this.eat(l.eq)?(this.enterScope(Re|Ze),t.value=this.parseMaybeAssign(),this.exitScope()):t.value=null,this.semicolon(),this.finishNode(t,"PropertyDefinition")};y.parseClassStaticBlock=function(t){t.body=[];var e=this.labels;for(this.labels=[],this.enterScope(Se|Ze);this.type!==l.braceR;){var n=this.parseStatement(null);t.body.push(n)}return this.next(),this.exitScope(),this.labels=e,this.finishNode(t,"StaticBlock")};y.parseClassId=function(t,e){this.type===l.name?(t.id=this.parseIdent(),e&&this.checkLValSimple(t.id,fe,!1)):(e===!0&&this.unexpected(),t.id=null)};y.parseClassSuper=function(t){t.superClass=this.eat(l._extends)?this.parseExprSubscripts(null,!1):null};y.enterClassBody=function(){var t={declared:Object.create(null),used:[]};return this.privateNameStack.push(t),t.declared};y.exitClassBody=function(){var t=this.privateNameStack.pop(),e=t.declared,n=t.used;if(this.options.checkPrivateFields)for(var i=this.privateNameStack.length,s=i===0?null:this.privateNameStack[i-1],r=0;r<n.length;++r){var a=n[r];Ie(e,a.name)||(s?s.used.push(a):this.raiseRecoverable(a.start,"Private field '#"+a.name+"' must be declared in an enclosing class"))}};function Oi(t,e){var n=e.key.name,i=t[n],s="true";return e.type==="MethodDefinition"&&(e.kind==="get"||e.kind==="set")&&(s=(e.static?"s":"i")+e.kind),i==="iget"&&s==="iset"||i==="iset"&&s==="iget"||i==="sget"&&s==="sset"||i==="sset"&&s==="sget"?(t[n]="true",!1):i?!0:(t[n]=s,!1)}function qe(t,e){var n=t.computed,i=t.key;return!n&&(i.type==="Identifier"&&i.name===e||i.type==="Literal"&&i.value===e)}y.parseExportAllDeclaration=function(t,e){return this.options.ecmaVersion>=11&&(this.eatContextual("as")?(t.exported=this.parseModuleExportName(),this.checkExport(e,t.exported,this.lastTokStart)):t.exported=null),this.expectContextual("from"),this.type!==l.string&&this.unexpected(),t.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(t.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(t,"ExportAllDeclaration")};y.parseExport=function(t,e){if(this.next(),this.eat(l.star))return this.parseExportAllDeclaration(t,e);if(this.eat(l._default))return this.checkExport(e,"default",this.lastTokStart),t.declaration=this.parseExportDefaultDeclaration(),this.finishNode(t,"ExportDefaultDeclaration");if(this.shouldParseExportStatement())t.declaration=this.parseExportDeclaration(t),t.declaration.type==="VariableDeclaration"?this.checkVariableExport(e,t.declaration.declarations):this.checkExport(e,t.declaration.id,t.declaration.id.start),t.specifiers=[],t.source=null,this.options.ecmaVersion>=16&&(t.attributes=[]);else{if(t.declaration=null,t.specifiers=this.parseExportSpecifiers(e),this.eatContextual("from"))this.type!==l.string&&this.unexpected(),t.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(t.attributes=this.parseWithClause());else{for(var n=0,i=t.specifiers;n<i.length;n+=1){var s=i[n];this.checkUnreserved(s.local),this.checkLocalExport(s.local),s.local.type==="Literal"&&this.raise(s.local.start,"A string literal cannot be used as an exported binding without `from`.")}t.source=null,this.options.ecmaVersion>=16&&(t.attributes=[])}this.semicolon()}return this.finishNode(t,"ExportNamedDeclaration")};y.parseExportDeclaration=function(t){return this.parseStatement(null)};y.parseExportDefaultDeclaration=function(){var t;if(this.type===l._function||(t=this.isAsyncFunction())){var e=this.startNode();return this.next(),t&&this.next(),this.parseFunction(e,Te|gn,!1,t)}else if(this.type===l._class){var n=this.startNode();return this.parseClass(n,"nullableID")}else{var i=this.parseMaybeAssign();return this.semicolon(),i}};y.checkExport=function(t,e,n){t&&(typeof e!="string"&&(e=e.type==="Identifier"?e.name:e.value),Ie(t,e)&&this.raiseRecoverable(n,"Duplicate export '"+e+"'"),t[e]=!0)};y.checkPatternExport=function(t,e){var n=e.type;if(n==="Identifier")this.checkExport(t,e,e.start);else if(n==="ObjectPattern")for(var i=0,s=e.properties;i<s.length;i+=1){var r=s[i];this.checkPatternExport(t,r)}else if(n==="ArrayPattern")for(var a=0,o=e.elements;a<o.length;a+=1){var c=o[a];c&&this.checkPatternExport(t,c)}else n==="Property"?this.checkPatternExport(t,e.value):n==="AssignmentPattern"?this.checkPatternExport(t,e.left):n==="RestElement"&&this.checkPatternExport(t,e.argument)};y.checkVariableExport=function(t,e){if(t)for(var n=0,i=e;n<i.length;n+=1){var s=i[n];this.checkPatternExport(t,s.id)}};y.shouldParseExportStatement=function(){return this.type.keyword==="var"||this.type.keyword==="const"||this.type.keyword==="class"||this.type.keyword==="function"||this.isLet()||this.isAsyncFunction()};y.parseExportSpecifier=function(t){var e=this.startNode();return e.local=this.parseModuleExportName(),e.exported=this.eatContextual("as")?this.parseModuleExportName():e.local,this.checkExport(t,e.exported,e.exported.start),this.finishNode(e,"ExportSpecifier")};y.parseExportSpecifiers=function(t){var e=[],n=!0;for(this.expect(l.braceL);!this.eat(l.braceR);){if(n)n=!1;else if(this.expect(l.comma),this.afterTrailingComma(l.braceR))break;e.push(this.parseExportSpecifier(t))}return e};y.parseImport=function(t){return this.next(),this.type===l.string?(t.specifiers=Ri,t.source=this.parseExprAtom()):(t.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),t.source=this.type===l.string?this.parseExprAtom():this.unexpected()),this.options.ecmaVersion>=16&&(t.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(t,"ImportDeclaration")};y.parseImportSpecifier=function(){var t=this.startNode();return t.imported=this.parseModuleExportName(),this.eatContextual("as")?t.local=this.parseIdent():(this.checkUnreserved(t.imported),t.local=t.imported),this.checkLValSimple(t.local,fe),this.finishNode(t,"ImportSpecifier")};y.parseImportDefaultSpecifier=function(){var t=this.startNode();return t.local=this.parseIdent(),this.checkLValSimple(t.local,fe),this.finishNode(t,"ImportDefaultSpecifier")};y.parseImportNamespaceSpecifier=function(){var t=this.startNode();return this.next(),this.expectContextual("as"),t.local=this.parseIdent(),this.checkLValSimple(t.local,fe),this.finishNode(t,"ImportNamespaceSpecifier")};y.parseImportSpecifiers=function(){var t=[],e=!0;if(this.type===l.name&&(t.push(this.parseImportDefaultSpecifier()),!this.eat(l.comma)))return t;if(this.type===l.star)return t.push(this.parseImportNamespaceSpecifier()),t;for(this.expect(l.braceL);!this.eat(l.braceR);){if(e)e=!1;else if(this.expect(l.comma),this.afterTrailingComma(l.braceR))break;t.push(this.parseImportSpecifier())}return t};y.parseWithClause=function(){var t=[];if(!this.eat(l._with))return t;this.expect(l.braceL);for(var e={},n=!0;!this.eat(l.braceR);){if(n)n=!1;else if(this.expect(l.comma),this.afterTrailingComma(l.braceR))break;var i=this.parseImportAttribute(),s=i.key.type==="Identifier"?i.key.name:i.key.value;Ie(e,s)&&this.raiseRecoverable(i.key.start,"Duplicate attribute key '"+s+"'"),e[s]=!0,t.push(i)}return t};y.parseImportAttribute=function(){var t=this.startNode();return t.key=this.type===l.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never"),this.expect(l.colon),this.type!==l.string&&this.unexpected(),t.value=this.parseExprAtom(),this.finishNode(t,"ImportAttribute")};y.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===l.string){var t=this.parseLiteral(this.value);return Ii.test(t.value)&&this.raise(t.start,"An export name cannot include a lone surrogate."),t}return this.parseIdent(!0)};y.adaptDirectivePrologue=function(t){for(var e=0;e<t.length&&this.isDirectiveCandidate(t[e]);++e)t[e].directive=t[e].expression.raw.slice(1,-1)};y.isDirectiveCandidate=function(t){return this.options.ecmaVersion>=5&&t.type==="ExpressionStatement"&&t.expression.type==="Literal"&&typeof t.expression.value=="string"&&(this.input[t.start]==='"'||this.input[t.start]==="'")};var ee=j.prototype;ee.toAssignable=function(t,e,n){if(this.options.ecmaVersion>=6&&t)switch(t.type){case"Identifier":this.inAsync&&t.name==="await"&&this.raise(t.start,"Cannot use 'await' as identifier inside an async function");break;case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":break;case"ObjectExpression":t.type="ObjectPattern",n&&this.checkPatternErrors(n,!0);for(var i=0,s=t.properties;i<s.length;i+=1){var r=s[i];this.toAssignable(r,e),r.type==="RestElement"&&(r.argument.type==="ArrayPattern"||r.argument.type==="ObjectPattern")&&this.raise(r.argument.start,"Unexpected token")}break;case"Property":t.kind!=="init"&&this.raise(t.key.start,"Object pattern can't contain getter or setter"),this.toAssignable(t.value,e);break;case"ArrayExpression":t.type="ArrayPattern",n&&this.checkPatternErrors(n,!0),this.toAssignableList(t.elements,e);break;case"SpreadElement":t.type="RestElement",this.toAssignable(t.argument,e),t.argument.type==="AssignmentPattern"&&this.raise(t.argument.start,"Rest elements cannot have a default value");break;case"AssignmentExpression":t.operator!=="="&&this.raise(t.left.end,"Only '=' operator can be used for specifying default value."),t.type="AssignmentPattern",delete t.operator,this.toAssignable(t.left,e);break;case"ParenthesizedExpression":this.toAssignable(t.expression,e,n);break;case"ChainExpression":this.raiseRecoverable(t.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":if(!e)break;default:this.raise(t.start,"Assigning to rvalue")}else n&&this.checkPatternErrors(n,!0);return t};ee.toAssignableList=function(t,e){for(var n=t.length,i=0;i<n;i++){var s=t[i];s&&this.toAssignable(s,e)}if(n){var r=t[n-1];this.options.ecmaVersion===6&&e&&r&&r.type==="RestElement"&&r.argument.type!=="Identifier"&&this.unexpected(r.argument.start)}return t};ee.parseSpread=function(t){var e=this.startNode();return this.next(),e.argument=this.parseMaybeAssign(!1,t),this.finishNode(e,"SpreadElement")};ee.parseRestBinding=function(){var t=this.startNode();return this.next(),this.options.ecmaVersion===6&&this.type!==l.name&&this.unexpected(),t.argument=this.parseBindingAtom(),this.finishNode(t,"RestElement")};ee.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case l.bracketL:var t=this.startNode();return this.next(),t.elements=this.parseBindingList(l.bracketR,!0,!0),this.finishNode(t,"ArrayPattern");case l.braceL:return this.parseObj(!0)}return this.parseIdent()};ee.parseBindingList=function(t,e,n,i){for(var s=[],r=!0;!this.eat(t);)if(r?r=!1:this.expect(l.comma),e&&this.type===l.comma)s.push(null);else{if(n&&this.afterTrailingComma(t))break;if(this.type===l.ellipsis){var a=this.parseRestBinding();this.parseBindingListItem(a),s.push(a),this.type===l.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.expect(t);break}else s.push(this.parseAssignableListItem(i))}return s};ee.parseAssignableListItem=function(t){var e=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(e),e};ee.parseBindingListItem=function(t){return t};ee.parseMaybeDefault=function(t,e,n){if(n=n||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(l.eq))return n;var i=this.startNodeAt(t,e);return i.left=n,i.right=this.parseMaybeAssign(),this.finishNode(i,"AssignmentPattern")};ee.checkLValSimple=function(t,e,n){e===void 0&&(e=ze);var i=e!==ze;switch(t.type){case"Identifier":this.strict&&this.reservedWordsStrictBind.test(t.name)&&this.raiseRecoverable(t.start,(i?"Binding ":"Assigning to ")+t.name+" in strict mode"),i&&(e===fe&&t.name==="let"&&this.raiseRecoverable(t.start,"let is disallowed as a lexically bound name"),n&&(Ie(n,t.name)&&this.raiseRecoverable(t.start,"Argument name clash"),n[t.name]=!0),e!==mn&&this.declareName(t.name,e,t.start));break;case"ChainExpression":this.raiseRecoverable(t.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":i&&this.raiseRecoverable(t.start,"Binding member expression");break;case"ParenthesizedExpression":return i&&this.raiseRecoverable(t.start,"Binding parenthesized expression"),this.checkLValSimple(t.expression,e,n);default:this.raise(t.start,(i?"Binding":"Assigning to")+" rvalue")}};ee.checkLValPattern=function(t,e,n){switch(e===void 0&&(e=ze),t.type){case"ObjectPattern":for(var i=0,s=t.properties;i<s.length;i+=1){var r=s[i];this.checkLValInnerPattern(r,e,n)}break;case"ArrayPattern":for(var a=0,o=t.elements;a<o.length;a+=1){var c=o[a];c&&this.checkLValInnerPattern(c,e,n)}break;default:this.checkLValSimple(t,e,n)}};ee.checkLValInnerPattern=function(t,e,n){switch(e===void 0&&(e=ze),t.type){case"Property":this.checkLValInnerPattern(t.value,e,n);break;case"AssignmentPattern":this.checkLValPattern(t.left,e,n);break;case"RestElement":this.checkLValPattern(t.argument,e,n);break;default:this.checkLValPattern(t,e,n)}};var se=function(e,n,i,s,r){this.token=e,this.isExpr=!!n,this.preserveSpace=!!i,this.override=s,this.generator=!!r},O={b_stat:new se("{",!1),b_expr:new se("{",!0),b_tmpl:new se("${",!1),p_stat:new se("(",!1),p_expr:new se("(",!0),q_tmpl:new se("`",!0,!0,function(t){return t.tryReadTemplateToken()}),f_stat:new se("function",!1),f_expr:new se("function",!0),f_expr_gen:new se("function",!0,!1,null,!0),f_gen:new se("function",!1,!1,null,!0)},Ae=j.prototype;Ae.initialContext=function(){return[O.b_stat]};Ae.curContext=function(){return this.context[this.context.length-1]};Ae.braceIsBlock=function(t){var e=this.curContext();return e===O.f_expr||e===O.f_stat?!0:t===l.colon&&(e===O.b_stat||e===O.b_expr)?!e.isExpr:t===l._return||t===l.name&&this.exprAllowed?z.test(this.input.slice(this.lastTokEnd,this.start)):t===l._else||t===l.semi||t===l.eof||t===l.parenR||t===l.arrow?!0:t===l.braceL?e===O.b_stat:t===l._var||t===l._const||t===l.name?!1:!this.exprAllowed};Ae.inGeneratorContext=function(){for(var t=this.context.length-1;t>=1;t--){var e=this.context[t];if(e.token==="function")return e.generator}return!1};Ae.updateContext=function(t){var e,n=this.type;n.keyword&&t===l.dot?this.exprAllowed=!1:(e=n.updateContext)?e.call(this,t):this.exprAllowed=n.beforeExpr};Ae.overrideContext=function(t){this.curContext()!==t&&(this.context[this.context.length-1]=t)};l.parenR.updateContext=l.braceR.updateContext=function(){if(this.context.length===1){this.exprAllowed=!0;return}var t=this.context.pop();t===O.b_stat&&this.curContext().token==="function"&&(t=this.context.pop()),this.exprAllowed=!t.isExpr};l.braceL.updateContext=function(t){this.context.push(this.braceIsBlock(t)?O.b_stat:O.b_expr),this.exprAllowed=!0};l.dollarBraceL.updateContext=function(){this.context.push(O.b_tmpl),this.exprAllowed=!0};l.parenL.updateContext=function(t){var e=t===l._if||t===l._for||t===l._with||t===l._while;this.context.push(e?O.p_stat:O.p_expr),this.exprAllowed=!0};l.incDec.updateContext=function(){};l._function.updateContext=l._class.updateContext=function(t){t.beforeExpr&&t!==l._else&&!(t===l.semi&&this.curContext()!==O.p_stat)&&!(t===l._return&&z.test(this.input.slice(this.lastTokEnd,this.start)))&&!((t===l.colon||t===l.braceL)&&this.curContext()===O.b_stat)?this.context.push(O.f_expr):this.context.push(O.f_stat),this.exprAllowed=!1};l.colon.updateContext=function(){this.curContext().token==="function"&&this.context.pop(),this.exprAllowed=!0};l.backQuote.updateContext=function(){this.curContext()===O.q_tmpl?this.context.pop():this.context.push(O.q_tmpl),this.exprAllowed=!1};l.star.updateContext=function(t){if(t===l._function){var e=this.context.length-1;this.context[e]===O.f_expr?this.context[e]=O.f_expr_gen:this.context[e]=O.f_gen}this.exprAllowed=!0};l.name.updateContext=function(t){var e=!1;this.options.ecmaVersion>=6&&t!==l.dot&&(this.value==="of"&&!this.exprAllowed||this.value==="yield"&&this.inGeneratorContext())&&(e=!0),this.exprAllowed=e};var w=j.prototype;w.checkPropClash=function(t,e,n){if(!(this.options.ecmaVersion>=9&&t.type==="SpreadElement")&&!(this.options.ecmaVersion>=6&&(t.computed||t.method||t.shorthand))){var i=t.key,s;switch(i.type){case"Identifier":s=i.name;break;case"Literal":s=String(i.value);break;default:return}var r=t.kind;if(this.options.ecmaVersion>=6){s==="__proto__"&&r==="init"&&(e.proto&&(n?n.doubleProto<0&&(n.doubleProto=i.start):this.raiseRecoverable(i.start,"Redefinition of __proto__ property")),e.proto=!0);return}s="$"+s;var a=e[s];if(a){var o;r==="init"?o=this.strict&&a.init||a.get||a.set:o=a.init||a[r],o&&this.raiseRecoverable(i.start,"Redefinition of property")}else a=e[s]={init:!1,get:!1,set:!1};a[r]=!0}};w.parseExpression=function(t,e){var n=this;return this.catchStackOverflow(function(){var i=n.start,s=n.startLoc,r=n.parseMaybeAssign(t,e);if(n.type===l.comma){var a=n.startNodeAt(i,s);for(a.expressions=[r];n.eat(l.comma);)a.expressions.push(n.parseMaybeAssign(t,e));return n.finishNode(a,"SequenceExpression")}return r})};w.parseMaybeAssign=function(t,e,n){if(this.isContextual("yield")){if(this.inGenerator)return this.parseYield(t);this.exprAllowed=!1}var i=!1,s=-1,r=-1,a=-1;e?(s=e.parenthesizedAssign,r=e.trailingComma,a=e.doubleProto,e.parenthesizedAssign=e.trailingComma=-1):(e=new Ye,i=!0);var o=this.start,c=this.startLoc;(this.type===l.parenL||this.type===l.name)&&(this.potentialArrowAt=this.start,this.potentialArrowInForAwait=t==="await");var h=this.parseMaybeConditional(t,e);if(n&&(h=n.call(this,h,o,c)),this.type.isAssign){var u=this.startNodeAt(o,c);return u.operator=this.value,this.type===l.eq&&(h=this.toAssignable(h,!1,e)),i||(e.parenthesizedAssign=e.trailingComma=-1,e.shorthandAssign>=h.start&&(e.shorthandAssign=-1),e.doubleProto>=h.start&&(e.doubleProto=-1)),this.type===l.eq?this.checkLValPattern(h):this.checkLValSimple(h),u.left=h,this.next(),u.right=this.parseMaybeAssign(t),a>-1&&(e.doubleProto=a),this.finishNode(u,"AssignmentExpression")}else i&&this.checkExpressionErrors(e,!0);return s>-1&&(e.parenthesizedAssign=s),r>-1&&(e.trailingComma=r),h};w.parseMaybeConditional=function(t,e){var n=this.start,i=this.startLoc,s=this.parseExprOps(t,e);if(this.checkExpressionErrors(e))return s;if(!(s.type==="ArrowFunctionExpression"&&s.start===n)&&this.eat(l.question)){var r=this.startNodeAt(n,i);return r.test=s,r.consequent=this.parseMaybeAssign(),this.expect(l.colon),r.alternate=this.parseMaybeAssign(t),this.finishNode(r,"ConditionalExpression")}return s};w.parseExprOps=function(t,e){var n=this.start,i=this.startLoc,s=this.parseMaybeUnary(e,!1,!1,t);return this.checkExpressionErrors(e)||s.start===n&&s.type==="ArrowFunctionExpression"?s:this.parseExprOp(s,n,i,-1,t)};w.parseExprOp=function(t,e,n,i,s){var r=this.type.binop;if(r!=null&&(!s||this.type!==l._in)&&r>i){var a=this.type===l.logicalOR||this.type===l.logicalAND,o=this.type===l.coalesce;o&&(r=l.logicalAND.binop);var c=this.value;this.next();var h=this.start,u=this.startLoc,f=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,s),h,u,r,s),x=this.buildBinary(e,n,t,f,c,a||o);return(a&&this.type===l.coalesce||o&&(this.type===l.logicalOR||this.type===l.logicalAND))&&this.raiseRecoverable(this.start,"Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses"),this.parseExprOp(x,e,n,i,s)}return t};w.buildBinary=function(t,e,n,i,s,r){i.type==="PrivateIdentifier"&&this.raise(i.start,"Private identifier can only be left side of binary expression");var a=this.startNodeAt(t,e);return a.left=n,a.operator=s,a.right=i,this.finishNode(a,r?"LogicalExpression":"BinaryExpression")};w.parseMaybeUnary=function(t,e,n,i){var s=this.start,r=this.startLoc,a;if(this.isContextual("await")&&this.canAwait)a=this.parseAwait(i),e=!0;else if(this.type.prefix){var o=this.startNode(),c=this.type===l.incDec;o.operator=this.value,o.prefix=!0,this.next(),o.argument=this.parseMaybeUnary(null,!0,c,i),this.checkExpressionErrors(t,!0),c?this.checkLValSimple(o.argument):this.strict&&o.operator==="delete"&&vn(o.argument)?this.raiseRecoverable(o.start,"Deleting local variable in strict mode"):o.operator==="delete"&&ft(o.argument)?this.raiseRecoverable(o.start,"Private fields can not be deleted"):e=!0,a=this.finishNode(o,c?"UpdateExpression":"UnaryExpression")}else if(!e&&this.type===l.privateId)(i||this.privateNameStack.length===0)&&this.options.checkPrivateFields&&this.unexpected(),a=this.parsePrivateIdent(),this.type!==l._in&&this.unexpected();else{if(a=this.parseExprSubscripts(t,i),this.checkExpressionErrors(t))return a;for(;this.type.postfix&&!this.canInsertSemicolon();){var h=this.startNodeAt(s,r);h.operator=this.value,h.prefix=!1,h.argument=a,this.checkLValSimple(a),this.next(),a=this.finishNode(h,"UpdateExpression")}}if(!n&&!(a.type==="ArrowFunctionExpression"&&a.start===s)&&this.eat(l.starstar))if(e)this.unexpected(this.lastTokStart);else return this.buildBinary(s,r,a,this.parseMaybeUnary(null,!1,!1,i),"**",!1);else return a};function vn(t){return t.type==="Identifier"||t.type==="ParenthesizedExpression"&&vn(t.expression)}function ft(t){return t.type==="MemberExpression"&&t.property.type==="PrivateIdentifier"||t.type==="ChainExpression"&&ft(t.expression)||t.type==="ParenthesizedExpression"&&ft(t.expression)}w.parseExprSubscripts=function(t,e){var n=this.start,i=this.startLoc,s=-1,r=-1;t&&(s=t.doubleProto,r=t.shorthandAssign,t.doubleProto=t.shorthandAssign=-1);var a=this.parseExprAtom(t,e);if(a.type==="ArrowFunctionExpression"&&this.input.slice(this.lastTokStart,this.lastTokEnd)!==")")return a;var o=this.parseSubscripts(a,n,i,!1,e);return t&&(o.end>a.end&&(this.checkExpressionErrors(t,!0),t.parenthesizedAssign>=o.start&&(t.parenthesizedAssign=-1),t.parenthesizedBind>=o.start&&(t.parenthesizedBind=-1),t.trailingComma>=o.start&&(t.trailingComma=-1)),s>-1&&(t.doubleProto=s),r>-1&&(t.shorthandAssign=r)),o};w.parseSubscripts=function(t,e,n,i,s){for(var r=this.options.ecmaVersion>=8&&t.type==="Identifier"&&t.name==="async"&&this.lastTokEnd===t.end&&!this.canInsertSemicolon()&&t.end-t.start===5&&this.potentialArrowAt===t.start,a=!1;;){var o=this.parseSubscript(t,e,n,i,r,a,s);if(o.optional&&(a=!0),o.end===t.end||o.type==="ArrowFunctionExpression"){if(a){var c=this.startNodeAt(e,n);c.expression=o,o=this.finishNode(c,"ChainExpression")}return o}t=o,r=!1}};w.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(l.arrow)};w.parseSubscriptAsyncArrow=function(t,e,n,i){return this.parseArrowExpression(this.startNodeAt(t,e),n,!0,i)};w.parseSubscript=function(t,e,n,i,s,r,a){var o=this.options.ecmaVersion>=11,c=o&&this.eat(l.questionDot);i&&c&&this.raise(this.lastTokStart,"Optional chaining cannot appear in the callee of new expressions");var h=this.eat(l.bracketL);if(h||c&&this.type!==l.parenL&&this.type!==l.backQuote||this.eat(l.dot)){var u=this.startNodeAt(e,n);u.object=t,h?(u.property=this.parseExpression(),this.expect(l.bracketR)):this.type===l.privateId&&t.type!=="Super"?u.property=this.parsePrivateIdent():u.property=this.parseIdent(this.options.allowReserved!=="never"),u.computed=!!h,o&&(u.optional=c),t=this.finishNode(u,"MemberExpression")}else if(!i&&this.eat(l.parenL)){var f=new Ye,x=this.yieldPos,d=this.awaitPos,g=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var m=this.parseExprList(l.parenR,this.options.ecmaVersion>=8,!1,f);if(s&&!c&&this.shouldParseAsyncArrow())return this.checkPatternErrors(f,!1),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0&&this.raise(this.awaitIdentPos,"Cannot use 'await' as identifier inside an async function"),this.yieldPos=x,this.awaitPos=d,this.awaitIdentPos=g,this.parseSubscriptAsyncArrow(e,n,m,a);this.checkExpressionErrors(f,!0),this.yieldPos=x||this.yieldPos,this.awaitPos=d||this.awaitPos,this.awaitIdentPos=g||this.awaitIdentPos;var k=this.startNodeAt(e,n);k.callee=t,k.arguments=m,o&&(k.optional=c),t=this.finishNode(k,"CallExpression")}else if(this.type===l.backQuote){(c||r)&&this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions");var C=this.startNodeAt(e,n);C.tag=t,C.quasi=this.parseTemplate({isTagged:!0}),t=this.finishNode(C,"TaggedTemplateExpression")}return t};w.parseExprAtom=function(t,e,n){this.type===l.slash&&this.readRegexp();var i,s=this.potentialArrowAt===this.start;switch(this.type){case l._super:return this.allowSuper||this.raise(this.start,"'super' keyword outside a method"),i=this.startNode(),this.next(),this.type===l.parenL&&!this.allowDirectSuper&&this.raise(i.start,"super() call outside constructor of a subclass"),this.type!==l.dot&&this.type!==l.bracketL&&this.type!==l.parenL&&this.unexpected(),this.finishNode(i,"Super");case l._this:return i=this.startNode(),this.next(),this.finishNode(i,"ThisExpression");case l.name:var r=this.start,a=this.startLoc,o=this.containsEsc,c=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!o&&c.name==="async"&&!this.canInsertSemicolon()&&this.eat(l._function))return this.overrideContext(O.f_expr),this.parseFunction(this.startNodeAt(r,a),0,!1,!0,e);if(s&&!this.canInsertSemicolon()){if(this.eat(l.arrow))return this.parseArrowExpression(this.startNodeAt(r,a),[c],!1,e);if(this.options.ecmaVersion>=8&&c.name==="async"&&this.type===l.name&&!o&&(!this.potentialArrowInForAwait||this.value!=="of"||this.containsEsc))return c=this.parseIdent(!1),(this.canInsertSemicolon()||!this.eat(l.arrow))&&this.unexpected(),this.parseArrowExpression(this.startNodeAt(r,a),[c],!0,e)}return c;case l.regexp:var h=this.value;return i=this.parseLiteral(h.value),i.regex={pattern:h.pattern,flags:h.flags},i;case l.num:case l.string:return this.parseLiteral(this.value);case l._null:case l._true:case l._false:return i=this.startNode(),i.value=this.type===l._null?null:this.type===l._true,i.raw=this.type.keyword,this.next(),this.finishNode(i,"Literal");case l.parenL:var u=this.start,f=this.parseParenAndDistinguishExpression(s,e);return t&&(t.parenthesizedAssign<0&&!this.isSimpleAssignTarget(f)&&(t.parenthesizedAssign=u),t.parenthesizedBind<0&&(t.parenthesizedBind=u)),f;case l.bracketL:return i=this.startNode(),this.next(),i.elements=this.parseExprList(l.bracketR,!0,!0,t),this.finishNode(i,"ArrayExpression");case l.braceL:return this.overrideContext(O.b_expr),this.parseObj(!1,t);case l._function:return i=this.startNode(),this.next(),this.parseFunction(i,0);case l._class:return this.parseClass(this.startNode(),!1);case l._new:return this.parseNew();case l.backQuote:return this.parseTemplate();case l._import:return this.options.ecmaVersion>=11?this.parseExprImport(n):this.unexpected();default:return this.parseExprAtomDefault()}};w.parseExprAtomDefault=function(){this.unexpected()};w.parseExprImport=function(t){var e=this.startNode();if(this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword import"),this.next(),this.type===l.parenL&&!t)return this.parseDynamicImport(e);if(this.type===l.dot){var n=this.startNodeAt(e.start,e.loc&&e.loc.start);return n.name="import",e.meta=this.finishNode(n,"Identifier"),this.parseImportMeta(e)}else this.unexpected()};w.parseDynamicImport=function(t){if(this.next(),t.source=this.parseMaybeAssign(),this.options.ecmaVersion>=16)this.eat(l.parenR)?t.options=null:(this.expect(l.comma),this.afterTrailingComma(l.parenR)?t.options=null:(t.options=this.parseMaybeAssign(),this.eat(l.parenR)||(this.expect(l.comma),this.afterTrailingComma(l.parenR)||this.unexpected())));else if(!this.eat(l.parenR)){var e=this.start;this.eat(l.comma)&&this.eat(l.parenR)?this.raiseRecoverable(e,"Trailing comma is not allowed in import()"):this.unexpected(e)}return this.finishNode(t,"ImportExpression")};w.parseImportMeta=function(t){this.next();var e=this.containsEsc;return t.property=this.parseIdent(!0),t.property.name!=="meta"&&this.raiseRecoverable(t.property.start,"The only valid meta property for import is 'import.meta'"),e&&this.raiseRecoverable(t.start,"'import.meta' must not contain escaped characters"),this.options.sourceType!=="module"&&!this.options.allowImportExportEverywhere&&this.raiseRecoverable(t.start,"Cannot use 'import.meta' outside a module"),this.finishNode(t,"MetaProperty")};w.parseLiteral=function(t){var e=this.startNode();return e.value=t,e.raw=this.input.slice(this.start,this.end),e.raw.charCodeAt(e.raw.length-1)===110&&(e.bigint=e.value!=null?e.value.toString():e.raw.slice(0,-1).replace(/_/g,"")),this.next(),this.finishNode(e,"Literal")};w.parseParenExpression=function(){this.expect(l.parenL);var t=this.parseExpression();return this.expect(l.parenR),t};w.shouldParseArrow=function(t){return!this.canInsertSemicolon()};w.parseParenAndDistinguishExpression=function(t,e){var n=this.start,i=this.startLoc,s,r=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var a=this.start,o=this.startLoc,c=[],h=!0,u=!1,f=new Ye,x=this.yieldPos,d=this.awaitPos,g;for(this.yieldPos=0,this.awaitPos=0;this.type!==l.parenR;)if(h?h=!1:this.expect(l.comma),r&&this.afterTrailingComma(l.parenR,!0)){u=!0;break}else if(this.type===l.ellipsis){g=this.start,c.push(this.parseParenItem(this.parseRestBinding())),this.type===l.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");break}else c.push(this.parseMaybeAssign(!1,f,this.parseParenItem));var m=this.lastTokEnd,k=this.lastTokEndLoc;if(this.expect(l.parenR),t&&this.shouldParseArrow(c)&&this.eat(l.arrow))return this.checkPatternErrors(f,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=x,this.awaitPos=d,this.parseParenArrowList(n,i,c,e);(!c.length||u)&&this.unexpected(this.lastTokStart),g&&this.unexpected(g),this.checkExpressionErrors(f,!0),this.yieldPos=x||this.yieldPos,this.awaitPos=d||this.awaitPos,c.length>1?(s=this.startNodeAt(a,o),s.expressions=c,this.finishNodeAt(s,"SequenceExpression",m,k)):s=c[0]}else s=this.parseParenExpression();if(this.options.preserveParens){var C=this.startNodeAt(n,i);return C.expression=s,this.finishNode(C,"ParenthesizedExpression")}else return s};w.parseParenItem=function(t){return t};w.parseParenArrowList=function(t,e,n,i){return this.parseArrowExpression(this.startNodeAt(t,e),n,!1,i)};var Vi=[];w.parseNew=function(){this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword new");var t=this.startNode();if(this.next(),this.options.ecmaVersion>=6&&this.type===l.dot){var e=this.startNodeAt(t.start,t.loc&&t.loc.start);e.name="new",t.meta=this.finishNode(e,"Identifier"),this.next();var n=this.containsEsc;return t.property=this.parseIdent(!0),t.property.name!=="target"&&this.raiseRecoverable(t.property.start,"The only valid meta property for new is 'new.target'"),n&&this.raiseRecoverable(t.start,"'new.target' must not contain escaped characters"),this.allowNewDotTarget||this.raiseRecoverable(t.start,"'new.target' can only be used in functions and class static block"),this.finishNode(t,"MetaProperty")}var i=this.start,s=this.startLoc;return t.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),i,s,!0,!1),t.callee.type==="Super"&&this.raiseRecoverable(i,"Invalid use of 'super'"),this.eat(l.parenL)?t.arguments=this.parseExprList(l.parenR,this.options.ecmaVersion>=8,!1):t.arguments=Vi,this.finishNode(t,"NewExpression")};w.parseTemplateElement=function(t){var e=t.isTagged,n=this.startNode();return this.type===l.invalidTemplate?(e||this.raiseRecoverable(this.start,"Bad escape sequence in untagged template literal"),n.value={raw:this.value.replace(/\r\n?/g,`
|
|
12
|
+
`&&e!=="`")return;if(e==="`"&&n==="$"&&this.peekChar(1)==="{"){this.advance(2);let i=1;for(;this.pos<this.src.length&&i>0;){let s=this.peekChar();s==="{"?i++:s==="}"&&i--,this.advance()}continue}this.advance()}}};function ge(t,e,n){return new at(t,e,n).tokenize()}var fi=new Set(["title","descr","description","fav","favicon","lang","charset","viewport","author","keywords","robots","themeColor","colorScheme","canonical","generator","manifest","appleTouchIcon","base","bodyClass","htmlClass","paths","jsonLd"]);function di(t){return fi.has(t)||/^(og|twitter)[A-Z]/.test(t)}var mi=new Set(["String","Number","Boolean","BigInt","Symbol","Array","Object","Date","Error","RegExp","Promise"]),gi=new Set(["Infinity","NaN"]),vi=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","enum","export","extends","false","finally","for","function","if","import","in","instanceof","new","null","return","super","switch","this","throw","true","try","typeof","var","void","while","with","yield","let","static","await","implements","interface","package","private","protected","public","and","or","not","arguments","eval"]),xi=new Set(["=","+=","-=","*=","/=","%=","**=","??=","&&=","||="]),we=class t{constructor(e,n){this.source=e;this.file=n;$(this,"pos",0);$(this,"tokens");Ht(n,e),this.tokens=ge(e,n)}static fromTokens(e,n){let i=Object.create(t.prototype);return Object.assign(i,{pos:0,tokens:e,file:n,source:""}),i}peek(e=0){return this.tokens[Math.min(this.pos+e,this.tokens.length-1)]}get tok(){return this.peek()}next(){let e=this.tokens[this.pos];return this.pos<this.tokens.length-1&&this.pos++,e}isPunct(e,n=0){let i=this.peek(n);return i.kind==="punct"&&i.value===e}isIdent(e,n=0){let i=this.peek(n);return i.kind==="ident"&&(e===void 0||i.value===e)}eat(e){return this.isPunct(e)?(this.next(),!0):!1}eatIdent(e){return this.isIdent(e)?(this.next(),!0):!1}describe(e){return e.kind==="eof"?"end of file":e.kind==="string"?`string "${e.value}"`:e.kind==="raw"?"block":`'${e.value}'`}fail(e,n=this.tok,i,s="E0100"){throw new P(s,e,{...n.loc,length:Math.max(1,n.end-n.start)},i)}expect(e,n){return this.isPunct(e)||this.fail(`Expected '${e}'${n?" "+n:""}, found ${this.describe(this.tok)}`),this.next()}expectIdent(e){return this.tok.kind!=="ident"&&this.fail(`Expected ${e}, found ${this.describe(this.tok)}`),this.next()}sameLine(){return!this.tok.newlineBefore}adjacent(){let e=this.tokens[this.pos-1];return!!e&&e.end===this.tok.start}parseFile(){let e={path:this.file,source:this.source,isPage:!1,imports:[],meta:[],externs:[],vars:[],functions:[],components:[],styles:[],scripts:[],lifecycle:[],watchers:[],body:[]};if(this.isIdent("page")&&(this.peek(1).kind==="eof"||this.peek(1).newlineBefore))throw new P("E0104","The 'page' keyword was removed",this.tok.loc,"Delete this line. Files in pages/ (or in the project root when there is no pages/ folder) are pages automatically");let n=new Set;for(;this.tok.kind!=="eof";){let i=this.tok;if(i.kind==="ident"){switch(i.value){case"import":e.imports.push(this.parseImport());continue;case"extern":this.next();do{let s=this.expectIdent("a name after 'extern'");e.externs.push({name:s.value,loc:s.loc})}while(this.eat(","));continue;case"private":case"export":if(this.isIdent("component",1)||this.isIdent("custom-element",1)){let s=i.value==="export";this.next();let r=this.isIdent("component")?this.parseComponent():this.parseLegacyCustomElement();r.exported=s,e.components.push(r);continue}break;case"component":e.components.push(this.parseComponent());continue;case"custom-element":case"custom":if(this.peek(1).kind==="ident"){e.components.push(this.parseLegacyCustomElement());continue}break;default:break}if(this.tryParseOwnerItem(e,n))continue;if(i.value!=="var"&&this.isPunct("=",1)&&!n.has(i.value)&&di(i.value)){this.next(),this.next(),e.meta.push({key:i.value,value:this.parseExpr(),loc:i.loc});continue}}e.body.push(...this.parseNode(e))}return e}tryParseOwnerItem(e,n){let i=this.tok;if(i.kind!=="ident")return!1;if(i.value==="var"||i.value==="const"||i.value==="computed"||i.value==="persist"&&this.isIdent("var",1)){let s=this.parseVarDecl();return e.vars.push(s),n?.add(s.name),!0}return i.value==="function"||i.value==="async"&&this.isIdent("function",1)?(e.functions.push(this.parseFunction()),!0):i.value==="style"&&this.peekPastModifiersIsRaw()?(e.styles.push(this.parseStyle()),!0):i.value==="script"&&this.peekPastModifiersIsRaw()?(e.scripts.push(this.parseScript()),!0):(i.value==="onMount"||i.value==="onDestroy")&&this.isPunct("{",1)?(this.next(),e.lifecycle.push({kind:i.value==="onMount"?"mount":"destroy",body:this.parseStmtBlock(),loc:i.loc}),!0):i.value==="watch"&&!this.peek(1).newlineBefore&&(this.peek(1).kind!=="punct"||this.isPunct("(",1))?this.parseWatch(e):!1}parseWatch(e){let n=this.next(),i=this.parseExpr();return e.watchers.push({expr:i,body:this.parseStmtBlock(),loc:n.loc}),!0}peekPastModifiersIsRaw(){for(let e=1;e<32;e++){let n=this.peek(e);if(n.kind==="raw")return!0;if(n.kind==="eof"||n.kind==="punct"&&n.value!=="=")return!1}return!1}parseImport(){let n=this.next().loc,i={kind:"module",source:"",named:[],attrs:{},sideEffect:!1,loc:n},s;if(this.isIdent("css")||this.isIdent("style")?(this.next(),s="style"):this.isIdent("js")||this.isIdent("script")?(this.next(),s="script"):this.isIdent("font")&&(this.next(),s="font"),this.tok.kind==="string")i.source=this.next().value,i.sideEffect=!0;else{if(this.eat("*"))this.eatIdent("as")||this.fail("Expected 'as' after '*' in import"),i.namespace=this.expectIdent("a namespace name").value;else if(this.isPunct("{"))i.named=this.parseImportSpecifiers();else if(this.tok.kind==="ident"&&!this.isIdent("from")){let a=this.next().value;if(this.isIdent("as")){if(this.next(),i.defaultName=this.expectIdent("an alias").value,i.named.push({name:a,alias:i.defaultName,loc:n}),i.defaultName=void 0,!this.isIdent("from"))return i.source=a,i.kind="library",i}else i.defaultName=a;if(this.eat(",")&&(this.eat("*")?(this.eatIdent("as"),i.namespace=this.expectIdent("a namespace name").value):i.named.push(...this.parseImportSpecifiers())),!this.isIdent("from"))return i.source=a,i.defaultName=void 0,i.kind="library",i.sideEffect=!0,i}this.eatIdent("from")||this.fail(`Expected 'from' in import, found ${this.describe(this.tok)}`),this.peek().kind!=="string"&&this.fail("Expected a module path string after 'from'"),i.source=this.next().value}let r;return this.isIdent("as")&&i.sideEffect&&(this.next(),r=this.expectIdent("an alias").value,i.sideEffect=!1),this.isPunct("{")&&this.sameLine()&&(i.attrs=this.parseImportAttrs()),i.kind=s??yi(i.source),r&&(i.kind==="sinth"?i.defaultName=r:i.namespace=r),i}parseImportSpecifiers(){let e=[];for(this.expect("{");!this.isPunct("}");){let n=this.expectIdent("an imported name"),i=n.value;if(this.eatIdent("as")&&(i=this.expectIdent("an alias").value),e.push({name:n.value,alias:i,loc:n.loc}),!this.eat(","))break}return this.expect("}","to close the import list"),e}parseImportAttrs(){let e={};for(this.expect("{");!this.isPunct("}");){let n=this.expectIdent("an attribute name").value;if(this.eat(":")){let i=this.next();e[n]=i.kind==="string"?i.value:i.value==="true"?!0:i.value==="false"?!1:i.value}else e[n]=!0;this.eat(",")}return this.expect("}"),e}parseTypeRef(){let e=this.expectIdent("a type");He.has(e.value)||this.fail(`Unknown type '${e.value}'`,e,"Valid types: str, num, bool, obj, ui, any, void (add [] for arrays, ? for nullable)","E0201");let n={base:e.value,array:0,nullable:!1};for(;this.isPunct("[")&&this.isPunct("]",1)&&this.adjacent();)this.next(),this.next(),n.array++;return this.isPunct("?")&&this.adjacent()&&(this.next(),n.nullable=!0),n}looksLikeType(e=0){let n=this.peek(e);return n.kind==="ident"&&He.has(n.value)}parseVarDecl(){let e=this.tok,n=!1;this.isIdent("persist")&&(this.next(),n=!0);let i=this.next(),s=i.value==="const"?"const":i.value==="computed"?"computed":"var",r;this.looksLikeType()&&(this.peek(1).kind==="ident"||this.isPunct("[",1)&&this.isPunct("]",2)||this.isPunct("?",1))&&(r=this.parseTypeRef());let a=this.expectIdent("a variable name");this.checkName(a),!r&&this.isPunct(":")&&(this.next(),r=this.parseTypeRef());let o;return this.eat("=")&&(o=this.parseExpr()),s!=="var"&&!o&&this.fail(`'${s}' declarations need an initial value`,a),this.eat(";"),{kind:s,name:a.value,type:r,init:o,persist:n,loc:e.loc}}checkName(e){vi.has(e.value)&&this.fail(`'${e.value}' is a reserved word and cannot be used as a name`,e,void 0,"E0102"),e.value.startsWith("$$")&&this.fail("Names starting with '$$' are reserved for the Sinth runtime",e,void 0,"E0102")}parseParams(){let e=[];if(!this.eat("("))return e;for(;!this.isPunct(")");){let n=this.tok,i=this.eat("..."),s=this.isIdent("bind")&&this.peek(1).kind==="ident"&&!this.isPunct(":",1);s&&this.next();let r;this.looksLikeType()&&(this.peek(1).kind==="ident"||this.isPunct("[",1)&&this.isPunct("]",2)||this.isPunct("?",1))&&(r=this.parseTypeRef());let a=this.expectIdent("a parameter name");this.checkName(a);let o=!1;this.isPunct("?")&&this.adjacent()&&(this.next(),o=!0),!r&&this.eat(":")&&(r=this.parseTypeRef());let c;if(this.eat("=")&&(c=this.parseExpr()),r?.nullable&&!c&&(o=!0),e.push({name:a.value,type:r,defaultValue:c,optional:o||!!c,rest:i,bindable:s,loc:n.loc}),!this.eat(","))break}return this.expect(")","to close the parameter list"),e}parseFunction(){let e=this.tok,n=this.eatIdent("async");this.next();let i=this.expectIdent("a function name");this.checkName(i),/^[A-Z]/.test(i.value)&&this.fail(`Function '${i.value}' must start with a lowercase letter`,i,"Use 'component' for reusable UI with a capitalized name");let s=this.parseParams(),r;(this.eat("->")||this.eat(":"))&&(r=this.parseTypeRef());let a={name:i.value,params:s,returnType:r,body:[],async:n,loc:e.loc};if(r?.base==="ui"){this.expect("{","to open the function body");let o=bi();a.view=this.parseNodesUntilClose(o,!0),this.expect("}","to close the function body"),a.body=o.vars.map(c=>({k:"var",decl:c,loc:c.loc}))}else a.body=this.parseStmtBlock();return a}parseComponent(){let e=this.next(),n=this.expectIdent("a component name");/^[A-Z]/.test(n.value)||this.fail(`Component '${n.value}' must start with an uppercase letter`,n);let i=this.parseParams(),s;this.eatIdent("as")&&(s=this.parseTagLiteral());let r={name:n.value,params:i,vars:[],functions:[],body:[],styles:[],scripts:[],lifecycle:[],watchers:[],customTag:s,exported:!0,file:this.file,loc:e.loc};return this.expect("{",`to open the body of component '${n.value}'`),r.body=this.parseNodesUntilClose(r,!1),this.expect("}",`to close component '${n.value}'`),r}parseTagLiteral(){this.expect("<","to start a tag name like <my-element/>");let e=this.expectIdent("a tag name").value;for(;this.isPunct("-")&&this.adjacent();)this.next(),e+="-"+this.expectIdent("a tag name segment").value;return this.eat("/"),this.expect(">","to close the tag literal"),/^[a-z][a-z0-9]*-[a-z0-9-]+$/.test(e)||this.fail(`'${e}' is not a valid custom element name (it must be lowercase and contain a dash)`),e}parseLegacyCustomElement(){let e=this.next(),n=this.expectIdent("an element name"),i,s=[];if(this.eat("(")){for(;!this.isPunct(")");){let o=this.expectIdent("an option").value;if(o==="export"?(this.expect(":"),i=this.parseTagLiteral()):s.push({name:o,optional:!0,rest:!1,loc:this.tok.loc,defaultValue:this.eat("=")?this.parseExpr():void 0}),!this.eat(","))break}this.expect(")")}let a={name:/^[A-Z]/.test(n.value)?n.value:n.value[0].toUpperCase()+n.value.slice(1),params:s,vars:[],functions:[],body:[],styles:[],scripts:[],lifecycle:[],watchers:[],customTag:i??`sinth-${n.value.toLowerCase()}`,exported:!0,file:this.file,loc:e.loc};if(this.tok.kind==="raw"){let o=this.next(),c=t.fromTokens(ge(o.value,this.file,o.loc),this.file);a.body=c.parseNodesUntilClose(a,!1)}else this.expect("{"),a.body=this.parseNodesUntilClose(a,!1),this.expect("}");return a}parseStyle(){let e=this.next(),n=!1,i="sinth";for(;this.tok.kind!=="raw";)if(this.eatIdent("global"))n=!0;else if(this.eatIdent("scoped"))n=!1;else if(this.isIdent("lang")){this.next(),this.expect("=");let r=this.next();r.value!=="css"&&r.value!=="scss"&&r.value!=="sinth"&&this.fail(`Unsupported style language '${r.value}'`,r,'Use lang="css", lang="scss" or omit it'),i=r.value}else this.fail(`Unexpected ${this.describe(this.tok)} in style block header`);let s=this.next();return{global:n,lang:i,raw:s.value,loc:{...s.loc,line:s.loc.line,col:e.loc.col}}}parseScript(){this.next();let e={};for(;this.tok.kind!=="raw";){let i=this.expectIdent("a script attribute").value;e[i]=this.eat("=")?this.next().value:"true"}let n=this.next();return{raw:n.value,attrs:e,loc:n.loc}}parseNodesUntilClose(e,n){let i=[];for(;!this.isPunct("}")&&this.tok.kind!=="eof";)this.tryParseOwnerItem(e)||n&&this.isIdent("return")&&(this.next(),this.isPunct("}"))||i.push(...this.parseNode(e));return i}startsElement(){let e=this.tok;if(e.kind!=="ident"||!/^[A-Z]/.test(e.value)||gi.has(e.value))return!1;if(this.isPunct(".",1)){let n=this.peek(2);return n.kind==="ident"&&/^[A-Z]/.test(n.value)}return!(mi.has(e.value)&&this.isPunct("(",1))}parseNode(e){let n=this.tok;if(n.kind==="ident"){if(n.value==="if")return[this.parseIfNode(e)];if(n.value==="for")return[this.parseForNode(e)];if(n.value==="$slot")return[this.parseSlotOutlet(e)];if(n.value==="var"||n.value==="const"||n.value==="computed"){let c=this.parseVarDecl();return[{k:"var",decl:c,loc:c.loc}]}if(n.value==="slot"&&this.isPunct("(",1)&&this.fail("'slot(...) { }' can only be used directly inside a component usage to fill a named slot"),this.startsElement())return[this.parseElement(e)]}n.kind==="raw"&&this.fail("Unexpected block");let i=n.loc,s=this.parseExpr();if(this.eat(";"),Kt(s))return[{k:"stmt",stmt:{k:"expr",expr:s,loc:i},loc:i}];let r={k:"text",expr:s,loc:i},a=this.tok,o=a.kind==="ident"&&(/^[A-Z]/.test(a.value)||["if","for","var","const","computed","$slot","slot"].includes(a.value));return!a.newlineBefore&&(a.kind==="string"||a.kind==="number"||a.kind==="template"||a.kind==="ident"&&!o)&&this.fail(`Unexpected ${this.describe(this.tok)} after expression`,this.tok,"Use '+' to join values, or put each child on its own line"),[r]}parseSlotOutlet(e){let n=this.next(),i="default",s=[];if(this.isPunct("(")&&this.adjacent()){for(this.next();!this.isPunct(")");){let r=this.expectIdent("'name' or 'fallback'");if(this.expect(":"),r.value==="name"){let a=this.next();a.kind!=="string"&&this.fail("Slot names must be string literals",a),i=a.value}else if(r.value==="fallback"){let a=this.parseExpr();s=[{k:"text",expr:a,loc:a.loc}]}else this.fail(`Unknown slot option '${r.value}'`,r);if(!this.eat(","))break}this.expect(")")}return this.isPunct("{")&&this.sameLine()&&(this.next(),s=this.parseNodesUntilClose(e,!1),this.expect("}")),{k:"slot",name:i,fallback:s,loc:n.loc}}parseElement(e){let n=this.next(),i=n.value;for(;this.isPunct(".")&&this.peek(1).kind==="ident";)this.next(),i+="."+this.next().value;let s={k:"element",name:i,attrs:[],children:[],slots:[],hasBody:!1,loc:n.loc};if(this.isPunct("(")&&this.sameLine()&&(s.attrs=this.parseAttrs()),this.isPunct("{")){for(this.next(),s.hasBody=!0;!this.isPunct("}")&&this.tok.kind!=="eof";){if(this.isIdent("slot")&&this.isPunct("(",1)){s.slots.push(this.parseSlotFill(e));continue}this.tryParseOwnerItem(e)||s.children.push(...this.parseNode(e))}this.expect("}",`to close '${i}'`)}return s}parseSlotFill(e){let n=this.next();this.expect("(");let i="default";for(;!this.isPunct(")");){let r=this.expectIdent("'name'");this.expect(":");let a=this.next();if((r.value!=="name"||a.kind!=="string")&&this.fail('Expected slot(name: "...")',a),i=a.value,!this.eat(","))break}this.expect(")"),this.expect("{","to open the slot content");let s=this.parseNodesUntilClose(e,!1);return this.expect("}"),{name:i,children:s,loc:n.loc}}parseAttrName(){let e=this.tok;e.kind!=="ident"&&e.kind!=="string"&&this.fail(`Expected an attribute name, found ${this.describe(e)}`),this.next();let n=e.value;for(;e.kind==="ident"&&this.isPunct("-")&&this.adjacent()&&this.peek(1).kind==="ident"&&this.peek(1).start===this.tok.end;)this.next(),n+="-"+this.next().value;return{full:n,loc:e.loc}}parseAttrs(){let e=[];for(this.expect("(");!this.isPunct(")")&&this.tok.kind!=="eof";){if(this.isPunct("...")){let r=this.next();e.push({name:"...",modifiers:[],value:this.parseExpr(),loc:r.loc}),this.eat(",");continue}let n=this.parseAttrName(),i=[];for(;this.isPunct(".")&&this.adjacent();)this.next(),i.push(this.expectIdent("an event modifier").value);let s={name:n.full,modifiers:i,value:null,loc:n.loc};this.eat(":")&&(/^on[A-Z]/.test(s.name)?s.handler=this.parseHandler():s.value=this.parseExpr()),e.push(s),this.eat(",")}return this.expect(")","to close the attribute list"),e}atAttrBoundary(){return this.isPunct(",")||this.isPunct(")")?!0:this.tok.kind==="ident"&&this.isPunct(":",1)&&!this.isIdent("else")}parseHandler(){let e=[];for(;!(this.atAttrBoundary()||(e.push(this.parseStmt()),!this.eat(";"))););return e.length===0&&this.fail("Expected an event handler"),e}parseIfNode(e){let n=this.next(),i={k:"if",branches:[],persist:!1,loc:n.loc},s=this.parseExpr();for(this.parseIfModifiers(i),i.branches.push({test:s,body:this.parseNodeBlock(e),loc:n.loc});;){if(this.isIdent("elif")){let r=this.next(),a=this.parseExpr();this.parseIfModifiers(i),i.branches.push({test:a,body:this.parseNodeBlock(e),loc:r.loc});continue}if(this.isIdent("else")){let r=this.next();if(this.eatIdent("if")){let a=this.parseExpr();this.parseIfModifiers(i),i.branches.push({test:a,body:this.parseNodeBlock(e),loc:r.loc});continue}this.parseIfModifiers(i),i.branches.push({body:this.parseNodeBlock(e),loc:r.loc})}break}return i}parseIfModifiers(e){for(;;)if(this.eatIdent("persist"))e.persist=!0;else{if(this.eatIdent("replace"))continue;if(this.isIdent("delay")&&this.isPunct("(",1))this.next(),this.next(),e.delay=this.parseExpr(),this.expect(")");else if(this.isIdent("hide")&&this.isPunct("(",1)){this.next(),this.next();let n=this.parseExpr();this.expect(")"),n.k==="lit"&&n.value===!0&&(e.persist=!0)}else if(this.isIdent("transition")&&this.isPunct("(",1)){this.next(),this.next();let n=this.next();n.kind!=="string"&&this.fail('transition(...) expects a string name like "fade"',n),e.transition=n.value,this.expect(")")}else break}}parseNodeBlock(e){this.expect("{","to open the block");let n=this.parseNodesUntilClose(e,!1);return this.expect("}","to close the block"),n}parseLoopHead(){let e=this.isPunct("(")&&this.loopHeadIsParenthesized();e&&this.next();let n=[];do{let a=this.expectIdent("a loop variable name");this.checkName(a),n.push(a.value)}while(this.eat(","));n.length>3&&this.fail("A for loop can declare at most three names: item, index, key"),this.eatIdent("in")||this.fail(`Expected 'in' after loop variable${n.length>1?"s":""}`);let i=this.parseExpr();e&&this.expect(")","to close the loop header");let s,r;for(;;)if(this.isIdent("key"))this.next(),s=this.parseExpr();else if(this.isIdent("if"))this.next(),r=this.parseExpr();else break;return{names:n,iter:i,keyExpr:s,filter:r}}loopHeadIsParenthesized(){let e=0;for(let n=0;n<4096;n++){let i=this.peek(n);if(i.kind==="eof")return!1;if(i.kind==="punct"&&(i.value==="("||i.value==="["||i.value==="{")&&e++,i.kind==="punct"&&(i.value===")"||i.value==="]"||i.value==="}")&&e--,e===1&&i.kind==="ident"&&i.value==="in")return!0;if(e===0)return!1}return!1}parseForNode(e){let n=this.next(),i=this.parseLoopHead();this.eatIdent("persist");let s={k:"for",...i,body:this.parseNodeBlock(e),loc:n.loc};return this.isIdent("else")&&this.isPunct("{",1)&&(this.next(),s.empty=this.parseNodeBlock(e)),s}parseStmtBlock(){this.expect("{","to open the block");let e=[];for(;!this.isPunct("}")&&this.tok.kind!=="eof";)e.push(this.parseStmt()),this.eat(";");return this.expect("}","to close the block"),e}parseStmt(){let e=this.tok;if(e.kind==="ident")switch(e.value){case"var":case"const":case"computed":{let i=this.parseVarDecl();return{k:"var",decl:i,loc:i.loc}}case"if":{this.next();let i=this.parseExpr(),s=this.isPunct("{")?this.parseStmtBlock():[this.parseStmt()],r;return this.isIdent("elif")?r=[this.parseStmt()]:this.isIdent("else")&&(this.next(),r=this.isPunct("{")?this.parseStmtBlock():[this.parseStmt()]),{k:"if",test:i,then:s,else:r,loc:e.loc}}case"elif":{this.next();let i=this.parseExpr(),s=this.parseStmtBlock(),r;return this.isIdent("elif")?r=[this.parseStmt()]:this.eatIdent("else")&&(r=this.isPunct("{")?this.parseStmtBlock():[this.parseStmt()]),{k:"if",test:i,then:s,else:r,loc:e.loc}}case"for":{this.next();let i=this.parseLoopHead();return{k:"for",names:i.names,iter:i.iter,filter:i.filter,body:this.parseStmtBlock(),loc:e.loc}}case"while":return this.next(),{k:"while",test:this.parseExpr(),body:this.parseStmtBlock(),loc:e.loc};case"try":{this.next();let i=this.parseStmtBlock(),s,r,a;return this.eatIdent("catch")&&(this.isPunct("(")?(this.next(),s=this.expectIdent("a name for the caught error").value,this.expect(")","after the caught error name")):this.tok.kind==="ident"&&(s=this.expectIdent("a name for the caught error").value),r=this.parseStmtBlock()),this.eatIdent("finally")&&(a=this.parseStmtBlock()),!r&&!a&&this.fail("'try' needs a 'catch' or 'finally' block",e),{k:"try",body:i,param:s,handler:r,finalizer:a,loc:e.loc}}case"throw":return this.next(),{k:"throw",value:this.parseExpr(),loc:e.loc};case"return":return this.next(),this.isPunct("}")||this.isPunct(";")||this.tok.newlineBefore||this.tok.kind==="eof"||this.atAttrBoundary()?{k:"return",loc:e.loc}:{k:"return",value:this.parseExpr(),loc:e.loc};case"break":return this.next(),{k:"break",loc:e.loc};case"continue":return this.next(),{k:"continue",loc:e.loc};default:break}return{k:"expr",expr:this.parseExpr(),loc:e.loc}}parseExpr(){return this.parseAssign()}parseAssign(){let e=this.tryParseArrow();if(e)return e;let n=this.parseTernary(),i=this.tok;if(i.kind==="punct"&&xi.has(i.value)){n.k!=="id"&&n.k!=="member"&&n.k!=="index"&&this.fail("Invalid assignment target",i,void 0,"E0103"),this.next();let s=this.parseAssign();return{k:"assign",op:i.value,target:n,value:s,loc:n.loc}}return n}tryParseArrow(){let e=this.tok,n=this.isIdent("async")&&(this.isPunct("(",1)||this.peek(1).kind==="ident"&&this.isPunct("=>",2)),i=n?1:0;if(this.peek(i).kind==="ident"&&this.isPunct("=>",i+1)){n&&this.next();let h=this.next();return this.next(),{k:"arrow",params:[{name:h.value,optional:!1,rest:!1,loc:h.loc}],body:this.parseArrowBody(),async:n,loc:e.loc}}if(!this.isPunct("(",i))return;let s=0,r=i;for(;r<4096;r++){let h=this.peek(r);if(h.kind==="eof")return;if(h.kind==="punct"&&(h.value==="("||h.value==="["||h.value==="{")&&s++,h.kind==="punct"&&(h.value===")"||h.value==="]"||h.value==="}")&&s--,s===0)break}let a=this.peek(r+1);if(!(a.kind==="punct"&&(a.value==="=>"||a.value==="->"&&this.peek(r+2).kind==="ident"&&He.has(this.peek(r+2).value))))return;n&&this.next();let c=this.parseParams();return this.eat("->")?(this.parseTypeRef(),this.eat("=>")?{k:"arrow",params:c,body:this.parseArrowBody(),async:n,loc:e.loc}:{k:"arrow",params:c,body:this.parseStmtBlock(),async:n,loc:e.loc}):(this.expect("=>"),{k:"arrow",params:c,body:this.parseArrowBody(),async:n,loc:e.loc})}parseArrowBody(){return this.isPunct("{")?this.parseStmtBlock():this.parseAssign()}parseTernary(){let e=this.parseNullish();if(this.isPunct("?")){this.next();let n=this.parseAssign();this.expect(":","in conditional expression");let i=this.parseAssign();return{k:"cond",test:e,then:n,else:i,loc:e.loc}}return e}binaryLevel(e,n,i={}){let s=e();for(;;){let r=this.tok,a;if(r.kind==="punct"?a=n[r.value]:r.kind==="ident"&&(a=i[r.value]),!a)return s;this.next();let o=e();s={k:"binary",op:a,left:s,right:o,loc:s.loc}}}parseNullish(){return this.binaryLevel(()=>this.parseOr(),{"??":"??"})}parseOr(){return this.binaryLevel(()=>this.parseAnd(),{"||":"||"},{or:"||"})}parseAnd(){return this.binaryLevel(()=>this.parseEquality(),{"&&":"&&"},{and:"&&"})}parseEquality(){return this.binaryLevel(()=>this.parseRelational(),{"==":"==","!=":"!="})}parseRelational(){return this.binaryLevel(()=>this.parseAdditive(),{"<":"<",">":">","<=":"<=",">=":">="})}parseAdditive(){return this.binaryLevel(()=>this.parseMultiplicative(),{"+":"+","-":"-"})}parseMultiplicative(){return this.binaryLevel(()=>this.parseExponent(),{"*":"*","/":"/","%":"%"})}parseExponent(){let e=this.parseUnary();if(this.isPunct("**")){this.next();let n=this.parseExponent();return{k:"binary",op:"**",left:e,right:n,loc:e.loc}}return e}parseUnary(){let e=this.tok;return e.kind==="punct"&&(e.value==="!"||e.value==="-"||e.value==="+"||e.value==="~")?(this.next(),{k:"unary",op:e.value,arg:this.parseUnary(),loc:e.loc}):e.kind==="ident"&&(e.value==="not"||e.value==="typeof"||e.value==="await")?(this.next(),{k:"unary",op:e.value==="not"?"!":e.value,arg:this.parseUnary(),loc:e.loc}):this.isPunct("++")?(this.next(),{k:"update",op:"++",prefix:!0,target:this.parseUnary(),loc:e.loc}):this.parsePostfix()}parsePostfix(){let e=this.parseCallMember();return this.isPunct("++")&&this.sameLine()&&(this.next(),e={k:"update",op:"++",prefix:!1,target:e,loc:e.loc}),e}parseArgs(){let e=[];for(this.expect("(");!this.isPunct(")")&&this.tok.kind!=="eof";){let n=this.tok.loc;if(this.eat("..."))e.push({value:this.parseExpr(),spread:!0,loc:n});else if(this.tok.kind==="ident"&&this.isPunct(":",1)&&!this.isPunct(":",2)){let i=this.next().value;this.next(),e.push({name:i,value:this.parseExpr(),spread:!1,loc:n})}else e.push({value:this.parseExpr(),spread:!1,loc:n});if(!this.eat(","))break}return this.expect(")","to close the argument list"),e}parseCallMember(){let e;if(this.isIdent("new")){let n=this.next(),i=this.parsePrimary();for(;this.isPunct(".");){this.next();let r=this.expectIdent("a property name");i={k:"member",object:i,prop:r.value,optional:!1,loc:i.loc}}let s=this.isPunct("(")?this.parseArgs():[];e={k:"new",callee:i,args:s,loc:n.loc}}else e=this.parsePrimary();for(;;)if(this.isPunct(".")){this.next();let n=this.tok;n.kind!=="ident"&&this.fail(`Expected a property name after '.', found ${this.describe(n)}`),this.next(),e={k:"member",object:e,prop:n.value,optional:!1,loc:e.loc}}else if(this.isPunct("?."))if(this.next(),this.isPunct("("))e={k:"call",callee:e,args:this.parseArgs(),optional:!0,memo:!1,loc:e.loc};else if(this.isPunct("[")){this.next();let n=this.parseExpr();this.expect("]"),e={k:"index",object:e,index:n,optional:!0,loc:e.loc}}else{let n=this.expectIdent("a property name");e={k:"member",object:e,prop:n.value,optional:!0,loc:e.loc}}else if(this.isPunct("(")&&this.sameLine()){let n=!1,i=e;i.k==="id"&&i.name.startsWith("$")&&i.name.length>1&&i.name!=="$slot"&&(n=!0,i={...i,name:i.name.slice(1)}),e={k:"call",callee:i,args:this.parseArgs(),optional:!1,memo:n,loc:e.loc}}else if(this.isPunct("[")&&this.sameLine()){this.next();let n=this.parseExpr();this.expect("]"),e={k:"index",object:e,index:n,optional:!1,loc:e.loc}}else if(this.tok.kind==="template"&&this.tok.quote==="`"&&this.adjacent())this.fail("Tagged templates are not supported");else return e}parsePrimary(){let e=this.tok;switch(e.kind){case"number":return this.next(),{k:"lit",value:Number(e.value),loc:e.loc};case"string":return this.next(),{k:"lit",value:e.value,loc:e.loc};case"template":return this.next(),this.parseTemplate(e);case"ident":return this.next(),e.value==="true"||e.value==="false"?{k:"lit",value:e.value==="true",loc:e.loc}:e.value==="null"||e.value==="undefined"?{k:"lit",value:null,loc:e.loc}:{k:"id",name:e.value,loc:e.loc};case"punct":if(e.value==="("){this.next();let n=this.parseExpr();return this.expect(")","to close the parenthesized expression"),n}if(e.value==="[")return this.parseArray();if(e.value==="{")return this.parseObject();break;default:break}return this.fail(`Expected an expression, found ${this.describe(e)}`)}parseArray(){let e=this.next(),n=[];for(;!this.isPunct("]")&&this.tok.kind!=="eof";){let i=this.eat("...");if(n.push({value:this.parseExpr(),spread:i}),!this.eat(",")&&!this.tok.newlineBefore)break}return this.expect("]","to close the array"),{k:"array",items:n,loc:e.loc}}parseObject(){let e=this.next(),n=[];for(;!this.isPunct("}")&&this.tok.kind!=="eof";){let i=this.tok.loc;if(this.eat("..."))n.push({key:"",value:this.parseExpr(),spread:!0,loc:i});else if(this.isPunct("[")){this.next();let s=this.parseExpr();this.expect("]"),this.expect(":"),n.push({key:"",computedKey:s,value:this.parseExpr(),spread:!1,loc:i})}else{let s=this.tok;s.kind!=="ident"&&s.kind!=="string"&&s.kind!=="number"&&this.fail(`Expected an object key, found ${this.describe(s)}`),this.next();let r=s.value;for(;s.kind==="ident"&&this.isPunct("-")&&this.adjacent()&&this.peek(1).kind==="ident";)this.next(),r+="-"+this.next().value;this.eat(":")?n.push({key:r,value:this.parseExpr(),spread:!1,loc:i}):s.kind==="ident"?n.push({key:r,value:{k:"id",name:r,loc:s.loc},spread:!1,loc:i}):this.fail("Expected ':' after object key")}if(!this.eat(",")&&!this.eat(";")&&!this.tok.newlineBefore)break}return this.expect("}","to close the object"),{k:"object",props:n,loc:e.loc}}parseTemplate(e){let n=[],i=e.value,s="",r=0;for(;r<i.length;){let a=i[r];if(a==="\\"&&(i[r+1]==="{"||i[r+1]==="}")){s+=i[r+1],r+=2;continue}if(a==="{"){let o=1,c=r+1,h="";for(;c<i.length;c++){let d=i[c];if(h){d==="\\"?c++:d===h&&(h="");continue}if(d==='"'||d==="'")h=d;else if(d==="{")o++;else if(d==="}"&&--o===0)break}o!==0&&this.fail("Unmatched '{' in formatted string",e,"Escape literal braces as \\{ and \\}");let u=i.slice(r+1,c);s&&n.push(s),s="";let f=t.fromTokens(ge(u,this.file,{...e.loc,col:e.loc.col+2+r}),this.file),x=f.parseExpr();f.tok.kind!=="eof"&&f.fail(`Unexpected ${f.describe(f.tok)} inside formatted string`),n.push(x),r=c+1;continue}s+=a,r++}return s&&n.push(s),n.every(a=>typeof a=="string")?{k:"lit",value:n.join(""),loc:e.loc}:{k:"tpl",parts:n,loc:e.loc}}};function bi(){return{vars:[],functions:[],styles:[],scripts:[],lifecycle:[],watchers:[]}}function Kt(t){if(t.k==="assign"||t.k==="update"||t.k==="unary"&&t.op==="await")return!0;if(t.k==="call"){let e=Gt(t.callee);return e==="console"||e==="alert"||e==="localStorage"||e==="sessionStorage"||e==="history"}return!1}function Gt(t){if(t.k==="id")return t.name;if(t.k==="member")return Gt(t.object)}function yi(t){let e=t.split(/[?#]/)[0].toLowerCase();return/\.(css|scss|sass)$/.test(e)?"style":e.endsWith(".sinth")?"sinth":e.endsWith(".json")?"json":/^https?:\/\//.test(e)||e.startsWith("//")?"script":/\.(m?js|ts|mts|jsx|tsx)$/.test(e)?"module":e.startsWith("sinth:")||e.startsWith(".")||e.startsWith("/")?"sinth":"module"}function Jt(t,e){return new we(t,e).parseFile()}var ki=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,7,9,32,4,318,1,31,4,33,15,71,10,50,3,123,2,54,14,32,10,3,1,11,3,46,10,8,0,46,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,3,0,158,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,68,8,2,0,3,0,2,3,2,4,2,0,15,1,83,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,7,19,58,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,199,7,137,9,54,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,55,9,7,0,259,3,10,1,2,0,49,6,4,4,14,10,5350,0,7,14,11465,27,2343,9,87,9,39,4,60,6,26,9,535,9,470,0,2,54,8,3,82,0,12,1,19628,1,4178,9,519,45,3,22,481,1,61,4,4,5,9,7,3,6,31,3,149,2,12,2,9,1,3,0,33,1,1357,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,101,0,161,6,10,9,357,0,62,13,499,13,245,1,2,9,233,0,3,0,8,1,6,0,475,6,110,6,6,9,4759,9,787719,239],tn=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,4,51,13,310,10,21,11,7,25,5,2,41,2,13,65,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,7,25,39,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,39,27,10,22,251,41,7,1,17,5,18,21,18,28,11,0,9,21,43,17,47,20,28,22,13,52,58,1,3,0,14,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,20,1,64,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,31,9,2,0,3,0,2,37,2,0,26,0,2,0,45,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,38,6,186,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,19,72,18,0,182,32,32,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,24,43,22,0,239,18,16,0,2,12,2,33,125,0,80,921,103,111,6,206,13,310,2314,96,16,1071,18,5,26,3994,6,582,6842,29,1763,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,433,44,212,63,33,24,3,24,45,74,6,0,67,12,65,1,2,0,15,4,10,7386,37,33,96,114,14,913,15,50,7710,3,2,6,2,1,2,296,10,0,30,2,3,0,15,4,8,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,340,2,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,1845,129,15,6,55,50,49,61,147,44,11,6,17,0,322,29,19,43,485,27,229,29,3,0,208,30,2,2,2,1,2,6,3,4,10,1,225,6,2,3,2,1,2,14,2,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42719,33,4382,2,5773,3,7472,16,621,2467,541,1507,4938,6,8489,39815,11327],wi="\u200C\u200D\xB7\u0300-\u036F\u0387\u0483-\u0487\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7-\u05C9\u0610-\u061A\u064B-\u0669\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u06F0-\u06F9\u0711\u0730-\u074A\u07A6-\u07B0\u07C0-\u07C9\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0897-\u089F\u08CA-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0966-\u096F\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09E6-\u09EF\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A66-\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AE6-\u0AEF\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B53-\u0B57\u0B62\u0B63\u0B66-\u0B6F\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0BE6-\u0BEF\u0C00-\u0C04\u0C3C\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0CE6-\u0CEF\u0CF3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D66-\u0D6F\u0D81-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0E50-\u0E59\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECE\u0ED0-\u0ED9\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1040-\u1049\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F-\u109D\u135D-\u135F\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u17E0-\u17E9\u180B-\u180D\u180F-\u1819\u18A9\u1920-\u192B\u1930-\u193B\u1946-\u194F\u19D0-\u19DA\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AB0-\u1ABD\u1ABF-\u1AF0\u1B00-\u1B04\u1B34-\u1B44\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BB0-\u1BB9\u1BE6-\u1BF3\u1C24-\u1C37\u1C40-\u1C49\u1C50-\u1C59\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DFF\u200C\u200D\u203F\u2040\u2054\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\u30FB\uA620-\uA629\uA66F\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA82C\uA880\uA881\uA8B4-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F1\uA8FF-\uA909\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9D0-\uA9D9\uA9E5\uA9F0-\uA9F9\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA50-\uAA59\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uABF0-\uABF9\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFF10-\uFF19\uFF3F\uFF65",nn="\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0558\u0559\u0560-\u0588\u058B\u058C\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088F\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5C\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDC-\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C8A\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u208F-\u209F\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7DD\uA7E2\uA7F1-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB6C\uAB6D\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC",ot={3:"abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile",5:"class enum extends super const export import",6:"enum",strict:"implements interface let package private protected public static yield",strictBind:"eval arguments"},lt="break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this",Si={5:lt,"5module":lt+" export import",6:lt+" const class extends export import super"},sn=/^in(stanceof)?$/,Ci=new RegExp("["+nn+"]"),Ei=new RegExp("["+nn+wi+"]");function ut(t,e){for(var n=65536,i=0;i<e.length;i+=2){if(n+=e[i],n>t)return!1;if(n+=e[i+1],n>=t)return!0}return!1}function ae(t,e){return t<65?t===36:t<91?!0:t<97?t===95:t<123?!0:t<=65535?t>=170&&Ci.test(String.fromCharCode(t)):e===!1?!1:ut(t,tn)}function ue(t,e){return t<48?t===36:t<58?!0:t<65?!1:t<91?!0:t<97?t===95:t<123?!0:t<=65535?t>=170&&Ei.test(String.fromCharCode(t)):e===!1?!1:ut(t,tn)||ut(t,ki)}var I=function(e,n){n===void 0&&(n={}),this.label=e,this.keyword=n.keyword,this.beforeExpr=!!n.beforeExpr,this.startsExpr=!!n.startsExpr,this.isLoop=!!n.isLoop,this.isAssign=!!n.isAssign,this.prefix=!!n.prefix,this.postfix=!!n.postfix,this.binop=n.binop||null,this.updateContext=null};function Q(t,e){return new I(t,{beforeExpr:!0,binop:e})}var Y={beforeExpr:!0},W={startsExpr:!0},dt={};function N(t,e){return e===void 0&&(e={}),e.keyword=t,dt[t]=new I(t,e)}var l={num:new I("num",W),regexp:new I("regexp",W),string:new I("string",W),name:new I("name",W),privateId:new I("privateId",W),eof:new I("eof"),bracketL:new I("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new I("]"),braceL:new I("{",{beforeExpr:!0,startsExpr:!0}),braceR:new I("}"),parenL:new I("(",{beforeExpr:!0,startsExpr:!0}),parenR:new I(")"),comma:new I(",",Y),semi:new I(";",Y),colon:new I(":",Y),dot:new I("."),question:new I("?",Y),questionDot:new I("?."),arrow:new I("=>",Y),template:new I("template"),invalidTemplate:new I("invalidTemplate"),ellipsis:new I("...",Y),backQuote:new I("`",W),dollarBraceL:new I("${",{beforeExpr:!0,startsExpr:!0}),eq:new I("=",{beforeExpr:!0,isAssign:!0}),assign:new I("_=",{beforeExpr:!0,isAssign:!0}),incDec:new I("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new I("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:Q("||",1),logicalAND:Q("&&",2),bitwiseOR:Q("|",3),bitwiseXOR:Q("^",4),bitwiseAND:Q("&",5),equality:Q("==/!=/===/!==",6),relational:Q("</>/<=/>=",7),bitShift:Q("<</>>/>>>",8),plusMin:new I("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:Q("%",10),star:Q("*",10),slash:Q("/",10),starstar:new I("**",{beforeExpr:!0}),coalesce:Q("??",1),_break:N("break"),_case:N("case",Y),_catch:N("catch"),_continue:N("continue"),_debugger:N("debugger"),_default:N("default",Y),_do:N("do",{isLoop:!0,beforeExpr:!0}),_else:N("else",Y),_finally:N("finally"),_for:N("for",{isLoop:!0}),_function:N("function",W),_if:N("if"),_return:N("return",Y),_switch:N("switch"),_throw:N("throw",Y),_try:N("try"),_var:N("var"),_const:N("const"),_while:N("while",{isLoop:!0}),_with:N("with"),_new:N("new",{beforeExpr:!0,startsExpr:!0}),_this:N("this",W),_super:N("super",W),_class:N("class",W),_extends:N("extends",Y),_export:N("export"),_import:N("import",W),_null:N("null",W),_true:N("true",W),_false:N("false",W),_in:N("in",{beforeExpr:!0,binop:7}),_instanceof:N("instanceof",{beforeExpr:!0,binop:7}),_typeof:N("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:N("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:N("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},z=/\r\n?|\n|\u2028|\u2029/,$i=new RegExp(z.source,"g");function _e(t){return t===10||t===13||t===8232||t===8233}function rn(t,e,n){n===void 0&&(n=t.length);for(var i=e;i<n;i++){var s=t.charCodeAt(i);if(_e(s))return i<n-1&&s===13&&t.charCodeAt(i+1)===10?i+2:i+1}return-1}var an=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,M=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,on=Object.prototype,_i=on.hasOwnProperty,Ni=on.toString,Ne=Object.hasOwn||(function(t,e){return _i.call(t,e)}),Zt=Array.isArray||(function(t){return Ni.call(t)==="[object Array]"}),Qt=Object.create(null);function ve(t){return Qt[t]||(Qt[t]=new RegExp("^(?:"+t.replace(/ /g,"|")+")$"))}function he(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode((t>>10)+55296,(t&1023)+56320))}var Ii=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,Le=function(e,n){this.line=e,this.column=n};Le.prototype.offset=function(e){return new Le(this.line,this.column+e)};var Je=function(e,n,i){this.start=n,this.end=i,e.sourceFile!==null&&(this.source=e.sourceFile)};function ln(t,e){for(var n=1,i=0;;){var s=rn(t,i,e);if(s<0)return new Le(n,e-i);++n,i=s}}var ht={ecmaVersion:null,sourceType:"script",strict:!1,onInsertedSemicolon:null,onTrailingComma:null,allowReserved:null,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowAwaitOutsideFunction:null,allowSuperOutsideMethod:null,allowHashBang:!1,checkPrivateFields:!0,locations:!1,startLocation:null,onToken:null,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null,preserveParens:!1},Yt=!1;function Ai(t){var e={};for(var n in ht)e[n]=t&&Ne(t,n)?t[n]:ht[n];if(e.ecmaVersion==="latest"?e.ecmaVersion=1e8:e.ecmaVersion==null?(!Yt&&typeof console=="object"&&console.warn&&(Yt=!0,console.warn(`Since Acorn 8.0.0, options.ecmaVersion is required.
|
|
13
|
+
Defaulting to 2020, but this will stop working in the future.`)),e.ecmaVersion=11):e.ecmaVersion>=2015&&(e.ecmaVersion-=2009),e.allowReserved==null&&(e.allowReserved=e.ecmaVersion<5),(!t||t.allowHashBang==null)&&(e.allowHashBang=e.ecmaVersion>=14),Zt(e.onToken)){var i=e.onToken;e.onToken=function(s){return i.push(s)}}if(Zt(e.onComment)&&(e.onComment=Pi(e,e.onComment)),e.sourceType==="commonjs"&&e.allowAwaitOutsideFunction)throw new Error("Cannot use allowAwaitOutsideFunction with sourceType: commonjs");return e}function Pi(t,e){return function(n,i,s,r,a,o){var c={type:n?"Block":"Line",value:i,start:s,end:r};t.locations&&(c.loc=new Je(this,a,o)),t.ranges&&(c.range=[s,r]),e.push(c)}}var Se=1,Ce=2,mt=4,cn=8,gt=16,un=32,Ze=64,hn=128,Ee=256,Re=512,pn=1024,Qe=Se|Ce|Ee;function vt(t,e){return Ce|(t?mt:0)|(e?cn:0)}var ze=0,xt=1,fe=2,fn=3,dn=4,mn=5,D=function(e,n,i){this.options=e=Ai(e),this.sourceFile=e.sourceFile,this.keywords=ve(Si[e.ecmaVersion>=6?6:e.sourceType==="module"?"5module":5]);var s="";e.allowReserved!==!0&&(s=ot[e.ecmaVersion>=6?6:e.ecmaVersion===5?5:3],e.sourceType==="module"&&(s+=" await")),this.reservedWords=ve(s);var r=(s?s+" ":"")+ot.strict;this.reservedWordsStrict=ve(r),this.reservedWordsStrictBind=ve(r+" "+ot.strictBind),this.input=String(n),this.containsEsc=!1,this.pos=i||0,this.curLine=1,e.startLocation?(this.lineStart=this.pos-e.startLocation.column,this.curLine=e.startLocation.line):i?(this.lineStart=this.input.lastIndexOf(`
|
|
14
|
+
`,i-1)+1,this.options.locations&&(this.curLine=this.input.slice(0,this.lineStart).split(z).length)):this.lineStart=0,this.type=l.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=this.initialContext(),this.exprAllowed=!0,this.inModule=e.sourceType==="module",this.strict=this.inModule||e.strict===!0||this.strictDirective(this.pos),this.potentialArrowAt=-1,this.potentialArrowInForAwait=!1,this.yieldPos=this.awaitPos=this.awaitIdentPos=0,this.labels=[],this.undefinedExports=Object.create(null),this.pos===0&&e.allowHashBang&&this.input.slice(0,2)==="#!"&&this.skipLineComment(2),this.scopeStack=[],this.enterScope(this.options.sourceType==="commonjs"?Ce:Se),this.regexpState=null,this.privateNameStack=[]},ee={inFunction:{configurable:!0},inGenerator:{configurable:!0},inAsync:{configurable:!0},canAwait:{configurable:!0},allowReturn:{configurable:!0},allowSuper:{configurable:!0},allowDirectSuper:{configurable:!0},treatFunctionsAsVar:{configurable:!0},allowNewDotTarget:{configurable:!0},allowUsing:{configurable:!0},inClassStaticBlock:{configurable:!0}};D.prototype.parse=function(){var e=this,n=this.options.program||this.startNode();return this.nextToken(),this.catchStackOverflow(function(){return e.parseTopLevel(n)})};ee.inFunction.get=function(){return(this.currentVarScope().flags&Ce)>0};ee.inGenerator.get=function(){return(this.currentVarScope().flags&cn)>0};ee.inAsync.get=function(){return(this.currentVarScope().flags&mt)>0};ee.canAwait.get=function(){for(var t=this.scopeStack.length-1;t>=0;t--){var e=this.scopeStack[t],n=e.flags;if(n&(Ee|Re))return!1;if(n&Ce)return(n&mt)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction};ee.allowReturn.get=function(){return!!(this.inFunction||this.options.allowReturnOutsideFunction&&this.currentVarScope().flags&Se)};ee.allowSuper.get=function(){var t=this.currentThisScope(),e=t.flags;return(e&Ze)>0||this.options.allowSuperOutsideMethod};ee.allowDirectSuper.get=function(){return(this.currentThisScope().flags&hn)>0};ee.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())};ee.allowNewDotTarget.get=function(){for(var t=this.scopeStack.length-1;t>=0;t--){var e=this.scopeStack[t],n=e.flags;if(n&(Ee|Re)||n&Ce&&!(n>))return!0}return!1};ee.allowUsing.get=function(){var t=this.currentScope(),e=t.flags;return!(e&pn||!this.inModule&&e&Se)};ee.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&Ee)>0};D.extend=function(){for(var e=[],n=arguments.length;n--;)e[n]=arguments[n];for(var i=this,s=0;s<e.length;s++)i=e[s](i);return i};D.parse=function(e,n){return new this(n,e).parse()};D.parseExpressionAt=function(e,n,i){var s=new this(i,e,n);return s.nextToken(),s.parseExpression()};D.tokenizer=function(e,n){return new this(n,e)};Object.defineProperties(D.prototype,ee);var U=D.prototype,Ti=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;U.strictDirective=function(t){if(this.options.ecmaVersion<5)return!1;for(;;){M.lastIndex=t,t+=M.exec(this.input)[0].length;var e=Ti.exec(this.input.slice(t));if(!e)return!1;if((e[1]||e[2])==="use strict"){M.lastIndex=t+e[0].length;var n=M.exec(this.input),i=n.index+n[0].length,s=this.input.charAt(i);return s===";"||s==="}"||z.test(n[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(s)||s==="!"&&this.input.charAt(i+1)==="="||s==="i"&&Li(this,i))}t+=e[0].length,M.lastIndex=t,t+=M.exec(this.input)[0].length,this.input[t]===";"&&t++}};function Li(t,e){for(var n=e+1,i=Math.min(t.input.length,e+11);n<i;){var s=t.fullCharCodeAt(n);if(!ue(s,!0))break;n+=s<=65535?1:2}return n===e+2&&t.input.slice(e,n)==="in"||n===e+10&&t.input.slice(e,n)==="instanceof"}U.eat=function(t){return this.type===t?(this.next(),!0):!1};U.isContextual=function(t){return this.type===l.name&&this.value===t&&!this.containsEsc};U.eatContextual=function(t){return this.isContextual(t)?(this.next(),!0):!1};U.catchStackOverflow=function(t){try{return t()}catch(e){if(e instanceof Error&&(/\bstack\b.*\b(exceeded|overflow)\b/i.test(e.message)||/\btoo much recursion\b/i.test(e.message)))this.raise(this.start,"Not enough stack space to parse input");else throw e}};U.expectContextual=function(t){this.eatContextual(t)||this.unexpected()};U.canInsertSemicolon=function(){return this.type===l.eof||this.type===l.braceR||z.test(this.input.slice(this.lastTokEnd,this.start))};U.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0};U.semicolon=function(){!this.eat(l.semi)&&!this.insertSemicolon()&&this.unexpected()};U.afterTrailingComma=function(t,e){if(this.type===t)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),e||this.next(),!0};U.expect=function(t){this.eat(t)||this.unexpected()};U.unexpected=function(t){this.raise(t??this.start,"Unexpected token")};var Ye=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};U.checkPatternErrors=function(t,e){if(t){t.trailingComma>-1&&this.raiseRecoverable(t.trailingComma,"Comma is not permitted after the rest element");var n=e?t.parenthesizedAssign:t.parenthesizedBind;n>-1&&this.raiseRecoverable(n,e?"Assigning to rvalue":"Parenthesized pattern")}};U.checkExpressionErrors=function(t,e){if(!t)return!1;var n=t.shorthandAssign,i=t.doubleProto;if(!e)return n>=0||i>=0;n>=0&&this.raise(n,"Shorthand property assignments are valid only in destructuring patterns"),i>=0&&this.raiseRecoverable(i,"Redefinition of __proto__ property")};U.checkYieldAwaitInDefaultParams=function(){this.yieldPos&&(!this.awaitPos||this.yieldPos<this.awaitPos)&&this.raise(this.yieldPos,"Yield expression cannot be a default value"),this.awaitPos&&this.raise(this.awaitPos,"Await expression cannot be a default value")};U.isSimpleAssignTarget=function(t){return t.type==="ParenthesizedExpression"?this.isSimpleAssignTarget(t.expression):t.type==="Identifier"||t.type==="MemberExpression"};var y=D.prototype;y.parseTopLevel=function(t){var e=Object.create(null);for(t.body||(t.body=[]);this.type!==l.eof;){var n=this.parseStatement(null,!0,e);t.body.push(n)}if(this.inModule)for(var i=0,s=Object.keys(this.undefinedExports);i<s.length;i+=1){var r=s[i];this.raiseRecoverable(this.undefinedExports[r].start,"Export '"+r+"' is not defined")}return this.adaptDirectivePrologue(t.body),this.next(),t.sourceType=this.options.sourceType==="commonjs"?"script":this.options.sourceType,this.finishNode(t,"Program")};var bt={kind:"loop"},Ri={kind:"switch"};y.isLet=function(t){if(this.options.ecmaVersion<6||!this.isContextual("let"))return!1;M.lastIndex=this.pos;var e=M.exec(this.input),n=this.pos+e[0].length,i=this.fullCharCodeAt(n);if(i===91||i===92)return!0;if(t)return!1;if(i===123)return!0;if(ae(i)){var s=n;do n+=i<=65535?1:2;while(ue(i=this.fullCharCodeAt(n)));if(i===92)return!0;var r=this.input.slice(s,n);if(!sn.test(r))return!0}return!1};y.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;M.lastIndex=this.pos;var t=M.exec(this.input),e=this.pos+t[0].length,n;return!z.test(this.input.slice(this.pos,e))&&this.input.slice(e,e+8)==="function"&&(e+8===this.input.length||!(ue(n=this.fullCharCodeAt(e+8))||n===92))};y.isUsingKeyword=function(t,e){if(this.options.ecmaVersion<17||!this.isContextual(t?"await":"using"))return!1;M.lastIndex=this.pos;var n=M.exec(this.input),i=this.pos+n[0].length;if(z.test(this.input.slice(this.pos,i)))return!1;if(t){var s=i+5,r;if(this.input.slice(i,s)!=="using"||s===this.input.length||ue(r=this.fullCharCodeAt(s))||r===92)return!1;M.lastIndex=s;var a=M.exec(this.input);if(i=s+a[0].length,a&&z.test(this.input.slice(s,i)))return!1}var o=this.fullCharCodeAt(i);if(!ae(o)&&o!==92)return!1;var c=i;do i+=o<=65535?1:2;while(ue(o=this.fullCharCodeAt(i)));if(o===92)return!0;var h=this.input.slice(c,i);if(sn.test(h))return!1;if(e&&!t&&h==="of"){M.lastIndex=i;var u=M.exec(this.input);if(i=i+u[0].length,this.input.charCodeAt(i)!==61||(o=this.input.charCodeAt(i+1))===61||o===62)return!1}return!0};y.isAwaitUsing=function(t){return this.isUsingKeyword(!0,t)};y.isUsing=function(t){return this.isUsingKeyword(!1,t)};y.parseStatement=function(t,e,n){var i=this.type,s=this.startNode(),r;switch(this.isLet(t)&&(i=l._var,r="let"),i){case l._break:case l._continue:return this.parseBreakContinueStatement(s,i.keyword);case l._debugger:return this.parseDebuggerStatement(s);case l._do:return this.parseDoStatement(s);case l._for:return this.parseForStatement(s);case l._function:return t&&(this.strict||t!=="if"&&t!=="label")&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(s,!1,!t);case l._class:return t&&this.unexpected(),this.parseClass(s,!0);case l._if:return this.parseIfStatement(s);case l._return:return this.parseReturnStatement(s);case l._switch:return this.parseSwitchStatement(s);case l._throw:return this.parseThrowStatement(s);case l._try:return this.parseTryStatement(s);case l._const:case l._var:return r=r||this.value,t&&r!=="var"&&this.unexpected(),this.parseVarStatement(s,r);case l._while:return this.parseWhileStatement(s);case l._with:return this.parseWithStatement(s);case l.braceL:return this.parseBlock(!0,s);case l.semi:return this.parseEmptyStatement(s);case l._export:case l._import:if(this.options.ecmaVersion>10&&i===l._import){M.lastIndex=this.pos;var a=M.exec(this.input),o=this.pos+a[0].length,c=this.input.charCodeAt(o);if(c===40||c===46)return this.parseExpressionStatement(s,this.parseExpression())}return this.options.allowImportExportEverywhere||(e||this.raise(this.start,"'import' and 'export' may only appear at the top level"),this.inModule||this.raise(this.start,"'import' and 'export' may appear only with 'sourceType: module'")),i===l._import?this.parseImport(s):this.parseExport(s,n);default:if(this.isAsyncFunction())return t&&this.unexpected(),this.next(),this.parseFunctionStatement(s,!0,!t);var h=this.isAwaitUsing(!1)?"await using":this.isUsing(!1)?"using":null;if(h)return this.allowUsing||this.raise(this.start,"Using declaration cannot appear in the top level when source type is `script` or in the bare case statement"),t&&this.raise(this.start,"Using declaration is not allowed in single-statement positions"),h==="await using"&&(this.canAwait||this.raise(this.start,"Await using cannot appear outside of async function"),this.next()),this.next(),this.parseVar(s,!1,h),this.semicolon(),this.finishNode(s,"VariableDeclaration");var u=this.value,f=this.parseExpression();return i===l.name&&f.type==="Identifier"&&this.eat(l.colon)?this.parseLabeledStatement(s,u,f,t):this.parseExpressionStatement(s,f)}};y.parseBreakContinueStatement=function(t,e){var n=e==="break";this.next(),this.eat(l.semi)||this.insertSemicolon()?t.label=null:this.type!==l.name?this.unexpected():(t.label=this.parseIdent(),this.semicolon());for(var i=0;i<this.labels.length;++i){var s=this.labels[i];if((t.label==null||s.name===t.label.name)&&(s.kind!=null&&(n||s.kind==="loop")||t.label&&n))break}return i===this.labels.length&&this.raise(t.start,"Unsyntactic "+e),this.finishNode(t,n?"BreakStatement":"ContinueStatement")};y.parseDebuggerStatement=function(t){return this.next(),this.semicolon(),this.finishNode(t,"DebuggerStatement")};y.parseDoStatement=function(t){return this.next(),this.labels.push(bt),t.body=this.parseStatement("do"),this.labels.pop(),this.expect(l._while),t.test=this.parseParenExpression(),this.options.ecmaVersion>=6?this.eat(l.semi):this.semicolon(),this.finishNode(t,"DoWhileStatement")};y.parseForStatement=function(t){this.next();var e=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(bt),this.enterScope(0),this.expect(l.parenL),this.type===l.semi)return e>-1&&this.unexpected(e),this.parseFor(t,null);var n=this.isLet();if(this.type===l._var||this.type===l._const||n){var i=this.startNode(),s=n?"let":this.value;return this.next(),this.parseVar(i,!0,s),this.finishNode(i,"VariableDeclaration"),this.parseForAfterInit(t,i,e)}var r=this.isContextual("let"),a=!1,o=this.isUsing(!0)?"using":this.isAwaitUsing(!0)?"await using":null;if(o){var c=this.startNode();return this.next(),o==="await using"&&(this.canAwait||this.raise(this.start,"Await using cannot appear outside of async function"),this.next()),this.parseVar(c,!0,o),this.finishNode(c,"VariableDeclaration"),this.parseForAfterInit(t,c,e)}var h=this.containsEsc,u=new Ye,f=this.start,x=e>-1?this.parseExprSubscripts(u,"await"):this.parseExpression(!0,u);return this.type===l._in||(a=this.options.ecmaVersion>=6&&this.isContextual("of"))?(e>-1?(this.type===l._in&&this.unexpected(e),t.await=!0):a&&this.options.ecmaVersion>=8&&(x.start===f&&!h&&x.type==="Identifier"&&x.name==="async"?this.unexpected():this.options.ecmaVersion>=9&&(t.await=!1)),r&&a&&this.raise(x.start,"The left-hand side of a for-of loop may not start with 'let'."),this.toAssignable(x,!1,u),this.checkLValPattern(x),this.parseForIn(t,x)):(this.checkExpressionErrors(u,!0),e>-1&&this.unexpected(e),this.parseFor(t,x))};y.parseForAfterInit=function(t,e,n){return(this.type===l._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&e.declarations.length===1?(this.type===l._in?((e.kind==="using"||e.kind==="await using")&&!e.declarations[0].init&&this.raise(this.start,"Using declaration is not allowed in for-in loops"),this.options.ecmaVersion>=9&&n>-1&&this.unexpected(n)):this.options.ecmaVersion>=9&&(t.await=n>-1),this.parseForIn(t,e)):(n>-1&&this.unexpected(n),this.parseFor(t,e))};y.parseFunctionStatement=function(t,e,n){return this.next(),this.parseFunction(t,Te|(n?0:pt),!1,e)};y.parseIfStatement=function(t){return this.next(),t.test=this.parseParenExpression(),t.consequent=this.parseStatement("if"),t.alternate=this.eat(l._else)?this.parseStatement("if"):null,this.finishNode(t,"IfStatement")};y.parseReturnStatement=function(t){return this.allowReturn||this.raise(this.start,"'return' outside of function"),this.next(),this.eat(l.semi)||this.insertSemicolon()?t.argument=null:(t.argument=this.parseExpression(),this.semicolon()),this.finishNode(t,"ReturnStatement")};y.parseSwitchStatement=function(t){this.next(),t.discriminant=this.parseParenExpression(),t.cases=[],this.expect(l.braceL),this.labels.push(Ri),this.enterScope(pn);for(var e,n=!1;this.type!==l.braceR;)if(this.type===l._case||this.type===l._default){var i=this.type===l._case;e&&this.finishNode(e,"SwitchCase"),t.cases.push(e=this.startNode()),e.consequent=[],this.next(),i?e.test=this.parseExpression():(n&&this.raiseRecoverable(this.lastTokStart,"Multiple default clauses"),n=!0,e.test=null),this.expect(l.colon)}else e||this.unexpected(),e.consequent.push(this.parseStatement(null));return this.exitScope(),e&&this.finishNode(e,"SwitchCase"),this.next(),this.labels.pop(),this.finishNode(t,"SwitchStatement")};y.parseThrowStatement=function(t){return this.next(),z.test(this.input.slice(this.lastTokEnd,this.start))&&this.raise(this.lastTokEnd,"Illegal newline after throw"),t.argument=this.parseExpression(),this.semicolon(),this.finishNode(t,"ThrowStatement")};var Oi=[];y.parseCatchClauseParam=function(){var t=this.parseBindingAtom(),e=t.type==="Identifier";return this.enterScope(e?un:0),this.checkLValPattern(t,e?dn:fe),this.expect(l.parenR),t};y.parseTryStatement=function(t){if(this.next(),t.block=this.parseBlock(),t.handler=null,this.type===l._catch){var e=this.startNode();this.next(),this.eat(l.parenL)?e.param=this.parseCatchClauseParam():(this.options.ecmaVersion<10&&this.unexpected(),e.param=null,this.enterScope(0)),e.body=this.parseBlock(!1),this.exitScope(),t.handler=this.finishNode(e,"CatchClause")}return t.finalizer=this.eat(l._finally)?this.parseBlock():null,!t.handler&&!t.finalizer&&this.raise(t.start,"Missing catch or finally clause"),this.finishNode(t,"TryStatement")};y.parseVarStatement=function(t,e,n){return this.next(),this.parseVar(t,!1,e,n),this.semicolon(),this.finishNode(t,"VariableDeclaration")};y.parseWhileStatement=function(t){return this.next(),t.test=this.parseParenExpression(),this.labels.push(bt),t.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(t,"WhileStatement")};y.parseWithStatement=function(t){return this.strict&&this.raise(this.start,"'with' in strict mode"),this.next(),t.object=this.parseParenExpression(),t.body=this.parseStatement("with"),this.finishNode(t,"WithStatement")};y.parseEmptyStatement=function(t){return this.next(),this.finishNode(t,"EmptyStatement")};y.parseLabeledStatement=function(t,e,n,i){for(var s=0,r=this.labels;s<r.length;s+=1){var a=r[s];a.name===e&&this.raise(n.start,"Label '"+e+"' is already declared")}for(var o=this.type.isLoop?"loop":this.type===l._switch?"switch":null,c=this.labels.length-1;c>=0;c--){var h=this.labels[c];if(h.statementStart===t.start)h.statementStart=this.start,h.kind=o;else break}return this.labels.push({name:e,kind:o,statementStart:this.start}),t.body=this.parseStatement(i?i.indexOf("label")===-1?i+"label":i:"label"),this.labels.pop(),t.label=n,this.finishNode(t,"LabeledStatement")};y.parseExpressionStatement=function(t,e){return t.expression=e,this.semicolon(),this.finishNode(t,"ExpressionStatement")};y.parseBlock=function(t,e,n){for(t===void 0&&(t=!0),e===void 0&&(e=this.startNode()),e.body=[],this.expect(l.braceL),t&&this.enterScope(0);this.type!==l.braceR;){var i=this.parseStatement(null);e.body.push(i)}return n&&(this.strict=!1),this.next(),t&&this.exitScope(),this.finishNode(e,"BlockStatement")};y.parseFor=function(t,e){return t.init=e,this.expect(l.semi),t.test=this.type===l.semi?null:this.parseExpression(),this.expect(l.semi),t.update=this.type===l.parenR?null:this.parseExpression(),this.expect(l.parenR),t.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(t,"ForStatement")};y.parseForIn=function(t,e){var n=this.type===l._in;return this.next(),e.type==="VariableDeclaration"&&e.declarations[0].init!=null&&(!n||this.options.ecmaVersion<8||this.strict||e.kind!=="var"||e.declarations[0].id.type!=="Identifier")&&this.raise(e.start,(n?"for-in":"for-of")+" loop variable declaration may not have an initializer"),t.left=e,t.right=n?this.parseExpression():this.parseMaybeAssign(),this.expect(l.parenR),t.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(t,n?"ForInStatement":"ForOfStatement")};y.parseVar=function(t,e,n,i){for(t.declarations=[],t.kind=n;;){var s=this.startNode();if(this.parseVarId(s,n),this.eat(l.eq)?s.init=this.parseMaybeAssign(e):!i&&n==="const"&&!(this.type===l._in||this.options.ecmaVersion>=6&&this.isContextual("of"))?this.unexpected():!i&&(n==="using"||n==="await using")&&this.options.ecmaVersion>=17&&this.type!==l._in&&!this.isContextual("of")?this.raise(this.lastTokEnd,"Missing initializer in "+n+" declaration"):!i&&s.id.type!=="Identifier"&&!(e&&(this.type===l._in||this.isContextual("of")))?this.raise(this.lastTokEnd,"Complex binding patterns require an initialization value"):s.init=null,t.declarations.push(this.finishNode(s,"VariableDeclarator")),!this.eat(l.comma))break}return t};y.parseVarId=function(t,e){t.id=e==="using"||e==="await using"?this.parseIdent():this.parseBindingAtom(),this.checkLValPattern(t.id,e==="var"?xt:fe,!1)};var Te=1,pt=2,gn=4;y.parseFunction=function(t,e,n,i,s){this.initFunction(t),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!i)&&(this.type===l.star&&e&pt&&this.unexpected(),t.generator=this.eat(l.star)),this.options.ecmaVersion>=8&&(t.async=!!i),e&Te&&(t.id=e&gn&&this.type!==l.name?null:this.parseIdent(),t.id&&!(e&pt)&&this.checkLValSimple(t.id,this.strict||t.generator||t.async?this.treatFunctionsAsVar?xt:fe:fn));var r=this.yieldPos,a=this.awaitPos,o=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(vt(t.async,t.generator)),e&Te||(t.id=this.type===l.name?this.parseIdent():null),this.parseFunctionParams(t),this.parseFunctionBody(t,n,!1,s),this.yieldPos=r,this.awaitPos=a,this.awaitIdentPos=o,this.finishNode(t,e&Te?"FunctionDeclaration":"FunctionExpression")};y.parseFunctionParams=function(t){this.expect(l.parenL),t.params=this.parseBindingList(l.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()};y.parseClass=function(t,e){this.next();var n=this.strict;this.strict=!0,this.parseClassId(t,e),this.parseClassSuper(t);var i=this.enterClassBody(),s=this.startNode(),r=!1;for(s.body=[],this.expect(l.braceL);this.type!==l.braceR;){var a=this.parseClassElement(t.superClass!==null);a&&(s.body.push(a),a.type==="MethodDefinition"&&a.kind==="constructor"?(r&&this.raiseRecoverable(a.start,"Duplicate constructor in the same class"),r=!0):a.key&&a.key.type==="PrivateIdentifier"&&Vi(i,a)&&this.raiseRecoverable(a.key.start,"Identifier '#"+a.key.name+"' has already been declared"))}return this.strict=n,this.next(),t.body=this.finishNode(s,"ClassBody"),this.exitClassBody(),this.finishNode(t,e?"ClassDeclaration":"ClassExpression")};y.parseClassElement=function(t){if(this.eat(l.semi))return null;var e=this.options.ecmaVersion,n=this.startNode(),i="",s=!1,r=!1,a="method",o=!1;if(this.eatContextual("static")){if(e>=13&&this.eat(l.braceL))return this.parseClassStaticBlock(n),n;this.isClassElementNameStart()||this.type===l.star?o=!0:i="static"}if(n.static=o,!i&&e>=8&&this.eatContextual("async")&&((this.isClassElementNameStart()||this.type===l.star)&&!this.canInsertSemicolon()?r=!0:i="async"),!i&&(e>=9||!r)&&this.eat(l.star)&&(s=!0),!i&&!r&&!s){var c=this.value;(this.eatContextual("get")||this.eatContextual("set"))&&(this.isClassElementNameStart()?a=c:i=c)}if(i?(n.computed=!1,n.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),n.key.name=i,this.finishNode(n.key,"Identifier")):this.parseClassElementName(n),e<13||this.type===l.parenL||a!=="method"||s||r){var h=!n.static&&qe(n,"constructor"),u=h&&t;h&&a!=="method"&&this.raise(n.key.start,"Constructor can't have get/set modifier"),n.kind=h?"constructor":a,this.parseClassMethod(n,s,r,u)}else this.parseClassField(n);return n};y.isClassElementNameStart=function(){return this.type===l.name||this.type===l.privateId||this.type===l.num||this.type===l.string||this.type===l.bracketL||this.type.keyword};y.parseClassElementName=function(t){this.type===l.privateId?(this.value==="constructor"&&this.raise(this.start,"Classes can't have an element named '#constructor'"),t.computed=!1,t.key=this.parsePrivateIdent()):this.parsePropertyName(t)};y.parseClassMethod=function(t,e,n,i){var s=t.key;t.kind==="constructor"?(e&&this.raise(s.start,"Constructor can't be a generator"),n&&this.raise(s.start,"Constructor can't be an async method")):t.static&&qe(t,"prototype")&&this.raise(s.start,"Classes may not have a static property named prototype");var r=t.value=this.parseMethod(e,n,i);return t.kind==="get"&&r.params.length!==0&&this.raiseRecoverable(r.start,"getter should have no params"),t.kind==="set"&&r.params.length!==1&&this.raiseRecoverable(r.start,"setter should have exactly one param"),t.kind==="set"&&r.params[0].type==="RestElement"&&this.raiseRecoverable(r.params[0].start,"Setter cannot use rest params"),this.finishNode(t,"MethodDefinition")};y.parseClassField=function(t){return qe(t,"constructor")?this.raise(t.key.start,"Classes can't have a field named 'constructor'"):t.static&&qe(t,"prototype")&&this.raise(t.key.start,"Classes can't have a static field named 'prototype'"),this.eat(l.eq)?(this.enterScope(Re|Ze),t.value=this.parseMaybeAssign(),this.exitScope()):t.value=null,this.semicolon(),this.finishNode(t,"PropertyDefinition")};y.parseClassStaticBlock=function(t){t.body=[];var e=this.labels;for(this.labels=[],this.enterScope(Ee|Ze);this.type!==l.braceR;){var n=this.parseStatement(null);t.body.push(n)}return this.next(),this.exitScope(),this.labels=e,this.finishNode(t,"StaticBlock")};y.parseClassId=function(t,e){this.type===l.name?(t.id=this.parseIdent(),e&&this.checkLValSimple(t.id,fe,!1)):(e===!0&&this.unexpected(),t.id=null)};y.parseClassSuper=function(t){t.superClass=this.eat(l._extends)?this.parseExprSubscripts(null,!1):null};y.enterClassBody=function(){var t={declared:Object.create(null),used:[]};return this.privateNameStack.push(t),t.declared};y.exitClassBody=function(){var t=this.privateNameStack.pop(),e=t.declared,n=t.used;if(this.options.checkPrivateFields)for(var i=this.privateNameStack.length,s=i===0?null:this.privateNameStack[i-1],r=0;r<n.length;++r){var a=n[r];Ne(e,a.name)||(s?s.used.push(a):this.raiseRecoverable(a.start,"Private field '#"+a.name+"' must be declared in an enclosing class"))}};function Vi(t,e){var n=e.key.name,i=t[n],s="true";return e.type==="MethodDefinition"&&(e.kind==="get"||e.kind==="set")&&(s=(e.static?"s":"i")+e.kind),i==="iget"&&s==="iset"||i==="iset"&&s==="iget"||i==="sget"&&s==="sset"||i==="sset"&&s==="sget"?(t[n]="true",!1):i?!0:(t[n]=s,!1)}function qe(t,e){var n=t.computed,i=t.key;return!n&&(i.type==="Identifier"&&i.name===e||i.type==="Literal"&&i.value===e)}y.parseExportAllDeclaration=function(t,e){return this.options.ecmaVersion>=11&&(this.eatContextual("as")?(t.exported=this.parseModuleExportName(),this.checkExport(e,t.exported,this.lastTokStart)):t.exported=null),this.expectContextual("from"),this.type!==l.string&&this.unexpected(),t.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(t.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(t,"ExportAllDeclaration")};y.parseExport=function(t,e){if(this.next(),this.eat(l.star))return this.parseExportAllDeclaration(t,e);if(this.eat(l._default))return this.checkExport(e,"default",this.lastTokStart),t.declaration=this.parseExportDefaultDeclaration(),this.finishNode(t,"ExportDefaultDeclaration");if(this.shouldParseExportStatement())t.declaration=this.parseExportDeclaration(t),t.declaration.type==="VariableDeclaration"?this.checkVariableExport(e,t.declaration.declarations):this.checkExport(e,t.declaration.id,t.declaration.id.start),t.specifiers=[],t.source=null,this.options.ecmaVersion>=16&&(t.attributes=[]);else{if(t.declaration=null,t.specifiers=this.parseExportSpecifiers(e),this.eatContextual("from"))this.type!==l.string&&this.unexpected(),t.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(t.attributes=this.parseWithClause());else{for(var n=0,i=t.specifiers;n<i.length;n+=1){var s=i[n];this.checkUnreserved(s.local),this.checkLocalExport(s.local),s.local.type==="Literal"&&this.raise(s.local.start,"A string literal cannot be used as an exported binding without `from`.")}t.source=null,this.options.ecmaVersion>=16&&(t.attributes=[])}this.semicolon()}return this.finishNode(t,"ExportNamedDeclaration")};y.parseExportDeclaration=function(t){return this.parseStatement(null)};y.parseExportDefaultDeclaration=function(){var t;if(this.type===l._function||(t=this.isAsyncFunction())){var e=this.startNode();return this.next(),t&&this.next(),this.parseFunction(e,Te|gn,!1,t)}else if(this.type===l._class){var n=this.startNode();return this.parseClass(n,"nullableID")}else{var i=this.parseMaybeAssign();return this.semicolon(),i}};y.checkExport=function(t,e,n){t&&(typeof e!="string"&&(e=e.type==="Identifier"?e.name:e.value),Ne(t,e)&&this.raiseRecoverable(n,"Duplicate export '"+e+"'"),t[e]=!0)};y.checkPatternExport=function(t,e){var n=e.type;if(n==="Identifier")this.checkExport(t,e,e.start);else if(n==="ObjectPattern")for(var i=0,s=e.properties;i<s.length;i+=1){var r=s[i];this.checkPatternExport(t,r)}else if(n==="ArrayPattern")for(var a=0,o=e.elements;a<o.length;a+=1){var c=o[a];c&&this.checkPatternExport(t,c)}else n==="Property"?this.checkPatternExport(t,e.value):n==="AssignmentPattern"?this.checkPatternExport(t,e.left):n==="RestElement"&&this.checkPatternExport(t,e.argument)};y.checkVariableExport=function(t,e){if(t)for(var n=0,i=e;n<i.length;n+=1){var s=i[n];this.checkPatternExport(t,s.id)}};y.shouldParseExportStatement=function(){return this.type.keyword==="var"||this.type.keyword==="const"||this.type.keyword==="class"||this.type.keyword==="function"||this.isLet()||this.isAsyncFunction()};y.parseExportSpecifier=function(t){var e=this.startNode();return e.local=this.parseModuleExportName(),e.exported=this.eatContextual("as")?this.parseModuleExportName():e.local,this.checkExport(t,e.exported,e.exported.start),this.finishNode(e,"ExportSpecifier")};y.parseExportSpecifiers=function(t){var e=[],n=!0;for(this.expect(l.braceL);!this.eat(l.braceR);){if(n)n=!1;else if(this.expect(l.comma),this.afterTrailingComma(l.braceR))break;e.push(this.parseExportSpecifier(t))}return e};y.parseImport=function(t){return this.next(),this.type===l.string?(t.specifiers=Oi,t.source=this.parseExprAtom()):(t.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),t.source=this.type===l.string?this.parseExprAtom():this.unexpected()),this.options.ecmaVersion>=16&&(t.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(t,"ImportDeclaration")};y.parseImportSpecifier=function(){var t=this.startNode();return t.imported=this.parseModuleExportName(),this.eatContextual("as")?t.local=this.parseIdent():(this.checkUnreserved(t.imported),t.local=t.imported),this.checkLValSimple(t.local,fe),this.finishNode(t,"ImportSpecifier")};y.parseImportDefaultSpecifier=function(){var t=this.startNode();return t.local=this.parseIdent(),this.checkLValSimple(t.local,fe),this.finishNode(t,"ImportDefaultSpecifier")};y.parseImportNamespaceSpecifier=function(){var t=this.startNode();return this.next(),this.expectContextual("as"),t.local=this.parseIdent(),this.checkLValSimple(t.local,fe),this.finishNode(t,"ImportNamespaceSpecifier")};y.parseImportSpecifiers=function(){var t=[],e=!0;if(this.type===l.name&&(t.push(this.parseImportDefaultSpecifier()),!this.eat(l.comma)))return t;if(this.type===l.star)return t.push(this.parseImportNamespaceSpecifier()),t;for(this.expect(l.braceL);!this.eat(l.braceR);){if(e)e=!1;else if(this.expect(l.comma),this.afterTrailingComma(l.braceR))break;t.push(this.parseImportSpecifier())}return t};y.parseWithClause=function(){var t=[];if(!this.eat(l._with))return t;this.expect(l.braceL);for(var e={},n=!0;!this.eat(l.braceR);){if(n)n=!1;else if(this.expect(l.comma),this.afterTrailingComma(l.braceR))break;var i=this.parseImportAttribute(),s=i.key.type==="Identifier"?i.key.name:i.key.value;Ne(e,s)&&this.raiseRecoverable(i.key.start,"Duplicate attribute key '"+s+"'"),e[s]=!0,t.push(i)}return t};y.parseImportAttribute=function(){var t=this.startNode();return t.key=this.type===l.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never"),this.expect(l.colon),this.type!==l.string&&this.unexpected(),t.value=this.parseExprAtom(),this.finishNode(t,"ImportAttribute")};y.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===l.string){var t=this.parseLiteral(this.value);return Ii.test(t.value)&&this.raise(t.start,"An export name cannot include a lone surrogate."),t}return this.parseIdent(!0)};y.adaptDirectivePrologue=function(t){for(var e=0;e<t.length&&this.isDirectiveCandidate(t[e]);++e)t[e].directive=t[e].expression.raw.slice(1,-1)};y.isDirectiveCandidate=function(t){return this.options.ecmaVersion>=5&&t.type==="ExpressionStatement"&&t.expression.type==="Literal"&&typeof t.expression.value=="string"&&(this.input[t.start]==='"'||this.input[t.start]==="'")};var te=D.prototype;te.toAssignable=function(t,e,n){if(this.options.ecmaVersion>=6&&t)switch(t.type){case"Identifier":this.inAsync&&t.name==="await"&&this.raise(t.start,"Cannot use 'await' as identifier inside an async function");break;case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":break;case"ObjectExpression":t.type="ObjectPattern",n&&this.checkPatternErrors(n,!0);for(var i=0,s=t.properties;i<s.length;i+=1){var r=s[i];this.toAssignable(r,e),r.type==="RestElement"&&(r.argument.type==="ArrayPattern"||r.argument.type==="ObjectPattern")&&this.raise(r.argument.start,"Unexpected token")}break;case"Property":t.kind!=="init"&&this.raise(t.key.start,"Object pattern can't contain getter or setter"),this.toAssignable(t.value,e);break;case"ArrayExpression":t.type="ArrayPattern",n&&this.checkPatternErrors(n,!0),this.toAssignableList(t.elements,e);break;case"SpreadElement":t.type="RestElement",this.toAssignable(t.argument,e),t.argument.type==="AssignmentPattern"&&this.raise(t.argument.start,"Rest elements cannot have a default value");break;case"AssignmentExpression":t.operator!=="="&&this.raise(t.left.end,"Only '=' operator can be used for specifying default value."),t.type="AssignmentPattern",delete t.operator,this.toAssignable(t.left,e);break;case"ParenthesizedExpression":this.toAssignable(t.expression,e,n);break;case"ChainExpression":this.raiseRecoverable(t.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":if(!e)break;default:this.raise(t.start,"Assigning to rvalue")}else n&&this.checkPatternErrors(n,!0);return t};te.toAssignableList=function(t,e){for(var n=t.length,i=0;i<n;i++){var s=t[i];s&&this.toAssignable(s,e)}if(n){var r=t[n-1];this.options.ecmaVersion===6&&e&&r&&r.type==="RestElement"&&r.argument.type!=="Identifier"&&this.unexpected(r.argument.start)}return t};te.parseSpread=function(t){var e=this.startNode();return this.next(),e.argument=this.parseMaybeAssign(!1,t),this.finishNode(e,"SpreadElement")};te.parseRestBinding=function(){var t=this.startNode();return this.next(),this.options.ecmaVersion===6&&this.type!==l.name&&this.unexpected(),t.argument=this.parseBindingAtom(),this.finishNode(t,"RestElement")};te.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case l.bracketL:var t=this.startNode();return this.next(),t.elements=this.parseBindingList(l.bracketR,!0,!0),this.finishNode(t,"ArrayPattern");case l.braceL:return this.parseObj(!0)}return this.parseIdent()};te.parseBindingList=function(t,e,n,i){for(var s=[],r=!0;!this.eat(t);)if(r?r=!1:this.expect(l.comma),e&&this.type===l.comma)s.push(null);else{if(n&&this.afterTrailingComma(t))break;if(this.type===l.ellipsis){var a=this.parseRestBinding();this.parseBindingListItem(a),s.push(a),this.type===l.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.expect(t);break}else s.push(this.parseAssignableListItem(i))}return s};te.parseAssignableListItem=function(t){var e=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(e),e};te.parseBindingListItem=function(t){return t};te.parseMaybeDefault=function(t,e,n){if(n=n||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(l.eq))return n;var i=this.startNodeAt(t,e);return i.left=n,i.right=this.parseMaybeAssign(),this.finishNode(i,"AssignmentPattern")};te.checkLValSimple=function(t,e,n){e===void 0&&(e=ze);var i=e!==ze;switch(t.type){case"Identifier":this.strict&&this.reservedWordsStrictBind.test(t.name)&&this.raiseRecoverable(t.start,(i?"Binding ":"Assigning to ")+t.name+" in strict mode"),i&&(e===fe&&t.name==="let"&&this.raiseRecoverable(t.start,"let is disallowed as a lexically bound name"),n&&(Ne(n,t.name)&&this.raiseRecoverable(t.start,"Argument name clash"),n[t.name]=!0),e!==mn&&this.declareName(t.name,e,t.start));break;case"ChainExpression":this.raiseRecoverable(t.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":i&&this.raiseRecoverable(t.start,"Binding member expression");break;case"ParenthesizedExpression":return i&&this.raiseRecoverable(t.start,"Binding parenthesized expression"),this.checkLValSimple(t.expression,e,n);default:this.raise(t.start,(i?"Binding":"Assigning to")+" rvalue")}};te.checkLValPattern=function(t,e,n){switch(e===void 0&&(e=ze),t.type){case"ObjectPattern":for(var i=0,s=t.properties;i<s.length;i+=1){var r=s[i];this.checkLValInnerPattern(r,e,n)}break;case"ArrayPattern":for(var a=0,o=t.elements;a<o.length;a+=1){var c=o[a];c&&this.checkLValInnerPattern(c,e,n)}break;default:this.checkLValSimple(t,e,n)}};te.checkLValInnerPattern=function(t,e,n){switch(e===void 0&&(e=ze),t.type){case"Property":this.checkLValInnerPattern(t.value,e,n);break;case"AssignmentPattern":this.checkLValPattern(t.left,e,n);break;case"RestElement":this.checkLValPattern(t.argument,e,n);break;default:this.checkLValPattern(t,e,n)}};var se=function(e,n,i,s,r){this.token=e,this.isExpr=!!n,this.preserveSpace=!!i,this.override=s,this.generator=!!r},O={b_stat:new se("{",!1),b_expr:new se("{",!0),b_tmpl:new se("${",!1),p_stat:new se("(",!1),p_expr:new se("(",!0),q_tmpl:new se("`",!0,!0,function(t){return t.tryReadTemplateToken()}),f_stat:new se("function",!1),f_expr:new se("function",!0),f_expr_gen:new se("function",!0,!1,null,!0),f_gen:new se("function",!1,!1,null,!0)},Ie=D.prototype;Ie.initialContext=function(){return[O.b_stat]};Ie.curContext=function(){return this.context[this.context.length-1]};Ie.braceIsBlock=function(t){var e=this.curContext();return e===O.f_expr||e===O.f_stat?!0:t===l.colon&&(e===O.b_stat||e===O.b_expr)?!e.isExpr:t===l._return||t===l.name&&this.exprAllowed?z.test(this.input.slice(this.lastTokEnd,this.start)):t===l._else||t===l.semi||t===l.eof||t===l.parenR||t===l.arrow?!0:t===l.braceL?e===O.b_stat:t===l._var||t===l._const||t===l.name?!1:!this.exprAllowed};Ie.inGeneratorContext=function(){for(var t=this.context.length-1;t>=1;t--){var e=this.context[t];if(e.token==="function")return e.generator}return!1};Ie.updateContext=function(t){var e,n=this.type;n.keyword&&t===l.dot?this.exprAllowed=!1:(e=n.updateContext)?e.call(this,t):this.exprAllowed=n.beforeExpr};Ie.overrideContext=function(t){this.curContext()!==t&&(this.context[this.context.length-1]=t)};l.parenR.updateContext=l.braceR.updateContext=function(){if(this.context.length===1){this.exprAllowed=!0;return}var t=this.context.pop();t===O.b_stat&&this.curContext().token==="function"&&(t=this.context.pop()),this.exprAllowed=!t.isExpr};l.braceL.updateContext=function(t){this.context.push(this.braceIsBlock(t)?O.b_stat:O.b_expr),this.exprAllowed=!0};l.dollarBraceL.updateContext=function(){this.context.push(O.b_tmpl),this.exprAllowed=!0};l.parenL.updateContext=function(t){var e=t===l._if||t===l._for||t===l._with||t===l._while;this.context.push(e?O.p_stat:O.p_expr),this.exprAllowed=!0};l.incDec.updateContext=function(){};l._function.updateContext=l._class.updateContext=function(t){t.beforeExpr&&t!==l._else&&!(t===l.semi&&this.curContext()!==O.p_stat)&&!(t===l._return&&z.test(this.input.slice(this.lastTokEnd,this.start)))&&!((t===l.colon||t===l.braceL)&&this.curContext()===O.b_stat)?this.context.push(O.f_expr):this.context.push(O.f_stat),this.exprAllowed=!1};l.colon.updateContext=function(){this.curContext().token==="function"&&this.context.pop(),this.exprAllowed=!0};l.backQuote.updateContext=function(){this.curContext()===O.q_tmpl?this.context.pop():this.context.push(O.q_tmpl),this.exprAllowed=!1};l.star.updateContext=function(t){if(t===l._function){var e=this.context.length-1;this.context[e]===O.f_expr?this.context[e]=O.f_expr_gen:this.context[e]=O.f_gen}this.exprAllowed=!0};l.name.updateContext=function(t){var e=!1;this.options.ecmaVersion>=6&&t!==l.dot&&(this.value==="of"&&!this.exprAllowed||this.value==="yield"&&this.inGeneratorContext())&&(e=!0),this.exprAllowed=e};var S=D.prototype;S.checkPropClash=function(t,e,n){if(!(this.options.ecmaVersion>=9&&t.type==="SpreadElement")&&!(this.options.ecmaVersion>=6&&(t.computed||t.method||t.shorthand))){var i=t.key,s;switch(i.type){case"Identifier":s=i.name;break;case"Literal":s=String(i.value);break;default:return}var r=t.kind;if(this.options.ecmaVersion>=6){s==="__proto__"&&r==="init"&&(e.proto&&(n?n.doubleProto<0&&(n.doubleProto=i.start):this.raiseRecoverable(i.start,"Redefinition of __proto__ property")),e.proto=!0);return}s="$"+s;var a=e[s];if(a){var o;r==="init"?o=this.strict&&a.init||a.get||a.set:o=a.init||a[r],o&&this.raiseRecoverable(i.start,"Redefinition of property")}else a=e[s]={init:!1,get:!1,set:!1};a[r]=!0}};S.parseExpression=function(t,e){var n=this;return this.catchStackOverflow(function(){var i=n.start,s=n.startLoc,r=n.parseMaybeAssign(t,e);if(n.type===l.comma){var a=n.startNodeAt(i,s);for(a.expressions=[r];n.eat(l.comma);)a.expressions.push(n.parseMaybeAssign(t,e));return n.finishNode(a,"SequenceExpression")}return r})};S.parseMaybeAssign=function(t,e,n){if(this.isContextual("yield")){if(this.inGenerator)return this.parseYield(t);this.exprAllowed=!1}var i=!1,s=-1,r=-1,a=-1;e?(s=e.parenthesizedAssign,r=e.trailingComma,a=e.doubleProto,e.parenthesizedAssign=e.trailingComma=-1):(e=new Ye,i=!0);var o=this.start,c=this.startLoc;(this.type===l.parenL||this.type===l.name)&&(this.potentialArrowAt=this.start,this.potentialArrowInForAwait=t==="await");var h=this.parseMaybeConditional(t,e);if(n&&(h=n.call(this,h,o,c)),this.type.isAssign){var u=this.startNodeAt(o,c);return u.operator=this.value,this.type===l.eq&&(h=this.toAssignable(h,!1,e)),i||(e.parenthesizedAssign=e.trailingComma=-1,e.shorthandAssign>=h.start&&(e.shorthandAssign=-1),e.doubleProto>=h.start&&(e.doubleProto=-1)),this.type===l.eq?this.checkLValPattern(h):this.checkLValSimple(h),u.left=h,this.next(),u.right=this.parseMaybeAssign(t),a>-1&&(e.doubleProto=a),this.finishNode(u,"AssignmentExpression")}else i&&this.checkExpressionErrors(e,!0);return s>-1&&(e.parenthesizedAssign=s),r>-1&&(e.trailingComma=r),h};S.parseMaybeConditional=function(t,e){var n=this.start,i=this.startLoc,s=this.parseExprOps(t,e);if(this.checkExpressionErrors(e))return s;if(!(s.type==="ArrowFunctionExpression"&&s.start===n)&&this.eat(l.question)){var r=this.startNodeAt(n,i);return r.test=s,r.consequent=this.parseMaybeAssign(),this.expect(l.colon),r.alternate=this.parseMaybeAssign(t),this.finishNode(r,"ConditionalExpression")}return s};S.parseExprOps=function(t,e){var n=this.start,i=this.startLoc,s=this.parseMaybeUnary(e,!1,!1,t);return this.checkExpressionErrors(e)||s.start===n&&s.type==="ArrowFunctionExpression"?s:this.parseExprOp(s,n,i,-1,t)};S.parseExprOp=function(t,e,n,i,s){var r=this.type.binop;if(r!=null&&(!s||this.type!==l._in)&&r>i){var a=this.type===l.logicalOR||this.type===l.logicalAND,o=this.type===l.coalesce;o&&(r=l.logicalAND.binop);var c=this.value;this.next();var h=this.start,u=this.startLoc,f=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,s),h,u,r,s),x=this.buildBinary(e,n,t,f,c,a||o);return(a&&this.type===l.coalesce||o&&(this.type===l.logicalOR||this.type===l.logicalAND))&&this.raiseRecoverable(this.start,"Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses"),this.parseExprOp(x,e,n,i,s)}return t};S.buildBinary=function(t,e,n,i,s,r){i.type==="PrivateIdentifier"&&this.raise(i.start,"Private identifier can only be left side of binary expression");var a=this.startNodeAt(t,e);return a.left=n,a.operator=s,a.right=i,this.finishNode(a,r?"LogicalExpression":"BinaryExpression")};S.parseMaybeUnary=function(t,e,n,i){var s=this.start,r=this.startLoc,a;if(this.isContextual("await")&&this.canAwait)a=this.parseAwait(i),e=!0;else if(this.type.prefix){var o=this.startNode(),c=this.type===l.incDec;o.operator=this.value,o.prefix=!0,this.next(),o.argument=this.parseMaybeUnary(null,!0,c,i),this.checkExpressionErrors(t,!0),c?this.checkLValSimple(o.argument):this.strict&&o.operator==="delete"&&vn(o.argument)?this.raiseRecoverable(o.start,"Deleting local variable in strict mode"):o.operator==="delete"&&ft(o.argument)?this.raiseRecoverable(o.start,"Private fields can not be deleted"):e=!0,a=this.finishNode(o,c?"UpdateExpression":"UnaryExpression")}else if(!e&&this.type===l.privateId)(i||this.privateNameStack.length===0)&&this.options.checkPrivateFields&&this.unexpected(),a=this.parsePrivateIdent(),this.type!==l._in&&this.unexpected();else{if(a=this.parseExprSubscripts(t,i),this.checkExpressionErrors(t))return a;for(;this.type.postfix&&!this.canInsertSemicolon();){var h=this.startNodeAt(s,r);h.operator=this.value,h.prefix=!1,h.argument=a,this.checkLValSimple(a),this.next(),a=this.finishNode(h,"UpdateExpression")}}if(!n&&!(a.type==="ArrowFunctionExpression"&&a.start===s)&&this.eat(l.starstar))if(e)this.unexpected(this.lastTokStart);else return this.buildBinary(s,r,a,this.parseMaybeUnary(null,!1,!1,i),"**",!1);else return a};function vn(t){return t.type==="Identifier"||t.type==="ParenthesizedExpression"&&vn(t.expression)}function ft(t){return t.type==="MemberExpression"&&t.property.type==="PrivateIdentifier"||t.type==="ChainExpression"&&ft(t.expression)||t.type==="ParenthesizedExpression"&&ft(t.expression)}S.parseExprSubscripts=function(t,e){var n=this.start,i=this.startLoc,s=-1,r=-1;t&&(s=t.doubleProto,r=t.shorthandAssign,t.doubleProto=t.shorthandAssign=-1);var a=this.parseExprAtom(t,e);if(a.type==="ArrowFunctionExpression"&&this.input.slice(this.lastTokStart,this.lastTokEnd)!==")")return a;var o=this.parseSubscripts(a,n,i,!1,e);return t&&(o.end>a.end&&(this.checkExpressionErrors(t,!0),t.parenthesizedAssign>=o.start&&(t.parenthesizedAssign=-1),t.parenthesizedBind>=o.start&&(t.parenthesizedBind=-1),t.trailingComma>=o.start&&(t.trailingComma=-1)),s>-1&&(t.doubleProto=s),r>-1&&(t.shorthandAssign=r)),o};S.parseSubscripts=function(t,e,n,i,s){for(var r=this.options.ecmaVersion>=8&&t.type==="Identifier"&&t.name==="async"&&this.lastTokEnd===t.end&&!this.canInsertSemicolon()&&t.end-t.start===5&&this.potentialArrowAt===t.start,a=!1;;){var o=this.parseSubscript(t,e,n,i,r,a,s);if(o.optional&&(a=!0),o.end===t.end||o.type==="ArrowFunctionExpression"){if(a){var c=this.startNodeAt(e,n);c.expression=o,o=this.finishNode(c,"ChainExpression")}return o}t=o,r=!1}};S.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(l.arrow)};S.parseSubscriptAsyncArrow=function(t,e,n,i){return this.parseArrowExpression(this.startNodeAt(t,e),n,!0,i)};S.parseSubscript=function(t,e,n,i,s,r,a){var o=this.options.ecmaVersion>=11,c=o&&this.eat(l.questionDot);i&&c&&this.raise(this.lastTokStart,"Optional chaining cannot appear in the callee of new expressions");var h=this.eat(l.bracketL);if(h||c&&this.type!==l.parenL&&this.type!==l.backQuote||this.eat(l.dot)){var u=this.startNodeAt(e,n);u.object=t,h?(u.property=this.parseExpression(),this.expect(l.bracketR)):this.type===l.privateId&&t.type!=="Super"?u.property=this.parsePrivateIdent():u.property=this.parseIdent(this.options.allowReserved!=="never"),u.computed=!!h,o&&(u.optional=c),t=this.finishNode(u,"MemberExpression")}else if(!i&&this.eat(l.parenL)){var f=new Ye,x=this.yieldPos,d=this.awaitPos,m=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var g=this.parseExprList(l.parenR,this.options.ecmaVersion>=8,!1,f);if(s&&!c&&this.shouldParseAsyncArrow())return this.checkPatternErrors(f,!1),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0&&this.raise(this.awaitIdentPos,"Cannot use 'await' as identifier inside an async function"),this.yieldPos=x,this.awaitPos=d,this.awaitIdentPos=m,this.parseSubscriptAsyncArrow(e,n,g,a);this.checkExpressionErrors(f,!0),this.yieldPos=x||this.yieldPos,this.awaitPos=d||this.awaitPos,this.awaitIdentPos=m||this.awaitIdentPos;var w=this.startNodeAt(e,n);w.callee=t,w.arguments=g,o&&(w.optional=c),t=this.finishNode(w,"CallExpression")}else if(this.type===l.backQuote){(c||r)&&this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions");var k=this.startNodeAt(e,n);k.tag=t,k.quasi=this.parseTemplate({isTagged:!0}),t=this.finishNode(k,"TaggedTemplateExpression")}return t};S.parseExprAtom=function(t,e,n){this.type===l.slash&&this.readRegexp();var i,s=this.potentialArrowAt===this.start;switch(this.type){case l._super:return this.allowSuper||this.raise(this.start,"'super' keyword outside a method"),i=this.startNode(),this.next(),this.type===l.parenL&&!this.allowDirectSuper&&this.raise(i.start,"super() call outside constructor of a subclass"),this.type!==l.dot&&this.type!==l.bracketL&&this.type!==l.parenL&&this.unexpected(),this.finishNode(i,"Super");case l._this:return i=this.startNode(),this.next(),this.finishNode(i,"ThisExpression");case l.name:var r=this.start,a=this.startLoc,o=this.containsEsc,c=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!o&&c.name==="async"&&!this.canInsertSemicolon()&&this.eat(l._function))return this.overrideContext(O.f_expr),this.parseFunction(this.startNodeAt(r,a),0,!1,!0,e);if(s&&!this.canInsertSemicolon()){if(this.eat(l.arrow))return this.parseArrowExpression(this.startNodeAt(r,a),[c],!1,e);if(this.options.ecmaVersion>=8&&c.name==="async"&&this.type===l.name&&!o&&(!this.potentialArrowInForAwait||this.value!=="of"||this.containsEsc))return c=this.parseIdent(!1),(this.canInsertSemicolon()||!this.eat(l.arrow))&&this.unexpected(),this.parseArrowExpression(this.startNodeAt(r,a),[c],!0,e)}return c;case l.regexp:var h=this.value;return i=this.parseLiteral(h.value),i.regex={pattern:h.pattern,flags:h.flags},i;case l.num:case l.string:return this.parseLiteral(this.value);case l._null:case l._true:case l._false:return i=this.startNode(),i.value=this.type===l._null?null:this.type===l._true,i.raw=this.type.keyword,this.next(),this.finishNode(i,"Literal");case l.parenL:var u=this.start,f=this.parseParenAndDistinguishExpression(s,e);return t&&(t.parenthesizedAssign<0&&!this.isSimpleAssignTarget(f)&&(t.parenthesizedAssign=u),t.parenthesizedBind<0&&(t.parenthesizedBind=u)),f;case l.bracketL:return i=this.startNode(),this.next(),i.elements=this.parseExprList(l.bracketR,!0,!0,t),this.finishNode(i,"ArrayExpression");case l.braceL:return this.overrideContext(O.b_expr),this.parseObj(!1,t);case l._function:return i=this.startNode(),this.next(),this.parseFunction(i,0);case l._class:return this.parseClass(this.startNode(),!1);case l._new:return this.parseNew();case l.backQuote:return this.parseTemplate();case l._import:return this.options.ecmaVersion>=11?this.parseExprImport(n):this.unexpected();default:return this.parseExprAtomDefault()}};S.parseExprAtomDefault=function(){this.unexpected()};S.parseExprImport=function(t){var e=this.startNode();if(this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword import"),this.next(),this.type===l.parenL&&!t)return this.parseDynamicImport(e);if(this.type===l.dot){var n=this.startNodeAt(e.start,e.loc&&e.loc.start);return n.name="import",e.meta=this.finishNode(n,"Identifier"),this.parseImportMeta(e)}else this.unexpected()};S.parseDynamicImport=function(t){if(this.next(),t.source=this.parseMaybeAssign(),this.options.ecmaVersion>=16)this.eat(l.parenR)?t.options=null:(this.expect(l.comma),this.afterTrailingComma(l.parenR)?t.options=null:(t.options=this.parseMaybeAssign(),this.eat(l.parenR)||(this.expect(l.comma),this.afterTrailingComma(l.parenR)||this.unexpected())));else if(!this.eat(l.parenR)){var e=this.start;this.eat(l.comma)&&this.eat(l.parenR)?this.raiseRecoverable(e,"Trailing comma is not allowed in import()"):this.unexpected(e)}return this.finishNode(t,"ImportExpression")};S.parseImportMeta=function(t){this.next();var e=this.containsEsc;return t.property=this.parseIdent(!0),t.property.name!=="meta"&&this.raiseRecoverable(t.property.start,"The only valid meta property for import is 'import.meta'"),e&&this.raiseRecoverable(t.start,"'import.meta' must not contain escaped characters"),this.options.sourceType!=="module"&&!this.options.allowImportExportEverywhere&&this.raiseRecoverable(t.start,"Cannot use 'import.meta' outside a module"),this.finishNode(t,"MetaProperty")};S.parseLiteral=function(t){var e=this.startNode();return e.value=t,e.raw=this.input.slice(this.start,this.end),e.raw.charCodeAt(e.raw.length-1)===110&&(e.bigint=e.value!=null?e.value.toString():e.raw.slice(0,-1).replace(/_/g,"")),this.next(),this.finishNode(e,"Literal")};S.parseParenExpression=function(){this.expect(l.parenL);var t=this.parseExpression();return this.expect(l.parenR),t};S.shouldParseArrow=function(t){return!this.canInsertSemicolon()};S.parseParenAndDistinguishExpression=function(t,e){var n=this.start,i=this.startLoc,s,r=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var a=this.start,o=this.startLoc,c=[],h=!0,u=!1,f=new Ye,x=this.yieldPos,d=this.awaitPos,m;for(this.yieldPos=0,this.awaitPos=0;this.type!==l.parenR;)if(h?h=!1:this.expect(l.comma),r&&this.afterTrailingComma(l.parenR,!0)){u=!0;break}else if(this.type===l.ellipsis){m=this.start,c.push(this.parseParenItem(this.parseRestBinding())),this.type===l.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");break}else c.push(this.parseMaybeAssign(!1,f,this.parseParenItem));var g=this.lastTokEnd,w=this.lastTokEndLoc;if(this.expect(l.parenR),t&&this.shouldParseArrow(c)&&this.eat(l.arrow))return this.checkPatternErrors(f,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=x,this.awaitPos=d,this.parseParenArrowList(n,i,c,e);(!c.length||u)&&this.unexpected(this.lastTokStart),m&&this.unexpected(m),this.checkExpressionErrors(f,!0),this.yieldPos=x||this.yieldPos,this.awaitPos=d||this.awaitPos,c.length>1?(s=this.startNodeAt(a,o),s.expressions=c,this.finishNodeAt(s,"SequenceExpression",g,w)):s=c[0]}else s=this.parseParenExpression();if(this.options.preserveParens){var k=this.startNodeAt(n,i);return k.expression=s,this.finishNode(k,"ParenthesizedExpression")}else return s};S.parseParenItem=function(t){return t};S.parseParenArrowList=function(t,e,n,i){return this.parseArrowExpression(this.startNodeAt(t,e),n,!1,i)};var Bi=[];S.parseNew=function(){this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword new");var t=this.startNode();if(this.next(),this.options.ecmaVersion>=6&&this.type===l.dot){var e=this.startNodeAt(t.start,t.loc&&t.loc.start);e.name="new",t.meta=this.finishNode(e,"Identifier"),this.next();var n=this.containsEsc;return t.property=this.parseIdent(!0),t.property.name!=="target"&&this.raiseRecoverable(t.property.start,"The only valid meta property for new is 'new.target'"),n&&this.raiseRecoverable(t.start,"'new.target' must not contain escaped characters"),this.allowNewDotTarget||this.raiseRecoverable(t.start,"'new.target' can only be used in functions and class static block"),this.finishNode(t,"MetaProperty")}var i=this.start,s=this.startLoc;return t.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),i,s,!0,!1),t.callee.type==="Super"&&this.raiseRecoverable(i,"Invalid use of 'super'"),this.eat(l.parenL)?t.arguments=this.parseExprList(l.parenR,this.options.ecmaVersion>=8,!1):t.arguments=Bi,this.finishNode(t,"NewExpression")};S.parseTemplateElement=function(t){var e=t.isTagged,n=this.startNode();return this.type===l.invalidTemplate?(e||this.raiseRecoverable(this.start,"Bad escape sequence in untagged template literal"),n.value={raw:this.value.replace(/\r\n?/g,`
|
|
15
15
|
`),cooked:null}):n.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,`
|
|
16
|
-
`),cooked:this.value},this.next(),n.tail=this.type===l.backQuote,this.finishNode(n,"TemplateElement")};w.parseTemplate=function(t){t===void 0&&(t={});var e=t.isTagged;e===void 0&&(e=!1);var n=this.startNode();this.next(),n.expressions=[];var i=this.parseTemplateElement({isTagged:e});for(n.quasis=[i];!i.tail;)this.type===l.eof&&this.raise(this.pos,"Unterminated template literal"),this.expect(l.dollarBraceL),n.expressions.push(this.parseExpression()),this.expect(l.braceR),n.quasis.push(i=this.parseTemplateElement({isTagged:e}));return this.next(),this.finishNode(n,"TemplateLiteral")};w.isAsyncProp=function(t){return!t.computed&&t.key.type==="Identifier"&&t.key.name==="async"&&(this.type===l.name||this.type===l.num||this.type===l.string||this.type===l.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===l.star)&&!z.test(this.input.slice(this.lastTokEnd,this.start))};w.parseObj=function(t,e){var n=this.startNode(),i=!0,s={};for(n.properties=[],this.next();!this.eat(l.braceR);){if(i)i=!1;else if(this.expect(l.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(l.braceR))break;var r=this.parseProperty(t,e);t||this.checkPropClash(r,s,e),n.properties.push(r)}return this.finishNode(n,t?"ObjectPattern":"ObjectExpression")};w.parseProperty=function(t,e){var n=this.startNode(),i,s,r,a;if(this.options.ecmaVersion>=9&&this.eat(l.ellipsis))return t?(n.argument=this.parseIdent(!1),this.type===l.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.finishNode(n,"RestElement")):(n.argument=this.parseMaybeAssign(!1,e),this.type===l.comma&&e&&e.trailingComma<0&&(e.trailingComma=this.start),this.finishNode(n,"SpreadElement"));this.options.ecmaVersion>=6&&(n.method=!1,n.shorthand=!1,(t||e)&&(r=this.start,a=this.startLoc),t||(i=this.eat(l.star)));var o=this.containsEsc;return this.parsePropertyName(n),!t&&!o&&this.options.ecmaVersion>=8&&!i&&this.isAsyncProp(n)?(s=!0,i=this.options.ecmaVersion>=9&&this.eat(l.star),this.parsePropertyName(n)):s=!1,this.parsePropertyValue(n,t,i,s,r,a,e,o),this.finishNode(n,"Property")};w.parseGetterSetter=function(t){var e=t.key.name;this.parsePropertyName(t),t.value=this.parseMethod(!1),t.kind=e;var n=t.kind==="get"?0:1;if(t.value.params.length!==n){var i=t.value.start;t.kind==="get"?this.raiseRecoverable(i,"getter should have no params"):this.raiseRecoverable(i,"setter should have exactly one param")}else t.kind==="set"&&t.value.params[0].type==="RestElement"&&this.raiseRecoverable(t.value.params[0].start,"Setter cannot use rest params")};w.parsePropertyValue=function(t,e,n,i,s,r,a,o){(n||i)&&this.type===l.colon&&this.unexpected(),this.eat(l.colon)?(t.value=e?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,a),t.kind="init"):this.options.ecmaVersion>=6&&this.type===l.parenL?(e&&this.unexpected(),t.method=!0,t.value=this.parseMethod(n,i),t.kind="init"):!e&&!o&&this.options.ecmaVersion>=5&&!t.computed&&t.key.type==="Identifier"&&(t.key.name==="get"||t.key.name==="set")&&this.type!==l.comma&&this.type!==l.braceR&&this.type!==l.eq?((n||i)&&this.unexpected(),this.parseGetterSetter(t)):this.options.ecmaVersion>=6&&!t.computed&&t.key.type==="Identifier"?((n||i)&&this.unexpected(),this.checkUnreserved(t.key),t.key.name==="await"&&!this.awaitIdentPos&&(this.awaitIdentPos=s),e?t.value=this.parseMaybeDefault(s,r,this.copyNode(t.key)):this.type===l.eq&&a?(a.shorthandAssign<0&&(a.shorthandAssign=this.start),t.value=this.parseMaybeDefault(s,r,this.copyNode(t.key))):t.value=this.copyNode(t.key),t.kind="init",t.shorthand=!0):this.unexpected()};w.parsePropertyName=function(t){if(this.options.ecmaVersion>=6){if(this.eat(l.bracketL))return t.computed=!0,t.key=this.parseMaybeAssign(),this.expect(l.bracketR),t.key;t.computed=!1}return t.key=this.type===l.num||this.type===l.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never")};w.initFunction=function(t){t.id=null,this.options.ecmaVersion>=6&&(t.generator=t.expression=!1),this.options.ecmaVersion>=8&&(t.async=!1)};w.parseMethod=function(t,e,n){var i=this.startNode(),s=this.yieldPos,r=this.awaitPos,a=this.awaitIdentPos;return this.initFunction(i),this.options.ecmaVersion>=6&&(i.generator=t),this.options.ecmaVersion>=8&&(i.async=!!e),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(vt(e,i.generator)|Ze|(n?hn:0)),this.expect(l.parenL),i.params=this.parseBindingList(l.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(i,!1,!0,!1),this.yieldPos=s,this.awaitPos=r,this.awaitIdentPos=a,this.finishNode(i,"FunctionExpression")};w.parseArrowExpression=function(t,e,n,i){var s=this.yieldPos,r=this.awaitPos,a=this.awaitIdentPos;return this.enterScope(vt(n,!1)|gt),this.initFunction(t),this.options.ecmaVersion>=8&&(t.async=!!n),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,t.params=this.toAssignableList(e,!0),this.parseFunctionBody(t,!0,!1,i),this.yieldPos=s,this.awaitPos=r,this.awaitIdentPos=a,this.finishNode(t,"ArrowFunctionExpression")};w.parseFunctionBody=function(t,e,n,i){var s=e&&this.type!==l.braceL,r=this.strict,a=!1;if(s)t.body=this.parseMaybeAssign(i),t.expression=!0,this.checkParams(t,!1);else{var o=this.options.ecmaVersion>=7&&!this.isSimpleParamList(t.params);(!r||o)&&(a=this.strictDirective(this.end),a&&o&&this.raiseRecoverable(t.start,"Illegal 'use strict' directive in function with non-simple parameter list"));var c=this.labels;this.labels=[],a&&(this.strict=!0),this.checkParams(t,!r&&!a&&!e&&!n&&this.isSimpleParamList(t.params)),this.strict&&t.id&&this.checkLValSimple(t.id,mn),t.body=this.parseBlock(!1,void 0,a&&!r),t.expression=!1,this.adaptDirectivePrologue(t.body.body),this.labels=c}this.exitScope()};w.isSimpleParamList=function(t){for(var e=0,n=t;e<n.length;e+=1){var i=n[e];if(i.type!=="Identifier")return!1}return!0};w.checkParams=function(t,e){for(var n=Object.create(null),i=0,s=t.params;i<s.length;i+=1){var r=s[i];this.checkLValInnerPattern(r,xt,e?null:n)}};w.parseExprList=function(t,e,n,i){for(var s=[],r=!0;!this.eat(t);){if(r)r=!1;else if(this.expect(l.comma),e&&this.afterTrailingComma(t))break;var a=void 0;n&&this.type===l.comma?a=null:this.type===l.ellipsis?(a=this.parseSpread(i),i&&this.type===l.comma&&i.trailingComma<0&&(i.trailingComma=this.start)):a=this.parseMaybeAssign(!1,i),s.push(a)}return s};w.checkUnreserved=function(t){var e=t.start,n=t.end,i=t.name;if(this.inGenerator&&i==="yield"&&this.raiseRecoverable(e,"Cannot use 'yield' as identifier inside a generator"),this.inAsync&&i==="await"&&this.raiseRecoverable(e,"Cannot use 'await' as identifier inside an async function"),!(this.currentThisScope().flags&Qe)&&i==="arguments"&&this.raiseRecoverable(e,"Cannot use 'arguments' in class field initializer"),this.inClassStaticBlock&&(i==="arguments"||i==="await")&&this.raise(e,"Cannot use "+i+" in class static initialization block"),this.keywords.test(i)&&this.raise(e,"Unexpected keyword '"+i+"'"),!(this.options.ecmaVersion<6&&this.input.slice(e,n).indexOf("\\")!==-1)){var s=this.strict?this.reservedWordsStrict:this.reservedWords;s.test(i)&&(!this.inAsync&&i==="await"&&this.raiseRecoverable(e,"Cannot use keyword 'await' outside an async function"),this.raiseRecoverable(e,"The keyword '"+i+"' is reserved"))}};w.parseIdent=function(t){var e=this.parseIdentNode();return this.next(!!t),this.finishNode(e,"Identifier"),t||(this.checkUnreserved(e),e.name==="await"&&!this.awaitIdentPos&&(this.awaitIdentPos=e.start)),e};w.parseIdentNode=function(){var t=this.startNode();return this.type===l.name?t.name=this.value:this.type.keyword?(t.name=this.type.keyword,(t.name==="class"||t.name==="function")&&(this.lastTokEnd!==this.lastTokStart+1||this.input.charCodeAt(this.lastTokStart)!==46)&&this.context.pop(),this.type=l.name):this.unexpected(),t};w.parsePrivateIdent=function(){var t=this.startNode();return this.type===l.privateId?t.name=this.value:this.unexpected(),this.next(),this.finishNode(t,"PrivateIdentifier"),this.options.checkPrivateFields&&(this.privateNameStack.length===0?this.raise(t.start,"Private field '#"+t.name+"' must be declared in an enclosing class"):this.privateNameStack[this.privateNameStack.length-1].used.push(t)),t};w.parseYield=function(t){this.yieldPos||(this.yieldPos=this.start);var e=this.startNode();return this.next(),this.type===l.semi||this.canInsertSemicolon()||this.type!==l.star&&!this.type.startsExpr?(e.delegate=!1,e.argument=null):(e.delegate=this.eat(l.star),e.argument=this.parseMaybeAssign(t)),this.finishNode(e,"YieldExpression")};w.parseAwait=function(t){this.awaitPos||(this.awaitPos=this.start);var e=this.startNode();return this.next(),e.argument=this.parseMaybeUnary(null,!0,!1,t),this.finishNode(e,"AwaitExpression")};var Ke=j.prototype;Ke.raise=function(t,e){var n=ln(this.input,t);e+=" ("+n.line+":"+n.column+")",this.sourceFile&&(e+=" in "+this.sourceFile);var i=new SyntaxError(e);throw i.pos=t,i.loc=n,i.raisedAt=this.pos,i};Ke.raiseRecoverable=Ke.raise;Ke.curPosition=function(){if(this.options.locations)return new Le(this.curLine,this.pos-this.lineStart)};var xe=j.prototype,Bi=function(e){this.flags=e,this.var=[],this.lexical=[],this.functions=[]};xe.enterScope=function(t){this.scopeStack.push(new Bi(t))};xe.exitScope=function(){this.scopeStack.pop()};xe.treatFunctionsAsVarInScope=function(t){return t.flags&we||!this.inModule&&t.flags&ke};xe.declareName=function(t,e,n){var i=!1;if(e===fe){var s=this.currentScope();i=s.lexical.indexOf(t)>-1||s.functions.indexOf(t)>-1||s.var.indexOf(t)>-1,s.lexical.push(t),this.inModule&&s.flags&ke&&delete this.undefinedExports[t]}else if(e===dn){var r=this.currentScope();r.lexical.push(t)}else if(e===fn){var a=this.currentScope();this.treatFunctionsAsVar?i=a.lexical.indexOf(t)>-1:i=a.lexical.indexOf(t)>-1||a.var.indexOf(t)>-1,a.functions.push(t)}else for(var o=this.scopeStack.length-1;o>=0;--o){var c=this.scopeStack[o];if(c.lexical.indexOf(t)>-1&&!(c.flags&un&&c.lexical[0]===t)||!this.treatFunctionsAsVarInScope(c)&&c.functions.indexOf(t)>-1){i=!0;break}if(c.var.push(t),this.inModule&&c.flags&ke&&delete this.undefinedExports[t],c.flags&Qe)break}i&&this.raiseRecoverable(n,"Identifier '"+t+"' has already been declared")};xe.checkLocalExport=function(t){this.scopeStack[0].lexical.indexOf(t.name)===-1&&this.scopeStack[0].var.indexOf(t.name)===-1&&(this.undefinedExports[t.name]=t)};xe.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]};xe.currentVarScope=function(){for(var t=this.scopeStack.length-1;;t--){var e=this.scopeStack[t];if(e.flags&(Qe|Re|Se))return e}};xe.currentThisScope=function(){for(var t=this.scopeStack.length-1;;t--){var e=this.scopeStack[t];if(e.flags&(Qe|Re|Se)&&!(e.flags>))return e}};var Xe=function(e,n,i){this.type="",this.start=n,this.end=0,e.options.locations&&(this.loc=new Je(e,i)),e.options.directSourceFile&&(this.sourceFile=e.options.directSourceFile),e.options.ranges&&(this.range=[n,0])},Oe=j.prototype;Oe.startNode=function(){return new Xe(this,this.start,this.startLoc)};Oe.startNodeAt=function(t,e){return new Xe(this,t,e)};function xn(t,e,n,i){return t.type=e,t.end=n,this.options.locations&&(t.loc.end=i),this.options.ranges&&(t.range[1]=n),t}Oe.finishNode=function(t,e){return xn.call(this,t,e,this.lastTokEnd,this.lastTokEndLoc)};Oe.finishNodeAt=function(t,e,n,i){return xn.call(this,t,e,n,i)};Oe.copyNode=function(t){var e=new Xe(this,t.start,this.startLoc);for(var n in t)e[n]=t[n];return e};var ji="Berf Beria_Erfe Gara Garay Gukh Gurung_Khema Hrkt Katakana_Or_Hiragana Kawi Kirat_Rai Krai Nag_Mundari Nagm Ol_Onal Onao Sidetic Sidt Sunu Sunuwar Tai_Yo Tayo Todhri Todr Tolong_Siki Tols Tulu_Tigalari Tutg Unknown Zzzz",bn="ASCII ASCII_Hex_Digit AHex Alphabetic Alpha Any Assigned Bidi_Control Bidi_C Bidi_Mirrored Bidi_M Case_Ignorable CI Cased Changes_When_Casefolded CWCF Changes_When_Casemapped CWCM Changes_When_Lowercased CWL Changes_When_NFKC_Casefolded CWKCF Changes_When_Titlecased CWT Changes_When_Uppercased CWU Dash Default_Ignorable_Code_Point DI Deprecated Dep Diacritic Dia Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Extender Ext Grapheme_Base Gr_Base Grapheme_Extend Gr_Ext Hex_Digit Hex IDS_Binary_Operator IDSB IDS_Trinary_Operator IDST ID_Continue IDC ID_Start IDS Ideographic Ideo Join_Control Join_C Logical_Order_Exception LOE Lowercase Lower Math Noncharacter_Code_Point NChar Pattern_Syntax Pat_Syn Pattern_White_Space Pat_WS Quotation_Mark QMark Radical Regional_Indicator RI Sentence_Terminal STerm Soft_Dotted SD Terminal_Punctuation Term Unified_Ideograph UIdeo Uppercase Upper Variation_Selector VS White_Space space XID_Continue XIDC XID_Start XIDS",yn=bn+" Extended_Pictographic",kn=yn,wn=kn+" EBase EComp EMod EPres ExtPict",Sn=wn,Di=Sn,Fi={9:bn,10:yn,11:kn,12:wn,13:Sn,14:Di},Mi="Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji",Ui={9:"",10:"",11:"",12:"",13:"",14:Mi},Xt="Cased_Letter LC Close_Punctuation Pe Connector_Punctuation Pc Control Cc cntrl Currency_Symbol Sc Dash_Punctuation Pd Decimal_Number Nd digit Enclosing_Mark Me Final_Punctuation Pf Format Cf Initial_Punctuation Pi Letter L Letter_Number Nl Line_Separator Zl Lowercase_Letter Ll Mark M Combining_Mark Math_Symbol Sm Modifier_Letter Lm Modifier_Symbol Sk Nonspacing_Mark Mn Number N Open_Punctuation Ps Other C Other_Letter Lo Other_Number No Other_Punctuation Po Other_Symbol So Paragraph_Separator Zp Private_Use Co Punctuation P punct Separator Z Space_Separator Zs Spacing_Mark Mc Surrogate Cs Symbol S Titlecase_Letter Lt Unassigned Cn Uppercase_Letter Lu",Cn="Adlam Adlm Ahom Anatolian_Hieroglyphs Hluw Arabic Arab Armenian Armn Avestan Avst Balinese Bali Bamum Bamu Bassa_Vah Bass Batak Batk Bengali Beng Bhaiksuki Bhks Bopomofo Bopo Brahmi Brah Braille Brai Buginese Bugi Buhid Buhd Canadian_Aboriginal Cans Carian Cari Caucasian_Albanian Aghb Chakma Cakm Cham Cham Cherokee Cher Common Zyyy Coptic Copt Qaac Cuneiform Xsux Cypriot Cprt Cyrillic Cyrl Deseret Dsrt Devanagari Deva Duployan Dupl Egyptian_Hieroglyphs Egyp Elbasan Elba Ethiopic Ethi Georgian Geor Glagolitic Glag Gothic Goth Grantha Gran Greek Grek Gujarati Gujr Gurmukhi Guru Han Hani Hangul Hang Hanunoo Hano Hatran Hatr Hebrew Hebr Hiragana Hira Imperial_Aramaic Armi Inherited Zinh Qaai Inscriptional_Pahlavi Phli Inscriptional_Parthian Prti Javanese Java Kaithi Kthi Kannada Knda Katakana Kana Kayah_Li Kali Kharoshthi Khar Khmer Khmr Khojki Khoj Khudawadi Sind Lao Laoo Latin Latn Lepcha Lepc Limbu Limb Linear_A Lina Linear_B Linb Lisu Lisu Lycian Lyci Lydian Lydi Mahajani Mahj Malayalam Mlym Mandaic Mand Manichaean Mani Marchen Marc Masaram_Gondi Gonm Meetei_Mayek Mtei Mende_Kikakui Mend Meroitic_Cursive Merc Meroitic_Hieroglyphs Mero Miao Plrd Modi Mongolian Mong Mro Mroo Multani Mult Myanmar Mymr Nabataean Nbat New_Tai_Lue Talu Newa Newa Nko Nkoo Nushu Nshu Ogham Ogam Ol_Chiki Olck Old_Hungarian Hung Old_Italic Ital Old_North_Arabian Narb Old_Permic Perm Old_Persian Xpeo Old_South_Arabian Sarb Old_Turkic Orkh Oriya Orya Osage Osge Osmanya Osma Pahawh_Hmong Hmng Palmyrene Palm Pau_Cin_Hau Pauc Phags_Pa Phag Phoenician Phnx Psalter_Pahlavi Phlp Rejang Rjng Runic Runr Samaritan Samr Saurashtra Saur Sharada Shrd Shavian Shaw Siddham Sidd SignWriting Sgnw Sinhala Sinh Sora_Sompeng Sora Soyombo Soyo Sundanese Sund Syloti_Nagri Sylo Syriac Syrc Tagalog Tglg Tagbanwa Tagb Tai_Le Tale Tai_Tham Lana Tai_Viet Tavt Takri Takr Tamil Taml Tangut Tang Telugu Telu Thaana Thaa Thai Thai Tibetan Tibt Tifinagh Tfng Tirhuta Tirh Ugaritic Ugar Vai Vaii Warang_Citi Wara Yi Yiii Zanabazar_Square Zanb",En=Cn+" Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd",_n=En+" Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho",$n=_n+" Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi",In=$n+" Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith",Hi=In+" "+ji,Wi={9:Cn,10:En,11:_n,12:$n,13:In,14:Hi},An={};function zi(t){var e=An[t]={binary:ve(Fi[t]+" "+Xt),binaryOfStrings:ve(Ui[t]),nonBinary:{General_Category:ve(Xt),Script:ve(Wi[t])}};e.nonBinary.Script_Extensions=e.nonBinary.Script,e.nonBinary.gc=e.nonBinary.General_Category,e.nonBinary.sc=e.nonBinary.Script,e.nonBinary.scx=e.nonBinary.Script_Extensions}for(We=0,ct=[9,10,11,12,13,14];We<ct.length;We+=1)en=ct[We],zi(en);var en,We,ct,b=j.prototype,Ge=function(e,n){this.parent=e,this.base=n||this};Ge.prototype.separatedFrom=function(e){for(var n=this;n;n=n.parent)for(var i=e;i;i=i.parent)if(n.base===i.base&&n!==i)return!0;return!1};Ge.prototype.sibling=function(){return new Ge(this.parent,this.base)};var oe=function(e){this.parser=e,this.validFlags="gim"+(e.options.ecmaVersion>=6?"uy":"")+(e.options.ecmaVersion>=9?"s":"")+(e.options.ecmaVersion>=13?"d":"")+(e.options.ecmaVersion>=15?"v":""),this.unicodeProperties=An[e.options.ecmaVersion>=14?14:e.options.ecmaVersion],this.source="",this.flags="",this.start=0,this.switchU=!1,this.switchV=!1,this.switchN=!1,this.pos=0,this.lastIntValue=0,this.lastStringValue="",this.lastAssertionIsQuantifiable=!1,this.numCapturingParens=0,this.maxBackReference=0,this.groupNames=Object.create(null),this.backReferenceNames=[],this.branchID=null};oe.prototype.reset=function(e,n,i){var s=i.indexOf("v")!==-1,r=i.indexOf("u")!==-1;this.start=e|0,this.source=n+"",this.flags=i,s&&this.parser.options.ecmaVersion>=15?(this.switchU=!0,this.switchV=!0,this.switchN=!0):(this.switchU=r&&this.parser.options.ecmaVersion>=6,this.switchV=!1,this.switchN=r&&this.parser.options.ecmaVersion>=9)};oe.prototype.raise=function(e){this.parser.raiseRecoverable(this.start,"Invalid regular expression: /"+this.source+"/: "+e)};oe.prototype.at=function(e,n){n===void 0&&(n=!1);var i=this.source,s=i.length;if(e>=s)return-1;var r=i.charCodeAt(e);if(!(n||this.switchU)||r<=55295||r>=57344||e+1>=s)return r;var a=i.charCodeAt(e+1);return a>=56320&&a<=57343?(r<<10)+a-56613888:r};oe.prototype.nextIndex=function(e,n){n===void 0&&(n=!1);var i=this.source,s=i.length;if(e>=s)return s;var r=i.charCodeAt(e),a;return!(n||this.switchU)||r<=55295||r>=57344||e+1>=s||(a=i.charCodeAt(e+1))<56320||a>57343?e+1:e+2};oe.prototype.current=function(e){return e===void 0&&(e=!1),this.at(this.pos,e)};oe.prototype.lookahead=function(e){return e===void 0&&(e=!1),this.at(this.nextIndex(this.pos,e),e)};oe.prototype.advance=function(e){e===void 0&&(e=!1),this.pos=this.nextIndex(this.pos,e)};oe.prototype.eat=function(e,n){return n===void 0&&(n=!1),this.current(n)===e?(this.advance(n),!0):!1};oe.prototype.eatChars=function(e,n){n===void 0&&(n=!1);for(var i=this.pos,s=0,r=e;s<r.length;s+=1){var a=r[s],o=this.at(i,n);if(o===-1||o!==a)return!1;i=this.nextIndex(i,n)}return this.pos=i,!0};b.validateRegExpFlags=function(t){for(var e=t.validFlags,n=t.flags,i=!1,s=!1,r=0;r<n.length;r++){var a=n.charAt(r);e.indexOf(a)===-1&&this.raise(t.start,"Invalid regular expression flag"),n.indexOf(a,r+1)>-1&&this.raise(t.start,"Duplicate regular expression flag"),a==="u"&&(i=!0),a==="v"&&(s=!0)}this.options.ecmaVersion>=15&&i&&s&&this.raise(t.start,"Invalid regular expression flag")};function qi(t){for(var e in t)return!0;return!1}b.validateRegExpPattern=function(t){this.regexp_pattern(t),!t.switchN&&this.options.ecmaVersion>=9&&qi(t.groupNames)&&(t.switchN=!0,this.regexp_pattern(t))};b.regexp_pattern=function(t){t.pos=0,t.lastIntValue=0,t.lastStringValue="",t.lastAssertionIsQuantifiable=!1,t.numCapturingParens=0,t.maxBackReference=0,t.groupNames=Object.create(null),t.backReferenceNames.length=0,t.branchID=null,this.regexp_disjunction(t),t.pos!==t.source.length&&(t.eat(41)&&t.raise("Unmatched ')'"),(t.eat(93)||t.eat(125))&&t.raise("Lone quantifier brackets")),t.maxBackReference>t.numCapturingParens&&t.raise("Invalid escape");for(var e=0,n=t.backReferenceNames;e<n.length;e+=1){var i=n[e];t.groupNames[i]||t.raise("Invalid named capture referenced")}};b.regexp_disjunction=function(t){var e=this.options.ecmaVersion>=16;for(e&&(t.branchID=new Ge(t.branchID,null)),this.regexp_alternative(t);t.eat(124);)e&&(t.branchID=t.branchID.sibling()),this.regexp_alternative(t);e&&(t.branchID=t.branchID.parent),this.regexp_eatQuantifier(t,!0)&&t.raise("Nothing to repeat"),t.eat(123)&&t.raise("Lone quantifier brackets")};b.regexp_alternative=function(t){for(;t.pos<t.source.length&&this.regexp_eatTerm(t););};b.regexp_eatTerm=function(t){return this.regexp_eatAssertion(t)?(t.lastAssertionIsQuantifiable&&this.regexp_eatQuantifier(t)&&t.switchU&&t.raise("Invalid quantifier"),!0):(t.switchU?this.regexp_eatAtom(t):this.regexp_eatExtendedAtom(t))?(this.regexp_eatQuantifier(t),!0):!1};b.regexp_eatAssertion=function(t){var e=t.pos;if(t.lastAssertionIsQuantifiable=!1,t.eat(94)||t.eat(36))return!0;if(t.eat(92)){if(t.eat(66)||t.eat(98))return!0;t.pos=e}if(t.eat(40)&&t.eat(63)){var n=!1;if(this.options.ecmaVersion>=9&&(n=t.eat(60)),t.eat(61)||t.eat(33))return this.regexp_disjunction(t),t.eat(41)||t.raise("Unterminated group"),t.lastAssertionIsQuantifiable=!n,!0}return t.pos=e,!1};b.regexp_eatQuantifier=function(t,e){return e===void 0&&(e=!1),this.regexp_eatQuantifierPrefix(t,e)?(t.eat(63),!0):!1};b.regexp_eatQuantifierPrefix=function(t,e){return t.eat(42)||t.eat(43)||t.eat(63)||this.regexp_eatBracedQuantifier(t,e)};b.regexp_eatBracedQuantifier=function(t,e){var n=t.pos;if(t.eat(123)){var i=0,s=-1;if(this.regexp_eatDecimalDigits(t)&&(i=t.lastIntValue,t.eat(44)&&this.regexp_eatDecimalDigits(t)&&(s=t.lastIntValue),t.eat(125)))return s!==-1&&s<i&&!e&&t.raise("numbers out of order in {} quantifier"),!0;t.switchU&&!e&&t.raise("Incomplete quantifier"),t.pos=n}return!1};b.regexp_eatAtom=function(t){return this.regexp_eatPatternCharacters(t)||t.eat(46)||this.regexp_eatReverseSolidusAtomEscape(t)||this.regexp_eatCharacterClass(t)||this.regexp_eatUncapturingGroup(t)||this.regexp_eatCapturingGroup(t)};b.regexp_eatReverseSolidusAtomEscape=function(t){var e=t.pos;if(t.eat(92)){if(this.regexp_eatAtomEscape(t))return!0;t.pos=e}return!1};b.regexp_eatUncapturingGroup=function(t){var e=t.pos;if(t.eat(40)){if(t.eat(63)){if(this.options.ecmaVersion>=16){var n=this.regexp_eatModifiers(t),i=t.eat(45);if(n||i){for(var s=0;s<n.length;s++){var r=n.charAt(s);n.indexOf(r,s+1)>-1&&t.raise("Duplicate regular expression modifiers")}if(i){var a=this.regexp_eatModifiers(t);!n&&!a&&t.current()===58&&t.raise("Invalid regular expression modifiers");for(var o=0;o<a.length;o++){var c=a.charAt(o);(a.indexOf(c,o+1)>-1||n.indexOf(c)>-1)&&t.raise("Duplicate regular expression modifiers")}}}}if(t.eat(58)){if(this.regexp_disjunction(t),t.eat(41))return!0;t.raise("Unterminated group")}}t.pos=e}return!1};b.regexp_eatCapturingGroup=function(t){if(t.eat(40)){if(this.options.ecmaVersion>=9?this.regexp_groupSpecifier(t):t.current()===63&&t.raise("Invalid group"),this.regexp_disjunction(t),t.eat(41))return t.numCapturingParens+=1,!0;t.raise("Unterminated group")}return!1};b.regexp_eatModifiers=function(t){for(var e="",n=0;(n=t.current())!==-1&&Ki(n);)e+=he(n),t.advance();return e};function Ki(t){return t===105||t===109||t===115}b.regexp_eatExtendedAtom=function(t){return t.eat(46)||this.regexp_eatReverseSolidusAtomEscape(t)||this.regexp_eatCharacterClass(t)||this.regexp_eatUncapturingGroup(t)||this.regexp_eatCapturingGroup(t)||this.regexp_eatInvalidBracedQuantifier(t)||this.regexp_eatExtendedPatternCharacter(t)};b.regexp_eatInvalidBracedQuantifier=function(t){return this.regexp_eatBracedQuantifier(t,!0)&&t.raise("Nothing to repeat"),!1};b.regexp_eatSyntaxCharacter=function(t){var e=t.current();return Nn(e)?(t.lastIntValue=e,t.advance(),!0):!1};function Nn(t){return t===36||t>=40&&t<=43||t===46||t===63||t>=91&&t<=94||t>=123&&t<=125}b.regexp_eatPatternCharacters=function(t){for(var e=t.pos,n=0;(n=t.current())!==-1&&!Nn(n);)t.advance();return t.pos!==e};b.regexp_eatExtendedPatternCharacter=function(t){var e=t.current();return e!==-1&&e!==36&&!(e>=40&&e<=43)&&e!==46&&e!==63&&e!==91&&e!==94&&e!==124?(t.advance(),!0):!1};b.regexp_groupSpecifier=function(t){if(t.eat(63)){this.regexp_eatGroupName(t)||t.raise("Invalid group");var e=this.options.ecmaVersion>=16,n=t.groupNames[t.lastStringValue];if(n)if(e)for(var i=0,s=n;i<s.length;i+=1){var r=s[i];r.separatedFrom(t.branchID)||t.raise("Duplicate capture group name")}else t.raise("Duplicate capture group name");e?(n||(t.groupNames[t.lastStringValue]=[])).push(t.branchID):t.groupNames[t.lastStringValue]=!0}};b.regexp_eatGroupName=function(t){if(t.lastStringValue="",t.eat(60)){if(this.regexp_eatRegExpIdentifierName(t)&&t.eat(62))return!0;t.raise("Invalid capture group name")}return!1};b.regexp_eatRegExpIdentifierName=function(t){if(t.lastStringValue="",this.regexp_eatRegExpIdentifierStart(t)){for(t.lastStringValue+=he(t.lastIntValue);this.regexp_eatRegExpIdentifierPart(t);)t.lastStringValue+=he(t.lastIntValue);return!0}return!1};b.regexp_eatRegExpIdentifierStart=function(t){var e=t.pos,n=this.options.ecmaVersion>=11,i=t.current(n);return t.advance(n),i===92&&this.regexp_eatRegExpUnicodeEscapeSequence(t,n)&&(i=t.lastIntValue),Gi(i)?(t.lastIntValue=i,!0):(t.pos=e,!1)};function Gi(t){return ae(t,!0)||t===36||t===95}b.regexp_eatRegExpIdentifierPart=function(t){var e=t.pos,n=this.options.ecmaVersion>=11,i=t.current(n);return t.advance(n),i===92&&this.regexp_eatRegExpUnicodeEscapeSequence(t,n)&&(i=t.lastIntValue),Ji(i)?(t.lastIntValue=i,!0):(t.pos=e,!1)};function Ji(t){return ue(t,!0)||t===36||t===95||t===8204||t===8205}b.regexp_eatAtomEscape=function(t){return this.regexp_eatBackReference(t)||this.regexp_eatCharacterClassEscape(t)||this.regexp_eatCharacterEscape(t)||t.switchN&&this.regexp_eatKGroupName(t)?!0:(t.switchU&&(t.current()===99&&t.raise("Invalid unicode escape"),t.raise("Invalid escape")),!1)};b.regexp_eatBackReference=function(t){var e=t.pos;if(this.regexp_eatDecimalEscape(t)){var n=t.lastIntValue;if(t.switchU)return n>t.maxBackReference&&(t.maxBackReference=n),!0;if(n<=t.numCapturingParens)return!0;t.pos=e}return!1};b.regexp_eatKGroupName=function(t){if(t.eat(107)){if(this.regexp_eatGroupName(t))return t.backReferenceNames.push(t.lastStringValue),!0;t.raise("Invalid named reference")}return!1};b.regexp_eatCharacterEscape=function(t){return this.regexp_eatControlEscape(t)||this.regexp_eatCControlLetter(t)||this.regexp_eatZero(t)||this.regexp_eatHexEscapeSequence(t)||this.regexp_eatRegExpUnicodeEscapeSequence(t,!1)||!t.switchU&&this.regexp_eatLegacyOctalEscapeSequence(t)||this.regexp_eatIdentityEscape(t)};b.regexp_eatCControlLetter=function(t){var e=t.pos;if(t.eat(99)){if(this.regexp_eatControlLetter(t))return!0;t.pos=e}return!1};b.regexp_eatZero=function(t){return t.current()===48&&!et(t.lookahead())?(t.lastIntValue=0,t.advance(),!0):!1};b.regexp_eatControlEscape=function(t){var e=t.current();return e===116?(t.lastIntValue=9,t.advance(),!0):e===110?(t.lastIntValue=10,t.advance(),!0):e===118?(t.lastIntValue=11,t.advance(),!0):e===102?(t.lastIntValue=12,t.advance(),!0):e===114?(t.lastIntValue=13,t.advance(),!0):!1};b.regexp_eatControlLetter=function(t){var e=t.current();return Pn(e)?(t.lastIntValue=e%32,t.advance(),!0):!1};function Pn(t){return t>=65&&t<=90||t>=97&&t<=122}b.regexp_eatRegExpUnicodeEscapeSequence=function(t,e){e===void 0&&(e=!1);var n=t.pos,i=e||t.switchU;if(t.eat(117)){if(this.regexp_eatFixedHexDigits(t,4)){var s=t.lastIntValue;if(i&&s>=55296&&s<=56319){var r=t.pos;if(t.eat(92)&&t.eat(117)&&this.regexp_eatFixedHexDigits(t,4)){var a=t.lastIntValue;if(a>=56320&&a<=57343)return t.lastIntValue=(s-55296)*1024+(a-56320)+65536,!0}t.pos=r,t.lastIntValue=s}return!0}if(i&&t.eat(123)&&this.regexp_eatHexDigits(t)&&t.eat(125)&&Zi(t.lastIntValue))return!0;i&&t.raise("Invalid unicode escape"),t.pos=n}return!1};function Zi(t){return t>=0&&t<=1114111}b.regexp_eatIdentityEscape=function(t){if(t.switchU)return this.regexp_eatSyntaxCharacter(t)?!0:t.eat(47)?(t.lastIntValue=47,!0):!1;var e=t.current();return e!==99&&(!t.switchN||e!==107)?(t.lastIntValue=e,t.advance(),!0):!1};b.regexp_eatDecimalEscape=function(t){t.lastIntValue=0;var e=t.current();if(e>=49&&e<=57){do t.lastIntValue=10*t.lastIntValue+(e-48),t.advance();while((e=t.current())>=48&&e<=57);return!0}return!1};var Tn=0,pe=1,Y=2;b.regexp_eatCharacterClassEscape=function(t){var e=t.current();if(Qi(e))return t.lastIntValue=-1,t.advance(),pe;var n=!1;if(t.switchU&&this.options.ecmaVersion>=9&&((n=e===80)||e===112)){t.lastIntValue=-1,t.advance();var i;if(t.eat(123)&&(i=this.regexp_eatUnicodePropertyValueExpression(t))&&t.eat(125))return n&&i===Y&&t.raise("Invalid property name"),i;t.raise("Invalid property name")}return Tn};function Qi(t){return t===100||t===68||t===115||t===83||t===119||t===87}b.regexp_eatUnicodePropertyValueExpression=function(t){var e=t.pos;if(this.regexp_eatUnicodePropertyName(t)&&t.eat(61)){var n=t.lastStringValue;if(this.regexp_eatUnicodePropertyValue(t)){var i=t.lastStringValue;return this.regexp_validateUnicodePropertyNameAndValue(t,n,i),pe}}if(t.pos=e,this.regexp_eatLoneUnicodePropertyNameOrValue(t)){var s=t.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(t,s)}return Tn};b.regexp_validateUnicodePropertyNameAndValue=function(t,e,n){Ie(t.unicodeProperties.nonBinary,e)||t.raise("Invalid property name"),t.unicodeProperties.nonBinary[e].test(n)||t.raise("Invalid property value")};b.regexp_validateUnicodePropertyNameOrValue=function(t,e){if(t.unicodeProperties.binary.test(e))return pe;if(t.switchV&&t.unicodeProperties.binaryOfStrings.test(e))return Y;t.raise("Invalid property name")};b.regexp_eatUnicodePropertyName=function(t){var e=0;for(t.lastStringValue="";Ln(e=t.current());)t.lastStringValue+=he(e),t.advance();return t.lastStringValue!==""};function Ln(t){return Pn(t)||t===95}b.regexp_eatUnicodePropertyValue=function(t){var e=0;for(t.lastStringValue="";Yi(e=t.current());)t.lastStringValue+=he(e),t.advance();return t.lastStringValue!==""};function Yi(t){return Ln(t)||et(t)}b.regexp_eatLoneUnicodePropertyNameOrValue=function(t){return this.regexp_eatUnicodePropertyValue(t)};b.regexp_eatCharacterClass=function(t){if(t.eat(91)){var e=t.eat(94),n=this.regexp_classContents(t);return t.eat(93)||t.raise("Unterminated character class"),e&&n===Y&&t.raise("Negated character class may contain strings"),!0}return!1};b.regexp_classContents=function(t){return t.current()===93?pe:t.switchV?this.regexp_classSetExpression(t):(this.regexp_nonEmptyClassRanges(t),pe)};b.regexp_nonEmptyClassRanges=function(t){for(;this.regexp_eatClassAtom(t);){var e=t.lastIntValue;if(t.eat(45)&&this.regexp_eatClassAtom(t)){var n=t.lastIntValue;t.switchU&&(e===-1||n===-1)&&t.raise("Invalid character class"),e!==-1&&n!==-1&&e>n&&t.raise("Range out of order in character class")}}};b.regexp_eatClassAtom=function(t){var e=t.pos;if(t.eat(92)){if(this.regexp_eatClassEscape(t))return!0;if(t.switchU){var n=t.current();(n===99||Vn(n))&&t.raise("Invalid class escape"),t.raise("Invalid escape")}t.pos=e}var i=t.current();return i!==93?(t.lastIntValue=i,t.advance(),!0):!1};b.regexp_eatClassEscape=function(t){var e=t.pos;if(t.eat(98))return t.lastIntValue=8,!0;if(t.switchU&&t.eat(45))return t.lastIntValue=45,!0;if(!t.switchU&&t.eat(99)){if(this.regexp_eatClassControlLetter(t))return!0;t.pos=e}return this.regexp_eatCharacterClassEscape(t)||this.regexp_eatCharacterEscape(t)};b.regexp_classSetExpression=function(t){var e=pe,n;if(!this.regexp_eatClassSetRange(t))if(n=this.regexp_eatClassSetOperand(t)){n===Y&&(e=Y);for(var i=t.pos;t.eatChars([38,38]);){if(t.current()!==38&&(n=this.regexp_eatClassSetOperand(t))){n!==Y&&(e=pe);continue}t.raise("Invalid character in character class")}if(i!==t.pos)return e;for(;t.eatChars([45,45]);)this.regexp_eatClassSetOperand(t)||t.raise("Invalid character in character class");if(i!==t.pos)return e}else t.raise("Invalid character in character class");for(;;)if(!this.regexp_eatClassSetRange(t)){if(n=this.regexp_eatClassSetOperand(t),!n)return e;n===Y&&(e=Y)}};b.regexp_eatClassSetRange=function(t){var e=t.pos;if(this.regexp_eatClassSetCharacter(t)){var n=t.lastIntValue;if(t.eat(45)&&this.regexp_eatClassSetCharacter(t)){var i=t.lastIntValue;return n!==-1&&i!==-1&&n>i&&t.raise("Range out of order in character class"),!0}t.pos=e}return!1};b.regexp_eatClassSetOperand=function(t){return this.regexp_eatClassSetCharacter(t)?pe:this.regexp_eatClassStringDisjunction(t)||this.regexp_eatNestedClass(t)};b.regexp_eatNestedClass=function(t){var e=t.pos;if(t.eat(91)){var n=t.eat(94),i=this.regexp_classContents(t);if(t.eat(93))return n&&i===Y&&t.raise("Negated character class may contain strings"),i;t.pos=e}if(t.eat(92)){var s=this.regexp_eatCharacterClassEscape(t);if(s)return s;t.pos=e}return null};b.regexp_eatClassStringDisjunction=function(t){var e=t.pos;if(t.eatChars([92,113])){if(t.eat(123)){var n=this.regexp_classStringDisjunctionContents(t);if(t.eat(125))return n}else t.raise("Invalid escape");t.pos=e}return null};b.regexp_classStringDisjunctionContents=function(t){for(var e=this.regexp_classString(t);t.eat(124);)this.regexp_classString(t)===Y&&(e=Y);return e};b.regexp_classString=function(t){for(var e=0;this.regexp_eatClassSetCharacter(t);)e++;return e===1?pe:Y};b.regexp_eatClassSetCharacter=function(t){var e=t.pos;if(t.eat(92))return this.regexp_eatCharacterEscape(t)||this.regexp_eatClassSetReservedPunctuator(t)?!0:t.eat(98)?(t.lastIntValue=8,!0):(t.pos=e,!1);var n=t.current();return n<0||n===t.lookahead()&&Xi(n)||es(n)?!1:(t.advance(),t.lastIntValue=n,!0)};function Xi(t){return t===33||t>=35&&t<=38||t>=42&&t<=44||t===46||t>=58&&t<=64||t===94||t===96||t===126}function es(t){return t===40||t===41||t===45||t===47||t>=91&&t<=93||t>=123&&t<=125}b.regexp_eatClassSetReservedPunctuator=function(t){var e=t.current();return ts(e)?(t.lastIntValue=e,t.advance(),!0):!1};function ts(t){return t===33||t===35||t===37||t===38||t===44||t===45||t>=58&&t<=62||t===64||t===96||t===126}b.regexp_eatClassControlLetter=function(t){var e=t.current();return et(e)||e===95?(t.lastIntValue=e%32,t.advance(),!0):!1};b.regexp_eatHexEscapeSequence=function(t){var e=t.pos;if(t.eat(120)){if(this.regexp_eatFixedHexDigits(t,2))return!0;t.switchU&&t.raise("Invalid escape"),t.pos=e}return!1};b.regexp_eatDecimalDigits=function(t){var e=t.pos,n=0;for(t.lastIntValue=0;et(n=t.current());)t.lastIntValue=10*t.lastIntValue+(n-48),t.advance();return t.pos!==e};function et(t){return t>=48&&t<=57}b.regexp_eatHexDigits=function(t){var e=t.pos,n=0;for(t.lastIntValue=0;Rn(n=t.current());)t.lastIntValue=16*t.lastIntValue+On(n),t.advance();return t.pos!==e};function Rn(t){return t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102}function On(t){return t>=65&&t<=70?10+(t-65):t>=97&&t<=102?10+(t-97):t-48}b.regexp_eatLegacyOctalEscapeSequence=function(t){if(this.regexp_eatOctalDigit(t)){var e=t.lastIntValue;if(this.regexp_eatOctalDigit(t)){var n=t.lastIntValue;e<=3&&this.regexp_eatOctalDigit(t)?t.lastIntValue=e*64+n*8+t.lastIntValue:t.lastIntValue=e*8+n}else t.lastIntValue=e;return!0}return!1};b.regexp_eatOctalDigit=function(t){var e=t.current();return Vn(e)?(t.lastIntValue=e-48,t.advance(),!0):(t.lastIntValue=0,!1)};function Vn(t){return t>=48&&t<=55}b.regexp_eatFixedHexDigits=function(t,e){var n=t.pos;t.lastIntValue=0;for(var i=0;i<e;++i){var s=t.current();if(!Rn(s))return t.pos=n,!1;t.lastIntValue=16*t.lastIntValue+On(s),t.advance()}return!0};var yt=function(e){this.type=e.type,this.value=e.value,this.start=e.start,this.end=e.end,e.options.locations&&(this.loc=new Je(e,e.startLoc,e.endLoc)),e.options.ranges&&(this.range=[e.start,e.end])},_=j.prototype;_.next=function(t){!t&&this.type.keyword&&this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword "+this.type.keyword),this.options.onToken&&this.options.onToken(new yt(this)),this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()};_.getToken=function(){return this.next(),new yt(this)};typeof Symbol<"u"&&(_[Symbol.iterator]=function(){var t=this;return{next:function(){var e=t.getToken();return{done:e.type===l.eof,value:e}}}});_.nextToken=function(){var t=this.curContext();if((!t||!t.preserveSpace)&&this.skipSpace(),this.start=this.pos,this.options.locations&&(this.startLoc=this.curPosition()),this.pos>=this.input.length)return this.finishToken(l.eof);if(t.override)return t.override(this);this.readToken(this.fullCharCodeAtPos())};_.readToken=function(t){return ae(t,this.options.ecmaVersion>=6)||t===92?this.readWord():this.getTokenFromCode(t)};_.fullCharCodeAt=function(t){var e=this.input.charCodeAt(t);if(e<=55295||e>=56320)return e;var n=this.input.charCodeAt(t+1);return n<=56319||n>=57344?e:(e<<10)+n-56613888};_.fullCharCodeAtPos=function(){return this.fullCharCodeAt(this.pos)};_.skipBlockComment=function(){var t=this.options.onComment&&this.curPosition(),e=this.pos,n=this.input.indexOf("*/",this.pos+=2);if(n===-1&&this.raise(this.pos-2,"Unterminated comment"),this.pos=n+2,this.options.locations)for(var i=void 0,s=e;(i=rn(this.input,s,this.pos))>-1;)++this.curLine,s=this.lineStart=i;this.options.onComment&&this.options.onComment(!0,this.input.slice(e+2,n),e,this.pos,t,this.curPosition())};_.skipLineComment=function(t){for(var e=this.pos,n=this.options.onComment&&this.curPosition(),i=this.input.charCodeAt(this.pos+=t);this.pos<this.input.length&&!$e(i);)i=this.input.charCodeAt(++this.pos);this.options.onComment&&this.options.onComment(!1,this.input.slice(e+t,this.pos),e,this.pos,n,this.curPosition())};_.skipSpace=function(){e:for(;this.pos<this.input.length;){var t=this.input.charCodeAt(this.pos);switch(t){case 32:case 160:++this.pos;break;case 13:this.input.charCodeAt(this.pos+1)===10&&++this.pos;case 10:case 8232:case 8233:++this.pos,this.options.locations&&(++this.curLine,this.lineStart=this.pos);break;case 47:switch(this.input.charCodeAt(this.pos+1)){case 42:this.skipBlockComment();break;case 47:this.skipLineComment(2);break;default:break e}break;default:if(t>8&&t<14||t>=5760&&an.test(String.fromCharCode(t)))++this.pos;else break e}}};_.finishToken=function(t,e){this.end=this.pos,this.options.locations&&(this.endLoc=this.curPosition());var n=this.type;this.type=t,this.value=e,this.updateContext(n)};_.readToken_dot=function(){var t=this.input.charCodeAt(this.pos+1);if(t>=48&&t<=57)return this.readNumber(!0);var e=this.input.charCodeAt(this.pos+2);return this.options.ecmaVersion>=6&&t===46&&e===46?(this.pos+=3,this.finishToken(l.ellipsis)):(++this.pos,this.finishToken(l.dot))};_.readToken_slash=function(){var t=this.input.charCodeAt(this.pos+1);return this.exprAllowed?(++this.pos,this.readRegexp()):t===61?this.finishOp(l.assign,2):this.finishOp(l.slash,1)};_.readToken_mult_modulo_exp=function(t){var e=this.input.charCodeAt(this.pos+1),n=1,i=t===42?l.star:l.modulo;return this.options.ecmaVersion>=7&&t===42&&e===42&&(++n,i=l.starstar,e=this.input.charCodeAt(this.pos+2)),e===61?this.finishOp(l.assign,n+1):this.finishOp(i,n)};_.readToken_pipe_amp=function(t){var e=this.input.charCodeAt(this.pos+1);if(e===t){if(this.options.ecmaVersion>=12){var n=this.input.charCodeAt(this.pos+2);if(n===61)return this.finishOp(l.assign,3)}return this.finishOp(t===124?l.logicalOR:l.logicalAND,2)}return e===61?this.finishOp(l.assign,2):this.finishOp(t===124?l.bitwiseOR:l.bitwiseAND,1)};_.readToken_caret=function(){var t=this.input.charCodeAt(this.pos+1);return t===61?this.finishOp(l.assign,2):this.finishOp(l.bitwiseXOR,1)};_.readToken_plus_min=function(t){var e=this.input.charCodeAt(this.pos+1);return e===t?e===45&&!this.inModule&&this.input.charCodeAt(this.pos+2)===62&&(this.lastTokEnd===0||z.test(this.input.slice(this.lastTokEnd,this.pos)))?(this.skipLineComment(3),this.skipSpace(),this.nextToken()):this.finishOp(l.incDec,2):e===61?this.finishOp(l.assign,2):this.finishOp(l.plusMin,1)};_.readToken_lt_gt=function(t){var e=this.input.charCodeAt(this.pos+1),n=1;return e===t?(n=t===62&&this.input.charCodeAt(this.pos+2)===62?3:2,this.input.charCodeAt(this.pos+n)===61?this.finishOp(l.assign,n+1):this.finishOp(l.bitShift,n)):e===33&&t===60&&!this.inModule&&this.input.charCodeAt(this.pos+2)===45&&this.input.charCodeAt(this.pos+3)===45?(this.skipLineComment(4),this.skipSpace(),this.nextToken()):(e===61&&(n=2),this.finishOp(l.relational,n))};_.readToken_eq_excl=function(t){var e=this.input.charCodeAt(this.pos+1);return e===61?this.finishOp(l.equality,this.input.charCodeAt(this.pos+2)===61?3:2):t===61&&e===62&&this.options.ecmaVersion>=6?(this.pos+=2,this.finishToken(l.arrow)):this.finishOp(t===61?l.eq:l.prefix,1)};_.readToken_question=function(){var t=this.options.ecmaVersion;if(t>=11){var e=this.input.charCodeAt(this.pos+1);if(e===46){var n=this.input.charCodeAt(this.pos+2);if(n<48||n>57)return this.finishOp(l.questionDot,2)}if(e===63){if(t>=12){var i=this.input.charCodeAt(this.pos+2);if(i===61)return this.finishOp(l.assign,3)}return this.finishOp(l.coalesce,2)}}return this.finishOp(l.question,1)};_.readToken_numberSign=function(){var t=this.options.ecmaVersion,e=35;if(t>=13&&(++this.pos,e=this.fullCharCodeAtPos(),ae(e,!0)||e===92))return this.finishToken(l.privateId,this.readWord1());this.raise(this.pos,"Unexpected character '"+he(e)+"'")};_.getTokenFromCode=function(t){switch(t){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(l.parenL);case 41:return++this.pos,this.finishToken(l.parenR);case 59:return++this.pos,this.finishToken(l.semi);case 44:return++this.pos,this.finishToken(l.comma);case 91:return++this.pos,this.finishToken(l.bracketL);case 93:return++this.pos,this.finishToken(l.bracketR);case 123:return++this.pos,this.finishToken(l.braceL);case 125:return++this.pos,this.finishToken(l.braceR);case 58:return++this.pos,this.finishToken(l.colon);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(l.backQuote);case 48:var e=this.input.charCodeAt(this.pos+1);if(e===120||e===88)return this.readRadixNumber(16);if(this.options.ecmaVersion>=6){if(e===111||e===79)return this.readRadixNumber(8);if(e===98||e===66)return this.readRadixNumber(2)}case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return this.readNumber(!1);case 34:case 39:return this.readString(t);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo_exp(t);case 124:case 38:return this.readToken_pipe_amp(t);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(t);case 60:case 62:return this.readToken_lt_gt(t);case 61:case 33:return this.readToken_eq_excl(t);case 63:return this.readToken_question();case 126:return this.finishOp(l.prefix,1);case 35:return this.readToken_numberSign()}this.raise(this.pos,"Unexpected character '"+he(t)+"'")};_.finishOp=function(t,e){var n=this.input.slice(this.pos,this.pos+e);return this.pos+=e,this.finishToken(t,n)};_.readRegexp=function(){for(var t,e,n=this.pos;;){this.pos>=this.input.length&&this.raise(n,"Unterminated regular expression");var i=this.input.charAt(this.pos);if(z.test(i)&&this.raise(n,"Unterminated regular expression"),t)t=!1;else{if(i==="[")e=!0;else if(i==="]"&&e)e=!1;else if(i==="/"&&!e)break;t=i==="\\"}++this.pos}var s=this.input.slice(n,this.pos);++this.pos;var r=this.pos,a=this.readWord1();this.containsEsc&&this.unexpected(r);var o=this.regexpState||(this.regexpState=new oe(this));o.reset(n,s,a),this.validateRegExpFlags(o),this.validateRegExpPattern(o);var c=null;try{c=new RegExp(s,a)}catch{}return this.finishToken(l.regexp,{pattern:s,flags:a,value:c})};_.readInt=function(t,e,n){for(var i=this.options.ecmaVersion>=12&&e===void 0,s=n&&this.input.charCodeAt(this.pos)===48,r=this.pos,a=0,o=0,c=0,h=e??1/0;c<h;++c,++this.pos){var u=this.input.charCodeAt(this.pos),f=void 0;if(i&&u===95){s&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed in legacy octal numeric literals"),o===95&&this.raiseRecoverable(this.pos,"Numeric separator must be exactly one underscore"),c===0&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed at the first of digits"),o=u;continue}if(u>=97?f=u-97+10:u>=65?f=u-65+10:u>=48&&u<=57?f=u-48:f=1/0,f>=t)break;o=u,a=a*t+f}return i&&o===95&&this.raiseRecoverable(this.pos-1,"Numeric separator is not allowed at the last of digits"),this.pos===r||e!=null&&this.pos-r!==e?null:a};function ns(t,e){return e?parseInt(t,8):parseFloat(t.replace(/_/g,""))}function Bn(t){return typeof BigInt!="function"?null:BigInt(t.replace(/_/g,""))}_.readRadixNumber=function(t){var e=this.pos;this.pos+=2;var n=this.readInt(t);return n==null&&this.raise(this.start+2,"Expected number in radix "+t),this.options.ecmaVersion>=11&&this.input.charCodeAt(this.pos)===110?(n=Bn(this.input.slice(e,this.pos)),++this.pos):ae(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(l.num,n)};_.readNumber=function(t){var e=this.pos;!t&&this.readInt(10,void 0,!0)===null&&this.raise(e,"Invalid number");var n=this.pos-e>=2&&this.input.charCodeAt(e)===48;n&&this.strict&&this.raise(e,"Invalid number");var i=this.input.charCodeAt(this.pos);if(!n&&!t&&this.options.ecmaVersion>=11&&i===110){var s=Bn(this.input.slice(e,this.pos));return++this.pos,ae(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(l.num,s)}n&&/[89]/.test(this.input.slice(e,this.pos))&&(n=!1),i===46&&!n&&(++this.pos,this.readInt(10),i=this.input.charCodeAt(this.pos)),(i===69||i===101)&&!n&&(i=this.input.charCodeAt(++this.pos),(i===43||i===45)&&++this.pos,this.readInt(10)===null&&this.raise(e,"Invalid number")),ae(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number");var r=ns(this.input.slice(e,this.pos),n);return this.finishToken(l.num,r)};_.readCodePoint=function(){var t=this.input.charCodeAt(this.pos),e;if(t===123){this.options.ecmaVersion<6&&this.unexpected();var n=++this.pos;e=this.readHexChar(this.input.indexOf("}",this.pos)-this.pos),++this.pos,e>1114111&&this.invalidStringToken(n,"Code point out of bounds")}else e=this.readHexChar(4);return e};_.readString=function(t){for(var e="",n=++this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated string constant");var i=this.input.charCodeAt(this.pos);if(i===t)break;i===92?(e+=this.input.slice(n,this.pos),e+=this.readEscapedChar(!1),n=this.pos):i===8232||i===8233?(this.options.ecmaVersion<10&&this.raise(this.start,"Unterminated string constant"),++this.pos,this.options.locations&&(this.curLine++,this.lineStart=this.pos)):($e(i)&&this.raise(this.start,"Unterminated string constant"),++this.pos)}return e+=this.input.slice(n,this.pos++),this.finishToken(l.string,e)};var jn={};_.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(t){if(t===jn)this.readInvalidTemplateToken();else throw t}this.inTemplateElement=!1};_.invalidStringToken=function(t,e){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw jn;this.raise(t,e)};_.readTmplToken=function(){for(var t="",e=this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated template");var n=this.input.charCodeAt(this.pos);if(n===96||n===36&&this.input.charCodeAt(this.pos+1)===123)return this.pos===this.start&&(this.type===l.template||this.type===l.invalidTemplate)?n===36?(this.pos+=2,this.finishToken(l.dollarBraceL)):(++this.pos,this.finishToken(l.backQuote)):(t+=this.input.slice(e,this.pos),this.finishToken(l.template,t));if(n===92)t+=this.input.slice(e,this.pos),t+=this.readEscapedChar(!0),e=this.pos;else if($e(n)){switch(t+=this.input.slice(e,this.pos),++this.pos,n){case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:t+=`
|
|
16
|
+
`),cooked:this.value},this.next(),n.tail=this.type===l.backQuote,this.finishNode(n,"TemplateElement")};S.parseTemplate=function(t){t===void 0&&(t={});var e=t.isTagged;e===void 0&&(e=!1);var n=this.startNode();this.next(),n.expressions=[];var i=this.parseTemplateElement({isTagged:e});for(n.quasis=[i];!i.tail;)this.type===l.eof&&this.raise(this.pos,"Unterminated template literal"),this.expect(l.dollarBraceL),n.expressions.push(this.parseExpression()),this.expect(l.braceR),n.quasis.push(i=this.parseTemplateElement({isTagged:e}));return this.next(),this.finishNode(n,"TemplateLiteral")};S.isAsyncProp=function(t){return!t.computed&&t.key.type==="Identifier"&&t.key.name==="async"&&(this.type===l.name||this.type===l.num||this.type===l.string||this.type===l.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===l.star)&&!z.test(this.input.slice(this.lastTokEnd,this.start))};S.parseObj=function(t,e){var n=this.startNode(),i=!0,s={};for(n.properties=[],this.next();!this.eat(l.braceR);){if(i)i=!1;else if(this.expect(l.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(l.braceR))break;var r=this.parseProperty(t,e);t||this.checkPropClash(r,s,e),n.properties.push(r)}return this.finishNode(n,t?"ObjectPattern":"ObjectExpression")};S.parseProperty=function(t,e){var n=this.startNode(),i,s,r,a;if(this.options.ecmaVersion>=9&&this.eat(l.ellipsis))return t?(n.argument=this.parseIdent(!1),this.type===l.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.finishNode(n,"RestElement")):(n.argument=this.parseMaybeAssign(!1,e),this.type===l.comma&&e&&e.trailingComma<0&&(e.trailingComma=this.start),this.finishNode(n,"SpreadElement"));this.options.ecmaVersion>=6&&(n.method=!1,n.shorthand=!1,(t||e)&&(r=this.start,a=this.startLoc),t||(i=this.eat(l.star)));var o=this.containsEsc;return this.parsePropertyName(n),!t&&!o&&this.options.ecmaVersion>=8&&!i&&this.isAsyncProp(n)?(s=!0,i=this.options.ecmaVersion>=9&&this.eat(l.star),this.parsePropertyName(n)):s=!1,this.parsePropertyValue(n,t,i,s,r,a,e,o),this.finishNode(n,"Property")};S.parseGetterSetter=function(t){var e=t.key.name;this.parsePropertyName(t),t.value=this.parseMethod(!1),t.kind=e;var n=t.kind==="get"?0:1;if(t.value.params.length!==n){var i=t.value.start;t.kind==="get"?this.raiseRecoverable(i,"getter should have no params"):this.raiseRecoverable(i,"setter should have exactly one param")}else t.kind==="set"&&t.value.params[0].type==="RestElement"&&this.raiseRecoverable(t.value.params[0].start,"Setter cannot use rest params")};S.parsePropertyValue=function(t,e,n,i,s,r,a,o){(n||i)&&this.type===l.colon&&this.unexpected(),this.eat(l.colon)?(t.value=e?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,a),t.kind="init"):this.options.ecmaVersion>=6&&this.type===l.parenL?(e&&this.unexpected(),t.method=!0,t.value=this.parseMethod(n,i),t.kind="init"):!e&&!o&&this.options.ecmaVersion>=5&&!t.computed&&t.key.type==="Identifier"&&(t.key.name==="get"||t.key.name==="set")&&this.type!==l.comma&&this.type!==l.braceR&&this.type!==l.eq?((n||i)&&this.unexpected(),this.parseGetterSetter(t)):this.options.ecmaVersion>=6&&!t.computed&&t.key.type==="Identifier"?((n||i)&&this.unexpected(),this.checkUnreserved(t.key),t.key.name==="await"&&!this.awaitIdentPos&&(this.awaitIdentPos=s),e?t.value=this.parseMaybeDefault(s,r,this.copyNode(t.key)):this.type===l.eq&&a?(a.shorthandAssign<0&&(a.shorthandAssign=this.start),t.value=this.parseMaybeDefault(s,r,this.copyNode(t.key))):t.value=this.copyNode(t.key),t.kind="init",t.shorthand=!0):this.unexpected()};S.parsePropertyName=function(t){if(this.options.ecmaVersion>=6){if(this.eat(l.bracketL))return t.computed=!0,t.key=this.parseMaybeAssign(),this.expect(l.bracketR),t.key;t.computed=!1}return t.key=this.type===l.num||this.type===l.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never")};S.initFunction=function(t){t.id=null,this.options.ecmaVersion>=6&&(t.generator=t.expression=!1),this.options.ecmaVersion>=8&&(t.async=!1)};S.parseMethod=function(t,e,n){var i=this.startNode(),s=this.yieldPos,r=this.awaitPos,a=this.awaitIdentPos;return this.initFunction(i),this.options.ecmaVersion>=6&&(i.generator=t),this.options.ecmaVersion>=8&&(i.async=!!e),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(vt(e,i.generator)|Ze|(n?hn:0)),this.expect(l.parenL),i.params=this.parseBindingList(l.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(i,!1,!0,!1),this.yieldPos=s,this.awaitPos=r,this.awaitIdentPos=a,this.finishNode(i,"FunctionExpression")};S.parseArrowExpression=function(t,e,n,i){var s=this.yieldPos,r=this.awaitPos,a=this.awaitIdentPos;return this.enterScope(vt(n,!1)|gt),this.initFunction(t),this.options.ecmaVersion>=8&&(t.async=!!n),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,t.params=this.toAssignableList(e,!0),this.parseFunctionBody(t,!0,!1,i),this.yieldPos=s,this.awaitPos=r,this.awaitIdentPos=a,this.finishNode(t,"ArrowFunctionExpression")};S.parseFunctionBody=function(t,e,n,i){var s=e&&this.type!==l.braceL,r=this.strict,a=!1;if(s)t.body=this.parseMaybeAssign(i),t.expression=!0,this.checkParams(t,!1);else{var o=this.options.ecmaVersion>=7&&!this.isSimpleParamList(t.params);(!r||o)&&(a=this.strictDirective(this.end),a&&o&&this.raiseRecoverable(t.start,"Illegal 'use strict' directive in function with non-simple parameter list"));var c=this.labels;this.labels=[],a&&(this.strict=!0),this.checkParams(t,!r&&!a&&!e&&!n&&this.isSimpleParamList(t.params)),this.strict&&t.id&&this.checkLValSimple(t.id,mn),t.body=this.parseBlock(!1,void 0,a&&!r),t.expression=!1,this.adaptDirectivePrologue(t.body.body),this.labels=c}this.exitScope()};S.isSimpleParamList=function(t){for(var e=0,n=t;e<n.length;e+=1){var i=n[e];if(i.type!=="Identifier")return!1}return!0};S.checkParams=function(t,e){for(var n=Object.create(null),i=0,s=t.params;i<s.length;i+=1){var r=s[i];this.checkLValInnerPattern(r,xt,e?null:n)}};S.parseExprList=function(t,e,n,i){for(var s=[],r=!0;!this.eat(t);){if(r)r=!1;else if(this.expect(l.comma),e&&this.afterTrailingComma(t))break;var a=void 0;n&&this.type===l.comma?a=null:this.type===l.ellipsis?(a=this.parseSpread(i),i&&this.type===l.comma&&i.trailingComma<0&&(i.trailingComma=this.start)):a=this.parseMaybeAssign(!1,i),s.push(a)}return s};S.checkUnreserved=function(t){var e=t.start,n=t.end,i=t.name;if(this.inGenerator&&i==="yield"&&this.raiseRecoverable(e,"Cannot use 'yield' as identifier inside a generator"),this.inAsync&&i==="await"&&this.raiseRecoverable(e,"Cannot use 'await' as identifier inside an async function"),!(this.currentThisScope().flags&Qe)&&i==="arguments"&&this.raiseRecoverable(e,"Cannot use 'arguments' in class field initializer"),this.inClassStaticBlock&&(i==="arguments"||i==="await")&&this.raise(e,"Cannot use "+i+" in class static initialization block"),this.keywords.test(i)&&this.raise(e,"Unexpected keyword '"+i+"'"),!(this.options.ecmaVersion<6&&this.input.slice(e,n).indexOf("\\")!==-1)){var s=this.strict?this.reservedWordsStrict:this.reservedWords;s.test(i)&&(!this.inAsync&&i==="await"&&this.raiseRecoverable(e,"Cannot use keyword 'await' outside an async function"),this.raiseRecoverable(e,"The keyword '"+i+"' is reserved"))}};S.parseIdent=function(t){var e=this.parseIdentNode();return this.next(!!t),this.finishNode(e,"Identifier"),t||(this.checkUnreserved(e),e.name==="await"&&!this.awaitIdentPos&&(this.awaitIdentPos=e.start)),e};S.parseIdentNode=function(){var t=this.startNode();return this.type===l.name?t.name=this.value:this.type.keyword?(t.name=this.type.keyword,(t.name==="class"||t.name==="function")&&(this.lastTokEnd!==this.lastTokStart+1||this.input.charCodeAt(this.lastTokStart)!==46)&&this.context.pop(),this.type=l.name):this.unexpected(),t};S.parsePrivateIdent=function(){var t=this.startNode();return this.type===l.privateId?t.name=this.value:this.unexpected(),this.next(),this.finishNode(t,"PrivateIdentifier"),this.options.checkPrivateFields&&(this.privateNameStack.length===0?this.raise(t.start,"Private field '#"+t.name+"' must be declared in an enclosing class"):this.privateNameStack[this.privateNameStack.length-1].used.push(t)),t};S.parseYield=function(t){this.yieldPos||(this.yieldPos=this.start);var e=this.startNode();return this.next(),this.type===l.semi||this.canInsertSemicolon()||this.type!==l.star&&!this.type.startsExpr?(e.delegate=!1,e.argument=null):(e.delegate=this.eat(l.star),e.argument=this.parseMaybeAssign(t)),this.finishNode(e,"YieldExpression")};S.parseAwait=function(t){this.awaitPos||(this.awaitPos=this.start);var e=this.startNode();return this.next(),e.argument=this.parseMaybeUnary(null,!0,!1,t),this.finishNode(e,"AwaitExpression")};var Ke=D.prototype;Ke.raise=function(t,e){var n=ln(this.input,t);e+=" ("+n.line+":"+n.column+")",this.sourceFile&&(e+=" in "+this.sourceFile);var i=new SyntaxError(e);throw i.pos=t,i.loc=n,i.raisedAt=this.pos,i};Ke.raiseRecoverable=Ke.raise;Ke.curPosition=function(){if(this.options.locations)return new Le(this.curLine,this.pos-this.lineStart)};var xe=D.prototype,Di=function(e){this.flags=e,this.var=[],this.lexical=[],this.functions=[]};xe.enterScope=function(t){this.scopeStack.push(new Di(t))};xe.exitScope=function(){this.scopeStack.pop()};xe.treatFunctionsAsVarInScope=function(t){return t.flags&Ce||!this.inModule&&t.flags&Se};xe.declareName=function(t,e,n){var i=!1;if(e===fe){var s=this.currentScope();i=s.lexical.indexOf(t)>-1||s.functions.indexOf(t)>-1||s.var.indexOf(t)>-1,s.lexical.push(t),this.inModule&&s.flags&Se&&delete this.undefinedExports[t]}else if(e===dn){var r=this.currentScope();r.lexical.push(t)}else if(e===fn){var a=this.currentScope();this.treatFunctionsAsVar?i=a.lexical.indexOf(t)>-1:i=a.lexical.indexOf(t)>-1||a.var.indexOf(t)>-1,a.functions.push(t)}else for(var o=this.scopeStack.length-1;o>=0;--o){var c=this.scopeStack[o];if(c.lexical.indexOf(t)>-1&&!(c.flags&un&&c.lexical[0]===t)||!this.treatFunctionsAsVarInScope(c)&&c.functions.indexOf(t)>-1){i=!0;break}if(c.var.push(t),this.inModule&&c.flags&Se&&delete this.undefinedExports[t],c.flags&Qe)break}i&&this.raiseRecoverable(n,"Identifier '"+t+"' has already been declared")};xe.checkLocalExport=function(t){this.scopeStack[0].lexical.indexOf(t.name)===-1&&this.scopeStack[0].var.indexOf(t.name)===-1&&(this.undefinedExports[t.name]=t)};xe.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]};xe.currentVarScope=function(){for(var t=this.scopeStack.length-1;;t--){var e=this.scopeStack[t];if(e.flags&(Qe|Re|Ee))return e}};xe.currentThisScope=function(){for(var t=this.scopeStack.length-1;;t--){var e=this.scopeStack[t];if(e.flags&(Qe|Re|Ee)&&!(e.flags>))return e}};var Xe=function(e,n,i){this.type="",this.start=n,this.end=0,e.options.locations&&(this.loc=new Je(e,i)),e.options.directSourceFile&&(this.sourceFile=e.options.directSourceFile),e.options.ranges&&(this.range=[n,0])},Oe=D.prototype;Oe.startNode=function(){return new Xe(this,this.start,this.startLoc)};Oe.startNodeAt=function(t,e){return new Xe(this,t,e)};function xn(t,e,n,i){return t.type=e,t.end=n,this.options.locations&&(t.loc.end=i),this.options.ranges&&(t.range[1]=n),t}Oe.finishNode=function(t,e){return xn.call(this,t,e,this.lastTokEnd,this.lastTokEndLoc)};Oe.finishNodeAt=function(t,e,n,i){return xn.call(this,t,e,n,i)};Oe.copyNode=function(t){var e=new Xe(this,t.start,this.startLoc);for(var n in t)e[n]=t[n];return e};var ji="Berf Beria_Erfe Gara Garay Gukh Gurung_Khema Hrkt Katakana_Or_Hiragana Kawi Kirat_Rai Krai Nag_Mundari Nagm Ol_Onal Onao Sidetic Sidt Sunu Sunuwar Tai_Yo Tayo Todhri Todr Tolong_Siki Tols Tulu_Tigalari Tutg Unknown Zzzz",bn="ASCII ASCII_Hex_Digit AHex Alphabetic Alpha Any Assigned Bidi_Control Bidi_C Bidi_Mirrored Bidi_M Case_Ignorable CI Cased Changes_When_Casefolded CWCF Changes_When_Casemapped CWCM Changes_When_Lowercased CWL Changes_When_NFKC_Casefolded CWKCF Changes_When_Titlecased CWT Changes_When_Uppercased CWU Dash Default_Ignorable_Code_Point DI Deprecated Dep Diacritic Dia Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Extender Ext Grapheme_Base Gr_Base Grapheme_Extend Gr_Ext Hex_Digit Hex IDS_Binary_Operator IDSB IDS_Trinary_Operator IDST ID_Continue IDC ID_Start IDS Ideographic Ideo Join_Control Join_C Logical_Order_Exception LOE Lowercase Lower Math Noncharacter_Code_Point NChar Pattern_Syntax Pat_Syn Pattern_White_Space Pat_WS Quotation_Mark QMark Radical Regional_Indicator RI Sentence_Terminal STerm Soft_Dotted SD Terminal_Punctuation Term Unified_Ideograph UIdeo Uppercase Upper Variation_Selector VS White_Space space XID_Continue XIDC XID_Start XIDS",yn=bn+" Extended_Pictographic",kn=yn,wn=kn+" EBase EComp EMod EPres ExtPict",Sn=wn,Fi=Sn,Mi={9:bn,10:yn,11:kn,12:wn,13:Sn,14:Fi},Ui="Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji",Hi={9:"",10:"",11:"",12:"",13:"",14:Ui},Xt="Cased_Letter LC Close_Punctuation Pe Connector_Punctuation Pc Control Cc cntrl Currency_Symbol Sc Dash_Punctuation Pd Decimal_Number Nd digit Enclosing_Mark Me Final_Punctuation Pf Format Cf Initial_Punctuation Pi Letter L Letter_Number Nl Line_Separator Zl Lowercase_Letter Ll Mark M Combining_Mark Math_Symbol Sm Modifier_Letter Lm Modifier_Symbol Sk Nonspacing_Mark Mn Number N Open_Punctuation Ps Other C Other_Letter Lo Other_Number No Other_Punctuation Po Other_Symbol So Paragraph_Separator Zp Private_Use Co Punctuation P punct Separator Z Space_Separator Zs Spacing_Mark Mc Surrogate Cs Symbol S Titlecase_Letter Lt Unassigned Cn Uppercase_Letter Lu",Cn="Adlam Adlm Ahom Anatolian_Hieroglyphs Hluw Arabic Arab Armenian Armn Avestan Avst Balinese Bali Bamum Bamu Bassa_Vah Bass Batak Batk Bengali Beng Bhaiksuki Bhks Bopomofo Bopo Brahmi Brah Braille Brai Buginese Bugi Buhid Buhd Canadian_Aboriginal Cans Carian Cari Caucasian_Albanian Aghb Chakma Cakm Cham Cham Cherokee Cher Common Zyyy Coptic Copt Qaac Cuneiform Xsux Cypriot Cprt Cyrillic Cyrl Deseret Dsrt Devanagari Deva Duployan Dupl Egyptian_Hieroglyphs Egyp Elbasan Elba Ethiopic Ethi Georgian Geor Glagolitic Glag Gothic Goth Grantha Gran Greek Grek Gujarati Gujr Gurmukhi Guru Han Hani Hangul Hang Hanunoo Hano Hatran Hatr Hebrew Hebr Hiragana Hira Imperial_Aramaic Armi Inherited Zinh Qaai Inscriptional_Pahlavi Phli Inscriptional_Parthian Prti Javanese Java Kaithi Kthi Kannada Knda Katakana Kana Kayah_Li Kali Kharoshthi Khar Khmer Khmr Khojki Khoj Khudawadi Sind Lao Laoo Latin Latn Lepcha Lepc Limbu Limb Linear_A Lina Linear_B Linb Lisu Lisu Lycian Lyci Lydian Lydi Mahajani Mahj Malayalam Mlym Mandaic Mand Manichaean Mani Marchen Marc Masaram_Gondi Gonm Meetei_Mayek Mtei Mende_Kikakui Mend Meroitic_Cursive Merc Meroitic_Hieroglyphs Mero Miao Plrd Modi Mongolian Mong Mro Mroo Multani Mult Myanmar Mymr Nabataean Nbat New_Tai_Lue Talu Newa Newa Nko Nkoo Nushu Nshu Ogham Ogam Ol_Chiki Olck Old_Hungarian Hung Old_Italic Ital Old_North_Arabian Narb Old_Permic Perm Old_Persian Xpeo Old_South_Arabian Sarb Old_Turkic Orkh Oriya Orya Osage Osge Osmanya Osma Pahawh_Hmong Hmng Palmyrene Palm Pau_Cin_Hau Pauc Phags_Pa Phag Phoenician Phnx Psalter_Pahlavi Phlp Rejang Rjng Runic Runr Samaritan Samr Saurashtra Saur Sharada Shrd Shavian Shaw Siddham Sidd SignWriting Sgnw Sinhala Sinh Sora_Sompeng Sora Soyombo Soyo Sundanese Sund Syloti_Nagri Sylo Syriac Syrc Tagalog Tglg Tagbanwa Tagb Tai_Le Tale Tai_Tham Lana Tai_Viet Tavt Takri Takr Tamil Taml Tangut Tang Telugu Telu Thaana Thaa Thai Thai Tibetan Tibt Tifinagh Tfng Tirhuta Tirh Ugaritic Ugar Vai Vaii Warang_Citi Wara Yi Yiii Zanabazar_Square Zanb",En=Cn+" Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd",$n=En+" Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho",_n=$n+" Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi",Nn=_n+" Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith",Wi=Nn+" "+ji,zi={9:Cn,10:En,11:$n,12:_n,13:Nn,14:Wi},In={};function qi(t){var e=In[t]={binary:ve(Mi[t]+" "+Xt),binaryOfStrings:ve(Hi[t]),nonBinary:{General_Category:ve(Xt),Script:ve(zi[t])}};e.nonBinary.Script_Extensions=e.nonBinary.Script,e.nonBinary.gc=e.nonBinary.General_Category,e.nonBinary.sc=e.nonBinary.Script,e.nonBinary.scx=e.nonBinary.Script_Extensions}for(We=0,ct=[9,10,11,12,13,14];We<ct.length;We+=1)en=ct[We],qi(en);var en,We,ct,b=D.prototype,Ge=function(e,n){this.parent=e,this.base=n||this};Ge.prototype.separatedFrom=function(e){for(var n=this;n;n=n.parent)for(var i=e;i;i=i.parent)if(n.base===i.base&&n!==i)return!0;return!1};Ge.prototype.sibling=function(){return new Ge(this.parent,this.base)};var oe=function(e){this.parser=e,this.validFlags="gim"+(e.options.ecmaVersion>=6?"uy":"")+(e.options.ecmaVersion>=9?"s":"")+(e.options.ecmaVersion>=13?"d":"")+(e.options.ecmaVersion>=15?"v":""),this.unicodeProperties=In[e.options.ecmaVersion>=14?14:e.options.ecmaVersion],this.source="",this.flags="",this.start=0,this.switchU=!1,this.switchV=!1,this.switchN=!1,this.pos=0,this.lastIntValue=0,this.lastStringValue="",this.lastAssertionIsQuantifiable=!1,this.numCapturingParens=0,this.maxBackReference=0,this.groupNames=Object.create(null),this.backReferenceNames=[],this.branchID=null};oe.prototype.reset=function(e,n,i){var s=i.indexOf("v")!==-1,r=i.indexOf("u")!==-1;this.start=e|0,this.source=n+"",this.flags=i,s&&this.parser.options.ecmaVersion>=15?(this.switchU=!0,this.switchV=!0,this.switchN=!0):(this.switchU=r&&this.parser.options.ecmaVersion>=6,this.switchV=!1,this.switchN=r&&this.parser.options.ecmaVersion>=9)};oe.prototype.raise=function(e){this.parser.raiseRecoverable(this.start,"Invalid regular expression: /"+this.source+"/: "+e)};oe.prototype.at=function(e,n){n===void 0&&(n=!1);var i=this.source,s=i.length;if(e>=s)return-1;var r=i.charCodeAt(e);if(!(n||this.switchU)||r<=55295||r>=57344||e+1>=s)return r;var a=i.charCodeAt(e+1);return a>=56320&&a<=57343?(r<<10)+a-56613888:r};oe.prototype.nextIndex=function(e,n){n===void 0&&(n=!1);var i=this.source,s=i.length;if(e>=s)return s;var r=i.charCodeAt(e),a;return!(n||this.switchU)||r<=55295||r>=57344||e+1>=s||(a=i.charCodeAt(e+1))<56320||a>57343?e+1:e+2};oe.prototype.current=function(e){return e===void 0&&(e=!1),this.at(this.pos,e)};oe.prototype.lookahead=function(e){return e===void 0&&(e=!1),this.at(this.nextIndex(this.pos,e),e)};oe.prototype.advance=function(e){e===void 0&&(e=!1),this.pos=this.nextIndex(this.pos,e)};oe.prototype.eat=function(e,n){return n===void 0&&(n=!1),this.current(n)===e?(this.advance(n),!0):!1};oe.prototype.eatChars=function(e,n){n===void 0&&(n=!1);for(var i=this.pos,s=0,r=e;s<r.length;s+=1){var a=r[s],o=this.at(i,n);if(o===-1||o!==a)return!1;i=this.nextIndex(i,n)}return this.pos=i,!0};b.validateRegExpFlags=function(t){for(var e=t.validFlags,n=t.flags,i=!1,s=!1,r=0;r<n.length;r++){var a=n.charAt(r);e.indexOf(a)===-1&&this.raise(t.start,"Invalid regular expression flag"),n.indexOf(a,r+1)>-1&&this.raise(t.start,"Duplicate regular expression flag"),a==="u"&&(i=!0),a==="v"&&(s=!0)}this.options.ecmaVersion>=15&&i&&s&&this.raise(t.start,"Invalid regular expression flag")};function Ki(t){for(var e in t)return!0;return!1}b.validateRegExpPattern=function(t){this.regexp_pattern(t),!t.switchN&&this.options.ecmaVersion>=9&&Ki(t.groupNames)&&(t.switchN=!0,this.regexp_pattern(t))};b.regexp_pattern=function(t){t.pos=0,t.lastIntValue=0,t.lastStringValue="",t.lastAssertionIsQuantifiable=!1,t.numCapturingParens=0,t.maxBackReference=0,t.groupNames=Object.create(null),t.backReferenceNames.length=0,t.branchID=null,this.regexp_disjunction(t),t.pos!==t.source.length&&(t.eat(41)&&t.raise("Unmatched ')'"),(t.eat(93)||t.eat(125))&&t.raise("Lone quantifier brackets")),t.maxBackReference>t.numCapturingParens&&t.raise("Invalid escape");for(var e=0,n=t.backReferenceNames;e<n.length;e+=1){var i=n[e];t.groupNames[i]||t.raise("Invalid named capture referenced")}};b.regexp_disjunction=function(t){var e=this.options.ecmaVersion>=16;for(e&&(t.branchID=new Ge(t.branchID,null)),this.regexp_alternative(t);t.eat(124);)e&&(t.branchID=t.branchID.sibling()),this.regexp_alternative(t);e&&(t.branchID=t.branchID.parent),this.regexp_eatQuantifier(t,!0)&&t.raise("Nothing to repeat"),t.eat(123)&&t.raise("Lone quantifier brackets")};b.regexp_alternative=function(t){for(;t.pos<t.source.length&&this.regexp_eatTerm(t););};b.regexp_eatTerm=function(t){return this.regexp_eatAssertion(t)?(t.lastAssertionIsQuantifiable&&this.regexp_eatQuantifier(t)&&t.switchU&&t.raise("Invalid quantifier"),!0):(t.switchU?this.regexp_eatAtom(t):this.regexp_eatExtendedAtom(t))?(this.regexp_eatQuantifier(t),!0):!1};b.regexp_eatAssertion=function(t){var e=t.pos;if(t.lastAssertionIsQuantifiable=!1,t.eat(94)||t.eat(36))return!0;if(t.eat(92)){if(t.eat(66)||t.eat(98))return!0;t.pos=e}if(t.eat(40)&&t.eat(63)){var n=!1;if(this.options.ecmaVersion>=9&&(n=t.eat(60)),t.eat(61)||t.eat(33))return this.regexp_disjunction(t),t.eat(41)||t.raise("Unterminated group"),t.lastAssertionIsQuantifiable=!n,!0}return t.pos=e,!1};b.regexp_eatQuantifier=function(t,e){return e===void 0&&(e=!1),this.regexp_eatQuantifierPrefix(t,e)?(t.eat(63),!0):!1};b.regexp_eatQuantifierPrefix=function(t,e){return t.eat(42)||t.eat(43)||t.eat(63)||this.regexp_eatBracedQuantifier(t,e)};b.regexp_eatBracedQuantifier=function(t,e){var n=t.pos;if(t.eat(123)){var i=0,s=-1;if(this.regexp_eatDecimalDigits(t)&&(i=t.lastIntValue,t.eat(44)&&this.regexp_eatDecimalDigits(t)&&(s=t.lastIntValue),t.eat(125)))return s!==-1&&s<i&&!e&&t.raise("numbers out of order in {} quantifier"),!0;t.switchU&&!e&&t.raise("Incomplete quantifier"),t.pos=n}return!1};b.regexp_eatAtom=function(t){return this.regexp_eatPatternCharacters(t)||t.eat(46)||this.regexp_eatReverseSolidusAtomEscape(t)||this.regexp_eatCharacterClass(t)||this.regexp_eatUncapturingGroup(t)||this.regexp_eatCapturingGroup(t)};b.regexp_eatReverseSolidusAtomEscape=function(t){var e=t.pos;if(t.eat(92)){if(this.regexp_eatAtomEscape(t))return!0;t.pos=e}return!1};b.regexp_eatUncapturingGroup=function(t){var e=t.pos;if(t.eat(40)){if(t.eat(63)){if(this.options.ecmaVersion>=16){var n=this.regexp_eatModifiers(t),i=t.eat(45);if(n||i){for(var s=0;s<n.length;s++){var r=n.charAt(s);n.indexOf(r,s+1)>-1&&t.raise("Duplicate regular expression modifiers")}if(i){var a=this.regexp_eatModifiers(t);!n&&!a&&t.current()===58&&t.raise("Invalid regular expression modifiers");for(var o=0;o<a.length;o++){var c=a.charAt(o);(a.indexOf(c,o+1)>-1||n.indexOf(c)>-1)&&t.raise("Duplicate regular expression modifiers")}}}}if(t.eat(58)){if(this.regexp_disjunction(t),t.eat(41))return!0;t.raise("Unterminated group")}}t.pos=e}return!1};b.regexp_eatCapturingGroup=function(t){if(t.eat(40)){if(this.options.ecmaVersion>=9?this.regexp_groupSpecifier(t):t.current()===63&&t.raise("Invalid group"),this.regexp_disjunction(t),t.eat(41))return t.numCapturingParens+=1,!0;t.raise("Unterminated group")}return!1};b.regexp_eatModifiers=function(t){for(var e="",n=0;(n=t.current())!==-1&&Gi(n);)e+=he(n),t.advance();return e};function Gi(t){return t===105||t===109||t===115}b.regexp_eatExtendedAtom=function(t){return t.eat(46)||this.regexp_eatReverseSolidusAtomEscape(t)||this.regexp_eatCharacterClass(t)||this.regexp_eatUncapturingGroup(t)||this.regexp_eatCapturingGroup(t)||this.regexp_eatInvalidBracedQuantifier(t)||this.regexp_eatExtendedPatternCharacter(t)};b.regexp_eatInvalidBracedQuantifier=function(t){return this.regexp_eatBracedQuantifier(t,!0)&&t.raise("Nothing to repeat"),!1};b.regexp_eatSyntaxCharacter=function(t){var e=t.current();return An(e)?(t.lastIntValue=e,t.advance(),!0):!1};function An(t){return t===36||t>=40&&t<=43||t===46||t===63||t>=91&&t<=94||t>=123&&t<=125}b.regexp_eatPatternCharacters=function(t){for(var e=t.pos,n=0;(n=t.current())!==-1&&!An(n);)t.advance();return t.pos!==e};b.regexp_eatExtendedPatternCharacter=function(t){var e=t.current();return e!==-1&&e!==36&&!(e>=40&&e<=43)&&e!==46&&e!==63&&e!==91&&e!==94&&e!==124?(t.advance(),!0):!1};b.regexp_groupSpecifier=function(t){if(t.eat(63)){this.regexp_eatGroupName(t)||t.raise("Invalid group");var e=this.options.ecmaVersion>=16,n=t.groupNames[t.lastStringValue];if(n)if(e)for(var i=0,s=n;i<s.length;i+=1){var r=s[i];r.separatedFrom(t.branchID)||t.raise("Duplicate capture group name")}else t.raise("Duplicate capture group name");e?(n||(t.groupNames[t.lastStringValue]=[])).push(t.branchID):t.groupNames[t.lastStringValue]=!0}};b.regexp_eatGroupName=function(t){if(t.lastStringValue="",t.eat(60)){if(this.regexp_eatRegExpIdentifierName(t)&&t.eat(62))return!0;t.raise("Invalid capture group name")}return!1};b.regexp_eatRegExpIdentifierName=function(t){if(t.lastStringValue="",this.regexp_eatRegExpIdentifierStart(t)){for(t.lastStringValue+=he(t.lastIntValue);this.regexp_eatRegExpIdentifierPart(t);)t.lastStringValue+=he(t.lastIntValue);return!0}return!1};b.regexp_eatRegExpIdentifierStart=function(t){var e=t.pos,n=this.options.ecmaVersion>=11,i=t.current(n);return t.advance(n),i===92&&this.regexp_eatRegExpUnicodeEscapeSequence(t,n)&&(i=t.lastIntValue),Ji(i)?(t.lastIntValue=i,!0):(t.pos=e,!1)};function Ji(t){return ae(t,!0)||t===36||t===95}b.regexp_eatRegExpIdentifierPart=function(t){var e=t.pos,n=this.options.ecmaVersion>=11,i=t.current(n);return t.advance(n),i===92&&this.regexp_eatRegExpUnicodeEscapeSequence(t,n)&&(i=t.lastIntValue),Zi(i)?(t.lastIntValue=i,!0):(t.pos=e,!1)};function Zi(t){return ue(t,!0)||t===36||t===95||t===8204||t===8205}b.regexp_eatAtomEscape=function(t){return this.regexp_eatBackReference(t)||this.regexp_eatCharacterClassEscape(t)||this.regexp_eatCharacterEscape(t)||t.switchN&&this.regexp_eatKGroupName(t)?!0:(t.switchU&&(t.current()===99&&t.raise("Invalid unicode escape"),t.raise("Invalid escape")),!1)};b.regexp_eatBackReference=function(t){var e=t.pos;if(this.regexp_eatDecimalEscape(t)){var n=t.lastIntValue;if(t.switchU)return n>t.maxBackReference&&(t.maxBackReference=n),!0;if(n<=t.numCapturingParens)return!0;t.pos=e}return!1};b.regexp_eatKGroupName=function(t){if(t.eat(107)){if(this.regexp_eatGroupName(t))return t.backReferenceNames.push(t.lastStringValue),!0;t.raise("Invalid named reference")}return!1};b.regexp_eatCharacterEscape=function(t){return this.regexp_eatControlEscape(t)||this.regexp_eatCControlLetter(t)||this.regexp_eatZero(t)||this.regexp_eatHexEscapeSequence(t)||this.regexp_eatRegExpUnicodeEscapeSequence(t,!1)||!t.switchU&&this.regexp_eatLegacyOctalEscapeSequence(t)||this.regexp_eatIdentityEscape(t)};b.regexp_eatCControlLetter=function(t){var e=t.pos;if(t.eat(99)){if(this.regexp_eatControlLetter(t))return!0;t.pos=e}return!1};b.regexp_eatZero=function(t){return t.current()===48&&!et(t.lookahead())?(t.lastIntValue=0,t.advance(),!0):!1};b.regexp_eatControlEscape=function(t){var e=t.current();return e===116?(t.lastIntValue=9,t.advance(),!0):e===110?(t.lastIntValue=10,t.advance(),!0):e===118?(t.lastIntValue=11,t.advance(),!0):e===102?(t.lastIntValue=12,t.advance(),!0):e===114?(t.lastIntValue=13,t.advance(),!0):!1};b.regexp_eatControlLetter=function(t){var e=t.current();return Pn(e)?(t.lastIntValue=e%32,t.advance(),!0):!1};function Pn(t){return t>=65&&t<=90||t>=97&&t<=122}b.regexp_eatRegExpUnicodeEscapeSequence=function(t,e){e===void 0&&(e=!1);var n=t.pos,i=e||t.switchU;if(t.eat(117)){if(this.regexp_eatFixedHexDigits(t,4)){var s=t.lastIntValue;if(i&&s>=55296&&s<=56319){var r=t.pos;if(t.eat(92)&&t.eat(117)&&this.regexp_eatFixedHexDigits(t,4)){var a=t.lastIntValue;if(a>=56320&&a<=57343)return t.lastIntValue=(s-55296)*1024+(a-56320)+65536,!0}t.pos=r,t.lastIntValue=s}return!0}if(i&&t.eat(123)&&this.regexp_eatHexDigits(t)&&t.eat(125)&&Qi(t.lastIntValue))return!0;i&&t.raise("Invalid unicode escape"),t.pos=n}return!1};function Qi(t){return t>=0&&t<=1114111}b.regexp_eatIdentityEscape=function(t){if(t.switchU)return this.regexp_eatSyntaxCharacter(t)?!0:t.eat(47)?(t.lastIntValue=47,!0):!1;var e=t.current();return e!==99&&(!t.switchN||e!==107)?(t.lastIntValue=e,t.advance(),!0):!1};b.regexp_eatDecimalEscape=function(t){t.lastIntValue=0;var e=t.current();if(e>=49&&e<=57){do t.lastIntValue=10*t.lastIntValue+(e-48),t.advance();while((e=t.current())>=48&&e<=57);return!0}return!1};var Tn=0,pe=1,X=2;b.regexp_eatCharacterClassEscape=function(t){var e=t.current();if(Yi(e))return t.lastIntValue=-1,t.advance(),pe;var n=!1;if(t.switchU&&this.options.ecmaVersion>=9&&((n=e===80)||e===112)){t.lastIntValue=-1,t.advance();var i;if(t.eat(123)&&(i=this.regexp_eatUnicodePropertyValueExpression(t))&&t.eat(125))return n&&i===X&&t.raise("Invalid property name"),i;t.raise("Invalid property name")}return Tn};function Yi(t){return t===100||t===68||t===115||t===83||t===119||t===87}b.regexp_eatUnicodePropertyValueExpression=function(t){var e=t.pos;if(this.regexp_eatUnicodePropertyName(t)&&t.eat(61)){var n=t.lastStringValue;if(this.regexp_eatUnicodePropertyValue(t)){var i=t.lastStringValue;return this.regexp_validateUnicodePropertyNameAndValue(t,n,i),pe}}if(t.pos=e,this.regexp_eatLoneUnicodePropertyNameOrValue(t)){var s=t.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(t,s)}return Tn};b.regexp_validateUnicodePropertyNameAndValue=function(t,e,n){Ne(t.unicodeProperties.nonBinary,e)||t.raise("Invalid property name"),t.unicodeProperties.nonBinary[e].test(n)||t.raise("Invalid property value")};b.regexp_validateUnicodePropertyNameOrValue=function(t,e){if(t.unicodeProperties.binary.test(e))return pe;if(t.switchV&&t.unicodeProperties.binaryOfStrings.test(e))return X;t.raise("Invalid property name")};b.regexp_eatUnicodePropertyName=function(t){var e=0;for(t.lastStringValue="";Ln(e=t.current());)t.lastStringValue+=he(e),t.advance();return t.lastStringValue!==""};function Ln(t){return Pn(t)||t===95}b.regexp_eatUnicodePropertyValue=function(t){var e=0;for(t.lastStringValue="";Xi(e=t.current());)t.lastStringValue+=he(e),t.advance();return t.lastStringValue!==""};function Xi(t){return Ln(t)||et(t)}b.regexp_eatLoneUnicodePropertyNameOrValue=function(t){return this.regexp_eatUnicodePropertyValue(t)};b.regexp_eatCharacterClass=function(t){if(t.eat(91)){var e=t.eat(94),n=this.regexp_classContents(t);return t.eat(93)||t.raise("Unterminated character class"),e&&n===X&&t.raise("Negated character class may contain strings"),!0}return!1};b.regexp_classContents=function(t){return t.current()===93?pe:t.switchV?this.regexp_classSetExpression(t):(this.regexp_nonEmptyClassRanges(t),pe)};b.regexp_nonEmptyClassRanges=function(t){for(;this.regexp_eatClassAtom(t);){var e=t.lastIntValue;if(t.eat(45)&&this.regexp_eatClassAtom(t)){var n=t.lastIntValue;t.switchU&&(e===-1||n===-1)&&t.raise("Invalid character class"),e!==-1&&n!==-1&&e>n&&t.raise("Range out of order in character class")}}};b.regexp_eatClassAtom=function(t){var e=t.pos;if(t.eat(92)){if(this.regexp_eatClassEscape(t))return!0;if(t.switchU){var n=t.current();(n===99||Vn(n))&&t.raise("Invalid class escape"),t.raise("Invalid escape")}t.pos=e}var i=t.current();return i!==93?(t.lastIntValue=i,t.advance(),!0):!1};b.regexp_eatClassEscape=function(t){var e=t.pos;if(t.eat(98))return t.lastIntValue=8,!0;if(t.switchU&&t.eat(45))return t.lastIntValue=45,!0;if(!t.switchU&&t.eat(99)){if(this.regexp_eatClassControlLetter(t))return!0;t.pos=e}return this.regexp_eatCharacterClassEscape(t)||this.regexp_eatCharacterEscape(t)};b.regexp_classSetExpression=function(t){var e=pe,n;if(!this.regexp_eatClassSetRange(t))if(n=this.regexp_eatClassSetOperand(t)){n===X&&(e=X);for(var i=t.pos;t.eatChars([38,38]);){if(t.current()!==38&&(n=this.regexp_eatClassSetOperand(t))){n!==X&&(e=pe);continue}t.raise("Invalid character in character class")}if(i!==t.pos)return e;for(;t.eatChars([45,45]);)this.regexp_eatClassSetOperand(t)||t.raise("Invalid character in character class");if(i!==t.pos)return e}else t.raise("Invalid character in character class");for(;;)if(!this.regexp_eatClassSetRange(t)){if(n=this.regexp_eatClassSetOperand(t),!n)return e;n===X&&(e=X)}};b.regexp_eatClassSetRange=function(t){var e=t.pos;if(this.regexp_eatClassSetCharacter(t)){var n=t.lastIntValue;if(t.eat(45)&&this.regexp_eatClassSetCharacter(t)){var i=t.lastIntValue;return n!==-1&&i!==-1&&n>i&&t.raise("Range out of order in character class"),!0}t.pos=e}return!1};b.regexp_eatClassSetOperand=function(t){return this.regexp_eatClassSetCharacter(t)?pe:this.regexp_eatClassStringDisjunction(t)||this.regexp_eatNestedClass(t)};b.regexp_eatNestedClass=function(t){var e=t.pos;if(t.eat(91)){var n=t.eat(94),i=this.regexp_classContents(t);if(t.eat(93))return n&&i===X&&t.raise("Negated character class may contain strings"),i;t.pos=e}if(t.eat(92)){var s=this.regexp_eatCharacterClassEscape(t);if(s)return s;t.pos=e}return null};b.regexp_eatClassStringDisjunction=function(t){var e=t.pos;if(t.eatChars([92,113])){if(t.eat(123)){var n=this.regexp_classStringDisjunctionContents(t);if(t.eat(125))return n}else t.raise("Invalid escape");t.pos=e}return null};b.regexp_classStringDisjunctionContents=function(t){for(var e=this.regexp_classString(t);t.eat(124);)this.regexp_classString(t)===X&&(e=X);return e};b.regexp_classString=function(t){for(var e=0;this.regexp_eatClassSetCharacter(t);)e++;return e===1?pe:X};b.regexp_eatClassSetCharacter=function(t){var e=t.pos;if(t.eat(92))return this.regexp_eatCharacterEscape(t)||this.regexp_eatClassSetReservedPunctuator(t)?!0:t.eat(98)?(t.lastIntValue=8,!0):(t.pos=e,!1);var n=t.current();return n<0||n===t.lookahead()&&es(n)||ts(n)?!1:(t.advance(),t.lastIntValue=n,!0)};function es(t){return t===33||t>=35&&t<=38||t>=42&&t<=44||t===46||t>=58&&t<=64||t===94||t===96||t===126}function ts(t){return t===40||t===41||t===45||t===47||t>=91&&t<=93||t>=123&&t<=125}b.regexp_eatClassSetReservedPunctuator=function(t){var e=t.current();return ns(e)?(t.lastIntValue=e,t.advance(),!0):!1};function ns(t){return t===33||t===35||t===37||t===38||t===44||t===45||t>=58&&t<=62||t===64||t===96||t===126}b.regexp_eatClassControlLetter=function(t){var e=t.current();return et(e)||e===95?(t.lastIntValue=e%32,t.advance(),!0):!1};b.regexp_eatHexEscapeSequence=function(t){var e=t.pos;if(t.eat(120)){if(this.regexp_eatFixedHexDigits(t,2))return!0;t.switchU&&t.raise("Invalid escape"),t.pos=e}return!1};b.regexp_eatDecimalDigits=function(t){var e=t.pos,n=0;for(t.lastIntValue=0;et(n=t.current());)t.lastIntValue=10*t.lastIntValue+(n-48),t.advance();return t.pos!==e};function et(t){return t>=48&&t<=57}b.regexp_eatHexDigits=function(t){var e=t.pos,n=0;for(t.lastIntValue=0;Rn(n=t.current());)t.lastIntValue=16*t.lastIntValue+On(n),t.advance();return t.pos!==e};function Rn(t){return t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102}function On(t){return t>=65&&t<=70?10+(t-65):t>=97&&t<=102?10+(t-97):t-48}b.regexp_eatLegacyOctalEscapeSequence=function(t){if(this.regexp_eatOctalDigit(t)){var e=t.lastIntValue;if(this.regexp_eatOctalDigit(t)){var n=t.lastIntValue;e<=3&&this.regexp_eatOctalDigit(t)?t.lastIntValue=e*64+n*8+t.lastIntValue:t.lastIntValue=e*8+n}else t.lastIntValue=e;return!0}return!1};b.regexp_eatOctalDigit=function(t){var e=t.current();return Vn(e)?(t.lastIntValue=e-48,t.advance(),!0):(t.lastIntValue=0,!1)};function Vn(t){return t>=48&&t<=55}b.regexp_eatFixedHexDigits=function(t,e){var n=t.pos;t.lastIntValue=0;for(var i=0;i<e;++i){var s=t.current();if(!Rn(s))return t.pos=n,!1;t.lastIntValue=16*t.lastIntValue+On(s),t.advance()}return!0};var yt=function(e){this.type=e.type,this.value=e.value,this.start=e.start,this.end=e.end,e.options.locations&&(this.loc=new Je(e,e.startLoc,e.endLoc)),e.options.ranges&&(this.range=[e.start,e.end])},_=D.prototype;_.next=function(t){!t&&this.type.keyword&&this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword "+this.type.keyword),this.options.onToken&&this.options.onToken(new yt(this)),this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()};_.getToken=function(){return this.next(),new yt(this)};typeof Symbol<"u"&&(_[Symbol.iterator]=function(){var t=this;return{next:function(){var e=t.getToken();return{done:e.type===l.eof,value:e}}}});_.nextToken=function(){var t=this.curContext();if((!t||!t.preserveSpace)&&this.skipSpace(),this.start=this.pos,this.options.locations&&(this.startLoc=this.curPosition()),this.pos>=this.input.length)return this.finishToken(l.eof);if(t.override)return t.override(this);this.readToken(this.fullCharCodeAtPos())};_.readToken=function(t){return ae(t,this.options.ecmaVersion>=6)||t===92?this.readWord():this.getTokenFromCode(t)};_.fullCharCodeAt=function(t){var e=this.input.charCodeAt(t);if(e<=55295||e>=56320)return e;var n=this.input.charCodeAt(t+1);return n<=56319||n>=57344?e:(e<<10)+n-56613888};_.fullCharCodeAtPos=function(){return this.fullCharCodeAt(this.pos)};_.skipBlockComment=function(){var t=this.options.onComment&&this.curPosition(),e=this.pos,n=this.input.indexOf("*/",this.pos+=2);if(n===-1&&this.raise(this.pos-2,"Unterminated comment"),this.pos=n+2,this.options.locations)for(var i=void 0,s=e;(i=rn(this.input,s,this.pos))>-1;)++this.curLine,s=this.lineStart=i;this.options.onComment&&this.options.onComment(!0,this.input.slice(e+2,n),e,this.pos,t,this.curPosition())};_.skipLineComment=function(t){for(var e=this.pos,n=this.options.onComment&&this.curPosition(),i=this.input.charCodeAt(this.pos+=t);this.pos<this.input.length&&!_e(i);)i=this.input.charCodeAt(++this.pos);this.options.onComment&&this.options.onComment(!1,this.input.slice(e+t,this.pos),e,this.pos,n,this.curPosition())};_.skipSpace=function(){e:for(;this.pos<this.input.length;){var t=this.input.charCodeAt(this.pos);switch(t){case 32:case 160:++this.pos;break;case 13:this.input.charCodeAt(this.pos+1)===10&&++this.pos;case 10:case 8232:case 8233:++this.pos,this.options.locations&&(++this.curLine,this.lineStart=this.pos);break;case 47:switch(this.input.charCodeAt(this.pos+1)){case 42:this.skipBlockComment();break;case 47:this.skipLineComment(2);break;default:break e}break;default:if(t>8&&t<14||t>=5760&&an.test(String.fromCharCode(t)))++this.pos;else break e}}};_.finishToken=function(t,e){this.end=this.pos,this.options.locations&&(this.endLoc=this.curPosition());var n=this.type;this.type=t,this.value=e,this.updateContext(n)};_.readToken_dot=function(){var t=this.input.charCodeAt(this.pos+1);if(t>=48&&t<=57)return this.readNumber(!0);var e=this.input.charCodeAt(this.pos+2);return this.options.ecmaVersion>=6&&t===46&&e===46?(this.pos+=3,this.finishToken(l.ellipsis)):(++this.pos,this.finishToken(l.dot))};_.readToken_slash=function(){var t=this.input.charCodeAt(this.pos+1);return this.exprAllowed?(++this.pos,this.readRegexp()):t===61?this.finishOp(l.assign,2):this.finishOp(l.slash,1)};_.readToken_mult_modulo_exp=function(t){var e=this.input.charCodeAt(this.pos+1),n=1,i=t===42?l.star:l.modulo;return this.options.ecmaVersion>=7&&t===42&&e===42&&(++n,i=l.starstar,e=this.input.charCodeAt(this.pos+2)),e===61?this.finishOp(l.assign,n+1):this.finishOp(i,n)};_.readToken_pipe_amp=function(t){var e=this.input.charCodeAt(this.pos+1);if(e===t){if(this.options.ecmaVersion>=12){var n=this.input.charCodeAt(this.pos+2);if(n===61)return this.finishOp(l.assign,3)}return this.finishOp(t===124?l.logicalOR:l.logicalAND,2)}return e===61?this.finishOp(l.assign,2):this.finishOp(t===124?l.bitwiseOR:l.bitwiseAND,1)};_.readToken_caret=function(){var t=this.input.charCodeAt(this.pos+1);return t===61?this.finishOp(l.assign,2):this.finishOp(l.bitwiseXOR,1)};_.readToken_plus_min=function(t){var e=this.input.charCodeAt(this.pos+1);return e===t?e===45&&!this.inModule&&this.input.charCodeAt(this.pos+2)===62&&(this.lastTokEnd===0||z.test(this.input.slice(this.lastTokEnd,this.pos)))?(this.skipLineComment(3),this.skipSpace(),this.nextToken()):this.finishOp(l.incDec,2):e===61?this.finishOp(l.assign,2):this.finishOp(l.plusMin,1)};_.readToken_lt_gt=function(t){var e=this.input.charCodeAt(this.pos+1),n=1;return e===t?(n=t===62&&this.input.charCodeAt(this.pos+2)===62?3:2,this.input.charCodeAt(this.pos+n)===61?this.finishOp(l.assign,n+1):this.finishOp(l.bitShift,n)):e===33&&t===60&&!this.inModule&&this.input.charCodeAt(this.pos+2)===45&&this.input.charCodeAt(this.pos+3)===45?(this.skipLineComment(4),this.skipSpace(),this.nextToken()):(e===61&&(n=2),this.finishOp(l.relational,n))};_.readToken_eq_excl=function(t){var e=this.input.charCodeAt(this.pos+1);return e===61?this.finishOp(l.equality,this.input.charCodeAt(this.pos+2)===61?3:2):t===61&&e===62&&this.options.ecmaVersion>=6?(this.pos+=2,this.finishToken(l.arrow)):this.finishOp(t===61?l.eq:l.prefix,1)};_.readToken_question=function(){var t=this.options.ecmaVersion;if(t>=11){var e=this.input.charCodeAt(this.pos+1);if(e===46){var n=this.input.charCodeAt(this.pos+2);if(n<48||n>57)return this.finishOp(l.questionDot,2)}if(e===63){if(t>=12){var i=this.input.charCodeAt(this.pos+2);if(i===61)return this.finishOp(l.assign,3)}return this.finishOp(l.coalesce,2)}}return this.finishOp(l.question,1)};_.readToken_numberSign=function(){var t=this.options.ecmaVersion,e=35;if(t>=13&&(++this.pos,e=this.fullCharCodeAtPos(),ae(e,!0)||e===92))return this.finishToken(l.privateId,this.readWord1());this.raise(this.pos,"Unexpected character '"+he(e)+"'")};_.getTokenFromCode=function(t){switch(t){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(l.parenL);case 41:return++this.pos,this.finishToken(l.parenR);case 59:return++this.pos,this.finishToken(l.semi);case 44:return++this.pos,this.finishToken(l.comma);case 91:return++this.pos,this.finishToken(l.bracketL);case 93:return++this.pos,this.finishToken(l.bracketR);case 123:return++this.pos,this.finishToken(l.braceL);case 125:return++this.pos,this.finishToken(l.braceR);case 58:return++this.pos,this.finishToken(l.colon);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(l.backQuote);case 48:var e=this.input.charCodeAt(this.pos+1);if(e===120||e===88)return this.readRadixNumber(16);if(this.options.ecmaVersion>=6){if(e===111||e===79)return this.readRadixNumber(8);if(e===98||e===66)return this.readRadixNumber(2)}case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return this.readNumber(!1);case 34:case 39:return this.readString(t);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo_exp(t);case 124:case 38:return this.readToken_pipe_amp(t);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(t);case 60:case 62:return this.readToken_lt_gt(t);case 61:case 33:return this.readToken_eq_excl(t);case 63:return this.readToken_question();case 126:return this.finishOp(l.prefix,1);case 35:return this.readToken_numberSign()}this.raise(this.pos,"Unexpected character '"+he(t)+"'")};_.finishOp=function(t,e){var n=this.input.slice(this.pos,this.pos+e);return this.pos+=e,this.finishToken(t,n)};_.readRegexp=function(){for(var t,e,n=this.pos;;){this.pos>=this.input.length&&this.raise(n,"Unterminated regular expression");var i=this.input.charAt(this.pos);if(z.test(i)&&this.raise(n,"Unterminated regular expression"),t)t=!1;else{if(i==="[")e=!0;else if(i==="]"&&e)e=!1;else if(i==="/"&&!e)break;t=i==="\\"}++this.pos}var s=this.input.slice(n,this.pos);++this.pos;var r=this.pos,a=this.readWord1();this.containsEsc&&this.unexpected(r);var o=this.regexpState||(this.regexpState=new oe(this));o.reset(n,s,a),this.validateRegExpFlags(o),this.validateRegExpPattern(o);var c=null;try{c=new RegExp(s,a)}catch{}return this.finishToken(l.regexp,{pattern:s,flags:a,value:c})};_.readInt=function(t,e,n){for(var i=this.options.ecmaVersion>=12&&e===void 0,s=n&&this.input.charCodeAt(this.pos)===48,r=this.pos,a=0,o=0,c=0,h=e??1/0;c<h;++c,++this.pos){var u=this.input.charCodeAt(this.pos),f=void 0;if(i&&u===95){s&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed in legacy octal numeric literals"),o===95&&this.raiseRecoverable(this.pos,"Numeric separator must be exactly one underscore"),c===0&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed at the first of digits"),o=u;continue}if(u>=97?f=u-97+10:u>=65?f=u-65+10:u>=48&&u<=57?f=u-48:f=1/0,f>=t)break;o=u,a=a*t+f}return i&&o===95&&this.raiseRecoverable(this.pos-1,"Numeric separator is not allowed at the last of digits"),this.pos===r||e!=null&&this.pos-r!==e?null:a};function is(t,e){return e?parseInt(t,8):parseFloat(t.replace(/_/g,""))}function Bn(t){return typeof BigInt!="function"?null:BigInt(t.replace(/_/g,""))}_.readRadixNumber=function(t){var e=this.pos;this.pos+=2;var n=this.readInt(t);return n==null&&this.raise(this.start+2,"Expected number in radix "+t),this.options.ecmaVersion>=11&&this.input.charCodeAt(this.pos)===110?(n=Bn(this.input.slice(e,this.pos)),++this.pos):ae(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(l.num,n)};_.readNumber=function(t){var e=this.pos;!t&&this.readInt(10,void 0,!0)===null&&this.raise(e,"Invalid number");var n=this.pos-e>=2&&this.input.charCodeAt(e)===48;n&&this.strict&&this.raise(e,"Invalid number");var i=this.input.charCodeAt(this.pos);if(!n&&!t&&this.options.ecmaVersion>=11&&i===110){var s=Bn(this.input.slice(e,this.pos));return++this.pos,ae(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(l.num,s)}n&&/[89]/.test(this.input.slice(e,this.pos))&&(n=!1),i===46&&!n&&(++this.pos,this.readInt(10),i=this.input.charCodeAt(this.pos)),(i===69||i===101)&&!n&&(i=this.input.charCodeAt(++this.pos),(i===43||i===45)&&++this.pos,this.readInt(10)===null&&this.raise(e,"Invalid number")),ae(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number");var r=is(this.input.slice(e,this.pos),n);return this.finishToken(l.num,r)};_.readCodePoint=function(){var t=this.input.charCodeAt(this.pos),e;if(t===123){this.options.ecmaVersion<6&&this.unexpected();var n=++this.pos;e=this.readHexChar(this.input.indexOf("}",this.pos)-this.pos),++this.pos,e>1114111&&this.invalidStringToken(n,"Code point out of bounds")}else e=this.readHexChar(4);return e};_.readString=function(t){for(var e="",n=++this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated string constant");var i=this.input.charCodeAt(this.pos);if(i===t)break;i===92?(e+=this.input.slice(n,this.pos),e+=this.readEscapedChar(!1),n=this.pos):i===8232||i===8233?(this.options.ecmaVersion<10&&this.raise(this.start,"Unterminated string constant"),++this.pos,this.options.locations&&(this.curLine++,this.lineStart=this.pos)):(_e(i)&&this.raise(this.start,"Unterminated string constant"),++this.pos)}return e+=this.input.slice(n,this.pos++),this.finishToken(l.string,e)};var Dn={};_.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(t){if(t===Dn)this.readInvalidTemplateToken();else throw t}this.inTemplateElement=!1};_.invalidStringToken=function(t,e){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw Dn;this.raise(t,e)};_.readTmplToken=function(){for(var t="",e=this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated template");var n=this.input.charCodeAt(this.pos);if(n===96||n===36&&this.input.charCodeAt(this.pos+1)===123)return this.pos===this.start&&(this.type===l.template||this.type===l.invalidTemplate)?n===36?(this.pos+=2,this.finishToken(l.dollarBraceL)):(++this.pos,this.finishToken(l.backQuote)):(t+=this.input.slice(e,this.pos),this.finishToken(l.template,t));if(n===92)t+=this.input.slice(e,this.pos),t+=this.readEscapedChar(!0),e=this.pos;else if(_e(n)){switch(t+=this.input.slice(e,this.pos),++this.pos,n){case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:t+=`
|
|
17
17
|
`;break;default:t+=String.fromCharCode(n);break}this.options.locations&&(++this.curLine,this.lineStart=this.pos),e=this.pos}else++this.pos}};_.readInvalidTemplateToken=function(){for(;this.pos<this.input.length;this.pos++)switch(this.input[this.pos]){case"\\":++this.pos;break;case"$":if(this.input[this.pos+1]!=="{")break;case"`":return this.finishToken(l.invalidTemplate,this.input.slice(this.start,this.pos));case"\r":this.input[this.pos+1]===`
|
|
18
18
|
`&&++this.pos;case`
|
|
19
19
|
`:case"\u2028":case"\u2029":++this.curLine,this.lineStart=this.pos+1;break}this.raise(this.start,"Unterminated template")};_.readEscapedChar=function(t){var e=this.input.charCodeAt(++this.pos);switch(++this.pos,e){case 110:return`
|
|
20
|
-
`;case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return he(this.readCodePoint());case 116:return" ";case 98:return"\b";case 118:return"\v";case 102:return"\f";case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:return this.options.locations&&(this.lineStart=this.pos,++this.curLine),"";case 56:case 57:if(this.strict&&this.invalidStringToken(this.pos-1,"Invalid escape sequence"),t){var n=this.pos-1;this.invalidStringToken(n,"Invalid escape sequence in template string")}default:if(e>=48&&e<=55){var i=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],s=parseInt(i,8);return s>255&&(i=i.slice(0,-1),s=parseInt(i,8)),this.pos+=i.length-1,e=this.input.charCodeAt(this.pos),(i!=="0"||e===56||e===57)&&(this.strict||t)&&this.invalidStringToken(this.pos-1-i.length,t?"Octal literal in template string":"Octal literal in strict mode"),String.fromCharCode(s)}return
|
|
20
|
+
`;case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return he(this.readCodePoint());case 116:return" ";case 98:return"\b";case 118:return"\v";case 102:return"\f";case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:return this.options.locations&&(this.lineStart=this.pos,++this.curLine),"";case 56:case 57:if(this.strict&&this.invalidStringToken(this.pos-1,"Invalid escape sequence"),t){var n=this.pos-1;this.invalidStringToken(n,"Invalid escape sequence in template string")}default:if(e>=48&&e<=55){var i=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],s=parseInt(i,8);return s>255&&(i=i.slice(0,-1),s=parseInt(i,8)),this.pos+=i.length-1,e=this.input.charCodeAt(this.pos),(i!=="0"||e===56||e===57)&&(this.strict||t)&&this.invalidStringToken(this.pos-1-i.length,t?"Octal literal in template string":"Octal literal in strict mode"),String.fromCharCode(s)}return _e(e)?(this.options.locations&&(this.lineStart=this.pos,++this.curLine),""):String.fromCharCode(e)}};_.readHexChar=function(t){var e=this.pos,n=this.readInt(16,t);return n===null&&this.invalidStringToken(e,"Bad character escape sequence"),n};_.readWord1=function(){this.containsEsc=!1;for(var t="",e=!0,n=this.pos,i=this.options.ecmaVersion>=6;this.pos<this.input.length;){var s=this.fullCharCodeAtPos();if(ue(s,i))this.pos+=s<=65535?1:2;else if(s===92){this.containsEsc=!0,t+=this.input.slice(n,this.pos);var r=this.pos;this.input.charCodeAt(++this.pos)!==117&&this.invalidStringToken(this.pos,"Expecting Unicode escape sequence \\uXXXX"),++this.pos;var a=this.readCodePoint();(e?ae:ue)(a,i)||this.invalidStringToken(r,"Invalid Unicode escape"),t+=he(a),n=this.pos}else break;e=!1}return t+this.input.slice(n,this.pos)};_.readWord=function(){var t=this.readWord1(),e=l.name;return this.keywords.test(t)&&(e=dt[t]),this.finishToken(e,t)};var ss="8.19.0";D.acorn={Parser:D,version:ss,defaultOptions:ht,Position:Le,SourceLocation:Je,getLineInfo:ln,Node:Xe,TokenType:I,tokTypes:l,keywordTypes:dt,TokContext:se,tokContexts:O,isIdentifierChar:ue,isIdentifierStart:ae,Token:yt,isNewLine:_e,lineBreak:z,lineBreakG:$i,nonASCIIwhitespace:an};function jn(t,e){return D.parse(t,e)}function Ve(t,e){if(t)switch(t.type){case"Identifier":t.name&&e.push(t.name);break;case"ObjectPattern":for(let n of t.properties??[])Ve(n.type==="RestElement"?n.argument:n.value,e);break;case"ArrayPattern":for(let n of t.elements??[])Ve(n,e);break;case"RestElement":Ve(t.argument,e);break;case"AssignmentPattern":Ve(t.left,e);break;default:break}}function kt(t,e,n){let i;try{i=jn(t,{ecmaVersion:"latest",sourceType:n?"script":"module",allowReturnOutsideFunction:n,allowAwaitOutsideFunction:!n,locations:!0})}catch(a){let o=a,c=o.loc?e.line+o.loc.line-1:e.line,h=o.loc?o.loc.line===1?e.col+o.loc.column:o.loc.column+1:e.col;throw new P("E0500",`JavaScript syntax error in script block: ${o.message.replace(/\s*\(\d+:\d+\)$/,"")}`,{file:e.file,line:c,col:h})}let s=[],r=!1;for(let a of i.body??[])switch(a.type){case"FunctionDeclaration":case"ClassDeclaration":a.id?.name&&s.push(a.id.name);break;case"VariableDeclaration":for(let o of a.declarations??[])Ve(o.id,s);break;case"ImportDeclaration":r=!0;for(let o of a.specifiers??[])o.local?.name&&s.push(o.local.name);break;default:break}return{declared:s,hasImports:r}}var tt={onHover:":hover",onFocus:":focus",onActive:":active",onVisited:":visited",onChecked:":checked",onDisabled:":disabled",onEnabled:":enabled",onRequired:":required",onOptional:":optional",onValid:":valid",onInvalid:":invalid",onPlaceholderShown:":placeholder-shown",onFocusWithin:":focus-within",onFocusVisible:":focus-visible",onFirst:":first-child",onLast:":last-child",onFirstOfType:":first-of-type",onLastOfType:":last-of-type",onEmpty:":empty",onTarget:":target",onLink:":link",onOpen:"[open]"},Fn={before:"::before",after:"::after",placeholder:"::placeholder",selection:"::selection",firstLine:"::first-line",firstLetter:"::first-letter",marker:"::marker",backdrop:"::backdrop"},wt={dark:"(prefers-color-scheme: dark)",light:"(prefers-color-scheme: light)",reducedMotion:"(prefers-reduced-motion: reduce)",print:"print",mobile:"(max-width: 640px)",tablet:"(min-width: 641px) and (max-width: 1024px)",desktop:"(min-width: 1025px)"},as=new Set(["content","quotes"]);function $t(t){if(t.startsWith("--"))return t;let e=t.match(/^(Webkit|Moz|Ms|O)([A-Z].*)$/);return e?`-${e[1].toLowerCase()}-${$t(e[2][0].toLowerCase()+e[2].slice(1))}`:t.replace(/[A-Z]/g,n=>`-${n.toLowerCase()}`)}var St=class{constructor(e,n,i){this.src=e;this.sinth=n;this.loc=i;$(this,"pos",0);$(this,"line");this.line=i.line}fail(e){throw new P("E0400",e,{file:this.loc.file,line:this.line,col:1})}skipTrivia(){for(;this.pos<this.src.length;){let e=this.src[this.pos];if(e===`
|
|
21
21
|
`)this.line++,this.pos++;else if(e===" "||e===" "||e==="\r"||e===";")this.pos++;else if(e==="/"&&this.src[this.pos+1]==="*"){let n=this.src.indexOf("*/",this.pos+2),i=n===-1?this.src.length:n+2;this.countLines(this.pos,i),this.pos=i}else if(this.sinth&&e==="/"&&this.src[this.pos+1]==="/")for(;this.pos<this.src.length&&this.src[this.pos]!==`
|
|
22
22
|
`;)this.pos++;else if(this.sinth&&e==="-"&&this.src[this.pos+1]==="-"&&this.src[this.pos+2]==="["){let n=this.src.indexOf("]--",this.pos+3),i=n===-1?this.src.length:n+3;this.countLines(this.pos,i),this.pos=i}else if(this.sinth&&e==="-"&&this.src[this.pos+1]==="-"&&!/[A-Za-z0-9_]/.test(this.src[this.pos+2]??""))for(;this.pos<this.src.length&&this.src[this.pos]!==`
|
|
23
23
|
`;)this.pos++;else break}}countLines(e,n){for(let i=e;i<n;i++)this.src[i]===`
|
|
@@ -25,23 +25,23 @@ Defaulting to 2020, but this will stop working in the future.`)),e.ecmaVersion=1
|
|
|
25
25
|
`;)this.pos++;continue}if((s==="("||s==="[")&&i++,(s===")"||s==="]")&&i--,i===0){if(s==="{"){this.pos++;let r=this.readBlock();return this.src[this.pos]!=="}"&&this.fail(`Missing '}' for '${n.trim()}'`),this.pos++,this.makeBlock(n.trim(),r,e)}if(s===";"||s==="}")break;if(s===`
|
|
26
26
|
`){let r=n.trim(),a=r.endsWith(",")||r.endsWith(":")||this.nextLineStartsWithBrace();if(this.sinth&&r&&!a)break}}s===`
|
|
27
27
|
`&&this.line++,n+=s,this.pos++}return this.src[this.pos]===";"&&this.pos++,this.makeStatement(n.trim(),e)}nextLineStartsWithBrace(){let e=this.pos+1;for(;e<this.src.length&&/[ \t\r\n]/.test(this.src[e]);)e++;return this.src[e]==="{"}readQuoted(e){let n=this.pos;for(this.pos++;this.pos<this.src.length&&this.src[this.pos]!==e;)this.src[this.pos]==="\\"&&this.pos++,this.src[this.pos]===`
|
|
28
|
-
`&&this.fail("Unterminated string in style block"),this.pos++;return this.pos++,this.src.slice(n,this.pos)}makeBlock(e,n,i){if(e.startsWith("@")){let s=e.match(/^@([\w-]+)\s*([\s\S]*)$/);return{k:"at",name:s?.[1]??"",params:(s?.[2]??"").trim(),children:n}}if(this.sinth){let s=e.match(/^media\s*\(([\s\S]*)\)$/);if(s)return{k:"at",name:"media",params:
|
|
28
|
+
`&&this.fail("Unterminated string in style block"),this.pos++;return this.pos++,this.src.slice(n,this.pos)}makeBlock(e,n,i){if(e.startsWith("@")){let s=e.match(/^@([\w-]+)\s*([\s\S]*)$/);return{k:"at",name:s?.[1]??"",params:(s?.[2]??"").trim(),children:n}}if(this.sinth){let s=e.match(/^media\s*\(([\s\S]*)\)$/);if(s)return{k:"at",name:"media",params:os(s[1]),children:n};if(wt[e])return{k:"at",name:"media",params:wt[e],children:n};if(/^supports\s*\(/.test(e))return{k:"at",name:"supports",params:e.slice(8).trim(),children:n}}return e||this.fail(`Missing selector before '{' (line ${i})`),{k:"rule",selector:this.sinth?ls(e):e,children:n}}makeStatement(e,n){if(e.startsWith("@")){let a=e.match(/^@([\w-]+)\s*([\s\S]*)$/);return{k:"at",name:a?.[1]??"",params:(a?.[2]??"").trim(),children:null}}let i=zn(e);i===-1&&(this.sinth&&/^[A-Z][A-Za-z0-9]*$/.test(e)&&this.fail(`Missing '{' after selector '${e}'`),this.fail(`Invalid style declaration '${e}' (expected 'property: value')`));let s=e.slice(0,i).trim(),r=e.slice(i+1).trim();return r||this.fail(`Missing value for '${s}'`),{k:"decl",prop:s,value:r,line:n}}};function zn(t){let e=0,n="";for(let i=0;i<t.length;i++){let s=t[i];if(n){s==="\\"?i++:s===n&&(n="");continue}if(s==='"'||s==="'")n=s;else if(s==="("||s==="[")e++;else if(s===")"||s==="]")e--;else if(s===":"&&e===0)return i}return-1}function os(t){return _t(t,",").map(n=>{let i=n.trim(),s=zn(i);return s===-1?wt[i]??Mn(i):`(${$t(i.slice(0,s).trim())}: ${Mn(i.slice(s+1).trim())})`}).join(" and ")}function Mn(t){let e=t.match(/^(["'])([\s\S]*)\1$/);return e?e[2]:t}function _t(t,e){let n=[],i=0,s="",r="";for(let a=0;a<t.length;a++){let o=t[a];if(s){r+=o,o==="\\"?r+=t[++a]??"":o===s&&(s="");continue}if(o==='"'||o==="'"?s=o:o==="("||o==="["?i++:(o===")"||o==="]")&&i--,o===e&&i===0){n.push(r),r="";continue}r+=o}return n.push(r),n}function ls(t){return tt[t]?"&"+tt[t]:Fn[t]?"&"+Fn[t]:_t(t,",").map(e=>e.trim().replace(/(^|[\s>+~(])([A-Z][A-Za-z0-9]*)(?=$|[\s.:#[>+~,)])/g,(n,i,s)=>{let r=Z[s];return r?i+r.tag+(r.className?"."+r.className.split(" ").join("."):""):n}).replace(/&?\b(on[A-Z][A-Za-z]+)\b/g,(n,i)=>tt[i]?"&"+tt[i]:n)).join(", ")}var Ct=class{constructor(e){this.opts=e;$(this,"expressions",[])}convert(e){return e.map(n=>n.k==="decl"?this.convertDecl(n):n.k==="rule"?{...n,children:this.convert(n.children)}:{...n,children:n.children?this.convert(n.children):null})}convertDecl(e){if(e.prop.startsWith("$"))return e;let n=$t(e.prop),i=e.value,s="",r=i.match(/\s*!important$/);r&&(s=" !important",i=i.slice(0,r.index));let a=this.reactiveExpression(i);if(a!==void 0){let c=`${this.opts.varPrefix}${this.expressions.length}`;return this.expressions.push({cssVar:c,source:a,line:e.line}),{k:"decl",prop:n,value:`var(${c})${s}`,line:e.line}}let o=i.match(/^(["'])([\s\S]*)\1$/);return(o&&!as.has(n)||o&&n==="content"&&(/^(attr|counter|counters|url|var)\(|^(none|normal|open-quote|close-quote)$/.test(o[2])||/^(["'])[\s\S]*\1$/.test(o[2])))&&(i=o[2]),{k:"decl",prop:n,value:i+s,line:e.line}}reactiveExpression(e){let n=this.opts.reactiveNames;if(!n||n.size===0)return;let i=e.replace(/(["'])(?:\\.|(?!\1).)*\1/g,'""');if((i.match(/[A-Za-z_$][A-Za-z0-9_$]*(?:\.[A-Za-z_$][A-Za-z0-9_$]*)*/g)??[]).some(a=>n.has(a.split(".")[0]))&&(/^[A-Za-z_$][\w$.]*$/.test(e.trim())||/[+*/?]|\(|\)/.test(i)||/^["']/.test(e.trim())))return e.trim()}};function Un(t,e,n){let i=new St(t,e,n),s=i.readBlock();return i.pos<t.length&&i.fail("Unexpected '}' in style block"),s}function Et(t,e=""){let n=[];for(let i of t)i.k==="decl"?n.push(`${e}${i.prop}: ${i.value};`):i.k==="rule"?n.push(`${e}${i.selector} {
|
|
29
29
|
${Et(i.children,e+" ")}
|
|
30
30
|
${e}}`):i.children===null?n.push(`${e}@${i.name}${i.params?" "+i.params:""};`):n.push(`${e}@${i.name}${i.params?" "+i.params:""} {
|
|
31
31
|
${Et(i.children,e+" ")}
|
|
32
32
|
${e}}`);return n.join(`
|
|
33
|
-
`)}var Hn=/^(html|body|:root|:host)(?=$|[\s.:#[>+~])/;function
|
|
33
|
+
`)}var Hn=/^(html|body|:root|:host)(?=$|[\s.:#[>+~])/;function cs(t,e){let n=t.trim();if(/^:global\(/.test(n)&&n.endsWith(")"))return n.slice(8,-1);if(n.includes(":global("))return n.replace(/:global\(([^)]*)\)/g,"$1");if(Hn.test(n)&&!/[\s>+~]/.test(n))return n;let i=`.${e}`,s=0,r=0;for(let u=0;u<n.length;u++){let f=n[u];f==="("||f==="["?s++:f===")"||f==="]"?s--:s===0&&/[\s>+~]/.test(f)&&(r=u+1)}let a=n.slice(0,r),o=n.slice(r);if(Hn.test(o))return n;let c=o.indexOf("::"),h=c===-1?o+i:o.slice(0,c)+i+o.slice(c);return a+h}function us(t,e){let n=[];for(let i of _t(e,",")){let s=i.trim();for(let r of t)n.push(s.includes("&")?s.replace(/&/g,r):r?`${r} ${s}`:s)}return n}function nt(t,e,n){let i=[],s=t.filter(r=>r.k==="decl");if(s.length&&e.selectors.length){let r=e.inKeyframes?e.selectors.join(", "):e.selectors.map(a=>e.scope?cs(a,e.scope):a).join(`,
|
|
34
34
|
`+n);i.push(`${n}${r} {
|
|
35
35
|
${s.map(a=>`${n} ${a.prop}: ${a.value};`).join(`
|
|
36
36
|
`)}
|
|
37
|
-
${n}}`)}else s.length&&i.push(...s.map(r=>`${n}${r.prop}: ${r.value};`));for(let r of t)if(r.k==="rule"){let a=e.inKeyframes?[r.selector]:
|
|
37
|
+
${n}}`)}else s.length&&i.push(...s.map(r=>`${n}${r.prop}: ${r.value};`));for(let r of t)if(r.k==="rule"){let a=e.inKeyframes?[r.selector]:us(e.selectors.length?e.selectors:[""],r.selector);i.push(...nt(r.children,{...e,selectors:a},n))}else if(r.k==="at"){if(r.children===null){i.push(`${n}@${r.name}${r.params?" "+r.params:""};`);continue}if(/keyframes$/.test(r.name)||r.name==="font-face"||r.name==="property"||r.name==="page"||r.name==="counter-style"){let c=nt(r.children,{selectors:[],scope:void 0,inKeyframes:!0},n+" ");i.push(`${n}@${r.name}${r.params?" "+r.params:""} {
|
|
38
38
|
${c.join(`
|
|
39
39
|
`)}
|
|
40
40
|
${n}}`);continue}let o=nt(r.children,e,n+" ");o.length&&i.push(`${n}@${r.name}${r.params?" "+r.params:""} {
|
|
41
41
|
${o.join(`
|
|
42
42
|
`)}
|
|
43
43
|
${n}}`)}return i}function Wn(t,e){return nt(t,{selectors:[],scope:e,inKeyframes:!1},"").join(`
|
|
44
|
-
`)}function it(t,e,n,i){let s=new Ct(n),r=s.convert(Un(t,e!=="css",n.loc));if(e==="scss"){if(!i)throw new P("E0401","SCSS support requires the 'sass' package",n.loc,"Install it in your project: npm install -D sass");let a=i(Et(r),n.loc.file);return{css:Wn(Un(a,!1,n.loc),n.scope),expressions:s.expressions}}return{css:Wn(r,n.scope),expressions:s.expressions}}function
|
|
44
|
+
`)}function it(t,e,n,i){let s=new Ct(n),r=s.convert(Un(t,e!=="css",n.loc));if(e==="scss"){if(!i)throw new P("E0401","SCSS support requires the 'sass' package",n.loc,"Install it in your project: npm install -D sass");let a=i(Et(r),n.loc.file);return{css:Wn(Un(a,!1,n.loc),n.scope),expressions:s.expressions}}return{css:Wn(r,n.scope),expressions:s.expressions}}function Ae(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function T(t){return t.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}function be(t){let e=2166136261,n=16777619;for(let i=0;i<t.length;i++){let s=t.charCodeAt(i);e=Math.imul(e^s,16777619)>>>0,n=Math.imul(n^s,1540483477)>>>0}return(e.toString(36)+n.toString(36)).padEnd(12,"0")}var qn={descr:"description",description:"description",author:"author",keywords:"keywords",robots:"robots",themeColor:"theme-color",colorScheme:"color-scheme",generator:"generator"};function Kn(t,e){let n={lang:"en",charset:"utf-8",viewport:"width=device-width, initial-scale=1",metaNames:[],metaProps:[],jsonLd:[]};for(let r of t){if(!r.known)throw new P("E0700",`Metadata '${r.key}' must be computable at build time`,r.loc,"Use literals, imported JSON, constants and route params. Values that need the browser (fetch, localStorage, user input) can't go in the page head");if(r.value===null||r.value===void 0||r.value===!1)continue;if(r.key==="jsonLd"){if(typeof r.value!="object")throw new P("E0701","Metadata 'jsonLd' must be an object or an array of objects",r.loc);n.jsonLd.push(JSON.stringify(r.value).replace(/</g,"\\u003c"));continue}if(typeof r.value=="object")throw new P("E0701",`Metadata '${r.key}' must be a string, number or boolean`,r.loc);let a=String(r.value);switch(r.key){case"title":n.title=a;break;case"lang":n.lang=a;break;case"charset":n.charset=a;break;case"viewport":n.viewport=a;break;case"fav":case"favicon":n.favicon=e(a);break;case"canonical":n.canonical=a;break;case"manifest":n.manifest=e(a);break;case"appleTouchIcon":n.appleTouchIcon=e(a);break;case"base":n.base=a;break;case"bodyClass":n.bodyClass=a;break;case"htmlClass":n.htmlClass=a;break;default:if(qn[r.key])n.metaNames.push([qn[r.key],a]);else if(/^og[A-Z]/.test(r.key)){let o="og:"+r.key.slice(2).replace(/[A-Z]/g,(c,h)=>h===0?c.toLowerCase():"_"+c.toLowerCase());n.metaProps.push([o,/image|url$/i.test(r.key)?e(a):a])}else if(/^twitter[A-Z]/.test(r.key)){let o="twitter:"+r.key.slice(7).replace(/[A-Z]/g,(c,h)=>h===0?c.toLowerCase():"_"+c.toLowerCase());n.metaNames.push([o,/image$/i.test(r.key)?e(a):a])}}}let i=(r,a)=>r.some(([o])=>o===a),s=n.metaNames.find(([r])=>r==="description")?.[1];return n.title&&!i(n.metaProps,"og:title")&&n.metaProps.push(["og:title",n.title]),s&&!i(n.metaProps,"og:description")&&n.metaProps.push(["og:description",s]),i(n.metaProps,"og:type")||n.metaProps.push(["og:type","website"]),i(n.metaNames,"generator")||n.metaNames.push(["generator","Sinth"]),i(n.metaNames,"twitter:card")||n.metaNames.push(["twitter:card",i(n.metaProps,"og:image")?"summary_large_image":"summary"]),n}function hs(t){switch(t.split(/[?#]/)[0].split(".").pop()?.toLowerCase()){case"ico":return"image/x-icon";case"png":return"image/png";case"svg":return"image/svg+xml";case"gif":return"image/gif";case"webp":return"image/webp";case"jpg":case"jpeg":return"image/jpeg";default:return}}function Gn(t,e,n){let i=[];i.push(`<meta charset="${T(t.charset)}">`),i.push(`<meta name="viewport" content="${T(t.viewport)}">`),t.base&&i.push(`<base href="${T(t.base)}">`),t.title!==void 0&&i.push(`<title>${Ae(t.title)}</title>`);for(let[a,o]of t.metaNames)i.push(`<meta name="${T(a)}" content="${T(o)}">`);for(let[a,o]of t.metaProps)i.push(`<meta property="${T(a)}" content="${T(o)}">`);if(t.canonical&&i.push(`<link rel="canonical" href="${T(t.canonical)}">`),t.favicon){let a=hs(t.favicon);i.push(`<link rel="icon" href="${T(t.favicon)}"${a?` type="${a}"`:""}>`)}t.appleTouchIcon&&i.push(`<link rel="apple-touch-icon" href="${T(t.appleTouchIcon)}">`),t.manifest&&i.push(`<link rel="manifest" href="${T(t.manifest)}">`);for(let a of t.jsonLd)i.push(`<script type="application/ld+json">${a}<\/script>`);for(let a of n.preloads)i.push(`<link rel="modulepreload" href="${T(a)}">`);for(let a of n.styles)i.push(`<link rel="stylesheet" href="${T(a)}">`);for(let a of n.scripts){let o=Object.entries(a.attrs).filter(([,c])=>c!==!1).map(([c,h])=>h===!0?` ${c}`:` ${c}="${T(String(h))}"`).join("");i.push(`<script${a.module?' type="module"':""} src="${T(a.src)}"${o}><\/script>`)}i.push(...n.inlineHead);let s=t.htmlClass?` class="${T(t.htmlClass)}"`:"",r=t.bodyClass?` class="${T(t.bodyClass)}"`:"";return`<!DOCTYPE html>
|
|
45
45
|
<html lang="${T(t.lang)}"${s}>
|
|
46
46
|
<head>
|
|
47
47
|
${i.map(a=>" "+a).join(`
|
|
@@ -51,59 +51,59 @@ ${i.map(a=>" "+a).join(`
|
|
|
51
51
|
${e}
|
|
52
52
|
</body>
|
|
53
53
|
</html>
|
|
54
|
-
`}var F=class{constructor(e,n="block"){this.parent=e;this.kind=n
|
|
54
|
+
`}var F=class{constructor(e,n="block"){this.parent=e;this.kind=n;$(this,"names",new Map)}define(e,n){this.names.set(e,n)}has(e){return this.names.has(e)}lookup(e){return this.names.get(e)??this.parent?.lookup(e)}all(){let e=new Set(this.names.keys());if(this.parent)for(let n of this.parent.all())e.add(n);return[...e]}inComponent(){return this.kind==="component"||!!this.parent?.inComponent()}},j=(t,e=0)=>({base:t,array:e,nullable:!1}),ps=new Set(["push","pop","shift","unshift","splice","sort","reverse","fill","copyWithin","set","delete","add","clear"]);function ne(t){return t.base+"[]".repeat(t.array)+(t.nullable?"?":"")}function fs(t,e){let n=i=>i.base==="int"?"num":i.base;return t.base==="any"||e.base==="any"?!0:t.array!==e.array?t.base==="obj"&&t.array===0&&e.array>0:n(t)===n(e)||t.base==="obj"&&e.base==="obj"?!0:t.base==="fn"||e.base==="fn"?t.base===e.base:!1}function At(t){let e={components:new Map,functions:new Map,vars:new Map};for(let s of t.components)s.exported&&e.components.set(s.name,{name:s.name,params:s.params,customTag:s.customTag});for(let s of t.functions)e.functions.set(s.name,{name:s.name,params:s.params,returnType:s.returnType,ui:s.returnType?.base==="ui"});for(let s of t.vars)e.vars.set(s.name,{name:s.name,kind:s.kind,type:s.type??void 0});let n=t.path.replace(/\\/g,"/").split("/").pop()?.replace(/\.sinth$/,"")??"",i=t.components.find(s=>s.name===n||s.name.toLowerCase()===n.toLowerCase());return e.defaultComponent=i?.name??(t.components.length===1?t.components[0].name:void 0),e}var ds={doubleclick:"dblclick",dblclick:"dblclick"},Jn=["Click","DoubleClick","Dblclick","ContextMenu","MouseDown","MouseUp","MouseMove","MouseEnter","MouseLeave","MouseOver","MouseOut","PointerDown","PointerUp","PointerMove","PointerEnter","PointerLeave","PointerCancel","TouchStart","TouchEnd","TouchMove","KeyDown","KeyUp","KeyPress","Input","Change","Submit","Reset","Focus","Blur","FocusIn","FocusOut","Scroll","Wheel","DragStart","Drag","DragEnd","DragEnter","DragLeave","DragOver","Drop","Load","Error","Resize","Select","Invalid","Play","Pause","Ended","TimeUpdate","Toggle","Close","Cancel","AnimationEnd","TransitionEnd","Copy","Cut","Paste"].map(t=>"on"+t),ms=new Set(Jn.map(t=>t.toLowerCase()));function gs(t){let e=t.slice(2).toLowerCase();return ds[e]??e}var vs=new Set(["img","video","canvas","iframe","svg","embed","object","source","input","rect","image","td","th","col","table"]),xs=new Set(["model","bind","ref","hide","show","html","delay","key","..."]),bs=new Set(["value","checked","selected","indeterminate","muted","volume","currentTime"]),It=class{constructor(e,n,i){this.file=e;this.imports=n;this.opts=i;$(this,"css",[]);$(this,"uid",0);$(this,"interactive",!1);$(this,"uses",new Set);$(this,"componentInfo",{});$(this,"usesState",!1);$(this,"diagnostics",new Fe);$(this,"moduleScope",new F(null,"module"));$(this,"importLines",[]);$(this,"exportsInfo");$(this,"fileHash");$(this,"pageCssVars",[]);this.exportsInfo=At(e),this.fileHash=be(e.path.replace(/\\/g,"/")).slice(0,6)}id(e){return`$$${e}${++this.uid}`}fail(e,n,i,s){throw new P(e,n,i,s)}compile(){let e=this.file;this.importLines.push(`import * as $$ from ${JSON.stringify(this.opts.runtime)};`),this.declareImports();for(let u of e.externs)this.moduleScope.define(u.name,{kind:"global",js:u.name});for(let u of e.params??[])this.moduleScope.define(u,{kind:"const",js:u,type:j("str")});for(let u of e.components)this.defineComponent(this.moduleScope,u.name,u.name,{name:u.name,params:u.params,customTag:u.customTag},`${e.path}#${u.name}`,u.loc);for(let u of e.functions)this.moduleScope.define(u.name,{kind:"function",js:u.name,fn:{name:u.name,params:u.params,returnType:u.returnType,ui:u.returnType?.base==="ui"},loc:u.loc});let n=[];for(let u of e.scripts)n.push(...kt(u.raw,u.loc,!1).declared);for(let u of n)this.moduleScope.has(u)||this.moduleScope.define(u,{kind:"global",js:u});e.scripts.length&&(this.interactive=!0);let i=[];for(let u of e.params??[])i.push(`const ${u} = $$.param(${JSON.stringify(u)});`);for(let u of e.vars)this.checkDuplicate(this.moduleScope,u.name,u.loc),i.push(this.genVarDecl(u,this.moduleScope,!0));for(let u of e.scripts)i.push(u.raw.trim());for(let u of e.functions)i.push("export "+this.genFunction(u,this.moduleScope));let s=this.interactive;for(let u of e.components)this.interactive=!1,this.uses=new Set,i.push(this.genComponent(u)),this.componentInfo[u.name]={interactive:this.interactive,uses:[...this.uses]};let r=s;for(let u of e.styles)this.interactive=!1,this.addStyle(u,void 0,this.moduleScope,e.isPage?"page":"module"),this.interactive&&(r=!0);this.interactive=this.pageCssVars.length>0&&e.isPage,this.uses=new Set;let a=e.vars.filter(u=>u.kind==="var");if(e.vars.length){let u=e.vars.map(f=>f.kind==="computed"?`get ${f.name}() { return ${f.name}(); }`:f.kind==="const"?`get ${f.name}() { return ${f.name}; }`:`get ${f.name}() { return ${f.name}; }, set ${f.name}($$v) { ${f.name} = $$v; }`);i.push(`export const $$vars = { ${u.join(", ")} };`)}if(e.isPage){let u={scope:new F(this.moduleScope,"function"),svg:!1},f=[];for(let d of a)d.persist&&f.push(`$$.persist(${JSON.stringify(this.persistKey(d.name))}, () => ${d.name});`);f.push(...this.genLifecycle(e.lifecycle,e.watchers,u.scope)),f.push(this.genNodes(e.body,"$$root",u)),i.push(`export function render($$root) {
|
|
55
55
|
${R(f.filter(Boolean).join(`
|
|
56
56
|
`))}
|
|
57
|
-
}`),i.push(`export function state() { return { ${
|
|
57
|
+
}`),i.push(`export function state() { return { ${a.map(d=>`${JSON.stringify(d.name)}: ${d.name}`).join(", ")} }; }`);let x=a.map(d=>`if (${JSON.stringify(d.name)} in $$s) ${d.name} = $$s[${JSON.stringify(d.name)}];`);i.push(`export function restore($$s) {${x.length?`
|
|
58
58
|
`+R(x.join(`
|
|
59
59
|
`))+`
|
|
60
|
-
`:" "}}`),(
|
|
60
|
+
`:" "}}`),(a.length||e.lifecycle.length||e.watchers.length)&&(this.usesState=!0),(a.some(d=>d.persist)||e.lifecycle.length||e.watchers.length)&&(this.interactive=!0)}else if(e.body.length){let u=e.body[0];this.diagnostics.warn("W0101","Markup outside a component in a non-page file is ignored",u.loc,"Move the file into pages/ to make it a page, or wrap the markup in a component")}for(let u of e.components){if(!u.customTag)continue;let f=u.params.map(x=>`[${JSON.stringify(x.name)}, ${JSON.stringify(x.type?ne(x.type):"str")}]`).join(", ");i.push(`$$.defineElement(${JSON.stringify(u.customTag)}, ${u.name}, [${f}]);`),this.interactive=!0}let o=e.isPage?{interactive:this.interactive,uses:[...this.uses]}:void 0;e.components.some(u=>u.customTag)&&(r=!0),this.css.length&&this.importLines.push(`import ${JSON.stringify("sinth-css:"+this.file.path)};`);let c=[...this.importLines,"",...i].join(`
|
|
61
61
|
`)+`
|
|
62
|
-
`,h=o
|
|
62
|
+
`,h=r||!!o?.interactive||Object.values(this.componentInfo).some(u=>u.interactive);return{js:c,css:this.css.join(`
|
|
63
63
|
|
|
64
|
-
`),exports:this.exportsInfo,interactive:h,base:
|
|
64
|
+
`),exports:this.exportsInfo,interactive:h,base:r,components:this.componentInfo,page:o,usesState:this.usesState,diagnostics:this.diagnostics}}persistKey(e){return`${this.opts.persistPrefix}:${e}`}checkDuplicate(e,n,i){e.has(n)&&this.fail("E0202",`'${n}' is already declared in this scope`,i)}defineComponent(e,n,i,s,r,a){e.define(n,{kind:"component",js:i,comp:s,ref:r,loc:a})}declareImports(){let e=0;for(let n of this.imports){let i=n.decl,s=JSON.stringify(n.specifier);switch(n.kind){case"style":/^(https?:)?\/\//.test(n.specifier)||this.importLines.push(`import ${s};`);break;case"script":case"font":i.namespace&&this.moduleScope.define(i.namespace,{kind:"global",js:i.namespace});for(let r of i.named)this.moduleScope.define(r.alias,{kind:"global",js:r.alias});break;case"json":{let r=i.defaultName??i.namespace;if(r)this.importLines.push(`const ${r} = ${JSON.stringify(n.json)};`),this.moduleScope.define(r,{kind:"const",js:r,type:j((Array.isArray(n.json),"obj"))});else if(i.named.length){let a=n.json??{};for(let o of i.named)o.name in a||this.fail("E0603",`'${o.name}' does not exist in ${i.source}`,o.loc),this.importLines.push(`const ${o.alias} = ${JSON.stringify(a[o.name])};`),this.moduleScope.define(o.alias,{kind:"const",js:o.alias})}break}case"module":{this.interactive=!0;let r=[];i.defaultName&&r.push(i.defaultName),i.namespace&&r.push(`* as ${i.namespace}`),i.named.length&&r.push(`{ ${i.named.map(a=>a.name===a.alias?a.name:`${a.name} as ${a.alias}`).join(", ")} }`),this.importLines.push(r.length?`import ${r.join(", ")} from ${s};`:`import ${s};`);for(let a of[i.defaultName,i.namespace,...i.named.map(o=>o.alias)])a&&this.moduleScope.define(a,{kind:"import",js:a});break}case"sinth":{let r=n.exports;if(!r)break;let a=`$$m${++e}`;this.importLines.push(`import * as ${a} from ${s};`);let o=i.sideEffect||!i.named.length&&!i.defaultName&&!i.namespace,c=(h,u,f)=>{let x=r.components.get(h),d=r.functions.get(h),m=r.vars.get(h);if(x)this.defineComponent(this.moduleScope,u,`${a}.${h}`,x,`${n.specifier}#${h}`,f);else if(d)this.moduleScope.define(u,{kind:"function",js:`${a}.${h}`,fn:d});else if(m){let g=m.kind==="computed"?"computed":m.kind==="const"?"const":"state";this.moduleScope.define(u,{kind:g,js:`${a}.$$vars.${h}`,type:m.type})}else{let g=[...r.components.keys(),...r.functions.keys(),...r.vars.keys()],w=ke(h,g);this.fail("E0602",`'${i.source}' has no export named '${h}'`,f,w?`Did you mean '${w}'?`:g.length?`Available: ${g.join(", ")}`:void 0)}};if(o)for(let h of r.components.keys())c(h,h,i.loc);i.defaultName&&(r.defaultComponent||this.fail("E0604",`'${i.source}' has no default component`,i.loc,'Name the component like the file, or use: import { Name } from "..."'),c(r.defaultComponent,i.defaultName,i.loc)),i.namespace&&this.moduleScope.define(i.namespace,{kind:"global",js:a,comp:void 0});for(let h of i.named)c(h.name,h.alias,h.loc);break}}}}resolveNamespacedComponent(e){let[n,i]=e.split(".");if(!i)return;let s=this.imports.find(o=>o.kind==="sinth"&&o.decl.namespace===n),r=this.moduleScope.lookup(n),a=s?.exports?.components.get(i);if(!(!a||!r))return{kind:"component",js:`${r.js}.${i}`,comp:a,ref:`${s?.specifier}#${i}`}}genVarDecl(e,n,i){let s=e.type??(e.init?this.inferType(e.init,n):void 0);e.type?.base==="int"&&this.diagnostics.warn("W0201","'int' is deprecated; use 'num'",e.loc),e.type&&e.init&&this.checkAssignable(e.type,e.init,n,e.loc,`'${e.name}'`);let r=e.init?this.expr(e.init,n):ys(e.type),a;return e.kind==="computed"?(a=`const ${e.name} = () => ${r};`,n.define(e.name,{kind:"computed",js:`${e.name}()`,type:s})):e.kind==="const"?(a=`const ${e.name} = ${r};`,n.define(e.name,{kind:"const",js:e.name,type:s})):(e.persist&&(!i&&!n.inComponent()&&this.fail("E0210","'persist' is only allowed on page or component variables",e.loc),r=`$$.persisted(${JSON.stringify(this.persistKey(e.name))}, ${r})`,this.interactive=!0),a=`let ${e.name} = ${r};`,n.define(e.name,{kind:i?"state":"local",js:e.name,type:s})),a}genFunction(e,n){let i=new F(n,"function"),s=this.genParams(e.params,i);if(e.view){let a={scope:i,svg:!1,scopeClass:void 0},o=e.body.map(h=>this.stmt(h,i)).join(`
|
|
65
65
|
`),c=this.genNodes(e.view,"$$parent",a);return`function ${e.name}($$parent${s?", "+s:""}) {
|
|
66
66
|
${R([o,c].filter(Boolean).join(`
|
|
67
67
|
`))}
|
|
68
|
-
}`}let r=this.stmts(e.body,i,e.returnType);return`${e.async||
|
|
68
|
+
}`}let r=this.stmts(e.body,i,e.returnType);return`${e.async||ie(e.body)?"async ":""}function ${e.name}(${s}) {
|
|
69
69
|
${R(r)}
|
|
70
|
-
}`}genParams(e,n){return e.map(i=>(n.define(i.name,{kind:"local",js:i.name,type:i.type}),i.rest?`...${i.name}`:i.defaultValue?`${i.name} = ${this.expr(i.defaultValue,n)}`:i.name)).join(", ")}genComponent(e){let n=new F(this.moduleScope,"component"),i=`s-${
|
|
70
|
+
}`}genParams(e,n){return e.map(i=>(n.define(i.name,{kind:"local",js:i.name,type:i.type}),i.rest?`...${i.name}`:i.defaultValue?`${i.name} = ${this.expr(i.defaultValue,n)}`:i.name)).join(", ")}genComponent(e){let n=new F(this.moduleScope,"component"),i=`s-${be(this.file.path.replace(/\\/g,"/")+"#"+e.name).slice(0,7)}`;for(let u of e.params)this.checkDuplicate(n,u.name,u.loc),n.define(u.name,{kind:"param",js:`$$p.${u.name}`,type:u.type,defaultValue:u.defaultValue,bindable:u.bindable});let s=[];for(let u of e.vars)this.checkDuplicate(n,u.name,u.loc),s.push(this.genVarDecl(u,n,!1)),u.persist&&s.push(`$$.persist(${JSON.stringify(this.persistKey(e.name+"."+u.name))}, () => ${u.name});`);for(let u of e.functions)n.define(u.name,{kind:"function",js:u.name,fn:{name:u.name,params:u.params,returnType:u.returnType,ui:u.returnType?.base==="ui"}});for(let u of e.scripts){let f=kt(u.raw,u.loc,!0);f.hasImports&&this.fail("E0501","Component script blocks cannot contain 'import' statements",u.loc,"Use a top-level 'import' in the .sinth file instead");for(let x of f.declared)n.has(x)||n.define(x,{kind:"local",js:x});this.interactive=!0}for(let u of e.functions)s.push(this.genFunction(u,n));for(let u of e.scripts)s.push(u.raw.trim());(e.lifecycle.length||e.watchers.length)&&(this.interactive=!0),s.push(...this.genLifecycle(e.lifecycle,e.watchers,n));let r={};for(let u of e.styles)Object.assign(r,this.addStyle(u,u.global?void 0:i,n,e.name));let a=Object.entries(r),o=u=>{let f=[];return u[0]&&f.push(`if ($$a) $$a(${u[0]});`),a.length&&u.length&&f.push(`$$.cssVars([${u.join(", ")}], { ${a.map(([x,d])=>`${JSON.stringify(x)}: () => ${this.expr(d,n)}`).join(", ")} });`),f.join(`
|
|
71
71
|
`)},c={scope:n,comp:e,scopeClass:i,slotsVar:"$$s",svg:!1,rootHook:o},h=[];return s.push(this.genNodes(e.body,"$$parent",c,h)),s.push(o(h)),`export function ${e.name}($$parent, $$p, $$s, $$a) {
|
|
72
72
|
${R(s.filter(Boolean).join(`
|
|
73
73
|
`))}
|
|
74
|
-
}`}genLifecycle(e,n,i){let s=[];for(let r of e){let a=new F(i,"function"),o=this.stmts(r.body,a),c=
|
|
74
|
+
}`}genLifecycle(e,n,i){let s=[];for(let r of e){let a=new F(i,"function"),o=this.stmts(r.body,a),c=ie(r.body)?"async ":"";s.push(r.kind==="mount"?`$$.onMount(${c}() => {
|
|
75
75
|
${R(o)}
|
|
76
76
|
});`:`$$.onDestroy(() => {
|
|
77
77
|
${R(o)}
|
|
78
|
-
});`)}for(let r of n){let a=new F(i,"function");a.define("value",{kind:"local",js:"value"}),a.define("previous",{kind:"local",js:"previous"});let o=
|
|
78
|
+
});`)}for(let r of n){let a=new F(i,"function");a.define("value",{kind:"local",js:"value"}),a.define("previous",{kind:"local",js:"previous"});let o=ie(r.body)?"async ":"";s.push(`$$.watch(() => ${this.expr(r.expr,i)}, ${o}(value, previous) => {
|
|
79
79
|
${R(this.stmts(r.body,a))}
|
|
80
|
-
});`)}return s}addStyle(e,n,i,s){let r=new Set(i.all().filter(h=>{let u=i.lookup(h);return u&&(u.kind==="param"||u.kind==="state"||u.kind==="computed"||u.kind==="local"||u.kind==="const")})),a=`--sv-${
|
|
81
|
-
${o.css}`);let c={};for(let h of o.expressions){let u=
|
|
80
|
+
});`)}return s}addStyle(e,n,i,s){let r=new Set(i.all().filter(h=>{let u=i.lookup(h);return u&&(u.kind==="param"||u.kind==="state"||u.kind==="computed"||u.kind==="local"||u.kind==="const")})),a=`--sv-${be(this.file.path+s).slice(0,5)}-`,o=it(e.raw,e.lang,{scope:n,reactiveNames:r,varPrefix:a,loc:e.loc,sinthSyntax:e.lang==="sinth"},this.opts.scss);o.css.trim()&&this.css.push(`/* ${s} */
|
|
81
|
+
${o.css}`);let c={};for(let h of o.expressions){let u=ws(h.source,{file:e.loc.file,line:h.line,col:1});this.expr(u,i),c[h.cssVar]=u}return o.expressions.length&&!n&&(this.interactive=!0,i===this.moduleScope&&this.pageCssVars.push(...Object.entries(c))),c}genNodes(e,n,i,s){let r=[];this.pageCssVars.length&&n==="$$root"&&r.push(`$$.cssVars([document.documentElement], { ${this.pageCssVars.map(([a,o])=>`${JSON.stringify(a)}: () => ${this.expr(o,i.scope)}`).join(", ")} });`);for(let a of e)r.push(this.genNode(a,n,i,s));return r.filter(Boolean).join(`
|
|
82
82
|
`)}genNode(e,n,i,s){switch(e.k){case"text":return this.genText(e.expr,n,i);case"element":return this.genElement(e,n,i,s);case"if":return this.genIf(e,n,i,!!s);case"for":return this.genFor(e,n,i,!!s);case"slot":{i.slotsVar||this.fail("E0310","'$slot' can only be used inside a component",e.loc);let r=e.fallback.length?`, ($$f) => {
|
|
83
83
|
${R(this.genNodes(e.fallback,"$$f",i))}
|
|
84
|
-
}`:"";return`$$.slot(${n}, ${i.slotsVar}, ${JSON.stringify(e.name)}${r});`}case"stmt":return this.stmt(e.stmt,i.scope);case"var":return this.checkDuplicate(i.scope,e.decl.name,e.loc),this.genVarDecl(e.decl,i.scope,!1)}}genText(e,n,i){if(e.k==="lit")return e.value===null?"":`${n}.append(${JSON.stringify(String(e.value))});`;if(e.k==="call"){let r=this.calleeBinding(e.callee,i.scope);if(r?.fn?.ui)return this.genUiCall(e,r,n,i)}let s=this.expr(e,i.scope);return this.isConstantExpr(e,i.scope)?`${n}.append($$.toText(${s}));`:`$$.text(${n}, () => ${s});`}genUiCall(e,n,i,s){let r=n.fn,a=this.genCallArgs(e.args,r,s.scope,e.loc);return`${n.js}(${i}${a?", "+a:""});`}isConstantExpr(e,n){switch(e.k){case"lit":return!0;case"id":{let i=n.lookup(e.name);return i?.kind==="const"&&!i.js.includes(".")}case"binary":return this.isConstantExpr(e.left,n)&&this.isConstantExpr(e.right,n);case"unary":return e.op!=="await"&&this.isConstantExpr(e.arg,n);case"tpl":return e.parts.every(i=>typeof i=="string"||this.isConstantExpr(i,n));case"cond":return this.isConstantExpr(e.test,n)&&this.isConstantExpr(e.then,n)&&this.isConstantExpr(e.else,n);default:return!1}}isStaticNode(e,n){if(e.k==="text")return e.expr.k==="lit";if(e.k!=="element"||zt.has(e.name)||!
|
|
85
|
-
${n}.appendChild(${
|
|
86
|
-
`)}genRawHtml(e,n,i){let s=e.attrs.find(r=>r.name==="content"||r.name==="html");return s?.value||this.fail("E0332",`${e.name} requires a 'content' attribute`,e.loc),s.value.k!=="lit"&&this.diagnostics.warn("W0301",`${e.name} renders dynamic content as unescaped HTML. Only use it with trusted content`,s.loc),`$$.html(${n}, () => ${this.expr(s.value,i.scope)});`}genDynamicAttrs(e,n,i,s){let r=[],a=s.scope;for(let o of e.attrs){if(o.name==="level"&&e.name==="Heading")continue;if(o.handler){this.interactive=!0,r.push(`$$.on(${n}, ${JSON.stringify(
|
|
84
|
+
}`:"";return`$$.slot(${n}, ${i.slotsVar}, ${JSON.stringify(e.name)}${r});`}case"stmt":return this.stmt(e.stmt,i.scope);case"var":return this.checkDuplicate(i.scope,e.decl.name,e.loc),this.genVarDecl(e.decl,i.scope,!1)}}genText(e,n,i){if(e.k==="lit")return e.value===null?"":`${n}.append(${JSON.stringify(String(e.value))});`;if(e.k==="call"){let r=this.calleeBinding(e.callee,i.scope);if(r?.fn?.ui)return this.genUiCall(e,r,n,i)}let s=this.expr(e,i.scope);return this.isConstantExpr(e,i.scope)?`${n}.append($$.toText(${s}));`:`$$.text(${n}, () => ${s});`}genUiCall(e,n,i,s){let r=n.fn,a=this.genCallArgs(e.args,r,s.scope,e.loc);return`${n.js}(${i}${a?", "+a:""});`}isConstantExpr(e,n){switch(e.k){case"lit":return!0;case"id":{let i=n.lookup(e.name);return i?.kind==="const"&&!i.js.includes(".")}case"binary":return this.isConstantExpr(e.left,n)&&this.isConstantExpr(e.right,n);case"unary":return e.op!=="await"&&this.isConstantExpr(e.arg,n);case"tpl":return e.parts.every(i=>typeof i=="string"||this.isConstantExpr(i,n));case"cond":return this.isConstantExpr(e.test,n)&&this.isConstantExpr(e.then,n)&&this.isConstantExpr(e.else,n);default:return!1}}isStaticNode(e,n){if(e.k==="text")return e.expr.k==="lit";if(e.k!=="element"||zt.has(e.name)||!Z[e.name]||n.scope.lookup(e.name)?.kind==="component"&&n.comp?.name!==e.name||e.slots.length)return!1;for(let i of e.attrs)if(i.handler||i.name==="..."||i.name==="model"||i.name==="bind"||i.name==="ref"||i.name==="hide"||i.name==="show"||i.name==="html"||i.name==="delay"||i.value&&!(i.value.k==="lit"||i.name==="style"&&Nt(i.value))||i.name==="level"&&i.value&&i.value.k!=="lit")return!1;return e.children.every(i=>this.isStaticNode(i,n))}checkVoidChildren(e,n,i){if(!e.children.length||!Pe.has(this.elementShape(e,n).tag))return;let s=`${e.name} is a void element and cannot have children`,r=e.name==="Input"||e.name==="Checkbox"||e.name==="Radio"?'Put the text in a Label next to it, e.g. Label { Checkbox(model: done) " Done" }':void 0;i&&this.fail("E0331",s,e.loc,r),this.diagnostics.warn("W0331",s+" (they are ignored)",e.loc,r)}staticHtml(e,n){if(e.k==="text")return e.expr.k==="lit"&&e.expr.value!==null?Ae(String(e.expr.value)):"";if(e.k!=="element")return"";this.checkVoidChildren(e,n,!1);let{tag:i,attrs:s}=this.elementShape(e,n),r=Object.entries(s).map(([a,o])=>o===""&&Ue.has(a)?` ${a}`:` ${a}="${T(o)}"`).join("");return Pe.has(i)?`<${i}${r}>`:`<${i}${r}>${e.children.map(a=>this.staticHtml(a,n)).join("")}</${i}>`}headingTag(e){let n=e.attrs.find(s=>s.name==="level");if(!n||!n.value)return Z[e.name]?.tag??"h1";(n.value.k!=="lit"||typeof n.value.value!="number")&&this.fail("E0320","Heading 'level' must be a number literal from 1 to 6",n.loc);let i=n.value.value;return(!Number.isInteger(i)||i<1||i>6)&&this.fail("E0320",`Heading level must be between 1 and 6, got ${i}`,n.loc),`h${i}`}elementShape(e,n){let i=Z[e.name],s=e.name==="Heading"?this.headingTag(e):i.tag,r={...i.attrs??{}},a=[];i.className&&a.push(i.className),n.scopeClass&&a.push(n.scopeClass);let o=[];for(let c of e.attrs){if(c.name==="level"&&e.name==="Heading"||c.handler||xs.has(c.name))continue;if(/^on[a-z]+$/.test(c.name)&&this.fail("E0334",`Inline event attribute '${c.name}' is not allowed`,c.loc,`Use '${"on"+c.name[2].toUpperCase()+c.name.slice(3)}: ...' with a Sinth handler instead`),c.value===null){r[ce(c.name)]="";continue}if(c.name==="class"&&c.value.k==="lit"){c.value.value&&a.push(String(c.value.value));continue}if(c.name==="style"&&Nt(c.value)){o.push(ks(c.value));continue}if(c.value.k!=="lit")continue;if(this.isStyleProp(c.name,s)){c.value.value!==null&&c.value.value!==!1&&o.push(`${Zn(c.name)}: ${c.value.value}`);continue}let h=c.value.value;h===!1||h===null||(r[ce(c.name)]=h===!0?"":String(h))}return a.length&&(r.class=a.join(" ")),o.length&&(r.style=[r.style,...o].filter(Boolean).join("; ")),{tag:s,attrs:r,svg:!!i.svg}}isStyleProp(e,n){return!(!Me.has(e)||(e==="width"||e==="height")&&vs.has(n))}genElement(e,n,i,s){let r=e.name.includes(".")?this.resolveNamespacedComponent(e.name):i.scope.lookup(e.name),a=i.comp?.name===e.name&&!!Z[e.name];if(r?.kind==="component"&&r.comp&&!a)return this.genComponentUse(e,r,n,i,s);if(e.name==="Fragment")return this.genNodes(e.children,n,i);if(e.name==="RawHTML"||e.name==="Html")return this.genRawHtml(e,n,i);let o=Z[e.name];if(!o){let k=[...Object.keys(Z),...i.scope.all().filter(K=>/^[A-Z]/.test(K))],E=ke(e.name,k);this.fail("E0301",`Unknown component '${e.name}'`,e.loc,E?`Did you mean '${E}'?`:"Import it, e.g. import { "+e.name+' } from "./components/'+e.name+'.sinth"')}if(e.slots.length&&this.fail("E0311","slot(...) fills can only be used inside components that declare $slot",e.slots[0].loc),this.isStaticNode(e,i)||this.checkVoidChildren(e,i,!0),this.isStaticNode(e,i)){let k=this.staticHtml(e,i);if(s){let E=this.id("e");return s.push(E),`const ${E} = $$.tpl(${JSON.stringify(k)}${o.svg?", true":""}).firstChild;
|
|
85
|
+
${n}.appendChild(${E});`}return`${n}.appendChild($$.tpl(${JSON.stringify(k)}${o.svg||i.svg?", true":""}));`}let{tag:c,attrs:h}=this.elementShape(e,i),u=this.id("e");s?.push(u);let f=[],x=!!o.svg||i.svg;f.push(`const ${u} = ${x?`$$.svg(${JSON.stringify(c)})`:`$$.el(${JSON.stringify(c)})`};`);for(let[k,E]of Object.entries(h))f.push(`${u}.setAttribute(${JSON.stringify(k)}, ${JSON.stringify(E)});`);let d=this.genDynamicAttrs(e,u,c,i),m=c==="select"?d.filter(k=>k.startsWith("$$.model(")||k.startsWith(`$$.prop(${u}, "value"`)):[];f.push(...d.filter(k=>!m.includes(k)));let g={...i,svg:x&&c!=="foreignObject"},w=e.attrs.find(k=>k.name==="html");return w&&e.children.length&&this.fail("E0330","An element with 'html' cannot also have children",w.loc),e.children.length&&f.push(this.genNodes(e.children,u,g)),f.push(...m),f.push(`${n}.appendChild(${u});`),f.filter(Boolean).join(`
|
|
86
|
+
`)}genRawHtml(e,n,i){let s=e.attrs.find(r=>r.name==="content"||r.name==="html");return s?.value||this.fail("E0332",`${e.name} requires a 'content' attribute`,e.loc),s.value.k!=="lit"&&this.diagnostics.warn("W0301",`${e.name} renders dynamic content as unescaped HTML. Only use it with trusted content`,s.loc),`$$.html(${n}, () => ${this.expr(s.value,i.scope)});`}genDynamicAttrs(e,n,i,s){let r=[],a=s.scope;for(let o of e.attrs){if(o.name==="level"&&e.name==="Heading")continue;if(o.handler){if(this.interactive=!0,!ms.has(o.name.toLowerCase())){let u=ke(o.name,Jn);u&&this.diagnostics.warn("W0302",`Unknown event '${o.name}'`,o.loc,`Did you mean '${u}'? Other names listen for custom events`)}r.push(`$$.on(${n}, ${JSON.stringify(gs(o.name))}, ${this.genHandler(o,a)}${o.modifiers.length?", "+JSON.stringify(o.modifiers):""});`);continue}if(o.name==="..."&&this.fail("E0333","Spread attributes are only supported on components",o.loc),o.value===null)continue;let c=o.value;switch(o.name){case"model":case"bind":{this.interactive=!0,c.k!=="id"&&c.k!=="member"&&c.k!=="index"&&this.fail("E0340",`'${o.name}' needs a variable to bind to`,o.loc);let u=this.expr(c,a),f=this.assignTarget(c,a,o.loc),x=this.inferType(c,a),d=!!x&&(x.base==="num"||x.base==="int")&&x.array===0;r.push(`$$.model(${n}, () => ${u}, ($$v) => { ${f} = $$v; }${d?", true":""});`);continue}case"ref":this.interactive=!0,c.k!=="id"&&c.k!=="member"&&this.fail("E0341","'ref' needs a variable to store the element in",o.loc),r.push(`$$.ref(${n}, ($$v) => { ${this.assignTarget(c,a,o.loc)} = $$v; });`);continue;case"hide":r.push(`$$.show(${n}, () => !(${this.expr(c,a)}));`);continue;case"show":r.push(`$$.show(${n}, () => ${this.expr(c,a)});`);continue;case"html":c.k!=="lit"&&this.diagnostics.warn("W0301","'html' renders dynamic content as unescaped HTML. Only use it with trusted content",o.loc),r.push(`$$.html(${n}, () => ${this.expr(c,a)});`);continue;case"delay":r.push(`$$.show(${n}, () => false);`,`setTimeout(() => { ${n}.style.display = ""; }, Number(${this.expr(c,a)}) || 0);`),this.interactive=!0;continue;case"key":continue;default:break}if(c.k==="lit"||o.name==="style"&&Nt(c))continue;let h=this.expr(c,a);o.name==="class"?r.push(`$$.cls(${n}, () => ${h});`):o.name==="style"?r.push(`$$.style(${n}, () => ${h});`):this.isStyleProp(o.name,i)?r.push(`$$.styleProp(${n}, ${JSON.stringify(o.name)}, () => ${h});`):bs.has(o.name)?r.push(`$$.prop(${n}, ${JSON.stringify(o.name)}, () => ${h});`):r.push(`$$.attr(${n}, ${JSON.stringify(ce(o.name))}, () => ${h});`)}return r}genHandler(e,n){let i=e.handler,s=new F(n,"function");if(s.define("e",{kind:"local",js:"e"}),s.define("event",{kind:"local",js:"e"}),i.length===1&&i[0].k==="expr"){let a=i[0].expr;if(a.k==="arrow")return this.expr(a,n);if(a.k==="lit"&&typeof a.value!="string"&&this.fail("E0352",`Event handlers must be code, not ${a.value===null?"null":typeof a.value}`,a.loc,`Write the handler as code, e.g. ${e.name}: count += 1`),a.k==="lit"||a.k==="tpl"){let o=a.k==="lit"?String(a.value):"",c=o.replace(/\(\s*\)\s*;?$/,"");this.fail("E0351","Event handlers cannot be strings",a.loc,/^[A-Za-z_$][\w$]*$/.test(c)?`Write ${e.name}: ${c}() instead of ${e.name}: "${o}"`:`Write the handler as code, e.g. ${e.name}: count += 1`)}if(a.k==="id"||a.k==="member"){let o=a.k==="id"?n.lookup(a.name):void 0;if(a.k==="id"&&!o&&this.unknownName(a.name,a.loc,n),a.k==="id"&&o&&(o.kind==="state"||o.kind==="local"||o.kind==="param")&&o.type&&o.type.base!=="fn"&&o.type.base!=="any"&&this.fail("E0350",`'${a.name}' is a ${ne(o.type)}, not a function, so it cannot be used as an event handler`,a.loc),o?.fn){let c=o.fn.params[0];if(c&&(c.name==="e"||c.name==="event"))return`(e) => ${this.expr(a,s)}(e)`;let h=o.fn.params.find(u=>!u.optional&&!u.rest);return h&&this.fail("E0315",`Missing argument '${h.name}' for function '${o.fn.name}'`,a.loc,`Call it with arguments, e.g. onClick: ${o.fn.name}(...)`),`() => ${this.expr(a,s)}()`}return`(e) => ${this.expr(a,s)}(e)`}}let r=this.stmts(i,s);return`${ie(i)?"async ":""}(e) => {
|
|
87
87
|
${R(r)}
|
|
88
|
-
}`}genComponentUse(e,n,i,s,r){let a=n.comp;n.ref&&this.uses.add(n.ref);let o=s.scope,c=[],h=new Set,u=[];for(let
|
|
88
|
+
}`}genComponentUse(e,n,i,s,r){let a=n.comp;n.ref&&this.uses.add(n.ref);let o=s.scope,c=[],h=new Set,u=[];for(let m of e.attrs){if(m.name==="..."){c.push(`...${this.expr(m.value,o)}`);continue}let g=a.params.find(E=>E.name===m.name);if(!g){let E=ke(m.name,a.params.map(K=>K.name));E&&!m.handler&&!["class","style","id"].includes(m.name)&&this.diagnostics.warn("W0310",`'${e.name}' has no parameter '${m.name}'; it is passed to the root element instead`,m.loc,`Did you mean '${E}'?`),u.push(m);continue}if(h.add(g.name),m.handler){c.push(`${JSON.stringify(g.name)}: ${this.genHandler(m,o)}`);continue}let w=m.value??{k:"lit",value:!0,loc:m.loc};g.type&&this.checkAssignable(g.type,w,o,m.loc,`parameter '${g.name}' of '${e.name}'`);let k=this.expr(w,o);if(g.bindable&&(w.k==="id"||w.k==="member"||w.k==="index")){let E=this.assignTarget(w,o,m.loc);c.push(`get ${JSON.stringify(g.name)}() { return ${k}; }, set ${JSON.stringify(g.name)}($$v) { ${E} = $$v; }`);continue}c.push(this.isConstantExpr(w,o)?`${JSON.stringify(g.name)}: ${k}`:`get ${JSON.stringify(g.name)}() { return ${k}; }`)}for(let m of a.params)!h.has(m.name)&&!m.optional&&!m.rest&&this.fail("E0360",`Missing required parameter '${m.name}' for component '${e.name}'`,e.loc,`Pass it like: ${e.name}(${m.name}: ...)`);let f=[];e.children.length&&f.push(`default: ($$f) => {
|
|
89
89
|
${R(this.genNodes(e.children,"$$f",{...s,svg:!1}))}
|
|
90
|
-
}`);for(let
|
|
91
|
-
${R(this.genNodes(
|
|
92
|
-
}`);let x="";if(u.length){let
|
|
93
|
-
${R(
|
|
90
|
+
}`);for(let m of e.slots)f.push(`${JSON.stringify(m.name)}: ($$f) => {
|
|
91
|
+
${R(this.genNodes(m.children,"$$f",s))}
|
|
92
|
+
}`);let x="";if(u.length){let g={...e,attrs:u,name:"Div"},w=this.genDynamicAttrs(g,"$$t","div",s);for(let k of u)k.handler||!k.value||k.value.k!=="lit"||(k.name==="class"?w.push(`$$t.classList.add(...${JSON.stringify(String(k.value.value).split(/\s+/).filter(Boolean))});`):k.value.value!==!1&&k.value.value!==null&&w.push(`$$t.setAttribute(${JSON.stringify(ce(k.name))}, ${JSON.stringify(k.value.value===!0?"":String(k.value.value))});`));for(let k of u)k.value===null&&!k.handler&&w.push(`$$t.setAttribute(${JSON.stringify(ce(k.name))}, "");`);x=`, ($$t) => {
|
|
93
|
+
${R(w.join(`
|
|
94
94
|
`))}
|
|
95
|
-
}`}let d=`$$.component(${i}, ${n.js}, { ${c.join(", ")} }, { ${f.join(", ")} }${x});`;if(r){let
|
|
95
|
+
}`}let d=`$$.component(${i}, ${n.js}, { ${c.join(", ")} }, { ${f.join(", ")} }${x});`;if(r){let m=this.id("c");return r.push(m),`const ${m} = ${d}`}return d}genIf(e,n,i,s=!1){let r=e.branches.map(o=>{let c=o.test?`() => ${this.expr(o.test,i.scope)}`:"null",h={...i,scope:new F(i.scope,"block")},u=this.id("b"),f=[],x=this.genNodes(o.body,u,h,s?f:void 0),d=s&&i.rootHook?i.rootHook(f):"";return`[${c}, (${u}) => {
|
|
96
96
|
${R([x,d].filter(Boolean).join(`
|
|
97
97
|
`))}
|
|
98
98
|
}]`}),a=[];return e.persist&&a.push("persist: true"),e.delay&&a.push(`delay: () => ${this.expr(e.delay,i.scope)}`),e.transition&&a.push(`transition: ${JSON.stringify(e.transition)}`),`$$.when(${n}, [
|
|
99
99
|
${R(r.join(`,
|
|
100
100
|
`))}
|
|
101
|
-
]${a.length?`, { ${a.join(", ")} }`:""});`}genFor(e,n,i,s=!1){let r=this.expr(e.iter,i.scope),a=this.id("l"),o=new F(i.scope,"loop"),c=["item","index","key"];e.names.forEach((k
|
|
102
|
-
`+i.rootHook(u):""),x=e.keyExpr?`(${a}) => ${this.expr(e.keyExpr,o)}`:"undefined",d=e.filter?`(${a}) => ${this.expr(e.filter,o)}`:"undefined",
|
|
101
|
+
]${a.length?`, { ${a.join(", ")} }`:""});`}genFor(e,n,i,s=!1){let r=this.expr(e.iter,i.scope),a=this.id("l"),o=new F(i.scope,"loop"),c=["item","index","key"];e.names.forEach((w,k)=>{let E=this.inferType(e.iter,i.scope),K=k===1?j("num"):k===0&&E&&E.array>0?{...E,array:E.array-1}:void 0;o.define(w,{kind:"loop",js:`${a}.${c[k]}`,type:K})});let h=this.id("b"),u=[],f=this.genNodes(e.body,h,{...i,scope:o},s?u:void 0)+(s&&i.rootHook?`
|
|
102
|
+
`+i.rootHook(u):""),x=e.keyExpr?`(${a}) => ${this.expr(e.keyExpr,o)}`:"undefined",d=e.filter?`(${a}) => ${this.expr(e.filter,o)}`:"undefined",m=e.empty?`($$f) => {
|
|
103
103
|
${R(this.genNodes(e.empty,"$$f",i))}
|
|
104
|
-
}`:"",
|
|
104
|
+
}`:"",g=[x,d,m].filter(Boolean);for(;g.length&&g[g.length-1]==="undefined";)g.pop();return`$$.each(${n}, () => ${r}, (${h}, ${a}) => {
|
|
105
105
|
${R(f)}
|
|
106
|
-
}${
|
|
106
|
+
}${g.length?", "+g.join(", "):""});`}stmts(e,n,i){return e.map(s=>this.stmt(s,n,i)).filter(Boolean).join(`
|
|
107
107
|
`)}stmt(e,n,i){switch(e.k){case"expr":{if(e.expr.k==="call"){let s=this.calleeBinding(e.expr.callee,n);s?.fn?.ui&&this.fail("E0370",`'${s.fn.name}' returns UI and can only be used inside markup`,e.loc)}return`${this.expr(e.expr,n)};`}case"var":return this.checkDuplicate(n,e.decl.name,e.loc),this.genVarDecl(e.decl,n,!1);case"if":{let s=new F(n),r=`if (${this.expr(e.test,n)}) {
|
|
108
108
|
${R(this.stmts(e.then,s,i))}
|
|
109
109
|
}`;if(e.else){let a=new F(n);e.else.length===1&&e.else[0].k==="if"?r+=` else ${this.stmt(e.else[0],a,i)}`:r+=` else {
|
|
@@ -119,13 +119,13 @@ ${R(this.stmts(e.body,new F(n),i))}
|
|
|
119
119
|
${R(this.stmts(e.handler,r,i))}
|
|
120
120
|
}`}return e.finalizer&&(s+=` finally {
|
|
121
121
|
${R(this.stmts(e.finalizer,new F(n),i))}
|
|
122
|
-
}`),s}case"throw":return`throw ${this.expr(e.value,n)};`;case"return":return e.value&&i&&i.base!=="any"&&(i.base==="void"&&this.fail("E0380","This function is declared '-> void' and cannot return a value",e.loc),this.checkAssignable(i,e.value,n,e.loc,"the return value")),e.value?`return ${this.expr(e.value,n)};`:"return;";case"break":return"break;";case"continue":return"continue;"}}isTracked(e,n){let i=e;for(;i.k==="member"||i.k==="index";)i=i.object;if(i.k!=="id")return!1;let s=n.lookup(i.name)?.kind;return s!==void 0&&s!=="global"&&s!=="import"&&s!=="function"&&s!=="component"}calleeBinding(e,n){if(e.k==="id")return n.lookup(e.name)}unknownName(e,n,i){let s=
|
|
122
|
+
}`),s}case"throw":return`throw ${this.expr(e.value,n)};`;case"return":return e.value&&i&&i.base!=="any"&&(i.base==="void"&&this.fail("E0380","This function is declared '-> void' and cannot return a value",e.loc),this.checkAssignable(i,e.value,n,e.loc,"the return value")),e.value?`return ${this.expr(e.value,n)};`:"return;";case"break":return"break;";case"continue":return"continue;"}}isTracked(e,n){let i=e;for(;i.k==="member"||i.k==="index";)i=i.object;if(i.k!=="id")return!1;let s=n.lookup(i.name)?.kind;return s!==void 0&&s!=="global"&&s!=="import"&&s!=="function"&&s!=="component"}calleeBinding(e,n){if(e.k==="id")return n.lookup(e.name)}unknownName(e,n,i){let s=ke(e,i.all())??[...rt].find(r=>r.toLowerCase()===e.toLowerCase()||st(r,e)===1);this.fail("E0302",`Unknown name '${e}'`,n,s?`Did you mean '${s}'?`:`Declare it with 'var', import it, or declare a browser global with 'extern ${e}'`)}resolveId(e,n,i){let s=i.lookup(e);if(s)return s;let r=qt.get(e);return r?{kind:"global",js:r}:rt.has(e)?{kind:"global",js:e}:this.unknownName(e,n,i)}bindingJs(e,n){return e.kind==="param"&&e.defaultValue?`(${e.js} === undefined ? ${this.expr(e.defaultValue,n)} : ${e.js})`:((e.kind==="state"||e.kind==="computed")&&(this.usesState=!0),e.js)}assignTarget(e,n,i){if(e.k==="id"){let s=this.resolveId(e.name,e.loc,n);switch(s.kind){case"param":if(s.bindable)return s.js;this.fail("E0390",`Cannot assign to parameter '${e.name}'; parameters are read-only`,i,`Copy it into a variable (var ${e.name}Value = ${e.name}) or declare it as 'bind ${e.name}' for two-way binding`);break;case"const":this.fail("E0391",`Cannot assign to constant '${e.name}'`,i);break;case"computed":this.fail("E0392",`Cannot assign to computed value '${e.name}'`,i);break;case"function":case"component":this.fail("E0393",`Cannot assign to ${s.kind} '${e.name}'`,i);break;case"loop":this.fail("E0394",`Cannot assign to loop variable '${e.name}'`,i,"Change the list instead, e.g. items[index] = newValue");break;default:break}return s.kind==="state"&&(this.usesState=!0),s.js}return this.expr(e,n)}genCallArgs(e,n,i,s){let r=n.params,a=[],o=0,c=!1,h=r.find(d=>d.rest),u=[];for(let d of e){if(d.spread)return e.map(m=>(m.spread?"...":"")+this.expr(m.value,i)).join(", ");if(d.name){c=!0;let m=r.findIndex(g=>g.name===d.name);if(m===-1){let g=ke(d.name,r.map(w=>w.name));this.fail("E0311",`'${n.name}' has no parameter named '${d.name}'`,d.loc,g?`Did you mean '${g}'?`:void 0)}a[m]&&this.fail("E0312",`Parameter '${d.name}' was passed twice`,d.loc),a[m]=d.value}else{if(c&&this.fail("E0313","Positional arguments cannot follow named arguments",d.loc),o>=r.length||r[o].rest){if(h){u.push(d.value);continue}this.fail("E0314",`Too many arguments for '${n.name}': expected at most ${r.length}, got ${e.length}`,d.loc)}a[o++]=d.value}}r.forEach((d,m)=>{if(d.rest)return;let g=a[m];!g&&!d.optional&&this.fail("E0315",`Missing argument '${d.name}' for function '${n.name}'`,s,`Expected: ${n.name}(${r.map(w=>w.name+(w.optional?"?":"")).join(", ")})`),g&&d.type&&this.checkAssignable(d.type,g,i,g.loc,`argument '${d.name}' of '${n.name}'`)});let f=a.length-1;for(;f>=0&&!a[f];)f--;let x=[];for(let d=0;d<=f;d++)x.push(a[d]?this.expr(a[d],i):"undefined");for(let d of u)x.push(this.expr(d,i));return x.join(", ")}expr(e,n){switch(e.k){case"lit":return e.value===null?"null":JSON.stringify(e.value);case"tpl":return"`"+e.parts.map(i=>typeof i=="string"?i.replace(/[`\\$]/g,s=>"\\"+s):"${$$.toText("+this.expr(i,n)+")}").join("")+"`";case"id":return this.bindingJs(this.resolveId(e.name,e.loc,n),n);case"member":return`${this.expr(e.object,n)}${e.optional?"?.":"."}${e.prop}`;case"index":return`${this.expr(e.object,n)}${e.optional?"?.[":"["}${this.expr(e.index,n)}]`;case"call":{let i=this.calleeBinding(e.callee,n);e.callee.k==="id"&&!i&&this.resolveId(e.callee.name,e.callee.loc,n),i?.kind==="component"&&this.fail("E0371",`'${e.callee.k==="id"?e.callee.name:""}' is a component; use it as markup, not as a function call`,e.loc),i?.fn?.ui&&this.fail("E0370",`'${i.fn.name}' returns UI and can only be used inside markup`,e.loc);let s=this.expr(e.callee,n),r=i?.fn?this.genCallArgs(e.args,i.fn,n,e.loc):e.args.map(o=>(o.spread?"...":"")+this.expr(o.value,n)).join(", ");!i?.fn&&e.args.some(o=>o.name)&&this.fail("E0316","Named arguments are only supported for Sinth functions",e.args.find(o=>o.name)?.loc);let a=`${s}${e.optional?"?.":""}(${r})`;return e.callee.k==="member"&&ps.has(e.callee.prop)&&this.isTracked(e.callee.object,n)?`$$.changed(${a})`:e.memo?`$$.memo(${JSON.stringify(this.fileHash+":"+e.loc.line+":"+e.loc.col)}, () => ${a}, [${r}])`:a}case"new":return`new ${this.expr(e.callee,n)}(${e.args.map(i=>(i.spread?"...":"")+this.expr(i.value,n)).join(", ")})`;case"unary":{let i=this.expr(e.arg,n);return e.op==="typeof"||e.op==="await"?`(${e.op} ${i})`:`(${e.op}${i})`}case"binary":{this.checkBinary(e,n);let i=e.op==="=="?"===":e.op==="!="?"!==":e.op;return`(${this.expr(e.left,n)} ${i} ${this.expr(e.right,n)})`}case"cond":return`(${this.expr(e.test,n)} ? ${this.expr(e.then,n)} : ${this.expr(e.else,n)})`;case"assign":{let i=this.assignTarget(e.target,n,e.loc),s=this.isTracked(e.target,n);if(e.target.k==="id"){let a=this.resolveId(e.target.name,e.loc,n).type;if(a){if(e.op==="=")this.checkAssignable(a,e.value,n,e.value.loc,`'${e.target.name}'`);else if(e.op==="+="&&a.base==="num"&&a.array===0){let o=this.inferType(e.value,n);o&&o.base==="str"&&o.array===0&&this.fail("E0400",`Cannot add a str to num variable '${e.target.name}'`,e.value.loc)}}}let r=`${i} ${e.op} ${this.expr(e.value,n)}`;return s?`$$.changed(${r})`:r}case"update":{let i=this.assignTarget(e.target,n,e.loc),s=e.prefix?`++${i}`:`${i}++`;return this.isTracked(e.target,n)?`$$.changed(${s})`:s}case"array":return`[${e.items.map(i=>(i.spread?"...":"")+this.expr(i.value,n)).join(", ")}]`;case"object":return`({ ${e.props.map(i=>i.spread?`...${this.expr(i.value,n)}`:i.computedKey?`[${this.expr(i.computedKey,n)}]: ${this.expr(i.value,n)}`:`${JSON.stringify(i.key)}: ${this.expr(i.value,n)}`).join(", ")} })`;case"arrow":{let i=new F(n,"function"),s=this.genParams(e.params,i),r=e.async||(Array.isArray(e.body)?ie(e.body):V(e.body));return Array.isArray(e.body)?`${r?"async ":""}(${s}) => {
|
|
123
123
|
${R(this.stmts(e.body,i))}
|
|
124
|
-
}`:`${r?"async ":""}(${s}) => (${this.expr(e.body,i)})`}case"range":return`$$.range(${e.args.map(i=>this.expr(i,n)).join(", ")})`}}checkBinary(e,n){if(!["==","!=","<",">","<=",">="].includes(e.op))return;let i=this.inferType(e.left,n),s=this.inferType(e.right,n);if(!i||!s||i.array||s.array||i.nullable||s.nullable)return;let r=a=>a.base==="num"||a.base==="int";(r(i)&&s.base==="str"||i.base==="str"&&r(s))&&this.fail("E0401",`Cannot compare ${
|
|
124
|
+
}`:`${r?"async ":""}(${s}) => (${this.expr(e.body,i)})`}case"range":return`$$.range(${e.args.map(i=>this.expr(i,n)).join(", ")})`}}checkBinary(e,n){if(!["==","!=","<",">","<=",">="].includes(e.op))return;let i=this.inferType(e.left,n),s=this.inferType(e.right,n);if(!i||!s||i.array||s.array||i.nullable||s.nullable)return;let r=a=>a.base==="num"||a.base==="int";(r(i)&&s.base==="str"||i.base==="str"&&r(s))&&this.fail("E0401",`Cannot compare ${ne(i)} and ${ne(s)} with '${e.op}'`,e.loc,"Convert one side first, e.g. Number(value) or String(value)")}inferType(e,n){switch(e.k){case"lit":return typeof e.value=="string"?j("str"):typeof e.value=="number"?j("num"):typeof e.value=="boolean"?j("bool"):void 0;case"tpl":return j("str");case"id":return n.lookup(e.name)?.type;case"binary":{if(["==","!=","<",">","<=",">="].includes(e.op))return j("bool");if(e.op==="+"){let i=this.inferType(e.left,n),s=this.inferType(e.right,n);return i?.base==="str"&&!i.array||s?.base==="str"&&!s.array?j("str"):i&&s&&(i.base==="num"||i.base==="int")&&(s.base==="num"||s.base==="int")&&!i.array&&!s.array?j("num"):void 0}return["-","*","/","%","**"].includes(e.op)?j("num"):void 0}case"unary":return e.op==="!"?j("bool"):e.op==="-"||e.op==="+"?j("num"):e.op==="typeof"?j("str"):void 0;case"cond":{let i=this.inferType(e.then,n),s=this.inferType(e.else,n);return i&&s&&ne(i)===ne(s)?i:void 0}case"array":{if(!e.items.length)return;let i=this.inferType(e.items[0].value,n);return!i||e.items.some(s=>s.spread||ne(this.inferType(s.value,n)??j("any"))!==ne(i))?j("any",1):{...i,array:i.array+1}}case"object":return j("obj");case"call":{let i=this.calleeBinding(e.callee,n);if(i?.fn?.returnType&&i.fn.returnType.base!=="void")return i.fn.returnType;if(e.callee.k==="member"&&["toUpperCase","toLowerCase","trim","join","toFixed","padStart","padEnd","slice","replace","toString"].includes(e.callee.prop)){let s=this.inferType(e.callee.object,n);if(e.callee.prop==="slice"&&s?.array)return s;if(e.callee.prop!=="slice"||s?.base==="str")return j("str")}return}case"member":return e.prop==="length"?j("num"):void 0;default:return}}checkAssignable(e,n,i,s,r){if(n.k==="lit"&&n.value===null){!e.nullable&&e.base!=="obj"&&e.base!=="any"&&e.array===0&&this.diagnostics.warn("W0401",`Assigning null to non-nullable ${ne(e)} ${r}`,s,`Declare it as '${ne(e)}?' to allow null`);return}let a=this.inferType(n,i);a&&(e.base==="ui"||e.base==="void"||fs(e,a)||this.fail("E0403",`Type mismatch: cannot assign ${ne(a)} to ${ne(e)} ${r}`,s))}};function ys(t){if(!t||t.nullable)return"null";if(t.array)return"[]";switch(t.base){case"str":return'""';case"num":case"int":return"0";case"bool":return"false";default:return"null"}}function Nt(t){return t.k==="object"&&t.props.every(e=>!e.spread&&!e.computedKey&&e.value.k==="lit")}function Zn(t){return t.replace(/^(Webkit|Moz|Ms)/,e=>"-"+e.toLowerCase()).replace(/[A-Z]/g,e=>"-"+e.toLowerCase())}function ks(t){return t.props.filter(e=>e.value.k==="lit"&&e.value.value!==null&&e.value.value!==!1).map(e=>`${Zn(e.key)}: ${String(e.value.value)}`).join("; ")}function V(t){switch(t.k){case"unary":return t.op==="await"||V(t.arg);case"binary":return V(t.left)||V(t.right);case"assign":return V(t.value);case"cond":return V(t.test)||V(t.then)||V(t.else);case"call":return V(t.callee)||t.args.some(e=>V(e.value));case"member":return V(t.object);case"index":return V(t.object)||V(t.index);case"array":return t.items.some(e=>V(e.value));case"object":return t.props.some(e=>V(e.value));case"tpl":return t.parts.some(e=>typeof e!="string"&&V(e));default:return!1}}function ie(t){return t.some(e=>{switch(e.k){case"expr":return V(e.expr);case"var":return!!e.decl.init&&V(e.decl.init);case"if":return V(e.test)||ie(e.then)||!!e.else&&ie(e.else);case"for":return V(e.iter)||ie(e.body);case"while":return V(e.test)||ie(e.body);case"try":return ie(e.body)||ie(e.handler??[])||ie(e.finalizer??[]);case"throw":return V(e.value);case"return":return!!e.value&&V(e.value);default:return!1}})}function R(t){return t.split(`
|
|
125
125
|
`).map(e=>e&&" "+e).join(`
|
|
126
|
-
`)}function ys(t,e){return ye.fromTokens(ge(t,e.file,e),e.file).parseExpr()}function Zn(t,e,n){return new At(t,e,n).compile()}var v=Symbol("unknown"),Lt=class{constructor(e){this.value=e}},q=class{constructor(e){this.parent=e;E(this,"vars",new Map)}define(e,n){this.vars.set(e,new Lt(n))}find(e){return this.vars.get(e)??this.parent?.find(e)}},le=class{constructor(e){this.value=e}},Be=class{},je=class{},Rt=new Set(["constructor","__proto__","prototype","__defineGetter__","__defineSetter__"]),ks=2e6,Ot=class{constructor(e){this.host=e;E(this,"complete",!0);E(this,"steps",0);E(this,"moduleEnvs",new Map);E(this,"componentTables",new Map);E(this,"depth",0)}renderPage(e,n){let i=this.moduleEnv(e,n);return this.renderNodes(e.body,{env:new q(i),file:e})}evalMeta(e,n){let i=this.moduleEnv(e,n);return e.meta.filter(s=>s.key!=="paths").map(s=>{let r;try{r=this.eval(s.value,i,e)}catch{r=v}return{key:s.key,value:r===v?void 0:r,known:r!==v,loc:s.loc}})}evalPaths(e,n){let i=e.meta.find(o=>o.key==="paths");if(!i)return{value:void 0,known:!0};let s={},r=this.moduleEnv(e,s,n),a;try{a=this.eval(i.value,r,e)}catch{a=v}return{value:a===v?void 0:a,known:a!==v}}tick(){if(++this.steps>ks)throw new Error("Prerender step limit exceeded")}moduleEnv(e,n,i=[]){let s=this.moduleEnvs.get(e.path);if(s)return s;let r=new q(null);this.moduleEnvs.set(e.path,r);for(let a of i)r.define(a,v);if(n)for(let[a,o]of Object.entries(n))r.define(a,o);for(let a of this.host.getImports(e)){let o=a.decl;if(a.kind==="json"){o.defaultName&&r.define(o.defaultName,a.json);for(let c of o.named)r.define(c.alias,a.json?.[c.name])}else if(a.kind==="sinth"&&a.exports){let c=this.host.getFile(a.specifier),h=this.moduleEnv(c);for(let u of o.named){let f=h.find(u.name);f&&r.define(u.alias,f.value)}}else for(let c of[o.defaultName,o.namespace,...o.named.map(h=>h.alias)])c&&r.define(c,v)}for(let a of e.externs)r.define(a.name,v);for(let a of e.functions)r.define(a.name,this.makeFunction(a,r,e));e.scripts.length&&(this.complete=!1);for(let a of e.vars)try{this.declare(a,r,e)}catch{r.define(a.name,v)}return r}declare(e,n,i){if(e.kind==="computed"&&e.init){let s=e.init;n.define(e.name,v);let r=n.find(e.name);Object.defineProperty(r,"value",{get:()=>this.eval(s,n,i),configurable:!0});return}n.define(e.name,e.init?this.eval(e.init,n,i):ws(e))}makeFunction(e,n,i){return e.view?v:(...s)=>{let r=new q(n);e.params.forEach((a,o)=>{let c=s[o];c===void 0&&a.defaultValue&&(c=this.eval(a.defaultValue,r,i)),r.define(a.name,c)});try{this.execAll(e.body,r,i)}catch(a){if(a instanceof le)return a.value;throw a}}}execAll(e,n,i){for(let s of e)this.exec(s,n,i)}exec(e,n,i){switch(this.tick(),e.k){case"expr":this.eval(e.expr,n,i);return;case"var":this.declare(e.decl,n,i);return;case"if":{let s=this.eval(e.test,n,i);if(s===v)throw new le(v);s?this.execAll(e.then,new q(n),i):e.else&&this.execAll(e.else,new q(n),i);return}case"for":{let s=this.eval(e.iter,n,i);if(s===v)throw new le(v);for(let[r,a,o]of Qn(s)){let c=new q(n);if([r,a,o].slice(0,e.names.length).forEach((h,u)=>c.define(e.names[u],h)),!(e.filter&&!this.eval(e.filter,c,i)))try{this.execAll(e.body,c,i)}catch(h){if(h instanceof Be)break;if(h instanceof je)continue;throw h}}return}case"while":{for(;;){let s=this.eval(e.test,n,i);if(s===v)throw new le(v);if(!s)break;try{this.execAll(e.body,new q(n),i)}catch(r){if(r instanceof Be)break;if(r instanceof je)continue;throw r}}return}case"try":case"throw":throw new le(v);case"return":throw new le(e.value?this.eval(e.value,n,i):void 0);case"break":throw new Be;case"continue":throw new je}}eval(e,n,i){switch(this.tick(),e.k){case"lit":return e.value;case"tpl":{let s="";for(let r of e.parts)if(typeof r=="string")s+=r;else{let a=this.eval(r,n,i);if(a===v)return v;s+=be(a)}return s}case"id":{let s=n.find(e.name);return s?s.value:Ss[e.name]??v}case"member":{let s=this.eval(e.object,n,i);return s===v?v:s==null?e.optional?void 0:v:Tt(s,e.prop)}case"index":{let s=this.eval(e.object,n,i),r=this.eval(e.index,n,i);return s===v||r===v?v:s==null?e.optional?void 0:v:Tt(s,String(r))}case"call":{let s,r;if(e.callee.k==="member"){if(s=this.eval(e.callee.object,n,i),s===v)return v;if(s==null)return e.optional||e.callee.optional?void 0:v;r=Tt(s,e.callee.prop)}else r=this.eval(e.callee,n,i);if(typeof r!="function")return v;let a=[];for(let o of e.args){let c=this.eval(o.value,n,i);if(c===v)return v;o.spread&&Array.isArray(c)?a.push(...c):a.push(c)}if(!Es(r,s))return v;try{let o=r.apply(s,a);return o instanceof Promise?v:o}catch(o){return o instanceof le?o.value:v}}case"new":{if(e.callee.k==="id"&&e.callee.name==="Date"){let s=e.args.map(r=>this.eval(r.value,n,i));return s.includes(v)?v:new Date(...s)}return v}case"unary":{if(e.op==="await")return v;let s=this.eval(e.arg,n,i);if(s===v)return v;switch(e.op){case"!":return!s;case"-":return-s;case"+":return+s;case"~":return~s;case"typeof":return typeof s}return v}case"binary":{let s=this.eval(e.left,n,i);if(s===v)return v;if(e.op==="&&")return s&&this.eval(e.right,n,i);if(e.op==="||")return s||this.eval(e.right,n,i);if(e.op==="??")return s??this.eval(e.right,n,i);let r=this.eval(e.right,n,i);return r===v?v:Pt(e.op,s,r)}case"cond":{let s=this.eval(e.test,n,i);return s===v?v:s?this.eval(e.then,n,i):this.eval(e.else,n,i)}case"assign":{let s=this.eval(e.value,n,i);if(e.target.k==="id"){let r=n.find(e.target.name);if(!r)return v;let a=r.value;return r.value=e.op==="="?s:s===v||a===v?v:Pt(e.op.slice(0,-1),a,s),r.value}if(e.target.k==="member"||e.target.k==="index"){let r=this.eval(e.target.object,n,i),a=e.target.k==="member"?e.target.prop:this.eval(e.target.index,n,i);if(r&&typeof r=="object"&&a!==v&&!Rt.has(String(a))){let o=r;return o[String(a)]=e.op==="="?s:Pt(e.op.slice(0,-1),o[String(a)],s),o[String(a)]}}return v}case"update":{if(e.target.k!=="id")return v;let s=n.find(e.target.name);if(!s||typeof s.value!="number")return v;let r=s.value;return s.value=r+1,e.prefix?s.value:r}case"array":{let s=[];for(let r of e.items){let a=this.eval(r.value,n,i);if(a===v)return v;r.spread&&Array.isArray(a)?s.push(...a):s.push(a)}return s}case"object":{let s={};for(let r of e.props){let a=this.eval(r.value,n,i);if(a===v)return v;if(r.spread)Object.assign(s,a);else{let o=r.computedKey?String(this.eval(r.computedKey,n,i)):r.key;Rt.has(o)||(s[o]=a)}}return s}case"arrow":{let s=e.body,r=e.params;return e.async?v:(...a)=>{let o=new q(n);if(r.forEach((c,h)=>o.define(c.name,a[h]===void 0&&c.defaultValue?this.eval(c.defaultValue,o,i):a[h])),!Array.isArray(s))return this.eval(s,o,i);try{this.execAll(s,o,i)}catch(c){if(c instanceof le)return c.value;throw c}}}case"range":return v}}components(e){let n=this.componentTables.get(e.path);if(n)return n;let i=new Map;this.componentTables.set(e.path,i);for(let s of this.host.getImports(e)){if(s.kind!=="sinth"||!s.exports)continue;let r=this.host.getFile(s.specifier),a=s.decl,o=c=>{let h=r.components.find(u=>u.name===c);return h?{decl:h,file:r}:void 0};if(a.sideEffect||!a.named.length&&!a.defaultName&&!a.namespace)for(let c of r.components)i.set(c.name,{decl:c,file:r});if(a.defaultName&&s.exports.defaultComponent){let c=o(s.exports.defaultComponent);c&&i.set(a.defaultName,c)}if(a.namespace)for(let c of r.components)i.set(`${a.namespace}.${c.name}`,{decl:c,file:r});for(let c of a.named){let h=o(c.name);h&&i.set(c.alias,h)}}for(let s of e.components)i.set(s.name,{decl:s,file:e});return i}renderNodes(e,n){let i="";for(let s of e)i+=this.renderNode(s,n);return i}renderNode(e,n){switch(this.tick(),e.k){case"text":{if(e.expr.k==="call"&&e.expr.callee.k==="id"){let s=n.file.functions.find(r=>r.name===e.expr.callee.name&&r.view);if(s&&s.view)return this.renderUiFunction(s,e.expr.args.map(r=>this.eval(r.value,n.env,n.file)),n)}let i=this.eval(e.expr,n.env,n.file);return i===v?(this.complete=!1,""):Ne(be(i))}case"element":return this.renderElement(e,n);case"if":{for(let i of e.branches){let s=i.test?this.eval(i.test,n.env,n.file):!0;if(s===v)return this.complete=!1,"";if(s)return this.renderNodes(i.body,{...n,env:new q(n.env)})}return""}case"for":{let i=this.eval(e.iter,n.env,n.file);if(i===v)return this.complete=!1,"";let s="",r=0;for(let[a,o,c]of Qn(i)){let h=new q(n.env);if([a,r,c].slice(0,e.names.length).forEach((u,f)=>h.define(e.names[f],u)),e.filter){let u=this.eval(e.filter,h,n.file);if(u===v&&(this.complete=!1),!u||u===v)continue}r++,s+=this.renderNodes(e.body,{...n,env:h})}return r===0&&e.empty&&(s+=this.renderNodes(e.empty,n)),s}case"slot":{let i=n.slots?.[e.name];return i?i():this.renderNodes(e.fallback,n)}case"stmt":try{this.exec(e.stmt,n.env,n.file)}catch{this.complete=!1}return"";case"var":return this.declare(e.decl,n.env,n.file),""}}renderUiFunction(e,n,i){let s=new q(this.moduleEnv(i.file));e.params.forEach((r,a)=>s.define(r.name,n[a]===void 0&&r.defaultValue?this.eval(r.defaultValue,s,i.file):n[a]));for(let r of e.body)r.k==="var"&&this.declare(r.decl,s,i.file);return this.renderNodes(e.view??[],{...i,env:s})}attrValue(e,n){return e.value===null?!0:this.eval(e.value,n.env,n.file)}renderElement(e,n){let i=n.compName===e.name&&J[e.name]?void 0:this.components(n.file).get(e.name);if(i)return this.renderComponent(e,i,n);if(e.name==="Fragment")return this.renderNodes(e.children,n);if(e.name==="RawHTML"||e.name==="Html"){let d=e.attrs.find(m=>m.name==="content"||m.name==="html"),g=d?this.attrValue(d,n):"";return g===v?(this.complete=!1,""):be(g)}let s=J[e.name];if(!s)return"";let r=s.tag,a=new Map(Object.entries(s.attrs??{})),o=[];s.className&&o.push(s.className),n.scopeClass&&o.push(n.scopeClass);let c=[],h;for(let d of e.attrs){if(d.handler||d.name==="ref"||d.name==="key"||d.name==="...")continue;if(d.name==="level"&&e.name==="Heading"){let C=this.attrValue(d,n);typeof C=="number"&&(r=`h${Math.min(6,Math.max(1,C))}`);continue}let g=this.attrValue(d,n);if(g===v){this.complete=!1;continue}switch(d.name){case"class":o.push(Vt(g));continue;case"style":if(g&&typeof g=="object")for(let[C,A]of Object.entries(g))A!=null&&A!==!1&&c.push(`${Yn(C)}: ${String(A)}`);else typeof g=="string"&&c.push(g);continue;case"model":case"bind":a.get("type")==="checkbox"||e.name==="Checkbox"?g===!0&&a.set("checked",""):r==="textarea"?h=Ne(be(g)):r!=="select"&&a.set("value",be(g));continue;case"hide":g&&c.push("display: none");continue;case"show":g||c.push("display: none");continue;case"delay":c.push("display: none");continue;case"html":h=be(g);continue;default:break}if(Me.has(d.name)&&!((d.name==="width"||d.name==="height")&&["img","video","canvas","iframe","svg","input","rect","embed","object","source"].includes(r))){g!=null&&g!==!1&&c.push(`${Yn(d.name)}: ${String(g)}`);continue}if(g==null||g===!1)continue;let m=ce(d.name);if(/^on/i.test(m))continue;let k=g===!0?"":typeof g=="object"?JSON.stringify(g):String(g);a.set(m,/^(href|src|action|formaction|poster)$/.test(m)&&/^\s*(javascript|vbscript):/i.test(k)?"about:blank#blocked":k)}let u=o.filter(Boolean).join(" ");u&&a.set("class",u),c.length&&a.set("style",[a.get("style"),...c].filter(Boolean).join("; "));let f=[...a].map(([d,g])=>g===""&&Ue.has(d)?` ${d}`:` ${d}="${T(g)}"`).join("");if(Pe.has(r))return`<${r}${f}>`;let x=h??this.renderNodes(e.children,n);return`<${r}${f}>${x}</${r}>`}renderComponent(e,n,i){if(++this.depth>64)throw this.depth--,new Error(`Component nesting is deeper than 64 levels at '${e.name}' (recursive component without a stop condition?)`);try{let s=n.decl,r=this.moduleEnv(n.file),a=new q(r),o=[];for(let m of s.params){let k=e.attrs.find(C=>C.name===m.name);k&&!k.handler?a.define(m.name,this.attrValue(k,i)):k?.handler?a.define(m.name,v):a.define(m.name,m.defaultValue?this.eval(m.defaultValue,a,n.file):void 0)}for(let m of e.attrs)!s.params.some(k=>k.name===m.name)&&!m.handler&&o.push(m);for(let m of s.vars)this.declare(m,a,n.file);s.scripts.length&&(this.complete=!1);let c={};e.children.length&&(c.default=()=>this.renderNodes(e.children,i));for(let m of e.slots)c[m.name]=()=>this.renderNodes(m.children,i);let h=`s-${Ce(n.file.path.replace(/\\/g,"/")+"#"+s.name).slice(0,7)}`,u={env:a,file:n.file,scopeClass:h,slots:c,compName:s.name},f=this.renderNodes(s.body,u),x=this.styleVars(s,n.file,a),d=o.filter(m=>m.name==="class").map(m=>Vt(this.attrValue(m,i))).join(" "),g=o.filter(m=>m.name!=="class"&&m.name!=="style"&&m.name!=="model"&&m.name!=="bind"&&m.name!=="ref").map(m=>[ce(m.name),this.attrValue(m,i)]).filter(([,m])=>m!==v&&m!==null&&m!==void 0&&m!==!1);return(x||d||g.length)&&(f=f.replace(/^<([a-zA-Z][\w-]*)((?:\s[^>]*)?)>/,(m,k,C)=>{let A=C;d&&(A=/\sclass="/.test(A)?A.replace(/\sclass="([^"]*)"/,(ie,de)=>` class="${de} ${T(d)}"`):`${A} class="${T(d)}"`),x&&(A=/\sstyle="/.test(A)?A.replace(/\sstyle="([^"]*)"/,(ie,de)=>` style="${de}; ${T(x)}"`):`${A} style="${T(x)}"`);for(let[ie,de]of g)new RegExp(`\\s${ie}=`).test(A)||(A+=de===!0?` ${ie}`:` ${ie}="${T(String(de))}"`);return`<${k}${A}>`})),f}finally{this.depth--}}styleVars(e,n,i){let s=new Set([...e.params.map(a=>a.name),...e.vars.map(a=>a.name)]),r=[];for(let a of e.styles){if(a.global)continue;let o=`--sv-${Ce(n.path+e.name).slice(0,5)}-`;try{let c=it(a.raw,a.lang==="scss"?"css":a.lang,{reactiveNames:s,varPrefix:o,loc:a.loc,sinthSyntax:a.lang==="sinth"});for(let h of c.expressions){let u=ye.fromTokens(ge(h.source,n.path,a.loc),n.path).parseExpr(),f=this.eval(u,i,n);f!==v&&f!==null&&f!==void 0&&r.push(`${h.cssVar}: ${be(f)}`)}}catch{continue}}return r.join("; ")}};function ws(t){let e=t.type;return!e||e.nullable?null:e.array?[]:e.base==="str"?"":e.base==="num"||e.base==="int"?0:e.base==="bool"?!1:null}function Pt(t,e,n){let i=e,s=n;switch(t){case"+":return e+n;case"-":return i-s;case"*":return i*s;case"/":return i/s;case"%":return i%s;case"**":return i**s;case"==":return e===n;case"!=":return e!==n;case"<":return i<s;case">":return i>s;case"<=":return i<=s;case">=":return i>=s;default:return v}}function Tt(t,e){if(Rt.has(e))return v;if(typeof t=="string"||typeof t=="number"||typeof t=="boolean"){let n=Object(t)[e];return n===void 0?void 0:n}return t&&(typeof t=="object"||typeof t=="function")?t[e]:v}var Ss={Math,JSON,Number,String,Boolean,Array,Object,Date,parseInt,parseFloat,isNaN,isFinite,encodeURIComponent,decodeURIComponent,encodeURI,decodeURI,Infinity:1/0,NaN:NaN,range:(t,e,n=1)=>{let i=e===void 0?0:t,s=e===void 0?t:e,r=[];if(n>0)for(let a=i;a<s&&r.length<1e5;a+=n)r.push(a);else if(n<0)for(let a=i;a>s&&r.length<1e5;a+=n)r.push(a);return r}},Cs=new Set([Function,Object.defineProperty,Object.defineProperties,Object.setPrototypeOf,Object.assign]);function Es(t,e){return!(Cs.has(t)||t===Function.prototype.call||t===Function.prototype.apply||t===Function.prototype.bind)}function Qn(t){return t==null||t===!1?[]:typeof t=="number"?Array.from({length:Math.max(0,Math.floor(t))},(e,n)=>[n,n,n]):Array.isArray(t)?t.map((e,n)=>[e,n,n]):t instanceof Map?Array.from(t.entries()).map(([e,n],i)=>[n,i,e]):typeof t=="string"?Array.from(t).map((e,n)=>[e,n,n]):typeof t=="object"?Object.entries(t).map(([e,n],i)=>[n,i,e]):[]}function be(t){if(t==null||t===!1||t===v)return"";if(typeof t=="string")return t;if(typeof t=="number")return String(t);if(Array.isArray(t))return t.map(be).join(", ");if(t instanceof Date)return t.toLocaleString("en-US");if(typeof t=="object")try{return JSON.stringify(t)}catch{return""}return String(t)}function Vt(t){return!t||t===v?"":typeof t=="string"?t:Array.isArray(t)?t.map(Vt).filter(Boolean).join(" "):typeof t=="object"?Object.entries(t).filter(([,e])=>!!e).map(([e])=>e).join(" "):String(t)}function Yn(t){return t.startsWith("--")?t:t.replace(/^(Webkit|Moz|Ms)/,e=>"-"+e.toLowerCase()).replace(/[A-Z]/g,e=>"-"+e.toLowerCase())}function Xn(t,e,n){let i=new Ot(e),s;try{s=i.renderPage(t,n)}catch{s=void 0}let r=s!==void 0&&i.complete;return{html:s??"",complete:r,meta:i.evalMeta(t,n)}}function _s(t){let e=t.lastIndexOf("/");return e<=0?"/":t.slice(0,e)}function Bt(t){let e=[];for(let n of t.split("/"))!n||n==="."||(n===".."?e.pop():e.push(n));return"/"+e.join("/")}var jt=/^(https?:)?\/\//;function ei(t,e={}){let n=Bt(e.entry??"/pages/index.sinth"),i=e.builtins??{},s=e.resolvePackage??(S=>`https://esm.sh/${S}`),r=new Map,a=new Map,o=new Map,c=[],h=[],u=[],f=[],x=S=>S.startsWith("sinth:")?i[S]:t[S],d=S=>{let H=r.get(S);if(H)return H;let L=x(S);if(L===void 0)throw new P("E0600",`File not found: ${S}`);let K=Jt(L,S);return K.isPage=S===n,r.set(S,K),K},g=(S,H)=>[S,...H.map(L=>S+L),...H.map(L=>S+"/index"+L)].find(L=>x(L)!==void 0),m=S=>{let H=a.get(S.path);if(H)return H;let L=[];for(let K of S.imports){let B=K;B.kind==="library"&&(B={...B,kind:"sinth",source:"sinth:ui",sideEffect:!0});let N=B.source,Ee=N.startsWith("/")&&!N.startsWith("//")?Bt(N):Bt(_s(S.path)+"/"+N),ii=N.startsWith(".")||N.startsWith("/")&&!N.startsWith("//"),Dt=()=>{throw new P("E0601",`Cannot find '${N}'`,B.loc)},Ft=re=>{let De=d(re);if(De.isPage)throw new P("E0608",`Cannot import page '${N}'; pages are entry points`,B.loc);return{decl:{...B,kind:"sinth"},kind:"sinth",specifier:re,exports:Nt(De)}};if(N.startsWith("sinth:")){if(i[N]===void 0)throw new P("E0605",`Unknown built-in library '${N}'`,B.loc);L.push(Ft(N));continue}switch(B.kind){case"style":{if(jt.test(N)){f.push(N),L.push({decl:B,kind:"style",specifier:N});break}let re=g(Ee,[".css"])??Dt();h.push(x(re)??""),L.push({decl:B,kind:"style",specifier:N});break}case"font":L.push({decl:B,kind:"font",specifier:N});break;case"json":{let re=g(Ee,[])??Dt();try{L.push({decl:B,kind:"json",specifier:re,json:JSON.parse(x(re)??"")})}catch(De){throw new P("E0606",`Invalid JSON in '${N}': ${De.message}`,B.loc)}break}case"script":if(!jt.test(N))throw new P("E0607",`Only URL scripts can be imported here: '${N}'`,B.loc);u.push(N),L.push({decl:B,kind:"script",specifier:N});break;default:{if(jt.test(N)){L.push({decl:{...B,kind:"module"},kind:"module",specifier:N});break}if(ii){let re=g(Ee,[".sinth"]);if(re?.endsWith(".sinth")){L.push(Ft(re));break}throw new P("E0601",`Cannot find '${N}'`,B.loc,"Only .sinth, .css and .json files can be imported here")}L.push({decl:{...B,kind:"module"},kind:"module",specifier:s(N)})}}}return a.set(S.path,L),L},k=(S,H)=>{let L=o.get(S);if(L)return L;if(H.includes(S))throw new P("E0609",`Circular import: ${[...H.slice(H.indexOf(S)),S].join(" -> ")}`);let K=d(S),B=m(K);for(let Ee of B)Ee.kind==="sinth"&&k(Ee.specifier,[...H,S]);let N=Zn(K,B,{runtime:"sinth-runtime",dev:!!e.dev,persistPrefix:"sinth:"+S.replace(/^\//,"").replace(/\.sinth$/,"")});return o.set(S,N),c.push(S),N};k(n,[]);let C={getFile:d,getImports:m},A=Xn(d(n),C),ie=Kn(A.meta.map(S=>S.known?S:{...S,known:!0,value:void 0}),S=>S),de=c.map(S=>{let H=o.get(S),L=m(d(S)).filter(K=>K.kind==="sinth").map(K=>K.specifier);return{id:S,js:H.js.replace(/^import "sinth-css:[^"]*";\n/gm,""),deps:L}}),ti=[...h,...c.map(S=>o.get(S)?.css??"").filter(Boolean)].join(`
|
|
126
|
+
`)}function ws(t,e){return we.fromTokens(ge(t,e.file,e),e.file).parseExpr()}function Qn(t,e,n){return new It(t,e,n).compile()}var v=Symbol("unknown"),Lt=class{constructor(e){this.value=e}},q=class{constructor(e){this.parent=e;$(this,"vars",new Map)}define(e,n){this.vars.set(e,new Lt(n))}find(e){return this.vars.get(e)??this.parent?.find(e)}},le=class{constructor(e){this.value=e}},Be=class{},De=class{},Rt=new Set(["constructor","__proto__","prototype","__defineGetter__","__defineSetter__"]),Ss=2e6,Ot=class{constructor(e){this.host=e;$(this,"complete",!0);$(this,"steps",0);$(this,"moduleEnvs",new Map);$(this,"componentTables",new Map);$(this,"depth",0)}renderPage(e,n){let i=this.moduleEnv(e,n),s=this.renderNodes(e.body,{env:new q(i),file:e}),r=new Set(e.vars.map(o=>o.name)),a=this.evalStyleVars(e.styles,r,`--sv-${be(e.path+"page").slice(0,5)}-`,e,i);return a?`<style>:root{${Cs(a)}}</style>${s}`:s}evalMeta(e,n){let i=this.moduleEnv(e,n);return e.meta.filter(s=>s.key!=="paths").map(s=>{let r;try{r=this.eval(s.value,i,e)}catch{r=v}return{key:s.key,value:r===v?void 0:r,known:r!==v,loc:s.loc}})}evalPaths(e,n){let i=e.meta.find(o=>o.key==="paths");if(!i)return{value:void 0,known:!0};let s={},r=this.moduleEnv(e,s,n),a;try{a=this.eval(i.value,r,e)}catch{a=v}return{value:a===v?void 0:a,known:a!==v}}tick(){if(++this.steps>Ss)throw new Error("Prerender step limit exceeded")}moduleEnv(e,n,i=[]){let s=this.moduleEnvs.get(e.path);if(s)return s;let r=new q(null);this.moduleEnvs.set(e.path,r);for(let a of i)r.define(a,v);if(n)for(let[a,o]of Object.entries(n))r.define(a,o);for(let a of this.host.getImports(e)){let o=a.decl;if(a.kind==="json"){o.defaultName&&r.define(o.defaultName,a.json);for(let c of o.named)r.define(c.alias,a.json?.[c.name])}else if(a.kind==="sinth"&&a.exports){let c=this.host.getFile(a.specifier),h=this.moduleEnv(c);for(let u of o.named){let f=h.find(u.name);f&&r.define(u.alias,f.value)}}else for(let c of[o.defaultName,o.namespace,...o.named.map(h=>h.alias)])c&&r.define(c,v)}for(let a of e.externs)r.define(a.name,v);for(let a of e.functions)r.define(a.name,this.makeFunction(a,r,e));e.scripts.length&&(this.complete=!1);for(let a of e.vars)try{this.declare(a,r,e)}catch{r.define(a.name,v)}return r}declare(e,n,i){if(e.kind==="computed"&&e.init){let s=e.init;n.define(e.name,v);let r=n.find(e.name);Object.defineProperty(r,"value",{get:()=>this.eval(s,n,i),configurable:!0});return}n.define(e.name,e.init?this.eval(e.init,n,i):Es(e))}makeFunction(e,n,i){return e.view?v:(...s)=>{let r=new q(n);e.params.forEach((a,o)=>{let c=s[o];c===void 0&&a.defaultValue&&(c=this.eval(a.defaultValue,r,i)),r.define(a.name,c)});try{this.execAll(e.body,r,i)}catch(a){if(a instanceof le)return a.value;throw a}}}execAll(e,n,i){for(let s of e)this.exec(s,n,i)}exec(e,n,i){switch(this.tick(),e.k){case"expr":this.eval(e.expr,n,i);return;case"var":this.declare(e.decl,n,i);return;case"if":{let s=this.eval(e.test,n,i);if(s===v)throw new le(v);s?this.execAll(e.then,new q(n),i):e.else&&this.execAll(e.else,new q(n),i);return}case"for":{let s=this.eval(e.iter,n,i);if(s===v)throw new le(v);for(let[r,a,o]of Yn(s)){let c=new q(n);if([r,a,o].slice(0,e.names.length).forEach((h,u)=>c.define(e.names[u],h)),!(e.filter&&!this.eval(e.filter,c,i)))try{this.execAll(e.body,c,i)}catch(h){if(h instanceof Be)break;if(h instanceof De)continue;throw h}}return}case"while":{for(;;){let s=this.eval(e.test,n,i);if(s===v)throw new le(v);if(!s)break;try{this.execAll(e.body,new q(n),i)}catch(r){if(r instanceof Be)break;if(r instanceof De)continue;throw r}}return}case"try":case"throw":throw new le(v);case"return":throw new le(e.value?this.eval(e.value,n,i):void 0);case"break":throw new Be;case"continue":throw new De}}eval(e,n,i){switch(this.tick(),e.k){case"lit":return e.value;case"tpl":{let s="";for(let r of e.parts)if(typeof r=="string")s+=r;else{let a=this.eval(r,n,i);if(a===v)return v;s+=ye(a)}return s}case"id":{let s=n.find(e.name);return s?s.value:$s[e.name]??v}case"member":{let s=this.eval(e.object,n,i);return s===v?v:s==null?e.optional?void 0:v:Tt(s,e.prop)}case"index":{let s=this.eval(e.object,n,i),r=this.eval(e.index,n,i);return s===v||r===v?v:s==null?e.optional?void 0:v:Tt(s,String(r))}case"call":{let s,r;if(e.callee.k==="member"){if(s=this.eval(e.callee.object,n,i),s===v)return v;if(s==null)return e.optional||e.callee.optional?void 0:v;r=Tt(s,e.callee.prop)}else r=this.eval(e.callee,n,i);if(typeof r!="function")return v;let a=[];for(let o of e.args){let c=this.eval(o.value,n,i);if(c===v)return v;o.spread&&Array.isArray(c)?a.push(...c):a.push(c)}if(!Ns(r,s))return v;try{let o=r.apply(s,a);return o instanceof Promise?v:o}catch(o){return o instanceof le?o.value:v}}case"new":{if(e.callee.k==="id"&&e.callee.name==="Date"){let s=e.args.map(r=>this.eval(r.value,n,i));return s.includes(v)?v:new Date(...s)}return v}case"unary":{if(e.op==="await")return v;let s=this.eval(e.arg,n,i);if(s===v)return v;switch(e.op){case"!":return!s;case"-":return-s;case"+":return+s;case"~":return~s;case"typeof":return typeof s}return v}case"binary":{let s=this.eval(e.left,n,i);if(s===v)return v;if(e.op==="&&")return s&&this.eval(e.right,n,i);if(e.op==="||")return s||this.eval(e.right,n,i);if(e.op==="??")return s??this.eval(e.right,n,i);let r=this.eval(e.right,n,i);return r===v?v:Pt(e.op,s,r)}case"cond":{let s=this.eval(e.test,n,i);return s===v?v:s?this.eval(e.then,n,i):this.eval(e.else,n,i)}case"assign":{let s=this.eval(e.value,n,i);if(e.target.k==="id"){let r=n.find(e.target.name);if(!r)return v;let a=r.value;return r.value=e.op==="="?s:s===v||a===v?v:Pt(e.op.slice(0,-1),a,s),r.value}if(e.target.k==="member"||e.target.k==="index"){let r=this.eval(e.target.object,n,i),a=e.target.k==="member"?e.target.prop:this.eval(e.target.index,n,i);if(r&&typeof r=="object"&&a!==v&&!Rt.has(String(a))){let o=r;return o[String(a)]=e.op==="="?s:Pt(e.op.slice(0,-1),o[String(a)],s),o[String(a)]}}return v}case"update":{if(e.target.k!=="id")return v;let s=n.find(e.target.name);if(!s||typeof s.value!="number")return v;let r=s.value;return s.value=r+1,e.prefix?s.value:r}case"array":{let s=[];for(let r of e.items){let a=this.eval(r.value,n,i);if(a===v)return v;r.spread&&Array.isArray(a)?s.push(...a):s.push(a)}return s}case"object":{let s={};for(let r of e.props){let a=this.eval(r.value,n,i);if(a===v)return v;if(r.spread)Object.assign(s,a);else{let o=r.computedKey?String(this.eval(r.computedKey,n,i)):r.key;Rt.has(o)||(s[o]=a)}}return s}case"arrow":{let s=e.body,r=e.params;return e.async?v:(...a)=>{let o=new q(n);if(r.forEach((c,h)=>o.define(c.name,a[h]===void 0&&c.defaultValue?this.eval(c.defaultValue,o,i):a[h])),!Array.isArray(s))return this.eval(s,o,i);try{this.execAll(s,o,i)}catch(c){if(c instanceof le)return c.value;throw c}}}case"range":return v}}components(e){let n=this.componentTables.get(e.path);if(n)return n;let i=new Map;this.componentTables.set(e.path,i);for(let s of this.host.getImports(e)){if(s.kind!=="sinth"||!s.exports)continue;let r=this.host.getFile(s.specifier),a=s.decl,o=c=>{let h=r.components.find(u=>u.name===c);return h?{decl:h,file:r}:void 0};if(a.sideEffect||!a.named.length&&!a.defaultName&&!a.namespace)for(let c of r.components)i.set(c.name,{decl:c,file:r});if(a.defaultName&&s.exports.defaultComponent){let c=o(s.exports.defaultComponent);c&&i.set(a.defaultName,c)}if(a.namespace)for(let c of r.components)i.set(`${a.namespace}.${c.name}`,{decl:c,file:r});for(let c of a.named){let h=o(c.name);h&&i.set(c.alias,h)}}for(let s of e.components)i.set(s.name,{decl:s,file:e});return i}renderNodes(e,n){let i="";for(let s of e)i+=this.renderNode(s,n);return i}renderNode(e,n){switch(this.tick(),e.k){case"text":{if(e.expr.k==="call"&&e.expr.callee.k==="id"){let s=n.file.functions.find(r=>r.name===e.expr.callee.name&&r.view);if(s&&s.view)return this.renderUiFunction(s,e.expr.args.map(r=>this.eval(r.value,n.env,n.file)),n)}let i=this.eval(e.expr,n.env,n.file);return i===v?(this.complete=!1,""):Ae(ye(i))}case"element":return this.renderElement(e,n);case"if":{for(let i of e.branches){let s=i.test?this.eval(i.test,n.env,n.file):!0;if(s===v)return this.complete=!1,"";if(s)return this.renderNodes(i.body,{...n,env:new q(n.env)})}return""}case"for":{let i=this.eval(e.iter,n.env,n.file);if(i===v)return this.complete=!1,"";let s="",r=0;for(let[a,o,c]of Yn(i)){let h=new q(n.env);if([a,r,c].slice(0,e.names.length).forEach((u,f)=>h.define(e.names[f],u)),e.filter){let u=this.eval(e.filter,h,n.file);if(u===v&&(this.complete=!1),!u||u===v)continue}r++,s+=this.renderNodes(e.body,{...n,env:h})}return r===0&&e.empty&&(s+=this.renderNodes(e.empty,n)),s}case"slot":{let i=n.slots?.[e.name];return i?i():this.renderNodes(e.fallback,n)}case"stmt":try{this.exec(e.stmt,n.env,n.file)}catch{this.complete=!1}return"";case"var":return this.declare(e.decl,n.env,n.file),""}}renderUiFunction(e,n,i){let s=new q(this.moduleEnv(i.file));e.params.forEach((r,a)=>s.define(r.name,n[a]===void 0&&r.defaultValue?this.eval(r.defaultValue,s,i.file):n[a]));for(let r of e.body)r.k==="var"&&this.declare(r.decl,s,i.file);return this.renderNodes(e.view??[],{...i,env:s})}attrValue(e,n){return e.value===null?!0:this.eval(e.value,n.env,n.file)}renderElement(e,n){let i=n.compName===e.name&&Z[e.name]?void 0:this.components(n.file).get(e.name);if(i)return this.renderComponent(e,i,n);if(e.name==="Fragment")return this.renderNodes(e.children,n);if(e.name==="RawHTML"||e.name==="Html"){let d=e.attrs.find(g=>g.name==="content"||g.name==="html"),m=d?this.attrValue(d,n):"";return m===v?(this.complete=!1,""):ye(m)}let s=Z[e.name];if(!s)return"";let r=s.tag,a=new Map(Object.entries(s.attrs??{})),o=[];s.className&&o.push(s.className),n.scopeClass&&o.push(n.scopeClass);let c=[],h;for(let d of e.attrs){if(d.handler||d.name==="ref"||d.name==="key"||d.name==="...")continue;if(d.name==="level"&&e.name==="Heading"){let k=this.attrValue(d,n);typeof k=="number"&&(r=`h${Math.min(6,Math.max(1,k))}`);continue}let m=this.attrValue(d,n);if(m===v){this.complete=!1;continue}switch(d.name){case"class":o.push(Vt(m));continue;case"style":if(m&&typeof m=="object")for(let[k,E]of Object.entries(m))E!=null&&E!==!1&&c.push(`${Xn(k)}: ${String(E)}`);else typeof m=="string"&&c.push(m);continue;case"model":case"bind":a.get("type")==="checkbox"||e.name==="Checkbox"?m===!0&&a.set("checked",""):r==="textarea"?h=Ae(ye(m)):r!=="select"&&a.set("value",ye(m));continue;case"hide":m&&c.push("display: none");continue;case"show":m||c.push("display: none");continue;case"delay":c.push("display: none");continue;case"html":h=ye(m);continue;default:break}if(Me.has(d.name)&&!((d.name==="width"||d.name==="height")&&["img","video","canvas","iframe","svg","input","rect","embed","object","source"].includes(r))){m!=null&&m!==!1&&c.push(`${Xn(d.name)}: ${String(m)}`);continue}if(m==null||m===!1)continue;let g=ce(d.name);if(/^on/i.test(g))continue;let w=m===!0?"":typeof m=="object"?JSON.stringify(m):String(m);a.set(g,/^(href|src|action|formaction|poster)$/.test(g)&&/^\s*(javascript|vbscript):/i.test(w)?"about:blank#blocked":w)}let u=o.filter(Boolean).join(" ");u&&a.set("class",u),c.length&&a.set("style",[a.get("style"),...c].filter(Boolean).join("; "));let f=[...a].map(([d,m])=>m===""&&Ue.has(d)?` ${d}`:` ${d}="${T(m)}"`).join("");if(Pe.has(r))return`<${r}${f}>`;let x=h??this.renderNodes(e.children,n);return`<${r}${f}>${x}</${r}>`}renderComponent(e,n,i){if(++this.depth>64)throw this.depth--,new Error(`Component nesting is deeper than 64 levels at '${e.name}' (recursive component without a stop condition?)`);try{let s=n.decl,r=this.moduleEnv(n.file),a=new q(r),o=[];for(let g of s.params){let w=e.attrs.find(k=>k.name===g.name);w&&!w.handler?a.define(g.name,this.attrValue(w,i)):w?.handler?a.define(g.name,v):a.define(g.name,g.defaultValue?this.eval(g.defaultValue,a,n.file):void 0)}for(let g of e.attrs)!s.params.some(w=>w.name===g.name)&&!g.handler&&o.push(g);for(let g of s.vars)this.declare(g,a,n.file);s.scripts.length&&(this.complete=!1);let c={};e.children.length&&(c.default=()=>this.renderNodes(e.children,i));for(let g of e.slots)c[g.name]=()=>this.renderNodes(g.children,i);let h=`s-${be(n.file.path.replace(/\\/g,"/")+"#"+s.name).slice(0,7)}`,u={env:a,file:n.file,scopeClass:h,slots:c,compName:s.name},f=this.renderNodes(s.body,u),x=this.styleVars(s,n.file,a),d=o.filter(g=>g.name==="class").map(g=>Vt(this.attrValue(g,i))).join(" "),m=o.filter(g=>g.name!=="class"&&g.name!=="style"&&g.name!=="model"&&g.name!=="bind"&&g.name!=="ref").map(g=>[ce(g.name),this.attrValue(g,i)]).filter(([,g])=>g!==v&&g!==null&&g!==void 0&&g!==!1);return(x||d||m.length)&&(f=f.replace(/^<([a-zA-Z][\w-]*)((?:\s[^>]*)?)>/,(g,w,k)=>{let E=k;d&&(E=/\sclass="/.test(E)?E.replace(/\sclass="([^"]*)"/,(K,de)=>` class="${de} ${T(d)}"`):`${E} class="${T(d)}"`),x&&(E=/\sstyle="/.test(E)?E.replace(/\sstyle="([^"]*)"/,(K,de)=>` style="${de}; ${T(x)}"`):`${E} style="${T(x)}"`);for(let[K,de]of m)new RegExp(`\\s${K}=`).test(E)||(E+=de===!0?` ${K}`:` ${K}="${T(String(de))}"`);return`<${w}${E}>`})),f}finally{this.depth--}}styleVars(e,n,i){let s=new Set([...e.params.map(r=>r.name),...e.vars.map(r=>r.name)]);return this.evalStyleVars(e.styles.filter(r=>!r.global),s,`--sv-${be(n.path+e.name).slice(0,5)}-`,n,i)}evalStyleVars(e,n,i,s,r){let a=[];for(let o of e)try{let c=it(o.raw,o.lang==="scss"?"css":o.lang,{reactiveNames:n,varPrefix:i,loc:o.loc,sinthSyntax:o.lang==="sinth"});for(let h of c.expressions){let u=we.fromTokens(ge(h.source,s.path,o.loc),s.path).parseExpr(),f=this.eval(u,r,s);f!==v&&f!==null&&f!==void 0&&a.push(`${h.cssVar}: ${ye(f)}`)}}catch{continue}return a.join("; ")}};function Cs(t){return t.replace(/<\//gi,"<\\/")}function Es(t){let e=t.type;return!e||e.nullable?null:e.array?[]:e.base==="str"?"":e.base==="num"||e.base==="int"?0:e.base==="bool"?!1:null}function Pt(t,e,n){let i=e,s=n;switch(t){case"+":return e+n;case"-":return i-s;case"*":return i*s;case"/":return i/s;case"%":return i%s;case"**":return i**s;case"==":return e===n;case"!=":return e!==n;case"<":return i<s;case">":return i>s;case"<=":return i<=s;case">=":return i>=s;default:return v}}function Tt(t,e){if(Rt.has(e))return v;if(typeof t=="string"||typeof t=="number"||typeof t=="boolean"){let n=Object(t)[e];return n===void 0?void 0:n}return t&&(typeof t=="object"||typeof t=="function")?t[e]:v}var $s={Math,JSON,Number,String,Boolean,Array,Object,Date,parseInt,parseFloat,isNaN,isFinite,encodeURIComponent,decodeURIComponent,encodeURI,decodeURI,Infinity:1/0,NaN:NaN,range:(t,e,n=1)=>{let i=e===void 0?0:t,s=e===void 0?t:e,r=[];if(n>0)for(let a=i;a<s&&r.length<1e5;a+=n)r.push(a);else if(n<0)for(let a=i;a>s&&r.length<1e5;a+=n)r.push(a);return r}},_s=new Set([Function,Object.defineProperty,Object.defineProperties,Object.setPrototypeOf,Object.assign]);function Ns(t,e){return!(_s.has(t)||t===Function.prototype.call||t===Function.prototype.apply||t===Function.prototype.bind)}function Yn(t){return t==null||t===!1?[]:typeof t=="number"?Array.from({length:Math.max(0,Math.floor(t))},(e,n)=>[n,n,n]):Array.isArray(t)?t.map((e,n)=>[e,n,n]):t instanceof Map?Array.from(t.entries()).map(([e,n],i)=>[n,i,e]):typeof t=="string"?Array.from(t).map((e,n)=>[e,n,n]):typeof t=="object"?Object.entries(t).map(([e,n],i)=>[n,i,e]):[]}function ye(t){if(t==null||t===!1||t===v)return"";if(typeof t=="string")return t;if(typeof t=="number")return String(t);if(Array.isArray(t))return t.map(ye).join(", ");if(t instanceof Date)return t.toLocaleString("en-US");if(typeof t=="object")try{return JSON.stringify(t)}catch{return""}return String(t)}function Vt(t){return!t||t===v?"":typeof t=="string"?t:Array.isArray(t)?t.map(Vt).filter(Boolean).join(" "):typeof t=="object"?Object.entries(t).filter(([,e])=>!!e).map(([e])=>e).join(" "):String(t)}function Xn(t){return t.startsWith("--")?t:t.replace(/^(Webkit|Moz|Ms)/,e=>"-"+e.toLowerCase()).replace(/[A-Z]/g,e=>"-"+e.toLowerCase())}function ei(t,e,n){let i=new Ot(e),s;try{s=i.renderPage(t,n)}catch{s=void 0}let r=s!==void 0&&i.complete;return{html:s??"",complete:r,meta:i.evalMeta(t,n)}}function Is(t){let e=t.lastIndexOf("/");return e<=0?"/":t.slice(0,e)}function Bt(t){let e=[];for(let n of t.split("/"))!n||n==="."||(n===".."?e.pop():e.push(n));return"/"+e.join("/")}var Dt=/^(https?:)?\/\//;function ti(t,e={}){let n=Bt(e.entry??"/pages/index.sinth"),i=e.builtins??{},s=e.resolvePackage??(C=>`https://esm.sh/${C}`),r=new Map,a=new Map,o=new Map,c=[],h=[],u=[],f=[],x=C=>C.startsWith("sinth:")?i[C]:t[C],d=C=>{let H=r.get(C);if(H)return H;let L=x(C);if(L===void 0)throw new P("E0600",`File not found: ${C}`);let G=Jt(L,C);return G.isPage=C===n,r.set(C,G),G},m=(C,H)=>[C,...H.map(L=>C+L),...H.map(L=>C+"/index"+L)].find(L=>x(L)!==void 0),g=C=>{let H=a.get(C.path);if(H)return H;let L=[];for(let G of C.imports){let B=G;B.kind==="library"&&(B={...B,kind:"sinth",source:"sinth:ui",sideEffect:!0});let A=B.source,$e=A.startsWith("/")&&!A.startsWith("//")?Bt(A):Bt(Is(C.path)+"/"+A),si=A.startsWith(".")||A.startsWith("/")&&!A.startsWith("//"),jt=()=>{throw new P("E0601",`Cannot find '${A}'`,B.loc)},Ft=re=>{let je=d(re);if(je.isPage)throw new P("E0608",`Cannot import page '${A}'; pages are entry points`,B.loc);return{decl:{...B,kind:"sinth"},kind:"sinth",specifier:re,exports:At(je)}};if(A.startsWith("sinth:")){if(i[A]===void 0)throw new P("E0605",`Unknown built-in library '${A}'`,B.loc);L.push(Ft(A));continue}switch(B.kind){case"style":{if(Dt.test(A)){f.push(A),L.push({decl:B,kind:"style",specifier:A});break}let re=m($e,[".css"])??jt();h.push(x(re)??""),L.push({decl:B,kind:"style",specifier:A});break}case"font":L.push({decl:B,kind:"font",specifier:A});break;case"json":{let re=m($e,[])??jt();try{L.push({decl:B,kind:"json",specifier:re,json:JSON.parse(x(re)??"")})}catch(je){throw new P("E0606",`Invalid JSON in '${A}': ${je.message}`,B.loc)}break}case"script":if(!Dt.test(A))throw new P("E0607",`Only URL scripts can be imported here: '${A}'`,B.loc);u.push(A),L.push({decl:B,kind:"script",specifier:A});break;default:{if(Dt.test(A)){L.push({decl:{...B,kind:"module"},kind:"module",specifier:A});break}if(si){let re=m($e,[".sinth"]);if(re?.endsWith(".sinth")){L.push(Ft(re));break}throw new P("E0601",`Cannot find '${A}'`,B.loc,"Only .sinth, .css and .json files can be imported here")}L.push({decl:{...B,kind:"module"},kind:"module",specifier:s(A)})}}}return a.set(C.path,L),L},w=(C,H)=>{let L=o.get(C);if(L)return L;if(H.includes(C))throw new P("E0609",`Circular import: ${[...H.slice(H.indexOf(C)),C].join(" -> ")}`);let G=d(C),B=g(G);for(let $e of B)$e.kind==="sinth"&&w($e.specifier,[...H,C]);let A=Qn(G,B,{runtime:"sinth-runtime",dev:!!e.dev,persistPrefix:"sinth:"+C.replace(/^\//,"").replace(/\.sinth$/,"")});return o.set(C,A),c.push(C),A};w(n,[]);let k={getFile:d,getImports:g},E=ei(d(n),k),K=Kn(E.meta.map(C=>C.known?C:{...C,known:!0,value:void 0}),C=>C),de=c.map(C=>{let H=o.get(C),L=g(d(C)).filter(G=>G.kind==="sinth").map(G=>G.specifier);return{id:C,js:H.js.replace(/^import "sinth-css:[^"]*";\n/gm,""),deps:L}}),ni=[...h,...c.map(C=>o.get(C)?.css??"").filter(Boolean)].join(`
|
|
127
127
|
|
|
128
|
-
`),
|
|
128
|
+
`),ii=c.flatMap(C=>o.get(C)?.diagnostics.warnings??[]);return{modules:de,entry:n,css:ni,externalScripts:u,externalStyles:f,warnings:ii,html:Gn(K,E.html,{styles:[],scripts:[],preloads:[],inlineHead:[]})}}var oa="5.3.3",la=`const SVG_NS = "http://www.w3.org/2000/svg";
|
|
129
129
|
const BLOCKED_URL = /^\\s*(javascript|vbscript|data:(?!image\\/(png|gif|jpe?g|webp|avif|svg\\+xml)|video\\/|audio\\/))/i;
|
|
130
130
|
let rootOwner = createOwner(null);
|
|
131
131
|
let current = rootOwner;
|
|
@@ -540,27 +540,38 @@ export function model(node, get, set, numeric = false) {
|
|
|
540
540
|
return;
|
|
541
541
|
}
|
|
542
542
|
const isNumber = numeric || type === "number" || type === "range";
|
|
543
|
+
// The value last written to or read from the field. The field is only overwritten when the bound
|
|
544
|
+
// value changes from it, so typing (an empty number field, "1." on the way to "1.5") is not undone.
|
|
545
|
+
const NONE = {};
|
|
546
|
+
let synced = NONE;
|
|
543
547
|
effect(() => {
|
|
544
548
|
const v = get();
|
|
549
|
+
if (Object.is(v, synced))
|
|
550
|
+
return;
|
|
551
|
+
synced = v;
|
|
545
552
|
const str = v === null || v === undefined ? "" : String(v);
|
|
546
553
|
if (input.value !== str && !(isNumber && Number(input.value) === v && input.value !== "")) {
|
|
547
554
|
input.value = str;
|
|
548
555
|
}
|
|
549
556
|
});
|
|
557
|
+
const write = (v) => {
|
|
558
|
+
synced = v;
|
|
559
|
+
set(v);
|
|
560
|
+
};
|
|
550
561
|
const evt = tag === "SELECT" || type === "range" || type === "color" || type === "date" || type === "file" ? "change" : "input";
|
|
551
562
|
on(node, evt, () => {
|
|
552
563
|
if (!isNumber) {
|
|
553
|
-
|
|
564
|
+
write(input.value);
|
|
554
565
|
return;
|
|
555
566
|
}
|
|
556
567
|
if (input.value === "")
|
|
557
568
|
return;
|
|
558
569
|
const n = Number(input.value);
|
|
559
570
|
if (!Number.isNaN(n))
|
|
560
|
-
|
|
571
|
+
write(n);
|
|
561
572
|
});
|
|
562
573
|
if (evt === "change" && type === "range")
|
|
563
|
-
on(node, "input", () =>
|
|
574
|
+
on(node, "input", () => write(Number(input.value)));
|
|
564
575
|
}
|
|
565
576
|
export function ref(node, set) {
|
|
566
577
|
set(node);
|
|
@@ -685,7 +696,7 @@ export function each(parent, list, render, keyOf, filter, empty) {
|
|
|
685
696
|
const [start, end] = makeRange(parent, "for");
|
|
686
697
|
const owner = current;
|
|
687
698
|
let rows = new Map();
|
|
688
|
-
let
|
|
699
|
+
let empty$ = null;
|
|
689
700
|
effect(() => {
|
|
690
701
|
let entries = iterate(list());
|
|
691
702
|
if (filter)
|
|
@@ -749,30 +760,26 @@ export function each(parent, list, render, keyOf, filter, empty) {
|
|
|
749
760
|
}
|
|
750
761
|
}
|
|
751
762
|
if (empty) {
|
|
752
|
-
if (order.length === 0 && !
|
|
753
|
-
emptyOwner = createOwner(owner);
|
|
763
|
+
if (order.length === 0 && !empty$) {
|
|
764
|
+
const emptyOwner = createOwner(owner);
|
|
754
765
|
const frag = renderInto(emptyOwner, empty);
|
|
766
|
+
const emptyStart = document.createComment("");
|
|
767
|
+
const emptyEnd = document.createComment("");
|
|
768
|
+
frag.insertBefore(emptyStart, frag.firstChild);
|
|
769
|
+
frag.appendChild(emptyEnd);
|
|
755
770
|
end.parentNode?.insertBefore(frag, end);
|
|
771
|
+
empty$ = { owner: emptyOwner, start: emptyStart, end: emptyEnd };
|
|
756
772
|
}
|
|
757
|
-
else if (order.length > 0 &&
|
|
758
|
-
disposeOwner(
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
n.parentNode?.removeChild(n);
|
|
764
|
-
n = following;
|
|
765
|
-
}
|
|
773
|
+
else if (order.length > 0 && empty$) {
|
|
774
|
+
disposeOwner(empty$.owner);
|
|
775
|
+
clearRange(empty$.start, empty$.end);
|
|
776
|
+
empty$.start.remove();
|
|
777
|
+
empty$.end.remove();
|
|
778
|
+
empty$ = null;
|
|
766
779
|
}
|
|
767
780
|
}
|
|
768
781
|
});
|
|
769
782
|
}
|
|
770
|
-
function rowsHasStart(rows, node) {
|
|
771
|
-
for (const row of rows.values())
|
|
772
|
-
if (row.start === node)
|
|
773
|
-
return true;
|
|
774
|
-
return false;
|
|
775
|
-
}
|
|
776
783
|
export function html(parent, get) {
|
|
777
784
|
const [start, end] = makeRange(parent, "html");
|
|
778
785
|
let last;
|
|
@@ -804,11 +811,16 @@ export function slot(parent, slots, name, fallback) {
|
|
|
804
811
|
fallback(parent);
|
|
805
812
|
}
|
|
806
813
|
export function onMount(fn) {
|
|
814
|
+
// The callback runs after the current render, when \`current\` is no longer this component's
|
|
815
|
+
// owner, so the owner is captured now. A returned cleanup runs when the component is removed.
|
|
816
|
+
const owner = current;
|
|
807
817
|
queueMicrotask(() => {
|
|
818
|
+
if (owner.disposed)
|
|
819
|
+
return;
|
|
808
820
|
try {
|
|
809
|
-
const cleanup = fn
|
|
821
|
+
const cleanup = withOwner(owner, fn);
|
|
810
822
|
if (typeof cleanup === "function")
|
|
811
|
-
|
|
823
|
+
owner.cleanups.push(cleanup);
|
|
812
824
|
settle(cleanup);
|
|
813
825
|
}
|
|
814
826
|
catch (err) {
|
|
@@ -883,6 +895,8 @@ export function persist(key, get) {
|
|
|
883
895
|
});
|
|
884
896
|
}
|
|
885
897
|
const memoCache = new Map();
|
|
898
|
+
/** Results kept per memoized function; the oldest are dropped beyond this. */
|
|
899
|
+
const MEMO_LIMIT = 500;
|
|
886
900
|
export function memo(site, fn, args) {
|
|
887
901
|
let cache = memoCache.get(site);
|
|
888
902
|
if (!cache) {
|
|
@@ -899,6 +913,8 @@ export function memo(site, fn, args) {
|
|
|
899
913
|
if (cache.has(key))
|
|
900
914
|
return cache.get(key);
|
|
901
915
|
const value = fn();
|
|
916
|
+
if (cache.size >= MEMO_LIMIT)
|
|
917
|
+
cache.delete(cache.keys().next().value);
|
|
902
918
|
cache.set(key, value);
|
|
903
919
|
return value;
|
|
904
920
|
}
|
|
@@ -907,6 +923,8 @@ export function range(a, b, step = 1) {
|
|
|
907
923
|
const endN = b === undefined ? a : b;
|
|
908
924
|
if (step === 0)
|
|
909
925
|
throw new Error("range() step cannot be 0");
|
|
926
|
+
if (!Number.isFinite(startN) || !Number.isFinite(endN) || !Number.isFinite(step))
|
|
927
|
+
throw new Error("range() needs finite numbers");
|
|
910
928
|
const out = [];
|
|
911
929
|
if (step > 0)
|
|
912
930
|
for (let i = startN; i < endN; i += step)
|
|
@@ -1053,7 +1071,7 @@ export function param(name) {
|
|
|
1053
1071
|
}
|
|
1054
1072
|
return routeParams[name] ?? "";
|
|
1055
1073
|
}
|
|
1056
|
-
`;function
|
|
1074
|
+
`;function ca(t,e={}){return ti(t,{...e,builtins:{"sinth:ui":`-- sinth:ui: the official Sinth component library.
|
|
1057
1075
|
-- Usage: import { Button, Card } from "sinth:ui"
|
|
1058
1076
|
-- Theme it by overriding the --ui-* custom properties on :root.
|
|
1059
1077
|
|
|
@@ -1489,4 +1507,4 @@ style global {
|
|
|
1489
1507
|
&::before, &::after { content: "''"; flex: "1"; borderTop: "1px solid var(--ui-border)" }
|
|
1490
1508
|
}
|
|
1491
1509
|
}
|
|
1492
|
-
`,...e.builtins}})}export{P as SinthError,
|
|
1510
|
+
`,...e.builtins}})}export{P as SinthError,ca as compileFiles,Wt as formatDiagnostic,la as runtimeSource,oa as version};
|