sveld 0.38.7 → 0.38.9
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/README.md +21 -21
- package/browser.js +126 -126
- package/{chunk-nfwzp0b2.js → chunk-hkvtnaw2.js} +111 -111
- package/{chunk-qqhje1j7.js → chunk-tm3wwspf.js} +1 -1
- package/{chunk-gg5d8z19.js → chunk-xmk8z1r7.js} +30 -30
- package/chunk-xzarv1ey.js +1 -0
- package/cli-entry.js +2 -2
- package/index.js +1 -1
- package/package.json +1 -1
- package/chunk-60yq13dk.js +0 -1
|
@@ -1,86 +1,86 @@
|
|
|
1
|
-
var
|
|
2
|
-
`,
|
|
1
|
+
var T=Symbol("sveld.parsedComponentTypeScriptMetadata"),I=Symbol("sveld.parsedComponentPropIgnores");function fo(K){return K[I]}function mo(K){return K[T]}var Fs=Array(2048).fill(void 0);function Tc(){Fs.fill(void 0)}function go(K,ee,Oe,Ot){let Ft=Ot&2047,jt=Fs[Ft];if(jt!==void 0&&jt.length===Oe-ee&&K.startsWith(jt,ee))return jt;let Gt=K.slice(ee,Oe);return Fs[Ft]=Gt,Gt}var oi="",Dn=[0],Vn=0,ri=0,jn;function te(K){Tc(),oi=K,Dn=[0],Vn=0,ri=0,jn=void 0}function Bs(K){while(Vn<=K){let ee=oi.indexOf(`
|
|
2
|
+
`,Vn);if(ee===-1){Vn=Number.POSITIVE_INFINITY;return}Vn=ee+1,Dn.push(Vn)}}function yo(K){let ee=[0],Oe=K.indexOf(`
|
|
3
3
|
`);while(Oe!==-1)ee.push(Oe+1),Oe=K.indexOf(`
|
|
4
|
-
`,Oe+1);return ee}function Mi(K,ee,Oe){let Ot=0,Ft=K.length-1;if(ee>=K[Oe])Ot=Oe;else Ft=Oe-1;if(Ot<Ft&&ee<K[Ot+1])Ft=Ot;while(Ot<Ft){let jt=Ot+Ft+1>>>1;if(K[jt]<=ee)Ot=jt;else Ft=jt-1}return Ot}function g(K){return Oi(K),ss=Mi(An,K,ss),{line:ss+1,column:K-An[ss],character:K}}var Ii=/\r\n?|\n|\u2028|\u2029/g,bc=/[\r\u2028\u2029]/;function fo(K){if(jn===void 0){jn=bc.test(is)?[]:null,Ii.lastIndex=0;while(jn!==null&&Ii.exec(is)!==null)jn.push(Ii.lastIndex)}if(jn===null)return Oi(K),Mi(An,K,ss);let ee=0,Oe=jn.length;while(ee<Oe){let Ot=ee+Oe>>>1;if(jn[Ot]<=K)ee=Ot+1;else Oe=Ot}return ee}function P(K){let{line:ee,column:Oe}=g(K);return{line:ee,column:Oe}}function mo(K){while(An.length<=K+1&&Bn!==Number.POSITIVE_INFINITY)Oi(Bn);if(K>=An.length)return;let ee=K+1<An.length?An[K+1]-1:is.length;return is.slice(An[K],ee)}function Te(K){let ee,Oe=0;return(Ot)=>(ee??=Sc(K),Oe=Mi(ee,Ot,Oe),{line:Oe+1,column:Ot-ee[Oe]})}function Ln(K){return typeof K==="object"&&K!==null&&typeof zn(K).type==="string"}function zn(K){return K}function U(K,ee){let Oe=zn(K);for(let Ot in Oe){let Ft=Oe[Ot];if(Array.isArray(Ft)){for(let jt=0;jt<Ft.length;jt++)if(Ln(Ft[jt]))Ft[jt]=ee(Ft[jt])}else if(Ln(Ft))Oe[Ot]=ee(Ft)}}function ne(K,...ee){if(!ee.some((Oe)=>Oe===K.type))throw Error(`expected ${ee.join(" or ")}, got ${K.type}`)}function Ee(K){let ee=[];return Xn(K,ee),ee}function Xn(K,ee){switch(K.type){case"Identifier":ee.push(K);return;case"ObjectPattern":for(let Oe of K.properties)Xn(Oe.type==="RestElement"?Oe.argument:Oe.value,ee);return;case"ArrayPattern":for(let Oe of K.elements)if(Oe!==null)Xn(Oe,ee);return;case"RestElement":Xn(K.argument,ee);return;case"AssignmentPattern":Xn(K.left,ee);return;case"TSParameterProperty":Xn(K.parameter,ee);return;case"TSAsExpression":case"TSNonNullExpression":case"TSSatisfiesExpression":case"TSTypeAssertion":Xn(K.expression,ee)}}function G(K,ee){if(K.type!=="Identifier")return!1;if(ee===null)return!0;switch(ee.type){case"MemberExpression":return ee.computed||K===ee.object;case"MethodDefinition":return ee.computed;case"Property":case"PropertyDefinition":return ee.computed||K===ee.value;case"ExportSpecifier":case"ImportSpecifier":return K===ee.local;case"MetaProperty":case"ImportAttribute":case"ExportAllDeclaration":case"LabeledStatement":case"BreakStatement":case"ContinueStatement":return!1;case"TSAsExpression":case"TSSatisfiesExpression":case"TSTypeAssertion":case"TSNonNullExpression":case"TSInstantiationExpression":case"TSExportAssignment":return K===ee.expression;case"TSEnumMember":return K===ee.initializer;case"TSParameterProperty":case"TSEnumDeclaration":case"TSImportEqualsDeclaration":return!0;default:return!ee.type.startsWith("TS")}}var rs={Root:["module","instance","fragment","css"],Script:["attributes","content"],Fragment:["nodes"],Text:[],Comment:[],ExpressionTag:["expression"],HtmlTag:["expression"],ConstTag:["declaration"],DeclarationTag:["declaration"],DebugTag:["identifiers"],RenderTag:["expression"],AttachTag:["expression"],Attribute:["value"],SpreadAttribute:["expression"],AnimateDirective:["expression"],BindDirective:["expression"],ClassDirective:["expression"],LetDirective:["expression"],OnDirective:["expression"],StyleDirective:["value"],TransitionDirective:["expression"],UseDirective:["expression"],Component:["attributes","fragment"],TitleElement:["attributes","fragment"],SlotElement:["attributes","fragment"],RegularElement:["attributes","fragment"],SvelteBody:["attributes","fragment"],SvelteBoundary:["attributes","fragment"],SvelteComponent:["expression","attributes","fragment"],SvelteDocument:["attributes","fragment"],SvelteElement:["tag","attributes","fragment"],SvelteFragment:["attributes","fragment"],SvelteHead:["attributes","fragment"],SvelteOptions:["attributes","fragment"],SvelteSelf:["attributes","fragment"],SvelteWindow:["attributes","fragment"],IfBlock:["test","consequent","alternate"],EachBlock:["expression","context","key","body","fallback"],AwaitBlock:["expression","pending","value","then","error","catch"],KeyBlock:["expression","fragment"],SnippetBlock:["expression","parameters","body"],StyleSheet:["attributes","children"],Rule:["prelude","block"],Atrule:["block"],SelectorList:["children"],ComplexSelector:["children"],RelativeSelector:["combinator","selectors"],Combinator:[],TypeSelector:[],IdSelector:[],ClassSelector:[],AttributeSelector:[],PseudoElementSelector:["args"],PseudoClassSelector:["args"],Percentage:[],Nth:[],NestingSelector:[],Block:["children"],Declaration:[],Program:["body"],ExpressionStatement:["expression"],BlockStatement:["body"],StaticBlock:["body"],EmptyStatement:[],DebuggerStatement:[],WithStatement:["object","body"],ReturnStatement:["argument"],LabeledStatement:["label","body"],BreakStatement:["label"],ContinueStatement:["label"],IfStatement:["test","consequent","alternate"],SwitchStatement:["discriminant","cases"],SwitchCase:["test","consequent"],ThrowStatement:["argument"],TryStatement:["block","handler","finalizer"],CatchClause:["param","body"],WhileStatement:["test","body"],DoWhileStatement:["body","test"],ForStatement:["init","test","update","body"],ForInStatement:["left","right","body"],ForOfStatement:["left","right","body"],FunctionDeclaration:["id","typeParameters","params","returnType","body"],FunctionExpression:["id","typeParameters","params","returnType","body"],ArrowFunctionExpression:["typeParameters","params","returnType","body"],VariableDeclaration:["declarations"],VariableDeclarator:["id","init"],ClassDeclaration:["decorators","id","typeParameters","superClass","superTypeParameters","implements","body"],ClassExpression:["decorators","id","typeParameters","superClass","superTypeParameters","implements","body"],ClassBody:["body"],MethodDefinition:["decorators","key","typeParameters","value"],PropertyDefinition:["decorators","key","typeAnnotation","value"],Property:["decorators","key","value"],ThisExpression:[],Super:[],Literal:[],Identifier:["decorators","typeAnnotation"],PrivateIdentifier:[],ArrayExpression:["elements"],ObjectExpression:["properties"],UnaryExpression:["argument"],UpdateExpression:["argument"],BinaryExpression:["left","right"],LogicalExpression:["left","right"],AssignmentExpression:["left","right"],MemberExpression:["object","property"],ConditionalExpression:["test","consequent","alternate"],CallExpression:["callee","typeArguments","arguments"],NewExpression:["callee","typeArguments","arguments"],SequenceExpression:["expressions"],TemplateLiteral:["quasis","expressions"],TaggedTemplateExpression:["tag","typeArguments","quasi"],TemplateElement:[],SpreadElement:["argument"],RestElement:["decorators","argument","typeAnnotation"],YieldExpression:["argument"],AwaitExpression:["argument"],ImportExpression:["source","options","arguments"],ChainExpression:["expression"],MetaProperty:["meta","property"],ObjectPattern:["decorators","properties","typeAnnotation"],ArrayPattern:["decorators","elements","typeAnnotation"],AssignmentPattern:["decorators","left","right"],ImportDeclaration:["specifiers","source","attributes"],ImportSpecifier:["imported","local"],ImportDefaultSpecifier:["local"],ImportNamespaceSpecifier:["local"],ImportAttribute:["key","value"],ExportNamedDeclaration:["declaration","specifiers","source","attributes"],ExportSpecifier:["local","exported"],ExportDefaultDeclaration:["declaration"],ExportAllDeclaration:["exported","source","attributes"],Decorator:["expression"],TSTypeAnnotation:["typeAnnotation"],TSTypeParameterDeclaration:["params"],TSTypeParameterInstantiation:["params"],TSTypeParameter:["constraint","default"],TSAnyKeyword:[],TSBigIntKeyword:[],TSBooleanKeyword:[],TSNeverKeyword:[],TSNullKeyword:[],TSNumberKeyword:[],TSObjectKeyword:[],TSStringKeyword:[],TSSymbolKeyword:[],TSUndefinedKeyword:[],TSUnknownKeyword:[],TSVoidKeyword:[],TSThisType:[],TSArrayType:["elementType"],TSTupleType:["elementTypes"],TSNamedTupleMember:["label","elementType"],TSOptionalType:["typeAnnotation"],TSRestType:["typeAnnotation"],TSUnionType:["types"],TSIntersectionType:["types"],TSConditionalType:["checkType","extendsType","trueType","falseType"],TSInferType:["typeParameter"],TSParenthesizedType:["typeAnnotation"],TSTypeOperator:["typeAnnotation"],TSIndexedAccessType:["objectType","indexType"],TSMappedType:["typeParameter","nameType","typeAnnotation"],TSLiteralType:["literal"],TSTypeReference:["typeName","typeArguments"],TSQualifiedName:["left","right"],TSTypeQuery:["exprName","typeArguments"],TSImportType:["argument","qualifier","typeArguments"],TSTypeLiteral:["members"],TSPropertySignature:["key","typeAnnotation"],TSMethodSignature:["key","typeParameters","parameters","typeAnnotation"],TSCallSignatureDeclaration:["typeParameters","parameters","typeAnnotation"],TSConstructSignatureDeclaration:["typeParameters","parameters","typeAnnotation"],TSFunctionType:["typeParameters","parameters","typeAnnotation"],TSConstructorType:["typeParameters","parameters","typeAnnotation"],TSIndexSignature:["decorators","parameters","typeAnnotation"],TSTypePredicate:["parameterName","typeAnnotation"],TSInterfaceDeclaration:["id","typeParameters","extends","body"],TSInterfaceBody:["body"],TSExpressionWithTypeArguments:["expression","typeParameters"],TSTypeAliasDeclaration:["id","typeParameters","typeAnnotation"],TSEnumDeclaration:["id","members"],TSEnumMember:["id","initializer"],TSModuleDeclaration:["id","body"],TSModuleBlock:["body"],TSImportEqualsDeclaration:["id","moduleReference"],TSExternalModuleReference:["expression"],TSExportAssignment:["expression"],TSNamespaceExportDeclaration:["id"],TSDeclareFunction:["id","typeParameters","params","returnType"],TSDeclareMethod:["typeParameters","params","returnType"],TSParameterProperty:["parameter"],TSAsExpression:["expression","typeAnnotation"],TSSatisfiesExpression:["expression","typeAnnotation"],TSTypeAssertion:["typeAnnotation","expression"],TSNonNullExpression:["expression"],TSInstantiationExpression:["expression","typeArguments"]};var Cc=Object.assign(Object.create(null),rs),wc=[],T=Symbol("sveast.walk.stop"),p=Symbol("sveast.walk.skip");function o(K,ee,Oe){Ws(K,null,null,null,ee,Oe===void 0||Oe===rs?kc:(Ot)=>Object.hasOwn(Oe,Ot.type)?Oe[Ot.type]:void 0)}function Ws(K,ee,Oe,Ot,Ft,jt){let Gt=jt(K);if(Gt===void 0)throw Error(`unknown node type: ${K.type}`);let Mt=Ft.enter?.(K,ee,Oe,Ot);if(Mt===T)return!0;if(Mt!==p){if(Mt!==K&&Ln(Mt))return Tc(Mt,ee,Oe,Ot,Ft,jt);let Vt=zn(K);for(let Wt=0;Wt<Gt.length;Wt++){let Kt=Gt[Wt],Ht=Vt[Kt];if(Array.isArray(Ht))for(let qt=0;qt<Ht.length;qt++){let zt=Ht[qt];if(Ln(zt)&&Ws(zt,K,Kt,qt,Ft,jt))return!0}else if(Ln(Ht)&&Ws(Ht,K,Kt,null,Ft,jt))return!0}}return Ft.leave?.(K,ee,Oe,Ot)===T}function kc(K){let ee=K.type;if(ee==="Identifier")return K.typeAnnotation===void 0&&K.decorators===void 0?wc:rs.Identifier;if(ee==="Literal")return rs.Literal;if(ee==="Text")return rs.Text;return Cc[ee]}function Tc(K,ee,Oe,Ot,Ft,jt){if(ee===null||Oe===null)throw Error("walk can't replace the node it was called with");let Gt=zn(ee),Mt=Gt[Oe];if(Ot===null)Gt[Oe]=K;else if(Array.isArray(Mt))Mt[Ot]=K;return Ws(K,ee,Oe,Ot,Ft,jt)}function r(K){return typeof K==="object"&&K!==null}function S(K){return r(K)&&K.type==="Literal"}function t(K){return r(K)&&K.type==="Identifier"&&typeof K.name==="string"}function k(K){return r(K)&&K.type==="MemberExpression"}function u(K){return r(K)&&K.type==="ObjectExpression"&&Array.isArray(K.properties)}function Pc(K){return r(K)&&K.type==="CallExpression"}function d(K,ee){return Pc(K)&&t(K.callee)&&K.callee.name===ee}function b(K){return K?.type==="TSAsExpression"||K?.type==="TSSatisfiesExpression"?b(K.expression):K}function Me(K){return K?.type==="TSAsExpression"||K?.type==="TSSatisfiesExpression"?K.typeAnnotation:void 0}function $c(K){return r(K)&&K.type==="NewExpression"}function Se(K,ee){return $c(K)&&t(K.callee)&&K.callee.name===ee}function w(K){if(!r(K))return null;if(K.type==="Literal")return K.value==null?null:String(K.value);if(K.type==="TemplateLiteral"){let ee=K.quasis;if(ee?.length===1)return ee[0]?.value?.cooked??null}return null}function c(K){if(t(K))return K.name;if(S(K))return K.value==null?void 0:String(K.value);return}var Ac=new Set(["Component","SvelteComponent","SvelteSelf"]),Nc=new Set(["RegularElement","SvelteElement"]);function L(K){return Ac.has(K)}function A(K){return Nc.has(K)}function Us(K,ee,Oe=0,Ot=K.length,Ft=0){let jt=Ft;for(let Gt=Oe;Gt<Ot;Gt++){let Mt=K.charCodeAt(Gt);if(Mt===34||Mt===39||Mt===96){Gt=Dc(K,Gt,Ot);continue}if(Mt===123||Mt===40||Mt===91||Mt===60)jt++;else if(Mt===125||Mt===41||Mt===93||Mt===62&&K.charCodeAt(Gt-1)!==61){if(jt>0)jt--}if(ee?.(Gt,jt)===!0)break}return jt}function Dc(K,ee,Oe){let Ot=K.charCodeAt(ee);for(let Ft=ee+1;Ft<Oe;Ft++){let jt=K.charCodeAt(Ft);if(jt===92)Ft++;else if(jt===Ot)return Ft}return Oe-1}function i(K,ee){let Oe=[],Ot=0;return Us(K,(Ft,jt)=>{if(jt===0&&ee.includes(K[Ft]))Oe.push(K.slice(Ot,Ft)),Ot=Ft+1;return!1}),Oe.push(K.slice(Ot)),Oe}function Fi(K,ee,Oe=0){let Ot=-1;return Us(K,(Ft,jt)=>{if(ee(Ft,jt))Ot=Ft;return Ot!==-1},Oe),Ot}function W(K,ee){return Fi(K,(Oe,Ot)=>Ot===0&&ee.includes(K[Oe]))}function v(K){return Fi(K,(ee,Oe)=>Oe===0&&K[ee]==="="&&K[ee+1]===">")}function C(K,ee){return Fi(K,(Oe,Ot)=>Ot===0,ee)}function ji(K){let ee=K.trim();return ee.startsWith("[")&&C(ee,0)===ee.length-1}function re(K){if(!K)return;let ee=v(K);if(ee===-1)return;return K.slice(ee+2).trim()||void 0}var _c=new Set(["null","undefined"]);function ie(K){if(!K)return!1;let ee=i(K,"|").map((Ot)=>Ot.trim()).filter((Ot)=>Ot&&!_c.has(Ot));if(ee.length!==1)return!1;let[Oe]=ee;while(Oe.startsWith("(")&&C(Oe,0)===Oe.length-1)Oe=Oe.slice(1,-1).trim();return(Oe.startsWith("(")||Oe.startsWith("<"))&&v(Oe)!==-1}function Rc(K){let ee="";for(let Oe=0;Oe<K.length;Oe++){let Ot=K[Oe];if(Ot==="*"&&K[Oe+1]==="*"){if(Oe++,K[Oe+1]==="/")ee+="(?:.*/)?",Oe++;else ee+=".*";continue}if(Ot==="*"){ee+="[^/]*";continue}if(Ot==="?"){ee+="[^/]";continue}ee+=".+^$()[]{}|\\".includes(Ot)?`\\${Ot}`:Ot}return ee}function go(K,ee){return new RegExp(`^${Rc(K)}$`).test(ee)}var Bi={"prop-unknown-type":{severity:"warning",label:"Props without inferred types"},"context-any-type":{severity:"warning",label:"Context values typed as `any`"},"slot-missing-type":{severity:"warning",label:"@slot/@snippet tags missing a {Type} annotation"},"slot-not-rendered":{severity:"warning",label:"@slot/@snippet tags for slots the component doesn't render"},"event-no-source":{severity:"warning",label:"@event tags with no dispatch or callback"},"dispatch-escapes":{severity:"warning",label:"Dispatchers passed to functions sveld can't follow"},"example-compile-error":{severity:"error",label:"@example blocks that failed to compile"},"example-syntax-error":{severity:"error",label:"@example blocks that failed to parse"},"syntax-skipped":{severity:"error",label:"Component syntax sveld skipped"},"type-syntax-error":{severity:"error",label:"JSDoc types that aren't valid TypeScript"},"rest-props-unresolved":{severity:"warning",label:"$$restProps spread only onto components"},"context-duplicate-key":{severity:"warning",label:"Duplicate setContext keys"},"context-key-unresolved":{severity:"warning",label:"setContext keys sveld couldn't resolve"},"context-value-unresolved":{severity:"warning",label:"setContext values sveld couldn't describe"},"spread-unresolved":{severity:"warning",label:"Unresolved spreads widened to Record<string, any>"},"export-unresolved":{severity:"warning",label:"Unresolved named export specifiers"},"module-export-conflict":{severity:"warning",label:"Module-script exports colliding with generated names"},"extend-props-target-missing":{severity:"error",label:"@extends/@extendProps targets that couldn't be verified"},"extend-props-duplicate":{severity:"warning",label:"Duplicate @extends/@extendProps tags"},"extend-props-override":{severity:"warning",label:"Own props overriding an @extends target's prop"},"jsdoc-unknown-tag":{severity:"warning",label:"Unknown JSDoc tags"},"typedef-duplicate":{severity:"warning",label:"Duplicate @typedef/@callback names"},"property-duplicate":{severity:"warning",label:"Duplicate @property names"},"generics-conflict":{severity:"warning",label:"Duplicate @generics/@template names"},"event-description-ambiguous":{severity:"warning",label:"Text after an @event read as the next tag's description"},"jsdoc-tag-dropped":{severity:"warning",label:"Passthrough JSDoc tags that couldn't attach"},"internal-typedef-referenced":{severity:"error",label:"Public types referencing an @internal typedef"},"cross-file-unresolved":{severity:"warning",label:"Imports a standalone parse couldn't read"},"export-ambiguous":{severity:"warning",label:"Ambiguous `export *` names left out of the entry exports"}};function a(K){return{...K,code:H[K.kind],severity:Bi[K.kind].severity}}function yo(K,ee){if(ee)return K;return K.filter((Oe)=>Oe.kind!=="jsdoc-unknown-tag")}function xo(K,ee){if(!ee)return[];return K.filter((Oe)=>!Oe.ignored&&(ee!=="errors"||Oe.severity==="error"))}function Ic(K,ee){if(ee.code!==void 0&&ee.code!==K.code)return!1;if(ee.name!==void 0&&ee.name!==K.name)return!1;if(ee.component!==void 0&&!go(ee.component,K.component))return!1;return!0}function vo(K,ee){if(!ee||ee.length===0)return K;return K.map((Oe)=>Oe.ignored||ee.some((Ot)=>Ic(Oe,Ot))?{...Oe,ignored:!0}:Oe)}var Eo=Object.keys(Bi),H=Object.fromEntries(Eo.map((K)=>[K,`sveld/${K}`]));function So(K){let ee=new Set,Oe=[];for(let Ot of K){let Ft=`${Ot.component}:${Ot.kind}:${Ot.name}`;if(ee.has(Ft))continue;ee.add(Ft),Oe.push(Ot)}return Oe}function bo(K){let ee=K.filter((Vt)=>!Vt.ignored),Oe=K.length-ee.length,Ot=Oe>0?` (${Oe} ignored)`:"";if(ee.length===0)return`sveld: no diagnostics${Ot}.`;let Ft=[],jt=(Vt,Wt)=>`${Vt} ${Wt}${Vt===1?"":"s"}`,Gt=ee.filter((Vt)=>Vt.severity==="error").length,Mt=`${jt(Gt,"error")}, ${jt(ee.length-Gt,"warning")}`;Ft.push(`sveld: ${jt(ee.length,"diagnostic")} (${Mt})${Ot}.`);for(let Vt of Eo){let Wt=ee.filter((Ht)=>Ht.kind===Vt);if(Wt.length===0)continue;Ft.push(""),Ft.push(`${Bi[Vt].label} (${Wt.length}):`);let Kt=new Map;for(let Ht of Wt){let qt=Kt.get(Ht.component)??[];qt.push(Ht),Kt.set(Ht.component,qt)}for(let[Ht,qt]of Kt){Ft.push(` ${Ht}`);for(let zt of qt){let Xt=zt.source?` (${Ht}:${zt.source.start.line}:${zt.source.start.column})`:"";Ft.push(` - ${zt.message}${Xt} [${zt.code}]`)}}}return Ft.join(`
|
|
5
|
-
`)}var $e=1;function
|
|
6
|
-
`}function
|
|
7
|
-
Defaulting to 2020, but this will stop working in the future.`);ee.ecmaVersion=11}else if(ee.ecmaVersion>=2015)ee.ecmaVersion-=2009;if(ee.allowReserved==null)ee.allowReserved=ee.ecmaVersion<5;if(!K||K.allowHashBang==null)ee.allowHashBang=ee.ecmaVersion>=14;if(
|
|
8
|
-
`,Oe-1)+1,this.options.locations)this.curLine=this.input.slice(0,this.lineStart).split(xn).length}else this.lineStart=0;if(this.type=Ut.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=K.sourceType==="module",this.strict=this.inModule||K.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&&K.allowHashBang&&this.input.slice(0,2)==="#!")this.skipLineComment(2);this.scopeStack=[],this.enterScope(this.options.sourceType==="commonjs"?Yn:Jn),this.regexpState=null,this.privateNameStack=[]},Cn={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}};s.prototype.parse=function(){var K=this,ee=this.options.program||this.startNode();return this.nextToken(),this.catchStackOverflow(function(){return K.parseTopLevel(ee)})};Cn.inFunction.get=function(){return(this.currentVarScope().flags&Yn)>0};Cn.inGenerator.get=function(){return(this.currentVarScope().flags&_o)>0};Cn.inAsync.get=function(){return(this.currentVarScope().flags&qi)>0};Cn.canAwait.get=function(){for(var K=this.scopeStack.length-1;K>=0;K--){var ee=this.scopeStack[K],Oe=ee.flags;if(Oe&(Qn|vs))return!1;if(Oe&Yn)return(Oe&qi)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction};Cn.allowReturn.get=function(){if(this.inFunction)return!0;if(this.options.allowReturnOutsideFunction&&this.currentVarScope().flags&Jn)return!0;return!1};Cn.allowSuper.get=function(){var K=this.currentThisScope(),ee=K.flags;return(ee&Ys)>0||this.options.allowSuperOutsideMethod};Cn.allowDirectSuper.get=function(){return(this.currentThisScope().flags&Io)>0};Cn.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())};Cn.allowNewDotTarget.get=function(){for(var K=this.scopeStack.length-1;K>=0;K--){var ee=this.scopeStack[K],Oe=ee.flags;if(Oe&(Qn|vs)||Oe&Yn&&!(Oe&zi))return!0}return!1};Cn.allowUsing.get=function(){var K=this.currentScope(),ee=K.flags;if(ee&Lo)return!1;if(!this.inModule&&ee&Jn)return!1;return!0};Cn.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&Qn)>0};s.extend=function(){var K=[],ee=arguments.length;while(ee--)K[ee]=arguments[ee];var Oe=this;for(var Ot=0;Ot<K.length;Ot++)Oe=K[Ot](Oe);return Oe};s.parse=function(K,ee){return new this(ee,K).parse()};s.parseExpressionAt=function(K,ee,Oe){var Ot=new this(Oe,K,ee);return Ot.nextToken(),Ot.parseExpression()};s.tokenizer=function(K,ee){return new this(ee,K)};Object.defineProperties(s.prototype,Cn);var fn=s.prototype,Jc=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;fn.strictDirective=function(K){if(this.options.ecmaVersion<5)return!1;for(;;){un.lastIndex=K,K+=un.exec(this.input)[0].length;var ee=Jc.exec(this.input.slice(K));if(!ee)return!1;if((ee[1]||ee[2])==="use strict"){un.lastIndex=K+ee[0].length;var Oe=un.exec(this.input),Ot=Oe.index+Oe[0].length,Ft=this.input.charAt(Ot);return Ft===";"||Ft==="}"||xn.test(Oe[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(Ft)||Ft==="!"&&this.input.charAt(Ot+1)==="=")}if(K+=ee[0].length,un.lastIndex=K,K+=un.exec(this.input)[0].length,this.input[K]===";")K++}};fn.eat=function(K){if(this.type===K)return this.next(),!0;else return!1};fn.isContextual=function(K){return this.type===Ut.name&&this.value===K&&!this.containsEsc};fn.eatContextual=function(K){if(!this.isContextual(K))return!1;return this.next(),!0};fn.catchStackOverflow=function(K){try{return K()}catch(ee){if(ee instanceof Error&&(/\bstack\b.*\b(exceeded|overflow)\b/i.test(ee.message)||/\btoo much recursion\b/i.test(ee.message)))this.raise(this.start,"Not enough stack space to parse input");else throw ee}};fn.expectContextual=function(K){if(!this.eatContextual(K))this.unexpected()};fn.canInsertSemicolon=function(){return this.type===Ut.eof||this.type===Ut.braceR||xn.test(this.input.slice(this.lastTokEnd,this.start))};fn.insertSemicolon=function(){if(this.canInsertSemicolon()){if(this.options.onInsertedSemicolon)this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc);return!0}};fn.semicolon=function(){if(!this.eat(Ut.semi)&&!this.insertSemicolon())this.unexpected()};fn.afterTrailingComma=function(K,ee){if(this.type===K){if(this.options.onTrailingComma)this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc);if(!ee)this.next();return!0}};fn.expect=function(K){this.eat(K)||this.unexpected()};fn.unexpected=function(K){this.raise(K!=null?K:this.start,"Unexpected token")};var Zs=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};fn.checkPatternErrors=function(K,ee){if(!K)return;if(K.trailingComma>-1)this.raiseRecoverable(K.trailingComma,"Comma is not permitted after the rest element");var Oe=ee?K.parenthesizedAssign:K.parenthesizedBind;if(Oe>-1)this.raiseRecoverable(Oe,ee?"Assigning to rvalue":"Parenthesized pattern")};fn.checkExpressionErrors=function(K,ee){if(!K)return!1;var{shorthandAssign:Oe,doubleProto:Ot}=K;if(!ee)return Oe>=0||Ot>=0;if(Oe>=0)this.raise(Oe,"Shorthand property assignments are valid only in destructuring patterns");if(Ot>=0)this.raiseRecoverable(Ot,"Redefinition of __proto__ property")};fn.checkYieldAwaitInDefaultParams=function(){if(this.yieldPos&&(!this.awaitPos||this.yieldPos<this.awaitPos))this.raise(this.yieldPos,"Yield expression cannot be a default value");if(this.awaitPos)this.raise(this.awaitPos,"Await expression cannot be a default value")};fn.isSimpleAssignTarget=function(K){if(K.type==="ParenthesizedExpression")return this.isSimpleAssignTarget(K.expression);return K.type==="Identifier"||K.type==="MemberExpression"};var Yt=s.prototype;Yt.parseTopLevel=function(K){var ee=Object.create(null);if(!K.body)K.body=[];while(this.type!==Ut.eof){var Oe=this.parseStatement(null,!0,ee);K.body.push(Oe)}if(this.inModule)for(var Ot=0,Ft=Object.keys(this.undefinedExports);Ot<Ft.length;Ot+=1){var jt=Ft[Ot];this.raiseRecoverable(this.undefinedExports[jt].start,"Export '"+jt+"' is not defined")}return this.adaptDirectivePrologue(K.body),this.next(),K.sourceType=this.options.sourceType==="commonjs"?"script":this.options.sourceType,this.finishNode(K,"Program")};var Yi={kind:"loop"},Yc={kind:"switch"};Yt.isLet=function(K){if(this.options.ecmaVersion<6||!this.isContextual("let"))return!1;un.lastIndex=this.pos;var ee=un.exec(this.input),Oe=this.pos+ee[0].length,Ot=this.fullCharCodeAt(Oe);if(Ot===91||Ot===92)return!0;if(K)return!1;if(Ot===123)return!0;if(m(Ot)){var Ft=Oe;do Oe+=Ot<=65535?1:2;while(E(Ot=this.fullCharCodeAt(Oe)));if(Ot===92)return!0;var jt=this.input.slice(Ft,Oe);if(!$o.test(jt))return!0}return!1};Yt.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;un.lastIndex=this.pos;var K=un.exec(this.input),ee=this.pos+K[0].length,Oe;return!xn.test(this.input.slice(this.pos,ee))&&this.input.slice(ee,ee+8)==="function"&&(ee+8===this.input.length||!(E(Oe=this.fullCharCodeAt(ee+8))||Oe===92))};Yt.isUsingKeyword=function(K,ee){if(this.options.ecmaVersion<17||!this.isContextual(K?"await":"using"))return!1;un.lastIndex=this.pos;var Oe=un.exec(this.input),Ot=this.pos+Oe[0].length;if(xn.test(this.input.slice(this.pos,Ot)))return!1;if(K){var Ft=Ot+5,jt;if(this.input.slice(Ot,Ft)!=="using"||Ft===this.input.length||E(jt=this.fullCharCodeAt(Ft))||jt===92)return!1;un.lastIndex=Ft;var Gt=un.exec(this.input);if(Ot=Ft+Gt[0].length,Gt&&xn.test(this.input.slice(Ft,Ot)))return!1}var Mt=this.fullCharCodeAt(Ot);if(!m(Mt)&&Mt!==92)return!1;var Vt=Ot;do Ot+=Mt<=65535?1:2;while(E(Mt=this.fullCharCodeAt(Ot)));if(Mt===92)return!0;var Wt=this.input.slice(Vt,Ot);if($o.test(Wt))return!1;if(ee&&!K&&Wt==="of"){un.lastIndex=Ot;var Kt=un.exec(this.input);if(Ot=Ot+Kt[0].length,this.input.charCodeAt(Ot)!==61||(Mt=this.input.charCodeAt(Ot+1))===61||Mt===62)return!1}return!0};Yt.isAwaitUsing=function(K){return this.isUsingKeyword(!0,K)};Yt.isUsing=function(K){return this.isUsingKeyword(!1,K)};Yt.parseStatement=function(K,ee,Oe){var Ot=this.type,Ft=this.startNode(),jt;if(this.isLet(K))Ot=Ut._var,jt="let";switch(Ot){case Ut._break:case Ut._continue:return this.parseBreakContinueStatement(Ft,Ot.keyword);case Ut._debugger:return this.parseDebuggerStatement(Ft);case Ut._do:return this.parseDoStatement(Ft);case Ut._for:return this.parseForStatement(Ft);case Ut._function:if(K&&(this.strict||K!=="if"&&K!=="label")&&this.options.ecmaVersion>=6)this.unexpected();return this.parseFunctionStatement(Ft,!1,!K);case Ut._class:if(K)this.unexpected();return this.parseClass(Ft,!0);case Ut._if:return this.parseIfStatement(Ft);case Ut._return:return this.parseReturnStatement(Ft);case Ut._switch:return this.parseSwitchStatement(Ft);case Ut._throw:return this.parseThrowStatement(Ft);case Ut._try:return this.parseTryStatement(Ft);case Ut._const:case Ut._var:if(jt=jt||this.value,K&&jt!=="var")this.unexpected();return this.parseVarStatement(Ft,jt);case Ut._while:return this.parseWhileStatement(Ft);case Ut._with:return this.parseWithStatement(Ft);case Ut.braceL:return this.parseBlock(!0,Ft);case Ut.semi:return this.parseEmptyStatement(Ft);case Ut._export:case Ut._import:if(this.options.ecmaVersion>10&&Ot===Ut._import){un.lastIndex=this.pos;var Gt=un.exec(this.input),Mt=this.pos+Gt[0].length,Vt=this.input.charCodeAt(Mt);if(Vt===40||Vt===46)return this.parseExpressionStatement(Ft,this.parseExpression())}if(!this.options.allowImportExportEverywhere){if(!ee)this.raise(this.start,"'import' and 'export' may only appear at the top level");if(!this.inModule)this.raise(this.start,"'import' and 'export' may appear only with 'sourceType: module'")}return Ot===Ut._import?this.parseImport(Ft):this.parseExport(Ft,Oe);default:if(this.isAsyncFunction()){if(K)this.unexpected();return this.next(),this.parseFunctionStatement(Ft,!0,!K)}var Wt=this.isAwaitUsing(!1)?"await using":this.isUsing(!1)?"using":null;if(Wt){if(!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");if(K)this.raise(this.start,"Using declaration is not allowed in single-statement positions");if(Wt==="await using"){if(!this.canAwait)this.raise(this.start,"Await using cannot appear outside of async function");this.next()}return this.next(),this.parseVar(Ft,!1,Wt),this.semicolon(),this.finishNode(Ft,"VariableDeclaration")}var Kt=this.value,Ht=this.parseExpression();if(Ot===Ut.name&&Ht.type==="Identifier"&&this.eat(Ut.colon))return this.parseLabeledStatement(Ft,Kt,Ht,K);else return this.parseExpressionStatement(Ft,Ht)}};Yt.parseBreakContinueStatement=function(K,ee){var Oe=ee==="break";if(this.next(),this.eat(Ut.semi)||this.insertSemicolon())K.label=null;else if(this.type!==Ut.name)this.unexpected();else K.label=this.parseIdent(),this.semicolon();var Ot=0;for(;Ot<this.labels.length;++Ot){var Ft=this.labels[Ot];if(K.label==null||Ft.name===K.label.name){if(Ft.kind!=null&&(Oe||Ft.kind==="loop"))break;if(K.label&&Oe)break}}if(Ot===this.labels.length)this.raise(K.start,"Unsyntactic "+ee);return this.finishNode(K,Oe?"BreakStatement":"ContinueStatement")};Yt.parseDebuggerStatement=function(K){return this.next(),this.semicolon(),this.finishNode(K,"DebuggerStatement")};Yt.parseDoStatement=function(K){if(this.next(),this.labels.push(Yi),K.body=this.parseStatement("do"),this.labels.pop(),this.expect(Ut._while),K.test=this.parseParenExpression(),this.options.ecmaVersion>=6)this.eat(Ut.semi);else this.semicolon();return this.finishNode(K,"DoWhileStatement")};Yt.parseForStatement=function(K){this.next();var ee=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(Yi),this.enterScope(0),this.expect(Ut.parenL),this.type===Ut.semi){if(ee>-1)this.unexpected(ee);return this.parseFor(K,null)}var Oe=this.isLet();if(this.type===Ut._var||this.type===Ut._const||Oe){var Ot=this.startNode(),Ft=Oe?"let":this.value;return this.next(),this.parseVar(Ot,!0,Ft),this.finishNode(Ot,"VariableDeclaration"),this.parseForAfterInit(K,Ot,ee)}var jt=this.isContextual("let"),Gt=!1,Mt=this.isUsing(!0)?"using":this.isAwaitUsing(!0)?"await using":null;if(Mt){var Vt=this.startNode();if(this.next(),Mt==="await using"){if(!this.canAwait)this.raise(this.start,"Await using cannot appear outside of async function");this.next()}return this.parseVar(Vt,!0,Mt),this.finishNode(Vt,"VariableDeclaration"),this.parseForAfterInit(K,Vt,ee)}var Wt=this.containsEsc,Kt=new Zs,Ht=this.start,qt=ee>-1?this.parseExprSubscripts(Kt,"await"):this.parseExpression(!0,Kt);if(this.type===Ut._in||(Gt=this.options.ecmaVersion>=6&&this.isContextual("of"))){if(ee>-1){if(this.type===Ut._in)this.unexpected(ee);K.await=!0}else if(Gt&&this.options.ecmaVersion>=8){if(qt.start===Ht&&!Wt&&qt.type==="Identifier"&&qt.name==="async")this.unexpected();else if(this.options.ecmaVersion>=9)K.await=!1}if(jt&&Gt)this.raise(qt.start,"The left-hand side of a for-of loop may not start with 'let'.");return this.toAssignable(qt,!1,Kt),this.checkLValPattern(qt),this.parseForIn(K,qt)}else this.checkExpressionErrors(Kt,!0);if(ee>-1)this.unexpected(ee);return this.parseFor(K,qt)};Yt.parseForAfterInit=function(K,ee,Oe){if((this.type===Ut._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&ee.declarations.length===1){if(this.type===Ut._in){if((ee.kind==="using"||ee.kind==="await using")&&!ee.declarations[0].init)this.raise(this.start,"Using declaration is not allowed in for-in loops");if(this.options.ecmaVersion>=9&&Oe>-1)this.unexpected(Oe)}else if(this.options.ecmaVersion>=9)K.await=Oe>-1;return this.parseForIn(K,ee)}if(Oe>-1)this.unexpected(Oe);return this.parseFor(K,ee)};Yt.parseFunctionStatement=function(K,ee,Oe){return this.next(),this.parseFunction(K,gs|(Oe?0:Ui),!1,ee)};Yt.parseIfStatement=function(K){return this.next(),K.test=this.parseParenExpression(),K.consequent=this.parseStatement("if"),K.alternate=this.eat(Ut._else)?this.parseStatement("if"):null,this.finishNode(K,"IfStatement")};Yt.parseReturnStatement=function(K){if(!this.allowReturn)this.raise(this.start,"'return' outside of function");if(this.next(),this.eat(Ut.semi)||this.insertSemicolon())K.argument=null;else K.argument=this.parseExpression(),this.semicolon();return this.finishNode(K,"ReturnStatement")};Yt.parseSwitchStatement=function(K){this.next(),K.discriminant=this.parseParenExpression(),K.cases=[],this.expect(Ut.braceL),this.labels.push(Yc),this.enterScope(Lo);var ee;for(var Oe=!1;this.type!==Ut.braceR;)if(this.type===Ut._case||this.type===Ut._default){var Ot=this.type===Ut._case;if(ee)this.finishNode(ee,"SwitchCase");if(K.cases.push(ee=this.startNode()),ee.consequent=[],this.next(),Ot)ee.test=this.parseExpression();else{if(Oe)this.raiseRecoverable(this.lastTokStart,"Multiple default clauses");Oe=!0,ee.test=null}this.expect(Ut.colon)}else{if(!ee)this.unexpected();ee.consequent.push(this.parseStatement(null))}if(this.exitScope(),ee)this.finishNode(ee,"SwitchCase");return this.next(),this.labels.pop(),this.finishNode(K,"SwitchStatement")};Yt.parseThrowStatement=function(K){if(this.next(),xn.test(this.input.slice(this.lastTokEnd,this.start)))this.raise(this.lastTokEnd,"Illegal newline after throw");return K.argument=this.parseExpression(),this.semicolon(),this.finishNode(K,"ThrowStatement")};var Qc=[];Yt.parseCatchClauseParam=function(){var K=this.parseBindingAtom(),ee=K.type==="Identifier";return this.enterScope(ee?Ro:0),this.checkLValPattern(K,ee?Mo:On),this.expect(Ut.parenR),K};Yt.parseTryStatement=function(K){if(this.next(),K.block=this.parseBlock(),K.handler=null,this.type===Ut._catch){var ee=this.startNode();if(this.next(),this.eat(Ut.parenL))ee.param=this.parseCatchClauseParam();else{if(this.options.ecmaVersion<10)this.unexpected();ee.param=null,this.enterScope(0)}ee.body=this.parseBlock(!1),this.exitScope(),K.handler=this.finishNode(ee,"CatchClause")}if(K.finalizer=this.eat(Ut._finally)?this.parseBlock():null,!K.handler&&!K.finalizer)this.raise(K.start,"Missing catch or finally clause");return this.finishNode(K,"TryStatement")};Yt.parseVarStatement=function(K,ee,Oe){return this.next(),this.parseVar(K,!1,ee,Oe),this.semicolon(),this.finishNode(K,"VariableDeclaration")};Yt.parseWhileStatement=function(K){return this.next(),K.test=this.parseParenExpression(),this.labels.push(Yi),K.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(K,"WhileStatement")};Yt.parseWithStatement=function(K){if(this.strict)this.raise(this.start,"'with' in strict mode");return this.next(),K.object=this.parseParenExpression(),K.body=this.parseStatement("with"),this.finishNode(K,"WithStatement")};Yt.parseEmptyStatement=function(K){return this.next(),this.finishNode(K,"EmptyStatement")};Yt.parseLabeledStatement=function(K,ee,Oe,Ot){for(var Ft=0,jt=this.labels;Ft<jt.length;Ft+=1){var Gt=jt[Ft];if(Gt.name===ee)this.raise(Oe.start,"Label '"+ee+"' is already declared")}var Mt=this.type.isLoop?"loop":this.type===Ut._switch?"switch":null;for(var Vt=this.labels.length-1;Vt>=0;Vt--){var Wt=this.labels[Vt];if(Wt.statementStart===K.start)Wt.statementStart=this.start,Wt.kind=Mt;else break}return this.labels.push({name:ee,kind:Mt,statementStart:this.start}),K.body=this.parseStatement(Ot?Ot.indexOf("label")===-1?Ot+"label":Ot:"label"),this.labels.pop(),K.label=Oe,this.finishNode(K,"LabeledStatement")};Yt.parseExpressionStatement=function(K,ee){return K.expression=ee,this.semicolon(),this.finishNode(K,"ExpressionStatement")};Yt.parseBlock=function(K,ee,Oe){if(K===void 0)K=!0;if(ee===void 0)ee=this.startNode();if(ee.body=[],this.expect(Ut.braceL),K)this.enterScope(0);while(this.type!==Ut.braceR){var Ot=this.parseStatement(null);ee.body.push(Ot)}if(Oe)this.strict=!1;if(this.next(),K)this.exitScope();return this.finishNode(ee,"BlockStatement")};Yt.parseFor=function(K,ee){return K.init=ee,this.expect(Ut.semi),K.test=this.type===Ut.semi?null:this.parseExpression(),this.expect(Ut.semi),K.update=this.type===Ut.parenR?null:this.parseExpression(),this.expect(Ut.parenR),K.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(K,"ForStatement")};Yt.parseForIn=function(K,ee){var Oe=this.type===Ut._in;if(this.next(),ee.type==="VariableDeclaration"&&ee.declarations[0].init!=null&&(!Oe||this.options.ecmaVersion<8||this.strict||ee.kind!=="var"||ee.declarations[0].id.type!=="Identifier"))this.raise(ee.start,(Oe?"for-in":"for-of")+" loop variable declaration may not have an initializer");return K.left=ee,K.right=Oe?this.parseExpression():this.parseMaybeAssign(),this.expect(Ut.parenR),K.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(K,Oe?"ForInStatement":"ForOfStatement")};Yt.parseVar=function(K,ee,Oe,Ot){K.declarations=[],K.kind=Oe;for(;;){var Ft=this.startNode();if(this.parseVarId(Ft,Oe),this.eat(Ut.eq))Ft.init=this.parseMaybeAssign(ee);else if(!Ot&&Oe==="const"&&!(this.type===Ut._in||this.options.ecmaVersion>=6&&this.isContextual("of")))this.unexpected();else if(!Ot&&(Oe==="using"||Oe==="await using")&&this.options.ecmaVersion>=17&&this.type!==Ut._in&&!this.isContextual("of"))this.raise(this.lastTokEnd,"Missing initializer in "+Oe+" declaration");else if(!Ot&&Ft.id.type!=="Identifier"&&!(ee&&(this.type===Ut._in||this.isContextual("of"))))this.raise(this.lastTokEnd,"Complex binding patterns require an initialization value");else Ft.init=null;if(K.declarations.push(this.finishNode(Ft,"VariableDeclarator")),!this.eat(Ut.comma))break}return K};Yt.parseVarId=function(K,ee){K.id=ee==="using"||ee==="await using"?this.parseIdent():this.parseBindingAtom(),this.checkLValPattern(K.id,ee==="var"?Ji:On,!1)};var gs=1,Ui=2,jo=4;Yt.parseFunction=function(K,ee,Oe,Ot,Ft){if(this.initFunction(K),this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!Ot){if(this.type===Ut.star&&ee&Ui)this.unexpected();K.generator=this.eat(Ut.star)}if(this.options.ecmaVersion>=8)K.async=!!Ot;if(ee&gs){if(K.id=ee&jo&&this.type!==Ut.name?null:this.parseIdent(),K.id&&!(ee&Ui))this.checkLValSimple(K.id,this.strict||K.generator||K.async?this.treatFunctionsAsVar?Ji:On:Oo)}var jt=this.yieldPos,Gt=this.awaitPos,Mt=this.awaitIdentPos;if(this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(Xi(K.async,K.generator)),!(ee&gs))K.id=this.type===Ut.name?this.parseIdent():null;return this.parseFunctionParams(K),this.parseFunctionBody(K,Oe,!1,Ft),this.yieldPos=jt,this.awaitPos=Gt,this.awaitIdentPos=Mt,this.finishNode(K,ee&gs?"FunctionDeclaration":"FunctionExpression")};Yt.parseFunctionParams=function(K){this.expect(Ut.parenL),K.params=this.parseBindingList(Ut.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()};Yt.parseClass=function(K,ee){this.next();var Oe=this.strict;this.strict=!0,this.parseClassId(K,ee),this.parseClassSuper(K);var Ot=this.enterClassBody(),Ft=this.startNode(),jt=!1;Ft.body=[],this.expect(Ut.braceL);while(this.type!==Ut.braceR){var Gt=this.parseClassElement(K.superClass!==null);if(Gt){if(Ft.body.push(Gt),Gt.type==="MethodDefinition"&&Gt.kind==="constructor"){if(jt)this.raiseRecoverable(Gt.start,"Duplicate constructor in the same class");jt=!0}else if(Gt.key&&Gt.key.type==="PrivateIdentifier"&&Zc(Ot,Gt))this.raiseRecoverable(Gt.key.start,"Identifier '#"+Gt.key.name+"' has already been declared")}}return this.strict=Oe,this.next(),K.body=this.finishNode(Ft,"ClassBody"),this.exitClassBody(),this.finishNode(K,ee?"ClassDeclaration":"ClassExpression")};Yt.parseClassElement=function(K){if(this.eat(Ut.semi))return null;var ee=this.options.ecmaVersion,Oe=this.startNode(),Ot="",Ft=!1,jt=!1,Gt="method",Mt=!1;if(this.eatContextual("static")){if(ee>=13&&this.eat(Ut.braceL))return this.parseClassStaticBlock(Oe),Oe;if(this.isClassElementNameStart()||this.type===Ut.star)Mt=!0;else Ot="static"}if(Oe.static=Mt,!Ot&&ee>=8&&this.eatContextual("async"))if((this.isClassElementNameStart()||this.type===Ut.star)&&!this.canInsertSemicolon())jt=!0;else Ot="async";if(!Ot&&(ee>=9||!jt)&&this.eat(Ut.star))Ft=!0;if(!Ot&&!jt&&!Ft){var Vt=this.value;if(this.eatContextual("get")||this.eatContextual("set"))if(this.isClassElementNameStart())Gt=Vt;else Ot=Vt}if(Ot)Oe.computed=!1,Oe.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),Oe.key.name=Ot,this.finishNode(Oe.key,"Identifier");else this.parseClassElementName(Oe);if(ee<13||this.type===Ut.parenL||Gt!=="method"||Ft||jt){var Wt=!Oe.static&&qs(Oe,"constructor"),Kt=Wt&&K;if(Wt&&Gt!=="method")this.raise(Oe.key.start,"Constructor can't have get/set modifier");Oe.kind=Wt?"constructor":Gt,this.parseClassMethod(Oe,Ft,jt,Kt)}else this.parseClassField(Oe);return Oe};Yt.isClassElementNameStart=function(){return this.type===Ut.name||this.type===Ut.privateId||this.type===Ut.num||this.type===Ut.string||this.type===Ut.bracketL||this.type.keyword};Yt.parseClassElementName=function(K){if(this.type===Ut.privateId){if(this.value==="constructor")this.raise(this.start,"Classes can't have an element named '#constructor'");K.computed=!1,K.key=this.parsePrivateIdent()}else this.parsePropertyName(K)};Yt.parseClassMethod=function(K,ee,Oe,Ot){var Ft=K.key;if(K.kind==="constructor"){if(ee)this.raise(Ft.start,"Constructor can't be a generator");if(Oe)this.raise(Ft.start,"Constructor can't be an async method")}else if(K.static&&qs(K,"prototype"))this.raise(Ft.start,"Classes may not have a static property named prototype");var jt=K.value=this.parseMethod(ee,Oe,Ot);if(K.kind==="get"&&jt.params.length!==0)this.raiseRecoverable(jt.start,"getter should have no params");if(K.kind==="set"&&jt.params.length!==1)this.raiseRecoverable(jt.start,"setter should have exactly one param");if(K.kind==="set"&&jt.params[0].type==="RestElement")this.raiseRecoverable(jt.params[0].start,"Setter cannot use rest params");return this.finishNode(K,"MethodDefinition")};Yt.parseClassField=function(K){if(qs(K,"constructor"))this.raise(K.key.start,"Classes can't have a field named 'constructor'");else if(K.static&&qs(K,"prototype"))this.raise(K.key.start,"Classes can't have a static field named 'prototype'");if(this.eat(Ut.eq))this.enterScope(vs|Ys),K.value=this.parseMaybeAssign(),this.exitScope();else K.value=null;return this.semicolon(),this.finishNode(K,"PropertyDefinition")};Yt.parseClassStaticBlock=function(K){K.body=[];var ee=this.labels;this.labels=[],this.enterScope(Qn|Ys);while(this.type!==Ut.braceR){var Oe=this.parseStatement(null);K.body.push(Oe)}return this.next(),this.exitScope(),this.labels=ee,this.finishNode(K,"StaticBlock")};Yt.parseClassId=function(K,ee){if(this.type===Ut.name){if(K.id=this.parseIdent(),ee)this.checkLValSimple(K.id,On,!1)}else{if(ee===!0)this.unexpected();K.id=null}};Yt.parseClassSuper=function(K){K.superClass=this.eat(Ut._extends)?this.parseExprSubscripts(null,!1):null};Yt.enterClassBody=function(){var K={declared:Object.create(null),used:[]};return this.privateNameStack.push(K),K.declared};Yt.exitClassBody=function(){var K=this.privateNameStack.pop(),{declared:ee,used:Oe}=K;if(!this.options.checkPrivateFields)return;var Ot=this.privateNameStack.length,Ft=Ot===0?null:this.privateNameStack[Ot-1];for(var jt=0;jt<Oe.length;++jt){var Gt=Oe[jt];if(!xs(ee,Gt.name))if(Ft)Ft.used.push(Gt);else this.raiseRecoverable(Gt.start,"Private field '#"+Gt.name+"' must be declared in an enclosing class")}};function Zc(K,ee){var Oe=ee.key.name,Ot=K[Oe],Ft="true";if(ee.type==="MethodDefinition"&&(ee.kind==="get"||ee.kind==="set"))Ft=(ee.static?"s":"i")+ee.kind;if(Ot==="iget"&&Ft==="iset"||Ot==="iset"&&Ft==="iget"||Ot==="sget"&&Ft==="sset"||Ot==="sset"&&Ft==="sget")return K[Oe]="true",!1;else if(!Ot)return K[Oe]=Ft,!1;else return!0}function qs(K,ee){var{computed:Oe,key:Ot}=K;return!Oe&&(Ot.type==="Identifier"&&Ot.name===ee||Ot.type==="Literal"&&Ot.value===ee)}Yt.parseExportAllDeclaration=function(K,ee){if(this.options.ecmaVersion>=11)if(this.eatContextual("as"))K.exported=this.parseModuleExportName(),this.checkExport(ee,K.exported,this.lastTokStart);else K.exported=null;if(this.expectContextual("from"),this.type!==Ut.string)this.unexpected();if(K.source=this.parseExprAtom(),this.options.ecmaVersion>=16)K.attributes=this.parseWithClause();return this.semicolon(),this.finishNode(K,"ExportAllDeclaration")};Yt.parseExport=function(K,ee){if(this.next(),this.eat(Ut.star))return this.parseExportAllDeclaration(K,ee);if(this.eat(Ut._default))return this.checkExport(ee,"default",this.lastTokStart),K.declaration=this.parseExportDefaultDeclaration(),this.finishNode(K,"ExportDefaultDeclaration");if(this.shouldParseExportStatement()){if(K.declaration=this.parseExportDeclaration(K),K.declaration.type==="VariableDeclaration")this.checkVariableExport(ee,K.declaration.declarations);else this.checkExport(ee,K.declaration.id,K.declaration.id.start);if(K.specifiers=[],K.source=null,this.options.ecmaVersion>=16)K.attributes=[]}else{if(K.declaration=null,K.specifiers=this.parseExportSpecifiers(ee),this.eatContextual("from")){if(this.type!==Ut.string)this.unexpected();if(K.source=this.parseExprAtom(),this.options.ecmaVersion>=16)K.attributes=this.parseWithClause()}else{for(var Oe=0,Ot=K.specifiers;Oe<Ot.length;Oe+=1){var Ft=Ot[Oe];if(this.checkUnreserved(Ft.local),this.checkLocalExport(Ft.local),Ft.local.type==="Literal")this.raise(Ft.local.start,"A string literal cannot be used as an exported binding without `from`.")}if(K.source=null,this.options.ecmaVersion>=16)K.attributes=[]}this.semicolon()}return this.finishNode(K,"ExportNamedDeclaration")};Yt.parseExportDeclaration=function(K){return this.parseStatement(null)};Yt.parseExportDefaultDeclaration=function(){var K;if(this.type===Ut._function||(K=this.isAsyncFunction())){var ee=this.startNode();if(this.next(),K)this.next();return this.parseFunction(ee,gs|jo,!1,K)}else if(this.type===Ut._class){var Oe=this.startNode();return this.parseClass(Oe,"nullableID")}else{var Ot=this.parseMaybeAssign();return this.semicolon(),Ot}};Yt.checkExport=function(K,ee,Oe){if(!K)return;if(typeof ee!=="string")ee=ee.type==="Identifier"?ee.name:ee.value;if(xs(K,ee))this.raiseRecoverable(Oe,"Duplicate export '"+ee+"'");K[ee]=!0};Yt.checkPatternExport=function(K,ee){var Oe=ee.type;if(Oe==="Identifier")this.checkExport(K,ee,ee.start);else if(Oe==="ObjectPattern")for(var Ot=0,Ft=ee.properties;Ot<Ft.length;Ot+=1){var jt=Ft[Ot];this.checkPatternExport(K,jt)}else if(Oe==="ArrayPattern")for(var Gt=0,Mt=ee.elements;Gt<Mt.length;Gt+=1){var Vt=Mt[Gt];if(Vt)this.checkPatternExport(K,Vt)}else if(Oe==="Property")this.checkPatternExport(K,ee.value);else if(Oe==="AssignmentPattern")this.checkPatternExport(K,ee.left);else if(Oe==="RestElement")this.checkPatternExport(K,ee.argument)};Yt.checkVariableExport=function(K,ee){if(!K)return;for(var Oe=0,Ot=ee;Oe<Ot.length;Oe+=1){var Ft=Ot[Oe];this.checkPatternExport(K,Ft.id)}};Yt.shouldParseExportStatement=function(){return this.type.keyword==="var"||this.type.keyword==="const"||this.type.keyword==="class"||this.type.keyword==="function"||this.isLet()||this.isAsyncFunction()};Yt.parseExportSpecifier=function(K){var ee=this.startNode();return ee.local=this.parseModuleExportName(),ee.exported=this.eatContextual("as")?this.parseModuleExportName():ee.local,this.checkExport(K,ee.exported,ee.exported.start),this.finishNode(ee,"ExportSpecifier")};Yt.parseExportSpecifiers=function(K){var ee=[],Oe=!0;this.expect(Ut.braceL);while(!this.eat(Ut.braceR)){if(!Oe){if(this.expect(Ut.comma),this.afterTrailingComma(Ut.braceR))break}else Oe=!1;ee.push(this.parseExportSpecifier(K))}return ee};Yt.parseImport=function(K){if(this.next(),this.type===Ut.string)K.specifiers=Qc,K.source=this.parseExprAtom();else K.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),K.source=this.type===Ut.string?this.parseExprAtom():this.unexpected();if(this.options.ecmaVersion>=16)K.attributes=this.parseWithClause();return this.semicolon(),this.finishNode(K,"ImportDeclaration")};Yt.parseImportSpecifier=function(){var K=this.startNode();if(K.imported=this.parseModuleExportName(),this.eatContextual("as"))K.local=this.parseIdent();else this.checkUnreserved(K.imported),K.local=K.imported;return this.checkLValSimple(K.local,On),this.finishNode(K,"ImportSpecifier")};Yt.parseImportDefaultSpecifier=function(){var K=this.startNode();return K.local=this.parseIdent(),this.checkLValSimple(K.local,On),this.finishNode(K,"ImportDefaultSpecifier")};Yt.parseImportNamespaceSpecifier=function(){var K=this.startNode();return this.next(),this.expectContextual("as"),K.local=this.parseIdent(),this.checkLValSimple(K.local,On),this.finishNode(K,"ImportNamespaceSpecifier")};Yt.parseImportSpecifiers=function(){var K=[],ee=!0;if(this.type===Ut.name){if(K.push(this.parseImportDefaultSpecifier()),!this.eat(Ut.comma))return K}if(this.type===Ut.star)return K.push(this.parseImportNamespaceSpecifier()),K;this.expect(Ut.braceL);while(!this.eat(Ut.braceR)){if(!ee){if(this.expect(Ut.comma),this.afterTrailingComma(Ut.braceR))break}else ee=!1;K.push(this.parseImportSpecifier())}return K};Yt.parseWithClause=function(){var K=[];if(!this.eat(Ut._with))return K;this.expect(Ut.braceL);var ee={},Oe=!0;while(!this.eat(Ut.braceR)){if(!Oe){if(this.expect(Ut.comma),this.afterTrailingComma(Ut.braceR))break}else Oe=!1;var Ot=this.parseImportAttribute(),Ft=Ot.key.type==="Identifier"?Ot.key.name:Ot.key.value;if(xs(ee,Ft))this.raiseRecoverable(Ot.key.start,"Duplicate attribute key '"+Ft+"'");ee[Ft]=!0,K.push(Ot)}return K};Yt.parseImportAttribute=function(){var K=this.startNode();if(K.key=this.type===Ut.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never"),this.expect(Ut.colon),this.type!==Ut.string)this.unexpected();return K.value=this.parseExprAtom(),this.finishNode(K,"ImportAttribute")};Yt.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===Ut.string){var K=this.parseLiteral(this.value);if(qc.test(K.value))this.raise(K.start,"An export name cannot include a lone surrogate.");return K}return this.parseIdent(!0)};Yt.adaptDirectivePrologue=function(K){for(var ee=0;ee<K.length&&this.isDirectiveCandidate(K[ee]);++ee)K[ee].directive=K[ee].expression.raw.slice(1,-1)};Yt.isDirectiveCandidate=function(K){return this.options.ecmaVersion>=5&&K.type==="ExpressionStatement"&&K.expression.type==="Literal"&&typeof K.expression.value==="string"&&(this.input[K.start]==='"'||this.input[K.start]==="'")};var wn=s.prototype;wn.toAssignable=function(K,ee,Oe){if(this.options.ecmaVersion>=6&&K)switch(K.type){case"Identifier":if(this.inAsync&&K.name==="await")this.raise(K.start,"Cannot use 'await' as identifier inside an async function");break;case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":break;case"ObjectExpression":if(K.type="ObjectPattern",Oe)this.checkPatternErrors(Oe,!0);for(var Ot=0,Ft=K.properties;Ot<Ft.length;Ot+=1){var jt=Ft[Ot];if(this.toAssignable(jt,ee),jt.type==="RestElement"&&(jt.argument.type==="ArrayPattern"||jt.argument.type==="ObjectPattern"))this.raise(jt.argument.start,"Unexpected token")}break;case"Property":if(K.kind!=="init")this.raise(K.key.start,"Object pattern can't contain getter or setter");this.toAssignable(K.value,ee);break;case"ArrayExpression":if(K.type="ArrayPattern",Oe)this.checkPatternErrors(Oe,!0);this.toAssignableList(K.elements,ee);break;case"SpreadElement":if(K.type="RestElement",this.toAssignable(K.argument,ee),K.argument.type==="AssignmentPattern")this.raise(K.argument.start,"Rest elements cannot have a default value");break;case"AssignmentExpression":if(K.operator!=="=")this.raise(K.left.end,"Only '=' operator can be used for specifying default value.");K.type="AssignmentPattern",delete K.operator,this.toAssignable(K.left,ee);break;case"ParenthesizedExpression":this.toAssignable(K.expression,ee,Oe);break;case"ChainExpression":this.raiseRecoverable(K.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":if(!ee)break;default:this.raise(K.start,"Assigning to rvalue")}else if(Oe)this.checkPatternErrors(Oe,!0);return K};wn.toAssignableList=function(K,ee){var Oe=K.length;for(var Ot=0;Ot<Oe;Ot++){var Ft=K[Ot];if(Ft)this.toAssignable(Ft,ee)}if(Oe){var jt=K[Oe-1];if(this.options.ecmaVersion===6&&ee&&jt&&jt.type==="RestElement"&&jt.argument.type!=="Identifier")this.unexpected(jt.argument.start)}return K};wn.parseSpread=function(K){var ee=this.startNode();return this.next(),ee.argument=this.parseMaybeAssign(!1,K),this.finishNode(ee,"SpreadElement")};wn.parseRestBinding=function(){var K=this.startNode();if(this.next(),this.options.ecmaVersion===6&&this.type!==Ut.name)this.unexpected();return K.argument=this.parseBindingAtom(),this.finishNode(K,"RestElement")};wn.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case Ut.bracketL:var K=this.startNode();return this.next(),K.elements=this.parseBindingList(Ut.bracketR,!0,!0),this.finishNode(K,"ArrayPattern");case Ut.braceL:return this.parseObj(!0)}return this.parseIdent()};wn.parseBindingList=function(K,ee,Oe,Ot){var Ft=[],jt=!0;while(!this.eat(K)){if(jt)jt=!1;else this.expect(Ut.comma);if(ee&&this.type===Ut.comma)Ft.push(null);else if(Oe&&this.afterTrailingComma(K))break;else if(this.type===Ut.ellipsis){var Gt=this.parseRestBinding();if(this.parseBindingListItem(Gt),Ft.push(Gt),this.type===Ut.comma)this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");this.expect(K);break}else Ft.push(this.parseAssignableListItem(Ot))}return Ft};wn.parseAssignableListItem=function(K){var ee=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(ee),ee};wn.parseBindingListItem=function(K){return K};wn.parseMaybeDefault=function(K,ee,Oe){if(Oe=Oe||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(Ut.eq))return Oe;var Ot=this.startNodeAt(K,ee);return Ot.left=Oe,Ot.right=this.parseMaybeAssign(),this.finishNode(Ot,"AssignmentPattern")};wn.checkLValSimple=function(K,ee,Oe){if(ee===void 0)ee=Hs;var Ot=ee!==Hs;switch(K.type){case"Identifier":if(this.strict&&this.reservedWordsStrictBind.test(K.name))this.raiseRecoverable(K.start,(Ot?"Binding ":"Assigning to ")+K.name+" in strict mode");if(Ot){if(ee===On&&K.name==="let")this.raiseRecoverable(K.start,"let is disallowed as a lexically bound name");if(Oe){if(xs(Oe,K.name))this.raiseRecoverable(K.start,"Argument name clash");Oe[K.name]=!0}if(ee!==Fo)this.declareName(K.name,ee,K.start)}break;case"ChainExpression":this.raiseRecoverable(K.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":if(Ot)this.raiseRecoverable(K.start,"Binding member expression");break;case"ParenthesizedExpression":if(Ot)this.raiseRecoverable(K.start,"Binding parenthesized expression");return this.checkLValSimple(K.expression,ee,Oe);default:this.raise(K.start,(Ot?"Binding":"Assigning to")+" rvalue")}};wn.checkLValPattern=function(K,ee,Oe){if(ee===void 0)ee=Hs;switch(K.type){case"ObjectPattern":for(var Ot=0,Ft=K.properties;Ot<Ft.length;Ot+=1){var jt=Ft[Ot];this.checkLValInnerPattern(jt,ee,Oe)}break;case"ArrayPattern":for(var Gt=0,Mt=K.elements;Gt<Mt.length;Gt+=1){var Vt=Mt[Gt];if(Vt)this.checkLValInnerPattern(Vt,ee,Oe)}break;default:this.checkLValSimple(K,ee,Oe)}};wn.checkLValInnerPattern=function(K,ee,Oe){if(ee===void 0)ee=Hs;switch(K.type){case"Property":this.checkLValInnerPattern(K.value,ee,Oe);break;case"AssignmentPattern":this.checkLValPattern(K.left,ee,Oe);break;case"RestElement":this.checkLValPattern(K.argument,ee,Oe);break;default:this.checkLValPattern(K,ee,Oe)}};var Tn=function(K,ee,Oe,Ot,Ft){this.token=K,this.isExpr=!!ee,this.preserveSpace=!!Oe,this.override=Ot,this.generator=!!Ft},an={b_stat:new Tn("{",!1),b_expr:new Tn("{",!0),b_tmpl:new Tn("${",!1),p_stat:new Tn("(",!1),p_expr:new Tn("(",!0),q_tmpl:new Tn("`",!0,!0,function(K){return K.tryReadTemplateToken()}),f_stat:new Tn("function",!1),f_expr:new Tn("function",!0),f_expr_gen:new Tn("function",!0,!1,null,!0),f_gen:new Tn("function",!1,!1,null,!0)},ps=s.prototype;ps.initialContext=function(){return[an.b_stat]};ps.curContext=function(){return this.context[this.context.length-1]};ps.braceIsBlock=function(K){var ee=this.curContext();if(ee===an.f_expr||ee===an.f_stat)return!0;if(K===Ut.colon&&(ee===an.b_stat||ee===an.b_expr))return!ee.isExpr;if(K===Ut._return||K===Ut.name&&this.exprAllowed)return xn.test(this.input.slice(this.lastTokEnd,this.start));if(K===Ut._else||K===Ut.semi||K===Ut.eof||K===Ut.parenR||K===Ut.arrow)return!0;if(K===Ut.braceL)return ee===an.b_stat;if(K===Ut._var||K===Ut._const||K===Ut.name)return!1;return!this.exprAllowed};ps.inGeneratorContext=function(){for(var K=this.context.length-1;K>=1;K--){var ee=this.context[K];if(ee.token==="function")return ee.generator}return!1};ps.updateContext=function(K){var ee,Oe=this.type;if(Oe.keyword&&K===Ut.dot)this.exprAllowed=!1;else if(ee=Oe.updateContext)ee.call(this,K);else this.exprAllowed=Oe.beforeExpr};ps.overrideContext=function(K){if(this.curContext()!==K)this.context[this.context.length-1]=K};Ut.parenR.updateContext=Ut.braceR.updateContext=function(){if(this.context.length===1){this.exprAllowed=!0;return}var K=this.context.pop();if(K===an.b_stat&&this.curContext().token==="function")K=this.context.pop();this.exprAllowed=!K.isExpr};Ut.braceL.updateContext=function(K){this.context.push(this.braceIsBlock(K)?an.b_stat:an.b_expr),this.exprAllowed=!0};Ut.dollarBraceL.updateContext=function(){this.context.push(an.b_tmpl),this.exprAllowed=!0};Ut.parenL.updateContext=function(K){var ee=K===Ut._if||K===Ut._for||K===Ut._with||K===Ut._while;this.context.push(ee?an.p_stat:an.p_expr),this.exprAllowed=!0};Ut.incDec.updateContext=function(){};Ut._function.updateContext=Ut._class.updateContext=function(K){if(K.beforeExpr&&K!==Ut._else&&!(K===Ut.semi&&this.curContext()!==an.p_stat)&&!(K===Ut._return&&xn.test(this.input.slice(this.lastTokEnd,this.start)))&&!((K===Ut.colon||K===Ut.braceL)&&this.curContext()===an.b_stat))this.context.push(an.f_expr);else this.context.push(an.f_stat);this.exprAllowed=!1};Ut.colon.updateContext=function(){if(this.curContext().token==="function")this.context.pop();this.exprAllowed=!0};Ut.backQuote.updateContext=function(){if(this.curContext()===an.q_tmpl)this.context.pop();else this.context.push(an.q_tmpl);this.exprAllowed=!1};Ut.star.updateContext=function(K){if(K===Ut._function){var ee=this.context.length-1;if(this.context[ee]===an.f_expr)this.context[ee]=an.f_expr_gen;else this.context[ee]=an.f_gen}this.exprAllowed=!0};Ut.name.updateContext=function(K){var ee=!1;if(this.options.ecmaVersion>=6&&K!==Ut.dot){if(this.value==="of"&&!this.exprAllowed||this.value==="yield"&&this.inGeneratorContext())ee=!0}this.exprAllowed=ee};var en=s.prototype;en.checkPropClash=function(K,ee,Oe){if(this.options.ecmaVersion>=9&&K.type==="SpreadElement")return;if(this.options.ecmaVersion>=6&&(K.computed||K.method||K.shorthand))return;var Ot=K.key,Ft;switch(Ot.type){case"Identifier":Ft=Ot.name;break;case"Literal":Ft=String(Ot.value);break;default:return}var jt=K.kind;if(this.options.ecmaVersion>=6){if(Ft==="__proto__"&&jt==="init"){if(ee.proto)if(Oe){if(Oe.doubleProto<0)Oe.doubleProto=Ot.start}else this.raiseRecoverable(Ot.start,"Redefinition of __proto__ property");ee.proto=!0}return}Ft="$"+Ft;var Gt=ee[Ft];if(Gt){var Mt;if(jt==="init")Mt=this.strict&&Gt.init||Gt.get||Gt.set;else Mt=Gt.init||Gt[jt];if(Mt)this.raiseRecoverable(Ot.start,"Redefinition of property")}else Gt=ee[Ft]={init:!1,get:!1,set:!1};Gt[jt]=!0};en.parseExpression=function(K,ee){var Oe=this;return this.catchStackOverflow(function(){var{start:Ot,startLoc:Ft}=Oe,jt=Oe.parseMaybeAssign(K,ee);if(Oe.type===Ut.comma){var Gt=Oe.startNodeAt(Ot,Ft);Gt.expressions=[jt];while(Oe.eat(Ut.comma))Gt.expressions.push(Oe.parseMaybeAssign(K,ee));return Oe.finishNode(Gt,"SequenceExpression")}return jt})};en.parseMaybeAssign=function(K,ee,Oe){if(this.isContextual("yield"))if(this.inGenerator)return this.parseYield(K);else this.exprAllowed=!1;var Ot=!1,Ft=-1,jt=-1,Gt=-1;if(ee)Ft=ee.parenthesizedAssign,jt=ee.trailingComma,Gt=ee.doubleProto,ee.parenthesizedAssign=ee.trailingComma=-1;else ee=new Zs,Ot=!0;var Mt=this.start,Vt=this.startLoc;if(this.type===Ut.parenL||this.type===Ut.name)this.potentialArrowAt=this.start,this.potentialArrowInForAwait=K==="await";var Wt=this.parseMaybeConditional(K,ee);if(Oe)Wt=Oe.call(this,Wt,Mt,Vt);if(this.type.isAssign){var Kt=this.startNodeAt(Mt,Vt);if(Kt.operator=this.value,this.type===Ut.eq)Wt=this.toAssignable(Wt,!1,ee);if(!Ot)ee.parenthesizedAssign=ee.trailingComma=ee.doubleProto=-1;if(ee.shorthandAssign>=Wt.start)ee.shorthandAssign=-1;if(this.type===Ut.eq)this.checkLValPattern(Wt);else this.checkLValSimple(Wt);if(Kt.left=Wt,this.next(),Kt.right=this.parseMaybeAssign(K),Gt>-1)ee.doubleProto=Gt;return this.finishNode(Kt,"AssignmentExpression")}else if(Ot)this.checkExpressionErrors(ee,!0);if(Ft>-1)ee.parenthesizedAssign=Ft;if(jt>-1)ee.trailingComma=jt;return Wt};en.parseMaybeConditional=function(K,ee){var Oe=this.start,Ot=this.startLoc,Ft=this.parseExprOps(K,ee);if(this.checkExpressionErrors(ee))return Ft;if(!(Ft.type==="ArrowFunctionExpression"&&Ft.start===Oe)&&this.eat(Ut.question)){var jt=this.startNodeAt(Oe,Ot);return jt.test=Ft,jt.consequent=this.parseMaybeAssign(),this.expect(Ut.colon),jt.alternate=this.parseMaybeAssign(K),this.finishNode(jt,"ConditionalExpression")}return Ft};en.parseExprOps=function(K,ee){var Oe=this.start,Ot=this.startLoc,Ft=this.parseMaybeUnary(ee,!1,!1,K);if(this.checkExpressionErrors(ee))return Ft;return Ft.start===Oe&&Ft.type==="ArrowFunctionExpression"?Ft:this.parseExprOp(Ft,Oe,Ot,-1,K)};en.parseExprOp=function(K,ee,Oe,Ot,Ft){var jt=this.type.binop;if(jt!=null&&(!Ft||this.type!==Ut._in)){if(jt>Ot){var Gt=this.type===Ut.logicalOR||this.type===Ut.logicalAND,Mt=this.type===Ut.coalesce;if(Mt)jt=Ut.logicalAND.binop;var Vt=this.value;this.next();var Wt=this.start,Kt=this.startLoc,Ht=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,Ft),Wt,Kt,jt,Ft),qt=this.buildBinary(ee,Oe,K,Ht,Vt,Gt||Mt);if(Gt&&this.type===Ut.coalesce||Mt&&(this.type===Ut.logicalOR||this.type===Ut.logicalAND))this.raiseRecoverable(this.start,"Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses");return this.parseExprOp(qt,ee,Oe,Ot,Ft)}}return K};en.buildBinary=function(K,ee,Oe,Ot,Ft,jt){if(Ot.type==="PrivateIdentifier")this.raise(Ot.start,"Private identifier can only be left side of binary expression");var Gt=this.startNodeAt(K,ee);return Gt.left=Oe,Gt.operator=Ft,Gt.right=Ot,this.finishNode(Gt,jt?"LogicalExpression":"BinaryExpression")};en.parseMaybeUnary=function(K,ee,Oe,Ot){var Ft=this.start,jt=this.startLoc,Gt;if(this.isContextual("await")&&this.canAwait)Gt=this.parseAwait(Ot),ee=!0;else if(this.type.prefix){var Mt=this.startNode(),Vt=this.type===Ut.incDec;if(Mt.operator=this.value,Mt.prefix=!0,this.next(),Mt.argument=this.parseMaybeUnary(null,!0,Vt,Ot),this.checkExpressionErrors(K,!0),Vt)this.checkLValSimple(Mt.argument);else if(this.strict&&Mt.operator==="delete"&&Bo(Mt.argument))this.raiseRecoverable(Mt.start,"Deleting local variable in strict mode");else if(Mt.operator==="delete"&&Ki(Mt.argument))this.raiseRecoverable(Mt.start,"Private fields can not be deleted");else ee=!0;Gt=this.finishNode(Mt,Vt?"UpdateExpression":"UnaryExpression")}else if(!ee&&this.type===Ut.privateId){if((Ot||this.privateNameStack.length===0)&&this.options.checkPrivateFields)this.unexpected();if(Gt=this.parsePrivateIdent(),this.type!==Ut._in)this.unexpected()}else{if(Gt=this.parseExprSubscripts(K,Ot),this.checkExpressionErrors(K))return Gt;while(this.type.postfix&&!this.canInsertSemicolon()){var Wt=this.startNodeAt(Ft,jt);Wt.operator=this.value,Wt.prefix=!1,Wt.argument=Gt,this.checkLValSimple(Gt),this.next(),Gt=this.finishNode(Wt,"UpdateExpression")}}if(!Oe&&!(Gt.type==="ArrowFunctionExpression"&&Gt.start===Ft)&&this.eat(Ut.starstar))if(ee)this.unexpected(this.lastTokStart);else return this.buildBinary(Ft,jt,Gt,this.parseMaybeUnary(null,!1,!1,Ot),"**",!1);else return Gt};function Bo(K){return K.type==="Identifier"||K.type==="ParenthesizedExpression"&&Bo(K.expression)}function Ki(K){return K.type==="MemberExpression"&&K.property.type==="PrivateIdentifier"||K.type==="ChainExpression"&&Ki(K.expression)||K.type==="ParenthesizedExpression"&&Ki(K.expression)}en.parseExprSubscripts=function(K,ee){var Oe=this.start,Ot=this.startLoc,Ft=this.parseExprAtom(K,ee);if(Ft.type==="ArrowFunctionExpression"&&this.input.slice(this.lastTokStart,this.lastTokEnd)!==")")return Ft;var jt=this.parseSubscripts(Ft,Oe,Ot,!1,ee);if(K&&jt.type==="MemberExpression"){if(K.parenthesizedAssign>=jt.start)K.parenthesizedAssign=-1;if(K.parenthesizedBind>=jt.start)K.parenthesizedBind=-1;if(K.trailingComma>=jt.start)K.trailingComma=-1}return jt};en.parseSubscripts=function(K,ee,Oe,Ot,Ft){var jt=this.options.ecmaVersion>=8&&K.type==="Identifier"&&K.name==="async"&&this.lastTokEnd===K.end&&!this.canInsertSemicolon()&&K.end-K.start===5&&this.potentialArrowAt===K.start,Gt=!1;while(!0){var Mt=this.parseSubscript(K,ee,Oe,Ot,jt,Gt,Ft);if(Mt.optional)Gt=!0;if(Mt===K||Mt.type==="ArrowFunctionExpression"){if(Gt){var Vt=this.startNodeAt(ee,Oe);Vt.expression=Mt,Mt=this.finishNode(Vt,"ChainExpression")}return Mt}K=Mt}};en.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(Ut.arrow)};en.parseSubscriptAsyncArrow=function(K,ee,Oe,Ot){return this.parseArrowExpression(this.startNodeAt(K,ee),Oe,!0,Ot)};en.parseSubscript=function(K,ee,Oe,Ot,Ft,jt,Gt){var Mt=this.options.ecmaVersion>=11,Vt=Mt&&this.eat(Ut.questionDot);if(Ot&&Vt)this.raise(this.lastTokStart,"Optional chaining cannot appear in the callee of new expressions");var Wt=this.eat(Ut.bracketL);if(Wt||Vt&&this.type!==Ut.parenL&&this.type!==Ut.backQuote||this.eat(Ut.dot)){var Kt=this.startNodeAt(ee,Oe);if(Kt.object=K,Wt)Kt.property=this.parseExpression(),this.expect(Ut.bracketR);else if(this.type===Ut.privateId&&K.type!=="Super")Kt.property=this.parsePrivateIdent();else Kt.property=this.parseIdent(this.options.allowReserved!=="never");if(Kt.computed=!!Wt,Mt)Kt.optional=Vt;K=this.finishNode(Kt,"MemberExpression")}else if(!Ot&&this.eat(Ut.parenL)){var Ht=new Zs,qt=this.yieldPos,zt=this.awaitPos,Xt=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var Qt=this.parseExprList(Ut.parenR,this.options.ecmaVersion>=8,!1,Ht);if(Ft&&!Vt&&this.shouldParseAsyncArrow()){if(this.checkPatternErrors(Ht,!1),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0)this.raise(this.awaitIdentPos,"Cannot use 'await' as identifier inside an async function");return this.yieldPos=qt,this.awaitPos=zt,this.awaitIdentPos=Xt,this.parseSubscriptAsyncArrow(ee,Oe,Qt,Gt)}this.checkExpressionErrors(Ht,!0),this.yieldPos=qt||this.yieldPos,this.awaitPos=zt||this.awaitPos,this.awaitIdentPos=Xt||this.awaitIdentPos;var Jt=this.startNodeAt(ee,Oe);if(Jt.callee=K,Jt.arguments=Qt,Mt)Jt.optional=Vt;K=this.finishNode(Jt,"CallExpression")}else if(this.type===Ut.backQuote){if(Vt||jt)this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions");var tn=this.startNodeAt(ee,Oe);tn.tag=K,tn.quasi=this.parseTemplate({isTagged:!0}),K=this.finishNode(tn,"TaggedTemplateExpression")}return K};en.parseExprAtom=function(K,ee,Oe){if(this.type===Ut.slash)this.readRegexp();var Ot,Ft=this.potentialArrowAt===this.start;switch(this.type){case Ut._super:if(!this.allowSuper)this.raise(this.start,"'super' keyword outside a method");if(Ot=this.startNode(),this.next(),this.type===Ut.parenL&&!this.allowDirectSuper)this.raise(Ot.start,"super() call outside constructor of a subclass");if(this.type!==Ut.dot&&this.type!==Ut.bracketL&&this.type!==Ut.parenL)this.unexpected();return this.finishNode(Ot,"Super");case Ut._this:return Ot=this.startNode(),this.next(),this.finishNode(Ot,"ThisExpression");case Ut.name:var jt=this.start,Gt=this.startLoc,Mt=this.containsEsc,Vt=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!Mt&&Vt.name==="async"&&!this.canInsertSemicolon()&&this.eat(Ut._function))return this.overrideContext(an.f_expr),this.parseFunction(this.startNodeAt(jt,Gt),0,!1,!0,ee);if(Ft&&!this.canInsertSemicolon()){if(this.eat(Ut.arrow))return this.parseArrowExpression(this.startNodeAt(jt,Gt),[Vt],!1,ee);if(this.options.ecmaVersion>=8&&Vt.name==="async"&&this.type===Ut.name&&!Mt&&(!this.potentialArrowInForAwait||this.value!=="of"||this.containsEsc)){if(Vt=this.parseIdent(!1),this.canInsertSemicolon()||!this.eat(Ut.arrow))this.unexpected();return this.parseArrowExpression(this.startNodeAt(jt,Gt),[Vt],!0,ee)}}return Vt;case Ut.regexp:var Wt=this.value;return Ot=this.parseLiteral(Wt.value),Ot.regex={pattern:Wt.pattern,flags:Wt.flags},Ot;case Ut.num:case Ut.string:return this.parseLiteral(this.value);case Ut._null:case Ut._true:case Ut._false:return Ot=this.startNode(),Ot.value=this.type===Ut._null?null:this.type===Ut._true,Ot.raw=this.type.keyword,this.next(),this.finishNode(Ot,"Literal");case Ut.parenL:var Kt=this.start,Ht=this.parseParenAndDistinguishExpression(Ft,ee);if(K){if(K.parenthesizedAssign<0&&!this.isSimpleAssignTarget(Ht))K.parenthesizedAssign=Kt;if(K.parenthesizedBind<0)K.parenthesizedBind=Kt}return Ht;case Ut.bracketL:return Ot=this.startNode(),this.next(),Ot.elements=this.parseExprList(Ut.bracketR,!0,!0,K),this.finishNode(Ot,"ArrayExpression");case Ut.braceL:return this.overrideContext(an.b_expr),this.parseObj(!1,K);case Ut._function:return Ot=this.startNode(),this.next(),this.parseFunction(Ot,0);case Ut._class:return this.parseClass(this.startNode(),!1);case Ut._new:return this.parseNew();case Ut.backQuote:return this.parseTemplate();case Ut._import:if(this.options.ecmaVersion>=11)return this.parseExprImport(Oe);else return this.unexpected();default:return this.parseExprAtomDefault()}};en.parseExprAtomDefault=function(){this.unexpected()};en.parseExprImport=function(K){var ee=this.startNode();if(this.containsEsc)this.raiseRecoverable(this.start,"Escape sequence in keyword import");if(this.next(),this.type===Ut.parenL&&!K)return this.parseDynamicImport(ee);else if(this.type===Ut.dot){var Oe=this.startNodeAt(ee.start,ee.loc&&ee.loc.start);return Oe.name="import",ee.meta=this.finishNode(Oe,"Identifier"),this.parseImportMeta(ee)}else this.unexpected()};en.parseDynamicImport=function(K){if(this.next(),K.source=this.parseMaybeAssign(),this.options.ecmaVersion>=16)if(!this.eat(Ut.parenR))if(this.expect(Ut.comma),!this.afterTrailingComma(Ut.parenR)){if(K.options=this.parseMaybeAssign(),!this.eat(Ut.parenR)){if(this.expect(Ut.comma),!this.afterTrailingComma(Ut.parenR))this.unexpected()}}else K.options=null;else K.options=null;else if(!this.eat(Ut.parenR)){var ee=this.start;if(this.eat(Ut.comma)&&this.eat(Ut.parenR))this.raiseRecoverable(ee,"Trailing comma is not allowed in import()");else this.unexpected(ee)}return this.finishNode(K,"ImportExpression")};en.parseImportMeta=function(K){this.next();var ee=this.containsEsc;if(K.property=this.parseIdent(!0),K.property.name!=="meta")this.raiseRecoverable(K.property.start,"The only valid meta property for import is 'import.meta'");if(ee)this.raiseRecoverable(K.start,"'import.meta' must not contain escaped characters");if(this.options.sourceType!=="module"&&!this.options.allowImportExportEverywhere)this.raiseRecoverable(K.start,"Cannot use 'import.meta' outside a module");return this.finishNode(K,"MetaProperty")};en.parseLiteral=function(K){var ee=this.startNode();if(ee.value=K,ee.raw=this.input.slice(this.start,this.end),ee.raw.charCodeAt(ee.raw.length-1)===110)ee.bigint=ee.value!=null?ee.value.toString():ee.raw.slice(0,-1).replace(/_/g,"");return this.next(),this.finishNode(ee,"Literal")};en.parseParenExpression=function(){this.expect(Ut.parenL);var K=this.parseExpression();return this.expect(Ut.parenR),K};en.shouldParseArrow=function(K){return!this.canInsertSemicolon()};en.parseParenAndDistinguishExpression=function(K,ee){var Oe=this.start,Ot=this.startLoc,Ft,jt=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var Gt=this.start,Mt=this.startLoc,Vt=[],Wt=!0,Kt=!1,Ht=new Zs,qt=this.yieldPos,zt=this.awaitPos,Xt;this.yieldPos=0,this.awaitPos=0;while(this.type!==Ut.parenR)if(Wt?Wt=!1:this.expect(Ut.comma),jt&&this.afterTrailingComma(Ut.parenR,!0)){Kt=!0;break}else if(this.type===Ut.ellipsis){if(Xt=this.start,Vt.push(this.parseParenItem(this.parseRestBinding())),this.type===Ut.comma)this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");break}else Vt.push(this.parseMaybeAssign(!1,Ht,this.parseParenItem));var Qt=this.lastTokEnd,Jt=this.lastTokEndLoc;if(this.expect(Ut.parenR),K&&this.shouldParseArrow(Vt)&&this.eat(Ut.arrow))return this.checkPatternErrors(Ht,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=qt,this.awaitPos=zt,this.parseParenArrowList(Oe,Ot,Vt,ee);if(!Vt.length||Kt)this.unexpected(this.lastTokStart);if(Xt)this.unexpected(Xt);if(this.checkExpressionErrors(Ht,!0),this.yieldPos=qt||this.yieldPos,this.awaitPos=zt||this.awaitPos,Vt.length>1)Ft=this.startNodeAt(Gt,Mt),Ft.expressions=Vt,this.finishNodeAt(Ft,"SequenceExpression",Qt,Jt);else Ft=Vt[0]}else Ft=this.parseParenExpression();if(this.options.preserveParens){var tn=this.startNodeAt(Oe,Ot);return tn.expression=Ft,this.finishNode(tn,"ParenthesizedExpression")}else return Ft};en.parseParenItem=function(K){return K};en.parseParenArrowList=function(K,ee,Oe,Ot){return this.parseArrowExpression(this.startNodeAt(K,ee),Oe,!1,Ot)};var el=[];en.parseNew=function(){if(this.containsEsc)this.raiseRecoverable(this.start,"Escape sequence in keyword new");var K=this.startNode();if(this.next(),this.options.ecmaVersion>=6&&this.type===Ut.dot){var ee=this.startNodeAt(K.start,K.loc&&K.loc.start);ee.name="new",K.meta=this.finishNode(ee,"Identifier"),this.next();var Oe=this.containsEsc;if(K.property=this.parseIdent(!0),K.property.name!=="target")this.raiseRecoverable(K.property.start,"The only valid meta property for new is 'new.target'");if(Oe)this.raiseRecoverable(K.start,"'new.target' must not contain escaped characters");if(!this.allowNewDotTarget)this.raiseRecoverable(K.start,"'new.target' can only be used in functions and class static block");return this.finishNode(K,"MetaProperty")}var Ot=this.start,Ft=this.startLoc;if(K.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),Ot,Ft,!0,!1),K.callee.type==="Super")this.raiseRecoverable(Ot,"Invalid use of 'super'");if(this.eat(Ut.parenL))K.arguments=this.parseExprList(Ut.parenR,this.options.ecmaVersion>=8,!1);else K.arguments=el;return this.finishNode(K,"NewExpression")};en.parseTemplateElement=function(K){var ee=K.isTagged,Oe=this.startNode();if(this.type===Ut.invalidTemplate){if(!ee)this.raiseRecoverable(this.start,"Bad escape sequence in untagged template literal");Oe.value={raw:this.value.replace(/\r\n?/g,`
|
|
4
|
+
`,Oe+1);return ee}function Ki(K,ee,Oe){let Ot=0,Ft=K.length-1;if(ee>=K[Oe])Ot=Oe;else Ft=Oe-1;if(Ot<Ft&&ee<K[Ot+1])Ft=Ot;while(Ot<Ft){let jt=Ot+Ft+1>>>1;if(K[jt]<=ee)Ot=jt;else Ft=jt-1}return Ot}function g(K){return Bs(K),ri=Ki(Dn,K,ri),{line:ri+1,column:K-Dn[ri],character:K}}var Ms=/\r\n?|\n|\u2028|\u2029/g,kc=/[\r\u2028\u2029]/;function xo(K){if(jn===void 0){jn=kc.test(oi)?[]:null,Ms.lastIndex=0;while(jn!==null&&Ms.exec(oi)!==null)jn.push(Ms.lastIndex)}if(jn===null)return Bs(K),Ki(Dn,K,ri);let ee=0,Oe=jn.length;while(ee<Oe){let Ot=ee+Oe>>>1;if(jn[Ot]<=K)ee=Ot+1;else Oe=Ot}return ee}function P(K){let{line:ee,column:Oe}=g(K);return{line:ee,column:Oe}}function vo(K){while(Dn.length<=K+1&&Vn!==Number.POSITIVE_INFINITY)Bs(Vn);if(K>=Dn.length)return;let ee=K+1<Dn.length?Dn[K+1]-1:oi.length;return oi.slice(Dn[K],ee)}function xe(K){let ee,Oe=0;return(Ot)=>(ee??=yo(K),Oe=Ki(ee,Ot,Oe),{line:Oe+1,column:Ot-ee[Oe]})}function Ln(K){return typeof K==="object"&&K!==null&&typeof Xn(K).type==="string"}function Xn(K){return K}function U(K,ee){let Oe=Xn(K);for(let Ot in Oe){let Ft=Oe[Ot];if(Array.isArray(Ft)){for(let jt=0;jt<Ft.length;jt++)if(Ln(Ft[jt]))Ft[jt]=ee(Ft[jt])}else if(Ln(Ft))Oe[Ot]=ee(Ft)}}function ne(K,...ee){if(!ee.some((Oe)=>Oe===K.type))throw Error(`expected ${ee.join(" or ")}, got ${K.type}`)}function Ee(K){let ee=[];return Jn(K,ee),ee}function Jn(K,ee){switch(K.type){case"Identifier":ee.push(K);return;case"ObjectPattern":for(let Oe of K.properties)Jn(Oe.type==="RestElement"?Oe.argument:Oe.value,ee);return;case"ArrayPattern":for(let Oe of K.elements)if(Oe!==null)Jn(Oe,ee);return;case"RestElement":Jn(K.argument,ee);return;case"AssignmentPattern":Jn(K.left,ee);return;case"TSParameterProperty":Jn(K.parameter,ee);return;case"TSAsExpression":case"TSNonNullExpression":case"TSSatisfiesExpression":case"TSTypeAssertion":Jn(K.expression,ee)}}function G(K,ee){if(K.type!=="Identifier")return!1;if(ee===null)return!0;switch(ee.type){case"MemberExpression":return ee.computed||K===ee.object;case"MethodDefinition":return ee.computed;case"Property":case"PropertyDefinition":return ee.computed||K===ee.value;case"ExportSpecifier":case"ImportSpecifier":return K===ee.local;case"MetaProperty":case"ImportAttribute":case"ExportAllDeclaration":case"LabeledStatement":case"BreakStatement":case"ContinueStatement":return!1;case"TSAsExpression":case"TSSatisfiesExpression":case"TSTypeAssertion":case"TSNonNullExpression":case"TSInstantiationExpression":case"TSExportAssignment":return K===ee.expression;case"TSEnumMember":return K===ee.initializer;case"TSParameterProperty":case"TSEnumDeclaration":case"TSImportEqualsDeclaration":return!0;default:return!ee.type.startsWith("TS")}}var Yn={Root:["module","instance","fragment","css"],Script:["attributes","content"],Fragment:["nodes"],Text:[],Comment:[],ExpressionTag:["expression"],HtmlTag:["expression"],ConstTag:["declaration"],DeclarationTag:["declaration"],DebugTag:["identifiers"],RenderTag:["expression"],AttachTag:["expression"],Attribute:["value"],SpreadAttribute:["expression"],AnimateDirective:["expression"],BindDirective:["expression"],ClassDirective:["expression"],LetDirective:["expression"],OnDirective:["expression"],StyleDirective:["value"],TransitionDirective:["expression"],UseDirective:["expression"],Component:["attributes","fragment"],TitleElement:["attributes","fragment"],SlotElement:["attributes","fragment"],RegularElement:["attributes","fragment"],SvelteBody:["attributes","fragment"],SvelteBoundary:["attributes","fragment"],SvelteComponent:["expression","attributes","fragment"],SvelteDocument:["attributes","fragment"],SvelteElement:["tag","attributes","fragment"],SvelteFragment:["attributes","fragment"],SvelteHead:["attributes","fragment"],SvelteOptions:["attributes","fragment"],SvelteSelf:["attributes","fragment"],SvelteWindow:["attributes","fragment"],IfBlock:["test","consequent","alternate"],EachBlock:["expression","context","key","body","fallback"],AwaitBlock:["expression","pending","value","then","error","catch"],KeyBlock:["expression","fragment"],SnippetBlock:["expression","parameters","body"],StyleSheet:["attributes","children"],Rule:["prelude","block"],Atrule:["block"],SelectorList:["children"],ComplexSelector:["children"],RelativeSelector:["combinator","selectors"],Combinator:[],TypeSelector:[],IdSelector:[],ClassSelector:[],AttributeSelector:[],PseudoElementSelector:["args"],PseudoClassSelector:["args"],Percentage:[],Nth:[],NestingSelector:[],Block:["children"],Declaration:[],Program:["body"],ExpressionStatement:["expression"],BlockStatement:["body"],StaticBlock:["body"],EmptyStatement:[],DebuggerStatement:[],WithStatement:["object","body"],ReturnStatement:["argument"],LabeledStatement:["label","body"],BreakStatement:["label"],ContinueStatement:["label"],IfStatement:["test","consequent","alternate"],SwitchStatement:["discriminant","cases"],SwitchCase:["test","consequent"],ThrowStatement:["argument"],TryStatement:["block","handler","finalizer"],CatchClause:["param","body"],WhileStatement:["test","body"],DoWhileStatement:["body","test"],ForStatement:["init","test","update","body"],ForInStatement:["left","right","body"],ForOfStatement:["left","right","body"],FunctionDeclaration:["id","typeParameters","params","returnType","body"],FunctionExpression:["id","typeParameters","params","returnType","body"],ArrowFunctionExpression:["typeParameters","params","returnType","body"],VariableDeclaration:["declarations"],VariableDeclarator:["id","init"],ClassDeclaration:["decorators","id","typeParameters","superClass","superTypeParameters","implements","body"],ClassExpression:["decorators","id","typeParameters","superClass","superTypeParameters","implements","body"],ClassBody:["body"],MethodDefinition:["decorators","key","typeParameters","value"],PropertyDefinition:["decorators","key","typeAnnotation","value"],Property:["decorators","key","value"],ThisExpression:[],Super:[],Literal:[],Identifier:["decorators","typeAnnotation"],PrivateIdentifier:[],ArrayExpression:["elements"],ObjectExpression:["properties"],UnaryExpression:["argument"],UpdateExpression:["argument"],BinaryExpression:["left","right"],LogicalExpression:["left","right"],AssignmentExpression:["left","right"],MemberExpression:["object","property"],ConditionalExpression:["test","consequent","alternate"],CallExpression:["callee","typeArguments","arguments"],NewExpression:["callee","typeArguments","arguments"],SequenceExpression:["expressions"],TemplateLiteral:["quasis","expressions"],TaggedTemplateExpression:["tag","typeArguments","quasi"],TemplateElement:[],SpreadElement:["argument"],RestElement:["decorators","argument","typeAnnotation"],YieldExpression:["argument"],AwaitExpression:["argument"],ImportExpression:["source","options","arguments"],ChainExpression:["expression"],ParenthesizedExpression:["expression"],MetaProperty:["meta","property"],ObjectPattern:["decorators","properties","typeAnnotation"],ArrayPattern:["decorators","elements","typeAnnotation"],AssignmentPattern:["decorators","left","right"],ImportDeclaration:["specifiers","source","attributes"],ImportSpecifier:["imported","local"],ImportDefaultSpecifier:["local"],ImportNamespaceSpecifier:["local"],ImportAttribute:["key","value"],ExportNamedDeclaration:["declaration","specifiers","source","attributes"],ExportSpecifier:["local","exported"],ExportDefaultDeclaration:["declaration"],ExportAllDeclaration:["exported","source","attributes"],Decorator:["expression"],TSTypeAnnotation:["typeAnnotation"],TSTypeParameterDeclaration:["params"],TSTypeParameterInstantiation:["params"],TSTypeParameter:["constraint","default"],TSAnyKeyword:[],TSBigIntKeyword:[],TSBooleanKeyword:[],TSNeverKeyword:[],TSNullKeyword:[],TSNumberKeyword:[],TSObjectKeyword:[],TSStringKeyword:[],TSSymbolKeyword:[],TSUndefinedKeyword:[],TSUnknownKeyword:[],TSVoidKeyword:[],TSThisType:[],TSArrayType:["elementType"],TSTupleType:["elementTypes"],TSNamedTupleMember:["label","elementType"],TSOptionalType:["typeAnnotation"],TSRestType:["typeAnnotation"],TSUnionType:["types"],TSIntersectionType:["types"],TSConditionalType:["checkType","extendsType","trueType","falseType"],TSInferType:["typeParameter"],TSParenthesizedType:["typeAnnotation"],TSTypeOperator:["typeAnnotation"],TSIndexedAccessType:["objectType","indexType"],TSMappedType:["typeParameter","nameType","typeAnnotation"],TSLiteralType:["literal"],TSTypeReference:["typeName","typeArguments"],TSQualifiedName:["left","right"],TSTypeQuery:["exprName","typeArguments"],TSImportType:["argument","qualifier","typeArguments"],TSTypeLiteral:["members"],TSPropertySignature:["key","typeAnnotation"],TSMethodSignature:["key","typeParameters","parameters","typeAnnotation"],TSCallSignatureDeclaration:["typeParameters","parameters","typeAnnotation"],TSConstructSignatureDeclaration:["typeParameters","parameters","typeAnnotation"],TSFunctionType:["typeParameters","parameters","typeAnnotation"],TSConstructorType:["typeParameters","parameters","typeAnnotation"],TSIndexSignature:["decorators","parameters","typeAnnotation"],TSTypePredicate:["parameterName","typeAnnotation"],TSInterfaceDeclaration:["id","typeParameters","extends","body"],TSInterfaceBody:["body"],TSExpressionWithTypeArguments:["expression","typeParameters"],TSTypeAliasDeclaration:["id","typeParameters","typeAnnotation"],TSEnumDeclaration:["id","members"],TSEnumMember:["id","initializer"],TSModuleDeclaration:["id","body"],TSModuleBlock:["body"],TSImportEqualsDeclaration:["id","moduleReference"],TSExternalModuleReference:["expression"],TSExportAssignment:["expression"],TSNamespaceExportDeclaration:["id"],TSDeclareFunction:["id","typeParameters","params","returnType"],TSDeclareMethod:["typeParameters","params","returnType"],TSParameterProperty:["parameter"],TSAsExpression:["expression","typeAnnotation"],TSSatisfiesExpression:["expression","typeAnnotation"],TSTypeAssertion:["typeAnnotation","expression"],TSNonNullExpression:["expression"],TSInstantiationExpression:["expression","typeArguments"]};var rn=[],ai={...Yn,FunctionDeclaration:["id","params","body"],FunctionExpression:["id","params","body"],ArrowFunctionExpression:["params","body"],ClassDeclaration:["decorators","id","superClass","body"],ClassExpression:["decorators","id","superClass","body"],MethodDefinition:["decorators","key","value"],PropertyDefinition:["decorators","key","value"],Identifier:["decorators"],CallExpression:["callee","arguments"],NewExpression:["callee","arguments"],TaggedTemplateExpression:["tag","quasi"],RestElement:["decorators","argument"],ObjectPattern:["decorators","properties"],ArrayPattern:["decorators","elements"],TSTypeAnnotation:rn,TSTypeParameterDeclaration:rn,TSTypeParameterInstantiation:rn,TSTypeParameter:rn,TSArrayType:rn,TSTupleType:rn,TSNamedTupleMember:rn,TSOptionalType:rn,TSRestType:rn,TSUnionType:rn,TSIntersectionType:rn,TSConditionalType:rn,TSInferType:rn,TSParenthesizedType:rn,TSTypeOperator:rn,TSIndexedAccessType:rn,TSMappedType:rn,TSLiteralType:rn,TSTypeReference:rn,TSTypeQuery:rn,TSImportType:rn,TSTypeLiteral:rn,TSPropertySignature:rn,TSMethodSignature:rn,TSCallSignatureDeclaration:rn,TSConstructSignatureDeclaration:rn,TSFunctionType:rn,TSConstructorType:rn,TSIndexSignature:rn,TSTypePredicate:rn,TSInterfaceDeclaration:rn,TSInterfaceBody:rn,TSExpressionWithTypeArguments:rn,TSTypeAliasDeclaration:rn,TSNamespaceExportDeclaration:rn,TSDeclareFunction:["id"],TSDeclareMethod:rn,TSAsExpression:["expression"],TSSatisfiesExpression:["expression"],TSTypeAssertion:["expression"],TSInstantiationExpression:["expression"]},Ac=Object.assign(Object.create(null),Yn),Pc=Object.assign(Object.create(null),ai),Eo=[],x=Symbol("sveast.walk.stop"),p=Symbol("sveast.walk.skip");function o(K,ee,Oe){Hi(K,null,null,null,ee,_c(Oe))}function _c(K){if(K===void 0||K===Yn)return Nc;if(K===ai)return Dc;return(ee)=>$c(K,ee.type)}function $c(K,ee){return Object.hasOwn(K,ee)?K[ee]:void 0}var hm=Object.freeze([]);function Hi(K,ee,Oe,Ot,Ft,jt){let Gt=jt(K);if(Gt===void 0)throw Error(`unknown node type: ${K.type}`);let Mt=Ft.enter?.(K,ee,Oe,Ot);if(Mt===x)return!0;if(Mt!==p){if(Mt!==K&&Ln(Mt))return Rc(Mt,ee,Oe,Ot,Ft,jt);let Vt=Xn(K);for(let Wt=0;Wt<Gt.length;Wt++){let Kt=Gt[Wt],Ht=Vt[Kt];if(Array.isArray(Ht))for(let qt=0;qt<Ht.length;qt++){let zt=Ht[qt];if(Ln(zt)&&Hi(zt,K,Kt,qt,Ft,jt))return!0}else if(Ln(Ht)&&Hi(Ht,K,Kt,null,Ft,jt))return!0}}return Ft.leave?.(K,ee,Oe,Ot)===x}function Nc(K){let ee=K.type;if(ee==="Identifier")return K.typeAnnotation===void 0&&K.decorators===void 0?Eo:Yn.Identifier;if(ee==="Literal")return Yn.Literal;if(ee==="Text")return Yn.Text;return Ac[ee]}function Dc(K){let ee=K.type;if(ee==="Identifier")return K.decorators===void 0?Eo:ai.Identifier;if(ee==="Literal")return ai.Literal;if(ee==="Text")return ai.Text;return Pc[ee]}function Rc(K,ee,Oe,Ot,Ft,jt){if(ee===null||Oe===null)throw Error("walk can't replace the node it was called with");let Gt=Xn(ee),Mt=Gt[Oe];if(Ot===null)Gt[Oe]=K;else if(Array.isArray(Mt))Mt[Ot]=K;return Hi(K,ee,Oe,Ot,Ft,jt)}function r(K){return typeof K==="object"&&K!==null}function S(K){return r(K)&&K.type==="Literal"}function t(K){return r(K)&&K.type==="Identifier"&&typeof K.name==="string"}function k(K){return r(K)&&K.type==="MemberExpression"}function l(K){return r(K)&&K.type==="ObjectExpression"&&Array.isArray(K.properties)}function Ic(K){return r(K)&&K.type==="CallExpression"}function d(K,ee){return Ic(K)&&t(K.callee)&&K.callee.name===ee}function b(K){return K?.type==="TSAsExpression"||K?.type==="TSSatisfiesExpression"?b(K.expression):K}function Me(K){return K?.type==="TSAsExpression"||K?.type==="TSSatisfiesExpression"?K.typeAnnotation:void 0}function Oc(K){return r(K)&&K.type==="NewExpression"}function Se(K,ee){return Oc(K)&&t(K.callee)&&K.callee.name===ee}function w(K){if(!r(K))return null;if(K.type==="Literal")return K.value==null?null:String(K.value);if(K.type==="TemplateLiteral"){let ee=K.quasis;if(ee?.length===1)return ee[0]?.value?.cooked??null}return null}function c(K){if(t(K))return K.name;if(S(K))return K.value==null?void 0:String(K.value);return}var Lc=new Set(["Component","SvelteComponent","SvelteSelf"]),Mc=new Set(["RegularElement","SvelteElement"]);function L(K){return Lc.has(K)}function A(K){return Mc.has(K)}function qi(K,ee,Oe=0,Ot=K.length,Ft=0){let jt=Ft;for(let Gt=Oe;Gt<Ot;Gt++){let Mt=K.charCodeAt(Gt);if(Mt===34||Mt===39||Mt===96){Gt=Fc(K,Gt,Ot);continue}if(Mt===123||Mt===40||Mt===91||Mt===60)jt++;else if(Mt===125||Mt===41||Mt===93||Mt===62&&K.charCodeAt(Gt-1)!==61){if(jt>0)jt--}if(ee?.(Gt,jt)===!0)break}return jt}function Fc(K,ee,Oe){let Ot=K.charCodeAt(ee);for(let Ft=ee+1;Ft<Oe;Ft++){let jt=K.charCodeAt(Ft);if(jt===92)Ft++;else if(jt===Ot)return Ft}return Oe-1}function i(K,ee){let Oe=[],Ot=0;return qi(K,(Ft,jt)=>{if(jt===0&&ee.includes(K[Ft]))Oe.push(K.slice(Ot,Ft)),Ot=Ft+1;return!1}),Oe.push(K.slice(Ot)),Oe}function js(K,ee,Oe=0){let Ot=-1;return qi(K,(Ft,jt)=>{if(ee(Ft,jt))Ot=Ft;return Ot!==-1},Oe),Ot}function W(K,ee){return js(K,(Oe,Ot)=>Ot===0&&ee.includes(K[Oe]))}function v(K){return js(K,(ee,Oe)=>Oe===0&&K[ee]==="="&&K[ee+1]===">")}function C(K,ee){return js(K,(Oe,Ot)=>Ot===0,ee)}function Vs(K){let ee=K.trim();return ee.startsWith("[")&&C(ee,0)===ee.length-1}function re(K){if(!K)return;let ee=v(K);if(ee===-1)return;return K.slice(ee+2).trim()||void 0}var Bc=new Set(["null","undefined"]);function ie(K){if(!K)return!1;let ee=i(K,"|").map((Ot)=>Ot.trim()).filter((Ot)=>Ot&&!Bc.has(Ot));if(ee.length!==1)return!1;let[Oe]=ee;while(Oe.startsWith("(")&&C(Oe,0)===Oe.length-1)Oe=Oe.slice(1,-1).trim();return(Oe.startsWith("(")||Oe.startsWith("<"))&&v(Oe)!==-1}function jc(K){let ee="";for(let Oe=0;Oe<K.length;Oe++){let Ot=K[Oe];if(Ot==="*"&&K[Oe+1]==="*"){if(Oe++,K[Oe+1]==="/")ee+="(?:.*/)?",Oe++;else ee+=".*";continue}if(Ot==="*"){ee+="[^/]*";continue}if(Ot==="?"){ee+="[^/]";continue}ee+=".+^$()[]{}|\\".includes(Ot)?`\\${Ot}`:Ot}return ee}function So(K,ee){return new RegExp(`^${jc(K)}$`).test(ee)}var Gs={"prop-unknown-type":{severity:"warning",label:"Props without inferred types"},"context-any-type":{severity:"warning",label:"Context values typed as `any`"},"slot-missing-type":{severity:"warning",label:"@slot/@snippet tags missing a {Type} annotation"},"slot-not-rendered":{severity:"warning",label:"@slot/@snippet tags for slots the component doesn't render"},"event-no-source":{severity:"warning",label:"@event tags with no dispatch or callback"},"dispatch-escapes":{severity:"warning",label:"Dispatchers passed to functions sveld can't follow"},"example-compile-error":{severity:"error",label:"@example blocks that failed to compile"},"example-syntax-error":{severity:"error",label:"@example blocks that failed to parse"},"syntax-skipped":{severity:"error",label:"Component syntax sveld skipped"},"type-syntax-error":{severity:"error",label:"JSDoc types that aren't valid TypeScript"},"rest-props-unresolved":{severity:"warning",label:"$$restProps spread only onto components"},"context-duplicate-key":{severity:"warning",label:"Duplicate setContext keys"},"context-key-unresolved":{severity:"warning",label:"setContext keys sveld couldn't resolve"},"context-value-unresolved":{severity:"warning",label:"setContext values sveld couldn't describe"},"spread-unresolved":{severity:"warning",label:"Unresolved spreads widened to Record<string, any>"},"export-unresolved":{severity:"warning",label:"Unresolved named export specifiers"},"module-export-conflict":{severity:"warning",label:"Module-script exports colliding with generated names"},"extend-props-target-missing":{severity:"error",label:"@extends/@extendProps targets that couldn't be verified"},"extend-props-duplicate":{severity:"warning",label:"Duplicate @extends/@extendProps tags"},"extend-props-override":{severity:"warning",label:"Own props overriding an @extends target's prop"},"jsdoc-unknown-tag":{severity:"warning",label:"Unknown JSDoc tags"},"typedef-duplicate":{severity:"warning",label:"Duplicate @typedef/@callback names"},"property-duplicate":{severity:"warning",label:"Duplicate @property names"},"generics-conflict":{severity:"warning",label:"Duplicate @generics/@template names"},"event-description-ambiguous":{severity:"warning",label:"Text after an @event read as the next tag's description"},"jsdoc-tag-dropped":{severity:"warning",label:"Passthrough JSDoc tags that couldn't attach"},"internal-typedef-referenced":{severity:"error",label:"Public types referencing an @internal typedef"},"cross-file-unresolved":{severity:"warning",label:"Imports a standalone parse couldn't read"},"export-ambiguous":{severity:"warning",label:"Ambiguous `export *` names left out of the entry exports"}};function a(K){return{...K,code:H[K.kind],severity:Gs[K.kind].severity}}function Co(K,ee){if(ee)return K;return K.filter((Oe)=>Oe.kind!=="jsdoc-unknown-tag")}function bo(K,ee){if(!ee)return[];return K.filter((Oe)=>!Oe.ignored&&(ee!=="errors"||Oe.severity==="error"))}function Vc(K,ee){if(ee.code!==void 0&&ee.code!==K.code)return!1;if(ee.name!==void 0&&ee.name!==K.name)return!1;if(ee.component!==void 0&&!So(ee.component,K.component))return!1;return!0}function wo(K,ee){if(!ee||ee.length===0)return K;return K.map((Oe)=>Oe.ignored||ee.some((Ot)=>Vc(Oe,Ot))?{...Oe,ignored:!0}:Oe)}var To=Object.keys(Gs),H=Object.fromEntries(To.map((K)=>[K,`sveld/${K}`]));function ko(K){let ee=new Set,Oe=[];for(let Ot of K){let Ft=`${Ot.component}:${Ot.kind}:${Ot.name}`;if(ee.has(Ft))continue;ee.add(Ft),Oe.push(Ot)}return Oe}function Ao(K){let ee=K.filter((Vt)=>!Vt.ignored),Oe=K.length-ee.length,Ot=Oe>0?` (${Oe} ignored)`:"";if(ee.length===0)return`sveld: no diagnostics${Ot}.`;let Ft=[],jt=(Vt,Wt)=>`${Vt} ${Wt}${Vt===1?"":"s"}`,Gt=ee.filter((Vt)=>Vt.severity==="error").length,Mt=`${jt(Gt,"error")}, ${jt(ee.length-Gt,"warning")}`;Ft.push(`sveld: ${jt(ee.length,"diagnostic")} (${Mt})${Ot}.`);for(let Vt of To){let Wt=ee.filter((Ht)=>Ht.kind===Vt);if(Wt.length===0)continue;Ft.push(""),Ft.push(`${Gs[Vt].label} (${Wt.length}):`);let Kt=new Map;for(let Ht of Wt){let qt=Kt.get(Ht.component)??[];qt.push(Ht),Kt.set(Ht.component,qt)}for(let[Ht,qt]of Kt){Ft.push(` ${Ht}`);for(let zt of qt){let Xt=zt.source?` (${Ht}:${zt.source.start.line}:${zt.source.start.column})`:"";Ft.push(` - ${zt.message}${Xt} [${zt.code}]`)}}}return Ft.join(`
|
|
5
|
+
`)}var $e=1;function Po(K){return`${JSON.stringify({kind:"diagnostics",schemaVersion:$e,diagnostics:K},null,2)}
|
|
6
|
+
`}function pi(K,ee){if(ee.length===0)return;K.diagnostics=[...K.diagnostics??[],...ee]}var Gc=/\*\//g,Wc=/[.*+?^${}()|[\]\\]/g;function _(K){return K.replace(Wc,"\\$&")}function O(K){return K.replace(Gc,"*\\/")}function y(K){return K.map((ee)=>`${ee.name}${ee.optional?"?":""}: ${ee.type}`).join(", ")}var Uc=new Intl.Collator("en");function u(K,ee){return Uc.compare(K,ee)}var Kc=/(?:_|[^\p{ID_Continue}$])+/u,Hc=/^[\p{ID_Start}$]/u;function z(K){let Ot=`${K.split(Kc).map((Ft)=>Ft.charAt(0).toUpperCase()+Ft.slice(1)).join("")}Context`;return Hc.test(Ot)?Ot:`_${Ot}`}function se({imported:K}){return K.type==="Identifier"?K.name:K.value}function X(K,ee){let Oe=ee.source.value;if(typeof Oe!=="string"||ee.importKind==="type")return;for(let Ot of ee.specifiers){if(Ot.type!=="ImportSpecifier"||Ot.importKind==="type")continue;let Ft=Ot.local.name,jt=se(Ot);K.valueImportBindingsByLocalName.set(Ft,{localName:Ft,importedName:jt,source:Oe})}}function oe(K){return[K.importedName,...K.members??[]].join(".")}function ke(K,ee){let Oe=[],Ot=ee;while(k(Ot)){if(Ot.computed||!t(Ot.property))return;Oe.unshift(Ot.property.name),Ot=Ot.object}if(!t(Ot))return;return Q(K,Ot.name,Oe)}function Q(K,ee,Oe=[]){let Ot=(jt,Gt,Mt)=>Mt.length>0?{source:jt,importedName:Gt,members:Mt}:{source:jt,importedName:Gt},Ft=K.valueImportBindingsByLocalName.get(ee);if(Ft)return Ot(Ft.source,Ft.importedName,Oe);for(let jt of[K.parsed?.instance,K.parsed?.module])for(let Gt of jt?.content.body??[]){if(Gt.type!=="ImportDeclaration")continue;let Mt=Gt.source.value;if(Gt.importKind==="type"||typeof Mt!=="string")continue;let Vt=Gt.specifiers.find((Wt)=>Wt.local.name===ee);if(Vt?.type==="ImportDefaultSpecifier")return Ot(Mt,"default",Oe);if(Vt?.type==="ImportNamespaceSpecifier"&&Oe.length>0)return Ot(Mt,Oe[0],Oe.slice(1))}return}function ae(K,ee){if(!k(ee))return;return ke(K,ee)}function Be(K){let ee=new Map;for(let Oe of K.content.body){if(Oe.type!=="ImportDeclaration"||Oe.importKind==="type")continue;let Ot=Oe.source.value;if(typeof Ot!=="string")continue;for(let Ft of Oe.specifiers){if(Ft.type==="ImportSpecifier"&&Ft.importKind==="type")continue;let jt=Ft.local.name,Gt;if(Ft.type==="ImportDefaultSpecifier")Gt="default";else if(Ft.type==="ImportNamespaceSpecifier")Gt="*";else Gt=se(Ft);ee.set(jt,{from:Ot,imported:Gt})}}return ee}function be(K,ee){for(let Oe of ee?.content.body??[]){if(Oe.type==="ImportDeclaration"){X(K,Oe);continue}let Ot=Oe.type==="ExportNamedDeclaration"&&Oe.declaration?Oe.declaration:Oe;if(Ot.type==="FunctionDeclaration"&&Ot.id?.name)K.funcDecls.set(Ot.id.name,Ot)}}function ce(K){return K==="TSTypeAnnotation"||K==="TSTypeAliasDeclaration"||K==="TSInterfaceDeclaration"||K==="TSTypeParameterDeclaration"||K==="TSTypeParameterInstantiation"}function Y(K){let ee=[];return o(K,{enter(Oe){if(Oe.type==="FunctionDeclaration"||Oe.type==="FunctionExpression"||Oe.type==="ArrowFunctionExpression")return p;if(Oe.type==="ReturnStatement")ee.push(Oe.argument??null)}}),ee}var Ws={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"},Us="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",qc={5:Us,"5module":Us+" export import",6:Us+" const class extends export import super"},Ro=/^in(stanceof)?$/,zc=/\p{ID_Start}/u,Xc=/[\p{ID_Continue}\u200c\u200d]/u;function m(K,ee){if(K<65)return K===36;if(K<91)return!0;if(K<97)return K===95;if(K<123)return!0;if(K>65535&&ee===!1)return!1;return K>=170&&zc.test(String.fromCodePoint(K))}function E(K,ee){if(K<48)return K===36;if(K<58)return!0;if(K<65)return!1;if(K<91)return!0;if(K<97)return K===95;if(K<123)return!0;if(K>65535&&ee===!1)return!1;return K>=170&&Xc.test(String.fromCodePoint(K))}var an=function(K,ee){if(ee===void 0)ee={};this.label=K,this.keyword=ee.keyword,this.beforeExpr=!!ee.beforeExpr,this.startsExpr=!!ee.startsExpr,this.isLoop=!!ee.isLoop,this.isAssign=!!ee.isAssign,this.prefix=!!ee.prefix,this.postfix=!!ee.postfix,this.binop=ee.binop||null,this.updateContext=null};function Cn(K,ee){return new an(K,{beforeExpr:!0,binop:ee})}var bn={beforeExpr:!0},xn={startsExpr:!0},zs={};function on(K,ee){if(ee===void 0)ee={};return ee.keyword=K,zs[K]=new an(K,ee)}var Ut={num:new an("num",xn),regexp:new an("regexp",xn),string:new an("string",xn),name:new an("name",xn),privateId:new an("privateId",xn),eof:new an("eof"),bracketL:new an("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new an("]"),braceL:new an("{",{beforeExpr:!0,startsExpr:!0}),braceR:new an("}"),parenL:new an("(",{beforeExpr:!0,startsExpr:!0}),parenR:new an(")"),comma:new an(",",bn),semi:new an(";",bn),colon:new an(":",bn),dot:new an("."),question:new an("?",bn),questionDot:new an("?."),arrow:new an("=>",bn),template:new an("template"),invalidTemplate:new an("invalidTemplate"),ellipsis:new an("...",bn),backQuote:new an("`",xn),dollarBraceL:new an("${",{beforeExpr:!0,startsExpr:!0}),eq:new an("=",{beforeExpr:!0,isAssign:!0}),assign:new an("_=",{beforeExpr:!0,isAssign:!0}),incDec:new an("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new an("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:Cn("||",1),logicalAND:Cn("&&",2),bitwiseOR:Cn("|",3),bitwiseXOR:Cn("^",4),bitwiseAND:Cn("&",5),equality:Cn("==/!=/===/!==",6),relational:Cn("</>/<=/>=",7),bitShift:Cn("<</>>/>>>",8),plusMin:new an("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:Cn("%",10),star:Cn("*",10),slash:Cn("/",10),starstar:new an("**",{beforeExpr:!0}),coalesce:Cn("??",1),_break:on("break"),_case:on("case",bn),_catch:on("catch"),_continue:on("continue"),_debugger:on("debugger"),_default:on("default",bn),_do:on("do",{isLoop:!0,beforeExpr:!0}),_else:on("else",bn),_finally:on("finally"),_for:on("for",{isLoop:!0}),_function:on("function",xn),_if:on("if"),_return:on("return",bn),_switch:on("switch"),_throw:on("throw",bn),_try:on("try"),_var:on("var"),_const:on("const"),_while:on("while",{isLoop:!0}),_with:on("with"),_new:on("new",{beforeExpr:!0,startsExpr:!0}),_this:on("this",xn),_super:on("super",xn),_class:on("class",xn),_extends:on("extends",bn),_export:on("export"),_import:on("import",xn),_null:on("null",xn),_true:on("true",xn),_false:on("false",xn),_in:on("in",{beforeExpr:!0,binop:7}),_instanceof:on("instanceof",{beforeExpr:!0,binop:7}),_typeof:on("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:on("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:on("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},vn=/\r\n?|\n|\u2028|\u2029/,Jc=new RegExp(vn.source,"g");function ci(K){return K===10||K===13||K===8232||K===8233}function Io(K,ee,Oe){if(Oe===void 0)Oe=K.length;for(var Ot=ee;Ot<Oe;Ot++){var Ft=K.charCodeAt(Ot);if(ci(Ft))return Ot<Oe-1&&Ft===13&&K.charCodeAt(Ot+1)===10?Ot+2:Ot+1}return-1}var Oo=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,hn=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,Yc=Object.prototype,{hasOwnProperty:Qc,toString:Zc}=Yc,Ei=Object.hasOwn||function(K,ee){return Qc.call(K,ee)},_o=Array.isArray||function(K){return Zc.call(K)==="[object Array]"},$o=Object.create(null);function zi(K){return $o[K]||($o[K]=new RegExp("^(?:"+K.replace(/ /g,"|")+")$"))}function Qi(K){if(K<=65535)return String.fromCharCode(K);return K-=65536,String.fromCharCode((K>>10)+55296,(K&1023)+56320)}var el=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,vi=function(K,ee){this.line=K,this.column=ee};vi.prototype.offset=function(K){return new vi(this.line,this.column+K)};var Zi=function(K,ee,Oe){if(this.start=ee,this.end=Oe,K.sourceFile!==null)this.source=K.sourceFile};function Lo(K,ee){for(var Oe=1,Ot=0;;){var Ft=Io(K,Ot,ee);if(Ft<0)return new vi(Oe,ee-Ot);++Oe,Ot=Ft}}var Ks={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},No=!1;function tl(K){var ee={};for(var Oe in Ks)ee[Oe]=K&&Ei(K,Oe)?K[Oe]:Ks[Oe];if(ee.ecmaVersion==="latest")ee.ecmaVersion=1e8;else if(ee.ecmaVersion==null){if(!No&&typeof console==="object"&&console.warn)No=!0,console.warn(`Since Acorn 8.0.0, options.ecmaVersion is required.
|
|
7
|
+
Defaulting to 2020, but this will stop working in the future.`);ee.ecmaVersion=11}else if(ee.ecmaVersion>=2015)ee.ecmaVersion-=2009;if(ee.allowReserved==null)ee.allowReserved=ee.ecmaVersion<5;if(!K||K.allowHashBang==null)ee.allowHashBang=ee.ecmaVersion>=14;if(_o(ee.onToken)){var Ot=ee.onToken;ee.onToken=function(Ft){return Ot.push(Ft)}}if(_o(ee.onComment))ee.onComment=nl(ee,ee.onComment);if(ee.sourceType==="commonjs"&&ee.allowAwaitOutsideFunction)throw Error("Cannot use allowAwaitOutsideFunction with sourceType: commonjs");return ee}function nl(K,ee){return function(Oe,Ot,Ft,jt,Gt,Mt){var Vt={type:Oe?"Block":"Line",value:Ot,start:Ft,end:jt};if(K.locations)Vt.loc=new Zi(this,Gt,Mt);if(K.ranges)Vt.range=[Ft,jt];ee.push(Vt)}}var Qn=1,Zn=2,Xs=4,Mo=8,Js=16,Fo=32,es=64,Bo=128,ei=256,Si=512,jo=1024,ts=Qn|Zn|ei;function Ys(K,ee){return Zn|(K?Xs:0)|(ee?Mo:0)}var Xi=0,Qs=1,Mn=2,Vo=3,Go=4,Wo=5,s=function(K,ee,Oe){this.options=K=tl(K),this.sourceFile=K.sourceFile,this.keywords=zi(qc[K.ecmaVersion>=6?6:K.sourceType==="module"?"5module":5]);var Ot="";if(K.allowReserved!==!0){if(Ot=Ws[K.ecmaVersion>=6?6:K.ecmaVersion===5?5:3],K.sourceType==="module")Ot+=" await"}this.reservedWords=zi(Ot);var Ft=(Ot?Ot+" ":"")+Ws.strict;if(this.reservedWordsStrict=zi(Ft),this.reservedWordsStrictBind=zi(Ft+" "+Ws.strictBind),this.input=String(ee),this.containsEsc=!1,this.pos=Oe||0,this.curLine=1,K.startLocation)this.lineStart=this.pos-K.startLocation.column,this.curLine=K.startLocation.line;else if(Oe){if(this.lineStart=this.input.lastIndexOf(`
|
|
8
|
+
`,Oe-1)+1,this.options.locations)this.curLine=this.input.slice(0,this.lineStart).split(vn).length}else this.lineStart=0;if(this.type=Ut.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=K.sourceType==="module",this.strict=this.inModule||K.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&&K.allowHashBang&&this.input.slice(0,2)==="#!")this.skipLineComment(2);this.scopeStack=[],this.enterScope(this.options.sourceType==="commonjs"?Zn:Qn),this.regexpState=null,this.privateNameStack=[]},wn={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}};s.prototype.parse=function(){var K=this,ee=this.options.program||this.startNode();return this.nextToken(),this.catchStackOverflow(function(){return K.parseTopLevel(ee)})};wn.inFunction.get=function(){return(this.currentVarScope().flags&Zn)>0};wn.inGenerator.get=function(){return(this.currentVarScope().flags&Mo)>0};wn.inAsync.get=function(){return(this.currentVarScope().flags&Xs)>0};wn.canAwait.get=function(){for(var K=this.scopeStack.length-1;K>=0;K--){var ee=this.scopeStack[K],Oe=ee.flags;if(Oe&(ei|Si))return!1;if(Oe&Zn)return(Oe&Xs)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction};wn.allowReturn.get=function(){if(this.inFunction)return!0;if(this.options.allowReturnOutsideFunction&&this.currentVarScope().flags&Qn)return!0;return!1};wn.allowSuper.get=function(){var K=this.currentThisScope(),ee=K.flags;return(ee&es)>0||this.options.allowSuperOutsideMethod};wn.allowDirectSuper.get=function(){return(this.currentThisScope().flags&Bo)>0};wn.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())};wn.allowNewDotTarget.get=function(){for(var K=this.scopeStack.length-1;K>=0;K--){var ee=this.scopeStack[K],Oe=ee.flags;if(Oe&(ei|Si)||Oe&Zn&&!(Oe&Js))return!0}return!1};wn.allowUsing.get=function(){var K=this.currentScope(),ee=K.flags;if(ee&jo)return!1;if(!this.inModule&&ee&Qn)return!1;return!0};wn.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&ei)>0};s.extend=function(){var K=[],ee=arguments.length;while(ee--)K[ee]=arguments[ee];var Oe=this;for(var Ot=0;Ot<K.length;Ot++)Oe=K[Ot](Oe);return Oe};s.parse=function(K,ee){return new this(ee,K).parse()};s.parseExpressionAt=function(K,ee,Oe){var Ot=new this(Oe,K,ee);return Ot.nextToken(),Ot.parseExpression()};s.tokenizer=function(K,ee){return new this(ee,K)};Object.defineProperties(s.prototype,wn);var mn=s.prototype,il=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;mn.strictDirective=function(K){if(this.options.ecmaVersion<5)return!1;for(;;){hn.lastIndex=K,K+=hn.exec(this.input)[0].length;var ee=il.exec(this.input.slice(K));if(!ee)return!1;if((ee[1]||ee[2])==="use strict"){hn.lastIndex=K+ee[0].length;var Oe=hn.exec(this.input),Ot=Oe.index+Oe[0].length,Ft=this.input.charAt(Ot);return Ft===";"||Ft==="}"||vn.test(Oe[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(Ft)||Ft==="!"&&this.input.charAt(Ot+1)==="=")}if(K+=ee[0].length,hn.lastIndex=K,K+=hn.exec(this.input)[0].length,this.input[K]===";")K++}};mn.eat=function(K){if(this.type===K)return this.next(),!0;else return!1};mn.isContextual=function(K){return this.type===Ut.name&&this.value===K&&!this.containsEsc};mn.eatContextual=function(K){if(!this.isContextual(K))return!1;return this.next(),!0};mn.catchStackOverflow=function(K){try{return K()}catch(ee){if(ee instanceof Error&&(/\bstack\b.*\b(exceeded|overflow)\b/i.test(ee.message)||/\btoo much recursion\b/i.test(ee.message)))this.raise(this.start,"Not enough stack space to parse input");else throw ee}};mn.expectContextual=function(K){if(!this.eatContextual(K))this.unexpected()};mn.canInsertSemicolon=function(){return this.type===Ut.eof||this.type===Ut.braceR||vn.test(this.input.slice(this.lastTokEnd,this.start))};mn.insertSemicolon=function(){if(this.canInsertSemicolon()){if(this.options.onInsertedSemicolon)this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc);return!0}};mn.semicolon=function(){if(!this.eat(Ut.semi)&&!this.insertSemicolon())this.unexpected()};mn.afterTrailingComma=function(K,ee){if(this.type===K){if(this.options.onTrailingComma)this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc);if(!ee)this.next();return!0}};mn.expect=function(K){this.eat(K)||this.unexpected()};mn.unexpected=function(K){this.raise(K!=null?K:this.start,"Unexpected token")};var ns=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};mn.checkPatternErrors=function(K,ee){if(!K)return;if(K.trailingComma>-1)this.raiseRecoverable(K.trailingComma,"Comma is not permitted after the rest element");var Oe=ee?K.parenthesizedAssign:K.parenthesizedBind;if(Oe>-1)this.raiseRecoverable(Oe,ee?"Assigning to rvalue":"Parenthesized pattern")};mn.checkExpressionErrors=function(K,ee){if(!K)return!1;var{shorthandAssign:Oe,doubleProto:Ot}=K;if(!ee)return Oe>=0||Ot>=0;if(Oe>=0)this.raise(Oe,"Shorthand property assignments are valid only in destructuring patterns");if(Ot>=0)this.raiseRecoverable(Ot,"Redefinition of __proto__ property")};mn.checkYieldAwaitInDefaultParams=function(){if(this.yieldPos&&(!this.awaitPos||this.yieldPos<this.awaitPos))this.raise(this.yieldPos,"Yield expression cannot be a default value");if(this.awaitPos)this.raise(this.awaitPos,"Await expression cannot be a default value")};mn.isSimpleAssignTarget=function(K){if(K.type==="ParenthesizedExpression")return this.isSimpleAssignTarget(K.expression);return K.type==="Identifier"||K.type==="MemberExpression"};var Qt=s.prototype;Qt.parseTopLevel=function(K){var ee=Object.create(null);if(!K.body)K.body=[];while(this.type!==Ut.eof){var Oe=this.parseStatement(null,!0,ee);K.body.push(Oe)}if(this.inModule)for(var Ot=0,Ft=Object.keys(this.undefinedExports);Ot<Ft.length;Ot+=1){var jt=Ft[Ot];this.raiseRecoverable(this.undefinedExports[jt].start,"Export '"+jt+"' is not defined")}return this.adaptDirectivePrologue(K.body),this.next(),K.sourceType=this.options.sourceType==="commonjs"?"script":this.options.sourceType,this.finishNode(K,"Program")};var Zs={kind:"loop"},sl={kind:"switch"};Qt.isLet=function(K){if(this.options.ecmaVersion<6||!this.isContextual("let"))return!1;hn.lastIndex=this.pos;var ee=hn.exec(this.input),Oe=this.pos+ee[0].length,Ot=this.fullCharCodeAt(Oe);if(Ot===91||Ot===92)return!0;if(K)return!1;if(Ot===123)return!0;if(m(Ot)){var Ft=Oe;do Oe+=Ot<=65535?1:2;while(E(Ot=this.fullCharCodeAt(Oe)));if(Ot===92)return!0;var jt=this.input.slice(Ft,Oe);if(!Ro.test(jt))return!0}return!1};Qt.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;hn.lastIndex=this.pos;var K=hn.exec(this.input),ee=this.pos+K[0].length,Oe;return!vn.test(this.input.slice(this.pos,ee))&&this.input.slice(ee,ee+8)==="function"&&(ee+8===this.input.length||!(E(Oe=this.fullCharCodeAt(ee+8))||Oe===92))};Qt.isUsingKeyword=function(K,ee){if(this.options.ecmaVersion<17||!this.isContextual(K?"await":"using"))return!1;hn.lastIndex=this.pos;var Oe=hn.exec(this.input),Ot=this.pos+Oe[0].length;if(vn.test(this.input.slice(this.pos,Ot)))return!1;if(K){var Ft=Ot+5,jt;if(this.input.slice(Ot,Ft)!=="using"||Ft===this.input.length||E(jt=this.fullCharCodeAt(Ft))||jt===92)return!1;hn.lastIndex=Ft;var Gt=hn.exec(this.input);if(Ot=Ft+Gt[0].length,Gt&&vn.test(this.input.slice(Ft,Ot)))return!1}var Mt=this.fullCharCodeAt(Ot);if(!m(Mt)&&Mt!==92)return!1;var Vt=Ot;do Ot+=Mt<=65535?1:2;while(E(Mt=this.fullCharCodeAt(Ot)));if(Mt===92)return!0;var Wt=this.input.slice(Vt,Ot);if(Ro.test(Wt))return!1;if(ee&&!K&&Wt==="of"){hn.lastIndex=Ot;var Kt=hn.exec(this.input);if(Ot=Ot+Kt[0].length,this.input.charCodeAt(Ot)!==61||(Mt=this.input.charCodeAt(Ot+1))===61||Mt===62)return!1}return!0};Qt.isAwaitUsing=function(K){return this.isUsingKeyword(!0,K)};Qt.isUsing=function(K){return this.isUsingKeyword(!1,K)};Qt.parseStatement=function(K,ee,Oe){var Ot=this.type,Ft=this.startNode(),jt;if(this.isLet(K))Ot=Ut._var,jt="let";switch(Ot){case Ut._break:case Ut._continue:return this.parseBreakContinueStatement(Ft,Ot.keyword);case Ut._debugger:return this.parseDebuggerStatement(Ft);case Ut._do:return this.parseDoStatement(Ft);case Ut._for:return this.parseForStatement(Ft);case Ut._function:if(K&&(this.strict||K!=="if"&&K!=="label")&&this.options.ecmaVersion>=6)this.unexpected();return this.parseFunctionStatement(Ft,!1,!K);case Ut._class:if(K)this.unexpected();return this.parseClass(Ft,!0);case Ut._if:return this.parseIfStatement(Ft);case Ut._return:return this.parseReturnStatement(Ft);case Ut._switch:return this.parseSwitchStatement(Ft);case Ut._throw:return this.parseThrowStatement(Ft);case Ut._try:return this.parseTryStatement(Ft);case Ut._const:case Ut._var:if(jt=jt||this.value,K&&jt!=="var")this.unexpected();return this.parseVarStatement(Ft,jt);case Ut._while:return this.parseWhileStatement(Ft);case Ut._with:return this.parseWithStatement(Ft);case Ut.braceL:return this.parseBlock(!0,Ft);case Ut.semi:return this.parseEmptyStatement(Ft);case Ut._export:case Ut._import:if(this.options.ecmaVersion>10&&Ot===Ut._import){hn.lastIndex=this.pos;var Gt=hn.exec(this.input),Mt=this.pos+Gt[0].length,Vt=this.input.charCodeAt(Mt);if(Vt===40||Vt===46)return this.parseExpressionStatement(Ft,this.parseExpression())}if(!this.options.allowImportExportEverywhere){if(!ee)this.raise(this.start,"'import' and 'export' may only appear at the top level");if(!this.inModule)this.raise(this.start,"'import' and 'export' may appear only with 'sourceType: module'")}return Ot===Ut._import?this.parseImport(Ft):this.parseExport(Ft,Oe);default:if(this.isAsyncFunction()){if(K)this.unexpected();return this.next(),this.parseFunctionStatement(Ft,!0,!K)}var Wt=this.isAwaitUsing(!1)?"await using":this.isUsing(!1)?"using":null;if(Wt){if(!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");if(K)this.raise(this.start,"Using declaration is not allowed in single-statement positions");if(Wt==="await using"){if(!this.canAwait)this.raise(this.start,"Await using cannot appear outside of async function");this.next()}return this.next(),this.parseVar(Ft,!1,Wt),this.semicolon(),this.finishNode(Ft,"VariableDeclaration")}var Kt=this.value,Ht=this.parseExpression();if(Ot===Ut.name&&Ht.type==="Identifier"&&this.eat(Ut.colon))return this.parseLabeledStatement(Ft,Kt,Ht,K);else return this.parseExpressionStatement(Ft,Ht)}};Qt.parseBreakContinueStatement=function(K,ee){var Oe=ee==="break";if(this.next(),this.eat(Ut.semi)||this.insertSemicolon())K.label=null;else if(this.type!==Ut.name)this.unexpected();else K.label=this.parseIdent(),this.semicolon();var Ot=0;for(;Ot<this.labels.length;++Ot){var Ft=this.labels[Ot];if(K.label==null||Ft.name===K.label.name){if(Ft.kind!=null&&(Oe||Ft.kind==="loop"))break;if(K.label&&Oe)break}}if(Ot===this.labels.length)this.raise(K.start,"Unsyntactic "+ee);return this.finishNode(K,Oe?"BreakStatement":"ContinueStatement")};Qt.parseDebuggerStatement=function(K){return this.next(),this.semicolon(),this.finishNode(K,"DebuggerStatement")};Qt.parseDoStatement=function(K){if(this.next(),this.labels.push(Zs),K.body=this.parseStatement("do"),this.labels.pop(),this.expect(Ut._while),K.test=this.parseParenExpression(),this.options.ecmaVersion>=6)this.eat(Ut.semi);else this.semicolon();return this.finishNode(K,"DoWhileStatement")};Qt.parseForStatement=function(K){this.next();var ee=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(Zs),this.enterScope(0),this.expect(Ut.parenL),this.type===Ut.semi){if(ee>-1)this.unexpected(ee);return this.parseFor(K,null)}var Oe=this.isLet();if(this.type===Ut._var||this.type===Ut._const||Oe){var Ot=this.startNode(),Ft=Oe?"let":this.value;return this.next(),this.parseVar(Ot,!0,Ft),this.finishNode(Ot,"VariableDeclaration"),this.parseForAfterInit(K,Ot,ee)}var jt=this.isContextual("let"),Gt=!1,Mt=this.isUsing(!0)?"using":this.isAwaitUsing(!0)?"await using":null;if(Mt){var Vt=this.startNode();if(this.next(),Mt==="await using"){if(!this.canAwait)this.raise(this.start,"Await using cannot appear outside of async function");this.next()}return this.parseVar(Vt,!0,Mt),this.finishNode(Vt,"VariableDeclaration"),this.parseForAfterInit(K,Vt,ee)}var Wt=this.containsEsc,Kt=new ns,Ht=this.start,qt=ee>-1?this.parseExprSubscripts(Kt,"await"):this.parseExpression(!0,Kt);if(this.type===Ut._in||(Gt=this.options.ecmaVersion>=6&&this.isContextual("of"))){if(ee>-1){if(this.type===Ut._in)this.unexpected(ee);K.await=!0}else if(Gt&&this.options.ecmaVersion>=8){if(qt.start===Ht&&!Wt&&qt.type==="Identifier"&&qt.name==="async")this.unexpected();else if(this.options.ecmaVersion>=9)K.await=!1}if(jt&&Gt)this.raise(qt.start,"The left-hand side of a for-of loop may not start with 'let'.");return this.toAssignable(qt,!1,Kt),this.checkLValPattern(qt),this.parseForIn(K,qt)}else this.checkExpressionErrors(Kt,!0);if(ee>-1)this.unexpected(ee);return this.parseFor(K,qt)};Qt.parseForAfterInit=function(K,ee,Oe){if((this.type===Ut._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&ee.declarations.length===1){if(this.type===Ut._in){if((ee.kind==="using"||ee.kind==="await using")&&!ee.declarations[0].init)this.raise(this.start,"Using declaration is not allowed in for-in loops");if(this.options.ecmaVersion>=9&&Oe>-1)this.unexpected(Oe)}else if(this.options.ecmaVersion>=9)K.await=Oe>-1;return this.parseForIn(K,ee)}if(Oe>-1)this.unexpected(Oe);return this.parseFor(K,ee)};Qt.parseFunctionStatement=function(K,ee,Oe){return this.next(),this.parseFunction(K,xi|(Oe?0:Hs),!1,ee)};Qt.parseIfStatement=function(K){return this.next(),K.test=this.parseParenExpression(),K.consequent=this.parseStatement("if"),K.alternate=this.eat(Ut._else)?this.parseStatement("if"):null,this.finishNode(K,"IfStatement")};Qt.parseReturnStatement=function(K){if(!this.allowReturn)this.raise(this.start,"'return' outside of function");if(this.next(),this.eat(Ut.semi)||this.insertSemicolon())K.argument=null;else K.argument=this.parseExpression(),this.semicolon();return this.finishNode(K,"ReturnStatement")};Qt.parseSwitchStatement=function(K){this.next(),K.discriminant=this.parseParenExpression(),K.cases=[],this.expect(Ut.braceL),this.labels.push(sl),this.enterScope(jo);var ee;for(var Oe=!1;this.type!==Ut.braceR;)if(this.type===Ut._case||this.type===Ut._default){var Ot=this.type===Ut._case;if(ee)this.finishNode(ee,"SwitchCase");if(K.cases.push(ee=this.startNode()),ee.consequent=[],this.next(),Ot)ee.test=this.parseExpression();else{if(Oe)this.raiseRecoverable(this.lastTokStart,"Multiple default clauses");Oe=!0,ee.test=null}this.expect(Ut.colon)}else{if(!ee)this.unexpected();ee.consequent.push(this.parseStatement(null))}if(this.exitScope(),ee)this.finishNode(ee,"SwitchCase");return this.next(),this.labels.pop(),this.finishNode(K,"SwitchStatement")};Qt.parseThrowStatement=function(K){if(this.next(),vn.test(this.input.slice(this.lastTokEnd,this.start)))this.raise(this.lastTokEnd,"Illegal newline after throw");return K.argument=this.parseExpression(),this.semicolon(),this.finishNode(K,"ThrowStatement")};var rl=[];Qt.parseCatchClauseParam=function(){var K=this.parseBindingAtom(),ee=K.type==="Identifier";return this.enterScope(ee?Fo:0),this.checkLValPattern(K,ee?Go:Mn),this.expect(Ut.parenR),K};Qt.parseTryStatement=function(K){if(this.next(),K.block=this.parseBlock(),K.handler=null,this.type===Ut._catch){var ee=this.startNode();if(this.next(),this.eat(Ut.parenL))ee.param=this.parseCatchClauseParam();else{if(this.options.ecmaVersion<10)this.unexpected();ee.param=null,this.enterScope(0)}ee.body=this.parseBlock(!1),this.exitScope(),K.handler=this.finishNode(ee,"CatchClause")}if(K.finalizer=this.eat(Ut._finally)?this.parseBlock():null,!K.handler&&!K.finalizer)this.raise(K.start,"Missing catch or finally clause");return this.finishNode(K,"TryStatement")};Qt.parseVarStatement=function(K,ee,Oe){return this.next(),this.parseVar(K,!1,ee,Oe),this.semicolon(),this.finishNode(K,"VariableDeclaration")};Qt.parseWhileStatement=function(K){return this.next(),K.test=this.parseParenExpression(),this.labels.push(Zs),K.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(K,"WhileStatement")};Qt.parseWithStatement=function(K){if(this.strict)this.raise(this.start,"'with' in strict mode");return this.next(),K.object=this.parseParenExpression(),K.body=this.parseStatement("with"),this.finishNode(K,"WithStatement")};Qt.parseEmptyStatement=function(K){return this.next(),this.finishNode(K,"EmptyStatement")};Qt.parseLabeledStatement=function(K,ee,Oe,Ot){for(var Ft=0,jt=this.labels;Ft<jt.length;Ft+=1){var Gt=jt[Ft];if(Gt.name===ee)this.raise(Oe.start,"Label '"+ee+"' is already declared")}var Mt=this.type.isLoop?"loop":this.type===Ut._switch?"switch":null;for(var Vt=this.labels.length-1;Vt>=0;Vt--){var Wt=this.labels[Vt];if(Wt.statementStart===K.start)Wt.statementStart=this.start,Wt.kind=Mt;else break}return this.labels.push({name:ee,kind:Mt,statementStart:this.start}),K.body=this.parseStatement(Ot?Ot.indexOf("label")===-1?Ot+"label":Ot:"label"),this.labels.pop(),K.label=Oe,this.finishNode(K,"LabeledStatement")};Qt.parseExpressionStatement=function(K,ee){return K.expression=ee,this.semicolon(),this.finishNode(K,"ExpressionStatement")};Qt.parseBlock=function(K,ee,Oe){if(K===void 0)K=!0;if(ee===void 0)ee=this.startNode();if(ee.body=[],this.expect(Ut.braceL),K)this.enterScope(0);while(this.type!==Ut.braceR){var Ot=this.parseStatement(null);ee.body.push(Ot)}if(Oe)this.strict=!1;if(this.next(),K)this.exitScope();return this.finishNode(ee,"BlockStatement")};Qt.parseFor=function(K,ee){return K.init=ee,this.expect(Ut.semi),K.test=this.type===Ut.semi?null:this.parseExpression(),this.expect(Ut.semi),K.update=this.type===Ut.parenR?null:this.parseExpression(),this.expect(Ut.parenR),K.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(K,"ForStatement")};Qt.parseForIn=function(K,ee){var Oe=this.type===Ut._in;if(this.next(),ee.type==="VariableDeclaration"&&ee.declarations[0].init!=null&&(!Oe||this.options.ecmaVersion<8||this.strict||ee.kind!=="var"||ee.declarations[0].id.type!=="Identifier"))this.raise(ee.start,(Oe?"for-in":"for-of")+" loop variable declaration may not have an initializer");return K.left=ee,K.right=Oe?this.parseExpression():this.parseMaybeAssign(),this.expect(Ut.parenR),K.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(K,Oe?"ForInStatement":"ForOfStatement")};Qt.parseVar=function(K,ee,Oe,Ot){K.declarations=[],K.kind=Oe;for(;;){var Ft=this.startNode();if(this.parseVarId(Ft,Oe),this.eat(Ut.eq))Ft.init=this.parseMaybeAssign(ee);else if(!Ot&&Oe==="const"&&!(this.type===Ut._in||this.options.ecmaVersion>=6&&this.isContextual("of")))this.unexpected();else if(!Ot&&(Oe==="using"||Oe==="await using")&&this.options.ecmaVersion>=17&&this.type!==Ut._in&&!this.isContextual("of"))this.raise(this.lastTokEnd,"Missing initializer in "+Oe+" declaration");else if(!Ot&&Ft.id.type!=="Identifier"&&!(ee&&(this.type===Ut._in||this.isContextual("of"))))this.raise(this.lastTokEnd,"Complex binding patterns require an initialization value");else Ft.init=null;if(K.declarations.push(this.finishNode(Ft,"VariableDeclarator")),!this.eat(Ut.comma))break}return K};Qt.parseVarId=function(K,ee){K.id=ee==="using"||ee==="await using"?this.parseIdent():this.parseBindingAtom(),this.checkLValPattern(K.id,ee==="var"?Qs:Mn,!1)};var xi=1,Hs=2,Uo=4;Qt.parseFunction=function(K,ee,Oe,Ot,Ft){if(this.initFunction(K),this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!Ot){if(this.type===Ut.star&&ee&Hs)this.unexpected();K.generator=this.eat(Ut.star)}if(this.options.ecmaVersion>=8)K.async=!!Ot;if(ee&xi){if(K.id=ee&Uo&&this.type!==Ut.name?null:this.parseIdent(),K.id&&!(ee&Hs))this.checkLValSimple(K.id,this.strict||K.generator||K.async?this.treatFunctionsAsVar?Qs:Mn:Vo)}var jt=this.yieldPos,Gt=this.awaitPos,Mt=this.awaitIdentPos;if(this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(Ys(K.async,K.generator)),!(ee&xi))K.id=this.type===Ut.name?this.parseIdent():null;return this.parseFunctionParams(K),this.parseFunctionBody(K,Oe,!1,Ft),this.yieldPos=jt,this.awaitPos=Gt,this.awaitIdentPos=Mt,this.finishNode(K,ee&xi?"FunctionDeclaration":"FunctionExpression")};Qt.parseFunctionParams=function(K){this.expect(Ut.parenL),K.params=this.parseBindingList(Ut.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()};Qt.parseClass=function(K,ee){this.next();var Oe=this.strict;this.strict=!0,this.parseClassId(K,ee),this.parseClassSuper(K);var Ot=this.enterClassBody(),Ft=this.startNode(),jt=!1;Ft.body=[],this.expect(Ut.braceL);while(this.type!==Ut.braceR){var Gt=this.parseClassElement(K.superClass!==null);if(Gt){if(Ft.body.push(Gt),Gt.type==="MethodDefinition"&&Gt.kind==="constructor"){if(jt)this.raiseRecoverable(Gt.start,"Duplicate constructor in the same class");jt=!0}else if(Gt.key&&Gt.key.type==="PrivateIdentifier"&&ol(Ot,Gt))this.raiseRecoverable(Gt.key.start,"Identifier '#"+Gt.key.name+"' has already been declared")}}return this.strict=Oe,this.next(),K.body=this.finishNode(Ft,"ClassBody"),this.exitClassBody(),this.finishNode(K,ee?"ClassDeclaration":"ClassExpression")};Qt.parseClassElement=function(K){if(this.eat(Ut.semi))return null;var ee=this.options.ecmaVersion,Oe=this.startNode(),Ot="",Ft=!1,jt=!1,Gt="method",Mt=!1;if(this.eatContextual("static")){if(ee>=13&&this.eat(Ut.braceL))return this.parseClassStaticBlock(Oe),Oe;if(this.isClassElementNameStart()||this.type===Ut.star)Mt=!0;else Ot="static"}if(Oe.static=Mt,!Ot&&ee>=8&&this.eatContextual("async"))if((this.isClassElementNameStart()||this.type===Ut.star)&&!this.canInsertSemicolon())jt=!0;else Ot="async";if(!Ot&&(ee>=9||!jt)&&this.eat(Ut.star))Ft=!0;if(!Ot&&!jt&&!Ft){var Vt=this.value;if(this.eatContextual("get")||this.eatContextual("set"))if(this.isClassElementNameStart())Gt=Vt;else Ot=Vt}if(Ot)Oe.computed=!1,Oe.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),Oe.key.name=Ot,this.finishNode(Oe.key,"Identifier");else this.parseClassElementName(Oe);if(ee<13||this.type===Ut.parenL||Gt!=="method"||Ft||jt){var Wt=!Oe.static&&Ji(Oe,"constructor"),Kt=Wt&&K;if(Wt&&Gt!=="method")this.raise(Oe.key.start,"Constructor can't have get/set modifier");Oe.kind=Wt?"constructor":Gt,this.parseClassMethod(Oe,Ft,jt,Kt)}else this.parseClassField(Oe);return Oe};Qt.isClassElementNameStart=function(){return this.type===Ut.name||this.type===Ut.privateId||this.type===Ut.num||this.type===Ut.string||this.type===Ut.bracketL||this.type.keyword};Qt.parseClassElementName=function(K){if(this.type===Ut.privateId){if(this.value==="constructor")this.raise(this.start,"Classes can't have an element named '#constructor'");K.computed=!1,K.key=this.parsePrivateIdent()}else this.parsePropertyName(K)};Qt.parseClassMethod=function(K,ee,Oe,Ot){var Ft=K.key;if(K.kind==="constructor"){if(ee)this.raise(Ft.start,"Constructor can't be a generator");if(Oe)this.raise(Ft.start,"Constructor can't be an async method")}else if(K.static&&Ji(K,"prototype"))this.raise(Ft.start,"Classes may not have a static property named prototype");var jt=K.value=this.parseMethod(ee,Oe,Ot);if(K.kind==="get"&&jt.params.length!==0)this.raiseRecoverable(jt.start,"getter should have no params");if(K.kind==="set"&&jt.params.length!==1)this.raiseRecoverable(jt.start,"setter should have exactly one param");if(K.kind==="set"&&jt.params[0].type==="RestElement")this.raiseRecoverable(jt.params[0].start,"Setter cannot use rest params");return this.finishNode(K,"MethodDefinition")};Qt.parseClassField=function(K){if(Ji(K,"constructor"))this.raise(K.key.start,"Classes can't have a field named 'constructor'");else if(K.static&&Ji(K,"prototype"))this.raise(K.key.start,"Classes can't have a static field named 'prototype'");if(this.eat(Ut.eq))this.enterScope(Si|es),K.value=this.parseMaybeAssign(),this.exitScope();else K.value=null;return this.semicolon(),this.finishNode(K,"PropertyDefinition")};Qt.parseClassStaticBlock=function(K){K.body=[];var ee=this.labels;this.labels=[],this.enterScope(ei|es);while(this.type!==Ut.braceR){var Oe=this.parseStatement(null);K.body.push(Oe)}return this.next(),this.exitScope(),this.labels=ee,this.finishNode(K,"StaticBlock")};Qt.parseClassId=function(K,ee){if(this.type===Ut.name){if(K.id=this.parseIdent(),ee)this.checkLValSimple(K.id,Mn,!1)}else{if(ee===!0)this.unexpected();K.id=null}};Qt.parseClassSuper=function(K){K.superClass=this.eat(Ut._extends)?this.parseExprSubscripts(null,!1):null};Qt.enterClassBody=function(){var K={declared:Object.create(null),used:[]};return this.privateNameStack.push(K),K.declared};Qt.exitClassBody=function(){var K=this.privateNameStack.pop(),{declared:ee,used:Oe}=K;if(!this.options.checkPrivateFields)return;var Ot=this.privateNameStack.length,Ft=Ot===0?null:this.privateNameStack[Ot-1];for(var jt=0;jt<Oe.length;++jt){var Gt=Oe[jt];if(!Ei(ee,Gt.name))if(Ft)Ft.used.push(Gt);else this.raiseRecoverable(Gt.start,"Private field '#"+Gt.name+"' must be declared in an enclosing class")}};function ol(K,ee){var Oe=ee.key.name,Ot=K[Oe],Ft="true";if(ee.type==="MethodDefinition"&&(ee.kind==="get"||ee.kind==="set"))Ft=(ee.static?"s":"i")+ee.kind;if(Ot==="iget"&&Ft==="iset"||Ot==="iset"&&Ft==="iget"||Ot==="sget"&&Ft==="sset"||Ot==="sset"&&Ft==="sget")return K[Oe]="true",!1;else if(!Ot)return K[Oe]=Ft,!1;else return!0}function Ji(K,ee){var{computed:Oe,key:Ot}=K;return!Oe&&(Ot.type==="Identifier"&&Ot.name===ee||Ot.type==="Literal"&&Ot.value===ee)}Qt.parseExportAllDeclaration=function(K,ee){if(this.options.ecmaVersion>=11)if(this.eatContextual("as"))K.exported=this.parseModuleExportName(),this.checkExport(ee,K.exported,this.lastTokStart);else K.exported=null;if(this.expectContextual("from"),this.type!==Ut.string)this.unexpected();if(K.source=this.parseExprAtom(),this.options.ecmaVersion>=16)K.attributes=this.parseWithClause();return this.semicolon(),this.finishNode(K,"ExportAllDeclaration")};Qt.parseExport=function(K,ee){if(this.next(),this.eat(Ut.star))return this.parseExportAllDeclaration(K,ee);if(this.eat(Ut._default))return this.checkExport(ee,"default",this.lastTokStart),K.declaration=this.parseExportDefaultDeclaration(),this.finishNode(K,"ExportDefaultDeclaration");if(this.shouldParseExportStatement()){if(K.declaration=this.parseExportDeclaration(K),K.declaration.type==="VariableDeclaration")this.checkVariableExport(ee,K.declaration.declarations);else this.checkExport(ee,K.declaration.id,K.declaration.id.start);if(K.specifiers=[],K.source=null,this.options.ecmaVersion>=16)K.attributes=[]}else{if(K.declaration=null,K.specifiers=this.parseExportSpecifiers(ee),this.eatContextual("from")){if(this.type!==Ut.string)this.unexpected();if(K.source=this.parseExprAtom(),this.options.ecmaVersion>=16)K.attributes=this.parseWithClause()}else{for(var Oe=0,Ot=K.specifiers;Oe<Ot.length;Oe+=1){var Ft=Ot[Oe];if(this.checkUnreserved(Ft.local),this.checkLocalExport(Ft.local),Ft.local.type==="Literal")this.raise(Ft.local.start,"A string literal cannot be used as an exported binding without `from`.")}if(K.source=null,this.options.ecmaVersion>=16)K.attributes=[]}this.semicolon()}return this.finishNode(K,"ExportNamedDeclaration")};Qt.parseExportDeclaration=function(K){return this.parseStatement(null)};Qt.parseExportDefaultDeclaration=function(){var K;if(this.type===Ut._function||(K=this.isAsyncFunction())){var ee=this.startNode();if(this.next(),K)this.next();return this.parseFunction(ee,xi|Uo,!1,K)}else if(this.type===Ut._class){var Oe=this.startNode();return this.parseClass(Oe,"nullableID")}else{var Ot=this.parseMaybeAssign();return this.semicolon(),Ot}};Qt.checkExport=function(K,ee,Oe){if(!K)return;if(typeof ee!=="string")ee=ee.type==="Identifier"?ee.name:ee.value;if(Ei(K,ee))this.raiseRecoverable(Oe,"Duplicate export '"+ee+"'");K[ee]=!0};Qt.checkPatternExport=function(K,ee){var Oe=ee.type;if(Oe==="Identifier")this.checkExport(K,ee,ee.start);else if(Oe==="ObjectPattern")for(var Ot=0,Ft=ee.properties;Ot<Ft.length;Ot+=1){var jt=Ft[Ot];this.checkPatternExport(K,jt)}else if(Oe==="ArrayPattern")for(var Gt=0,Mt=ee.elements;Gt<Mt.length;Gt+=1){var Vt=Mt[Gt];if(Vt)this.checkPatternExport(K,Vt)}else if(Oe==="Property")this.checkPatternExport(K,ee.value);else if(Oe==="AssignmentPattern")this.checkPatternExport(K,ee.left);else if(Oe==="RestElement")this.checkPatternExport(K,ee.argument)};Qt.checkVariableExport=function(K,ee){if(!K)return;for(var Oe=0,Ot=ee;Oe<Ot.length;Oe+=1){var Ft=Ot[Oe];this.checkPatternExport(K,Ft.id)}};Qt.shouldParseExportStatement=function(){return this.type.keyword==="var"||this.type.keyword==="const"||this.type.keyword==="class"||this.type.keyword==="function"||this.isLet()||this.isAsyncFunction()};Qt.parseExportSpecifier=function(K){var ee=this.startNode();return ee.local=this.parseModuleExportName(),ee.exported=this.eatContextual("as")?this.parseModuleExportName():ee.local,this.checkExport(K,ee.exported,ee.exported.start),this.finishNode(ee,"ExportSpecifier")};Qt.parseExportSpecifiers=function(K){var ee=[],Oe=!0;this.expect(Ut.braceL);while(!this.eat(Ut.braceR)){if(!Oe){if(this.expect(Ut.comma),this.afterTrailingComma(Ut.braceR))break}else Oe=!1;ee.push(this.parseExportSpecifier(K))}return ee};Qt.parseImport=function(K){if(this.next(),this.type===Ut.string)K.specifiers=rl,K.source=this.parseExprAtom();else K.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),K.source=this.type===Ut.string?this.parseExprAtom():this.unexpected();if(this.options.ecmaVersion>=16)K.attributes=this.parseWithClause();return this.semicolon(),this.finishNode(K,"ImportDeclaration")};Qt.parseImportSpecifier=function(){var K=this.startNode();if(K.imported=this.parseModuleExportName(),this.eatContextual("as"))K.local=this.parseIdent();else this.checkUnreserved(K.imported),K.local=K.imported;return this.checkLValSimple(K.local,Mn),this.finishNode(K,"ImportSpecifier")};Qt.parseImportDefaultSpecifier=function(){var K=this.startNode();return K.local=this.parseIdent(),this.checkLValSimple(K.local,Mn),this.finishNode(K,"ImportDefaultSpecifier")};Qt.parseImportNamespaceSpecifier=function(){var K=this.startNode();return this.next(),this.expectContextual("as"),K.local=this.parseIdent(),this.checkLValSimple(K.local,Mn),this.finishNode(K,"ImportNamespaceSpecifier")};Qt.parseImportSpecifiers=function(){var K=[],ee=!0;if(this.type===Ut.name){if(K.push(this.parseImportDefaultSpecifier()),!this.eat(Ut.comma))return K}if(this.type===Ut.star)return K.push(this.parseImportNamespaceSpecifier()),K;this.expect(Ut.braceL);while(!this.eat(Ut.braceR)){if(!ee){if(this.expect(Ut.comma),this.afterTrailingComma(Ut.braceR))break}else ee=!1;K.push(this.parseImportSpecifier())}return K};Qt.parseWithClause=function(){var K=[];if(!this.eat(Ut._with))return K;this.expect(Ut.braceL);var ee={},Oe=!0;while(!this.eat(Ut.braceR)){if(!Oe){if(this.expect(Ut.comma),this.afterTrailingComma(Ut.braceR))break}else Oe=!1;var Ot=this.parseImportAttribute(),Ft=Ot.key.type==="Identifier"?Ot.key.name:Ot.key.value;if(Ei(ee,Ft))this.raiseRecoverable(Ot.key.start,"Duplicate attribute key '"+Ft+"'");ee[Ft]=!0,K.push(Ot)}return K};Qt.parseImportAttribute=function(){var K=this.startNode();if(K.key=this.type===Ut.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never"),this.expect(Ut.colon),this.type!==Ut.string)this.unexpected();return K.value=this.parseExprAtom(),this.finishNode(K,"ImportAttribute")};Qt.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===Ut.string){var K=this.parseLiteral(this.value);if(el.test(K.value))this.raise(K.start,"An export name cannot include a lone surrogate.");return K}return this.parseIdent(!0)};Qt.adaptDirectivePrologue=function(K){for(var ee=0;ee<K.length&&this.isDirectiveCandidate(K[ee]);++ee)K[ee].directive=K[ee].expression.raw.slice(1,-1)};Qt.isDirectiveCandidate=function(K){return this.options.ecmaVersion>=5&&K.type==="ExpressionStatement"&&K.expression.type==="Literal"&&typeof K.expression.value==="string"&&(this.input[K.start]==='"'||this.input[K.start]==="'")};var Tn=s.prototype;Tn.toAssignable=function(K,ee,Oe){if(this.options.ecmaVersion>=6&&K)switch(K.type){case"Identifier":if(this.inAsync&&K.name==="await")this.raise(K.start,"Cannot use 'await' as identifier inside an async function");break;case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":break;case"ObjectExpression":if(K.type="ObjectPattern",Oe)this.checkPatternErrors(Oe,!0);for(var Ot=0,Ft=K.properties;Ot<Ft.length;Ot+=1){var jt=Ft[Ot];if(this.toAssignable(jt,ee),jt.type==="RestElement"&&(jt.argument.type==="ArrayPattern"||jt.argument.type==="ObjectPattern"))this.raise(jt.argument.start,"Unexpected token")}break;case"Property":if(K.kind!=="init")this.raise(K.key.start,"Object pattern can't contain getter or setter");this.toAssignable(K.value,ee);break;case"ArrayExpression":if(K.type="ArrayPattern",Oe)this.checkPatternErrors(Oe,!0);this.toAssignableList(K.elements,ee);break;case"SpreadElement":if(K.type="RestElement",this.toAssignable(K.argument,ee),K.argument.type==="AssignmentPattern")this.raise(K.argument.start,"Rest elements cannot have a default value");break;case"AssignmentExpression":if(K.operator!=="=")this.raise(K.left.end,"Only '=' operator can be used for specifying default value.");K.type="AssignmentPattern",delete K.operator,this.toAssignable(K.left,ee);break;case"ParenthesizedExpression":this.toAssignable(K.expression,ee,Oe);break;case"ChainExpression":this.raiseRecoverable(K.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":if(!ee)break;default:this.raise(K.start,"Assigning to rvalue")}else if(Oe)this.checkPatternErrors(Oe,!0);return K};Tn.toAssignableList=function(K,ee){var Oe=K.length;for(var Ot=0;Ot<Oe;Ot++){var Ft=K[Ot];if(Ft)this.toAssignable(Ft,ee)}if(Oe){var jt=K[Oe-1];if(this.options.ecmaVersion===6&&ee&&jt&&jt.type==="RestElement"&&jt.argument.type!=="Identifier")this.unexpected(jt.argument.start)}return K};Tn.parseSpread=function(K){var ee=this.startNode();return this.next(),ee.argument=this.parseMaybeAssign(!1,K),this.finishNode(ee,"SpreadElement")};Tn.parseRestBinding=function(){var K=this.startNode();if(this.next(),this.options.ecmaVersion===6&&this.type!==Ut.name)this.unexpected();return K.argument=this.parseBindingAtom(),this.finishNode(K,"RestElement")};Tn.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case Ut.bracketL:var K=this.startNode();return this.next(),K.elements=this.parseBindingList(Ut.bracketR,!0,!0),this.finishNode(K,"ArrayPattern");case Ut.braceL:return this.parseObj(!0)}return this.parseIdent()};Tn.parseBindingList=function(K,ee,Oe,Ot){var Ft=[],jt=!0;while(!this.eat(K)){if(jt)jt=!1;else this.expect(Ut.comma);if(ee&&this.type===Ut.comma)Ft.push(null);else if(Oe&&this.afterTrailingComma(K))break;else if(this.type===Ut.ellipsis){var Gt=this.parseRestBinding();if(this.parseBindingListItem(Gt),Ft.push(Gt),this.type===Ut.comma)this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");this.expect(K);break}else Ft.push(this.parseAssignableListItem(Ot))}return Ft};Tn.parseAssignableListItem=function(K){var ee=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(ee),ee};Tn.parseBindingListItem=function(K){return K};Tn.parseMaybeDefault=function(K,ee,Oe){if(Oe=Oe||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(Ut.eq))return Oe;var Ot=this.startNodeAt(K,ee);return Ot.left=Oe,Ot.right=this.parseMaybeAssign(),this.finishNode(Ot,"AssignmentPattern")};Tn.checkLValSimple=function(K,ee,Oe){if(ee===void 0)ee=Xi;var Ot=ee!==Xi;switch(K.type){case"Identifier":if(this.strict&&this.reservedWordsStrictBind.test(K.name))this.raiseRecoverable(K.start,(Ot?"Binding ":"Assigning to ")+K.name+" in strict mode");if(Ot){if(ee===Mn&&K.name==="let")this.raiseRecoverable(K.start,"let is disallowed as a lexically bound name");if(Oe){if(Ei(Oe,K.name))this.raiseRecoverable(K.start,"Argument name clash");Oe[K.name]=!0}if(ee!==Wo)this.declareName(K.name,ee,K.start)}break;case"ChainExpression":this.raiseRecoverable(K.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":if(Ot)this.raiseRecoverable(K.start,"Binding member expression");break;case"ParenthesizedExpression":if(Ot)this.raiseRecoverable(K.start,"Binding parenthesized expression");return this.checkLValSimple(K.expression,ee,Oe);default:this.raise(K.start,(Ot?"Binding":"Assigning to")+" rvalue")}};Tn.checkLValPattern=function(K,ee,Oe){if(ee===void 0)ee=Xi;switch(K.type){case"ObjectPattern":for(var Ot=0,Ft=K.properties;Ot<Ft.length;Ot+=1){var jt=Ft[Ot];this.checkLValInnerPattern(jt,ee,Oe)}break;case"ArrayPattern":for(var Gt=0,Mt=K.elements;Gt<Mt.length;Gt+=1){var Vt=Mt[Gt];if(Vt)this.checkLValInnerPattern(Vt,ee,Oe)}break;default:this.checkLValSimple(K,ee,Oe)}};Tn.checkLValInnerPattern=function(K,ee,Oe){if(ee===void 0)ee=Xi;switch(K.type){case"Property":this.checkLValInnerPattern(K.value,ee,Oe);break;case"AssignmentPattern":this.checkLValPattern(K.left,ee,Oe);break;case"RestElement":this.checkLValPattern(K.argument,ee,Oe);break;default:this.checkLValPattern(K,ee,Oe)}};var An=function(K,ee,Oe,Ot,Ft){this.token=K,this.isExpr=!!ee,this.preserveSpace=!!Oe,this.override=Ot,this.generator=!!Ft},pn={b_stat:new An("{",!1),b_expr:new An("{",!0),b_tmpl:new An("${",!1),p_stat:new An("(",!1),p_expr:new An("(",!0),q_tmpl:new An("`",!0,!0,function(K){return K.tryReadTemplateToken()}),f_stat:new An("function",!1),f_expr:new An("function",!0),f_expr_gen:new An("function",!0,!1,null,!0),f_gen:new An("function",!1,!1,null,!0)},li=s.prototype;li.initialContext=function(){return[pn.b_stat]};li.curContext=function(){return this.context[this.context.length-1]};li.braceIsBlock=function(K){var ee=this.curContext();if(ee===pn.f_expr||ee===pn.f_stat)return!0;if(K===Ut.colon&&(ee===pn.b_stat||ee===pn.b_expr))return!ee.isExpr;if(K===Ut._return||K===Ut.name&&this.exprAllowed)return vn.test(this.input.slice(this.lastTokEnd,this.start));if(K===Ut._else||K===Ut.semi||K===Ut.eof||K===Ut.parenR||K===Ut.arrow)return!0;if(K===Ut.braceL)return ee===pn.b_stat;if(K===Ut._var||K===Ut._const||K===Ut.name)return!1;return!this.exprAllowed};li.inGeneratorContext=function(){for(var K=this.context.length-1;K>=1;K--){var ee=this.context[K];if(ee.token==="function")return ee.generator}return!1};li.updateContext=function(K){var ee,Oe=this.type;if(Oe.keyword&&K===Ut.dot)this.exprAllowed=!1;else if(ee=Oe.updateContext)ee.call(this,K);else this.exprAllowed=Oe.beforeExpr};li.overrideContext=function(K){if(this.curContext()!==K)this.context[this.context.length-1]=K};Ut.parenR.updateContext=Ut.braceR.updateContext=function(){if(this.context.length===1){this.exprAllowed=!0;return}var K=this.context.pop();if(K===pn.b_stat&&this.curContext().token==="function")K=this.context.pop();this.exprAllowed=!K.isExpr};Ut.braceL.updateContext=function(K){this.context.push(this.braceIsBlock(K)?pn.b_stat:pn.b_expr),this.exprAllowed=!0};Ut.dollarBraceL.updateContext=function(){this.context.push(pn.b_tmpl),this.exprAllowed=!0};Ut.parenL.updateContext=function(K){var ee=K===Ut._if||K===Ut._for||K===Ut._with||K===Ut._while;this.context.push(ee?pn.p_stat:pn.p_expr),this.exprAllowed=!0};Ut.incDec.updateContext=function(){};Ut._function.updateContext=Ut._class.updateContext=function(K){if(K.beforeExpr&&K!==Ut._else&&!(K===Ut.semi&&this.curContext()!==pn.p_stat)&&!(K===Ut._return&&vn.test(this.input.slice(this.lastTokEnd,this.start)))&&!((K===Ut.colon||K===Ut.braceL)&&this.curContext()===pn.b_stat))this.context.push(pn.f_expr);else this.context.push(pn.f_stat);this.exprAllowed=!1};Ut.colon.updateContext=function(){if(this.curContext().token==="function")this.context.pop();this.exprAllowed=!0};Ut.backQuote.updateContext=function(){if(this.curContext()===pn.q_tmpl)this.context.pop();else this.context.push(pn.q_tmpl);this.exprAllowed=!1};Ut.star.updateContext=function(K){if(K===Ut._function){var ee=this.context.length-1;if(this.context[ee]===pn.f_expr)this.context[ee]=pn.f_expr_gen;else this.context[ee]=pn.f_gen}this.exprAllowed=!0};Ut.name.updateContext=function(K){var ee=!1;if(this.options.ecmaVersion>=6&&K!==Ut.dot){if(this.value==="of"&&!this.exprAllowed||this.value==="yield"&&this.inGeneratorContext())ee=!0}this.exprAllowed=ee};var en=s.prototype;en.checkPropClash=function(K,ee,Oe){if(this.options.ecmaVersion>=9&&K.type==="SpreadElement")return;if(this.options.ecmaVersion>=6&&(K.computed||K.method||K.shorthand))return;var Ot=K.key,Ft;switch(Ot.type){case"Identifier":Ft=Ot.name;break;case"Literal":Ft=String(Ot.value);break;default:return}var jt=K.kind;if(this.options.ecmaVersion>=6){if(Ft==="__proto__"&&jt==="init"){if(ee.proto)if(Oe){if(Oe.doubleProto<0)Oe.doubleProto=Ot.start}else this.raiseRecoverable(Ot.start,"Redefinition of __proto__ property");ee.proto=!0}return}Ft="$"+Ft;var Gt=ee[Ft];if(Gt){var Mt;if(jt==="init")Mt=this.strict&&Gt.init||Gt.get||Gt.set;else Mt=Gt.init||Gt[jt];if(Mt)this.raiseRecoverable(Ot.start,"Redefinition of property")}else Gt=ee[Ft]={init:!1,get:!1,set:!1};Gt[jt]=!0};en.parseExpression=function(K,ee){var Oe=this;return this.catchStackOverflow(function(){var{start:Ot,startLoc:Ft}=Oe,jt=Oe.parseMaybeAssign(K,ee);if(Oe.type===Ut.comma){var Gt=Oe.startNodeAt(Ot,Ft);Gt.expressions=[jt];while(Oe.eat(Ut.comma))Gt.expressions.push(Oe.parseMaybeAssign(K,ee));return Oe.finishNode(Gt,"SequenceExpression")}return jt})};en.parseMaybeAssign=function(K,ee,Oe){if(this.isContextual("yield"))if(this.inGenerator)return this.parseYield(K);else this.exprAllowed=!1;var Ot=!1,Ft=-1,jt=-1,Gt=-1;if(ee)Ft=ee.parenthesizedAssign,jt=ee.trailingComma,Gt=ee.doubleProto,ee.parenthesizedAssign=ee.trailingComma=-1;else ee=new ns,Ot=!0;var Mt=this.start,Vt=this.startLoc;if(this.type===Ut.parenL||this.type===Ut.name)this.potentialArrowAt=this.start,this.potentialArrowInForAwait=K==="await";var Wt=this.parseMaybeConditional(K,ee);if(Oe)Wt=Oe.call(this,Wt,Mt,Vt);if(this.type.isAssign){var Kt=this.startNodeAt(Mt,Vt);if(Kt.operator=this.value,this.type===Ut.eq)Wt=this.toAssignable(Wt,!1,ee);if(!Ot)ee.parenthesizedAssign=ee.trailingComma=ee.doubleProto=-1;if(ee.shorthandAssign>=Wt.start)ee.shorthandAssign=-1;if(this.type===Ut.eq)this.checkLValPattern(Wt);else this.checkLValSimple(Wt);if(Kt.left=Wt,this.next(),Kt.right=this.parseMaybeAssign(K),Gt>-1)ee.doubleProto=Gt;return this.finishNode(Kt,"AssignmentExpression")}else if(Ot)this.checkExpressionErrors(ee,!0);if(Ft>-1)ee.parenthesizedAssign=Ft;if(jt>-1)ee.trailingComma=jt;return Wt};en.parseMaybeConditional=function(K,ee){var Oe=this.start,Ot=this.startLoc,Ft=this.parseExprOps(K,ee);if(this.checkExpressionErrors(ee))return Ft;if(!(Ft.type==="ArrowFunctionExpression"&&Ft.start===Oe)&&this.eat(Ut.question)){var jt=this.startNodeAt(Oe,Ot);return jt.test=Ft,jt.consequent=this.parseMaybeAssign(),this.expect(Ut.colon),jt.alternate=this.parseMaybeAssign(K),this.finishNode(jt,"ConditionalExpression")}return Ft};en.parseExprOps=function(K,ee){var Oe=this.start,Ot=this.startLoc,Ft=this.parseMaybeUnary(ee,!1,!1,K);if(this.checkExpressionErrors(ee))return Ft;return Ft.start===Oe&&Ft.type==="ArrowFunctionExpression"?Ft:this.parseExprOp(Ft,Oe,Ot,-1,K)};en.parseExprOp=function(K,ee,Oe,Ot,Ft){var jt=this.type.binop;if(jt!=null&&(!Ft||this.type!==Ut._in)){if(jt>Ot){var Gt=this.type===Ut.logicalOR||this.type===Ut.logicalAND,Mt=this.type===Ut.coalesce;if(Mt)jt=Ut.logicalAND.binop;var Vt=this.value;this.next();var Wt=this.start,Kt=this.startLoc,Ht=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,Ft),Wt,Kt,jt,Ft),qt=this.buildBinary(ee,Oe,K,Ht,Vt,Gt||Mt);if(Gt&&this.type===Ut.coalesce||Mt&&(this.type===Ut.logicalOR||this.type===Ut.logicalAND))this.raiseRecoverable(this.start,"Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses");return this.parseExprOp(qt,ee,Oe,Ot,Ft)}}return K};en.buildBinary=function(K,ee,Oe,Ot,Ft,jt){if(Ot.type==="PrivateIdentifier")this.raise(Ot.start,"Private identifier can only be left side of binary expression");var Gt=this.startNodeAt(K,ee);return Gt.left=Oe,Gt.operator=Ft,Gt.right=Ot,this.finishNode(Gt,jt?"LogicalExpression":"BinaryExpression")};en.parseMaybeUnary=function(K,ee,Oe,Ot){var Ft=this.start,jt=this.startLoc,Gt;if(this.isContextual("await")&&this.canAwait)Gt=this.parseAwait(Ot),ee=!0;else if(this.type.prefix){var Mt=this.startNode(),Vt=this.type===Ut.incDec;if(Mt.operator=this.value,Mt.prefix=!0,this.next(),Mt.argument=this.parseMaybeUnary(null,!0,Vt,Ot),this.checkExpressionErrors(K,!0),Vt)this.checkLValSimple(Mt.argument);else if(this.strict&&Mt.operator==="delete"&&Ko(Mt.argument))this.raiseRecoverable(Mt.start,"Deleting local variable in strict mode");else if(Mt.operator==="delete"&&qs(Mt.argument))this.raiseRecoverable(Mt.start,"Private fields can not be deleted");else ee=!0;Gt=this.finishNode(Mt,Vt?"UpdateExpression":"UnaryExpression")}else if(!ee&&this.type===Ut.privateId){if((Ot||this.privateNameStack.length===0)&&this.options.checkPrivateFields)this.unexpected();if(Gt=this.parsePrivateIdent(),this.type!==Ut._in)this.unexpected()}else{if(Gt=this.parseExprSubscripts(K,Ot),this.checkExpressionErrors(K))return Gt;while(this.type.postfix&&!this.canInsertSemicolon()){var Wt=this.startNodeAt(Ft,jt);Wt.operator=this.value,Wt.prefix=!1,Wt.argument=Gt,this.checkLValSimple(Gt),this.next(),Gt=this.finishNode(Wt,"UpdateExpression")}}if(!Oe&&!(Gt.type==="ArrowFunctionExpression"&&Gt.start===Ft)&&this.eat(Ut.starstar))if(ee)this.unexpected(this.lastTokStart);else return this.buildBinary(Ft,jt,Gt,this.parseMaybeUnary(null,!1,!1,Ot),"**",!1);else return Gt};function Ko(K){return K.type==="Identifier"||K.type==="ParenthesizedExpression"&&Ko(K.expression)}function qs(K){return K.type==="MemberExpression"&&K.property.type==="PrivateIdentifier"||K.type==="ChainExpression"&&qs(K.expression)||K.type==="ParenthesizedExpression"&&qs(K.expression)}en.parseExprSubscripts=function(K,ee){var Oe=this.start,Ot=this.startLoc,Ft=this.parseExprAtom(K,ee);if(Ft.type==="ArrowFunctionExpression"&&this.input.slice(this.lastTokStart,this.lastTokEnd)!==")")return Ft;var jt=this.parseSubscripts(Ft,Oe,Ot,!1,ee);if(K&&jt.type==="MemberExpression"){if(K.parenthesizedAssign>=jt.start)K.parenthesizedAssign=-1;if(K.parenthesizedBind>=jt.start)K.parenthesizedBind=-1;if(K.trailingComma>=jt.start)K.trailingComma=-1}return jt};en.parseSubscripts=function(K,ee,Oe,Ot,Ft){var jt=this.options.ecmaVersion>=8&&K.type==="Identifier"&&K.name==="async"&&this.lastTokEnd===K.end&&!this.canInsertSemicolon()&&K.end-K.start===5&&this.potentialArrowAt===K.start,Gt=!1;while(!0){var Mt=this.parseSubscript(K,ee,Oe,Ot,jt,Gt,Ft);if(Mt.optional)Gt=!0;if(Mt===K||Mt.type==="ArrowFunctionExpression"){if(Gt){var Vt=this.startNodeAt(ee,Oe);Vt.expression=Mt,Mt=this.finishNode(Vt,"ChainExpression")}return Mt}K=Mt}};en.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(Ut.arrow)};en.parseSubscriptAsyncArrow=function(K,ee,Oe,Ot){return this.parseArrowExpression(this.startNodeAt(K,ee),Oe,!0,Ot)};en.parseSubscript=function(K,ee,Oe,Ot,Ft,jt,Gt){var Mt=this.options.ecmaVersion>=11,Vt=Mt&&this.eat(Ut.questionDot);if(Ot&&Vt)this.raise(this.lastTokStart,"Optional chaining cannot appear in the callee of new expressions");var Wt=this.eat(Ut.bracketL);if(Wt||Vt&&this.type!==Ut.parenL&&this.type!==Ut.backQuote||this.eat(Ut.dot)){var Kt=this.startNodeAt(ee,Oe);if(Kt.object=K,Wt)Kt.property=this.parseExpression(),this.expect(Ut.bracketR);else if(this.type===Ut.privateId&&K.type!=="Super")Kt.property=this.parsePrivateIdent();else Kt.property=this.parseIdent(this.options.allowReserved!=="never");if(Kt.computed=!!Wt,Mt)Kt.optional=Vt;K=this.finishNode(Kt,"MemberExpression")}else if(!Ot&&this.eat(Ut.parenL)){var Ht=new ns,qt=this.yieldPos,zt=this.awaitPos,Xt=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var Yt=this.parseExprList(Ut.parenR,this.options.ecmaVersion>=8,!1,Ht);if(Ft&&!Vt&&this.shouldParseAsyncArrow()){if(this.checkPatternErrors(Ht,!1),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0)this.raise(this.awaitIdentPos,"Cannot use 'await' as identifier inside an async function");return this.yieldPos=qt,this.awaitPos=zt,this.awaitIdentPos=Xt,this.parseSubscriptAsyncArrow(ee,Oe,Yt,Gt)}this.checkExpressionErrors(Ht,!0),this.yieldPos=qt||this.yieldPos,this.awaitPos=zt||this.awaitPos,this.awaitIdentPos=Xt||this.awaitIdentPos;var Jt=this.startNodeAt(ee,Oe);if(Jt.callee=K,Jt.arguments=Yt,Mt)Jt.optional=Vt;K=this.finishNode(Jt,"CallExpression")}else if(this.type===Ut.backQuote){if(Vt||jt)this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions");var tn=this.startNodeAt(ee,Oe);tn.tag=K,tn.quasi=this.parseTemplate({isTagged:!0}),K=this.finishNode(tn,"TaggedTemplateExpression")}return K};en.parseExprAtom=function(K,ee,Oe){if(this.type===Ut.slash)this.readRegexp();var Ot,Ft=this.potentialArrowAt===this.start;switch(this.type){case Ut._super:if(!this.allowSuper)this.raise(this.start,"'super' keyword outside a method");if(Ot=this.startNode(),this.next(),this.type===Ut.parenL&&!this.allowDirectSuper)this.raise(Ot.start,"super() call outside constructor of a subclass");if(this.type!==Ut.dot&&this.type!==Ut.bracketL&&this.type!==Ut.parenL)this.unexpected();return this.finishNode(Ot,"Super");case Ut._this:return Ot=this.startNode(),this.next(),this.finishNode(Ot,"ThisExpression");case Ut.name:var jt=this.start,Gt=this.startLoc,Mt=this.containsEsc,Vt=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!Mt&&Vt.name==="async"&&!this.canInsertSemicolon()&&this.eat(Ut._function))return this.overrideContext(pn.f_expr),this.parseFunction(this.startNodeAt(jt,Gt),0,!1,!0,ee);if(Ft&&!this.canInsertSemicolon()){if(this.eat(Ut.arrow))return this.parseArrowExpression(this.startNodeAt(jt,Gt),[Vt],!1,ee);if(this.options.ecmaVersion>=8&&Vt.name==="async"&&this.type===Ut.name&&!Mt&&(!this.potentialArrowInForAwait||this.value!=="of"||this.containsEsc)){if(Vt=this.parseIdent(!1),this.canInsertSemicolon()||!this.eat(Ut.arrow))this.unexpected();return this.parseArrowExpression(this.startNodeAt(jt,Gt),[Vt],!0,ee)}}return Vt;case Ut.regexp:var Wt=this.value;return Ot=this.parseLiteral(Wt.value),Ot.regex={pattern:Wt.pattern,flags:Wt.flags},Ot;case Ut.num:case Ut.string:return this.parseLiteral(this.value);case Ut._null:case Ut._true:case Ut._false:return Ot=this.startNode(),Ot.value=this.type===Ut._null?null:this.type===Ut._true,Ot.raw=this.type.keyword,this.next(),this.finishNode(Ot,"Literal");case Ut.parenL:var Kt=this.start,Ht=this.parseParenAndDistinguishExpression(Ft,ee);if(K){if(K.parenthesizedAssign<0&&!this.isSimpleAssignTarget(Ht))K.parenthesizedAssign=Kt;if(K.parenthesizedBind<0)K.parenthesizedBind=Kt}return Ht;case Ut.bracketL:return Ot=this.startNode(),this.next(),Ot.elements=this.parseExprList(Ut.bracketR,!0,!0,K),this.finishNode(Ot,"ArrayExpression");case Ut.braceL:return this.overrideContext(pn.b_expr),this.parseObj(!1,K);case Ut._function:return Ot=this.startNode(),this.next(),this.parseFunction(Ot,0);case Ut._class:return this.parseClass(this.startNode(),!1);case Ut._new:return this.parseNew();case Ut.backQuote:return this.parseTemplate();case Ut._import:if(this.options.ecmaVersion>=11)return this.parseExprImport(Oe);else return this.unexpected();default:return this.parseExprAtomDefault()}};en.parseExprAtomDefault=function(){this.unexpected()};en.parseExprImport=function(K){var ee=this.startNode();if(this.containsEsc)this.raiseRecoverable(this.start,"Escape sequence in keyword import");if(this.next(),this.type===Ut.parenL&&!K)return this.parseDynamicImport(ee);else if(this.type===Ut.dot){var Oe=this.startNodeAt(ee.start,ee.loc&&ee.loc.start);return Oe.name="import",ee.meta=this.finishNode(Oe,"Identifier"),this.parseImportMeta(ee)}else this.unexpected()};en.parseDynamicImport=function(K){if(this.next(),K.source=this.parseMaybeAssign(),this.options.ecmaVersion>=16)if(!this.eat(Ut.parenR))if(this.expect(Ut.comma),!this.afterTrailingComma(Ut.parenR)){if(K.options=this.parseMaybeAssign(),!this.eat(Ut.parenR)){if(this.expect(Ut.comma),!this.afterTrailingComma(Ut.parenR))this.unexpected()}}else K.options=null;else K.options=null;else if(!this.eat(Ut.parenR)){var ee=this.start;if(this.eat(Ut.comma)&&this.eat(Ut.parenR))this.raiseRecoverable(ee,"Trailing comma is not allowed in import()");else this.unexpected(ee)}return this.finishNode(K,"ImportExpression")};en.parseImportMeta=function(K){this.next();var ee=this.containsEsc;if(K.property=this.parseIdent(!0),K.property.name!=="meta")this.raiseRecoverable(K.property.start,"The only valid meta property for import is 'import.meta'");if(ee)this.raiseRecoverable(K.start,"'import.meta' must not contain escaped characters");if(this.options.sourceType!=="module"&&!this.options.allowImportExportEverywhere)this.raiseRecoverable(K.start,"Cannot use 'import.meta' outside a module");return this.finishNode(K,"MetaProperty")};en.parseLiteral=function(K){var ee=this.startNode();if(ee.value=K,ee.raw=this.input.slice(this.start,this.end),ee.raw.charCodeAt(ee.raw.length-1)===110)ee.bigint=ee.value!=null?ee.value.toString():ee.raw.slice(0,-1).replace(/_/g,"");return this.next(),this.finishNode(ee,"Literal")};en.parseParenExpression=function(){this.expect(Ut.parenL);var K=this.parseExpression();return this.expect(Ut.parenR),K};en.shouldParseArrow=function(K){return!this.canInsertSemicolon()};en.parseParenAndDistinguishExpression=function(K,ee){var Oe=this.start,Ot=this.startLoc,Ft,jt=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var Gt=this.start,Mt=this.startLoc,Vt=[],Wt=!0,Kt=!1,Ht=new ns,qt=this.yieldPos,zt=this.awaitPos,Xt;this.yieldPos=0,this.awaitPos=0;while(this.type!==Ut.parenR)if(Wt?Wt=!1:this.expect(Ut.comma),jt&&this.afterTrailingComma(Ut.parenR,!0)){Kt=!0;break}else if(this.type===Ut.ellipsis){if(Xt=this.start,Vt.push(this.parseParenItem(this.parseRestBinding())),this.type===Ut.comma)this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");break}else Vt.push(this.parseMaybeAssign(!1,Ht,this.parseParenItem));var Yt=this.lastTokEnd,Jt=this.lastTokEndLoc;if(this.expect(Ut.parenR),K&&this.shouldParseArrow(Vt)&&this.eat(Ut.arrow))return this.checkPatternErrors(Ht,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=qt,this.awaitPos=zt,this.parseParenArrowList(Oe,Ot,Vt,ee);if(!Vt.length||Kt)this.unexpected(this.lastTokStart);if(Xt)this.unexpected(Xt);if(this.checkExpressionErrors(Ht,!0),this.yieldPos=qt||this.yieldPos,this.awaitPos=zt||this.awaitPos,Vt.length>1)Ft=this.startNodeAt(Gt,Mt),Ft.expressions=Vt,this.finishNodeAt(Ft,"SequenceExpression",Yt,Jt);else Ft=Vt[0]}else Ft=this.parseParenExpression();if(this.options.preserveParens){var tn=this.startNodeAt(Oe,Ot);return tn.expression=Ft,this.finishNode(tn,"ParenthesizedExpression")}else return Ft};en.parseParenItem=function(K){return K};en.parseParenArrowList=function(K,ee,Oe,Ot){return this.parseArrowExpression(this.startNodeAt(K,ee),Oe,!1,Ot)};var al=[];en.parseNew=function(){if(this.containsEsc)this.raiseRecoverable(this.start,"Escape sequence in keyword new");var K=this.startNode();if(this.next(),this.options.ecmaVersion>=6&&this.type===Ut.dot){var ee=this.startNodeAt(K.start,K.loc&&K.loc.start);ee.name="new",K.meta=this.finishNode(ee,"Identifier"),this.next();var Oe=this.containsEsc;if(K.property=this.parseIdent(!0),K.property.name!=="target")this.raiseRecoverable(K.property.start,"The only valid meta property for new is 'new.target'");if(Oe)this.raiseRecoverable(K.start,"'new.target' must not contain escaped characters");if(!this.allowNewDotTarget)this.raiseRecoverable(K.start,"'new.target' can only be used in functions and class static block");return this.finishNode(K,"MetaProperty")}var Ot=this.start,Ft=this.startLoc;if(K.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),Ot,Ft,!0,!1),K.callee.type==="Super")this.raiseRecoverable(Ot,"Invalid use of 'super'");if(this.eat(Ut.parenL))K.arguments=this.parseExprList(Ut.parenR,this.options.ecmaVersion>=8,!1);else K.arguments=al;return this.finishNode(K,"NewExpression")};en.parseTemplateElement=function(K){var ee=K.isTagged,Oe=this.startNode();if(this.type===Ut.invalidTemplate){if(!ee)this.raiseRecoverable(this.start,"Bad escape sequence in untagged template literal");Oe.value={raw:this.value.replace(/\r\n?/g,`
|
|
9
9
|
`),cooked:null}}else Oe.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,`
|
|
10
|
-
`),cooked:this.value};return this.next(),Oe.tail=this.type===Ut.backQuote,this.finishNode(Oe,"TemplateElement")};en.parseTemplate=function(K){if(K===void 0)K={};var ee=K.isTagged;if(ee===void 0)ee=!1;var Oe=this.startNode();this.next(),Oe.expressions=[];var Ot=this.parseTemplateElement({isTagged:ee});Oe.quasis=[Ot];while(!Ot.tail){if(this.type===Ut.eof)this.raise(this.pos,"Unterminated template literal");this.expect(Ut.dollarBraceL),Oe.expressions.push(this.parseExpression()),this.expect(Ut.braceR),Oe.quasis.push(Ot=this.parseTemplateElement({isTagged:ee}))}return this.next(),this.finishNode(Oe,"TemplateLiteral")};en.isAsyncProp=function(K){return!K.computed&&K.key.type==="Identifier"&&K.key.name==="async"&&(this.type===Ut.name||this.type===Ut.num||this.type===Ut.string||this.type===Ut.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===Ut.star)&&!xn.test(this.input.slice(this.lastTokEnd,this.start))};en.parseObj=function(K,ee){var Oe=this.startNode(),Ot=!0,Ft={};Oe.properties=[],this.next();while(!this.eat(Ut.braceR)){if(!Ot){if(this.expect(Ut.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(Ut.braceR))break}else Ot=!1;var jt=this.parseProperty(K,ee);if(!K)this.checkPropClash(jt,Ft,ee);Oe.properties.push(jt)}return this.finishNode(Oe,K?"ObjectPattern":"ObjectExpression")};en.parseProperty=function(K,ee){var Oe=this.startNode(),Ot,Ft,jt,Gt;if(this.options.ecmaVersion>=9&&this.eat(Ut.ellipsis)){if(K){if(Oe.argument=this.parseIdent(!1),this.type===Ut.comma)this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");return this.finishNode(Oe,"RestElement")}if(Oe.argument=this.parseMaybeAssign(!1,ee),this.type===Ut.comma&&ee&&ee.trailingComma<0)ee.trailingComma=this.start;return this.finishNode(Oe,"SpreadElement")}if(this.options.ecmaVersion>=6){if(Oe.method=!1,Oe.shorthand=!1,K||ee)jt=this.start,Gt=this.startLoc;if(!K)Ot=this.eat(Ut.star)}var Mt=this.containsEsc;if(this.parsePropertyName(Oe),!K&&!Mt&&this.options.ecmaVersion>=8&&!Ot&&this.isAsyncProp(Oe))Ft=!0,Ot=this.options.ecmaVersion>=9&&this.eat(Ut.star),this.parsePropertyName(Oe);else Ft=!1;return this.parsePropertyValue(Oe,K,Ot,Ft,jt,Gt,ee,Mt),this.finishNode(Oe,"Property")};en.parseGetterSetter=function(K){var ee=K.key.name;this.parsePropertyName(K),K.value=this.parseMethod(!1),K.kind=ee;var Oe=K.kind==="get"?0:1;if(K.value.params.length!==Oe){var Ot=K.value.start;if(K.kind==="get")this.raiseRecoverable(Ot,"getter should have no params");else this.raiseRecoverable(Ot,"setter should have exactly one param")}else if(K.kind==="set"&&K.value.params[0].type==="RestElement")this.raiseRecoverable(K.value.params[0].start,"Setter cannot use rest params")};en.parsePropertyValue=function(K,ee,Oe,Ot,Ft,jt,Gt,Mt){if((Oe||Ot)&&this.type===Ut.colon)this.unexpected();if(this.eat(Ut.colon))K.value=ee?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,Gt),K.kind="init";else if(this.options.ecmaVersion>=6&&this.type===Ut.parenL){if(ee)this.unexpected();K.method=!0,K.value=this.parseMethod(Oe,Ot),K.kind="init"}else if(!ee&&!Mt&&this.options.ecmaVersion>=5&&!K.computed&&K.key.type==="Identifier"&&(K.key.name==="get"||K.key.name==="set")&&(this.type!==Ut.comma&&this.type!==Ut.braceR&&this.type!==Ut.eq)){if(Oe||Ot)this.unexpected();this.parseGetterSetter(K)}else if(this.options.ecmaVersion>=6&&!K.computed&&K.key.type==="Identifier"){if(Oe||Ot)this.unexpected();if(this.checkUnreserved(K.key),K.key.name==="await"&&!this.awaitIdentPos)this.awaitIdentPos=Ft;if(ee)K.value=this.parseMaybeDefault(Ft,jt,this.copyNode(K.key));else if(this.type===Ut.eq&&Gt){if(Gt.shorthandAssign<0)Gt.shorthandAssign=this.start;K.value=this.parseMaybeDefault(Ft,jt,this.copyNode(K.key))}else K.value=this.copyNode(K.key);K.kind="init",K.shorthand=!0}else this.unexpected()};en.parsePropertyName=function(K){if(this.options.ecmaVersion>=6)if(this.eat(Ut.bracketL))return K.computed=!0,K.key=this.parseMaybeAssign(),this.expect(Ut.bracketR),K.key;else K.computed=!1;return K.key=this.type===Ut.num||this.type===Ut.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never")};en.initFunction=function(K){if(K.id=null,this.options.ecmaVersion>=6)K.generator=K.expression=!1;if(this.options.ecmaVersion>=8)K.async=!1};en.parseMethod=function(K,ee,Oe){var Ot=this.startNode(),Ft=this.yieldPos,jt=this.awaitPos,Gt=this.awaitIdentPos;if(this.initFunction(Ot),this.options.ecmaVersion>=6)Ot.generator=K;if(this.options.ecmaVersion>=8)Ot.async=!!ee;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(Xi(ee,Ot.generator)|Ys|(Oe?Io:0)),this.expect(Ut.parenL),Ot.params=this.parseBindingList(Ut.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(Ot,!1,!0,!1),this.yieldPos=Ft,this.awaitPos=jt,this.awaitIdentPos=Gt,this.finishNode(Ot,"FunctionExpression")};en.parseArrowExpression=function(K,ee,Oe,Ot){var Ft=this.yieldPos,jt=this.awaitPos,Gt=this.awaitIdentPos;if(this.enterScope(Xi(Oe,!1)|zi),this.initFunction(K),this.options.ecmaVersion>=8)K.async=!!Oe;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,K.params=this.toAssignableList(ee,!0),this.parseFunctionBody(K,!0,!1,Ot),this.yieldPos=Ft,this.awaitPos=jt,this.awaitIdentPos=Gt,this.finishNode(K,"ArrowFunctionExpression")};en.parseFunctionBody=function(K,ee,Oe,Ot){var Ft=ee&&this.type!==Ut.braceL,jt=this.strict,Gt=!1;if(Ft)K.body=this.parseMaybeAssign(Ot),K.expression=!0,this.checkParams(K,!1);else{var Mt=this.options.ecmaVersion>=7&&!this.isSimpleParamList(K.params);if(!jt||Mt){if(Gt=this.strictDirective(this.end),Gt&&Mt)this.raiseRecoverable(K.start,"Illegal 'use strict' directive in function with non-simple parameter list")}var Vt=this.labels;if(this.labels=[],Gt)this.strict=!0;if(this.checkParams(K,!jt&&!Gt&&!ee&&!Oe&&this.isSimpleParamList(K.params)),this.strict&&K.id)this.checkLValSimple(K.id,Fo);K.body=this.parseBlock(!1,void 0,Gt&&!jt),K.expression=!1,this.adaptDirectivePrologue(K.body.body),this.labels=Vt}this.exitScope()};en.isSimpleParamList=function(K){for(var ee=0,Oe=K;ee<Oe.length;ee+=1){var Ot=Oe[ee];if(Ot.type!=="Identifier")return!1}return!0};en.checkParams=function(K,ee){var Oe=Object.create(null);for(var Ot=0,Ft=K.params;Ot<Ft.length;Ot+=1){var jt=Ft[Ot];this.checkLValInnerPattern(jt,Ji,ee?null:Oe)}};en.parseExprList=function(K,ee,Oe,Ot){var Ft=[],jt=!0;while(!this.eat(K)){if(!jt){if(this.expect(Ut.comma),ee&&this.afterTrailingComma(K))break}else jt=!1;var Gt=void 0;if(Oe&&this.type===Ut.comma)Gt=null;else if(this.type===Ut.ellipsis){if(Gt=this.parseSpread(Ot),Ot&&this.type===Ut.comma&&Ot.trailingComma<0)Ot.trailingComma=this.start}else Gt=this.parseMaybeAssign(!1,Ot);Ft.push(Gt)}return Ft};en.checkUnreserved=function(K){var{start:ee,end:Oe,name:Ot}=K;if(this.inGenerator&&Ot==="yield")this.raiseRecoverable(ee,"Cannot use 'yield' as identifier inside a generator");if(this.inAsync&&Ot==="await")this.raiseRecoverable(ee,"Cannot use 'await' as identifier inside an async function");if(!(this.currentThisScope().flags&Qs)&&Ot==="arguments")this.raiseRecoverable(ee,"Cannot use 'arguments' in class field initializer");if(this.inClassStaticBlock&&(Ot==="arguments"||Ot==="await"))this.raise(ee,"Cannot use "+Ot+" in class static initialization block");if(this.keywords.test(Ot))this.raise(ee,"Unexpected keyword '"+Ot+"'");if(this.options.ecmaVersion<6&&this.input.slice(ee,Oe).indexOf("\\")!==-1)return;var Ft=this.strict?this.reservedWordsStrict:this.reservedWords;if(Ft.test(Ot)){if(!this.inAsync&&Ot==="await")this.raiseRecoverable(ee,"Cannot use keyword 'await' outside an async function");this.raiseRecoverable(ee,"The keyword '"+Ot+"' is reserved")}};en.parseIdent=function(K){var ee=this.parseIdentNode();if(this.next(!!K),this.finishNode(ee,"Identifier"),!K){if(this.checkUnreserved(ee),ee.name==="await"&&!this.awaitIdentPos)this.awaitIdentPos=ee.start}return ee};en.parseIdentNode=function(){var K=this.startNode();if(this.type===Ut.name)K.name=this.value;else if(this.type.keyword){if(K.name=this.type.keyword,(K.name==="class"||K.name==="function")&&(this.lastTokEnd!==this.lastTokStart+1||this.input.charCodeAt(this.lastTokStart)!==46))this.context.pop();this.type=Ut.name}else this.unexpected();return K};en.parsePrivateIdent=function(){var K=this.startNode();if(this.type===Ut.privateId)K.name=this.value;else this.unexpected();if(this.next(),this.finishNode(K,"PrivateIdentifier"),this.options.checkPrivateFields)if(this.privateNameStack.length===0)this.raise(K.start,"Private field '#"+K.name+"' must be declared in an enclosing class");else this.privateNameStack[this.privateNameStack.length-1].used.push(K);return K};en.parseYield=function(K){if(!this.yieldPos)this.yieldPos=this.start;var ee=this.startNode();if(this.next(),this.type===Ut.semi||this.canInsertSemicolon()||this.type!==Ut.star&&!this.type.startsExpr)ee.delegate=!1,ee.argument=null;else ee.delegate=this.eat(Ut.star),ee.argument=this.parseMaybeAssign(K);return this.finishNode(ee,"YieldExpression")};en.parseAwait=function(K){if(!this.awaitPos)this.awaitPos=this.start;var ee=this.startNode();return this.next(),ee.argument=this.parseMaybeUnary(null,!0,!1,K),this.finishNode(ee,"AwaitExpression")};var zs=s.prototype;zs.raise=function(K,ee){var Oe=Do(this.input,K);if(ee+=" ("+Oe.line+":"+Oe.column+")",this.sourceFile)ee+=" in "+this.sourceFile;var Ot=SyntaxError(ee);throw Ot.pos=K,Ot.loc=Oe,Ot.raisedAt=this.pos,Ot};zs.raiseRecoverable=zs.raise;zs.curPosition=function(){if(this.options.locations)return new ys(this.curLine,this.pos-this.lineStart)};var Vn=s.prototype,tl=function(K){this.flags=K,this.var=[],this.lexical=[],this.functions=[]};Vn.enterScope=function(K){this.scopeStack.push(new tl(K))};Vn.exitScope=function(){this.scopeStack.pop()};Vn.treatFunctionsAsVarInScope=function(K){return K.flags&Yn||!this.inModule&&K.flags&Jn};Vn.declareName=function(K,ee,Oe){var Ot=!1;if(ee===On){var Ft=this.currentScope();if(Ot=Ft.lexical.indexOf(K)>-1||Ft.functions.indexOf(K)>-1||Ft.var.indexOf(K)>-1,Ft.lexical.push(K),this.inModule&&Ft.flags&Jn)delete this.undefinedExports[K]}else if(ee===Mo){var jt=this.currentScope();jt.lexical.push(K)}else if(ee===Oo){var Gt=this.currentScope();if(this.treatFunctionsAsVar)Ot=Gt.lexical.indexOf(K)>-1;else Ot=Gt.lexical.indexOf(K)>-1||Gt.var.indexOf(K)>-1;Gt.functions.push(K)}else for(var Mt=this.scopeStack.length-1;Mt>=0;--Mt){var Vt=this.scopeStack[Mt];if(Vt.lexical.indexOf(K)>-1&&!(Vt.flags&Ro&&Vt.lexical[0]===K)||!this.treatFunctionsAsVarInScope(Vt)&&Vt.functions.indexOf(K)>-1){Ot=!0;break}if(Vt.var.push(K),this.inModule&&Vt.flags&Jn)delete this.undefinedExports[K];if(Vt.flags&Qs)break}if(Ot)this.raiseRecoverable(Oe,"Identifier '"+K+"' has already been declared")};Vn.checkLocalExport=function(K){if(this.scopeStack[0].lexical.indexOf(K.name)===-1&&this.scopeStack[0].var.indexOf(K.name)===-1)this.undefinedExports[K.name]=K};Vn.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]};Vn.currentVarScope=function(){for(var K=this.scopeStack.length-1;;K--){var ee=this.scopeStack[K];if(ee.flags&(Qs|vs|Qn))return ee}};Vn.currentThisScope=function(){for(var K=this.scopeStack.length-1;;K--){var ee=this.scopeStack[K];if(ee.flags&(Qs|vs|Qn)&&!(ee.flags&zi))return ee}};var ei=function(K,ee,Oe){if(this.type="",this.start=ee,this.end=0,K.options.locations)this.loc=new Js(K,Oe);if(K.options.directSourceFile)this.sourceFile=K.options.directSourceFile;if(K.options.ranges)this.range=[ee,0]},Es=s.prototype;Es.startNode=function(){return new ei(this,this.start,this.startLoc)};Es.startNodeAt=function(K,ee){return new ei(this,K,ee)};function Vo(K,ee,Oe,Ot){if(K.type=ee,K.end=Oe,this.options.locations)K.loc.end=Ot;if(this.options.ranges)K.range[1]=Oe;return K}Es.finishNode=function(K,ee){return Vo.call(this,K,ee,this.lastTokEnd,this.lastTokEndLoc)};Es.finishNodeAt=function(K,ee,Oe,Ot){return Vo.call(this,K,ee,Oe,Ot)};Es.copyNode=function(K){var ee=new ei(this,K.start,this.startLoc);for(var Oe in K)ee[Oe]=K[Oe];return ee};var Go=function(){};Go.prototype.reset=function(){};s.prototype.validateRegExpFlags=function(){};s.prototype.validateRegExpPattern=function(){};var Qi=function(K){if(this.type=K.type,this.value=K.value,this.start=K.start,this.end=K.end,K.options.locations)this.loc=new Js(K,K.startLoc,K.endLoc);if(K.options.ranges)this.range=[K.start,K.end]},nn=s.prototype;nn.next=function(K){if(!K&&this.type.keyword&&this.containsEsc)this.raiseRecoverable(this.start,"Escape sequence in keyword "+this.type.keyword);if(this.options.onToken)this.options.onToken(new Qi(this));this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()};nn.getToken=function(){return this.next(),new Qi(this)};if(typeof Symbol<"u")nn[Symbol.iterator]=function(){var K=this;return{next:function(){var ee=K.getToken();return{done:ee.type===Ut.eof,value:ee}}}};nn.nextToken=function(){var K=this.curContext();if(!K||!K.preserveSpace)this.skipSpace();if(this.start=this.pos,this.options.locations)this.startLoc=this.curPosition();if(this.pos>=this.input.length)return this.finishToken(Ut.eof);if(K.override)return K.override(this);else this.readToken(this.fullCharCodeAtPos())};nn.readToken=function(K){if(m(K,this.options.ecmaVersion>=6)||K===92)return this.readWord();return this.getTokenFromCode(K)};nn.fullCharCodeAt=function(K){var ee=this.input.charCodeAt(K);if(ee<=55295||ee>=56320)return ee;var Oe=this.input.charCodeAt(K+1);return Oe<=56319||Oe>=57344?ee:(ee<<10)+Oe-56613888};nn.fullCharCodeAtPos=function(){return this.fullCharCodeAt(this.pos)};nn.skipBlockComment=function(){var K=this.options.onComment&&this.curPosition(),ee=this.pos,Oe=this.input.indexOf("*/",this.pos+=2);if(Oe===-1)this.raise(this.pos-2,"Unterminated comment");if(this.pos=Oe+2,this.options.locations)for(var Ot=void 0,Ft=ee;(Ot=Ao(this.input,Ft,this.pos))>-1;)++this.curLine,Ft=this.lineStart=Ot;if(this.options.onComment)this.options.onComment(!0,this.input.slice(ee+2,Oe),ee,this.pos,K,this.curPosition())};nn.skipLineComment=function(K){var ee=this.pos,Oe=this.options.onComment&&this.curPosition(),Ot=this.input.charCodeAt(this.pos+=K);while(this.pos<this.input.length&&!as(Ot))Ot=this.input.charCodeAt(++this.pos);if(this.options.onComment)this.options.onComment(!1,this.input.slice(ee+K,this.pos),ee,this.pos,Oe,this.curPosition())};nn.skipSpace=function(){e:while(this.pos<this.input.length){var K=this.input.charCodeAt(this.pos);switch(K){case 32:case 160:++this.pos;break;case 13:if(this.input.charCodeAt(this.pos+1)===10)++this.pos;case 10:case 8232:case 8233:if(++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(K>8&&K<14||K>=5760&&No.test(String.fromCharCode(K)))++this.pos;else break e}}};nn.finishToken=function(K,ee){if(this.end=this.pos,this.options.locations)this.endLoc=this.curPosition();var Oe=this.type;this.type=K,this.value=ee,this.updateContext(Oe)};nn.readToken_dot=function(){var K=this.input.charCodeAt(this.pos+1);if(K>=48&&K<=57)return this.readNumber(!0);var ee=this.input.charCodeAt(this.pos+2);if(this.options.ecmaVersion>=6&&K===46&&ee===46)return this.pos+=3,this.finishToken(Ut.ellipsis);else return++this.pos,this.finishToken(Ut.dot)};nn.readToken_slash=function(){var K=this.input.charCodeAt(this.pos+1);if(this.exprAllowed)return++this.pos,this.readRegexp();if(K===61)return this.finishOp(Ut.assign,2);return this.finishOp(Ut.slash,1)};nn.readToken_mult_modulo_exp=function(K){var ee=this.input.charCodeAt(this.pos+1),Oe=1,Ot=K===42?Ut.star:Ut.modulo;if(this.options.ecmaVersion>=7&&K===42&&ee===42)++Oe,Ot=Ut.starstar,ee=this.input.charCodeAt(this.pos+2);if(ee===61)return this.finishOp(Ut.assign,Oe+1);return this.finishOp(Ot,Oe)};nn.readToken_pipe_amp=function(K){var ee=this.input.charCodeAt(this.pos+1);if(ee===K){if(this.options.ecmaVersion>=12){var Oe=this.input.charCodeAt(this.pos+2);if(Oe===61)return this.finishOp(Ut.assign,3)}return this.finishOp(K===124?Ut.logicalOR:Ut.logicalAND,2)}if(ee===61)return this.finishOp(Ut.assign,2);return this.finishOp(K===124?Ut.bitwiseOR:Ut.bitwiseAND,1)};nn.readToken_caret=function(){var K=this.input.charCodeAt(this.pos+1);if(K===61)return this.finishOp(Ut.assign,2);return this.finishOp(Ut.bitwiseXOR,1)};nn.readToken_plus_min=function(K){var ee=this.input.charCodeAt(this.pos+1);if(ee===K){if(ee===45&&!this.inModule&&this.input.charCodeAt(this.pos+2)===62&&(this.lastTokEnd===0||xn.test(this.input.slice(this.lastTokEnd,this.pos))))return this.skipLineComment(3),this.skipSpace(),this.nextToken();return this.finishOp(Ut.incDec,2)}if(ee===61)return this.finishOp(Ut.assign,2);return this.finishOp(Ut.plusMin,1)};nn.readToken_lt_gt=function(K){var ee=this.input.charCodeAt(this.pos+1),Oe=1;if(ee===K){if(Oe=K===62&&this.input.charCodeAt(this.pos+2)===62?3:2,this.input.charCodeAt(this.pos+Oe)===61)return this.finishOp(Ut.assign,Oe+1);return this.finishOp(Ut.bitShift,Oe)}if(ee===33&&K===60&&!this.inModule&&this.input.charCodeAt(this.pos+2)===45&&this.input.charCodeAt(this.pos+3)===45)return this.skipLineComment(4),this.skipSpace(),this.nextToken();if(ee===61)Oe=2;return this.finishOp(Ut.relational,Oe)};nn.readToken_eq_excl=function(K){var ee=this.input.charCodeAt(this.pos+1);if(ee===61)return this.finishOp(Ut.equality,this.input.charCodeAt(this.pos+2)===61?3:2);if(K===61&&ee===62&&this.options.ecmaVersion>=6)return this.pos+=2,this.finishToken(Ut.arrow);return this.finishOp(K===61?Ut.eq:Ut.prefix,1)};nn.readToken_question=function(){var K=this.options.ecmaVersion;if(K>=11){var ee=this.input.charCodeAt(this.pos+1);if(ee===46){var Oe=this.input.charCodeAt(this.pos+2);if(Oe<48||Oe>57)return this.finishOp(Ut.questionDot,2)}if(ee===63){if(K>=12){var Ot=this.input.charCodeAt(this.pos+2);if(Ot===61)return this.finishOp(Ut.assign,3)}return this.finishOp(Ut.coalesce,2)}}return this.finishOp(Ut.question,1)};nn.readToken_numberSign=function(){var K=this.options.ecmaVersion,ee=35;if(K>=13){if(++this.pos,ee=this.fullCharCodeAtPos(),m(ee,!0)||ee===92)return this.finishToken(Ut.privateId,this.readWord1())}this.raise(this.pos,"Unexpected character '"+Xs(ee)+"'")};nn.getTokenFromCode=function(K){switch(K){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(Ut.parenL);case 41:return++this.pos,this.finishToken(Ut.parenR);case 59:return++this.pos,this.finishToken(Ut.semi);case 44:return++this.pos,this.finishToken(Ut.comma);case 91:return++this.pos,this.finishToken(Ut.bracketL);case 93:return++this.pos,this.finishToken(Ut.bracketR);case 123:return++this.pos,this.finishToken(Ut.braceL);case 125:return++this.pos,this.finishToken(Ut.braceR);case 58:return++this.pos,this.finishToken(Ut.colon);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(Ut.backQuote);case 48:var ee=this.input.charCodeAt(this.pos+1);if(ee===120||ee===88)return this.readRadixNumber(16);if(this.options.ecmaVersion>=6){if(ee===111||ee===79)return this.readRadixNumber(8);if(ee===98||ee===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(K);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo_exp(K);case 124:case 38:return this.readToken_pipe_amp(K);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(K);case 60:case 62:return this.readToken_lt_gt(K);case 61:case 33:return this.readToken_eq_excl(K);case 63:return this.readToken_question();case 126:return this.finishOp(Ut.prefix,1);case 35:return this.readToken_numberSign()}this.raise(this.pos,"Unexpected character '"+Xs(K)+"'")};nn.finishOp=function(K,ee){var Oe=this.input.slice(this.pos,this.pos+ee);return this.pos+=ee,this.finishToken(K,Oe)};nn.readRegexp=function(){var K,ee,Oe=this.pos;for(;;){if(this.pos>=this.input.length)this.raise(Oe,"Unterminated regular expression");var Ot=this.input.charAt(this.pos);if(xn.test(Ot))this.raise(Oe,"Unterminated regular expression");if(!K){if(Ot==="[")ee=!0;else if(Ot==="]"&&ee)ee=!1;else if(Ot==="/"&&!ee)break;K=Ot==="\\"}else K=!1;++this.pos}var Ft=this.input.slice(Oe,this.pos);++this.pos;var jt=this.pos,Gt=this.readWord1();if(this.containsEsc)this.unexpected(jt);var Mt=this.regexpState||(this.regexpState=new Go(this));Mt.reset(Oe,Ft,Gt),this.validateRegExpFlags(Mt),this.validateRegExpPattern(Mt);var Vt=null;try{Vt=new RegExp(Ft,Gt)}catch(Wt){}return this.finishToken(Ut.regexp,{pattern:Ft,flags:Gt,value:Vt})};nn.readInt=function(K,ee,Oe){var Ot=this.options.ecmaVersion>=12&&ee===void 0,Ft=Oe&&this.input.charCodeAt(this.pos)===48,jt=this.pos,Gt=0,Mt=0;for(var Vt=0,Wt=ee==null?1/0:ee;Vt<Wt;++Vt,++this.pos){var Kt=this.input.charCodeAt(this.pos),Ht=void 0;if(Ot&&Kt===95){if(Ft)this.raiseRecoverable(this.pos,"Numeric separator is not allowed in legacy octal numeric literals");if(Mt===95)this.raiseRecoverable(this.pos,"Numeric separator must be exactly one underscore");if(Vt===0)this.raiseRecoverable(this.pos,"Numeric separator is not allowed at the first of digits");Mt=Kt;continue}if(Kt>=97)Ht=Kt-97+10;else if(Kt>=65)Ht=Kt-65+10;else if(Kt>=48&&Kt<=57)Ht=Kt-48;else Ht=1/0;if(Ht>=K)break;Mt=Kt,Gt=Gt*K+Ht}if(Ot&&Mt===95)this.raiseRecoverable(this.pos-1,"Numeric separator is not allowed at the last of digits");if(this.pos===jt||ee!=null&&this.pos-jt!==ee)return null;return Gt};function nl(K,ee){if(ee)return parseInt(K,8);return parseFloat(K.replace(/_/g,""))}function Wo(K){if(typeof BigInt!=="function")return null;return BigInt(K.replace(/_/g,""))}nn.readRadixNumber=function(K){var ee=this.pos;this.pos+=2;var Oe=this.readInt(K);if(Oe==null)this.raise(this.start+2,"Expected number in radix "+K);if(this.options.ecmaVersion>=11&&this.input.charCodeAt(this.pos)===110)Oe=Wo(this.input.slice(ee,this.pos)),++this.pos;else if(m(this.fullCharCodeAtPos()))this.raise(this.pos,"Identifier directly after number");return this.finishToken(Ut.num,Oe)};nn.readNumber=function(K){var ee=this.pos;if(!K&&this.readInt(10,void 0,!0)===null)this.raise(ee,"Invalid number");var Oe=this.pos-ee>=2&&this.input.charCodeAt(ee)===48;if(Oe&&this.strict)this.raise(ee,"Invalid number");var Ot=this.input.charCodeAt(this.pos);if(!Oe&&!K&&this.options.ecmaVersion>=11&&Ot===110){var Ft=Wo(this.input.slice(ee,this.pos));if(++this.pos,m(this.fullCharCodeAtPos()))this.raise(this.pos,"Identifier directly after number");return this.finishToken(Ut.num,Ft)}if(Oe&&/[89]/.test(this.input.slice(ee,this.pos)))Oe=!1;if(Ot===46&&!Oe)++this.pos,this.readInt(10),Ot=this.input.charCodeAt(this.pos);if((Ot===69||Ot===101)&&!Oe){if(Ot=this.input.charCodeAt(++this.pos),Ot===43||Ot===45)++this.pos;if(this.readInt(10)===null)this.raise(ee,"Invalid number")}if(m(this.fullCharCodeAtPos()))this.raise(this.pos,"Identifier directly after number");var jt=nl(this.input.slice(ee,this.pos),Oe);return this.finishToken(Ut.num,jt)};nn.readCodePoint=function(){var K=this.input.charCodeAt(this.pos),ee;if(K===123){if(this.options.ecmaVersion<6)this.unexpected();var Oe=++this.pos;if(ee=this.readHexChar(this.input.indexOf("}",this.pos)-this.pos),++this.pos,ee>1114111)this.invalidStringToken(Oe,"Code point out of bounds")}else ee=this.readHexChar(4);return ee};nn.readString=function(K){var ee="",Oe=++this.pos;for(;;){if(this.pos>=this.input.length)this.raise(this.start,"Unterminated string constant");var Ot=this.input.charCodeAt(this.pos);if(Ot===K)break;if(Ot===92)ee+=this.input.slice(Oe,this.pos),ee+=this.readEscapedChar(!1),Oe=this.pos;else if(Ot===8232||Ot===8233){if(this.options.ecmaVersion<10)this.raise(this.start,"Unterminated string constant");if(++this.pos,this.options.locations)this.curLine++,this.lineStart=this.pos}else{if(as(Ot))this.raise(this.start,"Unterminated string constant");++this.pos}}return ee+=this.input.slice(Oe,this.pos++),this.finishToken(Ut.string,ee)};var Uo={};nn.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(K){if(K===Uo)this.readInvalidTemplateToken();else throw K}this.inTemplateElement=!1};nn.invalidStringToken=function(K,ee){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw Uo;else this.raise(K,ee)};nn.readTmplToken=function(){var K="",ee=this.pos;for(;;){if(this.pos>=this.input.length)this.raise(this.start,"Unterminated template");var Oe=this.input.charCodeAt(this.pos);if(Oe===96||Oe===36&&this.input.charCodeAt(this.pos+1)===123){if(this.pos===this.start&&(this.type===Ut.template||this.type===Ut.invalidTemplate))if(Oe===36)return this.pos+=2,this.finishToken(Ut.dollarBraceL);else return++this.pos,this.finishToken(Ut.backQuote);return K+=this.input.slice(ee,this.pos),this.finishToken(Ut.template,K)}if(Oe===92)K+=this.input.slice(ee,this.pos),K+=this.readEscapedChar(!0),ee=this.pos;else if(as(Oe)){switch(K+=this.input.slice(ee,this.pos),++this.pos,Oe){case 13:if(this.input.charCodeAt(this.pos)===10)++this.pos;case 10:K+=`
|
|
10
|
+
`),cooked:this.value};return this.next(),Oe.tail=this.type===Ut.backQuote,this.finishNode(Oe,"TemplateElement")};en.parseTemplate=function(K){if(K===void 0)K={};var ee=K.isTagged;if(ee===void 0)ee=!1;var Oe=this.startNode();this.next(),Oe.expressions=[];var Ot=this.parseTemplateElement({isTagged:ee});Oe.quasis=[Ot];while(!Ot.tail){if(this.type===Ut.eof)this.raise(this.pos,"Unterminated template literal");this.expect(Ut.dollarBraceL),Oe.expressions.push(this.parseExpression()),this.expect(Ut.braceR),Oe.quasis.push(Ot=this.parseTemplateElement({isTagged:ee}))}return this.next(),this.finishNode(Oe,"TemplateLiteral")};en.isAsyncProp=function(K){return!K.computed&&K.key.type==="Identifier"&&K.key.name==="async"&&(this.type===Ut.name||this.type===Ut.num||this.type===Ut.string||this.type===Ut.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===Ut.star)&&!vn.test(this.input.slice(this.lastTokEnd,this.start))};en.parseObj=function(K,ee){var Oe=this.startNode(),Ot=!0,Ft={};Oe.properties=[],this.next();while(!this.eat(Ut.braceR)){if(!Ot){if(this.expect(Ut.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(Ut.braceR))break}else Ot=!1;var jt=this.parseProperty(K,ee);if(!K)this.checkPropClash(jt,Ft,ee);Oe.properties.push(jt)}return this.finishNode(Oe,K?"ObjectPattern":"ObjectExpression")};en.parseProperty=function(K,ee){var Oe=this.startNode(),Ot,Ft,jt,Gt;if(this.options.ecmaVersion>=9&&this.eat(Ut.ellipsis)){if(K){if(Oe.argument=this.parseIdent(!1),this.type===Ut.comma)this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");return this.finishNode(Oe,"RestElement")}if(Oe.argument=this.parseMaybeAssign(!1,ee),this.type===Ut.comma&&ee&&ee.trailingComma<0)ee.trailingComma=this.start;return this.finishNode(Oe,"SpreadElement")}if(this.options.ecmaVersion>=6){if(Oe.method=!1,Oe.shorthand=!1,K||ee)jt=this.start,Gt=this.startLoc;if(!K)Ot=this.eat(Ut.star)}var Mt=this.containsEsc;if(this.parsePropertyName(Oe),!K&&!Mt&&this.options.ecmaVersion>=8&&!Ot&&this.isAsyncProp(Oe))Ft=!0,Ot=this.options.ecmaVersion>=9&&this.eat(Ut.star),this.parsePropertyName(Oe);else Ft=!1;return this.parsePropertyValue(Oe,K,Ot,Ft,jt,Gt,ee,Mt),this.finishNode(Oe,"Property")};en.parseGetterSetter=function(K){var ee=K.key.name;this.parsePropertyName(K),K.value=this.parseMethod(!1),K.kind=ee;var Oe=K.kind==="get"?0:1;if(K.value.params.length!==Oe){var Ot=K.value.start;if(K.kind==="get")this.raiseRecoverable(Ot,"getter should have no params");else this.raiseRecoverable(Ot,"setter should have exactly one param")}else if(K.kind==="set"&&K.value.params[0].type==="RestElement")this.raiseRecoverable(K.value.params[0].start,"Setter cannot use rest params")};en.parsePropertyValue=function(K,ee,Oe,Ot,Ft,jt,Gt,Mt){if((Oe||Ot)&&this.type===Ut.colon)this.unexpected();if(this.eat(Ut.colon))K.value=ee?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,Gt),K.kind="init";else if(this.options.ecmaVersion>=6&&this.type===Ut.parenL){if(ee)this.unexpected();K.method=!0,K.value=this.parseMethod(Oe,Ot),K.kind="init"}else if(!ee&&!Mt&&this.options.ecmaVersion>=5&&!K.computed&&K.key.type==="Identifier"&&(K.key.name==="get"||K.key.name==="set")&&(this.type!==Ut.comma&&this.type!==Ut.braceR&&this.type!==Ut.eq)){if(Oe||Ot)this.unexpected();this.parseGetterSetter(K)}else if(this.options.ecmaVersion>=6&&!K.computed&&K.key.type==="Identifier"){if(Oe||Ot)this.unexpected();if(this.checkUnreserved(K.key),K.key.name==="await"&&!this.awaitIdentPos)this.awaitIdentPos=Ft;if(ee)K.value=this.parseMaybeDefault(Ft,jt,this.copyNode(K.key));else if(this.type===Ut.eq&&Gt){if(Gt.shorthandAssign<0)Gt.shorthandAssign=this.start;K.value=this.parseMaybeDefault(Ft,jt,this.copyNode(K.key))}else K.value=this.copyNode(K.key);K.kind="init",K.shorthand=!0}else this.unexpected()};en.parsePropertyName=function(K){if(this.options.ecmaVersion>=6)if(this.eat(Ut.bracketL))return K.computed=!0,K.key=this.parseMaybeAssign(),this.expect(Ut.bracketR),K.key;else K.computed=!1;return K.key=this.type===Ut.num||this.type===Ut.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never")};en.initFunction=function(K){if(K.id=null,this.options.ecmaVersion>=6)K.generator=K.expression=!1;if(this.options.ecmaVersion>=8)K.async=!1};en.parseMethod=function(K,ee,Oe){var Ot=this.startNode(),Ft=this.yieldPos,jt=this.awaitPos,Gt=this.awaitIdentPos;if(this.initFunction(Ot),this.options.ecmaVersion>=6)Ot.generator=K;if(this.options.ecmaVersion>=8)Ot.async=!!ee;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(Ys(ee,Ot.generator)|es|(Oe?Bo:0)),this.expect(Ut.parenL),Ot.params=this.parseBindingList(Ut.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(Ot,!1,!0,!1),this.yieldPos=Ft,this.awaitPos=jt,this.awaitIdentPos=Gt,this.finishNode(Ot,"FunctionExpression")};en.parseArrowExpression=function(K,ee,Oe,Ot){var Ft=this.yieldPos,jt=this.awaitPos,Gt=this.awaitIdentPos;if(this.enterScope(Ys(Oe,!1)|Js),this.initFunction(K),this.options.ecmaVersion>=8)K.async=!!Oe;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,K.params=this.toAssignableList(ee,!0),this.parseFunctionBody(K,!0,!1,Ot),this.yieldPos=Ft,this.awaitPos=jt,this.awaitIdentPos=Gt,this.finishNode(K,"ArrowFunctionExpression")};en.parseFunctionBody=function(K,ee,Oe,Ot){var Ft=ee&&this.type!==Ut.braceL,jt=this.strict,Gt=!1;if(Ft)K.body=this.parseMaybeAssign(Ot),K.expression=!0,this.checkParams(K,!1);else{var Mt=this.options.ecmaVersion>=7&&!this.isSimpleParamList(K.params);if(!jt||Mt){if(Gt=this.strictDirective(this.end),Gt&&Mt)this.raiseRecoverable(K.start,"Illegal 'use strict' directive in function with non-simple parameter list")}var Vt=this.labels;if(this.labels=[],Gt)this.strict=!0;if(this.checkParams(K,!jt&&!Gt&&!ee&&!Oe&&this.isSimpleParamList(K.params)),this.strict&&K.id)this.checkLValSimple(K.id,Wo);K.body=this.parseBlock(!1,void 0,Gt&&!jt),K.expression=!1,this.adaptDirectivePrologue(K.body.body),this.labels=Vt}this.exitScope()};en.isSimpleParamList=function(K){for(var ee=0,Oe=K;ee<Oe.length;ee+=1){var Ot=Oe[ee];if(Ot.type!=="Identifier")return!1}return!0};en.checkParams=function(K,ee){var Oe=Object.create(null);for(var Ot=0,Ft=K.params;Ot<Ft.length;Ot+=1){var jt=Ft[Ot];this.checkLValInnerPattern(jt,Qs,ee?null:Oe)}};en.parseExprList=function(K,ee,Oe,Ot){var Ft=[],jt=!0;while(!this.eat(K)){if(!jt){if(this.expect(Ut.comma),ee&&this.afterTrailingComma(K))break}else jt=!1;var Gt=void 0;if(Oe&&this.type===Ut.comma)Gt=null;else if(this.type===Ut.ellipsis){if(Gt=this.parseSpread(Ot),Ot&&this.type===Ut.comma&&Ot.trailingComma<0)Ot.trailingComma=this.start}else Gt=this.parseMaybeAssign(!1,Ot);Ft.push(Gt)}return Ft};en.checkUnreserved=function(K){var{start:ee,end:Oe,name:Ot}=K;if(this.inGenerator&&Ot==="yield")this.raiseRecoverable(ee,"Cannot use 'yield' as identifier inside a generator");if(this.inAsync&&Ot==="await")this.raiseRecoverable(ee,"Cannot use 'await' as identifier inside an async function");if(!(this.currentThisScope().flags&ts)&&Ot==="arguments")this.raiseRecoverable(ee,"Cannot use 'arguments' in class field initializer");if(this.inClassStaticBlock&&(Ot==="arguments"||Ot==="await"))this.raise(ee,"Cannot use "+Ot+" in class static initialization block");if(this.keywords.test(Ot))this.raise(ee,"Unexpected keyword '"+Ot+"'");if(this.options.ecmaVersion<6&&this.input.slice(ee,Oe).indexOf("\\")!==-1)return;var Ft=this.strict?this.reservedWordsStrict:this.reservedWords;if(Ft.test(Ot)){if(!this.inAsync&&Ot==="await")this.raiseRecoverable(ee,"Cannot use keyword 'await' outside an async function");this.raiseRecoverable(ee,"The keyword '"+Ot+"' is reserved")}};en.parseIdent=function(K){var ee=this.parseIdentNode();if(this.next(!!K),this.finishNode(ee,"Identifier"),!K){if(this.checkUnreserved(ee),ee.name==="await"&&!this.awaitIdentPos)this.awaitIdentPos=ee.start}return ee};en.parseIdentNode=function(){var K=this.startNode();if(this.type===Ut.name)K.name=this.value;else if(this.type.keyword){if(K.name=this.type.keyword,(K.name==="class"||K.name==="function")&&(this.lastTokEnd!==this.lastTokStart+1||this.input.charCodeAt(this.lastTokStart)!==46))this.context.pop();this.type=Ut.name}else this.unexpected();return K};en.parsePrivateIdent=function(){var K=this.startNode();if(this.type===Ut.privateId)K.name=this.value;else this.unexpected();if(this.next(),this.finishNode(K,"PrivateIdentifier"),this.options.checkPrivateFields)if(this.privateNameStack.length===0)this.raise(K.start,"Private field '#"+K.name+"' must be declared in an enclosing class");else this.privateNameStack[this.privateNameStack.length-1].used.push(K);return K};en.parseYield=function(K){if(!this.yieldPos)this.yieldPos=this.start;var ee=this.startNode();if(this.next(),this.type===Ut.semi||this.canInsertSemicolon()||this.type!==Ut.star&&!this.type.startsExpr)ee.delegate=!1,ee.argument=null;else ee.delegate=this.eat(Ut.star),ee.argument=this.parseMaybeAssign(K);return this.finishNode(ee,"YieldExpression")};en.parseAwait=function(K){if(!this.awaitPos)this.awaitPos=this.start;var ee=this.startNode();return this.next(),ee.argument=this.parseMaybeUnary(null,!0,!1,K),this.finishNode(ee,"AwaitExpression")};var Yi=s.prototype;Yi.raise=function(K,ee){var Oe=Lo(this.input,K);if(ee+=" ("+Oe.line+":"+Oe.column+")",this.sourceFile)ee+=" in "+this.sourceFile;var Ot=SyntaxError(ee);throw Ot.pos=K,Ot.loc=Oe,Ot.raisedAt=this.pos,Ot};Yi.raiseRecoverable=Yi.raise;Yi.curPosition=function(){if(this.options.locations)return new vi(this.curLine,this.pos-this.lineStart)};var Gn=s.prototype,pl=function(K){this.flags=K,this.var=[],this.lexical=[],this.functions=[]};Gn.enterScope=function(K){this.scopeStack.push(new pl(K))};Gn.exitScope=function(){this.scopeStack.pop()};Gn.treatFunctionsAsVarInScope=function(K){return K.flags&Zn||!this.inModule&&K.flags&Qn};Gn.declareName=function(K,ee,Oe){var Ot=!1;if(ee===Mn){var Ft=this.currentScope();if(Ot=Ft.lexical.indexOf(K)>-1||Ft.functions.indexOf(K)>-1||Ft.var.indexOf(K)>-1,Ft.lexical.push(K),this.inModule&&Ft.flags&Qn)delete this.undefinedExports[K]}else if(ee===Go){var jt=this.currentScope();jt.lexical.push(K)}else if(ee===Vo){var Gt=this.currentScope();if(this.treatFunctionsAsVar)Ot=Gt.lexical.indexOf(K)>-1;else Ot=Gt.lexical.indexOf(K)>-1||Gt.var.indexOf(K)>-1;Gt.functions.push(K)}else for(var Mt=this.scopeStack.length-1;Mt>=0;--Mt){var Vt=this.scopeStack[Mt];if(Vt.lexical.indexOf(K)>-1&&!(Vt.flags&Fo&&Vt.lexical[0]===K)||!this.treatFunctionsAsVarInScope(Vt)&&Vt.functions.indexOf(K)>-1){Ot=!0;break}if(Vt.var.push(K),this.inModule&&Vt.flags&Qn)delete this.undefinedExports[K];if(Vt.flags&ts)break}if(Ot)this.raiseRecoverable(Oe,"Identifier '"+K+"' has already been declared")};Gn.checkLocalExport=function(K){if(this.scopeStack[0].lexical.indexOf(K.name)===-1&&this.scopeStack[0].var.indexOf(K.name)===-1)this.undefinedExports[K.name]=K};Gn.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]};Gn.currentVarScope=function(){for(var K=this.scopeStack.length-1;;K--){var ee=this.scopeStack[K];if(ee.flags&(ts|Si|ei))return ee}};Gn.currentThisScope=function(){for(var K=this.scopeStack.length-1;;K--){var ee=this.scopeStack[K];if(ee.flags&(ts|Si|ei)&&!(ee.flags&Js))return ee}};var is=function(K,ee,Oe){if(this.type="",this.start=ee,this.end=0,K.options.locations)this.loc=new Zi(K,Oe);if(K.options.directSourceFile)this.sourceFile=K.options.directSourceFile;if(K.options.ranges)this.range=[ee,0]},Ci=s.prototype;Ci.startNode=function(){return new is(this,this.start,this.startLoc)};Ci.startNodeAt=function(K,ee){return new is(this,K,ee)};function Ho(K,ee,Oe,Ot){if(K.type=ee,K.end=Oe,this.options.locations)K.loc.end=Ot;if(this.options.ranges)K.range[1]=Oe;return K}Ci.finishNode=function(K,ee){return Ho.call(this,K,ee,this.lastTokEnd,this.lastTokEndLoc)};Ci.finishNodeAt=function(K,ee,Oe,Ot){return Ho.call(this,K,ee,Oe,Ot)};Ci.copyNode=function(K){var ee=new is(this,K.start,this.startLoc);for(var Oe in K)ee[Oe]=K[Oe];return ee};var qo=function(){};qo.prototype.reset=function(){};s.prototype.validateRegExpFlags=function(){};s.prototype.validateRegExpPattern=function(){};var er=function(K){if(this.type=K.type,this.value=K.value,this.start=K.start,this.end=K.end,K.options.locations)this.loc=new Zi(K,K.startLoc,K.endLoc);if(K.options.ranges)this.range=[K.start,K.end]},nn=s.prototype;nn.next=function(K){if(!K&&this.type.keyword&&this.containsEsc)this.raiseRecoverable(this.start,"Escape sequence in keyword "+this.type.keyword);if(this.options.onToken)this.options.onToken(new er(this));this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()};nn.getToken=function(){return this.next(),new er(this)};if(typeof Symbol<"u")nn[Symbol.iterator]=function(){var K=this;return{next:function(){var ee=K.getToken();return{done:ee.type===Ut.eof,value:ee}}}};nn.nextToken=function(){var K=this.curContext();if(!K||!K.preserveSpace)this.skipSpace();if(this.start=this.pos,this.options.locations)this.startLoc=this.curPosition();if(this.pos>=this.input.length)return this.finishToken(Ut.eof);if(K.override)return K.override(this);else this.readToken(this.fullCharCodeAtPos())};nn.readToken=function(K){if(m(K,this.options.ecmaVersion>=6)||K===92)return this.readWord();return this.getTokenFromCode(K)};nn.fullCharCodeAt=function(K){var ee=this.input.charCodeAt(K);if(ee<=55295||ee>=56320)return ee;var Oe=this.input.charCodeAt(K+1);return Oe<=56319||Oe>=57344?ee:(ee<<10)+Oe-56613888};nn.fullCharCodeAtPos=function(){return this.fullCharCodeAt(this.pos)};nn.skipBlockComment=function(){var K=this.options.onComment&&this.curPosition(),ee=this.pos,Oe=this.input.indexOf("*/",this.pos+=2);if(Oe===-1)this.raise(this.pos-2,"Unterminated comment");if(this.pos=Oe+2,this.options.locations)for(var Ot=void 0,Ft=ee;(Ot=Io(this.input,Ft,this.pos))>-1;)++this.curLine,Ft=this.lineStart=Ot;if(this.options.onComment)this.options.onComment(!0,this.input.slice(ee+2,Oe),ee,this.pos,K,this.curPosition())};nn.skipLineComment=function(K){var ee=this.pos,Oe=this.options.onComment&&this.curPosition(),Ot=this.input.charCodeAt(this.pos+=K);while(this.pos<this.input.length&&!ci(Ot))Ot=this.input.charCodeAt(++this.pos);if(this.options.onComment)this.options.onComment(!1,this.input.slice(ee+K,this.pos),ee,this.pos,Oe,this.curPosition())};nn.skipSpace=function(){e:while(this.pos<this.input.length){var K=this.input.charCodeAt(this.pos);switch(K){case 32:case 160:++this.pos;break;case 13:if(this.input.charCodeAt(this.pos+1)===10)++this.pos;case 10:case 8232:case 8233:if(++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(K>8&&K<14||K>=5760&&Oo.test(String.fromCharCode(K)))++this.pos;else break e}}};nn.finishToken=function(K,ee){if(this.end=this.pos,this.options.locations)this.endLoc=this.curPosition();var Oe=this.type;this.type=K,this.value=ee,this.updateContext(Oe)};nn.readToken_dot=function(){var K=this.input.charCodeAt(this.pos+1);if(K>=48&&K<=57)return this.readNumber(!0);var ee=this.input.charCodeAt(this.pos+2);if(this.options.ecmaVersion>=6&&K===46&&ee===46)return this.pos+=3,this.finishToken(Ut.ellipsis);else return++this.pos,this.finishToken(Ut.dot)};nn.readToken_slash=function(){var K=this.input.charCodeAt(this.pos+1);if(this.exprAllowed)return++this.pos,this.readRegexp();if(K===61)return this.finishOp(Ut.assign,2);return this.finishOp(Ut.slash,1)};nn.readToken_mult_modulo_exp=function(K){var ee=this.input.charCodeAt(this.pos+1),Oe=1,Ot=K===42?Ut.star:Ut.modulo;if(this.options.ecmaVersion>=7&&K===42&&ee===42)++Oe,Ot=Ut.starstar,ee=this.input.charCodeAt(this.pos+2);if(ee===61)return this.finishOp(Ut.assign,Oe+1);return this.finishOp(Ot,Oe)};nn.readToken_pipe_amp=function(K){var ee=this.input.charCodeAt(this.pos+1);if(ee===K){if(this.options.ecmaVersion>=12){var Oe=this.input.charCodeAt(this.pos+2);if(Oe===61)return this.finishOp(Ut.assign,3)}return this.finishOp(K===124?Ut.logicalOR:Ut.logicalAND,2)}if(ee===61)return this.finishOp(Ut.assign,2);return this.finishOp(K===124?Ut.bitwiseOR:Ut.bitwiseAND,1)};nn.readToken_caret=function(){var K=this.input.charCodeAt(this.pos+1);if(K===61)return this.finishOp(Ut.assign,2);return this.finishOp(Ut.bitwiseXOR,1)};nn.readToken_plus_min=function(K){var ee=this.input.charCodeAt(this.pos+1);if(ee===K){if(ee===45&&!this.inModule&&this.input.charCodeAt(this.pos+2)===62&&(this.lastTokEnd===0||vn.test(this.input.slice(this.lastTokEnd,this.pos))))return this.skipLineComment(3),this.skipSpace(),this.nextToken();return this.finishOp(Ut.incDec,2)}if(ee===61)return this.finishOp(Ut.assign,2);return this.finishOp(Ut.plusMin,1)};nn.readToken_lt_gt=function(K){var ee=this.input.charCodeAt(this.pos+1),Oe=1;if(ee===K){if(Oe=K===62&&this.input.charCodeAt(this.pos+2)===62?3:2,this.input.charCodeAt(this.pos+Oe)===61)return this.finishOp(Ut.assign,Oe+1);return this.finishOp(Ut.bitShift,Oe)}if(ee===33&&K===60&&!this.inModule&&this.input.charCodeAt(this.pos+2)===45&&this.input.charCodeAt(this.pos+3)===45)return this.skipLineComment(4),this.skipSpace(),this.nextToken();if(ee===61)Oe=2;return this.finishOp(Ut.relational,Oe)};nn.readToken_eq_excl=function(K){var ee=this.input.charCodeAt(this.pos+1);if(ee===61)return this.finishOp(Ut.equality,this.input.charCodeAt(this.pos+2)===61?3:2);if(K===61&&ee===62&&this.options.ecmaVersion>=6)return this.pos+=2,this.finishToken(Ut.arrow);return this.finishOp(K===61?Ut.eq:Ut.prefix,1)};nn.readToken_question=function(){var K=this.options.ecmaVersion;if(K>=11){var ee=this.input.charCodeAt(this.pos+1);if(ee===46){var Oe=this.input.charCodeAt(this.pos+2);if(Oe<48||Oe>57)return this.finishOp(Ut.questionDot,2)}if(ee===63){if(K>=12){var Ot=this.input.charCodeAt(this.pos+2);if(Ot===61)return this.finishOp(Ut.assign,3)}return this.finishOp(Ut.coalesce,2)}}return this.finishOp(Ut.question,1)};nn.readToken_numberSign=function(){var K=this.options.ecmaVersion,ee=35;if(K>=13){if(++this.pos,ee=this.fullCharCodeAtPos(),m(ee,!0)||ee===92)return this.finishToken(Ut.privateId,this.readWord1())}this.raise(this.pos,"Unexpected character '"+Qi(ee)+"'")};nn.getTokenFromCode=function(K){switch(K){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(Ut.parenL);case 41:return++this.pos,this.finishToken(Ut.parenR);case 59:return++this.pos,this.finishToken(Ut.semi);case 44:return++this.pos,this.finishToken(Ut.comma);case 91:return++this.pos,this.finishToken(Ut.bracketL);case 93:return++this.pos,this.finishToken(Ut.bracketR);case 123:return++this.pos,this.finishToken(Ut.braceL);case 125:return++this.pos,this.finishToken(Ut.braceR);case 58:return++this.pos,this.finishToken(Ut.colon);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(Ut.backQuote);case 48:var ee=this.input.charCodeAt(this.pos+1);if(ee===120||ee===88)return this.readRadixNumber(16);if(this.options.ecmaVersion>=6){if(ee===111||ee===79)return this.readRadixNumber(8);if(ee===98||ee===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(K);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo_exp(K);case 124:case 38:return this.readToken_pipe_amp(K);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(K);case 60:case 62:return this.readToken_lt_gt(K);case 61:case 33:return this.readToken_eq_excl(K);case 63:return this.readToken_question();case 126:return this.finishOp(Ut.prefix,1);case 35:return this.readToken_numberSign()}this.raise(this.pos,"Unexpected character '"+Qi(K)+"'")};nn.finishOp=function(K,ee){var Oe=this.input.slice(this.pos,this.pos+ee);return this.pos+=ee,this.finishToken(K,Oe)};nn.readRegexp=function(){var K,ee,Oe=this.pos;for(;;){if(this.pos>=this.input.length)this.raise(Oe,"Unterminated regular expression");var Ot=this.input.charAt(this.pos);if(vn.test(Ot))this.raise(Oe,"Unterminated regular expression");if(!K){if(Ot==="[")ee=!0;else if(Ot==="]"&&ee)ee=!1;else if(Ot==="/"&&!ee)break;K=Ot==="\\"}else K=!1;++this.pos}var Ft=this.input.slice(Oe,this.pos);++this.pos;var jt=this.pos,Gt=this.readWord1();if(this.containsEsc)this.unexpected(jt);var Mt=this.regexpState||(this.regexpState=new qo(this));Mt.reset(Oe,Ft,Gt),this.validateRegExpFlags(Mt),this.validateRegExpPattern(Mt);var Vt=null;try{Vt=new RegExp(Ft,Gt)}catch(Wt){}return this.finishToken(Ut.regexp,{pattern:Ft,flags:Gt,value:Vt})};nn.readInt=function(K,ee,Oe){var Ot=this.options.ecmaVersion>=12&&ee===void 0,Ft=Oe&&this.input.charCodeAt(this.pos)===48,jt=this.pos,Gt=0,Mt=0;for(var Vt=0,Wt=ee==null?1/0:ee;Vt<Wt;++Vt,++this.pos){var Kt=this.input.charCodeAt(this.pos),Ht=void 0;if(Ot&&Kt===95){if(Ft)this.raiseRecoverable(this.pos,"Numeric separator is not allowed in legacy octal numeric literals");if(Mt===95)this.raiseRecoverable(this.pos,"Numeric separator must be exactly one underscore");if(Vt===0)this.raiseRecoverable(this.pos,"Numeric separator is not allowed at the first of digits");Mt=Kt;continue}if(Kt>=97)Ht=Kt-97+10;else if(Kt>=65)Ht=Kt-65+10;else if(Kt>=48&&Kt<=57)Ht=Kt-48;else Ht=1/0;if(Ht>=K)break;Mt=Kt,Gt=Gt*K+Ht}if(Ot&&Mt===95)this.raiseRecoverable(this.pos-1,"Numeric separator is not allowed at the last of digits");if(this.pos===jt||ee!=null&&this.pos-jt!==ee)return null;return Gt};function cl(K,ee){if(ee)return parseInt(K,8);return parseFloat(K.replace(/_/g,""))}function zo(K){if(typeof BigInt!=="function")return null;return BigInt(K.replace(/_/g,""))}nn.readRadixNumber=function(K){var ee=this.pos;this.pos+=2;var Oe=this.readInt(K);if(Oe==null)this.raise(this.start+2,"Expected number in radix "+K);if(this.options.ecmaVersion>=11&&this.input.charCodeAt(this.pos)===110)Oe=zo(this.input.slice(ee,this.pos)),++this.pos;else if(m(this.fullCharCodeAtPos()))this.raise(this.pos,"Identifier directly after number");return this.finishToken(Ut.num,Oe)};nn.readNumber=function(K){var ee=this.pos;if(!K&&this.readInt(10,void 0,!0)===null)this.raise(ee,"Invalid number");var Oe=this.pos-ee>=2&&this.input.charCodeAt(ee)===48;if(Oe&&this.strict)this.raise(ee,"Invalid number");var Ot=this.input.charCodeAt(this.pos);if(!Oe&&!K&&this.options.ecmaVersion>=11&&Ot===110){var Ft=zo(this.input.slice(ee,this.pos));if(++this.pos,m(this.fullCharCodeAtPos()))this.raise(this.pos,"Identifier directly after number");return this.finishToken(Ut.num,Ft)}if(Oe&&/[89]/.test(this.input.slice(ee,this.pos)))Oe=!1;if(Ot===46&&!Oe)++this.pos,this.readInt(10),Ot=this.input.charCodeAt(this.pos);if((Ot===69||Ot===101)&&!Oe){if(Ot=this.input.charCodeAt(++this.pos),Ot===43||Ot===45)++this.pos;if(this.readInt(10)===null)this.raise(ee,"Invalid number")}if(m(this.fullCharCodeAtPos()))this.raise(this.pos,"Identifier directly after number");var jt=cl(this.input.slice(ee,this.pos),Oe);return this.finishToken(Ut.num,jt)};nn.readCodePoint=function(){var K=this.input.charCodeAt(this.pos),ee;if(K===123){if(this.options.ecmaVersion<6)this.unexpected();var Oe=++this.pos;if(ee=this.readHexChar(this.input.indexOf("}",this.pos)-this.pos),++this.pos,ee>1114111)this.invalidStringToken(Oe,"Code point out of bounds")}else ee=this.readHexChar(4);return ee};nn.readString=function(K){var ee="",Oe=++this.pos;for(;;){if(this.pos>=this.input.length)this.raise(this.start,"Unterminated string constant");var Ot=this.input.charCodeAt(this.pos);if(Ot===K)break;if(Ot===92)ee+=this.input.slice(Oe,this.pos),ee+=this.readEscapedChar(!1),Oe=this.pos;else if(Ot===8232||Ot===8233){if(this.options.ecmaVersion<10)this.raise(this.start,"Unterminated string constant");if(++this.pos,this.options.locations)this.curLine++,this.lineStart=this.pos}else{if(ci(Ot))this.raise(this.start,"Unterminated string constant");++this.pos}}return ee+=this.input.slice(Oe,this.pos++),this.finishToken(Ut.string,ee)};var Xo={};nn.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(K){if(K===Xo)this.readInvalidTemplateToken();else throw K}this.inTemplateElement=!1};nn.invalidStringToken=function(K,ee){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw Xo;else this.raise(K,ee)};nn.readTmplToken=function(){var K="",ee=this.pos;for(;;){if(this.pos>=this.input.length)this.raise(this.start,"Unterminated template");var Oe=this.input.charCodeAt(this.pos);if(Oe===96||Oe===36&&this.input.charCodeAt(this.pos+1)===123){if(this.pos===this.start&&(this.type===Ut.template||this.type===Ut.invalidTemplate))if(Oe===36)return this.pos+=2,this.finishToken(Ut.dollarBraceL);else return++this.pos,this.finishToken(Ut.backQuote);return K+=this.input.slice(ee,this.pos),this.finishToken(Ut.template,K)}if(Oe===92)K+=this.input.slice(ee,this.pos),K+=this.readEscapedChar(!0),ee=this.pos;else if(ci(Oe)){switch(K+=this.input.slice(ee,this.pos),++this.pos,Oe){case 13:if(this.input.charCodeAt(this.pos)===10)++this.pos;case 10:K+=`
|
|
11
11
|
`;break;default:K+=String.fromCharCode(Oe);break}if(this.options.locations)++this.curLine,this.lineStart=this.pos;ee=this.pos}else++this.pos}};nn.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(Ut.invalidTemplate,this.input.slice(this.start,this.pos));case"\r":if(this.input[this.pos+1]===`
|
|
12
12
|
`)++this.pos;case`
|
|
13
13
|
`:case"\u2028":case"\u2029":++this.curLine,this.lineStart=this.pos+1;break}this.raise(this.start,"Unterminated template")};nn.readEscapedChar=function(K){var ee=this.input.charCodeAt(++this.pos);switch(++this.pos,ee){case 110:return`
|
|
14
|
-
`;case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return Xs(this.readCodePoint());case 116:return"\t";case 98:return"\b";case 118:return"\v";case 102:return"\f";case 13:if(this.input.charCodeAt(this.pos)===10)++this.pos;case 10:if(this.options.locations)this.lineStart=this.pos,++this.curLine;return"";case 56:case 57:if(this.strict)this.invalidStringToken(this.pos-1,"Invalid escape sequence");if(K){var Oe=this.pos-1;this.invalidStringToken(Oe,"Invalid escape sequence in template string")}default:if(ee>=48&&ee<=55){var Ot=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],Ft=parseInt(Ot,8);if(Ft>255)Ot=Ot.slice(0,-1),Ft=parseInt(Ot,8);if(this.pos+=Ot.length-1,ee=this.input.charCodeAt(this.pos),(Ot!=="0"||ee===56||ee===57)&&(this.strict||K))this.invalidStringToken(this.pos-1-Ot.length,K?"Octal literal in template string":"Octal literal in strict mode");return String.fromCharCode(Ft)}if(as(ee)){if(this.options.locations)this.lineStart=this.pos,++this.curLine;return""}return String.fromCharCode(ee)}};nn.readHexChar=function(K){var ee=this.pos,Oe=this.readInt(16,K);if(Oe===null)this.invalidStringToken(ee,"Bad character escape sequence");return Oe};nn.readWord1=function(){this.containsEsc=!1;var K="",ee=!0,Oe=this.pos,Ot=this.options.ecmaVersion>=6;while(this.pos<this.input.length){var Ft=this.fullCharCodeAtPos();if(E(Ft,Ot))this.pos+=Ft<=65535?1:2;else if(Ft===92){this.containsEsc=!0,K+=this.input.slice(Oe,this.pos);var jt=this.pos;if(this.input.charCodeAt(++this.pos)!==117)this.invalidStringToken(this.pos,"Expecting Unicode escape sequence \\uXXXX");++this.pos;var Gt=this.readCodePoint();if(!(ee?m:E)(Gt,Ot))this.invalidStringToken(jt,"Invalid Unicode escape");K+=Xs(Gt),Oe=this.pos}else break;ee=!1}return K+this.input.slice(Oe,this.pos)};nn.readWord=function(){var K=this.readWord1(),ee=Ut.name;if(this.keywords.test(K))ee=Hi[K];return this.finishToken(ee,K)};var sl="8.18.0";s.acorn={Parser:s,version:sl,defaultOptions:Wi,Position:ys,SourceLocation:Js,getLineInfo:Do,Node:ei,TokenType:on,tokTypes:Ut,keywordTypes:Hi,TokContext:Tn,tokContexts:an,isIdentifierChar:E,isIdentifierStart:m,Token:Qi,isNewLine:as,lineBreak:xn,lineBreakG:Wc,nonASCIIwhitespace:No};function Ss(K){return(ee)=>K(ee)}function ti(...K){return s.extend(...K)}function bs(K,ee,Oe){for(let Ot=ee;Ot<Oe;Ot++){let Ft=K.charCodeAt(Ot);if(Ft===10||Ft===13||Ft===8232||Ft===8233)return!0}return!1}var Po=new WeakMap;function vn(K,ee){if(K===void 0)return!1;if(K.length<16)return K.includes(ee);let Oe=Po.get(K);if(Oe===void 0||Oe.length>K.length)Oe={names:new Set,length:0},Po.set(K,Oe);while(Oe.length<K.length)Oe.names.add(K[Oe.length++]);return Oe.names.has(ee)}var Zi=/(?:\s|\/\/.*|\/\*[\s\S]*?\*\/)*/g,il=new Map([["any","TSAnyKeyword"],["bigint","TSBigIntKeyword"],["boolean","TSBooleanKeyword"],["never","TSNeverKeyword"],["null","TSNullKeyword"],["number","TSNumberKeyword"],["object","TSObjectKeyword"],["string","TSStringKeyword"],["symbol","TSSymbolKeyword"],["undefined","TSUndefinedKeyword"],["unknown","TSUnknownKeyword"],["void","TSVoidKeyword"]]),rl=new Set("public private protected readonly declare abstract override static accessor".split(" ")),ol=new Set("public private protected readonly override".split(" ")),al=new Set("var let const function class abstract enum interface type namespace module global".split(" ")),pl=new Set("var let const function class interface enum".split(" ")),Ko=new Set(["TSAsExpression","TSSatisfiesExpression","TSNonNullExpression","TSTypeAssertion"]),Ho=1,cl=32,ll=256,ul=0,hl=1,Cs=2,dl=3,fl=4,er=6,qo=7,Zo=256,ir=1024,ml=8|ir,gl=Cs|Zo,zo=1,yl=2,Xo=40,xl=41,vl=44,Jo=46,Yo=58,ni=61,Qo=60,si=123,El=91,tr=42,Sl=35,nr=34,sr=39,bl=SyntaxError("speculative parse failed"),pe=Ss((K)=>{let{tokTypes:ee,keywordTypes:Oe,isIdentifierChar:Ot,isIdentifierStart:Ft}=K.acorn,jt=new K.acorn.TokenType("@");class Gt extends K{inType=!1;$4=!1;$5=!1;$7=null;$k=null;$l=!1;$m=!1;$f=null;$9=[[]];$n=0;$t=0;$o=-1;constructor(Mt,Vt,Wt){super(Mt,Vt,Wt);let Kt=this.options.onComment;if(typeof Kt==="function")this.options.onComment=(Ht,qt,zt,Xt,Qt,Jt)=>{if(zt<this.$t)return;this.$t=Xt,Kt.call(this,Ht,qt,zt,Xt,Qt,Jt)}}reset(){this.inType=!1,this.$4=!1,this.$5=!1,this.$7=null,this.$k=null,this.$l=!1,this.$m=!1,this.$f=null,this.$9=[[]],this.$n=0,this.$t=0,this.$o=-1}getTokenFromCode(Mt){if(Mt===64)return++this.pos,this.finishToken(jt);return super.getTokenFromCode(Mt)}readToken_lt_gt(Mt){if(this.inType)return this.finishOp(ee.relational,1);return super.readToken_lt_gt(Mt)}$a(Mt){let Vt=this.inType;this.inType=!0;let Wt=Mt();if(this.inType=Vt,!Vt&&this.type===ee.relational)this.pos=this.start,this.nextToken();return Wt}$1(){return this.type===ee.relational&&this.value==="<"}$p(){if(this.type===ee.bitShift&&this.value==="<<")this.pos=this.start+1,this.finishToken(ee.relational,"<");return this.$1()}$c(){return this.type===ee.relational&&this.value===">"}$u(){return this.type===ee.prefix&&this.value==="!"}hasPrecedingLineBreak(){return bs(this.input,this.lastTokEnd,this.start)}$d(Mt=this.pos){return Zi.lastIndex=Mt,Zi.exec(this.input),Zi.lastIndex}$2(){return this.input.charCodeAt(this.$d())}$3(){let Mt=this.$d(),Vt=Mt;while(Vt<this.input.length&&Ot(this.input.charCodeAt(Vt)))Vt++;return this.input.slice(Mt,Vt)}$b(){return!bs(this.input,this.pos,this.$d())}$14(){return this.$b()&&Ft(this.$2())&&!Object.hasOwn(Oe,this.$3())}$15(){return{pos:this.pos,type:this.type,value:this.value,start:this.start,end:this.end,startLoc:this.startLoc,endLoc:this.endLoc,lastTokStart:this.lastTokStart,lastTokEnd:this.lastTokEnd,lastTokStartLoc:this.lastTokStartLoc,lastTokEndLoc:this.lastTokEndLoc,curLine:this.curLine,lineStart:this.lineStart,context:this.context.slice(),exprAllowed:this.exprAllowed,containsEsc:this.containsEsc,inType:this.inType,$4:this.$4,$5:this.$5,$7:this.$7,scopes:this.scopeStack.length,privateNames:this.privateNameStack.length,labels:this.labels,labelCount:this.labels.length,strict:this.strict,yieldPos:this.yieldPos,awaitPos:this.awaitPos,awaitIdentPos:this.awaitIdentPos,potentialArrowAt:this.potentialArrowAt,potentialArrowInForAwait:this.potentialArrowInForAwait}}$16(Mt){this.pos=Mt.pos,this.type=Mt.type,this.value=Mt.value,this.start=Mt.start,this.end=Mt.end,this.startLoc=Mt.startLoc,this.endLoc=Mt.endLoc,this.lastTokStart=Mt.lastTokStart,this.lastTokEnd=Mt.lastTokEnd,this.lastTokStartLoc=Mt.lastTokStartLoc,this.lastTokEndLoc=Mt.lastTokEndLoc,this.curLine=Mt.curLine,this.lineStart=Mt.lineStart,this.context=Mt.context,this.exprAllowed=Mt.exprAllowed,this.containsEsc=Mt.containsEsc,this.inType=Mt.inType,this.$4=Mt.$4,this.$5=Mt.$5,this.$7=Mt.$7,this.scopeStack.length=Mt.scopes,this.privateNameStack.length=Mt.privateNames,this.labels=Mt.labels,this.labels.length=Mt.labelCount,this.strict=Mt.strict,this.yieldPos=Mt.yieldPos,this.awaitPos=Mt.awaitPos,this.awaitIdentPos=Mt.awaitIdentPos,this.potentialArrowAt=Mt.potentialArrowAt,this.potentialArrowInForAwait=Mt.potentialArrowInForAwait}raise(Mt,Vt){if(this.$n>0)throw bl;return super.raise(Mt,Vt)}$1y(Mt,Vt){try{super.raise(Mt,Vt)}catch(Wt){if(Wt instanceof SyntaxError)Wt.$1z=!0;throw Wt}throw Error("unreachable")}$g(Mt,Vt=!1){let Wt=this.$15();this.$n++;try{let Kt=Mt();if(Vt||Kt===void 0)this.$16(Wt);return Kt}catch(Kt){if(!(Kt instanceof SyntaxError)||!Vt&&Kt.$1z)throw Kt;this.$16(Wt);return}finally{this.$n--}}$v(Mt){return this.$g(Mt,!0)===!0}$17(Mt){if(Mt.end=this.lastTokEnd,this.options.locations)Mt.loc.end=this.lastTokEndLoc}$q(Mt,Vt){if(Mt.start=Vt.start,this.options.locations)Mt.loc.start=Vt.loc.start}$6(Mt=!1){let Vt=this.startNode();return Vt.typeAnnotation=this.$a(()=>(this.next(),Mt?this.$20():this.$0())),this.finishNode(Vt,"TSTypeAnnotation")}$h(Mt,Vt){if(Vt&&this.eat(ee.question))Mt.optional=!0,this.$17(Mt);if(this.type===ee.colon)Mt.typeAnnotation=this.$6(),this.$17(Mt);return Mt}$20(){if(this.type!==ee.name&&this.type!==ee._this)return this.$0();if(this.isContextual("asserts")&&this.$b()&&Ft(this.$2())){let Mt=this.startNode();if(this.next(),Mt.parameterName=this.type===ee._this?this.$w():this.parseIdent(),this.isContextual("is")&&!this.hasPrecedingLineBreak())return this.$x(Mt,!0);return Mt.asserts=!0,Mt.typeAnnotation=null,this.finishNode(Mt,"TSTypePredicate")}if(this.$3()==="is"&&this.$b()){let Mt=this.startNode();return Mt.parameterName=this.type===ee._this?this.$w():this.parseIdent(!0),this.$x(Mt,!1)}return this.$0()}$x(Mt,Vt){this.next();let Wt=this.startNode();return Wt.typeAnnotation=this.$0(),Mt.typeAnnotation=this.finishNode(Wt,"TSTypeAnnotation"),Mt.asserts=Vt,this.finishNode(Mt,"TSTypePredicate")}$w(){let Mt=this.startNode();return this.next(),this.finishNode(Mt,"TSThisType")}parseWholeType(){this.inType=!0,this.nextToken();let Mt=this.$0();if(this.type!==ee.eof)this.unexpected();return Mt}$0(){let Mt=this.$18();if(this.$4||this.type!==ee._extends||this.hasPrecedingLineBreak())return Mt;let Vt=this.startNodeAt(Mt.start,Mt.loc?.start);return this.next(),Vt.checkType=Mt,Vt.extendsType=this.$i(!0,()=>this.$18()),this.expect(ee.question),Vt.trueType=this.$i(!1,()=>this.$0()),this.expect(ee.colon),Vt.falseType=this.$i(!1,()=>this.$0()),this.finishNode(Vt,"TSConditionalType")}$i(Mt,Vt){let Wt=this.$4;this.$4=Mt;let Kt=Vt();return this.$4=Wt,Kt}$18(){if(this.$21())return this.$19("TSFunctionType");if(this.type===ee._new||this.isContextual("abstract")&&this.$3()==="new")return this.$19("TSConstructorType");return this.$1a("TSUnionType",ee.bitwiseOR,()=>this.$1a("TSIntersectionType",ee.bitwiseAND,()=>this.$1b()))}$19(Mt){let Vt=this.startNode();if(Mt==="TSConstructorType"){if(Vt.abstract=this.isContextual("abstract"),Vt.abstract)this.next();this.next()}return this.$i(!1,()=>this.$r(Vt,ee.arrow)),this.finishNode(Vt,Mt)}$r(Mt,Vt){if(this.$1())Mt.typeParameters=this.$8();if(this.expect(ee.parenL),Mt.parameters=this.parseBindingList(ee.parenR,!1,!0),this.type===Vt)Mt.typeAnnotation=this.$6(!0);else if(Vt===ee.arrow)this.unexpected()}$21(){if(this.$1())return!0;if(this.type!==ee.parenL)return!1;return this.$v(()=>{if(this.next(),this.type===ee.parenR||this.type===ee.ellipsis)return!0;if(this.type===ee.name||this.type===ee._this)this.next();else if(this.type===ee.braceL||this.type===ee.bracketL)this.parseBindingAtom();else return!1;let Mt=this.type;if(Mt===ee.colon||Mt===ee.comma||Mt===ee.question||Mt===ee.eq)return!0;if(Mt!==ee.parenR)return!1;return this.next(),this.type===ee.arrow})}$1a(Mt,Vt,Wt){let Kt=this.startNode(),Ht=this.eat(Vt),qt=[];do qt.push(Wt());while(this.eat(Vt));if(qt.length===1&&!Ht)return qt[0];return Kt.types=qt,this.finishNode(Kt,Mt)}$1b(){if(this.type===ee.name&&!this.containsEsc){let Mt=this.value;if(Mt==="keyof"||Mt==="unique"||Mt==="readonly"){let Vt=this.startNode();return this.next(),Vt.operator=Mt,Vt.typeAnnotation=this.$1b(),this.finishNode(Vt,"TSTypeOperator")}if(Mt==="infer"){let Vt=this.startNode();this.next();let Wt=this.startNode();Wt.name=this.$y();let Kt=this.$g(()=>this.$22());if(Kt)Wt.constraint=Kt;return Vt.typeParameter=this.finishNode(Wt,"TSTypeParameter"),this.finishNode(Vt,"TSInferType")}}return this.$i(!1,()=>this.$23())}$22(){if(!this.eat(ee._extends))return;let Mt=this.$i(!0,()=>this.$0());return this.$4||this.type!==ee.question?Mt:void 0}$y(){if(this.type!==ee.name&&!this.type.keyword)this.unexpected();let Mt=this.type===ee.name?this.value:this.type.keyword;return this.next(),Mt}$23(){let Mt=this.$24();while(!this.hasPrecedingLineBreak()&&this.eat(ee.bracketL)){let Vt=this.startNodeAt(Mt.start,Mt.loc?.start);if(this.eat(ee.bracketR))Vt.elementType=Mt,Mt=this.finishNode(Vt,"TSArrayType");else Vt.objectType=Mt,Vt.indexType=this.$0(),this.expect(ee.bracketR),Mt=this.finishNode(Vt,"TSIndexedAccessType")}return Mt}$24(){switch(this.type){case ee.name:case ee._void:case ee._null:{let Mt=il.get(this.value);if(Mt&&(this.type!==ee.name||!this.containsEsc&&this.$2()!==Jo)){let Vt=this.startNode();return this.next(),this.finishNode(Vt,Mt)}return this.$1c()}case ee.string:case ee.num:case ee._true:case ee._false:{let Mt=this.startNode();return Mt.literal=this.parseExprAtom(),this.finishNode(Mt,"TSLiteralType")}case ee.plusMin:{if(this.value!=="-")break;let Mt=this.startNode(),Vt=this.startNode();if(this.next(),this.type!==ee.num)this.unexpected();return Vt.operator="-",Vt.prefix=!0,Vt.argument=this.parseExprAtom(),Mt.literal=this.finishNode(Vt,"UnaryExpression"),this.finishNode(Mt,"TSLiteralType")}case ee.backQuote:return this.$25();case ee._this:{let Mt=this.$w();if(this.isContextual("is")&&!this.hasPrecedingLineBreak()){let Vt=this.startNodeAt(Mt.start,Mt.loc?.start);return Vt.parameterName=Mt,this.$x(Vt,!1)}return Mt}case ee._typeof:return this.$26();case ee._import:return this.$1d();case ee.braceL:return this.$27()?this.$28():this.$29();case ee.bracketL:return this.$2a();case ee.parenL:{let Mt=this.startNode();return this.next(),Mt.typeAnnotation=this.$0(),this.expect(ee.parenR),this.finishNode(Mt,"TSParenthesizedType")}default:if(this.type.keyword)return this.$1c()}return this.unexpected()}$1c(){let Mt=this.startNode();if(Mt.typeName=this.$j(),!this.hasPrecedingLineBreak()&&this.$1())Mt.typeArguments=this.$e();return this.finishNode(Mt,"TSTypeReference")}$j(){let Mt=this.parseIdent(!0);while(this.eat(ee.dot)){let Vt=this.startNodeAt(Mt.start,Mt.loc?.start);Vt.left=Mt,Vt.right=this.parseIdent(!0),Mt=this.finishNode(Vt,"TSQualifiedName")}return Mt}$26(){let Mt=this.startNode();if(this.next(),Mt.exprName=this.type===ee._import?this.$1d():this.$j(),!this.hasPrecedingLineBreak()&&this.$1())Mt.typeArguments=this.$e();return this.finishNode(Mt,"TSTypeQuery")}$1d(){let Mt=this.startNode();if(this.next(),Mt.argument=this.$1e(),this.eat(ee.dot))Mt.qualifier=this.$j();if(this.$1())Mt.typeArguments=this.$e();return this.finishNode(Mt,"TSImportType")}$z(){if(this.type!==ee.string)this.unexpected();return this.parseExprAtom()}$1e(){this.expect(ee.parenL);let Mt=this.$z();return this.expect(ee.parenR),Mt}$25(){let Mt=this.startNode(),Vt=this.startNode();this.next(),Vt.expressions=[];let Wt=this.parseTemplateElement({isTagged:!1});Vt.quasis=[Wt];while(!Wt.tail){if(this.type===ee.eof)this.raise(this.pos,"Unterminated template literal");this.expect(ee.dollarBraceL),Vt.expressions.push(this.$0()),this.expect(ee.braceR),Wt=this.parseTemplateElement({isTagged:!1}),Vt.quasis.push(Wt)}return this.next(),Mt.literal=this.finishNode(Vt,"TemplateLiteral"),this.finishNode(Mt,"TSLiteralType")}$27(){return this.$v(()=>{if(this.next(),this.type===ee.plusMin)return this.next(),this.isContextual("readonly");if(this.isContextual("readonly"))this.next();if(this.type!==ee.bracketL)return!1;if(this.next(),this.type!==ee.name)return!1;return this.next(),this.type===ee._in})}$28(){let Mt=this.startNode();if(this.expect(ee.braceL),this.type===ee.plusMin)Mt.readonly=this.value,this.next(),this.expectContextual("readonly");else if(this.eatContextual("readonly"))Mt.readonly=!0;this.expect(ee.bracketL);let Vt=this.startNode();if(Vt.name=this.$y(),this.expect(ee._in),Vt.constraint=this.$0(),Mt.typeParameter=this.finishNode(Vt,"TSTypeParameter"),Mt.nameType=this.eatContextual("as")?this.$0():null,this.expect(ee.bracketR),this.type===ee.plusMin)Mt.optional=this.value,this.next(),this.expect(ee.question);else if(this.eat(ee.question))Mt.optional=!0;if(this.eat(ee.colon))Mt.typeAnnotation=this.$0();return this.semicolon(),this.expect(ee.braceR),this.finishNode(Mt,"TSMappedType")}$29(){let Mt=this.startNode();return Mt.members=this.$1f(),this.finishNode(Mt,"TSTypeLiteral")}$1f(){this.expect(ee.braceL);let Mt=[];while(!this.eat(ee.braceR))Mt.push(this.$2b());return Mt}$2b(){let Mt=this.startNode(),Vt="TSPropertySignature",Wt=this.type===ee._new?this.$2():-1;if(this.type===ee.parenL||this.$1())Vt="TSCallSignatureDeclaration",this.$r(Mt,ee.colon);else if(Wt===Xo||Wt===Qo)Vt="TSConstructSignatureDeclaration",this.next(),this.$r(Mt,ee.colon);else{let Kt=this.type===ee._new?this.parseIdent(!0):null;if(this.isContextual("readonly")&&this.$s(!0))this.next(),Mt.readonly=!0;if(this.type===ee.bracketL&&this.$1g())return this.$1h(Mt);let Ht="method";if(Kt)Mt.key=Kt;else{if((this.isContextual("get")||this.isContextual("set"))&&this.$s(!1))Ht=this.value,this.next();this.parsePropertyName(Mt)}if(this.eat(ee.question))Mt.optional=!0;if(this.type===ee.parenL||this.$1()){if(Vt="TSMethodSignature",Ht!=="method")Mt.kind=Ht;this.$r(Mt,ee.colon),Mt.kind=Ht}else if(this.type===ee.colon)Mt.typeAnnotation=this.$6()}return this.$1i(),this.finishNode(Mt,Vt)}$1i(){if(!this.eat(ee.comma))this.semicolon()}$1g(){return this.$v(()=>{if(this.next(),this.type!==ee.name)return!1;return this.next(),this.type===ee.colon})}$1h(Mt){if(this.expect(ee.bracketL),Mt.parameters=[this.$h(this.parseIdent(),!1)],this.expect(ee.bracketR),this.type===ee.colon)Mt.typeAnnotation=this.$6();return this.$1i(),this.finishNode(Mt,"TSIndexSignature")}$2a(){let Mt=this.startNode();this.expect(ee.bracketL),Mt.elementTypes=[];while(!this.eat(ee.bracketR))if(Mt.elementTypes.push(this.$2c()),this.type!==ee.bracketR)this.expect(ee.comma);return this.finishNode(Mt,"TSTupleType")}$2c(){let Mt=this.start,Vt=this.startLoc,Wt=this.eat(ee.ellipsis),Kt;if((this.type===ee.name||this.type.keyword)&&this.$2d()){let Ht=this.startNode();Ht.label=this.parseIdent(!0),Ht.optional=this.eat(ee.question),this.expect(ee.colon),Ht.elementType=this.$0(),Kt=this.finishNode(Ht,"TSNamedTupleMember")}else if(Kt=this.$0(),this.eat(ee.question)){let Ht=this.startNodeAt(Kt.start,Kt.loc?.start);Ht.typeAnnotation=Kt,Kt=this.finishNode(Ht,"TSOptionalType")}if(Wt){let Ht=this.startNodeAt(Mt,Vt);Ht.typeAnnotation=Kt,Kt=this.finishNode(Ht,"TSRestType")}return Kt}$2d(){let Mt=this.$d();if(this.input.charCodeAt(Mt)===63)Mt=this.$d(Mt+1);return this.input.charCodeAt(Mt)===Yo}$8(){return this.$a(()=>{let Mt=this.startNode();this.next(),Mt.params=[];while(!this.$c()){let Vt=this.startNode();while((this.type===ee._const||this.type===ee._in||this.isContextual("out"))&&Ft(this.$2()))Vt[this.value]=!0,this.next();if(Vt.name=this.$y(),this.eat(ee._extends))Vt.constraint=this.$0();if(this.eat(ee.eq))Vt.default=this.$0();if(Mt.params.push(this.finishNode(Vt,"TSTypeParameter")),!this.$c()){if(this.expect(ee.comma),this.$c())Mt.extra={trailingComma:this.lastTokStart}}}if(this.next(),Mt.params.length===0)this.$1y(this.start,"Type parameter list cannot be empty.");return this.finishNode(Mt,"TSTypeParameterDeclaration")})}$e(){return this.$a(()=>{let Mt=this.startNode();this.next(),Mt.params=[];while(!this.$c())if(Mt.params.push(this.$0()),!this.$c())this.expect(ee.comma);if(Mt.params.length===0)this.unexpected();return this.next(),this.finishNode(Mt,"TSTypeParameterInstantiation")})}$1j(){let Mt=[];do{let Vt=this.startNode();if(Vt.expression=this.$j(),this.$1())Vt.typeParameters=this.$e();Mt.push(this.finishNode(Vt,"TSExpressionWithTypeArguments"))}while(this.eat(ee.comma));return Mt}$1k(Mt=!1){if(this.type!==ee.name||this.containsEsc){if(this.type===ee._const&&this.$3()==="enum")return this.$10(this.startNode());return}if(!this.$2e(this.value))return;if(this.value==="declare")return this.$2f(Mt);return this.$1l(this.startNode(),this.value)}$2e(Mt){switch(Mt){case"interface":case"type":case"namespace":return this.$14();case"enum":return Ft(this.$2());case"abstract":return this.$b()&&this.$3()==="class";case"module":{let Vt=this.$2();return this.$b()&&(Vt===nr||Vt===sr||Ft(Vt))}case"declare":return this.$b()&&al.has(this.$3());case"global":return this.$b()&&this.$2()===si}return!1}$1l(Mt,Vt){switch(Vt){case"interface":return this.$1m(Mt);case"type":return this.$2g(Mt);case"enum":return this.$10(Mt);case"abstract":return this.$1n(Mt,!0);case"global":return Mt.global=!0,Mt.id=this.parseIdent(),Mt.body=this.$11(),this.finishNode(Mt,"TSModuleDeclaration")}return this.$2h(Mt)}$2f(Mt){let Vt=this.$5;this.$5=!0;let Wt=this.startNode();this.next();let Kt=this.value;if(Kt==="const"&&this.$3()==="enum")Wt.const=!0;if(!Mt&&pl.has(Kt))Wt.declare=!0;let Ht;if(Wt.const)Ht=this.$10(Wt);else if(Kt==="var"||Kt==="let"||Kt==="const")Ht=this.parseVarStatement(Wt,Kt,!0);else if(Kt==="function")this.next(),Ht=this.parseFunction(Wt,zo,!1,!1);else if(Kt==="class")Ht=this.parseClass(Wt,!0);else Ht=this.$1l(Wt,Kt);return Ht.declare=!0,this.$5=Vt,Ht}$1n(Mt,Vt){return this.next(),Mt.abstract=!0,this.parseClass(Mt,Vt)}$1m(Mt){if(this.next(),Mt.id=this.parseIdent(),this.checkLValSimple(Mt.id,qo),this.$1())Mt.typeParameters=this.$8();return this.$a(()=>{if(this.eat(ee._extends))Mt.extends=this.$1j();let Vt=this.startNode();Vt.body=this.$1f(),Mt.body=this.finishNode(Vt,"TSInterfaceBody")}),this.finishNode(Mt,"TSInterfaceDeclaration")}$2g(Mt){if(this.next(),Mt.id=this.parseIdent(),this.checkLValSimple(Mt.id,er),this.$1())Mt.typeParameters=this.$8();return Mt.typeAnnotation=this.$a(()=>(this.expect(ee.eq),this.$0())),this.semicolon(),this.finishNode(Mt,"TSTypeAliasDeclaration")}$10(Mt){if(this.type===ee._const)Mt.const=!0,this.next();this.next(),Mt.id=this.parseIdent(),this.checkLValSimple(Mt.id,gl),this.expect(ee.braceL),Mt.members=[];while(!this.eat(ee.braceR)){let Vt=this.startNode();if(Vt.id=this.type===ee.string?this.parseExprAtom():this.parseIdent(!0),this.eat(ee.eq))Vt.initializer=this.parseMaybeAssign();if(Mt.members.push(this.finishNode(Vt,"TSEnumMember")),this.type!==ee.braceR)this.expect(ee.comma)}return this.finishNode(Mt,"TSEnumDeclaration")}$2h(Mt){if(this.next(),this.type===ee.string){if(Mt.id=this.parseExprAtom(),this.type===ee.braceL)Mt.body=this.$11();else this.semicolon();return this.finishNode(Mt,"TSModuleDeclaration")}return Mt.id=this.parseIdent(),this.checkLValSimple(Mt.id,ml),this.$1o(Mt)}$1o(Mt){if(this.eat(ee.dot)){let Vt=this.startNode();Vt.id=this.parseIdent(),Mt.body=this.$1o(Vt)}else Mt.body=this.$11();return this.finishNode(Mt,"TSModuleDeclaration")}$11(){this.enterScope(ll);let Mt=this.startNode();this.enterScope(0),this.expect(ee.braceL),Mt.body=[];while(!this.eat(ee.braceR))Mt.body.push(this.parseStatement(null,!0));return this.exitScope(),this.exitScope(),this.finishNode(Mt,"TSModuleBlock")}$1p(Mt,Vt){if(Mt.isExport=Vt,Mt.id=this.parseIdent(),this.checkLValSimple(Mt.id,Cs),this.expect(ee.eq),this.isContextual("require")&&this.$2()===Xo){let Wt=this.startNode();this.next(),Wt.expression=this.$1e(),Mt.moduleReference=this.finishNode(Wt,"TSExternalModuleReference")}else Mt.moduleReference=this.$j();return this.semicolon(),this.finishNode(Mt,"TSImportEqualsDeclaration")}$2i(){let Mt=this.$d();if(this.input.charCodeAt(Mt)!==ni)return!1;let Vt=this.input.charCodeAt(Mt+1);return Vt!==ni&&Vt!==62}parseStatement(Mt,Vt,Wt){if(this.type===jt)this.$1q(!0);let Kt=this.$1k();if(Kt)return Kt;return super.parseStatement(Mt,Vt,Wt)}parseVarStatement(Mt,Vt,Wt){return super.parseVarStatement(Mt,Vt,Wt||this.$5)}parseVarId(Mt,Vt){if(super.parseVarId(Mt,Vt),Mt.id.type==="Identifier"&&this.$u()&&!this.hasPrecedingLineBreak())this.next(),Mt.definite=!0;this.$h(Mt.id,!1)}parseCatchClauseParam(){let Mt=this.$h(this.parseBindingAtom(),!1),Vt=Mt.type==="Identifier";return this.enterScope(Vt?cl:0),this.checkLValPattern(Mt,Vt?fl:Cs),this.expect(ee.parenR),Mt}parseImport(Mt){if(this.next(),Mt.importKind="value",this.type===ee.string)Mt.specifiers=[],Mt.source=this.parseExprAtom();else{if(this.isContextual("type")){let Vt=this.$2();if(Vt===si||Vt===tr||Ft(Vt)&&this.$3()!=="from")Mt.importKind="type",this.next()}if(this.type===ee.name&&this.$2i())return this.$1p(Mt,!1);Mt.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),Mt.source=this.$z()}return this.$1r(Mt),this.semicolon(),this.finishNode(Mt,"ImportDeclaration")}parseWithClause(){if(this.isContextual("assert")&&!this.hasPrecedingLineBreak())this.type=ee._with;return this.type===ee._with?super.parseWithClause():void 0}$1r(Mt){let Vt=this.parseWithClause();if(Vt)Mt.attributes=Vt}parseImportSpecifier(){return this.$1s("importKind",()=>super.parseImportSpecifier())}parseExportSpecifier(Mt){return this.$1s("exportKind",()=>super.parseExportSpecifier(Mt))}$1s(Mt,Vt){let Wt=this.isContextual("type")?this.$2():-1;if(Wt===nr||Wt===sr||Ft(Wt)&&this.$3()!=="as"){let Ht=this.startNode();this.next();let qt=Vt();return this.$q(qt,Ht),qt[Mt]="type",qt}let Kt=Vt();return Kt[Mt]="value",Kt}parseExport(Mt,Vt){if(this.next(),this.eat(ee._import)){if(Mt.importKind="value",this.isContextual("type")&&Ft(this.$2())&&this.$3()!=="from")Mt.importKind="type",this.next();return this.$1p(Mt,!0)}if(this.eat(ee.eq))return Mt.expression=this.parseExpression(),this.semicolon(),this.finishNode(Mt,"TSExportAssignment");if(this.eatContextual("as"))return this.expectContextual("namespace"),Mt.id=this.parseIdent(),this.semicolon(),this.finishNode(Mt,"TSNamespaceExportDeclaration");if(Mt.exportKind="value",this.isContextual("type")){let Ht=this.$2();if(Ht===si||Ht===tr)Mt.exportKind="type",this.next()}if(this.eat(ee.star))return this.parseExportAllDeclaration(Mt,Vt);if(this.eat(ee._default)){if(this.isContextual("interface")&&this.$14())Mt.declaration=this.$1m(this.startNode());else if(this.isContextual("abstract")&&this.$3()==="class")Mt.declaration=this.$1n(this.startNode(),"nullableID");else Mt.declaration=this.parseExportDefaultDeclaration();return this.finishNode(Mt,"ExportDefaultDeclaration")}let Wt=this.isContextual("declare"),Kt=this.$1k(!0);if(Kt||this.shouldParseExportStatement()){if(Mt.declaration=Kt??this.parseStatement(null),Wt||Mt.declaration.type==="TSInterfaceDeclaration"||Mt.declaration.type==="TSTypeAliasDeclaration")Mt.exportKind="type";return Mt.specifiers=[],Mt.source=null,this.finishNode(Mt,"ExportNamedDeclaration")}if(Mt.declaration=null,Mt.specifiers=this.parseExportSpecifiers(Vt),this.eatContextual("from"))Mt.source=this.$z(),this.$1r(Mt);else{for(let Ht of Mt.specifiers)if(this.checkUnreserved(Ht.local),this.checkLocalExport(Ht.local),Ht.local.type==="Literal")this.raise(Ht.local.start,"A string literal cannot be used as an exported binding without `from`.");Mt.source=null}return this.semicolon(),this.finishNode(Mt,"ExportNamedDeclaration")}parseFunction(Mt,Vt,Wt,Kt,Ht){let qt=Vt&zo;if(qt)this.$f=Mt,this.$o=Mt.start;super.parseFunction(Mt,Vt,Wt,Kt,Ht),this.$f=null;let zt=!Mt.body;if(zt)Mt.type="TSDeclareFunction";if(qt&&Mt.id){if(zt){if(this.$5&&this.currentScope().flags&Ho)this.declareName(Mt.id.name,ir,Mt.id.start);this.checkLValSimple(Mt.id,ul)}else if(!(Vt&yl)){let Xt=dl;if(this.strict||Mt.generator||Mt.async)Xt=this.treatFunctionsAsVar?hl:Cs;this.checkLValSimple(Mt.id,Xt)}}return Mt}parseFunctionParams(Mt){if(this.$1())Mt.typeParameters=this.$8();if(super.parseFunctionParams(Mt),this.type===ee.colon)Mt.returnType=this.$6(!0)}parseFunctionBody(Mt,Vt,Wt,Kt){if(Wt&&this.type===ee.colon)Mt.returnType=this.$6(!0);if(Vt||this.type===ee.braceL||Mt.start!==this.$o){super.parseFunctionBody(Mt,Vt,Wt,Kt);return}this.semicolon(),this.exitScope()}parseMethod(Mt,Vt,Wt){let Kt=this.$k;this.$k=null;let Ht=super.parseMethod(Mt,Vt,Wt);if(!Ht.body)Ht.type="TSDeclareMethod";if(Kt)Ht.typeParameters=Kt;return Ht}parseBindingList(Mt,Vt,Wt,Kt){let Ht=Kt===!0||this.$l;return this.$l=!1,super.parseBindingList(Mt,Vt,Wt,Ht)}$s(Mt){if(!Mt&&!this.$b())return!1;let Vt=this.$2();return Vt===El||Vt===si||Vt===tr||Vt===Jo||Vt===Sl||Vt===nr||Vt===sr||Vt>=48&&Vt<=57||Ft(Vt)}parseAssignableListItem(Mt){let Vt=this.$12(),Wt=this.start,Kt=this.startLoc,Ht,qt=!1,zt=!1;if(Mt)while(this.type===ee.name&&ol.has(this.value)&&!this.containsEsc&&this.$s(!1)){if(this.value==="readonly")qt=!0;else if(this.value==="override")zt=!0;else Ht=this.value;this.next()}let Xt;if(this.type===ee._this)Xt=this.startNode(),Xt.name="this",this.next(),this.finishNode(Xt,"Identifier");else Xt=this.parseBindingAtom();let Qt=this.type===ee.eq?this.parseMaybeDefault(Wt,Kt,Xt):this.parseMaybeDefault(Xt.start,Xt.loc?.start,this.$h(Xt,!0));if(Vt.length>0)Qt.decorators=Vt;if(!Ht&&!qt&&!zt)return Qt;let Jt=this.startNodeAt(Wt,Kt);if(Ht)Jt.accessibility=Ht;if(qt)Jt.readonly=!0;if(zt)Jt.override=!0;return Jt.parameter=Qt,this.finishNode(Jt,"TSParameterProperty")}parseBindingListItem(Mt){if(Mt.type==="RestElement")this.$h(Mt,!0);return Mt}checkLValSimple(Mt,Vt,Wt){if(this.$f&&Mt===this.$f.id){this.$f=null;return}if(!Vt&&Ko.has(Mt.type)){this.checkLValSimple(Mt.expression,Vt,Wt);return}switch(Mt.type){case"TSParameterProperty":this.checkLValInnerPattern(Mt.parameter,Vt,Wt);return;case"Identifier":if(Mt.name==="this")return}super.checkLValSimple(Mt,Vt,Wt)}toAssignable(Mt,Vt,Wt){if(Mt&&!Vt&&Ko.has(Mt.type))return Mt;return super.toAssignable(Mt,Vt,Wt)}declareName(Mt,Vt,Wt){let Kt=this.currentScope();if(Vt&ir){this.$1t(Kt,Mt),Kt.$1u??=[],Kt.$1u.push(Mt);return}if(Vt===er||Vt===qo){if(Kt.$13??=[],Vt===er&&vn(Kt.$13,Mt))this.raise(Wt,`type '${Mt}' has already been declared.`);Kt.$13.push(Mt),this.$1t(Kt,Mt);return}if(Vt&Zo){if(Kt.$1v??=[],vn(Kt.$1v,Mt))return;super.declareName(Mt,Cs,Wt),Kt.$1v.push(Mt);return}super.declareName(Mt,Vt,Wt)}$1t(Mt,Vt){if(this.inModule&&Mt.flags&Ho)delete this.undefinedExports[Vt]}checkLocalExport(Mt){for(let Vt=this.scopeStack.length-1;Vt>=0;Vt--){let Wt=this.scopeStack[Vt];if(vn(Wt.$13,Mt.name)||vn(Wt.$1u,Mt.name))return}super.checkLocalExport(Mt)}checkExport(){}raiseRecoverable(Mt,Vt){if(Vt==="Duplicate constructor in the same class")return;super.raiseRecoverable(Mt,Vt)}$12(){let Mt=[];while(this.type===jt)Mt.push(this.$1w());return Mt}$1q(Mt){let Vt=this.$9[this.$9.length-1];while(this.type===jt)Vt.push(this.$1w());if(this.type===ee._export){if(!Mt)this.unexpected()}else if(this.type!==ee._class&&!((this.isContextual("abstract")||this.isContextual("declare"))&&this.$3()==="class"))this.raise(this.start,"Leading decorators must be attached to a class declaration.")}$1w(){let Mt=this.startNode();this.next(),this.$9.push([]);let Vt=this.start,Wt=this.startLoc,Kt;if(this.type===ee.parenL){if(this.next(),Kt=this.parseExpression(),this.expect(ee.parenR),this.options.preserveParens){let qt=this.startNodeAt(Vt,Wt);qt.expression=Kt,Kt=this.finishNode(qt,"ParenthesizedExpression")}}else{Kt=this.parseIdent(!1);while(this.eat(ee.dot)){let qt=this.startNodeAt(Vt,Wt);qt.object=Kt,qt.property=this.parseIdent(!0),qt.computed=!1,Kt=this.finishNode(qt,"MemberExpression")}}let Ht=this.$p()?this.$e():void 0;if(this.eat(ee.parenL)){let qt=this.startNodeAt(Kt.start,Kt.loc?.start);if(qt.callee=Kt,qt.arguments=this.parseExprList(ee.parenR,!1,!1),Ht)qt.typeArguments=Ht;Kt=this.finishNode(qt,"CallExpression")}else if(Ht){let qt=this.startNodeAt(Kt.start,Kt.loc?.start);qt.expression=Kt,qt.typeArguments=Ht,Kt=this.finishNode(qt,"TSInstantiationExpression")}return Mt.expression=Kt,this.$9.pop(),this.finishNode(Mt,"Decorator")}shouldParseExportStatement(){return this.type===jt||super.shouldParseExportStatement()}parseExprAtom(Mt,Vt,Wt){if(this.type===jt)this.$1q(!1);return super.parseExprAtom(Mt,Vt,Wt)}parseProperty(Mt,Vt){if(Mt||this.type!==jt)return super.parseProperty(Mt,Vt);let Wt=this.$12(),Kt=super.parseProperty(Mt,Vt);if(Kt.type==="SpreadElement")this.raise(Kt.start,"Decorators can't be used with SpreadElement");return Kt.decorators=Wt,Kt}parseClassId(Mt,Vt){let Wt=this.$9.length-1,Kt=this.$9[Wt];if(Kt.length>0)Mt.decorators=Kt,this.$q(Mt,Kt[0]),this.$9[Wt]=[];if(!this.isContextual("implements")||Vt===!0)super.parseClassId(Mt,Vt);if(this.$1())Mt.typeParameters=this.$8()}parseClassSuper(Mt){if(super.parseClassSuper(Mt),Mt.superClass&&this.$1())Mt.superTypeParameters=this.$e();if(this.eatContextual("implements"))Mt.implements=this.$a(()=>this.$1j())}parseClassElement(Mt){if(this.type===jt){let zt=this.$12();if(this.type===ee.braceR)this.raise(this.start,"Decorators must be attached to a class element.");let Xt=this.parseClassElement(Mt);return Xt.decorators=zt,this.$q(Xt,zt[0]),Xt}if(this.eat(ee.semi))return null;let Vt=this.startNode();while(this.type===ee.name&&rl.has(this.value)&&!this.containsEsc&&this.$s(this.value==="static")){let zt=this.value;if(this.next(),zt==="static"&&this.type===ee.braceL)return this.next(),this.parseClassStaticBlock(Vt),Vt;if(zt==="public"||zt==="private"||zt==="protected")Vt.accessibility=zt;else Vt[zt]=!0}if(this.type===ee.bracketL&&this.$1g())return this.$1h(Vt);Vt.static??=!1;let Wt="",Kt=!1,Ht=!1,qt="method";if(this.eatContextual("async"))if((this.isClassElementNameStart()||this.type===ee.star)&&!this.canInsertSemicolon())Ht=!0;else Wt="async";if(!Wt&&this.eat(ee.star))Kt=!0;if(!Wt&&!Ht&&!Kt){let zt=this.value;if(this.eatContextual("get")||this.eatContextual("set"))if(this.isClassElementNameStart())qt=zt;else Wt=zt}if(Wt)Vt.computed=!1,Vt.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),Vt.key.name=Wt,this.finishNode(Vt.key,"Identifier");else this.parseClassElementName(Vt);if(this.eat(ee.question))Vt.optional=!0;if(this.type===ee.parenL||this.$1()||qt!=="method"||Kt||Ht){let zt=Vt.key,Xt=!Vt.static&&!Vt.computed&&(zt.type==="Identifier"&&zt.name==="constructor"||zt.type==="Literal"&&zt.value==="constructor");if(Vt.kind=Xt?"constructor":qt,this.$1())Vt.typeParameters=this.$8();this.$l=Xt,this.$o=this.start,this.parseClassMethod(Vt,Kt,Ht,Xt&&Mt)}else{if(!Vt.optional&&this.$u())this.next(),Vt.definite=!0;if(this.type===ee.colon)Vt.typeAnnotation=this.$6();this.parseClassField(Vt)}return Vt}parseMaybeAssign(Mt,Vt,Wt){if(this.$p()){let Kt=this.$g(()=>{let Ht=this.$8(),qt=super.parseMaybeAssign(Mt,Vt,Wt);if(qt.type!=="ArrowFunctionExpression")return;return qt.typeParameters=Ht,this.$q(qt,Ht),qt});if(Kt)return Kt}return super.parseMaybeAssign(Mt,Vt,Wt)}parseMaybeUnary(Mt,Vt,Wt,Kt){if(this.$p()){let Ht=this.startNode();return Ht.typeAnnotation=this.$a(()=>{this.next();let qt=this.$0();if(!this.$c())this.unexpected();return this.next(),qt}),Ht.expression=this.parseMaybeUnary(null,!1,!1,Kt),this.finishNode(Ht,"TSTypeAssertion")}return super.parseMaybeUnary(Mt,Vt,Wt,Kt)}parseMaybeConditional(Mt,Vt){let Wt=this.start,Kt=this.startLoc,Ht=this.parseExprOps(Mt,Vt);if(this.checkExpressionErrors(Vt))return Ht;if(this.type===ee.question&&!(Ht.type==="ArrowFunctionExpression"&&Ht.start===Wt)&&!this.$2j()){this.next();let qt=this.startNodeAt(Wt,Kt);return qt.test=Ht,qt.consequent=this.parseMaybeAssign(),this.expect(ee.colon),qt.alternate=this.parseMaybeAssign(Mt),this.finishNode(qt,"ConditionalExpression")}return Ht}$2j(){let Mt=this.$d(),Vt=this.input.charCodeAt(Mt);if(Vt===Yo||Vt===vl||Vt===xl)return!0;return Vt===ni&&this.input.charCodeAt(Mt+1)!==ni}parseParenItem(Mt){return this.$h(Mt,!0)}$1x(){if(this.type!==ee.colon)return!0;let Mt=this.$g(()=>{let Vt=this.$6(!0);return this.type===ee.arrow&&!this.canInsertSemicolon()?Vt:void 0});if(!Mt)return!1;return this.$7=Mt,!0}shouldParseArrow(Mt){return this.$1x()&&super.shouldParseArrow(Mt)}shouldParseAsyncArrow(){return this.$1x()&&super.shouldParseAsyncArrow()}parseArrowExpression(Mt,Vt,Wt,Kt){if(this.$7)Mt.returnType=this.$7,this.$7=null;return super.parseArrowExpression(Mt,Vt,Wt,Kt)}parseExprList(Mt,Vt,Wt,Kt){if(!this.$m)return super.parseExprList(Mt,Vt,Wt,Kt);this.$m=!1;let Ht=[],qt=!0;while(!this.eat(Mt)){if(qt)qt=!1;else if(this.expect(ee.comma),Vt&&this.afterTrailingComma(Mt))break;if(this.type===ee.ellipsis){let zt=this.parseSpread(Kt);if(this.eat(ee.question))zt.optional=!0;if(this.type===ee.colon)zt.typeAnnotation=this.$6();Ht.push(zt)}else Ht.push(this.parseMaybeAssign(!1,Kt,this.parseParenItem))}return Ht}parseSubscript(Mt,Vt,Wt,Kt,Ht,qt,zt){if(this.$u()&&!this.hasPrecedingLineBreak()){let Qt=this.startNodeAt(Vt,Wt);return this.exprAllowed=!1,this.next(),Qt.expression=Mt,this.finishNode(Qt,"TSNonNullExpression")}if(Ht&&this.$1()){let Qt=this.$g(()=>this.$2k(Vt,Wt,zt));if(Qt)return Qt}let Xt=this.type===ee.questionDot&&this.$2()===Qo;if(this.$1()||Xt||this.type===ee.bitShift&&this.value==="<<"){let Qt=this.$g(()=>{if(Xt)this.next();this.$p();let Jt=this.$e();if(this.type===ee.parenL&&!Kt)return Jt;if(this.type===ee.backQuote)return Xt?void 0:Jt;if(Xt)return;if(this.$c()||this.type===ee.bitShift||this.type.startsExpr&&this.type!==ee.parenL&&!this.hasPrecedingLineBreak())return;return Jt});if(Qt){let Jt=this.startNodeAt(Vt,Wt);if(this.type===ee.parenL&&!Kt){if(this.next(),Jt.callee=Mt,Jt.arguments=this.parseExprList(ee.parenR,!0,!1),Jt.typeArguments=Qt,Xt)Mt.optional=!0;if(Xt||qt)Jt.optional=Xt;return this.finishNode(Jt,"CallExpression")}if(this.type===ee.backQuote)return Jt.tag=Mt,Jt.quasi=this.parseTemplate({isTagged:!0}),Jt.typeArguments=Qt,this.finishNode(Jt,"TaggedTemplateExpression");return Jt.expression=Mt,Jt.typeArguments=Qt,this.finishNode(Jt,"TSInstantiationExpression")}}if(Ht&&this.type===ee.parenL)this.$m=!0;return super.parseSubscript(Mt,Vt,Wt,Kt,Ht,qt,zt)}$2k(Mt,Vt,Wt){let Kt=this.startNodeAt(Mt,Vt);if(Kt.typeParameters=this.$8(),this.expect(ee.parenL),Kt.params=this.parseBindingList(ee.parenR,!1,!0),this.type===ee.colon)Kt.returnType=this.$6(!0);if(this.type!==ee.arrow||this.canInsertSemicolon())return;return this.next(),this.parseArrowExpression(Kt,Kt.params,!0,Wt)}parseDynamicImport(Mt){if(this.next(),Mt.source=this.parseMaybeAssign(),this.eat(ee.comma)&&this.type!==ee.parenR)Mt.arguments=[this.parseExpression()];return this.expect(ee.parenR),this.finishNode(Mt,"ImportExpression")}parseNew(){let Mt=super.parseNew();if(Mt.callee?.type!=="TSInstantiationExpression")return Mt;let Vt=this.startNodeAt(Mt.start,Mt.loc?.start);return Vt.callee=Mt.callee.expression,Vt.typeArguments=Mt.callee.typeArguments,Vt.arguments=Mt.arguments,this.finishNodeAt(Vt,"NewExpression",Mt.end,Mt.loc?.end)}parseExprOp(Mt,Vt,Wt,Kt,Ht){if(ee._in.binop>Kt&&this.type===ee.name&&(this.value==="as"||this.value==="satisfies")&&!this.containsEsc&&!this.hasPrecedingLineBreak()){let qt=this.value==="satisfies",zt=this.startNodeAt(Vt,Wt);return zt.expression=Mt,zt.typeAnnotation=this.$a(()=>{if(this.next(),!qt&&this.type===ee._const){let Xt=this.startNode();return Xt.typeName=this.parseIdent(!0),this.finishNode(Xt,"TSTypeReference")}return this.$0()}),this.finishNode(zt,qt?"TSSatisfiesExpression":"TSAsExpression"),this.parseExprOp(zt,Vt,Wt,Kt,Ht)}return super.parseExprOp(Mt,Vt,Wt,Kt,Ht)}parseGetterSetter(Mt){Mt.kind=Mt.key.name,super.parseGetterSetter(Mt)}parsePropertyValue(Mt,Vt,Wt,Kt,Ht,qt,zt,Xt){if(!Vt&&this.$1()){if(this.$k=this.$8(),this.type!==ee.parenL)this.unexpected();Mt.kind="init"}return super.parsePropertyValue(Mt,Vt,Wt,Kt,Ht,qt,zt,Xt)}}return Gt});function ue(){throw Error('sveast: parsing TypeScript needs `typescript` from "sveast/typescript": createParser({ typescript }) or createModuleParser({ typescript })')}var Cl=/^\t+/;class e extends Error{name="ParseError";code;reason;position;start;end;frame;constructor(K,ee,Oe){super(`${Oe}
|
|
15
|
-
https://svelte.dev/e/${ee}`);this.code=ee,this.reason=Oe;let Ot=typeof K==="number"?K:K?.start,Ft=typeof K==="number"?K:K?.end;if(Ot!==void 0)this.position=[Ot,Ft??Ot],this.start=g(this.position[0]),this.end=g(this.position[1]),this.frame=
|
|
16
|
-
${" ".repeat(Ft+2+
|
|
17
|
-
`)}function Je(K){throw new e(K,"attribute_duplicate","Attributes need to be unique")}function
|
|
18
|
-
`)){let Vt=
|
|
19
|
-
`,Oe-1)+1,Wt=Vt,Kt=
|
|
14
|
+
`;case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return Qi(this.readCodePoint());case 116:return"\t";case 98:return"\b";case 118:return"\v";case 102:return"\f";case 13:if(this.input.charCodeAt(this.pos)===10)++this.pos;case 10:if(this.options.locations)this.lineStart=this.pos,++this.curLine;return"";case 56:case 57:if(this.strict)this.invalidStringToken(this.pos-1,"Invalid escape sequence");if(K){var Oe=this.pos-1;this.invalidStringToken(Oe,"Invalid escape sequence in template string")}default:if(ee>=48&&ee<=55){var Ot=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],Ft=parseInt(Ot,8);if(Ft>255)Ot=Ot.slice(0,-1),Ft=parseInt(Ot,8);if(this.pos+=Ot.length-1,ee=this.input.charCodeAt(this.pos),(Ot!=="0"||ee===56||ee===57)&&(this.strict||K))this.invalidStringToken(this.pos-1-Ot.length,K?"Octal literal in template string":"Octal literal in strict mode");return String.fromCharCode(Ft)}if(ci(ee)){if(this.options.locations)this.lineStart=this.pos,++this.curLine;return""}return String.fromCharCode(ee)}};nn.readHexChar=function(K){var ee=this.pos,Oe=this.readInt(16,K);if(Oe===null)this.invalidStringToken(ee,"Bad character escape sequence");return Oe};nn.readWord1=function(){this.containsEsc=!1;var K="",ee=!0,Oe=this.pos,Ot=this.options.ecmaVersion>=6;while(this.pos<this.input.length){var Ft=this.fullCharCodeAtPos();if(E(Ft,Ot))this.pos+=Ft<=65535?1:2;else if(Ft===92){this.containsEsc=!0,K+=this.input.slice(Oe,this.pos);var jt=this.pos;if(this.input.charCodeAt(++this.pos)!==117)this.invalidStringToken(this.pos,"Expecting Unicode escape sequence \\uXXXX");++this.pos;var Gt=this.readCodePoint();if(!(ee?m:E)(Gt,Ot))this.invalidStringToken(jt,"Invalid Unicode escape");K+=Qi(Gt),Oe=this.pos}else break;ee=!1}return K+this.input.slice(Oe,this.pos)};nn.readWord=function(){var K=this.readWord1(),ee=Ut.name;if(this.keywords.test(K))ee=zs[K];return this.finishToken(ee,K)};var ll="8.18.0";s.acorn={Parser:s,version:ll,defaultOptions:Ks,Position:vi,SourceLocation:Zi,getLineInfo:Lo,Node:is,TokenType:an,tokTypes:Ut,keywordTypes:zs,TokContext:An,tokContexts:pn,isIdentifierChar:E,isIdentifierStart:m,Token:er,isNewLine:ci,lineBreak:vn,lineBreakG:Jc,nonASCIIwhitespace:Oo};function bi(K){return(ee)=>K(ee)}function ss(...K){return s.extend(...K)}function wi(K,ee,Oe){for(let Ot=ee;Ot<Oe;Ot++){let Ft=K.charCodeAt(Ot);if(Ft===10||Ft===13||Ft===8232||Ft===8233)return!0}return!1}var Do=new WeakMap;function En(K,ee){if(K===void 0)return!1;if(K.length<16)return K.includes(ee);let Oe=Do.get(K);if(Oe===void 0||Oe.length>K.length)Oe={names:new Set,length:0},Do.set(K,Oe);while(Oe.length<K.length)Oe.names.add(K[Oe.length++]);return Oe.names.has(ee)}var tr=/(?:\s|\/\/.*|\/\*[\s\S]*?\*\/)*/g,ul=new Map([["any","TSAnyKeyword"],["bigint","TSBigIntKeyword"],["boolean","TSBooleanKeyword"],["never","TSNeverKeyword"],["null","TSNullKeyword"],["number","TSNumberKeyword"],["object","TSObjectKeyword"],["string","TSStringKeyword"],["symbol","TSSymbolKeyword"],["undefined","TSUndefinedKeyword"],["unknown","TSUnknownKeyword"],["void","TSVoidKeyword"]]),hl=new Set("public private protected readonly declare abstract override static accessor".split(" ")),dl=new Set("public private protected readonly override".split(" ")),fl=new Set("var let const function class abstract enum interface type namespace module global".split(" ")),ml=new Set("var let const function class interface enum".split(" ")),Jo=new Set(["TSAsExpression","TSSatisfiesExpression","TSNonNullExpression","TSTypeAssertion"]),Yo=1,gl=32,yl=256,xl=0,vl=1,Ti=2,El=3,Sl=4,nr=6,Qo=7,sa=256,or=1024,Cl=8|or,bl=Ti|sa,Zo=1,wl=2,ea=40,Tl=41,kl=44,ta=46,na=58,rs=61,ia=60,os=123,Al=91,ir=42,Pl=35,sr=34,rr=39,_l=SyntaxError("speculative parse failed"),pe=bi((K)=>{let{tokTypes:ee,keywordTypes:Oe,isIdentifierChar:Ot,isIdentifierStart:Ft}=K.acorn,jt=new K.acorn.TokenType("@");class Gt extends K{inType=!1;$4=!1;$5=!1;$7=null;$k=null;$l=!1;$m=!1;$f=null;$9=[[]];$n=0;$t=0;$o=-1;constructor(Mt,Vt,Wt){super(Mt,Vt,Wt);let Kt=this.options.onComment;if(typeof Kt==="function")this.options.onComment=(Ht,qt,zt,Xt,Yt,Jt)=>{if(zt<this.$t)return;this.$t=Xt,Kt.call(this,Ht,qt,zt,Xt,Yt,Jt)}}reset(){this.inType=!1,this.$4=!1,this.$5=!1,this.$7=null,this.$k=null,this.$l=!1,this.$m=!1,this.$f=null,this.$9=[[]],this.$n=0,this.$t=0,this.$o=-1}getTokenFromCode(Mt){if(Mt===64)return++this.pos,this.finishToken(jt);return super.getTokenFromCode(Mt)}readToken_lt_gt(Mt){if(this.inType)return this.finishOp(ee.relational,1);return super.readToken_lt_gt(Mt)}$a(Mt){let Vt=this.inType;this.inType=!0;let Wt=Mt();if(this.inType=Vt,!Vt&&this.type===ee.relational)this.pos=this.start,this.nextToken();return Wt}$1(){return this.type===ee.relational&&this.value==="<"}$p(){if(this.type===ee.bitShift&&this.value==="<<")this.pos=this.start+1,this.finishToken(ee.relational,"<");return this.$1()}$c(){return this.type===ee.relational&&this.value===">"}$u(){return this.type===ee.prefix&&this.value==="!"}hasPrecedingLineBreak(){return wi(this.input,this.lastTokEnd,this.start)}$d(Mt=this.pos){return tr.lastIndex=Mt,tr.exec(this.input),tr.lastIndex}$2(){return this.input.charCodeAt(this.$d())}$3(){let Mt=this.$d(),Vt=Mt;while(Vt<this.input.length&&Ot(this.input.charCodeAt(Vt)))Vt++;return this.input.slice(Mt,Vt)}$b(){return!wi(this.input,this.pos,this.$d())}$14(){return this.$b()&&Ft(this.$2())&&!Object.hasOwn(Oe,this.$3())}$15(){return{pos:this.pos,type:this.type,value:this.value,start:this.start,end:this.end,startLoc:this.startLoc,endLoc:this.endLoc,lastTokStart:this.lastTokStart,lastTokEnd:this.lastTokEnd,lastTokStartLoc:this.lastTokStartLoc,lastTokEndLoc:this.lastTokEndLoc,curLine:this.curLine,lineStart:this.lineStart,context:this.context.slice(),exprAllowed:this.exprAllowed,containsEsc:this.containsEsc,inType:this.inType,$4:this.$4,$5:this.$5,$7:this.$7,scopes:this.scopeStack.length,privateNames:this.privateNameStack.length,labels:this.labels,labelCount:this.labels.length,strict:this.strict,yieldPos:this.yieldPos,awaitPos:this.awaitPos,awaitIdentPos:this.awaitIdentPos,potentialArrowAt:this.potentialArrowAt,potentialArrowInForAwait:this.potentialArrowInForAwait}}$16(Mt){this.pos=Mt.pos,this.type=Mt.type,this.value=Mt.value,this.start=Mt.start,this.end=Mt.end,this.startLoc=Mt.startLoc,this.endLoc=Mt.endLoc,this.lastTokStart=Mt.lastTokStart,this.lastTokEnd=Mt.lastTokEnd,this.lastTokStartLoc=Mt.lastTokStartLoc,this.lastTokEndLoc=Mt.lastTokEndLoc,this.curLine=Mt.curLine,this.lineStart=Mt.lineStart,this.context=Mt.context,this.exprAllowed=Mt.exprAllowed,this.containsEsc=Mt.containsEsc,this.inType=Mt.inType,this.$4=Mt.$4,this.$5=Mt.$5,this.$7=Mt.$7,this.scopeStack.length=Mt.scopes,this.privateNameStack.length=Mt.privateNames,this.labels=Mt.labels,this.labels.length=Mt.labelCount,this.strict=Mt.strict,this.yieldPos=Mt.yieldPos,this.awaitPos=Mt.awaitPos,this.awaitIdentPos=Mt.awaitIdentPos,this.potentialArrowAt=Mt.potentialArrowAt,this.potentialArrowInForAwait=Mt.potentialArrowInForAwait}raise(Mt,Vt){if(this.$n>0)throw _l;return super.raise(Mt,Vt)}$1y(Mt,Vt){try{super.raise(Mt,Vt)}catch(Wt){if(Wt instanceof SyntaxError)Wt.$1z=!0;throw Wt}throw Error("unreachable")}$g(Mt,Vt=!1){let Wt=this.$15();this.$n++;try{let Kt=Mt();if(Vt||Kt===void 0)this.$16(Wt);return Kt}catch(Kt){if(!(Kt instanceof SyntaxError)||!Vt&&Kt.$1z)throw Kt;this.$16(Wt);return}finally{this.$n--}}$v(Mt){return this.$g(Mt,!0)===!0}$17(Mt){if(Mt.end=this.lastTokEnd,this.options.locations)Mt.loc.end=this.lastTokEndLoc}$q(Mt,Vt){if(Mt.start=Vt.start,this.options.locations)Mt.loc.start=Vt.loc.start}$6(Mt=!1){let Vt=this.startNode();return Vt.typeAnnotation=this.$a(()=>(this.next(),Mt?this.$20():this.$0())),this.finishNode(Vt,"TSTypeAnnotation")}$h(Mt,Vt){if(Vt&&this.eat(ee.question))Mt.optional=!0,this.$17(Mt);if(this.type===ee.colon)Mt.typeAnnotation=this.$6(),this.$17(Mt);return Mt}$20(){if(this.type!==ee.name&&this.type!==ee._this)return this.$0();if(this.isContextual("asserts")&&this.$b()&&Ft(this.$2())){let Mt=this.startNode();if(this.next(),Mt.parameterName=this.type===ee._this?this.$w():this.parseIdent(),this.isContextual("is")&&!this.hasPrecedingLineBreak())return this.$x(Mt,!0);return Mt.asserts=!0,Mt.typeAnnotation=null,this.finishNode(Mt,"TSTypePredicate")}if(this.$3()==="is"&&this.$b()){let Mt=this.startNode();return Mt.parameterName=this.type===ee._this?this.$w():this.parseIdent(!0),this.$x(Mt,!1)}return this.$0()}$x(Mt,Vt){this.next();let Wt=this.startNode();return Wt.typeAnnotation=this.$0(),Mt.typeAnnotation=this.finishNode(Wt,"TSTypeAnnotation"),Mt.asserts=Vt,this.finishNode(Mt,"TSTypePredicate")}$w(){let Mt=this.startNode();return this.next(),this.finishNode(Mt,"TSThisType")}parseWholeType(){this.inType=!0,this.nextToken();let Mt=this.$0();if(this.type!==ee.eof)this.unexpected();return Mt}$0(){let Mt=this.$18();if(this.$4||this.type!==ee._extends||this.hasPrecedingLineBreak())return Mt;let Vt=this.startNodeAt(Mt.start,Mt.loc?.start);return this.next(),Vt.checkType=Mt,Vt.extendsType=this.$i(!0,()=>this.$18()),this.expect(ee.question),Vt.trueType=this.$i(!1,()=>this.$0()),this.expect(ee.colon),Vt.falseType=this.$i(!1,()=>this.$0()),this.finishNode(Vt,"TSConditionalType")}$i(Mt,Vt){let Wt=this.$4;this.$4=Mt;let Kt=Vt();return this.$4=Wt,Kt}$18(){if(this.$21())return this.$19("TSFunctionType");if(this.type===ee._new||this.isContextual("abstract")&&this.$3()==="new")return this.$19("TSConstructorType");return this.$1a("TSUnionType",ee.bitwiseOR,()=>this.$1a("TSIntersectionType",ee.bitwiseAND,()=>this.$1b()))}$19(Mt){let Vt=this.startNode();if(Mt==="TSConstructorType"){if(Vt.abstract=this.isContextual("abstract"),Vt.abstract)this.next();this.next()}return this.$i(!1,()=>this.$r(Vt,ee.arrow)),this.finishNode(Vt,Mt)}$r(Mt,Vt){if(this.$1())Mt.typeParameters=this.$8();if(this.expect(ee.parenL),Mt.parameters=this.parseBindingList(ee.parenR,!1,!0),this.type===Vt)Mt.typeAnnotation=this.$6(!0);else if(Vt===ee.arrow)this.unexpected()}$21(){if(this.$1())return!0;if(this.type!==ee.parenL)return!1;return this.$v(()=>{if(this.next(),this.type===ee.parenR||this.type===ee.ellipsis)return!0;if(this.type===ee.name||this.type===ee._this)this.next();else if(this.type===ee.braceL||this.type===ee.bracketL)this.parseBindingAtom();else return!1;let Mt=this.type;if(Mt===ee.colon||Mt===ee.comma||Mt===ee.question||Mt===ee.eq)return!0;if(Mt!==ee.parenR)return!1;return this.next(),this.type===ee.arrow})}$1a(Mt,Vt,Wt){let Kt=this.startNode(),Ht=this.eat(Vt),qt=[];do qt.push(Wt());while(this.eat(Vt));if(qt.length===1&&!Ht)return qt[0];return Kt.types=qt,this.finishNode(Kt,Mt)}$1b(){if(this.type===ee.name&&!this.containsEsc){let Mt=this.value;if(Mt==="keyof"||Mt==="unique"||Mt==="readonly"){let Vt=this.startNode();return this.next(),Vt.operator=Mt,Vt.typeAnnotation=this.$1b(),this.finishNode(Vt,"TSTypeOperator")}if(Mt==="infer"){let Vt=this.startNode();this.next();let Wt=this.startNode();Wt.name=this.$y();let Kt=this.$g(()=>this.$22());if(Kt)Wt.constraint=Kt;return Vt.typeParameter=this.finishNode(Wt,"TSTypeParameter"),this.finishNode(Vt,"TSInferType")}}return this.$i(!1,()=>this.$23())}$22(){if(!this.eat(ee._extends))return;let Mt=this.$i(!0,()=>this.$0());return this.$4||this.type!==ee.question?Mt:void 0}$y(){if(this.type!==ee.name&&!this.type.keyword)this.unexpected();let Mt=this.type===ee.name?this.value:this.type.keyword;return this.next(),Mt}$23(){let Mt=this.$24();while(!this.hasPrecedingLineBreak()&&this.eat(ee.bracketL)){let Vt=this.startNodeAt(Mt.start,Mt.loc?.start);if(this.eat(ee.bracketR))Vt.elementType=Mt,Mt=this.finishNode(Vt,"TSArrayType");else Vt.objectType=Mt,Vt.indexType=this.$0(),this.expect(ee.bracketR),Mt=this.finishNode(Vt,"TSIndexedAccessType")}return Mt}$24(){switch(this.type){case ee.name:case ee._void:case ee._null:{let Mt=ul.get(this.value);if(Mt&&(this.type!==ee.name||!this.containsEsc&&this.$2()!==ta)){let Vt=this.startNode();return this.next(),this.finishNode(Vt,Mt)}return this.$1c()}case ee.string:case ee.num:case ee._true:case ee._false:{let Mt=this.startNode();return Mt.literal=this.parseExprAtom(),this.finishNode(Mt,"TSLiteralType")}case ee.plusMin:{if(this.value!=="-")break;let Mt=this.startNode(),Vt=this.startNode();if(this.next(),this.type!==ee.num)this.unexpected();return Vt.operator="-",Vt.prefix=!0,Vt.argument=this.parseExprAtom(),Mt.literal=this.finishNode(Vt,"UnaryExpression"),this.finishNode(Mt,"TSLiteralType")}case ee.backQuote:return this.$25();case ee._this:{let Mt=this.$w();if(this.isContextual("is")&&!this.hasPrecedingLineBreak()){let Vt=this.startNodeAt(Mt.start,Mt.loc?.start);return Vt.parameterName=Mt,this.$x(Vt,!1)}return Mt}case ee._typeof:return this.$26();case ee._import:return this.$1d();case ee.braceL:return this.$27()?this.$28():this.$29();case ee.bracketL:return this.$2a();case ee.parenL:{let Mt=this.startNode();return this.next(),Mt.typeAnnotation=this.$0(),this.expect(ee.parenR),this.finishNode(Mt,"TSParenthesizedType")}default:if(this.type.keyword)return this.$1c()}return this.unexpected()}$1c(){let Mt=this.startNode();if(Mt.typeName=this.$j(),!this.hasPrecedingLineBreak()&&this.$1())Mt.typeArguments=this.$e();return this.finishNode(Mt,"TSTypeReference")}$j(){let Mt=this.parseIdent(!0);while(this.eat(ee.dot)){let Vt=this.startNodeAt(Mt.start,Mt.loc?.start);Vt.left=Mt,Vt.right=this.parseIdent(!0),Mt=this.finishNode(Vt,"TSQualifiedName")}return Mt}$26(){let Mt=this.startNode();if(this.next(),Mt.exprName=this.type===ee._import?this.$1d():this.$j(),!this.hasPrecedingLineBreak()&&this.$1())Mt.typeArguments=this.$e();return this.finishNode(Mt,"TSTypeQuery")}$1d(){let Mt=this.startNode();if(this.next(),Mt.argument=this.$1e(),this.eat(ee.dot))Mt.qualifier=this.$j();if(this.$1())Mt.typeArguments=this.$e();return this.finishNode(Mt,"TSImportType")}$z(){if(this.type!==ee.string)this.unexpected();return this.parseExprAtom()}$1e(){this.expect(ee.parenL);let Mt=this.$z();return this.expect(ee.parenR),Mt}$25(){let Mt=this.startNode(),Vt=this.startNode();this.next(),Vt.expressions=[];let Wt=this.parseTemplateElement({isTagged:!1});Vt.quasis=[Wt];while(!Wt.tail){if(this.type===ee.eof)this.raise(this.pos,"Unterminated template literal");this.expect(ee.dollarBraceL),Vt.expressions.push(this.$0()),this.expect(ee.braceR),Wt=this.parseTemplateElement({isTagged:!1}),Vt.quasis.push(Wt)}return this.next(),Mt.literal=this.finishNode(Vt,"TemplateLiteral"),this.finishNode(Mt,"TSLiteralType")}$27(){return this.$v(()=>{if(this.next(),this.type===ee.plusMin)return this.next(),this.isContextual("readonly");if(this.isContextual("readonly"))this.next();if(this.type!==ee.bracketL)return!1;if(this.next(),this.type!==ee.name)return!1;return this.next(),this.type===ee._in})}$28(){let Mt=this.startNode();if(this.expect(ee.braceL),this.type===ee.plusMin)Mt.readonly=this.value,this.next(),this.expectContextual("readonly");else if(this.eatContextual("readonly"))Mt.readonly=!0;this.expect(ee.bracketL);let Vt=this.startNode();if(Vt.name=this.$y(),this.expect(ee._in),Vt.constraint=this.$0(),Mt.typeParameter=this.finishNode(Vt,"TSTypeParameter"),Mt.nameType=this.eatContextual("as")?this.$0():null,this.expect(ee.bracketR),this.type===ee.plusMin)Mt.optional=this.value,this.next(),this.expect(ee.question);else if(this.eat(ee.question))Mt.optional=!0;if(this.eat(ee.colon))Mt.typeAnnotation=this.$0();return this.semicolon(),this.expect(ee.braceR),this.finishNode(Mt,"TSMappedType")}$29(){let Mt=this.startNode();return Mt.members=this.$1f(),this.finishNode(Mt,"TSTypeLiteral")}$1f(){this.expect(ee.braceL);let Mt=[];while(!this.eat(ee.braceR))Mt.push(this.$2b());return Mt}$2b(){let Mt=this.startNode(),Vt="TSPropertySignature",Wt=this.type===ee._new?this.$2():-1;if(this.type===ee.parenL||this.$1())Vt="TSCallSignatureDeclaration",this.$r(Mt,ee.colon);else if(Wt===ea||Wt===ia)Vt="TSConstructSignatureDeclaration",this.next(),this.$r(Mt,ee.colon);else{let Kt=this.type===ee._new?this.parseIdent(!0):null;if(this.isContextual("readonly")&&this.$s(!0))this.next(),Mt.readonly=!0;if(this.type===ee.bracketL&&this.$1g())return this.$1h(Mt);let Ht="method";if(Kt)Mt.key=Kt;else{if((this.isContextual("get")||this.isContextual("set"))&&this.$s(!1))Ht=this.value,this.next();this.parsePropertyName(Mt)}if(this.eat(ee.question))Mt.optional=!0;if(this.type===ee.parenL||this.$1()){if(Vt="TSMethodSignature",Ht!=="method")Mt.kind=Ht;this.$r(Mt,ee.colon),Mt.kind=Ht}else if(this.type===ee.colon)Mt.typeAnnotation=this.$6()}return this.$1i(),this.finishNode(Mt,Vt)}$1i(){if(!this.eat(ee.comma))this.semicolon()}$1g(){return this.$v(()=>{if(this.next(),this.type!==ee.name)return!1;return this.next(),this.type===ee.colon})}$1h(Mt){if(this.expect(ee.bracketL),Mt.parameters=[this.$h(this.parseIdent(),!1)],this.expect(ee.bracketR),this.type===ee.colon)Mt.typeAnnotation=this.$6();return this.$1i(),this.finishNode(Mt,"TSIndexSignature")}$2a(){let Mt=this.startNode();this.expect(ee.bracketL),Mt.elementTypes=[];while(!this.eat(ee.bracketR))if(Mt.elementTypes.push(this.$2c()),this.type!==ee.bracketR)this.expect(ee.comma);return this.finishNode(Mt,"TSTupleType")}$2c(){let Mt=this.start,Vt=this.startLoc,Wt=this.eat(ee.ellipsis),Kt;if((this.type===ee.name||this.type.keyword)&&this.$2d()){let Ht=this.startNode();Ht.label=this.parseIdent(!0),Ht.optional=this.eat(ee.question),this.expect(ee.colon),Ht.elementType=this.$0(),Kt=this.finishNode(Ht,"TSNamedTupleMember")}else if(Kt=this.$0(),this.eat(ee.question)){let Ht=this.startNodeAt(Kt.start,Kt.loc?.start);Ht.typeAnnotation=Kt,Kt=this.finishNode(Ht,"TSOptionalType")}if(Wt){let Ht=this.startNodeAt(Mt,Vt);Ht.typeAnnotation=Kt,Kt=this.finishNode(Ht,"TSRestType")}return Kt}$2d(){let Mt=this.$d();if(this.input.charCodeAt(Mt)===63)Mt=this.$d(Mt+1);return this.input.charCodeAt(Mt)===na}$8(){return this.$a(()=>{let Mt=this.startNode();this.next(),Mt.params=[];while(!this.$c()){let Vt=this.startNode();while((this.type===ee._const||this.type===ee._in||this.isContextual("out"))&&Ft(this.$2()))Vt[this.value]=!0,this.next();if(Vt.name=this.$y(),this.eat(ee._extends))Vt.constraint=this.$0();if(this.eat(ee.eq))Vt.default=this.$0();if(Mt.params.push(this.finishNode(Vt,"TSTypeParameter")),!this.$c()){if(this.expect(ee.comma),this.$c())Mt.extra={trailingComma:this.lastTokStart}}}if(this.next(),Mt.params.length===0)this.$1y(this.start,"Type parameter list cannot be empty.");return this.finishNode(Mt,"TSTypeParameterDeclaration")})}$e(){return this.$a(()=>{let Mt=this.startNode();this.next(),Mt.params=[];while(!this.$c())if(Mt.params.push(this.$0()),!this.$c())this.expect(ee.comma);if(Mt.params.length===0)this.unexpected();return this.next(),this.finishNode(Mt,"TSTypeParameterInstantiation")})}$1j(){let Mt=[];do{let Vt=this.startNode();if(Vt.expression=this.$j(),this.$1())Vt.typeParameters=this.$e();Mt.push(this.finishNode(Vt,"TSExpressionWithTypeArguments"))}while(this.eat(ee.comma));return Mt}$1k(Mt=!1){if(this.type!==ee.name||this.containsEsc){if(this.type===ee._const&&this.$3()==="enum")return this.$10(this.startNode());return}if(!this.$2e(this.value))return;if(this.value==="declare")return this.$2f(Mt);return this.$1l(this.startNode(),this.value)}$2e(Mt){switch(Mt){case"interface":case"type":case"namespace":return this.$14();case"enum":return Ft(this.$2());case"abstract":return this.$b()&&this.$3()==="class";case"module":{let Vt=this.$2();return this.$b()&&(Vt===sr||Vt===rr||Ft(Vt))}case"declare":return this.$b()&&fl.has(this.$3());case"global":return this.$b()&&this.$2()===os}return!1}$1l(Mt,Vt){switch(Vt){case"interface":return this.$1m(Mt);case"type":return this.$2g(Mt);case"enum":return this.$10(Mt);case"abstract":return this.$1n(Mt,!0);case"global":return Mt.global=!0,Mt.id=this.parseIdent(),Mt.body=this.$11(),this.finishNode(Mt,"TSModuleDeclaration")}return this.$2h(Mt)}$2f(Mt){let Vt=this.$5;this.$5=!0;let Wt=this.startNode();this.next();let Kt=this.value;if(Kt==="const"&&this.$3()==="enum")Wt.const=!0;if(!Mt&&ml.has(Kt))Wt.declare=!0;let Ht;if(Wt.const)Ht=this.$10(Wt);else if(Kt==="var"||Kt==="let"||Kt==="const")Ht=this.parseVarStatement(Wt,Kt,!0);else if(Kt==="function")this.next(),Ht=this.parseFunction(Wt,Zo,!1,!1);else if(Kt==="class")Ht=this.parseClass(Wt,!0);else Ht=this.$1l(Wt,Kt);return Ht.declare=!0,this.$5=Vt,Ht}$1n(Mt,Vt){return this.next(),Mt.abstract=!0,this.parseClass(Mt,Vt)}$1m(Mt){if(this.next(),Mt.id=this.parseIdent(),this.checkLValSimple(Mt.id,Qo),this.$1())Mt.typeParameters=this.$8();return this.$a(()=>{if(this.eat(ee._extends))Mt.extends=this.$1j();let Vt=this.startNode();Vt.body=this.$1f(),Mt.body=this.finishNode(Vt,"TSInterfaceBody")}),this.finishNode(Mt,"TSInterfaceDeclaration")}$2g(Mt){if(this.next(),Mt.id=this.parseIdent(),this.checkLValSimple(Mt.id,nr),this.$1())Mt.typeParameters=this.$8();return Mt.typeAnnotation=this.$a(()=>(this.expect(ee.eq),this.$0())),this.semicolon(),this.finishNode(Mt,"TSTypeAliasDeclaration")}$10(Mt){if(this.type===ee._const)Mt.const=!0,this.next();this.next(),Mt.id=this.parseIdent(),this.checkLValSimple(Mt.id,bl),this.expect(ee.braceL),Mt.members=[];while(!this.eat(ee.braceR)){let Vt=this.startNode();if(Vt.id=this.type===ee.string?this.parseExprAtom():this.parseIdent(!0),this.eat(ee.eq))Vt.initializer=this.parseMaybeAssign();if(Mt.members.push(this.finishNode(Vt,"TSEnumMember")),this.type!==ee.braceR)this.expect(ee.comma)}return this.finishNode(Mt,"TSEnumDeclaration")}$2h(Mt){if(this.next(),this.type===ee.string){if(Mt.id=this.parseExprAtom(),this.type===ee.braceL)Mt.body=this.$11();else this.semicolon();return this.finishNode(Mt,"TSModuleDeclaration")}return Mt.id=this.parseIdent(),this.checkLValSimple(Mt.id,Cl),this.$1o(Mt)}$1o(Mt){if(this.eat(ee.dot)){let Vt=this.startNode();Vt.id=this.parseIdent(),Mt.body=this.$1o(Vt)}else Mt.body=this.$11();return this.finishNode(Mt,"TSModuleDeclaration")}$11(){this.enterScope(yl);let Mt=this.startNode();this.enterScope(0),this.expect(ee.braceL),Mt.body=[];while(!this.eat(ee.braceR))Mt.body.push(this.parseStatement(null,!0));return this.exitScope(),this.exitScope(),this.finishNode(Mt,"TSModuleBlock")}$1p(Mt,Vt){if(Mt.isExport=Vt,Mt.id=this.parseIdent(),this.checkLValSimple(Mt.id,Ti),this.expect(ee.eq),this.isContextual("require")&&this.$2()===ea){let Wt=this.startNode();this.next(),Wt.expression=this.$1e(),Mt.moduleReference=this.finishNode(Wt,"TSExternalModuleReference")}else Mt.moduleReference=this.$j();return this.semicolon(),this.finishNode(Mt,"TSImportEqualsDeclaration")}$2i(){let Mt=this.$d();if(this.input.charCodeAt(Mt)!==rs)return!1;let Vt=this.input.charCodeAt(Mt+1);return Vt!==rs&&Vt!==62}parseStatement(Mt,Vt,Wt){if(this.type===jt)this.$1q(!0);let Kt=this.$1k();if(Kt)return Kt;return super.parseStatement(Mt,Vt,Wt)}parseVarStatement(Mt,Vt,Wt){return super.parseVarStatement(Mt,Vt,Wt||this.$5)}parseVarId(Mt,Vt){if(super.parseVarId(Mt,Vt),Mt.id.type==="Identifier"&&this.$u()&&!this.hasPrecedingLineBreak())this.next(),Mt.definite=!0;this.$h(Mt.id,!1)}parseCatchClauseParam(){let Mt=this.$h(this.parseBindingAtom(),!1),Vt=Mt.type==="Identifier";return this.enterScope(Vt?gl:0),this.checkLValPattern(Mt,Vt?Sl:Ti),this.expect(ee.parenR),Mt}parseImport(Mt){if(this.next(),Mt.importKind="value",this.type===ee.string)Mt.specifiers=[],Mt.source=this.parseExprAtom();else{if(this.isContextual("type")){let Vt=this.$2();if(Vt===os||Vt===ir||Ft(Vt)&&this.$3()!=="from")Mt.importKind="type",this.next()}if(this.type===ee.name&&this.$2i())return this.$1p(Mt,!1);Mt.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),Mt.source=this.$z()}return this.$1r(Mt),this.semicolon(),this.finishNode(Mt,"ImportDeclaration")}parseWithClause(){if(this.isContextual("assert")&&!this.hasPrecedingLineBreak())this.type=ee._with;return this.type===ee._with?super.parseWithClause():void 0}$1r(Mt){let Vt=this.parseWithClause();if(Vt)Mt.attributes=Vt}parseImportSpecifier(){return this.$1s("importKind",()=>super.parseImportSpecifier())}parseExportSpecifier(Mt){return this.$1s("exportKind",()=>super.parseExportSpecifier(Mt))}$1s(Mt,Vt){let Wt=this.isContextual("type")?this.$2():-1;if(Wt===sr||Wt===rr||Ft(Wt)&&this.$3()!=="as"){let Ht=this.startNode();this.next();let qt=Vt();return this.$q(qt,Ht),qt[Mt]="type",qt}let Kt=Vt();return Kt[Mt]="value",Kt}parseExport(Mt,Vt){if(this.next(),this.eat(ee._import)){if(Mt.importKind="value",this.isContextual("type")&&Ft(this.$2())&&this.$3()!=="from")Mt.importKind="type",this.next();return this.$1p(Mt,!0)}if(this.eat(ee.eq))return Mt.expression=this.parseExpression(),this.semicolon(),this.finishNode(Mt,"TSExportAssignment");if(this.eatContextual("as"))return this.expectContextual("namespace"),Mt.id=this.parseIdent(),this.semicolon(),this.finishNode(Mt,"TSNamespaceExportDeclaration");if(Mt.exportKind="value",this.isContextual("type")){let Ht=this.$2();if(Ht===os||Ht===ir)Mt.exportKind="type",this.next()}if(this.eat(ee.star))return this.parseExportAllDeclaration(Mt,Vt);if(this.eat(ee._default)){if(this.isContextual("interface")&&this.$14())Mt.declaration=this.$1m(this.startNode());else if(this.isContextual("abstract")&&this.$3()==="class")Mt.declaration=this.$1n(this.startNode(),"nullableID");else Mt.declaration=this.parseExportDefaultDeclaration();return this.finishNode(Mt,"ExportDefaultDeclaration")}let Wt=this.isContextual("declare"),Kt=this.$1k(!0);if(Kt||this.shouldParseExportStatement()){if(Mt.declaration=Kt??this.parseStatement(null),Wt||Mt.declaration.type==="TSInterfaceDeclaration"||Mt.declaration.type==="TSTypeAliasDeclaration")Mt.exportKind="type";return Mt.specifiers=[],Mt.source=null,this.finishNode(Mt,"ExportNamedDeclaration")}if(Mt.declaration=null,Mt.specifiers=this.parseExportSpecifiers(Vt),this.eatContextual("from"))Mt.source=this.$z(),this.$1r(Mt);else{for(let Ht of Mt.specifiers)if(this.checkUnreserved(Ht.local),this.checkLocalExport(Ht.local),Ht.local.type==="Literal")this.raise(Ht.local.start,"A string literal cannot be used as an exported binding without `from`.");Mt.source=null}return this.semicolon(),this.finishNode(Mt,"ExportNamedDeclaration")}parseFunction(Mt,Vt,Wt,Kt,Ht){let qt=Vt&Zo;if(qt)this.$f=Mt,this.$o=Mt.start;super.parseFunction(Mt,Vt,Wt,Kt,Ht),this.$f=null;let zt=!Mt.body;if(zt)Mt.type="TSDeclareFunction";if(qt&&Mt.id){if(zt){if(this.$5&&this.currentScope().flags&Yo)this.declareName(Mt.id.name,or,Mt.id.start);this.checkLValSimple(Mt.id,xl)}else if(!(Vt&wl)){let Xt=El;if(this.strict||Mt.generator||Mt.async)Xt=this.treatFunctionsAsVar?vl:Ti;this.checkLValSimple(Mt.id,Xt)}}return Mt}parseFunctionParams(Mt){if(this.$1())Mt.typeParameters=this.$8();if(super.parseFunctionParams(Mt),this.type===ee.colon)Mt.returnType=this.$6(!0)}parseFunctionBody(Mt,Vt,Wt,Kt){if(Wt&&this.type===ee.colon)Mt.returnType=this.$6(!0);if(Vt||this.type===ee.braceL||Mt.start!==this.$o){super.parseFunctionBody(Mt,Vt,Wt,Kt);return}this.semicolon(),this.exitScope()}parseMethod(Mt,Vt,Wt){let Kt=this.$k;this.$k=null;let Ht=super.parseMethod(Mt,Vt,Wt);if(!Ht.body)Ht.type="TSDeclareMethod";if(Kt)Ht.typeParameters=Kt;return Ht}parseBindingList(Mt,Vt,Wt,Kt){let Ht=Kt===!0||this.$l;return this.$l=!1,super.parseBindingList(Mt,Vt,Wt,Ht)}$s(Mt){if(!Mt&&!this.$b())return!1;let Vt=this.$2();return Vt===Al||Vt===os||Vt===ir||Vt===ta||Vt===Pl||Vt===sr||Vt===rr||Vt>=48&&Vt<=57||Ft(Vt)}parseAssignableListItem(Mt){let Vt=this.$12(),Wt=this.start,Kt=this.startLoc,Ht,qt=!1,zt=!1;if(Mt)while(this.type===ee.name&&dl.has(this.value)&&!this.containsEsc&&this.$s(!1)){if(this.value==="readonly")qt=!0;else if(this.value==="override")zt=!0;else Ht=this.value;this.next()}let Xt;if(this.type===ee._this)Xt=this.startNode(),Xt.name="this",this.next(),this.finishNode(Xt,"Identifier");else Xt=this.parseBindingAtom();let Yt=this.type===ee.eq?this.parseMaybeDefault(Wt,Kt,Xt):this.parseMaybeDefault(Xt.start,Xt.loc?.start,this.$h(Xt,!0));if(Vt.length>0)Yt.decorators=Vt;if(!Ht&&!qt&&!zt)return Yt;let Jt=this.startNodeAt(Wt,Kt);if(Ht)Jt.accessibility=Ht;if(qt)Jt.readonly=!0;if(zt)Jt.override=!0;return Jt.parameter=Yt,this.finishNode(Jt,"TSParameterProperty")}parseBindingListItem(Mt){if(Mt.type==="RestElement")this.$h(Mt,!0);return Mt}checkLValSimple(Mt,Vt,Wt){if(this.$f&&Mt===this.$f.id){this.$f=null;return}if(!Vt&&Jo.has(Mt.type)){this.checkLValSimple(Mt.expression,Vt,Wt);return}switch(Mt.type){case"TSParameterProperty":this.checkLValInnerPattern(Mt.parameter,Vt,Wt);return;case"Identifier":if(Mt.name==="this")return}super.checkLValSimple(Mt,Vt,Wt)}toAssignable(Mt,Vt,Wt){if(Mt&&!Vt&&Jo.has(Mt.type))return Mt;return super.toAssignable(Mt,Vt,Wt)}declareName(Mt,Vt,Wt){let Kt=this.currentScope();if(Vt&or){this.$1t(Kt,Mt),Kt.$1u??=[],Kt.$1u.push(Mt);return}if(Vt===nr||Vt===Qo){if(Kt.$13??=[],Vt===nr&&En(Kt.$13,Mt))this.raise(Wt,`type '${Mt}' has already been declared.`);Kt.$13.push(Mt),this.$1t(Kt,Mt);return}if(Vt&sa){if(Kt.$1v??=[],En(Kt.$1v,Mt))return;super.declareName(Mt,Ti,Wt),Kt.$1v.push(Mt);return}super.declareName(Mt,Vt,Wt)}$1t(Mt,Vt){if(this.inModule&&Mt.flags&Yo)delete this.undefinedExports[Vt]}checkLocalExport(Mt){for(let Vt=this.scopeStack.length-1;Vt>=0;Vt--){let Wt=this.scopeStack[Vt];if(En(Wt.$13,Mt.name)||En(Wt.$1u,Mt.name))return}super.checkLocalExport(Mt)}checkExport(){}raiseRecoverable(Mt,Vt){if(Vt==="Duplicate constructor in the same class")return;super.raiseRecoverable(Mt,Vt)}$12(){let Mt=[];while(this.type===jt)Mt.push(this.$1w());return Mt}$1q(Mt){let Vt=this.$9[this.$9.length-1];while(this.type===jt)Vt.push(this.$1w());if(this.type===ee._export){if(!Mt)this.unexpected()}else if(this.type!==ee._class&&!((this.isContextual("abstract")||this.isContextual("declare"))&&this.$3()==="class"))this.raise(this.start,"Leading decorators must be attached to a class declaration.")}$1w(){let Mt=this.startNode();this.next(),this.$9.push([]);let Vt=this.start,Wt=this.startLoc,Kt;if(this.type===ee.parenL){if(this.next(),Kt=this.parseExpression(),this.expect(ee.parenR),this.options.preserveParens){let qt=this.startNodeAt(Vt,Wt);qt.expression=Kt,Kt=this.finishNode(qt,"ParenthesizedExpression")}}else{Kt=this.parseIdent(!1);while(this.eat(ee.dot)){let qt=this.startNodeAt(Vt,Wt);qt.object=Kt,qt.property=this.parseIdent(!0),qt.computed=!1,Kt=this.finishNode(qt,"MemberExpression")}}let Ht=this.$p()?this.$e():void 0;if(this.eat(ee.parenL)){let qt=this.startNodeAt(Kt.start,Kt.loc?.start);if(qt.callee=Kt,qt.arguments=this.parseExprList(ee.parenR,!1,!1),Ht)qt.typeArguments=Ht;Kt=this.finishNode(qt,"CallExpression")}else if(Ht){let qt=this.startNodeAt(Kt.start,Kt.loc?.start);qt.expression=Kt,qt.typeArguments=Ht,Kt=this.finishNode(qt,"TSInstantiationExpression")}return Mt.expression=Kt,this.$9.pop(),this.finishNode(Mt,"Decorator")}shouldParseExportStatement(){return this.type===jt||super.shouldParseExportStatement()}parseExprAtom(Mt,Vt,Wt){if(this.type===jt)this.$1q(!1);return super.parseExprAtom(Mt,Vt,Wt)}parseProperty(Mt,Vt){if(Mt||this.type!==jt)return super.parseProperty(Mt,Vt);let Wt=this.$12(),Kt=super.parseProperty(Mt,Vt);if(Kt.type==="SpreadElement")this.raise(Kt.start,"Decorators can't be used with SpreadElement");return Kt.decorators=Wt,Kt}parseClassId(Mt,Vt){let Wt=this.$9.length-1,Kt=this.$9[Wt];if(Kt.length>0)Mt.decorators=Kt,this.$q(Mt,Kt[0]),this.$9[Wt]=[];if(!this.isContextual("implements")||Vt===!0)super.parseClassId(Mt,Vt);if(this.$1())Mt.typeParameters=this.$8()}parseClassSuper(Mt){if(super.parseClassSuper(Mt),Mt.superClass&&this.$1())Mt.superTypeParameters=this.$e();if(this.eatContextual("implements"))Mt.implements=this.$a(()=>this.$1j())}parseClassElement(Mt){if(this.type===jt){let zt=this.$12();if(this.type===ee.braceR)this.raise(this.start,"Decorators must be attached to a class element.");let Xt=this.parseClassElement(Mt);return Xt.decorators=zt,this.$q(Xt,zt[0]),Xt}if(this.eat(ee.semi))return null;let Vt=this.startNode();while(this.type===ee.name&&hl.has(this.value)&&!this.containsEsc&&this.$s(this.value==="static")){let zt=this.value;if(this.next(),zt==="static"&&this.type===ee.braceL)return this.next(),this.parseClassStaticBlock(Vt),Vt;if(zt==="public"||zt==="private"||zt==="protected")Vt.accessibility=zt;else Vt[zt]=!0}if(this.type===ee.bracketL&&this.$1g())return this.$1h(Vt);Vt.static??=!1;let Wt="",Kt=!1,Ht=!1,qt="method";if(this.eatContextual("async"))if((this.isClassElementNameStart()||this.type===ee.star)&&!this.canInsertSemicolon())Ht=!0;else Wt="async";if(!Wt&&this.eat(ee.star))Kt=!0;if(!Wt&&!Ht&&!Kt){let zt=this.value;if(this.eatContextual("get")||this.eatContextual("set"))if(this.isClassElementNameStart())qt=zt;else Wt=zt}if(Wt)Vt.computed=!1,Vt.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),Vt.key.name=Wt,this.finishNode(Vt.key,"Identifier");else this.parseClassElementName(Vt);if(this.eat(ee.question))Vt.optional=!0;if(this.type===ee.parenL||this.$1()||qt!=="method"||Kt||Ht){let zt=Vt.key,Xt=!Vt.static&&!Vt.computed&&(zt.type==="Identifier"&&zt.name==="constructor"||zt.type==="Literal"&&zt.value==="constructor");if(Vt.kind=Xt?"constructor":qt,this.$1())Vt.typeParameters=this.$8();this.$l=Xt,this.$o=this.start,this.parseClassMethod(Vt,Kt,Ht,Xt&&Mt)}else{if(!Vt.optional&&this.$u())this.next(),Vt.definite=!0;if(this.type===ee.colon)Vt.typeAnnotation=this.$6();this.parseClassField(Vt)}return Vt}parseMaybeAssign(Mt,Vt,Wt){if(this.$p()){let Kt=this.$g(()=>{let Ht=this.$8(),qt=super.parseMaybeAssign(Mt,Vt,Wt);if(qt.type!=="ArrowFunctionExpression")return;return qt.typeParameters=Ht,this.$q(qt,Ht),qt});if(Kt)return Kt}return super.parseMaybeAssign(Mt,Vt,Wt)}parseMaybeUnary(Mt,Vt,Wt,Kt){if(this.$p()){let Ht=this.startNode();return Ht.typeAnnotation=this.$a(()=>{this.next();let qt=this.$0();if(!this.$c())this.unexpected();return this.next(),qt}),Ht.expression=this.parseMaybeUnary(null,!1,!1,Kt),this.finishNode(Ht,"TSTypeAssertion")}return super.parseMaybeUnary(Mt,Vt,Wt,Kt)}parseMaybeConditional(Mt,Vt){let Wt=this.start,Kt=this.startLoc,Ht=this.parseExprOps(Mt,Vt);if(this.checkExpressionErrors(Vt))return Ht;if(this.type===ee.question&&!(Ht.type==="ArrowFunctionExpression"&&Ht.start===Wt)&&!this.$2j()){this.next();let qt=this.startNodeAt(Wt,Kt);return qt.test=Ht,qt.consequent=this.parseMaybeAssign(),this.expect(ee.colon),qt.alternate=this.parseMaybeAssign(Mt),this.finishNode(qt,"ConditionalExpression")}return Ht}$2j(){let Mt=this.$d(),Vt=this.input.charCodeAt(Mt);if(Vt===na||Vt===kl||Vt===Tl)return!0;return Vt===rs&&this.input.charCodeAt(Mt+1)!==rs}parseParenItem(Mt){return this.$h(Mt,!0)}$1x(){if(this.type!==ee.colon)return!0;let Mt=this.$g(()=>{let Vt=this.$6(!0);return this.type===ee.arrow&&!this.canInsertSemicolon()?Vt:void 0});if(!Mt)return!1;return this.$7=Mt,!0}shouldParseArrow(Mt){return this.$1x()&&super.shouldParseArrow(Mt)}shouldParseAsyncArrow(){return this.$1x()&&super.shouldParseAsyncArrow()}parseArrowExpression(Mt,Vt,Wt,Kt){if(this.$7)Mt.returnType=this.$7,this.$7=null;return super.parseArrowExpression(Mt,Vt,Wt,Kt)}parseExprList(Mt,Vt,Wt,Kt){if(!this.$m)return super.parseExprList(Mt,Vt,Wt,Kt);this.$m=!1;let Ht=[],qt=!0;while(!this.eat(Mt)){if(qt)qt=!1;else if(this.expect(ee.comma),Vt&&this.afterTrailingComma(Mt))break;if(this.type===ee.ellipsis){let zt=this.parseSpread(Kt);if(this.eat(ee.question))zt.optional=!0;if(this.type===ee.colon)zt.typeAnnotation=this.$6();Ht.push(zt)}else Ht.push(this.parseMaybeAssign(!1,Kt,this.parseParenItem))}return Ht}parseSubscript(Mt,Vt,Wt,Kt,Ht,qt,zt){if(this.$u()&&!this.hasPrecedingLineBreak()){let Yt=this.startNodeAt(Vt,Wt);return this.exprAllowed=!1,this.next(),Yt.expression=Mt,this.finishNode(Yt,"TSNonNullExpression")}if(Ht&&this.$1()){let Yt=this.$g(()=>this.$2k(Vt,Wt,zt));if(Yt)return Yt}let Xt=this.type===ee.questionDot&&this.$2()===ia;if(this.$1()||Xt||this.type===ee.bitShift&&this.value==="<<"){let Yt=this.$g(()=>{if(Xt)this.next();this.$p();let Jt=this.$e();if(this.type===ee.parenL&&!Kt)return Jt;if(this.type===ee.backQuote)return Xt?void 0:Jt;if(Xt)return;if(this.$c()||this.type===ee.bitShift||this.type.startsExpr&&this.type!==ee.parenL&&!this.hasPrecedingLineBreak())return;return Jt});if(Yt){let Jt=this.startNodeAt(Vt,Wt);if(this.type===ee.parenL&&!Kt){if(this.next(),Jt.callee=Mt,Jt.arguments=this.parseExprList(ee.parenR,!0,!1),Jt.typeArguments=Yt,Xt)Mt.optional=!0;if(Xt||qt)Jt.optional=Xt;return this.finishNode(Jt,"CallExpression")}if(this.type===ee.backQuote)return Jt.tag=Mt,Jt.quasi=this.parseTemplate({isTagged:!0}),Jt.typeArguments=Yt,this.finishNode(Jt,"TaggedTemplateExpression");return Jt.expression=Mt,Jt.typeArguments=Yt,this.finishNode(Jt,"TSInstantiationExpression")}}if(Ht&&this.type===ee.parenL)this.$m=!0;return super.parseSubscript(Mt,Vt,Wt,Kt,Ht,qt,zt)}$2k(Mt,Vt,Wt){let Kt=this.startNodeAt(Mt,Vt);if(Kt.typeParameters=this.$8(),this.expect(ee.parenL),Kt.params=this.parseBindingList(ee.parenR,!1,!0),this.type===ee.colon)Kt.returnType=this.$6(!0);if(this.type!==ee.arrow||this.canInsertSemicolon())return;return this.next(),this.parseArrowExpression(Kt,Kt.params,!0,Wt)}parseDynamicImport(Mt){if(this.next(),Mt.source=this.parseMaybeAssign(),this.eat(ee.comma)&&this.type!==ee.parenR)Mt.arguments=[this.parseExpression()];return this.expect(ee.parenR),this.finishNode(Mt,"ImportExpression")}parseNew(){let Mt=super.parseNew();if(Mt.callee?.type!=="TSInstantiationExpression")return Mt;let Vt=this.startNodeAt(Mt.start,Mt.loc?.start);return Vt.callee=Mt.callee.expression,Vt.typeArguments=Mt.callee.typeArguments,Vt.arguments=Mt.arguments,this.finishNodeAt(Vt,"NewExpression",Mt.end,Mt.loc?.end)}parseExprOp(Mt,Vt,Wt,Kt,Ht){if(ee._in.binop>Kt&&this.type===ee.name&&(this.value==="as"||this.value==="satisfies")&&!this.containsEsc&&!this.hasPrecedingLineBreak()){let qt=this.value==="satisfies",zt=this.startNodeAt(Vt,Wt);return zt.expression=Mt,zt.typeAnnotation=this.$a(()=>{if(this.next(),!qt&&this.type===ee._const){let Xt=this.startNode();return Xt.typeName=this.parseIdent(!0),this.finishNode(Xt,"TSTypeReference")}return this.$0()}),this.finishNode(zt,qt?"TSSatisfiesExpression":"TSAsExpression"),this.parseExprOp(zt,Vt,Wt,Kt,Ht)}return super.parseExprOp(Mt,Vt,Wt,Kt,Ht)}parseGetterSetter(Mt){Mt.kind=Mt.key.name,super.parseGetterSetter(Mt)}parsePropertyValue(Mt,Vt,Wt,Kt,Ht,qt,zt,Xt){if(!Vt&&this.$1()){if(this.$k=this.$8(),this.type!==ee.parenL)this.unexpected();Mt.kind="init"}return super.parsePropertyValue(Mt,Vt,Wt,Kt,Ht,qt,zt,Xt)}}return Gt});function le(){throw Error('sveast: parsing TypeScript needs `typescript` from "sveast/typescript": createParser({ typescript }) or createModuleParser({ typescript })')}var $l=/^\t+/;class e extends Error{name="ParseError";code;reason;position;start;end;frame;constructor(K,ee,Oe){super(`${Oe}
|
|
15
|
+
https://svelte.dev/e/${ee}`);this.code=ee,this.reason=Oe;let Ot=typeof K==="number"?K:K?.start,Ft=typeof K==="number"?K:K?.end;if(Ot!==void 0)this.position=[Ot,Ft??Ot],this.start=g(this.position[0]),this.end=g(this.position[1]),this.frame=Nl(this.start.line-1,this.end.column)}}var ra=(K)=>K.replace($l,(ee)=>" ".repeat(ee.length));function Nl(K,ee){let Oe=Math.max(0,K-2),Ot=[];for(let jt=Oe;jt<K+3;jt++){let Gt=vo(jt);if(Gt===void 0)break;Ot.push(Gt)}let Ft=String(Oe+Ot.length+1).length;return Ot.map((jt,Gt)=>{let Mt=`${String(Oe+Gt+1).padStart(Ft," ")}: ${ra(jt)}`;if(Oe+Gt!==K)return Mt;return`${Mt}
|
|
16
|
+
${" ".repeat(Ft+2+ra(jt.slice(0,ee)).length)}^`}).join(`
|
|
17
|
+
`)}function Je(K){throw new e(K,"attribute_duplicate","Attributes need to be unique")}function qe(K){throw new e(K,"attribute_empty_shorthand","Attribute shorthand cannot be empty")}function je(K,ee){throw new e(K,"block_duplicate_clause",`${ee} cannot appear more than once within a block`)}function Fe(K){throw new e(K,"block_invalid_continuation_placement","{:...} block is invalid at this position (did you forget to close the preceding element or block?)")}function Ve(K){throw new e(K,"block_invalid_elseif","'elseif' should be 'else if'")}function Ue(K,ee,Oe){throw new e(K,"block_invalid_placement",`{#${ee} ...} block cannot be ${Oe}`)}function Ge(K){throw new e(K,"block_unclosed","Block was left open")}function We(K){throw new e(K,"block_unexpected_close","Unexpected block closing tag")}function He(K){throw new e(K,"const_tag_invalid_expression","{@const ...} must consist of a single variable declaration")}function ze(K){throw new e(K,"css_empty_declaration","Declaration cannot be empty")}function we(K){throw new e(K,"css_expected_identifier","Expected a valid CSS identifier")}function Xe(K){throw new e(K,"css_selector_invalid","Invalid selector")}function Qe(K){throw new e(K,"debug_tag_invalid_arguments","{@debug ...} arguments must be identifiers, not arbitrary expressions")}function ve(K){throw new e(K,"declaration_tag_invalid_type","Declaration tags must be `let` or `const` declarations")}function Ye(K){throw new e(K,"directive_invalid_value","Directive value must be a JavaScript expression enclosed in curly braces")}function Ze(K,ee){throw new e(K,"directive_missing_name",`\`${ee}\` name cannot be empty`)}function Ke(K,ee){throw new e(K,"element_invalid_closing_tag",`\`</${ee}>\` attempted to close an element that was not open`)}function et(K,ee,Oe){throw new e(K,"element_invalid_closing_tag_autoclosed",`\`</${ee}>\` attempted to close element that was already automatically closed by \`<${Oe}>\` (cannot nest \`<${Oe}>\` inside \`<${ee}>\`)`)}function Ce(K,ee){throw new e(K,"element_unclosed",`\`<${ee}>\` was left open`)}function De(K){throw new e(K,"expected_attribute_value","Expected attribute value")}function tt(K){throw new e(K,"expected_block_type","Expected 'if', 'each', 'await', 'key' or 'snippet'")}function Pe(K){throw new e(K,"expected_identifier","Expected an identifier")}function nt(K){throw new e(K,"expected_pattern","Expected identifier or destructure pattern")}function rt(K){throw new e(K,"expected_tag","Expected 'html', 'render', 'attach', 'const', or 'debug'")}function D(K,ee){throw new e(K,"expected_token",`Expected token ${ee}`)}function it(K){throw new e(K,"expected_whitespace","Expected whitespace")}function Dl(K,ee){throw new e(K,"js_parse_error",`${ee}`)}function st(K){throw new e(K,"render_tag_invalid_expression","`{@render ...}` tags can only contain call expressions")}function ot(K){throw new e(K,"script_duplicate","A component can have a single top-level `<script>` element and/or a single top-level `<script module>` element")}function at(K,ee){throw new e(K,"script_invalid_attribute_value",`If the \`${ee}\` attribute is supplied, it must be a boolean attribute`)}function ct(K){throw new e(K,"script_invalid_context",'If the context attribute is supplied, its value must be "module"')}function pt(K,ee){throw new e(K,"script_reserved_attribute",`The \`${ee}\` attribute is reserved and cannot be used`)}function lt(K){throw new e(K,"style_duplicate","A component can have a single top-level `<style>` element")}function ut(K){throw new e(K,"svelte_component_invalid_this","Invalid component definition — must be an `{expression}`")}function ft(K){throw new e(K,"svelte_component_missing_this","`<svelte:component>` must have a 'this' attribute")}function Ae(K){throw new e(K,"svelte_element_missing_this","`<svelte:element>` must have a 'this' attribute with a value")}function dt(K,ee){throw new e(K,"svelte_meta_duplicate",`A component can only have one \`<${ee}>\` element`)}function mt(K,ee){throw new e(K,"svelte_meta_invalid_content",`<${ee}> cannot have children`)}function ht(K,ee){throw new e(K,"svelte_meta_invalid_placement",`\`<${ee}>\` tags cannot be inside elements or blocks`)}function gt(K,ee){throw new e(K,"svelte_meta_invalid_tag",`Valid \`<svelte:...>\` tag names are ${ee}`)}function yt(K){throw new e(K,"svelte_options_deprecated_tag",'"tag" option is deprecated — use "customElement" instead')}function Tt(K){throw new e(K,"svelte_options_invalid_attribute","`<svelte:options>` can only receive static attributes")}function ue(K,ee){throw new e(K,"svelte_options_invalid_attribute_value",`Value must be ${ee}, if specified`)}function xt(K){throw new e(K,"svelte_options_invalid_customelement",'"customElement" must be a string literal defining a valid custom element name or an object of the form { tag?: string; shadow?: "open" | "none" | `ShadowRootInit`; props?: { [key: string]: { attribute?: string; reflect?: boolean; type: .. } } }')}function Et(K){throw new e(K,"svelte_options_invalid_customelement_props",'"props" must be a statically analyzable object literal of the form "{ [key: string]: { attribute?: string; reflect?: boolean; type?: "String" | "Boolean" | "Number" | "Array" | "Object" }"')}function St(K){throw new e(K,"svelte_options_invalid_customelement_shadow",'"shadow" must be either "open", "none" or `ShadowRootInit` object.')}function _e(K){throw new e(K,"svelte_options_invalid_tagname","Tag name must be lowercase and hyphenated")}function kt(K){throw new e(K,"svelte_options_reserved_tagname","Tag name is reserved")}function bt(K,ee){throw new e(K,"svelte_options_unknown_attribute",`\`<svelte:options>\` unknown attribute '${ee}'`)}function wt(K){throw new e(K,"tag_invalid_name","Expected a valid element or component name. Components must have a valid variable name or dot notation expression")}function vt(K,ee,Oe){throw new e(K,"tag_invalid_placement",`{@${ee} ...} tag cannot be ${Oe}`)}function f(K){throw new e(K,"unexpected_eof","Unexpected end of input")}function Ct(K,ee){throw new e(K,"unexpected_reserved_word",`'${ee}' is a reserved word in JavaScript and cannot be used here`)}function Dt(K){throw new e(K,"unterminated_string_constant","Unterminated string constant")}function Pt(K){throw new e(K,"void_element_invalid_content","Void elements cannot have children or closing tags")}var ui="",pa=[],ps=0,dn=[],fn=0;function Rl(K,ee){ui=K,pa=ee,ps=0}function Il(){return ps}function Ol(K,ee,Oe,Ot){ps=Ot}function Ll(K,ee,Oe,Ot,Ft,jt){ps=Ot;let Gt=ee;if(K&&Gt.includes(`
|
|
18
|
+
`)){let Vt=ui.lastIndexOf(`
|
|
19
|
+
`,Oe-1)+1,Wt=Vt,Kt=ui.charCodeAt(Wt);while(Kt===32||Kt===9)Kt=ui.charCodeAt(++Wt);if(Wt>Vt)Gt=Ml(Gt,ui.slice(Vt,Wt))}let Mt={type:K?"Block":"Line",value:Gt,start:Oe,end:Ot};if(Ft&&jt)Mt.loc={start:Ft,end:jt};pa.push(Mt)}function Ml(K,ee){let Oe=K.startsWith(ee)?ee.length:0,Ot="",Ft=K.indexOf(`
|
|
20
20
|
`,Oe);while(Ft!==-1){if(Ot+=K.slice(Oe,Ft+1),Oe=Ft+1,K.startsWith(ee,Oe))Oe+=ee.length;Ft=K.indexOf(`
|
|
21
|
-
`,Oe)}return Ot+K.slice(Oe)}function
|
|
22
|
-
`,Gt-1)+1,this.curLine=this.options.locations?jt.slice(0,this.lineStart).split(
|
|
23
|
-
`}var
|
|
24
|
-
`)}var
|
|
25
|
-
${Ft}`)}let Oe=ee.default;if(!r(Oe)||Array.isArray(Oe))throw Error(`sveld: config file "${K}" must export a configuration object as its default export. Did you forget \`export default defineConfig({ ... })\`?`);return Oe}async function
|
|
26
|
-
`)){let
|
|
21
|
+
`,Oe)}return Ot+K.slice(Oe)}function Fl(K,ee,Oe){let Ot=0,Ft=ee.length;while(Ot<Ft){let jt=Ot+Ft>>>1;if(ee[jt].start<Oe)Ot=jt+1;else Ft=jt}if(Ot>=ee.length)return;if(dn=ee.slice(Ot).map(({type:jt,value:Gt,start:Mt,end:Vt})=>({type:jt,value:Gt,start:Mt,end:Vt})),fn=0,pr(K,void 0,!1),fn<dn.length&&(dn[fn].start>=K.end||K.type==="Program")){K.trailingComments??=[];while(fn<dn.length)K.trailingComments.push(dn[fn++])}}var Bl=new Map([["BlockStatement","body"],["Program","body"],["ArrayExpression","elements"],["ObjectExpression","properties"]]);function oa(K,ee){for(let Oe=K;Oe<ee;Oe++){let Ot=ui.charCodeAt(Oe);if(Ot!==44&&Ot!==41&&Ot!==32&&Ot!==9)return!0}return!1}function pr(K,ee,Oe){while(fn<dn.length&&dn[fn].start<K.start)K.leadingComments??=[],K.leadingComments.push(dn[fn++]);if(fn>=dn.length)return;let Ot=dn[fn].start;if(Ot<K.end||!oa(K.end,Ot)){let Ft=Xn(K),jt=Bl.get(K.type),Gt=jt===void 0?void 0:Ft[jt],Mt=Array.isArray(Gt)&&Gt.length===0;for(let Vt in Ft){if(fn>=dn.length)return;if(Vt==="type")continue;let Wt=Ft[Vt];if(Array.isArray(Wt)){let Kt=Vt===jt;for(let Ht=0;Ht<Wt.length;Ht++){let qt=Wt[Ht];if(Ln(qt))pr(qt,K,Kt?Ht===Wt.length-1:Mt)}}else if(Ln(Wt))pr(Wt,K,Mt)}if(fn>=dn.length)return}if(ee!==void 0&&K.end===ee.end)return;if(Oe)while(fn<dn.length){if(ee&&dn[fn].start>=ee.end)break;K.trailingComments??=[],K.trailingComments.push(dn[fn++])}else if(K.end<=dn[fn].start&&!oa(K.end,dn[fn].start))K.trailingComments=[dn[fn++]]}var fe=new Set("arguments await break case catch class const continue debugger default delete do else enum eval export extends false finally for function if implements import in instanceof interface let new null package private protected public return static super switch this throw true try typeof var void while with yield".split(" ")),cs=!1,ki=1,jl=2,Vl=32,Gl=256,Wl=ki|jl|Gl,Ul=2,Kl=3,Hl=4,ql=/\r\n?|\n|\u2028|\u2029/,aa=new Map;function as(K){if(!(K instanceof RegExp))return K;let ee=aa.get(K);if(!ee){let Oe=new Set(K.source.slice(4,-2).split("|"));ee={test:(Ot)=>Oe.has(Ot)},aa.set(K,ee)}return ee}var cr=bi((K)=>class extends K{declareName(ee,Oe,Ot){let Ft=!1;if(Oe===Ul){let jt=this.currentScope();if(Ft=En(jt.lexical,ee)||En(jt.functions,ee)||En(jt.var,ee),jt.lexical.push(ee),this.inModule&&jt.flags&ki)delete this.undefinedExports[ee]}else if(Oe===Hl)this.currentScope().lexical.push(ee);else if(Oe===Kl){let jt=this.currentScope();Ft=this.treatFunctionsAsVar?En(jt.lexical,ee):En(jt.lexical,ee)||En(jt.var,ee),jt.functions.push(ee)}else for(let jt=this.scopeStack.length-1;jt>=0;--jt){let Gt=this.scopeStack[jt];if(En(Gt.lexical,ee)&&!(Gt.flags&Vl&&Gt.lexical[0]===ee)||!this.treatFunctionsAsVarInScope(Gt)&&En(Gt.functions,ee)){Ft=!0;break}if(Gt.var.push(ee),this.inModule&&Gt.flags&ki)delete this.undefinedExports[ee];if(Gt.flags&Wl)break}if(Ft)this.raiseRecoverable(Ot,`Identifier '${ee}' has already been declared`)}}),lr=bi((K)=>{let{keywordTypes:ee,tokTypes:Oe}=K.acorn,Ot=new Map("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 const class extends export import super".split(" ").map((jt)=>[jt,ee[jt]])),Ft;return class extends K{constructor(jt,Gt,Mt){super(jt,Gt,Mt);this.keywords=as(this.keywords),this.reservedWords=as(this.reservedWords),this.reservedWordsStrict=as(this.reservedWordsStrict),this.reservedWordsStrictBind=as(this.reservedWordsStrictBind),Ft??=this.context[0]}reset(jt,Gt,Mt){if(super.reset?.(jt,Gt,Mt),this.input=jt,this.containsEsc=!1,this.pos=Gt,Mt)this.lineStart=Gt-Mt.column,this.curLine=Mt.line;else this.lineStart=jt.lastIndexOf(`
|
|
22
|
+
`,Gt-1)+1,this.curLine=this.options.locations?jt.slice(0,this.lineStart).split(ql).length:1;this.type=Oe.eof,this.value=null,this.start=this.end=Gt,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=Gt;let Vt=this.context;if(Vt.length!==1||Vt[0]!==Ft)this.context=this.initialContext();if(this.exprAllowed=!0,this.strict=!0,this.potentialArrowAt=-1,this.potentialArrowInForAwait=!1,this.yieldPos=this.awaitPos=this.awaitIdentPos=0,this.labels.length>0)this.labels=[];for(let Ht in this.undefinedExports){this.undefinedExports=Object.create(null);break}let Wt=this.scopeStack,Kt=Wt[0];if(Wt.length!==1||Kt.flags!==ki||Kt.var.length>0||Kt.lexical.length>0||Kt.functions.length>0||Kt.tsTypes!==void 0||Kt.tsExportOnly!==void 0||Kt.tsEnums!==void 0)this.scopeStack=[],this.enterScope(ki);if(this.regexpState=null,this.privateNameStack.length>0)this.privateNameStack=[];this.inTemplateElement=!1}parseParenAndDistinguishExpression(jt,Gt){let Mt=super.parseParenAndDistinguishExpression(jt,Gt);if(Mt.type==="ParenthesizedExpression")cs=!0;return Mt}checkUnreserved(jt){if(fe.has(jt.name))super.checkUnreserved(jt)}canInsertSemicolon(){let jt=this.type;return jt===Oe.eof||jt===Oe.braceR||wi(this.input,this.lastTokEnd,this.start)}checkLocalExport(){}skipSpace(){let jt=this.input,Gt=this.options.locations,Mt=this.pos,Vt=jt.charCodeAt(Mt);for(;;)if(Vt===32||Vt===9)Vt=jt.charCodeAt(++Mt);else if(Vt===10){if(Vt=jt.charCodeAt(++Mt),Gt)this.curLine++,this.lineStart=Mt}else break;if(this.pos=Mt,Vt===47||Vt<33||Vt>=128)super.skipSpace()}readWord1(){let jt=this.input,Gt=this.pos,Mt=Gt,Vt=jt.charCodeAt(Mt),Wt=0;while(Vt>=97&&Vt<=122||Vt>=65&&Vt<=90||Vt>=48&&Vt<=57||Vt===95||Vt===36)Wt=Math.imul(Wt,31)+Vt|0,Vt=jt.charCodeAt(++Mt);if(Vt>=128||Vt===92)return super.readWord1();return this.containsEsc=!1,this.pos=Mt,go(jt,Gt,Mt,Wt)}readWord(){let jt=this.readWord1();return this.finishToken(Ot.get(jt)??Oe.name,jt)}}}),ca=ss(cr,lr),zl=/ \(\d+:\d+\)$/;function Ai(K){return K}function la(K){return K instanceof SyntaxError&&"pos"in K&&typeof K.pos==="number"}function ur(K,ee,Oe,Ot,Ft,jt=K.root.comments.length){let Gt=K.root.comments;Rl(ee,Gt);let Mt={onComment:K.comments?Ll:Ol,sourceType:"module",ecmaVersion:16,locations:K.loc,preserveParens:Ot};if(K.lfOnly)Mt.startLocation=g(Oe);let Vt=K.isTypeScript?K.typescript:ca;if(!Vt)le();let Wt;try{Wt=Ft(Vt,Mt)}catch(Kt){if(!la(Kt))throw Kt;Dl(Kt.pos,Kt.message.replace(zl,""))}if(Gt.length>jt)Fl(Ai(Wt),Gt,Oe);return Wt}function de(K,ee,Oe=0){return Ai(ur(K,ee,0,!1,(Ot,Ft)=>{if(Oe>0&&Ft.locations)Ft.startLocation=g(Oe);let jt=new Ot(Ft,ee,Oe).parse();return jt.start=0,jt},0))}function Xl(K,ee){if(!ee)return{line:1,column:0};let{column:Oe}=g(K);return{line:xo(K-Oe)+1,column:Oe}}var Jl={count:0},ar,Yl=(K)=>K.parseExpression();function Ql(K,ee,Oe,Ot,Ft){let jt=ar;if(ar=void 0,jt?.ParserClass===K&&jt.onComment===ee.onComment&&jt.locations===ee.locations&&jt.parser.reset)jt.parser.reset(Oe,Ot,ee.startLocation);else jt={ParserClass:K,onComment:ee.onComment,locations:ee.locations,parser:new K(ee,Oe,Ot)};let Gt=jt.parser;Gt.nextToken();let Mt=Ft(Gt);return Gt.input="",ar=jt,Mt}function ua(K,ee,Oe,Ot){return Jl.count+=1,cs=!1,ur(K,ee,Oe,!0,(Ft,jt)=>(jt.startLocation??=Xl(Oe,jt.locations),Ql(Ft,jt,ee,Oe,Ot)))}function M(K,ee,Oe,Ot=!1){let Ft=Ai(ua(K,ee,Oe,Yl)),jt=Math.max(Ft.end,Il());return{node:cs&&!Ot?hr(Ft):Ft,end:jt}}function At(K,ee,Oe){let Ot=K.root.comments.length,Ft=!0,jt=ua(K,ee,Oe,(Mt)=>{let Vt={shorthandAssign:-1,trailingComma:-1,parenthesizedAssign:-1,parenthesizedBind:-1,doubleProto:-1},Wt=Mt.parseMaybeConditional(void 0,Vt);if(Mt.type!==ca.acorn.tokTypes.eof)return Ft=!1,Wt;let Kt=Mt.toAssignable(Wt,!1,Vt);return Mt.checkLValPattern(Kt),Kt});if(!Ft){K.root.comments.length=Ot;return}let Gt=Ai(jt);return cs?hr(Gt):Gt}function _t(K,ee,Oe){return Ai(ur(K,ee,Oe,!1,(Ot,Ft)=>{let jt=new Ot(Ft,ee,Oe);try{return jt.nextToken(),jt.parseStatement(null,!0,Object.create(null))}catch(Gt){if(la(Gt)&&Gt.pos===ee.length)f(ee.length);throw Gt}}))}function hr(K){let ee=K;while(ee.type==="ParenthesizedExpression")ee=ee.expression;return U(ee,hr),ee}var B=ss(cr,pe,lr);function ha(K,ee,Oe){return te(K),de({isTypeScript:ee.typescript??!1,typescript:Oe,loc:ee.loc??!1,comments:ee.comments??!0,root:{comments:[]}},K)}function me(K,ee={}){return ha(K,ee,B)}function he(K,ee){let Oe=u(K.name,ee.name);if(Oe!==0)return Oe;let Ot=u(K.type,ee.type);if(Ot!==0)return Ot;if(K.type==="forwarded"&&ee.type==="forwarded"){let Ft=u(K.element,ee.element);if(Ft!==0)return Ft}return u(K.detail??"",ee.detail??"")}function Zl(K,ee){let Oe=K.length+1,Ot=ee.length+1,Ft=Array.from({length:Oe},()=>Array(Ot).fill(0));for(let jt=0;jt<Oe;jt++)Ft[jt][0]=jt;for(let jt=0;jt<Ot;jt++)Ft[0][jt]=jt;for(let jt=1;jt<Oe;jt++)for(let Gt=1;Gt<Ot;Gt++){let Mt=K[jt-1]===ee[Gt-1]?0:1;if(Ft[jt][Gt]=Math.min(Ft[jt-1][Gt]+1,Ft[jt][Gt-1]+1,Ft[jt-1][Gt-1]+Mt),jt>1&&Gt>1&&K[jt-1]===ee[Gt-2]&&K[jt-2]===ee[Gt-1])Ft[jt][Gt]=Math.min(Ft[jt][Gt],Ft[jt-2][Gt-2]+1)}return Ft[Oe-1][Ot-1]}function N(K,ee,Oe=3){let Ot,Ft=Number.POSITIVE_INFINITY;for(let jt of ee){let Gt=Zl(K,jt);if(Gt<Ft)Ot=jt,Ft=Gt}return Ft<=Oe?Ot:void 0}import{readFile as nu}from"node:fs/promises";import mr from"node:path";import da,{sep as dr}from"node:path";var Pn=/\.svelte$/,hi=[".ts",".mts",".cts",".tsx",".js",".mjs",".cjs",".jsx",".d.ts"],fa=/\.(?:svelte|[mc]?ts|[mc]?js|tsx|jsx)$/;function di(K){if(!K.endsWith(".svelte"))return!1;let ee=K.length-7;if(ee===0)return!1;let Oe=K.charCodeAt(ee-1);return Oe!==47&&(dr==="/"||Oe!==92)}function n(K){return dr==="/"?K:K.split(dr).join("/")}function ma(K,ee){return n(da.join(ee,da.normalize(K)))}function Pi(K){return`${JSON.stringify(K,null,2)}
|
|
23
|
+
`}var ga="sveld",ls="0.38.9";var Nt={name:ga,version:ls,license:"Apache-2.0",description:"Generate TypeScript definitions and component documentation for your Svelte components.",type:"module",main:"./dist/index.js",types:"./dist/index.d.ts",exports:{".":{types:"./dist/index.d.ts",import:"./dist/index.js",default:"./dist/index.js"},"./browser":{types:"./dist/browser.d.ts",import:"./dist/browser.js",default:"./dist/browser.js"},"./schema/component-api.schema.json":"./schema/component-api.schema.json"},scripts:{test:"bun test --parallel","test:update":"SVELD_UPDATE_FIXTURES=1 bun test tests/fixtures.test.ts","test:fixtures-types":"bun check --project tsconfig.fixtures.json","test:types-matrix":"bun scripts/typecheck-option-matrix.ts","test:svelte-versions":"bun scripts/typecheck-svelte-versions.ts","test:e2e":"bun tests/test-e2e.ts","test:inferred-types":"bun scripts/check-inferred-types.ts",format:"biome format --write .",lint:"biome check --error-on-warnings .","lint:fix":"biome check --write --unsafe .","lint:fix:changed":"biome check --write --unsafe --changed --no-errors-on-unmatched",knip:"knip-bun",build:"bun scripts/build.ts",bench:"bun scripts/bench.ts","bench:cache":"bun scripts/bench.ts --cache","bench:ostia":"ostia bench scripts/bench-ostia.ts",typecheck:"bun check && bun check --project tsconfig.excluded.json"},devDependencies:{"@biomejs/biome":"2.6.3","@types/bun":"^1.4.4","@types/jest":"^30.0.0","@typescript/typescript6":"^6.0.2",ajv:"^8.20.0",knip:"^6.43.0",ostia:"^0.2.11",sveast:"^0.9.6",svelte:"^5.57.2",typescript:"^7.0.2"},bin:{sveld:"dist/cli.js"},repository:{type:"git",url:"git+https://github.com/carbon-design-system/sveld.git"},homepage:"https://github.com/carbon-design-system/sveld",bugs:"https://github.com/carbon-design-system/sveld/issues",keywords:["svelte","svelte component","documentation","docgen","typescript","definitions","JSDocs","vite","vite-plugin"],maintainers:["Eric Liu (https://github.com/metonym)"]};var _i="5.57.2";var us=1;function Wn(K){return K.some((ee)=>ee.internal)?K.filter((ee)=>!ee.internal):K}function tu(K){return{...K,props:Wn(K.props),moduleExports:Wn(K.moduleExports),slots:Wn(K.slots),events:Wn(K.events),typedefs:Wn(K.typedefs),...K.contexts?{contexts:Wn(K.contexts).map((ee)=>({...ee,properties:Wn(ee.properties)}))}:{}}}function h(K,ee={}){let Oe=Array.from(K.values(),(jt)=>{let{diagnostics:Gt,...Mt}=jt;return tu(Mt)}).sort((jt,Gt)=>u(jt.moduleName,Gt.moduleName)),Ot={schemaVersion:us,generator:{name:ga,version:ls,svelteVersion:_i},total:Oe.length,components:Oe},Ft=ee.entryExports?Wn(ee.entryExports):void 0;if(Ft&&Ft.length>0)Ot.totalExports=Ft.length,Ot.exports=Ft;return Ot}var iu=/[:=]/,gr="COMPONENT_API.json",hs={none:0,patch:1,minor:2,major:3};function su(K,ee){return hs[ee]>hs[K]?ee:K}function ru(K){return K.reduce((ee,Oe)=>su(ee,Oe.bump),"none")}function Sa(K,ee){return hs[K]>=hs[ee]}function ya(K){return new Set(i(K,"|").map((ee)=>ee.trim()).filter((ee)=>ee.length>0))}function xa(K){let ee=v(K);if(ee===-1)return;let Oe=K.slice(0,ee).trim(),Ot=K.slice(ee+2).trim();if(!Oe.startsWith("(")||!Oe.endsWith(")"))return;let Ft=Oe.slice(1,-1).trim();return{params:Ft.length===0?[]:i(Ft,",").map((Gt)=>Gt.trim()),returnType:Ot}}function ou(K){return(K.split(iu,1)[0]??"").trimEnd().endsWith("?")}function au(K,ee){if(K.returnType!==ee.returnType)return"major";if(ee.params.length<K.params.length)return"major";for(let Ot=0;Ot<K.params.length;Ot++)if(K.params[Ot]!==ee.params[Ot])return"major";if(ee.params.length===K.params.length)return"none";return ee.params.slice(K.params.length).every(ou)?"minor":"major"}function yr(K,ee){if(K===ee)return"none";if(K===void 0||ee===void 0)return"major";let Oe=xa(K),Ot=xa(ee);if(Oe&&Ot)return au(Oe,Ot);let Ft=ya(K),jt=ya(ee),Gt=[...jt].some((Vt)=>!Ft.has(Vt));if(![...Ft].some((Vt)=>!jt.has(Vt)))return Gt?"minor":"none";return"major"}function va(K){return K.bindable===!0||K.binding==="writable"}function fs(K,ee,Oe){let Ot=new Map(K.map((Vt)=>[Oe(Vt),Vt])),Ft=new Map(ee.map((Vt)=>[Oe(Vt),Vt])),jt=[...Ft].filter(([Vt])=>!Ot.has(Vt)),Gt=[...Ot.keys()].filter((Vt)=>!Ft.has(Vt)),Mt=[];for(let[Vt,Wt]of Ot){let Kt=Ft.get(Vt);if(Kt)Mt.push([Vt,Wt,Kt])}return{added:jt,removed:Gt,common:Mt}}function xr(K,ee,Oe,Ot){return(Ft,jt,Gt)=>K.push({component:ee,kind:Oe,name:Ft,bump:jt,message:`${Ot} "${Ft}" ${Gt}`})}function Ea(K,ee,Oe,Ot){let Ft=[],jt=xr(Ft,K,ee,ee==="prop"?"prop":"export"),{added:Gt,removed:Mt,common:Vt}=fs(Oe,Ot,(Wt)=>Wt.name);for(let[Wt,Kt]of Gt)jt(Wt,Kt.isRequired?"major":"minor",`added${Kt.isRequired?" (required)":""}`);for(let Wt of Mt)jt(Wt,"major","removed");for(let[Wt,Kt,Ht]of Vt){if(Kt.isRequired!==Ht.isRequired)jt(Wt,Ht.isRequired?"major":"minor",`became ${Ht.isRequired?"required":"optional"}`);let qt=yr(Kt.type,Ht.type);if(qt!=="none")jt(Wt,qt,`type changed from \`${Kt.type??"unknown"}\` to \`${Ht.type??"unknown"}\``);let zt=va(Ht);if(va(Kt)!==zt)jt(Wt,zt?"minor":"major",zt?"gained a writable binding":"lost its writable binding");if(Kt.value!==Ht.value&&qt==="none")jt(Wt,"patch",`default changed from \`${Kt.value??"none"}\` to \`${Ht.value??"none"}\``);let Xt=Ht.deprecated!==void 0;if(Kt.deprecated!==void 0!==Xt)jt(Wt,Xt?"minor":"patch",Xt?"marked as deprecated":"no longer deprecated");if(Kt.constant!==Ht.constant)jt(Wt,"minor",Ht.constant?"became constant":"became mutable");if(Kt.reactive!==Ht.reactive)jt(Wt,"minor",Ht.reactive?"became reactive":"stopped being reactive")}return Ft}function pu(K,ee,Oe){let Ot=[],Ft=xr(Ot,K,"event","event"),{added:jt,removed:Gt,common:Mt}=fs(ee,Oe,(Vt)=>Vt.name);for(let[Vt]of jt)Ft(Vt,"minor","added");for(let Vt of Gt)Ft(Vt,"major","removed");for(let[Vt,Wt,Kt]of Mt){if(Wt.type!==Kt.type){Ft(Vt,"major",`changed from ${Wt.type} to ${Kt.type}`);continue}let Ht=Wt.type==="dispatched"?Wt.detail:void 0,qt=Kt.type==="dispatched"?Kt.detail:void 0,zt=yr(Ht,qt);if(zt!=="none")Ft(Vt,zt,`detail changed from \`${Ht??"unknown"}\` to \`${qt??"unknown"}\``)}return Ot}function cu(K,ee,Oe){let Ot=[],Ft=xr(Ot,K,"slot","slot"),{added:jt,removed:Gt,common:Mt}=fs(ee,Oe,(Vt)=>Vt.name??"default");for(let[Vt]of jt)Ft(Vt,"minor","added");for(let Vt of Gt)Ft(Vt,"major","removed");for(let[Vt,Wt,Kt]of Mt){let Ht=yr(Wt.slot_props,Kt.slot_props);if(Ht!=="none")Ft(Vt,Ht,`props changed from \`${Wt.slot_props??"none"}\` to \`${Kt.slot_props??"none"}\``)}return Ot}var lu=new Set(["description","source","componentCommentSource","tags"]);function ds(K){if(Array.isArray(K))return K.map(ds);if(r(K)){let ee={};for(let[Oe,Ot]of Object.entries(K)){if(lu.has(Oe))continue;ee[Oe]=ds(Ot)}return ee}return K}var uu=["generics","rest_props","extends","contexts","typedefs"];function hu(K,ee,Oe){let Ot=[];for(let Ft of uu){let jt=JSON.stringify(ds(ee[Ft])),Gt=JSON.stringify(ds(Oe[Ft]));if(jt!==Gt)Ot.push({component:K,kind:"shape",name:Ft,bump:"major",message:`"${Ft}" changed (breaking)`})}return Ot}function du(K,ee){let Oe=ee.moduleName;return[...Ea(Oe,"prop",K.props,ee.props),...Ea(Oe,"moduleExport",K.moduleExports,ee.moduleExports),...pu(Oe,K.events,ee.events),...cu(Oe,K.slots,ee.slots),...hu(Oe,K,ee)]}function Rt(K,ee){let Oe=[],{added:Ot,removed:Ft,common:jt}=fs(K.components,ee.components,(Gt)=>Gt.moduleName);for(let[Gt]of Ot)Oe.push({component:Gt,kind:"component",bump:"minor",message:`component "${Gt}" added`});for(let Gt of Ft)Oe.push({component:Gt,kind:"component",bump:"major",message:`component "${Gt}" removed`});for(let[,Gt,Mt]of jt)Oe.push(...du(Gt,Mt));return Oe}async function fu(K){let ee;try{ee=await nu(mr.resolve(K),"utf-8")}catch(Oe){if(Oe.code==="ENOENT")return null;throw Oe}try{return JSON.parse(ee)}catch{throw Error(`sveld: could not parse "${K}" as JSON. Is it a sveld COMPONENT_API.json snapshot?`)}}function Ca(K){if(typeof K.check==="string")return K.check;return K.jsonOptions?.outFile??gr}function ba(K,ee){if(!K.json||K.stdout||K.jsonOptions?.outDir)return!1;return mr.resolve(K.jsonOptions?.outFile??gr)===mr.resolve(ee)}async function Ne(K,ee,Oe={}){let Ot=await fu(ee);if(Ot===null)return{snapshotExists:!1,snapshotFile:ee,changes:[],bump:"none"};if(Ot.schemaVersion!==us)return{snapshotExists:!0,snapshotFile:ee,changes:[{component:"*",kind:"schema",bump:"none",message:`snapshot schemaVersion ${Ot.schemaVersion} differs from ${us}; regenerate the snapshot`}],bump:"none"};let Ft=h(K,{entryExports:Oe.entryExports}),jt=Rt(Ot,Ft);return{snapshotExists:!0,snapshotFile:ee,changes:jt,bump:ru(jt)}}var mu={major:"BREAKING",minor:"additive",patch:"patch",none:"no change"};function ge(K){if(!K.snapshotExists){let Ft=K.snapshotFile===gr?"`sveld --json`":`\`sveld --json\` with \`jsonOptions.outFile: "${K.snapshotFile}"\``;return`sveld --check: no snapshot found at "${K.snapshotFile}". Generate it with ${Ft} and commit it.`}if(K.changes.length===0)return`sveld --check: no API changes detected against "${K.snapshotFile}".`;let ee=K.changes.length,Oe=[`sveld --check: ${ee} API change${ee===1?"":"s"} detected against "${K.snapshotFile}".`,`Suggested semver bump: ${K.bump}.`],Ot=new Map;for(let Ft of K.changes){let jt=Ot.get(Ft.component)??[];jt.push(Ft),Ot.set(Ft.component,jt)}for(let[Ft,jt]of Ot){Oe.push("",` ${Ft}`);for(let Gt of jt){let Mt=Gt.kind==="schema"?"schema":mu[Gt.bump];Oe.push(` [${Mt}] ${Gt.message}`)}}return Oe.join(`
|
|
24
|
+
`)}var It=1;function ye(K){let ee={kind:"check-report",schemaVersion:It,...K};return Pi(ee)}import{existsSync as ka}from"node:fs";import{join as gu,resolve as yu}from"node:path";import{pathToFileURL as xu}from"node:url";var vu=["sveld.config.js","sveld.config.mjs","sveld.config.ts"];function $t(K){return K}function Eu(K=process.cwd()){for(let ee of vu){let Oe=gu(K,ee);if(ka(Oe))return Oe}return null}async function Aa(K){let ee;try{ee=await import(`${xu(K).href}?t=${Date.now()}`)}catch(Ot){let Ft=Ot instanceof Error?Ot.message:String(Ot);throw Error(`sveld: failed to load config file "${K}".
|
|
25
|
+
${Ft}`)}let Oe=ee.default;if(!r(Oe)||Array.isArray(Oe))throw Error(`sveld: config file "${K}" must export a configuration object as its default export. Did you forget \`export default defineConfig({ ... })\`?`);return Oe}async function Su(K=process.cwd()){let ee=Eu(K);return ee===null?{}:Aa(ee)}async function J(K,ee,Oe){if(typeof K==="string"){let Ot=yu(ee,K);if(!ka(Ot))throw Error(`sveld: config file "${K}" does not exist.`);return Aa(Ot)}return K??Oe?Su(ee):{}}function R(...K){let ee={};for(let Oe of K){if(!Oe)continue;for(let[Ot,Ft]of Object.entries(Oe)){let jt=ee[Ot];ee[Ot]=r(jt)&&!Array.isArray(jt)&&r(Ft)&&!Array.isArray(Ft)?{...jt,...Ft}:Ft}}return ee}var wa=["entry","glob","quiet","documentExports","types","typesOptions","json","jsonOptions","markdown","markdownOptions","failFast","watch","config","cache","checkExamples","reportDiagnostics","strict","check","checkLevel","stdout","format","diagnostics"],Cu={typesOptions:["outDir","preamble","format","transform","indexTypes"],jsonOptions:["outFile","outDir","source"],markdownOptions:["outFile","outDir","onAppend"],diagnostics:["ignore"]};function Ta(K,ee,Oe){let Ot=K===null?ee:`${K}.${ee}`,Ft=N(ee,Oe),jt=Ft===void 0?void 0:K===null?Ft:`${K}.${Ft}`;console.warn(`sveld: unknown option "${Ot}".${jt?` Did you mean "${jt}"?`:""}`)}function q(K){for(let ee of Object.keys(K))if(!wa.includes(ee))Ta(null,ee,wa);for(let[ee,Oe]of Object.entries(Cu)){let Ot=K[ee];if(!r(Ot))continue;for(let Ft of Object.keys(Ot))if(!Oe.includes(Ft))Ta(ee,Ft,Oe)}}import{dirname as Ec}from"node:path";import{lstatSync as Ef}from"node:fs";import{readFile as Sf}from"node:fs/promises";import{resolve as Kp}from"node:path";import{dirname as Ih}from"node:path";var bu=" ",wu=120,Tu=/\binterface\s+[A-Za-z_$][\w$]*(\s*<[^{};]*>)?\s*$/,ku=200,Na=/\s/,Au=/\s{2}|[^\S ]/,Pu=/["'`{}/]/g,_u=/["'`{};/]/g,Da=9,vr=10,$u=13,$i=32,gs=34,Nu=38,ys=39,Du=40,Ru=41,ms=42,Pa=46,Sr=47,Ra=59,Iu=62,Ou=91,Cr=92,Lu=93,xs=96,br=123,Mu=124,wr=125;function Fu(K){return Tu.test(ju(K,ku))}var _a=[""];function Bu(K){let ee=_a[K];if(ee===void 0)ee=bu.repeat(K),_a[K]=ee;return ee}function ju(K,ee){let Oe="";for(let Ot=K.length-1;Ot>=0&&Oe.length<ee;Ot--)Oe=K[Ot]+Oe;return Oe.length>ee?Oe.slice(-ee):Oe}function Vu(K){if(K.length===0)return!1;let ee=K[K.length-1];return ee.charCodeAt(ee.length-1)===vr}function Gu(K){while(K.length>0){let ee=K[K.length-1],Oe=ee.length;while(Oe>0){let Ot=ee.charCodeAt(Oe-1);if(Ot!==$i&&Ot!==Da)break;Oe--}if(Oe===ee.length)return;if(Oe===0){K.pop();continue}K[K.length-1]=ee.slice(0,Oe);return}}function Wu(K){while(K.length>0){let ee=K[K.length-1];if(!Na.test(ee[ee.length-1]))return;let Oe=ee.trimEnd();if(Oe.length===ee.length)return;if(Oe.length===0){K.pop();continue}K[K.length-1]=Oe;return}}function Uu(K){if(K.includes("{"))return!1;let ee=0,Oe=0;for(let Ot=0;Ot<K.length;Ot++){let Ft=K.charCodeAt(Ot);if(ee!==0){if(Ft===ee&&K.charCodeAt(Ot-1)!==Cr)ee=0;continue}if(Ft===gs||Ft===ys||Ft===xs){ee=Ft;continue}if(Ft===Ra&&++Oe>=2)return!0}return!1}function Ku(K){if(!Au.test(K))return K.trimEnd();let ee="",Oe=null,Ot=!1;for(let Ft=0;Ft<K.length;Ft++){let jt=K[Ft],Gt=K[Ft-1];if(Oe){if(ee+=jt,Oe==="double"&&jt==='"'&&Gt!=="\\"||Oe==="single"&&jt==="'"&&Gt!=="\\"||Oe==="template"&&jt==="`"&&Gt!=="\\")Oe=null;Ot=!1;continue}if(jt==='"'||jt==="'"||jt==="`"){Oe=jt==='"'?"double":jt==="'"?"single":"template",ee+=jt,Ot=!1;continue}if(Na.test(jt)){if(!Ot&&ee.length>0)ee+=" ",Ot=!0;continue}ee+=jt,Ot=!1}return ee.trimEnd()}function Ia(K,ee){let Oe=K[ee],Ot=K.indexOf(Oe,ee+1);while(Ot!==-1&&K.charCodeAt(Ot-1)===Cr)Ot=K.indexOf(Oe,Ot+1);return Ot}function Oa(K,ee){let Oe=K.indexOf("*/",ee+1);return Oe===-1?-1:Oe+1}function Hu(K){let ee=new Map,Oe=[],Ot=Pu,Ft=0;while(Ft<K.length){if(Ot.lastIndex=Ft,!Ot.test(K))break;Ft=Ot.lastIndex-1;let jt=K.charCodeAt(Ft);if(jt===Sr){if(K.charCodeAt(Ft+1)===ms){let Gt=Oa(K,Ft);if(Gt===-1)break;Ft=Gt}}else if(jt===gs||jt===ys||jt===xs){let Gt=Ia(K,Ft);if(Gt===-1)break;Ft=Gt}else if(jt===br)Oe.push(Ft);else if(jt===wr&&Oe.length>0)ee.set(Oe.pop(),Ft);Ft++}return ee}function qu(K,ee,Oe){for(let Ot=ee;Ot<Oe;Ot++)if(!Er(K.charCodeAt(Ot)))return!1;return!0}function Er(K){if(K<=$i)return K===$i||K>=Da&&K<=$u;if(K<160)return!1;return K===160||K===5760||K>=8192&&K<=8202||K===8232||K===8233||K===8239||K===8287||K===12288||K===65279}function La(K,ee,Oe,Ot){let Ft=[],jt=_u,Gt=ee,Mt=ee;while(Mt<Oe){if(jt.lastIndex=Mt,!jt.test(K))break;if(Mt=jt.lastIndex-1,Mt>=Oe)break;let Vt=K.charCodeAt(Mt);if(Vt===Sr){if(K.charCodeAt(Mt+1)===ms){let Wt=Oa(K,Mt);if(Wt===-1)break;Mt=Wt}Mt++;continue}if(Vt===gs||Vt===ys||Vt===xs){let Wt=Ia(K,Mt);if(Wt===-1)break;Mt=Wt+1;continue}if(Vt===br){let Wt=Ot.get(Mt);if(Wt===void 0||Wt>=Oe){Mt++;continue}if(Gt<Mt)Ft.push(K.slice(Gt,Mt));let Kt=Mt+1;if(qu(K,Kt,Wt)){Ft.push("{}"),Mt=Wt+1,Gt=Mt;continue}let Ht=K.slice(Kt,Wt),qt=K.charCodeAt(Kt)===vr;if(!qt&&!Ht.includes("/*")&&!Uu(Ht)&&!Fu(Ft)){let zt=La(K,Kt,Wt,Ot),Xt=zt.trim();if(!Xt.includes(`
|
|
26
|
+
`)){let Yt=Xt.endsWith(";")?Xt.slice(0,-1):Xt,Jt=`{ ${Ku(Yt)} }`;if(Jt.length<=wu){Ft.push(Jt),Mt=Wt+1,Gt=Mt;continue}}if(Ft.push("{"),zt.charCodeAt(0)!==Ra)Ft.push(`
|
|
27
27
|
`);if(zt.length>0)Ft.push(zt);Mt=Wt,Gt=Wt;continue}if(Ft.push("{"),!qt)Ft.push(`
|
|
28
|
-
`);Mt=Kt,Gt=Kt;continue}if(Vt===
|
|
29
|
-
`);Ft.push("}"),Mt++,Gt=Mt;continue}if(Gt<Mt)Ft.push(K.slice(Gt,Mt));if(
|
|
30
|
-
`);Mt++,Gt=Mt}if(Gt<Oe)Ft.push(K.slice(Gt,Oe));return Ft.join("")}function
|
|
31
|
-
`,Mt);if(Kt===-1)Kt=Ot;let Ht=Kt+1,qt=Mt,zt=Kt;while(qt<zt&&
|
|
32
|
-
`);let Ht=ee[Kt];if(Ht>0)Wt.push(
|
|
33
|
-
`}var kn="any",
|
|
28
|
+
`);Mt=Kt,Gt=Kt;continue}if(Vt===wr){if(Gt<Mt)Ft.push(K.slice(Gt,Mt));if(Gu(Ft),!Vu(Ft))Ft.push(`
|
|
29
|
+
`);Ft.push("}"),Mt++,Gt=Mt;continue}if(Gt<Mt)Ft.push(K.slice(Gt,Mt));if(Wu(Ft),Ft.push(";"),K.charCodeAt(Mt+1)!==vr)Ft.push(`
|
|
30
|
+
`);Mt++,Gt=Mt}if(Gt<Oe)Ft.push(K.slice(Gt,Oe));return Ft.join("")}function zu(K){if(!K.includes(" "))return K;let ee="",Oe=0;for(let Ot=0;Ot<K.length;Ot++){let Ft=K.charCodeAt(Ot);if(Oe!==0){if(ee+=K[Ot],Ft===Oe&&K.charCodeAt(Ot-1)!==Cr)Oe=0;continue}if(Ft===gs||Ft===ys||Ft===xs){Oe=Ft,ee+=K[Ot];continue}if(Ft===$i&&ee.charCodeAt(ee.length-1)===$i)continue;ee+=K[Ot]}return ee}function Xu(K){return K===wr||K===Lu||K===Ru||K===Iu}function Ju(K,ee,Oe){return Oe-ee>=3&&K.charCodeAt(ee)===Sr&&K.charCodeAt(ee+1)===ms&&K.charCodeAt(ee+2)===ms}function $a(K,ee,Oe){let Ot=K.indexOf("*/",ee);return Ot!==-1&&Ot+2<=Oe}function Yu(K,ee,Oe){let Ot=K.charCodeAt(ee);if(Ot===Mu||Ot===Nu)return!0;return Ot===Pa&&ee+1<Oe&&K.charCodeAt(ee+1)!==Pa}function Qu(K){let ee=[],Oe=[],Ot=K.length,Ft=0,jt=!1,Gt=0,Mt=0;while(Mt<=Ot){let Kt=K.indexOf(`
|
|
31
|
+
`,Mt);if(Kt===-1)Kt=Ot;let Ht=Kt+1,qt=Mt,zt=Kt;while(qt<zt&&Er(K.charCodeAt(qt)))qt++;while(zt>qt&&Er(K.charCodeAt(zt-1)))zt--;if(qt===zt){let sn=Oe.length>0?Oe[Oe.length-1]:void 0;if(sn!==void 0&&sn!==""){let ln=sn.charCodeAt(sn.length-1);if(ln!==br&&ln!==Du&&ln!==Ou)ee.push(0),Oe.push("")}Mt=Ht;continue}if(jt){if(ee.push(Gt),Oe.push(` ${K.slice(qt,zt)}`),$a(K,qt,zt))jt=!1;Mt=Ht;continue}let Xt=Ju(K,qt,zt),Yt=Xt&&$a(K,qt,zt);if(Xt&&!Yt){ee.push(Ft),Oe.push(K.slice(qt,zt)),jt=!0,Gt=Ft,Mt=Ht;continue}let Jt=Xu(K.charCodeAt(qt)),tn=Math.max(0,Ft-(Jt?1:0))+(Yu(K,qt,zt)?1:0);if(Jt&&tn===0&&Oe.length>0&&Oe[Oe.length-1]==="")ee.pop(),Oe.pop();if(ee.push(tn),Oe.push(zu(K.slice(qt,zt))),Mt=Ht,Yt)continue;Ft=qi(K,void 0,qt,zt,Ft)}let Vt=Oe.length;while(Vt>0&&Oe[Vt-1]==="")Vt--;let Wt=[];for(let Kt=0;Kt<Vt;Kt++){if(Kt>0)Wt.push(`
|
|
32
|
+
`);let Ht=ee[Kt];if(Ht>0)Wt.push(Bu(Ht));Wt.push(Oe[Kt])}return Wt.join("")}function Ma(K){return`${Qu(La(K,0,K.length,Hu(K)))}
|
|
33
|
+
`}var kn="any",Zu="Record<string, any>",Ni="Record<string, never>",Wa=/^[A-Za-z_$][A-Za-z0-9_$]*$/,eh=/CustomEvent/,th=/^[A-Z]/,nh=/\n/,ih=/=>/,sh=/^\s*[(<]/,rh=/(?:^|\n)@default\b/,oh=/^([ \t]*\*) +$/gm,ah=/[^\S\r\n]*[\r\n]\s*/g,ph=/(^|[^.\w])Snippet(?:\s*<|\b)/,ch=/import\s+type\s+[^;]*\bSnippet\b[^;]*from\s+"svelte";/,lh=/^const\s+/,uh=/^export /,hh=/[^\w$]/g;function Ua(K){return K.replace(lh,"")}function Rn(K){if(K.length===0)return"";return`/**
|
|
34
34
|
* ${O(K.join(`
|
|
35
35
|
* `))}
|
|
36
|
-
*/`}function
|
|
37
|
-
`):[]}function
|
|
38
|
-
`)}function
|
|
36
|
+
*/`}function Di(K){return K?K.split(`
|
|
37
|
+
`):[]}function Ka(K){if(K===void 0)return[];return(K===!0?"@deprecated":`@deprecated ${K}`).split(`
|
|
38
|
+
`)}function kr(K){let ee=[];for(let{name:Oe,body:Ot}of K??[])if(!Ot)ee.push(`@${Oe}`);else if(Ot.includes(`
|
|
39
39
|
`))ee.push(`@${Oe}`,...Ot.split(`
|
|
40
|
-
`));else ee.push(`@${Oe} ${Ot}`);return ee}function
|
|
41
|
-
`)?
|
|
42
|
-
`}function
|
|
43
|
-
`:""}export ${ee.ts}`.replace(
|
|
40
|
+
`));else ee.push(`@${Oe} ${Ot}`);return ee}function fi(K,ee,Oe){return[...Di(K),...Ka(ee),...kr(Oe)]}function Ha(K){if(!K)return"";return`/** ${O(K)} */`}function Ar(K){return K?.includes(`
|
|
41
|
+
`)?Rn(Di(K)):Ha(K)}function Pr(K,ee,Oe){let Ot=[...kr(ee),...Ka(Oe)];if(Ot.length===0)return Ar(K);return Rn([...Di(K),...Ot])}function qa(K){if(K===void 0)return kn;return`${K}
|
|
42
|
+
`}function vs(K){if(K.typedefs.length===0)return"";return K.typedefs.map((ee)=>{let Oe=Rn([...Di(ee.description),...kr(ee.tags)]);return`${Oe?`${Oe}
|
|
43
|
+
`:""}export ${ee.ts}`.replace(oh,"$1")}).join(`
|
|
44
44
|
|
|
45
|
-
`)}var
|
|
46
|
-
`:"",Vt=Gt.optional?"?":"";return`${Mt}${
|
|
47
|
-
`),Ot=ee.description?`${
|
|
48
|
-
`:"",{declSuffix:Ft}=
|
|
49
|
-
`));if(ee.type!==void 0)return`${Ot}export type ${ee.typeName}${Ft} = ${ee.type};`;if(ee.properties.length===0)return`${Ot}export type ${ee.typeName} = ${ee.hasUnresolvedSpread?"Record<string, any>":
|
|
45
|
+
`)}var Fa=new Map;function dh(K,ee){let Oe=Fa.get(ee);if(Oe===void 0)Oe=new RegExp(`\\b${_(ee)}\\b`),Fa.set(ee,Oe);return Oe.test(K)}var Ba,ja=[];function za(K){if(K!==Ba)Ba=K,ja=i(K,",");return ja}function fh(K){if(K===null)return[];return K[0].split(",").map((ee,Oe)=>({name:ee.trim(),constraint:(za(K[1]??"")[Oe]??ee).trim()}))}function Xa(K,ee){let Oe=fh(K).filter(({name:Ot})=>dh(ee,Ot));if(Oe.length===0)return{declSuffix:"",refSuffix:""};return{declSuffix:`<${Oe.map(({constraint:Ot})=>Ua(Ot)).join(", ")}>`,refSuffix:`<${Oe.map(({name:Ot})=>Ot).join(", ")}>`}}function Ja(K){if(!K.contexts||K.contexts.length===0)return"";return K.contexts.map((ee)=>{let Oe=ee.properties.map((Gt)=>{let Mt=Gt.description?`${Ar(Gt.description)}
|
|
46
|
+
`:"",Vt=Gt.optional?"?":"";return`${Mt}${_n(Gt.name)}${Vt}: ${Gt.type};`}).join(`
|
|
47
|
+
`),Ot=ee.description?`${Rn(Di(ee.description))}
|
|
48
|
+
`:"",{declSuffix:Ft}=Xa(K.generics,[ee.type??"",...ee.properties.map((Gt)=>Gt.type)].join(`
|
|
49
|
+
`));if(ee.type!==void 0)return`${Ot}export type ${ee.typeName}${Ft} = ${ee.type};`;if(ee.properties.length===0)return`${Ot}export type ${ee.typeName} = ${ee.hasUnresolvedSpread?"Record<string, any>":Ni};`;let jt=ee.hasUnresolvedSpread?" & Record<string, any>":"";return`${Ot}export type ${ee.typeName}${Ft} = {
|
|
50
50
|
${Oe}
|
|
51
51
|
}${jt};`}).join(`
|
|
52
52
|
|
|
53
|
-
`)}function
|
|
54
|
-
`:"",Ft=!ee.slot_props||ee.slot_props===
|
|
55
|
-
${Ot}${K}?: ${jt};`}function
|
|
56
|
-
${
|
|
57
|
-
${
|
|
58
|
-
`),Mt=
|
|
59
|
-
}`;if(K.rest_props?.type!=="Element"){let Zt;if(K.canonicalPropsType){let
|
|
53
|
+
`)}function _n(K){return Wa.test(K)?K:JSON.stringify(K)}function Va(K,ee){let Oe=Pr(ee.description,ee.tags,ee.deprecated),Ot=Oe?`${Oe}
|
|
54
|
+
`:"",Ft=!ee.slot_props||ee.slot_props===Ni?"[]":gh(ee.slot_props),jt=Ft==="[]"?"(this: void) => void":`(this: void, ...args: ${Ft}) => void`;return`
|
|
55
|
+
${Ot}${K}?: ${jt};`}function mh(K){let ee=K.props.filter((Zt)=>!Es(Zt)),Oe=new Set([...ee.map((Zt)=>Zt.name),...Array.from(K.canonicalPropNames??[])]),Ft=(K.canonicalPropsType?ee.filter((Zt)=>!K.canonicalPropNames?.has(Zt.name)):ee).map((Zt)=>{let si=typeof Zt.value==="string"?Zt.value.replace(ah," "):Zt.value,Gi=rh.test(Zt.description??"")||Zt.value===void 0||Zt.value==="undefined",Wi=Rn([...fi(Zt.description,Zt.deprecated,Zt.tags),...Zt.constant?["@constant"]:[],...Gi?[]:[`@default ${si}`]]),Ui=Zt.constant&&!Zt.isFunction?Zt.value:Zt.type||kn;return`
|
|
56
|
+
${Wi}
|
|
57
|
+
${_n(Zt.name)}${Zt.isRequired?"":"?"}: ${Ui};`});for(let Zt of K.slots)if(!Zt.default&&Zt.name!=null&&!Oe.has(Zt.name))Ft.push(Va(_n(Zt.name),Zt));let jt=K.slots.find((Zt)=>Zt.default||Zt.name===null);if(jt&&!Oe.has("children"))Ft.push(Va("children",jt));let Gt=Ft.join(`
|
|
58
|
+
`),Mt=mi(K.moduleName),Vt=K.generics?`<${za(K.generics[1]).map((Zt)=>Ua(Zt.trim())).join(", ")}>`:"",Wt=K.generics?`<${K.generics[0]}>`:"",Ht=`${K.extends===void 0?"":`Omit<${K.extends.interface}, keyof $Props${Wt}> & `}$Props${Wt}`,qt=(Zt)=>`export type ${Mt}${Vt} = ${Zt};`,zt=`{${Gt}
|
|
59
|
+
}`;if(K.rest_props?.type!=="Element"){let Zt;if(K.canonicalPropsType){let si=Gt.trim()===""?"":` & ${zt}`;Zt=[`type $Props${Vt} = ${K.canonicalPropsType}${si};`,qt(Ht)]}else if(Gt.trim()==="")Zt=[qt(K.extends?.interface??Ni)];else if(K.extends===void 0)Zt=[qt(zt)];else Zt=[`type $Props${Vt} = ${zt};`,qt(Ht)];return{props_name:Mt,prop_def:Zt.join(`
|
|
60
60
|
|
|
61
|
-
`),elementsImport:void 0}}let{name:Xt,thisValue:
|
|
62
|
-
`:"",
|
|
61
|
+
`),elementsImport:void 0}}let{name:Xt,thisValue:Yt,thisType:Jt,description:tn}=K.rest_props,sn;if(Xt!=="svelte:element")sn=Xt.split("|").map((Zt)=>`SvelteHTMLElements["${Zt.trim()}"]`).join(" & ");else if(Yt)sn=`SvelteHTMLElements["${Yt}"]`;else if(Jt)sn=`NoInfer<SvelteHTMLElements[${Jt}]>`;else sn="HTMLAttributes<HTMLElement>";let ln="[key: `data-${string}`]: unknown;",cn=tn?`${Ar(tn)}
|
|
62
|
+
`:"",un=K.canonicalPropsType?`(${K.canonicalPropsType}) & `:"",On=Jt?{name:Vt,ref:Wt}:{name:"",ref:""},zn=K.extends===void 0?`keyof $Props${Wt}`:`keyof ($Props${Wt} & ${K.extends.interface})`,Bn=`Omit<$RestProps${On.ref}, ${zn}>`,yn=Jt?`(${Jt} extends any ? ${Bn} : never)`:Bn;return{props_name:Mt,prop_def:[`${cn}type $RestProps${On.name} = ${sn};`,`type $Props${Vt} = ${un}{${Gt}
|
|
63
63
|
|
|
64
|
-
${
|
|
65
|
-
};`,qt(`${
|
|
64
|
+
${ln}
|
|
65
|
+
};`,qt(`${yn} & ${Ht}`)].join(`
|
|
66
66
|
|
|
67
|
-
`),elementsImport:sn.startsWith("HTMLAttributes")?"HTMLAttributes":"SvelteHTMLElements"}}function
|
|
68
|
-
`:""}${Gt}: ${
|
|
67
|
+
`),elementsImport:sn.startsWith("HTMLAttributes")?"HTMLAttributes":"SvelteHTMLElements"}}function gh(K){return Vs(K)?K:`[${K}]`}function yh(K){let ee=K.slots.filter((Ot)=>!Vs(Ot.slot_props??""));if(ee.length===0)return Ni;let Oe=ee.map(({name:Ot,slot_props:Ft,...jt})=>{let Gt=jt.default||Ot===null?"default":_n(Ot??""),Mt=Pr(jt.description,jt.tags,jt.deprecated);return`${Mt?`${Mt}
|
|
68
|
+
`:""}${Gt}: ${qa(Ft)};`}).join(`
|
|
69
69
|
`);return ee.length===1?`{${Oe}}`:`{
|
|
70
70
|
${Oe}
|
|
71
|
-
}`}var
|
|
72
|
-
`:""}${
|
|
71
|
+
}`}var xh=new Set(["click","dblclick","mousedown","mouseup","mousemove","mouseover","mouseout","mouseenter","mouseleave","contextmenu","wheel","keydown","keyup","keypress","submit","change","input","focus","blur","focusin","focusout","reset","select","touchstart","touchend","touchmove","touchcancel","drag","dragstart","dragend","dragover","dragenter","dragleave","drop","pointerdown","pointerup","pointermove","pointerover","pointerout","pointerenter","pointerleave","pointercancel","gotpointercapture","lostpointercapture","play","pause","ended","volumechange","timeupdate","loadeddata","loadedmetadata","canplay","canplaythrough","seeking","seeked","playing","waiting","stalled","suspend","abort","error","emptied","ratechange","durationchange","loadstart","progress","loadend","animationstart","animationend","animationiteration","animationcancel","transitionstart","transitionend","transitionrun","transitioncancel","scroll","resize","load","unload","beforeunload","cut","copy","paste","compositionstart","compositionupdate","compositionend"]);function Tr(K=kn){if(eh.test(K))return K;return`CustomEvent<${K}>`}function vh(K){switch(K.type){case"dispatched":return Tr(K.detail);case"forwarded":{let ee=K.element,Oe=ee&&th.test(ee),Ot=!Oe||xh.has(K.name);if(K.detail!==void 0&&K.detail!=="undefined"&&!(K.detail==="null"&&Ot&&!Oe))return Tr(K.detail);if(!Ot)return Tr();return`${ee==="svelte:document"?"DocumentEventMap":"WindowEventMap"}["${K.name}"]`}default:return K}}function Ga(K){if(K.events.length===0)return Zu;let ee=K.events.map((Oe)=>{let Ot=Pr(Oe.description,Oe.tags,Oe.deprecated);return`${Ot?`${Ot}
|
|
72
|
+
`:""}${_n(Oe.name)}: ${vh(Oe)};
|
|
73
73
|
`}).join("");return K.events.length===1?`{${ee}}`:`{
|
|
74
|
-
${ee}}`}function
|
|
75
|
-
${
|
|
76
|
-
${
|
|
77
|
-
`)}function
|
|
78
|
-
};`}}function
|
|
74
|
+
${ee}}`}function Eh(K){let ee=K.type==="() => any";if(K.type&&ih.test(K.type)&&!ee)return K.type;if(K.params&&K.params.length>0)return`(${y(K.params)}) => ${K.returnType||kn}`;if(K.returnType)return`() => ${K.returnType}`;return K.type||kn}function Es(K){return K.isFunctionDeclaration===!0||K.kind==="const"}function Ya(K){return K.props.filter(Es).map((ee)=>`
|
|
75
|
+
${Rn(fi(ee.description,ee.deprecated,ee.tags))}
|
|
76
|
+
${_n(ee.name)}: ${Eh(ee)};`).join(`
|
|
77
|
+
`)}function Sh(K){let ee=Ri(K.moduleName),Oe=Ya({props:K.props});if(Oe.trim()==="")return{exports_ref:ee,exports_def:`export type ${ee} = ${Ni};`};let{declSuffix:Ot,refSuffix:Ft}=Xa(K.generics,Oe);return{exports_ref:`${ee}${Ft}`,exports_def:`export type ${ee}${Ot} = {${Oe}
|
|
78
|
+
};`}}function Ch(K){let ee=K.props.filter((Oe)=>Oe.bindable===!0||Oe.binding==="writable").map((Oe)=>JSON.stringify(Oe.name));return ee.length>0?ee.join(" | "):'""'}function Qa(K){return K==="default"?"$$Component":K}function bh(K){let ee=Qa(K.moduleName);return`declare const ${ee}: Component<
|
|
79
79
|
${K.propsRef},
|
|
80
80
|
${K.exportsRef},
|
|
81
81
|
${K.bindings}
|
|
82
82
|
>;
|
|
83
|
-
export default ${ee};`}function
|
|
83
|
+
export default ${ee};`}function wh(K){let ee=Qa(K.moduleName),Oe=`${ee}Component`,Ot=K.eventsRef?`$on?<K extends keyof ${K.eventsRef} & string>(type: K, callback: (e: ${K.eventsRef}[K]) => void): () => void;`:"$on?(type: string, callback: (e: any) => void): () => void;";return`interface ${Oe} {
|
|
84
84
|
new ${K.generic}(
|
|
85
85
|
options: ComponentConstructorOptions<${K.propsRef}>
|
|
86
86
|
): SvelteComponent<${K.propsRef}${K.eventsRef?`, ${K.eventsRef}`:""}> & ${K.exportsRef};
|
|
@@ -96,94 +96,94 @@ ${ee}}`}function dh(K){let ee=K.type==="() => any";if(K.type&&Ju.test(K.type)&&!
|
|
|
96
96
|
z_$$bindings?: ${K.bindings};
|
|
97
97
|
}
|
|
98
98
|
declare const ${ee}: ${Oe};
|
|
99
|
-
export default ${ee};`}function
|
|
99
|
+
export default ${ee};`}function Th(K){if(K.extends===void 0)return"";return`import type { ${_r(K.extends.interface)} } from ${K.extends.import};`}function _r(K){let ee=K.indexOf("<");return(ee===-1?K:K.slice(0,ee)).trim()}function kh(K){if(!K.componentComment)return"";if(!nh.test(K.componentComment))return Ha(K.componentComment.trim());return`/*${O(K.componentComment).split(`
|
|
100
100
|
`).map((ee)=>`* ${ee}`).join(`
|
|
101
101
|
`)}
|
|
102
|
-
*/`}function
|
|
103
|
-
export ${Kt} from ${JSON.stringify(Ft)};`);continue}let Vt=`${Ft}\x00${Gt}`,Wt=Oe.get(Vt);if(!Wt)Wt={comment:Gt,from:Ft,specifiers:[]},Oe.set(Vt,Wt),ee.push(Vt);Wt.specifiers.push(jt===Ot.name?Mt:`${
|
|
102
|
+
*/`}function Ah(K){let ee=[],Oe=new Map;for(let Ot of K.moduleExports){if(Ot.kind!=="re-export"||!Ot.reExport)continue;let{from:Ft,imported:jt}=Ot.reExport,Gt=Rn(fi(Ot.description,Ot.deprecated,Ot.tags)),Mt=_n(Ot.name);if(jt==="*"){let Kt=Ot.name==="*"?"*":`* as ${Mt}`;ee.push(`${Gt}
|
|
103
|
+
export ${Kt} from ${JSON.stringify(Ft)};`);continue}let Vt=`${Ft}\x00${Gt}`,Wt=Oe.get(Vt);if(!Wt)Wt={comment:Gt,from:Ft,specifiers:[]},Oe.set(Vt,Wt),ee.push(Vt);Wt.specifiers.push(jt===Ot.name?Mt:`${_n(jt)} as ${Mt}`)}return ee.map((Ot)=>{let Ft=Oe.get(Ot);if(!Ft)return Ot;return`${Ft.comment}
|
|
104
104
|
export { ${Ft.specifiers.join(", ")} } from ${JSON.stringify(Ft.from)};`}).join(`
|
|
105
105
|
|
|
106
|
-
`)}function
|
|
106
|
+
`)}function $r(K){let ee=[K.static?"static ":"",K.abstract?"abstract ":"",K.readonly?"readonly ":""].join(""),Oe=K.optional?"?":"";if(K.kind==="property")return`${ee}${_n(K.name)}${Oe}: ${K.type??kn}`;if(K.kind==="index")return`${ee}${K.name}: ${K.type??kn}`;let Ot=y(K.params??[]);if(K.kind==="constructor")return`constructor(${Ot})`;let Ft=K.typeParameters?`<${K.typeParameters}>`:"";return`${ee}${_n(K.name)}${Oe}${Ft}(${Ot}): ${K.returnType??kn}`}function Ph(K,ee){let Oe=K.localName??K.name,Ot=Oe!==K.name,Ft=`export { ${Oe}${Ot?` as ${_n(K.name)}`:""} };`;if(ee.has(Oe))return Ft;ee.add(Oe);let jt=K.typeParameters?`<${K.typeParameters}>`:"",Gt=(K.members??[]).map((Kt)=>[Rn(fi(Kt.description,Kt.deprecated,Kt.tags)),`${$r(Kt)};`].filter(Boolean).join(`
|
|
107
107
|
`)).join(`
|
|
108
108
|
|
|
109
109
|
`),Mt=`${K.extends?` extends ${K.extends}`:""}${K.implements?.length?` implements ${K.implements.join(", ")}`:""}`,Vt=`${Ot?"":"export "}declare ${K.abstract?"abstract ":""}class ${Oe}${jt}${Mt}`;return`
|
|
110
|
-
${[
|
|
110
|
+
${[Rn(fi(K.description,K.deprecated,K.tags)),Gt?`${Vt} {
|
|
111
111
|
${Gt}
|
|
112
112
|
}`:`${Vt} {}`,Ot?Ft:""].filter(Boolean).join(`
|
|
113
|
-
`)}`}function
|
|
114
|
-
`;else if(Gt.kind==="let")Mt=`export declare let ${Gt.name}: ${Gt.type||kn};`;else if(Gt.params&&Gt.params.length>0)Mt=`export declare function ${Gt.name}${Wt}(${y(Gt.params)}): ${Gt.returnType||kn};`;else if(Gt.returnType)Mt=`export declare function ${Gt.name}${Wt}(): ${Gt.returnType};`;else if(Gt.type&&Vt!==-1){let Kt=Gt.type.slice(0,Vt).trimEnd(),Ht=Gt.type.slice(Vt+2).trim();Mt=`export declare function ${Gt.name}${Kt}: ${Ht};`}else Mt=`export declare let ${Gt.name}: ${Gt.type||kn};`;if(jt)Mt=`${Mt.replace(
|
|
113
|
+
`)}`}function _h(K){let ee=Ah(K),Oe=new Set,Ot=K.moduleExports.filter((Ft)=>Ft.kind!=="re-export").map((Ft)=>{if(Ft.kind==="class")return Ph(Ft,Oe);let jt=!Wa.test(Ft.name),Gt=jt?{...Ft,name:$h(Ft.name)}:Ft,Mt,Vt=Gt.type&&sh.test(Gt.type)?v(Gt.type):-1,Wt=Gt.typeParameters?`<${Gt.typeParameters}>`:"";if(Gt.kind==="const"&&Vt===-1)Mt=`export declare const ${Gt.name}: ${Gt.type||kn};
|
|
114
|
+
`;else if(Gt.kind==="let")Mt=`export declare let ${Gt.name}: ${Gt.type||kn};`;else if(Gt.params&&Gt.params.length>0)Mt=`export declare function ${Gt.name}${Wt}(${y(Gt.params)}): ${Gt.returnType||kn};`;else if(Gt.returnType)Mt=`export declare function ${Gt.name}${Wt}(): ${Gt.returnType};`;else if(Gt.type&&Vt!==-1){let Kt=Gt.type.slice(0,Vt).trimEnd(),Ht=Gt.type.slice(Vt+2).trim();Mt=`export declare function ${Gt.name}${Kt}: ${Ht};`}else Mt=`export declare let ${Gt.name}: ${Gt.type||kn};`;if(jt)Mt=`${Mt.replace(uh,"").trimEnd()}
|
|
115
115
|
export { ${Gt.name} as ${JSON.stringify(Ft.name)} };`;return`
|
|
116
|
-
${
|
|
116
|
+
${Rn(fi(Gt.description,Gt.deprecated,Gt.tags))}
|
|
117
117
|
${Mt}`}).join(`
|
|
118
118
|
`);return[ee,Ot].filter(Boolean).join(`
|
|
119
119
|
|
|
120
|
-
`)}function
|
|
121
|
-
`))){let Ft=`${Oe}${Ot.join(", ")}> {}`;if(Ft.length<=
|
|
120
|
+
`)}function $h(K){return`__export_${K.replace(hh,"_")}`}var Nh=120;function Dh(K){let Oe=`export default class ${K.moduleName==="default"?"":K.moduleName}${K.generic} extends SvelteComponentTyped<`,Ot=[K.genericProps,K.events,K.slots];if(K.accessors.trim()===""&&Ot.every((Ft)=>!Ft.includes(`
|
|
121
|
+
`))){let Ft=`${Oe}${Ot.join(", ")}> {}`;if(Ft.length<=Nh)return Ft}return`${Oe}
|
|
122
122
|
${K.genericProps},
|
|
123
123
|
${K.events},
|
|
124
124
|
${K.slots}
|
|
125
125
|
> {
|
|
126
126
|
${K.accessors}
|
|
127
|
-
}`}function
|
|
128
|
-
`),
|
|
127
|
+
}`}function mi(K){return`${K}Props`}function Ri(K){return`${K}Exports`}function Nr(K){return{format:K.format}}var Rh={format:"class"};function Za(K){let ee=Nr(K??{}),Oe={};for(let[Ot,Ft]of Object.entries(ee))Oe[Ot]=Ft??Rh[Ot];return JSON.stringify(Oe)}function Dr(K,ee){let Oe=mo(K),{moduleName:Ot,typedefs:Ft,generics:jt,props:Gt,moduleExports:Mt,slots:Vt,events:Wt,rest_props:Kt,extends:Ht,componentComment:qt,contexts:zt}=K,Xt=ee?.format==="component",Yt=jt!==null,{props_name:Jt,prop_def:tn,elementsImport:sn}=mh({moduleName:Ot,props:Gt,rest_props:Kt,extends:Ht,generics:jt,slots:Vt,canonicalPropNames:new Set(Oe?.canonicalPropNames??[]),canonicalPropsType:Oe?.canonicalPropsType}),ln=jt?`<${jt[1]}>`:"",cn=jt?`${Jt}<${jt[0]}>`:Jt,un=Xt&&Wt.length>0?`type $Events${ln} = ${Ga({events:Wt})};`:"",On=jt?`$Events<${jt[0]}>`:"$Events",zn=Xt&&(Yt||un!==""),Bn=_h({moduleExports:Mt}),yn=vs({typedefs:Ft}),Zt=Ja({contexts:zt,generics:jt}),si=(Oe?.typeImportStatements??[]).join(`
|
|
128
|
+
`),Gi=[...Oe?.localTypeDeclarations??[],...Oe?.moduleTypeDeclarations??[]].join(`
|
|
129
129
|
|
|
130
|
-
`),{exports_ref:
|
|
131
|
-
`),
|
|
132
|
-
`)].map((
|
|
130
|
+
`),{exports_ref:Wi,exports_def:Ui}=Xt?Sh({props:Gt,moduleName:Ot,generics:jt}):{exports_ref:"",exports_def:""},ho=Xt?Ch({props:Gt}):"",Os=!ch.test(si)&&[tn,Bn,yn,Zt,Gi,Ui].some((Ls)=>ph.test(Ls)),Cc=[Xt?zn?`import type { SvelteComponent, ComponentConstructorOptions, ComponentInternals${Os?", Snippet":""} } from "svelte";`:`import type { Component${Os?", Snippet":""} } from "svelte";`:`import { SvelteComponentTyped${Os?", type Snippet":""} } from "svelte";`,sn?`import type { ${sn} } from "svelte/elements";`:"",si,Th({extends:Ht})].filter(Boolean).join(`
|
|
131
|
+
`),bc=Xt?zn?wh({moduleName:Ot,generic:ln,propsRef:cn,exportsRef:Wi,bindings:ho,...un?{eventsRef:On}:{}}):bh({moduleName:Ot,propsRef:cn,exportsRef:Wi,bindings:ho}):Dh({moduleName:Ot,generic:ln,genericProps:cn,events:Ga({events:Wt}),slots:yh({slots:Vt}),accessors:Ya({props:Gt})}),wc=[Bn,yn,Gi,Zt,tn,Ui,un,[kh({componentComment:qt}),bc].filter(Boolean).join(`
|
|
132
|
+
`)].map((Ls)=>Ls.trim()).filter(Boolean).join(`
|
|
133
133
|
|
|
134
|
-
`);return
|
|
134
|
+
`);return Ma([Cc,wc].filter(Boolean).join(`
|
|
135
135
|
|
|
136
|
-
`))}var $h=[...ls,".svelte"];function Ah(K){let ee=K.trim();if(ee.length<2)return;let Oe=ee[0],Ot=ee[ee.length-1];if((Oe==='"'||Oe==="'"||Oe==="`")&&Oe===Ot)return ee.slice(1,-1);return}function Xa(K){let ee=[],Oe=K.moduleExports.filter((Ft)=>Ft.kind==="re-export");if(Oe.length===0)return ee;let Ot=new Set([ds(K.moduleName),Ds(K.moduleName)]);for(let Ft of Oe){if(!Ot.has(Ft.name))continue;ee.push(a({component:K.filePath,kind:"module-export-conflict",name:Ft.name,message:`Re-export "${Ft.name}" has the same name as the generated "${Ft.name}" type; the .d.ts won't type-check if "${Ft.reExport?.from}" exports a type by that name.`,source:Ft.source}))}return ee}function Ja(K,ee,Oe){let Ot=new Map(Array.from(K.values()).map((Ft)=>[ee(Ft.filePath),Ft]));return(Ft)=>{let jt=Ft.extends;if(!jt)return[];let Gt=Ah(jt.import);if(Gt===void 0||!Gt.startsWith(".")&&!Gt.startsWith("/"))return[];let Mt=ee(Ft.filePath),Vt=Oe.resolve(Gt,Ph(Mt),$h);if(Vt===null)return[a({component:Ft.filePath,kind:"extend-props-target-missing",name:jt.interface,message:`@extends/@extendProps target "${Gt}" was not found on disk.`})];let Wt=Ot.get(Vt);if(!Wt)return[];let Kt=ds(Wt.moduleName);if(jt.interface!==Kt)return[a({component:Ft.filePath,kind:"extend-props-target-missing",name:jt.interface,message:`@extends/@extendProps names "${jt.interface}", but "${Gt}" generates "${Kt}".`})];let Ht=[];for(let qt of Ft.props){let zt=Wt.props.find((Xt)=>Xt.name===qt.name);if(zt&&zt.type!==qt.type){let Xt=a({component:Ft.filePath,kind:"extend-props-override",name:qt.name,message:`Own prop "${qt.name}" (${qt.type}) overrides "${Kt}"'s "${qt.name}" (${zt.type}).`}),Jt=lo(Ft)?.[qt.name]?.some((tn)=>tn===""||tn===Xt.code);Ht.push(Jt?{...Xt,ignored:!0}:Xt)}}return Ht}}import{lstatSync as Jh,readFileSync as Yh,realpathSync as Qh,statSync as Zh}from"node:fs";import{dirname as ed,isAbsolute as td,join as fp,parse as nd,relative as jr,resolve as Rs}from"node:path";function Z(K){return K}function _n(K){if(K==="")return K;return K==="."||K===".."||K.startsWith("./")||K.startsWith("../")?K:`./${K}`}import{readFileSync as hp}from"node:fs";import{dirname as Mr,join as zh,relative as cp,resolve as lp}from"node:path";import{readFileSync as jh,statSync as Bh}from"node:fs";import{basename as Or,dirname as xi,isAbsolute as Vh,join as Gh,resolve as Wh}from"node:path";import{existsSync as Za,readdirSync as Nh}from"node:fs";import{dirname as Ya,join as ep,resolve as Dh}from"node:path";function q(K,ee){for(let Oe=Dh(K);;Oe=Ya(Oe)){for(let Ot of ee){let Ft=ep(Oe,Ot);if(Za(Ft))return Ft}if(Ya(Oe)===Oe)return null}}function Qa(K){return K.normalize("NFC").toLowerCase()}class Nr{listings=new Map;clear(){this.listings.clear()}entries(K){return this.read(K)?.entries??null}entry(K,ee){let Oe=this.read(K);if(Oe===null)return;if(Oe.byName===void 0){Oe.byName=new Map;for(let Ot of Oe.entries)Oe.byName.set(Ot.name,Ot)}return Oe.byName.get(ee)}has(K,ee){let Oe=this.read(K);if(Oe===null)return!1;if(Oe.names.has(ee))return!0;if(Oe.folded===void 0){Oe.folded=new Map;for(let Ft of Oe.names)Oe.folded.set(Qa(Ft),Ft)}let Ot=Oe.folded.get(Qa(ee));return Ot!==void 0&&Ot!==ee&&Za(ep(K,ee))}read(K){let ee=this.listings.get(K);if(ee!==void 0)return ee;try{let Oe=Nh(K,{withFileTypes:!0}),Ot=new Set;for(let Ft of Oe)Ot.add(Ft.name);ee={entries:Oe,names:Ot}}catch{ee=null}return this.listings.set(K,ee),ee}}var Dr=!1;function F(K){Dr=K}function Mn(K){if(!Dr)console.error(K)}function tp(K){if(!Dr)console.error(K)}function xe(K){if(K instanceof e)return K.start?`${K.reason} (${K.start.line}:${K.start.column})`:K.reason;return K instanceof Error?K.message:String(K)}var _s=null,_r=null;function Wn(){if(_s)return Promise.resolve(_s);if(!_r)_r=import("./chunk-60yq13dk.js").then((K)=>(_s=K,K));return _r}function $n(){if(!_s)throw Error("sveld: internal error, parser stack read before loadParserStack() resolved.");return _s}import{existsSync as Rr,readFileSync as _h}from"node:fs";import{dirname as op,isAbsolute as ap,relative as Rh,resolve as Ir}from"node:path";function np(K){if(!r(K))return{};let ee={};if(typeof K.svelte==="string")ee.svelte=K.svelte;if(typeof K.name==="string")ee.name=K.name;if(typeof K.description==="string")ee.description=K.description;return ee}function sp(K){if(!r(K))return{};let ee={};if(typeof K.extends==="string")ee.extends=K.extends;if(r(K.compilerOptions)){let Oe={};if(typeof K.compilerOptions.baseUrl==="string")Oe.baseUrl=K.compilerOptions.baseUrl;if(r(K.compilerOptions.paths)){let Ot={};for(let[Ft,jt]of Object.entries(K.compilerOptions.paths))if(Array.isArray(jt)&&jt.every((Gt)=>typeof Gt==="string"))Ot[Ft]=jt;if(Object.keys(Ot).length>0)Oe.paths=Ot}if(Object.keys(Oe).length>0)ee.compilerOptions=Oe}return ee}var Ih=["tsconfig.json","jsconfig.json"],ip=new Map,Lh=/\/\*[\s\S]*?\*\/|\/\/.*/g,Oh=[".svelte",...ls];class V extends Error{specifier;fromFile;searched;constructor(K,ee,Oe){super(`cannot resolve "${K}" from ${ee||"."} (${Oe})`);this.name="UnresolvedModuleError",this.specifier=K,this.fromFile=ee,this.searched=Oe}}function Mh(K){if(Rr(K))return!0;return Oh.some((ee)=>Rr(K+ee))}function rp(K){let ee=K.indexOf("*");return ee===-1?K.length:ee}function pp(K,ee){if(ee.has(K))return ee.get(K)??null;try{let Oe=_h(K,"utf-8"),Ot;try{Ot=JSON.parse(Oe)}catch{let jt=Oe.replace(Lh,"");Ot=JSON.parse(jt)}let Ft=sp(Ot);if(Ft.extends){let jt=ap(Ft.extends)?Ft.extends:Ir(op(K),Ft.extends),Gt=jt.endsWith(".json")?jt:`${jt}.json`;if(Rr(Gt)){let Mt=pp(Gt,ee);if(Mt)Ft.compilerOptions={...Mt.compilerOptions,...Ft.compilerOptions,paths:{...Mt.compilerOptions?.paths,...Ft.compilerOptions?.paths}}}}return ee.set(K,Ft),Ft}catch{return ee.set(K,null),null}}function Fh(K){let ee=ip.get(K);if(!ee){let Oe=K.split("*").map(_).join("(.*)");ee=new RegExp(`^${Oe}$`),ip.set(K,ee)}return ee}class Lr{configs=new Map;lookup(K,ee){if(K.startsWith(".")||ap(K))return{resolved:K,unresolved:!1,searched:""};let Oe=q(ee,Ih),Ot=Oe?pp(Oe,this.configs)?.compilerOptions:void 0,Ft=Ot?.paths;if(!Oe||!Ot||!Ft)return{resolved:K,unresolved:!0,searched:"no tsconfig/jsconfig paths found"};let jt=Ir(op(Oe),Ot.baseUrl??"."),Gt=Object.entries(Ft).sort(([Mt],[Vt])=>rp(Vt)-rp(Mt));for(let[Mt,Vt]of Gt){let Wt=K.match(Fh(Mt));if(!Wt)continue;let Kt;for(let Ht of Vt){let qt=Ht;for(let Xt=1;Xt<Wt.length;Xt++)qt=qt.replace("*",Wt[Xt]);let zt=Ir(jt,qt);if(Kt??=zt,Mh(zt))return{resolved:zt,unresolved:!1,searched:Oe}}return{resolved:Kt??K,unresolved:!1,searched:Oe}}return{resolved:K,unresolved:!0,searched:`tsconfig paths (${Oe})`}}absolute(K,ee){return this.lookup(K,ee).resolved}relative(K,ee){let Oe=this.absolute(K,ee);if(Oe===K)return K;return _n(n(Rh(ee,Oe)))}}var Uh=/\.[mc]?jsx?$/,Kh={".js":[".ts",".tsx",".d.ts"],".jsx":[".tsx",".d.ts"],".mjs":[".mts",".d.mts"],".cjs":[".cts",".d.cts"]};function Hh(K){return K==="."||K===".."||K.startsWith("./")||K.startsWith("../")||Vh(K)}class Un{aliases=new Lr;listings=new Nr;modules=new Map;programs=new Map;listDirectory(K){return this.listings.entries(K)}exists(K){return this.listings.has(xi(K),Or(K))}resolve(K,ee,Oe=ls){let Ot=this.aliases.absolute(K,ee);if(Ot===K&&!Hh(K))return null;let Ft=Wh(ee,Ot),jt=xi(Ft),Gt=Or(Ft),Mt=this.listings.has(jt,Gt),Vt;if(Mt){let Wt=this.listings.entry(jt,Gt);if(Vt=Wt&&!Wt.isSymbolicLink()?Wt:Bh(Ft,{throwIfNoEntry:!1}),Vt?.isFile())return Ft}for(let Wt of Oe)if(this.listings.has(jt,Gt+Wt))return Ft+Wt;if(!Mt)return this.typeScriptCounterpart(Ft)??null;if(Vt?.isDirectory()){for(let Wt of Oe)if(this.listings.has(Ft,`index${Wt}`))return Gh(Ft,`index${Wt}`)}return null}parse(K){let ee=this.modules.get(K);if(ee===void 0)ee=qh(K),this.modules.set(K,ee);return ee}parseJavaScript(K,ee){let Oe=this.programs.get(K);if(Oe?.source===ee)return Oe.ast;let Ot;try{Ot=me(ee)}catch(Ft){throw Error(xe(Ft))}return this.programs.set(K,{source:ee,ast:Ot}),Ot}invalidate(...K){this.listings.clear();for(let ee of K)this.modules.delete(ee),this.programs.delete(ee)}typeScriptCounterpart(K){let ee=Uh.exec(K)?.[0];if(ee===void 0)return;let Oe=K.slice(0,-ee.length),Ot=xi(Oe),Ft=Or(Oe);for(let jt of Kh[ee]??[])if(this.listings.has(Ot,Ft+jt))return Oe+jt;return}}function qh(K){let ee;try{ee=jh(K,"utf-8")}catch{return null}try{let Oe=K.endsWith(".svelte")?$n().parseSvelteScripts(ee).module?.content.body??[]:$n().parseModule(ee,{typescript:!0}).body;return{source:{text:ee,filePath:K,dir:xi(K)},body:Oe}}catch(Oe){return tp(`Warning: sveld couldn't parse ${K} to read its exports (${xe(Oe)}); skipping it.`),null}}function up(K){return K.type==="Identifier"?K.name:K.value}function Xh(K,ee,Oe,Ot){let Ft=K.resolve(ee,Oe);if(!Ft)return null;let jt=Mr(Ft);if(Ot.has(Ft))return{dir:jt,exports:{}};Ot.add(Ft);try{return{dir:jt,exports:Fr(K,hp(Ft,"utf-8"),jt,Ot,Ft)}}catch{return{dir:jt,exports:{}}}finally{Ot.delete(Ft)}}function dp(K,ee,Oe=new Un,Ot=new Set,Ft=ee){return Fr(Oe,K,ee,Ot,Ft)}function Fr(K,ee,Oe,Ot,Ft){let jt=K.parseJavaScript(Ft,ee),Gt={};for(let Mt of jt.body)if(Mt.type==="ExportDefaultDeclaration"){if(Mt.declaration.type!=="Identifier")continue;let Vt=Mt.declaration.name;if(Vt in Gt)Gt[Vt].default=!0;else Gt[Vt]={source:_n(""),default:!0}}else if(Mt.type==="ExportAllDeclaration"){let Vt=Mt.source.value,Wt=K.resolve(Vt,Oe);if(!Wt){let qt=K.aliases.lookup(Vt,Oe);throw new V(Vt,Ft,qt.unresolved?qt.searched:"no matching file or index found")}if(Ot.has(Wt))continue;Ot.add(Wt);let Kt=hp(Wt,"utf-8"),Ht=Fr(K,Kt,Mr(Wt),Ot,Wt);Ot.delete(Wt);for(let[qt,zt]of Object.entries(Ht)){let Xt=_n(n(zt.source.startsWith(".")?`./${cp(Oe,lp(Mr(Wt),zt.source))}`:`./${zh(Vt,zt.source)}`));Gt[qt]={...zt,source:Xt}}}else if(Mt.type==="ExportNamedDeclaration"){let Vt=Mt.source?.value,Wt=Vt!==void 0&&Nn.test(Vt);if(Wt){let qt=K.aliases.lookup(Vt,Oe);if(qt.unresolved)throw new V(Vt,Ft,qt.searched)}let Ht=Vt!==void 0&&!Wt?Xh(K,Vt,Oe,Ot):void 0;if(Ht===null){console.warn(`sveld: could not resolve re-exported module "${Vt}" from barrel "${Oe||"."}"; skipping.`);continue}for(let qt of Mt.specifiers){let zt=up(qt.exported),Xt=up(qt.local),Qt=zt||Xt,Jt=Ht?.exports[Xt],tn=Jt?_n(n(`./${cp(Oe,lp(Ht.dir,Jt.source))}`)):_n(K.aliases.relative(Vt??"",Oe)),sn=Jt?Jt.default:Xt==="default";if(Qt in Gt){if(Gt[Qt].mixed=!0,!Gt[Qt].source)Gt[Qt].source=tn}else Gt[Qt]={source:tn,default:sn}}}else if(Mt.type==="ImportDeclaration"){let Vt=Mt.specifiers[0];if(!Vt)continue;let Wt=Vt.local.name,Kt=_n(K.aliases.relative(Mt.source.value,Oe));if(Wt in Gt){if(!Gt[Wt].source)Gt[Wt].source=Kt}else Gt[Wt]={source:Kt,default:Wt==="default"}}return Gt}var sd=/-/g,id=/[^A-Za-z0-9_$]/g,rd=/^[0-9]/;function od(K,ee){let Oe=K.replace(id,""),Ot=rd.test(Oe)?`_${Oe}`:Oe;if(Ot!==K&&!ee?.has(K))ee?.add(K),console.warn(`Warning: "${K}" is not a valid identifier; using "${Ot}" instead.`);return Ot}function mp(K,ee){return od(nd(K).name.replace(sd,""),ee)}function gp(K,ee,Oe=[],Ot=new Set,Ft){let jt;try{jt=Ft??Qh(ee)}catch{return Oe}if(Ot.has(jt))return Oe;Ot.add(jt);let Gt=K.listDirectory(ee);if(Gt===null)return Oe;for(let Mt of Gt){if(Mt.name.startsWith("."))continue;let Vt=fp(ee,Mt.name),Wt=Mt.isSymbolicLink(),Kt=Wt?Zh(Vt,{throwIfNoEntry:!1}):Mt;if(!Kt)continue;if(Kt.isDirectory())gp(K,Vt,Oe,Ot,Wt?void 0:fp(jt,Mt.name));else if(Kt.isFile()&&Mt.name.endsWith(".svelte"))Oe.push(Vt)}return Oe}function ad(K,ee){return gp(K,ee).map((Oe)=>({moduleName:mp(Oe),source:_n(n(`./${jr(ee,Oe)}`))})).sort((Oe,Ot)=>l(Oe.source,Ot.source))}function pd(K){return!us(K)}function cd(K,ee){let Oe=K.endsWith("/")?K:`${K}/`;return ee.startsWith(Oe)}function vi(K,ee){return{seenPaths:new Set(K.map(([,Oe])=>ee(Oe.source))),seenModuleNamePaths:new Map(K.map(([Oe,Ot])=>[Oe,ee(Ot.source)])),warnedModuleNames:new Set}}function Br(K,ee,Oe,Ot,Ft,jt){for(let{moduleName:Gt,source:Mt}of ad(K,ee)){let Vt=Ft(Mt),Wt=Oe[Gt];if(Wt&&pd(Wt.source)&&cd(Wt.source,Mt)){jt.seenPaths.delete(Ft(Wt.source)),Wt.source=Mt,jt.seenPaths.add(Vt),jt.seenModuleNamePaths.set(Gt,Vt);continue}if(jt.seenPaths.has(Vt))continue;jt.seenPaths.add(Vt);let Kt=jt.seenModuleNamePaths.get(Gt);if(Kt===void 0)jt.seenModuleNamePaths.set(Gt,Vt);else if(Kt!==Vt&&!jt.warnedModuleNames.has(Gt))jt.warnedModuleNames.add(Gt),console.warn(`Warning: multiple components named "${Gt}" found (${n(jr(ee,Kt))} and ${n(jr(ee,Vt))}). Both are included in TypeScript definitions, but only one can be the named export.`);Ot.push([Gt,{source:Mt,default:!1}])}}function Vr(K,ee,Oe,Ot){let Ft=Jh(K).isFile(),jt=Ft?ed(K):K,Gt=Rs(jt),Mt=new Map,Vt=(Ht)=>{let qt=Mt.get(Ht);if(qt===void 0)qt=td(Ht)?Rs(Ht):Rs(Gt,Ht),Mt.set(Ht,qt);return qt},Wt={};if(Ft){let Ht=Yh(K,"utf-8");try{Wt=dp(Ht,Gt,Ot,new Set([Rs(K)]),Rs(K))}catch(qt){if(!Oe)throw qt;let zt=qt instanceof Error?qt.message:String(qt);console.warn(`Warning: Failed to parse component exports from ${K}: ${zt}`)}}let Kt=Object.entries(Wt);if(ee){let Ht=vi(Kt,Vt);if(Br(Ot,Gt,Wt,Kt,Vt,Ht),!Ft)Wt=Object.fromEntries(Kt.map(([qt,zt])=>[qt,{...zt,default:!0}]))}return{exports:Wt,allComponentEntries:Kt,rootDir:Gt,resolveComponentFilePath:Vt}}function yp(K,ee,Oe,Ot){if(Oe!==1||K!=="default")return K;return mp(ee,Ot)}import{dirname as Ud}from"node:path";import{resolve as ld}from"node:path";var ud=/\r?\n/,hd=/^\s*\*+/;function Ei(K){return{graph:K,cache:new Map,computing:new Set}}function mn(K){return K?.type==="Identifier"?K.name:void 0}function dd(K){let ee=K.trimEnd();for(;;){let Oe=ee.lastIndexOf(`
|
|
137
|
-
`)+1;if(ee.slice(Oe).trimStart().startsWith("//")){ee=ee.slice(0,Oe).trimEnd();continue}let Ot=ee.endsWith("*/")?ee.lastIndexOf("/*",ee.length-3):-1;if(Ot!==-1&&ee[Ot+2]!=="*"){ee=ee.slice(0,Ot).trimEnd();continue}return ee}}function fd(K,ee){let Oe=dd(K.slice(0,ee));if(!Oe.endsWith("*/"))return;let Ot=Oe.length-2,Ft=Oe.lastIndexOf("/**",Ot);if(Ft===-1)return;return Oe.slice(Ft,Ot+2)}function md(K){let ee=[];for(let Oe of K.slice(3,-2).split(ud)){let Ot=Oe.replace(hd,"").trim();if(Ot.startsWith("@"))break;if(Ot)ee.push(Ot)}return ee.join(" ")||void 0}function Zn(K,ee){if(!ee)return;return K.text.slice(ee.start,ee.end)}function gd(K,ee){return"typeAnnotation"in ee?Zn(K,ee.typeAnnotation?.typeAnnotation):void 0}function vp(K,ee){return Zn(K,ee.returnType?.typeAnnotation)}function Gr(K,ee,Oe){return`(${ee.params.map((Ft)=>Zn(K,Ft)??"").join(", ")}) => ${vp(K,ee)??Oe??"any"}`}function Ep(K){if(K.type==="Literal"){let ee=K.value;if(typeof ee==="string")return"string";if(typeof ee==="number")return"number";if(typeof ee==="boolean")return"boolean"}if(K.type==="TemplateLiteral")return"string";if(K.type==="UnaryExpression"&&(K.operator==="-"||K.operator==="+"))return K.argument.type==="Literal"&&typeof K.argument.value==="number"?"number":void 0;if(K.type==="CallExpression"&&K.callee.type==="Identifier")return yd[K.callee.name];return}var yd={String:"string",Number:"number",Boolean:"boolean"};function Sp(K){if(K.type==="Literal"){let ee=K.value;return typeof ee==="string"||typeof ee==="number"||typeof ee==="boolean"?ee:void 0}if(K.type==="UnaryExpression"&&K.operator==="-"){let ee=K.argument;return ee.type==="Literal"&&typeof ee.value==="number"?-ee.value:void 0}return K.type==="TemplateLiteral"?w(K)??void 0:void 0}function xd(K,ee){let Oe=Zn(K,ee),Ot=Sp(ee);if(Oe===void 0||Ot===void 0)return;return{raw:Oe,value:Ot,type:typeof Ot}}function vd(K,ee){if(K.type!=="CallExpression"&&K.type!=="NewExpression")return;let Oe=K.callee;if(!(mn(Oe)==="Symbol"||Oe.type==="MemberExpression"&&!Oe.computed&&mn(Oe.object)==="Symbol"&&mn(Oe.property)==="for"))return;let[Ft]=K.arguments;return(Ft?.type==="Literal"&&typeof Ft.value!=="string"?null:w(Ft))||ee}var Ed=new Set(["any","bigint","boolean","false","never","null","number","object","readonly","string","symbol","true","undefined","unknown","void"]),Sd=/"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'/g,bd=/(?<![\w$.])[A-Za-z_$][\w$]*(?![\w$]|\s*\??:)/g;function Cd(K,ee){let Oe=ee?$n().extractJsDocType(ee):void 0,Ot=K?{type:K,source:"typescript"}:Oe?{type:Oe,source:"jsdoc"}:void 0;if(!Ot||Ot.type.includes("`"))return;return(Ot.type.replace(Sd,'""').match(bd)??[]).every((jt)=>Ed.has(jt))?Ot:void 0}function bp(K){if(K.async||K.generator||K.type==="TSDeclareFunction")return;let ee=K.body,Oe=ee.type==="BlockStatement"?Y(ee):[ee];if(Oe.length===0)return;let Ot;for(let Ft of Oe){if(!Ft)return;let jt=Ep(Ft);if(!jt)return;if(Ot===void 0)Ot=jt;else if(Ot!==jt)return}return Ot}function wd(K){if(K.type==="TemplateLiteral")return;let ee=Sp(K);return typeof ee==="boolean"?void 0:ee}function kd(K){let ee=K.members;if(ee.length===0)return;let Oe=[],Ot=0;for(let Ft of ee){if(!Ft.initializer){Oe.push(String(Ot)),Ot+=1;continue}let jt=wd(Ft.initializer);if(jt===void 0)return;Oe.push(typeof jt==="string"?JSON.stringify(jt):String(jt)),Ot=typeof jt==="number"?jt+1:Ot}return Oe.join(" | ")}function Wr(K,ee,Oe,Ot){let Ft=fd(K.text,Oe),jt=Ft?md(Ft):void 0,Gt=Ft?$n().extractJsDocReturnType(Ft):void 0,{deprecated:Mt,tags:Vt,internal:Wt}=Ft?$n().extractJsDocDeprecatedAndTags(Ft):{deprecated:void 0,tags:void 0,internal:!1},Kt={description:jt,deprecated:Mt,tags:Vt,...Wt?{internal:!0}:{},declFile:K.filePath},Ht=(zt,Xt,Qt=!1)=>zt?[{name:zt,...Xt,...Kt,isTypeOnly:Qt}]:[],qt=(zt,Xt)=>vp(K,zt)??Gt??re(Xt)??bp(zt);if(ee.type==="VariableDeclaration"){let zt=ee.kind==="let"||ee.kind==="var"?ee.kind:"const";return ee.declarations.flatMap((Xt)=>{let Qt=Xt.id,Jt=mn(Qt);if(!Jt)return[];let tn=gd(K,Qt),sn=tn,cn,pn,ln,In,qn,Fn,gn=Xt.init;if(gn)if(gn.type==="ArrowFunctionExpression"||gn.type==="FunctionExpression"){if(Fn=gn,pn=qt(gn,sn),!sn)sn=Gr(K,gn,pn)}else{if(cn=Zn(K,gn),!sn)sn=Ep(gn);let Zt=b(gn);if(ln=w(Zt)??vd(Zt,Jt),zt==="const")In=xd(K,Zt),qn=Cd(tn,Ft)}return Ht(Jt,{kind:zt,type:sn,value:cn,returnType:pn,literalValue:ln,primitiveLiteral:In,declaredType:qn,functionNode:Fn})})}if(ee.type==="FunctionDeclaration"||ee.type==="TSDeclareFunction"){let zt=qt(ee);return Ht(mn(ee.id)??Ot,{kind:"function",type:Gr(K,ee,zt),returnType:zt,...ee.type==="FunctionDeclaration"?{functionNode:ee}:{}})}if(ee.type==="ClassDeclaration"){let zt=mn(ee.id);return Ht(zt??Ot,{kind:"class",...zt?{type:zt}:{}})}if(ee.type==="TSTypeAliasDeclaration")return Ht(mn(ee.id),{kind:"type",type:Zn(K,ee.typeAnnotation)},!0);if(ee.type==="TSInterfaceDeclaration")return Ht(mn(ee.id),{kind:"interface",type:Zn(K,ee.body)},!0);if(ee.type==="TSEnumDeclaration"){let zt=mn(ee.id);return Ht(zt,{kind:"enum",type:kd(ee)??zt})}return[]}function Td(K,ee,Oe){let Ot=ee.declaration;if(Ot.type==="FunctionDeclaration"||Ot.type==="TSDeclareFunction"||Ot.type==="ClassDeclaration"){let[Gt]=Wr(K,Ot,ee.start,"default");return Gt?{...Gt,name:"default"}:void 0}if(Ot.type==="FunctionExpression"||Ot.type==="ArrowFunctionExpression")return{name:"default",kind:"function",type:Gr(K,Ot,bp(Ot)),functionNode:Ot,declFile:K.filePath,isTypeOnly:!1};let Ft=mn(Ot),jt=Ft?Oe(Ft):null;return jt?{...jt,name:"default"}:void 0}function Pd(K,ee){for(let Oe of K){if(Oe.type!=="ImportDeclaration")continue;let Ot=Oe.source.value;for(let Ft of Oe.specifiers){if(Ft.local.name!==ee)continue;let jt=Oe.importKind==="type"||Ft.type==="ImportSpecifier"&&Ft.importKind==="type";if(Ft.type==="ImportDefaultSpecifier")return{specifier:Ot,importedName:"default",isTypeOnly:jt};if(Ft.type==="ImportNamespaceSpecifier")return{specifier:Ot,importedName:"*",isTypeOnly:jt};if(Ft.type==="ImportSpecifier"){let Gt=mn(Ft.imported)??ee;return{specifier:Ot,importedName:Gt,isTypeOnly:jt}}}}return null}function xp(K,ee,Oe){return{name:K,kind:"const",declFile:ee,namespaceFile:ee,isTypeOnly:Oe}}function Si(K,ee){let Oe=ee.cache.get(K);if(Oe)return Oe;if(ee.computing.has(K))return[];ee.computing.add(K);let Ot=ee.graph.parse(K);if(!Ot)return ee.computing.delete(K),ee.cache.set(K,[]),[];let{source:Ft,body:jt}=Ot,Gt=[],Mt=new Map;for(let qt of jt){let zt=qt.type==="ExportNamedDeclaration"?qt.declaration:qt;if(!zt)continue;for(let Xt of Wr(Ft,zt,zt.start))Mt.set(Xt.name,Xt)}let Vt=(qt,zt)=>({name:qt,kind:"const",declFile:ld(Ft.dir,zt),isTypeOnly:!1}),Wt=(qt)=>{let zt=Mt.get(qt);if(zt)return zt;let Xt=Pd(jt,qt);if(!Xt)return null;if(Xt.specifier.endsWith(".svelte"))return Vt(qt,Xt.specifier);let Qt=ee.graph.resolve(Xt.specifier,Ft.dir);if(!Qt)return null;if(Xt.importedName==="*")return xp(qt,Qt,Xt.isTypeOnly);return es(Qt,Xt.importedName,ee)??null},Kt=new Map;for(let qt of jt){if(qt.type==="ExportAllDeclaration"){let Jt=qt.source.value;if(Jt.endsWith(".svelte"))continue;let tn=ee.graph.resolve(Jt,Ft.dir);if(!tn)continue;let sn=qt.exportKind==="type",cn=mn(qt.exported);if(cn){Gt.push(xp(cn,tn,sn));continue}for(let pn of Si(tn,ee)){let ln=Kt.get(pn.name)??[];ln.push(sn?{...pn,isTypeOnly:!0}:pn),Kt.set(pn.name,ln)}continue}if(qt.type==="ExportDefaultDeclaration"){let Jt=Td(Ft,qt,Wt);if(Jt)Gt.push(Jt);continue}if(qt.type!=="ExportNamedDeclaration")continue;let zt=qt.declaration;if(zt){Gt.push(...Wr(Ft,zt,qt.start));continue}let Xt=qt.source?.value;if(Xt?.endsWith(".svelte")){for(let Jt of qt.specifiers){let tn=mn(Jt.exported);if(tn)Gt.push(Vt(tn,Xt))}continue}let Qt=qt.exportKind==="type";for(let Jt of qt.specifiers){let tn=mn(Jt.exported),sn=mn(Jt.local);if(!tn||!sn)continue;let cn=Qt||Jt.exportKind==="type",pn=null;if(Xt){let ln=ee.graph.resolve(Xt,Ft.dir);if(ln)pn=es(ln,sn,ee)??null}else pn=Wt(sn);if(pn)Gt.push({...pn,name:tn,isTypeOnly:pn.isTypeOnly||cn});else if(sn!=="default")Gt.push({name:tn,kind:cn?"type":"const",declFile:K,isTypeOnly:cn})}}let Ht=new Set(Gt.map((qt)=>qt.name));for(let[qt,zt]of Kt){if(Ht.has(qt)||qt==="default")continue;if(zt.every((Xt)=>Xt.declFile===zt[0].declFile))Gt.push(...zt);else ee.onAmbiguousStarExport?.(K,qt,zt)}return ee.computing.delete(K),ee.cache.set(K,Gt),Gt}function es(K,ee,Oe){return Si(K,Oe).findLast((Ot)=>Ot.name===ee)}function fs(K,{importedName:ee,members:Oe=[]},Ot){let Ft=es(K,ee,Ot);for(let jt of Oe){if(Ft?.namespaceFile===void 0)return;Ft=es(Ft.namespaceFile,jt,Ot)}return Ft}function Kn(K,ee,Oe){if(K[ee]===void 0)delete K[ee];K[ee]=Oe}function bi(K,ee){return(ee.location==="props"?K.props:K.moduleExports).find((Ot)=>Ot.name===ee.propName)}function Ci(K,ee){if(ee.location!=="props")return;K.diagnostics=(K.diagnostics??[]).filter((Oe)=>!(Oe.kind==="prop-unknown-type"&&Oe.name===ee.propName))}var $d=/\.[^./\\]+$/;function Ad(K,ee){if(K.endsWith(".d.ts"))return null;let Oe=K.replace($d,".d.ts");return ee.exists(Oe)?Oe:null}function Nd(K,ee,Oe){return ee.map((Ot)=>{if(!Ot.importSource||!Ot.importedName)return{candidate:Ot};let Ft=Oe.graph.resolve(Ot.importSource,K);if(!Ft)return{candidate:Ot,failureReason:"module-not-found"};let jt=es(Ft,Ot.importedName,Oe);if(!jt)return{candidate:Ot,failureReason:"export-not-found"};if(jt.returnType)return{candidate:Ot,type:jt.returnType};let Gt=Ad(Ft,Oe.graph);if(Gt){let Mt=es(Gt,Ot.importedName,Oe);if(Mt?.returnType)return{candidate:Ot,type:Mt.returnType}}return{candidate:Ot,failureReason:"return-type-unresolved"}})}function Dd(K,ee){switch(ee){case"module-not-found":return`Prop "${K.propName}" default calls "${K.calleeName}()", but "${K.importSource}" could not be resolved; falling back to "any".`;case"export-not-found":return`Prop "${K.propName}" default calls "${K.calleeName}()", but "${K.importedName}" is not exported from "${K.importSource}"; falling back to "any".`;case"return-type-unresolved":return`Prop "${K.propName}" default calls "${K.calleeName}()" imported from "${K.importSource}", but its return type could not be resolved; falling back to "any".`}}function _d(K,ee){for(let{candidate:Oe,type:Ot,failureReason:Ft}of ee){let jt=bi(K,Oe);if(jt?.typeSource!=="unknown")continue;if(Ot){Kn(jt,"type",Ot),Kn(jt,"typeSource","typescript"),Ci(K,Oe);continue}if(Oe.location==="props"&&Ft){let Gt=K.diagnostics?.find((Mt)=>Mt.kind==="prop-unknown-type"&&Mt.name===Oe.propName);if(Gt)Gt.message=Dd(Oe,Ft)}}}var Cp={collect:(K)=>K.pendingCallDefaultCandidates?.filter((ee)=>ee.importSource!==void 0)??[],resolve:Nd,apply:_d};function Rd(K,ee,Oe){return ee.map((Ot)=>{let Ft=Oe.graph.resolve(Ot.importSource,K);if(!Ft)return{candidate:Ot};let jt=fs(Ft,Ot,Oe);if(!jt?.primitiveLiteral)return{candidate:Ot};return{candidate:Ot,literal:jt.primitiveLiteral,declaredType:jt.declaredType}})}function Id(K,ee){for(let{candidate:Oe,literal:Ot,declaredType:Ft}of ee){if(!Ot)continue;let jt=bi(K,Oe);if(!jt)continue;if(Kn(jt,"value",Ot.raw),Kn(jt,"defaultValue",{raw:Ot.raw,kind:"literal",value:Ot.value}),jt.typeSource!=="unknown")continue;Kn(jt,"type",Ft?.type??Ot.type),Kn(jt,"typeSource",Ft?.source??"default"),Ci(K,Oe)}}var wp={collect:(K)=>K.pendingConstDefaultCandidates??[],resolve:Rd,apply:Id};function Ld(K,ee,Oe){return ee.map((Ot)=>{let Ft=Oe.graph.resolve(Ot.importSource,K);if(!Ft)return{candidate:Ot};let jt=fs(Ft,Ot,Oe);if(jt?.kind!=="const"||jt.literalValue===void 0)return{candidate:Ot};return{candidate:Ot,key:jt.literalValue}})}function Od(K,ee){for(let{candidate:Oe,key:Ot}of ee){if(!Ot){let Mt=oe(Oe);os(K,[a({component:K.filePath,kind:"context-key-unresolved",name:Mt,message:`setContext key \`${Mt}\` from "${Oe.importSource}" isn't an \`export const\` string or Symbol() sveld can read; the context is skipped.`,...Oe.source?{source:Oe.source}:{}})]);continue}let Ft=[...K.contexts??[]],jt=Ft.findIndex((Mt)=>Mt.key===Ot);if(jt!==-1){let Mt=Ft[jt],Vt=kp(Mt.source,Oe.source),Wt=Vt?Mt.source:Oe.source;if(os(K,[a({component:K.filePath,kind:"context-duplicate-key",name:Ot,message:`setContext("${Ot}", ...) was called more than once; only the first call's shape is used.`,...Wt?{source:Wt}:{}})]),!Vt)continue;Ft.splice(jt,1)}let Gt=Ft.findIndex((Mt)=>kp(Mt.source,Oe.source));Ft.splice(Gt===-1?Ft.length:Gt,0,{key:Ot,typeName:z(Ot),...Oe.type===void 0?{}:{type:Oe.type},description:Oe.description,properties:Oe.properties,...Oe.hasUnresolvedSpread?{hasUnresolvedSpread:!0}:{},...Oe.internal?{internal:!0}:{},source:Oe.source}),K.contexts=Ft}}function kp(K,ee){if(!K||!ee)return!1;let{line:Oe,column:Ot}=K.start;return Oe>ee.start.line||Oe===ee.start.line&&Ot>ee.start.column}var Tp={collect:(K)=>K.pendingContextKeyCandidates??[],resolve:Ld,apply:Od};function Md(K,ee,Oe){return ee.map((Ot)=>{let Ft=Oe.graph.resolve(Ot.importSource,K);if(!Ft)return{candidate:Ot,failureReason:"module-not-found"};let jt=fs(Ft,Ot,Oe)?.functionNode;if(!jt)return{candidate:Ot,failureReason:"not-a-function"};let Gt=Fd(jt,Ot);if(!Gt)return{candidate:Ot,failureReason:"parameter-not-found"};return Vd(jt,Gt,Ot)})}function Pp(K){return K?.type==="AssignmentPattern"?K.left:K}function Fd(K,ee){let Oe=Pp(K.params[ee.argumentIndex]);if(ee.property===void 0)return Oe?.type==="Identifier"?{name:Oe.name}:void 0;if(!ee.property)return;if(Oe?.type==="Identifier")return{object:Oe.name,property:ee.property};if(Oe?.type!=="ObjectPattern")return;for(let Ot of Oe.properties){if(Ot.type!=="Property"||Ot.computed)continue;if(Ot.key.type!=="Identifier"||Ot.key.name!==ee.property)continue;let Ft=Pp(Ot.value);return Ft?.type==="Identifier"?{name:Ft.name}:void 0}return}function Ur(K){if(!K)return null;if(K.type==="ConditionalExpression"){let Oe=Ur(K.consequent),Ot=Ur(K.alternate);return Oe&&Ot?[...Oe,...Ot]:null}let ee=w(K);return ee?[ee]:null}var jd={variableType:()=>{return}};function Bd(K){if(!K)return"null";let{deriveLiteralDetailType:ee,literalDetailToTypeText:Oe}=$n();if(K.type==="Literal")return Oe(K.value);return ee(jd,K)??"any"}function $p(K,ee){if("name"in ee)return K.type==="Identifier"&&K.name===ee.name;if(K.type!=="MemberExpression"||K.computed)return!1;return K.object.type==="Identifier"&&K.object.name===ee.object&&K.property.type==="Identifier"&&K.property.name===ee.property}function Vd(K,ee,Oe){let Ot=new Map,Ft="name"in ee?ee.name:ee.object,jt;if(o(K.body,{enter(Mt,Vt,Wt){if(Mt.type==="CallExpression"){if(!$p(Mt.callee,ee))return;let Ht=Mt.arguments,qt=Ur(Ht[0]);if(!qt)return jt="dynamic-event-name",T;for(let zt of qt){let Xt=Ot.get(zt)??new Set;Xt.add(Bd(Ht[1])),Ot.set(zt,Xt)}return}let Kt=Vt?.type==="CallExpression"&&Wt==="callee";if(Mt.type==="MemberExpression"&&$p(Mt,ee)&&!Kt)return jt="passed-on",T;if(Mt.type!=="Identifier"||Mt.name!==Ft)return;if(Kt)return;if(!("name"in ee)&&Vt?.type==="MemberExpression"&&Wt==="object")return;if(!G(Mt,Vt))return;return jt="passed-on",T}}),jt)return{candidate:Oe,failureReason:jt};let Gt=Array.from(Ot,([Mt,Vt])=>{let Wt=Array.from(Vt);return{name:Mt,detail:Wt.includes("any")?"any":Wt.join(" | ")}});return{candidate:Oe,events:Gt}}function Gd(K,ee){let Oe=K.members?`"${K.calleeText}"`:K.importedName==="default"?"the default export":`"${K.importedName}"`;switch(ee){case"module-not-found":return`"${K.importSource}" isn't a local module sveld can read`;case"not-a-function":return`${Oe} isn't a function declared in "${K.importSource}"`;case"parameter-not-found":return`no parameter of ${Oe} receives it`;case"dynamic-event-name":return"an event name isn't a string literal";case"passed-on":return`${Oe} passes it on`}}function Wd(K,ee,{deferredEventNoSourceDiagnostics:Oe=[],untypedJsDocEventNames:Ot=[]}){let Ft=new Map,jt=[...K.diagnostics??[]],Gt=!0;for(let{candidate:zt,events:Xt,failureReason:Qt}of ee){if(Qt){Gt=!1,jt.push(a({component:K.filePath,kind:"dispatch-escapes",name:zt.dispatcherName,message:`\`${zt.dispatcherName}\` is passed to \`${zt.calleeText}\`, but sveld couldn't read the events it dispatches: ${Gd(zt,Qt)}. Document them with @event tags.`,...zt.source?{source:zt.source}:{},...zt.ignored?{ignored:!0}:{}}));continue}for(let Jt of Xt??[]){if(Ft.has(Jt.name))continue;Ft.set(Jt.name,{type:"dispatched",name:Jt.name,detail:Jt.detail,...zt.source?{source:zt.source}:{}})}}if(Gt){for(let zt of Oe)if(!Ft.has(zt.name))jt.push(zt)}if(K.diagnostics=jt,Ft.size===0)return;let Mt=new Map,Vt=new Set;for(let zt of K.events)if(zt.type==="dispatched")Vt.add(zt.name);else if(!Mt.has(zt.name))Mt.set(zt.name,zt);let Wt=new Set(Ot),Kt=new Map,Ht=[];for(let zt of Ft.values()){if(Vt.has(zt.name)){if(Wt.has(zt.name)&&zt.detail!==void 0)Kt.set(zt.name,zt.detail);continue}let Xt=Mt.get(zt.name);if(!Xt){Ht.push(zt);continue}let Qt=zt.source??Xt.source;Ht.push({type:"dispatched",name:zt.name,detail:Xt.detail??zt.detail,...Xt.description?{description:Xt.description}:{},...Xt.deprecated===void 0?{}:{deprecated:Xt.deprecated},...Xt.tags?{tags:Xt.tags}:{},...Xt.internal?{internal:!0}:{},...Qt?{source:Qt}:{}})}if(Ht.length===0&&Kt.size===0)return;let qt=new Set(Ht.map((zt)=>zt.name));K.events=[...K.events.filter((zt)=>zt.type==="dispatched"||!qt.has(zt.name)).map((zt)=>{let Xt=zt.type==="dispatched"?Kt.get(zt.name):void 0;return Xt===void 0?zt:{...zt,detail:Xt}}),...Ht].sort(he)}var Ap={collect:(K)=>K.pendingDispatchEscapeCandidates??[],resolve:Md,apply:Wd};function wi(K){return(ee)=>{let Oe=K.collect(ee);if(Oe.length===0)return;return(Ot,Ft,jt)=>K.apply(Ot,K.resolve(Ft,Oe,jt),ee)}}var Kd=[wi(Cp),wi(wp),wi(Tp),wi(Ap)];async function Np(K,ee,Oe,Ot){let Ft=[];for(let Gt of K){let Mt=Oe(Gt);if(Mt===void 0)continue;let Vt=Kd.flatMap((Wt)=>Wt(Mt)??[]);if(Vt.length>0)Ft.push({component:Gt,passes:Vt})}let jt=new Map;if(Ft.length===0)return jt;await Wn();for(let{component:Gt,passes:Mt}of Ft){let Vt=Ei(Ot),Wt=Ud(ee(Gt.filePath));for(let Kt of Mt)Kt(Gt,Wt,Vt);jt.set(Gt.filePath,Array.from(Vt.cache.keys()))}return jt}var Hd=/^```([\w-]*)\r?\n([\s\S]*?)\r?\n?```$/,qd=new Set(["","js","jsx","ts","tsx","javascript","typescript"]),zd=new Set(["svelte","html"]);function Xd(K){let ee=K.trim();if(ee==="")return null;let Oe=ee.match(Hd);if(Oe){let Ot=Oe[1].toLowerCase(),Ft=Oe[2].trim();if(Ft==="")return null;if(qd.has(Ot))return{kind:"compile",code:Ft};if(zd.has(Ot))return{kind:"syntax",code:Ft};return null}if(ee.startsWith("<"))return null;return{kind:"compile",code:ee}}function Dp(K){if(!K.isFunction)return"any";return`(${(K.params??[]).map((Oe)=>`${Oe.name}${Oe.optional?"?":""}: any`).join(", ")}) => any`}function ki(K,ee,Oe,Ot,Ft){let jt=(K??[]).filter((Mt)=>Mt.name==="example"),Gt=jt.length>1;return jt.flatMap((Mt,Vt)=>{let Wt=Xd(Mt.body);if(Wt===null)return[];return[{id:Gt?`${ee}#${Vt}`:ee,name:Gt?`${Oe} (example ${Vt+1})`:Oe,type:Ot,code:Wt.code,kind:Wt.kind,...Ft?{source:Ft}:{}}]})}function Jd(K){let ee=[];for(let Oe of K.props)ee.push(...ki(Oe.tags,`prop:${Oe.name}`,Oe.name,Dp(Oe),Oe.source));for(let Oe of K.moduleExports)ee.push(...ki(Oe.tags,`export:${Oe.name}`,Oe.name,Dp(Oe),Oe.source));for(let Oe of K.slots){let Ot=Oe.name??"default";ee.push(...ki(Oe.tags,`slot:${Ot}`,Ot,"any",Oe.source))}for(let Oe of K.events)ee.push(...ki(Oe.tags,`event:${Oe.name}`,Oe.name,"any",Oe.source));return ee}function _p(K,ee){return K.flatMap(({component:Oe,sources:Ot})=>{let Ft=Ot.filter((jt)=>jt.kind===ee);return Ft.length===0?[]:[{component:Oe,sources:Ft}]})}async function Yd(K){let{formatParseError:ee,parseSvelte:Oe}=await Wn(),Ot=new Map;for(let{component:Ft,sources:jt}of K){let Gt=[];for(let Mt of jt)try{Oe(Mt.code)}catch(Vt){Gt.push(a({component:Ft.filePath,kind:"example-syntax-error",name:Mt.name,message:ee(Vt),...Mt.source?{source:Mt.source}:{}}))}Ot.set(Ft,Gt)}return Ot}async function Qd(K,ee,Oe){let Ot=await ee.checkExamples(K.map(({component:jt,sources:Gt})=>({moduleName:jt.moduleName,filePath:Oe(jt.filePath),sources:Gt}))),Ft=new Map;for(let{component:jt,sources:Gt}of K){let Mt=Ot.get(Oe(jt.filePath));if(!Mt||Mt.length===0)continue;let Vt=new Map(Gt.map((Wt)=>[Wt.id,Wt.source]));Ft.set(jt,Mt.map((Wt)=>{let Kt=Vt.get(Wt.id);return a({component:jt.filePath,kind:"example-compile-error",name:Wt.name,message:Wt.message,...Kt?{source:Kt}:{}})}))}return Ft}async function Rp(K,ee,Oe,Ot){let Ft=Array.from(K,(Wt)=>({component:Wt,sources:Jd(Wt)})),jt=ee===!0?_p(Ft,"compile"):[],Gt=_p(Ft,"syntax"),Mt=new Map,Vt=(Wt)=>{for(let[Kt,Ht]of Wt)Mt.set(Kt,[...Mt.get(Kt)??[],...Ht])};if(Gt.length>0)Vt(await Yd(Gt));if(jt.length>0){let{TypeResolver:Wt}=await import("./chunk-qqhje1j7.js"),Kt=await Wt.create(Oe);if(!Kt.ok)throw Error(`sveld: \`checkExamples\` ${Kt.message}.`);let Ht=Kt.resolver;try{Vt(await Qd(jt,Ht,Ot))}finally{await Ht.dispose()}}return Mt}import{hash as Zd}from"node:crypto";import{mkdirSync as ef,readFileSync as tf,renameSync as nf,writeFileSync as Ip}from"node:fs";import{dirname as Lp,isAbsolute as sf,join as rf,resolve as Kr}from"node:path";var Op=11,of=rf("node_modules",".cache","sveld","parse-cache.json"),af="8a507fce72252061";function Mp(){return`${ai}+${af}+svelte@${Ps}`}function pf(K){let ee=q(K,["package.json"]);return ee===null?Kr(K):Lp(ee)}function Fp(K,ee){let Oe=pf(K);if(typeof ee==="string")return sf(ee)?ee:Kr(Oe,ee);return Kr(Oe,of)}function Ti(K){return Zd("sha256",K,"hex")}function Hr(){return{formatVersion:Op,toolchainVersion:Mp(),entries:{}}}function cf(K){try{let ee=JSON.parse(tf(K,"utf-8"));if(ee.formatVersion!==Op||ee.toolchainVersion!==Mp())return Hr();return ee}catch{return Hr()}}class qr{cacheFilePath;file;next=new Map;dirty=!1;savedEntryCount;constructor(K){this.cacheFilePath=K,this.file=cf(K),this.savedEntryCount=Object.keys(this.file.entries).length}has(K,ee){return this.lookup(K,ee)!==void 0}lookup(K,ee){let Oe=this.next.get(K);if(Oe?.hash===ee)return Oe;let Ot=this.file.entries[K];return Ot?.hash===ee?Ot:void 0}get(K,ee){let Oe=this.lookup(K,ee);if(Oe===void 0)return null;this.next.set(K,Oe);let{component:Ot,typeScriptMetadata:Ft,propIgnores:jt,pending:Gt}=structuredClone({component:Oe.component,typeScriptMetadata:Oe.typeScriptMetadata,propIgnores:Oe.propIgnores,pending:Oe.pending});if(Ft!==void 0)Ot[x]=Ft;if(jt!==void 0)Ot[R]=jt;return Gt===void 0?{component:Ot}:{component:Ot,pending:Gt}}set(K,ee,{component:Oe,pending:Ot}){this.dirty=!0,this.next.set(K,{hash:ee,...structuredClone({component:Oe,typeScriptMetadata:Oe[x],propIgnores:Oe[R],pending:Ot})})}getGeneratedText(K,ee){let Oe=this.next.get(K);if(Oe?.generatedText===void 0||Oe.generatedText.key!==ee)return;return Oe.generatedText.text}setGeneratedText(K,ee,Oe){let Ot=this.next.get(K);if(Ot===void 0)return;if(Ot.generatedText?.key===ee&&Ot.generatedText.text===Oe)return;Ot.generatedText={key:ee,text:Oe},this.dirty=!0}save(){if(!this.dirty&&this.next.size===this.savedEntryCount)return;this.dirty=!1,this.savedEntryCount=this.next.size,ef(Lp(this.cacheFilePath),{recursive:!0});let K={...Hr(),entries:Object.fromEntries(this.next)},ee=JSON.stringify(K),Oe=`${this.cacheFilePath}.${process.pid}.tmp`;try{Ip(Oe,ee),nf(Oe,this.cacheFilePath)}catch{try{Ip(this.cacheFilePath,ee)}catch{}}}}import{dirname as lf,relative as uf,resolve as hf}from"node:path";async function jp(K,ee={}){await Wn();let Oe=hf(K),Ot=lf(Oe),Ft=(Mt)=>n(`./${uf(Ot,Mt)}`),jt=Si(Oe,{...Ei(ee.graph??new Un),onAmbiguousStarExport:(Mt,Vt,Wt)=>{if(Mt!==Oe||!ee.diagnostics)return;if(Wt.every((zt)=>zt.declFile.endsWith(".svelte")))return;let Kt=Array.from(new Set(Wt.map((zt)=>Ft(zt.declFile)))),Ht=Kt.map((zt)=>`"${zt}"`),qt=`${Ht.slice(0,-1).join(", ")} and ${Ht[Ht.length-1]}`;ee.diagnostics.push(a({component:Ft(Oe),kind:"export-ambiguous",name:Vt,message:`"${Vt}" is exported by ${qt} through \`export *\`, so the barrel doesn't export it and the docs leave it out; export it explicitly from the barrel (e.g. \`export { ${Vt} } from "${Kt[0]}"\`).`}))}}),Gt=new Map;for(let Mt of jt){if(Mt.name==="default"||Mt.declFile.endsWith(".svelte"))continue;let{declFile:Vt,returnType:Wt,literalValue:Kt,primitiveLiteral:Ht,declaredType:qt,functionNode:zt,namespaceFile:Xt,...Qt}=Mt,Jt=Ft(Vt);if(Xt!==void 0)Qt.type=`typeof import(${JSON.stringify(Ft(Xt))})`;Gt.set(Mt.name,{...Qt,source:Jt})}return Array.from(Gt.values()).sort((Mt,Vt)=>l(Mt.name,Vt.name))}async function mf(K){let ee=await Promise.all(Array.from(K,async(Oe)=>{try{return[Oe,await ff(Oe,"utf-8")]}catch(Ot){return console.warn(`Warning: Failed to read file ${Oe}:`,Ot),[Oe,null]}}));return new Map(ee)}function Vp(K){if(K.length===0)return;console.error(`sveld: failed to parse ${K.length} component(s):`);for(let{filePath:ee,message:Oe}of K)console.error(` - ${ee}: ${Oe}`)}class Is{input;glob;options;graph=new Un;collected;entryFile=null;globMergeState;cache;entryExports=[];entryDiagnostics=[];records=new Map;parseErrors=new Map;canonicalEntries=new Map;warnedModuleNames=new Set;constructor(K,ee,Oe={}){this.input=K,this.glob=ee,this.options=Oe}get documentExports(){return this.options.documentExports===!0}async build(){return this.graph=new Un,this.collected=Vr(this.input,this.glob,this.documentExports,this.graph),this.globMergeState=vi(this.collected.allComponentEntries,this.collected.resolveComponentFilePath),this.entryFile=df(this.input).isFile()?Bp(this.input):null,this.cache=this.options.cache===!1?void 0:new qr(Fp(this.collected.rootDir,this.options.cache??!0)),await this.readEntryExports(),this.records.clear(),this.parseErrors.clear(),this.indexEntries(),await this.process(this.componentPaths()),Vp(Array.from(this.parseErrors.values())),this.assemble()}async update(K){let ee=K.map((Wt)=>Bp(Wt));if(this.graph.invalidate(...ee),ee.length===0)return{result:this.assemble(),reparsed:[]};let Oe=this.entryFile!==null&&ee.includes(this.entryFile)?await this.recollect():[];if(this.glob){let{rootDir:Wt,exports:Kt,allComponentEntries:Ht,resolveComponentFilePath:qt}=this.collected;Br(this.graph,Wt,Kt,Ht,qt,this.globMergeState)}this.indexEntries();let Ot=this.componentPaths();for(let Wt of this.records.keys())if(!Ot.has(Wt))this.records.delete(Wt);for(let Wt of this.parseErrors.keys())if(!Ot.has(Wt))this.parseErrors.delete(Wt);let Ft=Array.from(this.records).flatMap(([Wt,{crossFileReads:Kt}])=>Kt?.some((Ht)=>ee.includes(Ht))?[Wt]:[]),jt=new Set([...ee.filter((Wt)=>Nn.test(Wt)),...Oe,...Ft]),Gt=new Set(Array.from(Ot).filter((Wt)=>jt.has(Wt))),Mt=await this.process(Gt),Vt=this.assemble();return Vp(Vt.errors),{result:Vt,reparsed:Mt}}async recollect(){let K=this.collected,ee=Vr(this.input,this.glob,this.documentExports,this.graph),Oe=[];for(let[Ot,Ft]of Object.entries(ee.exports)){let jt=ee.resolveComponentFilePath(Ft.source),Gt=Object.hasOwn(K.exports,Ot)?K.exports[Ot]:void 0;if(Gt===void 0||K.resolveComponentFilePath(Gt.source)!==jt)Oe.push(jt)}return this.collected=ee,this.globMergeState=vi(ee.allComponentEntries,ee.resolveComponentFilePath),await this.readEntryExports(),Oe}async readEntryExports(){this.entryDiagnostics=[],this.entryExports=this.documentExports&&this.entryFile!==null?await jp(this.entryFile,{diagnostics:this.entryDiagnostics,graph:this.graph}):[]}componentPaths(){let{exports:K,allComponentEntries:ee,resolveComponentFilePath:Oe}=this.collected,Ot=new Set;for(let[,Ft]of[...Object.entries(K),...ee])if(us(Ft.source))Ot.add(Oe(Ft.source));return Ot}indexEntries(){let{exports:K,allComponentEntries:ee,resolveComponentFilePath:Oe}=this.collected;this.canonicalEntries=new Map;for(let Ot of[Object.entries(K),ee])for(let Ft of Ot){if(!us(Ft[1].source))continue;this.canonicalEntries.set(Oe(Ft[1].source),this.entryIdentity(Ot,Ft))}}entryIdentity(K,[ee,{source:Oe}]){return{moduleName:yp(ee,Oe,K.length,this.warnedModuleNames),filePath:n(Oe)}}canonicalEntry(K){let ee=this.canonicalEntries.get(K);if(ee===void 0)throw Error(`sveld: no entry lists ${K}.`);return ee}async process(K){let ee=new Map,Oe=await this.parse(K,ee);this.cache?.save();let Ot=await this.settle(Oe);for(let Ft of K)this.records.delete(Ft),this.parseErrors.delete(Ft);for(let[Ft,jt]of Ot)this.records.set(Ft,jt);for(let[Ft,jt]of ee)this.parseErrors.set(Ft,jt);return Array.from(Ot.keys())}async parse(K,ee){let Oe=await mf(K),Ot=this.cache,Ft=new Map,jt=new Set;if(Ot)for(let[Mt,Vt]of Oe){if(Vt===null)continue;let Wt=Ti(Vt);if(Ft.set(Mt,Wt),!Ot.has(Mt,Wt))jt.add(Mt)}if(K.size>0&&(!Ot||jt.size>0))await Wn();let Gt=new Map;for(let Mt of K){let Vt=Oe.get(Mt);if(Vt===null||Vt===void 0)continue;let Wt=this.parseOne(Mt,Vt,Ft.get(Mt),ee);if(Wt)Gt.set(Mt,Wt)}return Gt}parseOne(K,ee,Oe,Ot){let Ft=Oe===void 0?null:this.cache?.get(K,Oe);if(Ft)return Ft;let{moduleName:jt,filePath:Gt}=this.canonicalEntry(K),Mt;try{Mt=new($n()).ComponentParser().parse(ee,{moduleName:jt,filePath:Gt})}catch(Vt){if(this.options.failFast)throw Vt;Ot.set(K,{filePath:Gt,moduleName:jt,message:Vt instanceof Error?Vt.message:String(Vt),stack:Vt instanceof Error?Vt.stack:void 0});return}if(Oe!==void 0)this.cache?.set(K,Oe,Mt);return Mt}async settle(K){let{rootDir:ee,resolveComponentFilePath:Oe}=this.collected,Ot=new Map,Ft=new Map;for(let[Vt,{component:Wt,pending:Kt}]of K){let Ht={...this.canonicalEntry(Vt),...Wt};Ot.set(Vt,Ht),Ft.set(Ht,Kt)}let{checkExamples:jt}=this.options;if(jt){let Vt=await Rp(Ot.values(),jt,ee,Oe);for(let[Wt,Kt]of Vt)os(Wt,Kt)}let Gt=await Np(Ot.values(),Oe,(Vt)=>Ft.get(Vt),this.graph),Mt=new Map;for(let[Vt,Wt]of Ot){let{moduleName:Kt,filePath:Ht,...qt}=Wt,zt=Gt.get(Ht);Mt.set(Vt,zt===void 0?{component:qt}:{component:qt,crossFileReads:zt})}return Mt}assemble(){let{exports:K,allComponentEntries:ee,resolveComponentFilePath:Oe}=this.collected,Ot=this.cache,Ft=(Ht,qt)=>{let{source:zt}=qt[1];if(!us(zt))return;let Xt=this.records.get(Oe(zt));if(Xt===void 0)return;return{component:{...this.entryIdentity(Ht,qt),...Xt.component},record:Xt}},jt=new Map,Gt=Ot?new Map:void 0,Mt=Ot?new Map:void 0;for(let Ht of ee){let qt=Ft(ee,Ht);if(qt===void 0)continue;let{filePath:zt}=qt.component;jt.set(zt,qt.component),(qt.record.crossFileReads===void 0?Gt:Mt)?.set(zt,Oe(Ht[1].source))}let Vt=Ja(jt,Oe,this.graph);for(let Ht of jt.values())os(Ht,[...Vt(Ht),...Xa(Ht)]);let Wt=new Map,Kt=Object.entries(K);for(let Ht of Kt){let qt=Ft(Kt,Ht);if(qt===void 0)continue;let zt=jt.get(qt.component.filePath);if(zt)qt.component.diagnostics=zt.diagnostics;Wt.set(qt.component.moduleName,qt.component)}return{exports:K,entryExports:this.entryExports,components:Wt,allComponentsForTypes:jt,errors:Array.from(this.parseErrors.values()),diagnostics:vo(So([...Array.from(jt.values()).flatMap((Ht)=>Ht.diagnostics??[]),...this.entryDiagnostics]),this.options.diagnostics?.ignore),cache:Ot,resolvedPathByFilePath:Gt,crossFileResolvedPathByFilePath:Mt}}}function Ls(K){return{failFast:K?.failFast,documentExports:K?.documentExports===!0,cache:K?.cache,checkExamples:K?.checkExamples==="syntax"?"syntax":K?.checkExamples===!0,diagnostics:K?.diagnostics}}async function Os(K,ee,Oe={}){return new Is(K,ee,Oe).build()}import{existsSync as zr,readFileSync as gf}from"node:fs";import{isAbsolute as yf,join as Wp}from"node:path";var Ms='sveld: could not resolve a Svelte entry point. Set package.json#svelte, or pass the "entry" option.';function Gp(K){return yf(K)?K:Wp(process.cwd(),K)}function Ie(K){if(K){let Ft=Gp(K);if(zr(Ft))return{entry:Z(K)};return{entry:null,configured:!0,message:`Invalid entry point: ${Ft}. Pass a valid --entry (or "entry" option), or unset it and set the "svelte" field in your package.json instead.`}}let ee=Wp(process.cwd(),"package.json");if(!zr(ee))return{entry:null,configured:!1,message:'Could not locate a package.json file. Specify an entry point with --entry (or the "entry" option).'};let Oe;try{Oe=np(JSON.parse(gf(ee,"utf-8")))}catch(Ft){throw console.error("Error reading package.json:",Ft),Ft}let Ot=Oe.svelte?.trim();if(!Ot)return{entry:null,configured:!1,message:'Could not determine an entry point. Set the "svelte" field in your package.json, or pass --entry (or the "entry" option).'};if(!zr(Gp(Ot)))return{entry:null,configured:!0,message:`The "svelte" field in package.json points to "${Ot}", which does not exist.`};return{entry:Z(Ot)}}function Pi(K){let ee=Ie(K);if(ee.entry===null)console.error(ee.message);return ee.entry}async function Up(K,ee,Oe={}){let Ot=new Is(K,ee,{...Oe,failFast:!1}),Ft=await Ot.build();return{get result(){return Promise.resolve(Ft)},async update(jt){let Gt=await Ot.update(jt);return Ft=Gt.result,Gt}}}import Jr from"node:path";function Kp(K){let ee=new Map;for(let[Ot,Ft]of Object.entries(K)){let jt=ee.get(Ft.source)??[];jt.push({id:Ot,exportee:Ft}),ee.set(Ft.source,jt)}let Oe=[];for(let[Ot,Ft]of ee){let jt=Nn.test(Ot),Gt=Ft.some(({id:qt,exportee:zt})=>qt!=="default"&&zt.default),Mt=Ft.some(({exportee:qt})=>!qt.default),Vt=jt&&Gt&&Mt,Wt=[],Kt=[],Ht=[];for(let{id:qt,exportee:zt}of Ft){if(qt==="default"){Kt.push(`export { default } from "${Ot}";`);continue}if(zt.default)if(zt.mixed)Kt.push(`export { default as ${qt} } from "${Ot}";`),Kt.push(`export { default } from "${Ot}";`);else Ht.push(`default as ${qt}`);else if(jt&&!Vt)Ht.push(`default as ${qt}`);else Wt.push(qt)}if(Ht.length>0&&Wt.length>0)Oe.push(`export { ${[...Ht,...Wt].join(", ")} } from "${Ot}";`);else{if(Wt.length>0)Oe.push(`export { ${Wt.join(", ")} } from "${Ot}";`);if(Ht.length>0)Oe.push(`export { ${Ht.join(", ")} } from "${Ot}";`)}Oe.push(...Kt)}return Oe.join(`
|
|
138
|
-
`)}function
|
|
139
|
-
`)}function
|
|
136
|
+
`))}var Oh=[...hi,".svelte"];function Lh(K){let ee=K.trim();if(ee.length<2)return;let Oe=ee[0],Ot=ee[ee.length-1];if((Oe==='"'||Oe==="'"||Oe==="`")&&Oe===Ot)return ee.slice(1,-1);return}function ep(K){let ee=[],Oe=K.moduleExports.filter((Ft)=>Ft.kind==="re-export");if(Oe.length===0)return ee;let Ot=new Set([mi(K.moduleName),Ri(K.moduleName)]);for(let Ft of Oe){if(!Ot.has(Ft.name))continue;ee.push(a({component:K.filePath,kind:"module-export-conflict",name:Ft.name,message:`Re-export "${Ft.name}" has the same name as the generated "${Ft.name}" type; the .d.ts won't type-check if "${Ft.reExport?.from}" exports a type by that name.`,source:Ft.source}))}return ee}function tp(K,ee,Oe){let Ot=new Map(Array.from(K.values()).map((Ft)=>[ee(Ft.filePath),Ft]));return(Ft)=>{let jt=Ft.extends;if(!jt)return[];let Gt=Lh(jt.import);if(Gt===void 0||!Gt.startsWith(".")&&!Gt.startsWith("/"))return[];let Mt=ee(Ft.filePath),Vt=Oe.resolve(Gt,Ih(Mt),Oh);if(Vt===null)return[a({component:Ft.filePath,kind:"extend-props-target-missing",name:jt.interface,message:`@extends/@extendProps target "${Gt}" was not found on disk.`})];let Wt=Ot.get(Vt);if(!Wt)return[];let Kt=mi(Wt.moduleName);if(_r(jt.interface)!==Kt)return[a({component:Ft.filePath,kind:"extend-props-target-missing",name:jt.interface,message:`@extends/@extendProps names "${jt.interface}", but "${Gt}" generates "${Kt}".`})];let Ht=[];for(let qt of Ft.props){let zt=Wt.props.find((Xt)=>Xt.name===qt.name);if(zt&&zt.type!==qt.type){let Xt=a({component:Ft.filePath,kind:"extend-props-override",name:qt.name,message:`Own prop "${qt.name}" (${qt.type}) overrides "${Kt}"'s "${qt.name}" (${zt.type}).`}),Jt=fo(Ft)?.[qt.name]?.some((tn)=>tn===""||tn===Xt.code);Ht.push(Jt?{...Xt,ignored:!0}:Xt)}}return Ht}}import{lstatSync as id,readFileSync as sd,realpathSync as rd,statSync as od}from"node:fs";import{dirname as ad,isAbsolute as pd,join as vp,parse as cd,relative as Gr,resolve as Oi}from"node:path";function Z(K){return K}function $n(K){if(K==="")return K;return K==="."||K===".."||K.startsWith("./")||K.startsWith("../")?K:`./${K}`}import{readFileSync as yp}from"node:fs";import{dirname as jr,join as td,relative as fp,resolve as mp}from"node:path";import{readFileSync as Hh,statSync as qh}from"node:fs";import{basename as Br,dirname as Ss,isAbsolute as zh,join as Xh,resolve as Jh}from"node:path";import{existsSync as sp,readdirSync as Mh}from"node:fs";import{dirname as np,join as rp,resolve as Fh}from"node:path";function j(K,ee){for(let Oe=Fh(K);;Oe=np(Oe)){for(let Ot of ee){let Ft=rp(Oe,Ot);if(sp(Ft))return Ft}if(np(Oe)===Oe)return null}}function ip(K){return K.normalize("NFC").toLowerCase()}class Rr{listings=new Map;clear(){this.listings.clear()}entries(K){return this.read(K)?.entries??null}entry(K,ee){let Oe=this.read(K);if(Oe===null)return;if(Oe.byName===void 0){Oe.byName=new Map;for(let Ot of Oe.entries)Oe.byName.set(Ot.name,Ot)}return Oe.byName.get(ee)}has(K,ee){let Oe=this.read(K);if(Oe===null)return!1;if(Oe.names.has(ee))return!0;if(Oe.folded===void 0){Oe.folded=new Map;for(let Ft of Oe.names)Oe.folded.set(ip(Ft),Ft)}let Ot=Oe.folded.get(ip(ee));return Ot!==void 0&&Ot!==ee&&sp(rp(K,ee))}read(K){let ee=this.listings.get(K);if(ee!==void 0)return ee;try{let Oe=Mh(K,{withFileTypes:!0}),Ot=new Set;for(let Ft of Oe)Ot.add(Ft.name);ee={entries:Oe,names:Ot}}catch{ee=null}return this.listings.set(K,ee),ee}}var Ir=!1;function F(K){Ir=K}function Fn(K){if(!Ir)console.error(K)}function op(K){if(!Ir)console.error(K)}function Te(K){if(K instanceof e)return K.start?`${K.reason} (${K.start.line}:${K.start.column})`:K.reason;return K instanceof Error?K.message:String(K)}var Ii=null,Or=null;function Un(){if(Ii)return Promise.resolve(Ii);if(!Or)Or=import("./chunk-xzarv1ey.js").then((K)=>(Ii=K,K));return Or}function Nn(){if(!Ii)throw Error("sveld: internal error, parser stack read before loadParserStack() resolved.");return Ii}import{existsSync as Lr,readFileSync as Bh}from"node:fs";import{dirname as up,isAbsolute as hp,relative as jh,resolve as Mr}from"node:path";function ap(K){if(!r(K))return{};let ee={};if(typeof K.svelte==="string")ee.svelte=K.svelte;if(typeof K.name==="string")ee.name=K.name;if(typeof K.description==="string")ee.description=K.description;return ee}function pp(K){if(!r(K))return{};let ee={};if(typeof K.extends==="string")ee.extends=K.extends;if(r(K.compilerOptions)){let Oe={};if(typeof K.compilerOptions.baseUrl==="string")Oe.baseUrl=K.compilerOptions.baseUrl;if(r(K.compilerOptions.paths)){let Ot={};for(let[Ft,jt]of Object.entries(K.compilerOptions.paths))if(Array.isArray(jt)&&jt.every((Gt)=>typeof Gt==="string"))Ot[Ft]=jt;if(Object.keys(Ot).length>0)Oe.paths=Ot}if(Object.keys(Oe).length>0)ee.compilerOptions=Oe}return ee}var Vh=["tsconfig.json","jsconfig.json"],cp=new Map,Gh=/\/\*[\s\S]*?\*\/|\/\/.*/g,Wh=[".svelte",...hi];class V extends Error{specifier;fromFile;searched;constructor(K,ee,Oe){super(`cannot resolve "${K}" from ${ee||"."} (${Oe})`);this.name="UnresolvedModuleError",this.specifier=K,this.fromFile=ee,this.searched=Oe}}function Uh(K){if(Lr(K))return!0;return Wh.some((ee)=>Lr(K+ee))}function lp(K){let ee=K.indexOf("*");return ee===-1?K.length:ee}function dp(K,ee){if(ee.has(K))return ee.get(K)??null;try{let Oe=Bh(K,"utf-8"),Ot;try{Ot=JSON.parse(Oe)}catch{let jt=Oe.replace(Gh,"");Ot=JSON.parse(jt)}let Ft=pp(Ot);if(Ft.extends){let jt=hp(Ft.extends)?Ft.extends:Mr(up(K),Ft.extends),Gt=jt.endsWith(".json")?jt:`${jt}.json`;if(Lr(Gt)){let Mt=dp(Gt,ee);if(Mt)Ft.compilerOptions={...Mt.compilerOptions,...Ft.compilerOptions,paths:{...Mt.compilerOptions?.paths,...Ft.compilerOptions?.paths}}}}return ee.set(K,Ft),Ft}catch{return ee.set(K,null),null}}function Kh(K){let ee=cp.get(K);if(!ee){let Oe=K.split("*").map(_).join("(.*)");ee=new RegExp(`^${Oe}$`),cp.set(K,ee)}return ee}class Fr{configs=new Map;lookup(K,ee){if(K.startsWith(".")||hp(K))return{resolved:K,unresolved:!1,searched:""};let Oe=j(ee,Vh),Ot=Oe?dp(Oe,this.configs)?.compilerOptions:void 0,Ft=Ot?.paths;if(!Oe||!Ot||!Ft)return{resolved:K,unresolved:!0,searched:"no tsconfig/jsconfig paths found"};let jt=Mr(up(Oe),Ot.baseUrl??"."),Gt=Object.entries(Ft).sort(([Mt],[Vt])=>lp(Vt)-lp(Mt));for(let[Mt,Vt]of Gt){let Wt=K.match(Kh(Mt));if(!Wt)continue;let Kt;for(let Ht of Vt){let qt=Ht;for(let Xt=1;Xt<Wt.length;Xt++)qt=qt.replace("*",Wt[Xt]);let zt=Mr(jt,qt);if(Kt??=zt,Uh(zt))return{resolved:zt,unresolved:!1,searched:Oe}}return{resolved:Kt??K,unresolved:!1,searched:Oe}}return{resolved:K,unresolved:!0,searched:`tsconfig paths (${Oe})`}}absolute(K,ee){return this.lookup(K,ee).resolved}relative(K,ee){let Oe=this.absolute(K,ee);if(Oe===K)return K;return $n(n(jh(ee,Oe)))}}var Yh=/\.[mc]?jsx?$/,Qh={".js":[".ts",".tsx",".d.ts"],".jsx":[".tsx",".d.ts"],".mjs":[".mts",".d.mts"],".cjs":[".cts",".d.cts"]};function Zh(K){return K==="."||K===".."||K.startsWith("./")||K.startsWith("../")||zh(K)}class Kn{aliases=new Fr;listings=new Rr;modules=new Map;programs=new Map;listDirectory(K){return this.listings.entries(K)}exists(K){return this.listings.has(Ss(K),Br(K))}resolve(K,ee,Oe=hi){let Ot=this.aliases.absolute(K,ee);if(Ot===K&&!Zh(K))return null;let Ft=Jh(ee,Ot),jt=Ss(Ft),Gt=Br(Ft),Mt=this.listings.has(jt,Gt),Vt;if(Mt){let Wt=this.listings.entry(jt,Gt);if(Vt=Wt&&!Wt.isSymbolicLink()?Wt:qh(Ft,{throwIfNoEntry:!1}),Vt?.isFile())return Ft}for(let Wt of Oe)if(this.listings.has(jt,Gt+Wt))return Ft+Wt;if(!Mt)return this.typeScriptCounterpart(Ft)??null;if(Vt?.isDirectory()){for(let Wt of Oe)if(this.listings.has(Ft,`index${Wt}`))return Xh(Ft,`index${Wt}`)}return null}parse(K){let ee=this.modules.get(K);if(ee===void 0)ee=ed(K),this.modules.set(K,ee);return ee}parseJavaScript(K,ee){let Oe=this.programs.get(K);if(Oe?.source===ee)return Oe.ast;let Ot;try{Ot=me(ee)}catch(Ft){throw Error(Te(Ft))}return this.programs.set(K,{source:ee,ast:Ot}),Ot}invalidate(...K){this.listings.clear();for(let ee of K)this.modules.delete(ee),this.programs.delete(ee)}typeScriptCounterpart(K){let ee=Yh.exec(K)?.[0];if(ee===void 0)return;let Oe=K.slice(0,-ee.length),Ot=Ss(Oe),Ft=Br(Oe);for(let jt of Qh[ee]??[])if(this.listings.has(Ot,Ft+jt))return Oe+jt;return}}function ed(K){let ee;try{ee=Hh(K,"utf-8")}catch{return null}try{let Oe=K.endsWith(".svelte")?Nn().parseSvelteScripts(ee).module?.content.body??[]:Nn().parseModule(ee,{typescript:!0}).body;return{source:{text:ee,filePath:K,dir:Ss(K)},body:Oe}}catch(Oe){return op(`Warning: sveld couldn't parse ${K} to read its exports (${Te(Oe)}); skipping it.`),null}}function gp(K){return K.type==="Identifier"?K.name:K.value}function nd(K,ee,Oe,Ot){let Ft=K.resolve(ee,Oe);if(!Ft)return null;let jt=jr(Ft);if(Ot.has(Ft))return{dir:jt,exports:{}};Ot.add(Ft);try{return{dir:jt,exports:Vr(K,yp(Ft,"utf-8"),jt,Ot,Ft)}}catch{return{dir:jt,exports:{}}}finally{Ot.delete(Ft)}}function xp(K,ee,Oe=new Kn,Ot=new Set,Ft=ee){return Vr(Oe,K,ee,Ot,Ft)}function Vr(K,ee,Oe,Ot,Ft){let jt=K.parseJavaScript(Ft,ee),Gt={};for(let Mt of jt.body)if(Mt.type==="ExportDefaultDeclaration"){if(Mt.declaration.type!=="Identifier")continue;let Vt=Mt.declaration.name;if(Vt in Gt)Gt[Vt].default=!0;else Gt[Vt]={source:$n(""),default:!0}}else if(Mt.type==="ExportAllDeclaration"){let Vt=Mt.source.value,Wt=K.resolve(Vt,Oe);if(!Wt){let zt=K.aliases.lookup(Vt,Oe);throw new V(Vt,Ft,zt.unresolved?zt.searched:"no matching file or index found")}if(Ot.has(Wt))continue;Ot.add(Wt);let Kt=yp(Wt,"utf-8"),Ht=Vr(K,Kt,jr(Wt),Ot,Wt);Ot.delete(Wt);let qt=Object.entries(Ht);if(qt.length===0&&!Pn.test(Vt)){let zt=$n(n(Vt));Gt[`*:${Vt}`]={source:zt,default:!1,star:!0}}for(let[zt,Xt]of qt){let Yt=$n(n(Xt.source.startsWith(".")?`./${fp(Oe,mp(jr(Wt),Xt.source))}`:`./${td(Vt,Xt.source)}`));Gt[zt]={...Xt,source:Yt}}}else if(Mt.type==="ExportNamedDeclaration"){let Vt=Mt.source?.value,Wt=Vt!==void 0&&Pn.test(Vt);if(Wt){let qt=K.aliases.lookup(Vt,Oe);if(qt.unresolved)throw new V(Vt,Ft,qt.searched)}let Ht=Vt!==void 0&&!Wt?nd(K,Vt,Oe,Ot):void 0;if(Ht===null){console.warn(`sveld: could not resolve re-exported module "${Vt}" from barrel "${Oe||"."}"; skipping.`);continue}for(let qt of Mt.specifiers){let zt=gp(qt.exported),Xt=gp(qt.local),Yt=zt||Xt,Jt=Ht?.exports[Xt],tn=Jt?$n(n(`./${fp(Oe,mp(Ht.dir,Jt.source))}`)):$n(K.aliases.relative(Vt??"",Oe)),sn=Jt?Jt.default:Xt==="default";if(Yt in Gt){if(Gt[Yt].mixed=!0,!Gt[Yt].source)Gt[Yt].source=tn}else Gt[Yt]={source:tn,default:sn}}}else if(Mt.type==="ImportDeclaration"){let Vt=Mt.specifiers[0];if(!Vt)continue;let Wt=Vt.local.name,Kt=$n(K.aliases.relative(Mt.source.value,Oe));if(Wt in Gt){if(!Gt[Wt].source)Gt[Wt].source=Kt}else Gt[Wt]={source:Kt,default:Wt==="default"}}return Gt}var ld=/-/g,ud=/[^A-Za-z0-9_$]/g,hd=/^[0-9]/;function dd(K,ee){let Oe=K.replace(ud,""),Ot=hd.test(Oe)?`_${Oe}`:Oe;if(Ot!==K&&!ee?.has(K))ee?.add(K),console.warn(`Warning: "${K}" is not a valid identifier; using "${Ot}" instead.`);return Ot}function Ep(K,ee){return dd(cd(K).name.replace(ld,""),ee)}function Sp(K,ee,Oe=[],Ot=new Set,Ft){let jt;try{jt=Ft??rd(ee)}catch{return Oe}if(Ot.has(jt))return Oe;Ot.add(jt);let Gt=K.listDirectory(ee);if(Gt===null)return Oe;for(let Mt of Gt){if(Mt.name.startsWith("."))continue;let Vt=vp(ee,Mt.name),Wt=Mt.isSymbolicLink(),Kt=Wt?od(Vt,{throwIfNoEntry:!1}):Mt;if(!Kt)continue;if(Kt.isDirectory())Sp(K,Vt,Oe,Ot,Wt?void 0:vp(jt,Mt.name));else if(Kt.isFile()&&Mt.name.endsWith(".svelte"))Oe.push(Vt)}return Oe}function fd(K,ee){return Sp(K,ee).map((Oe)=>({moduleName:Ep(Oe),source:$n(n(`./${Gr(ee,Oe)}`))})).sort((Oe,Ot)=>u(Oe.source,Ot.source))}function md(K){return!di(K)}function gd(K,ee){let Oe=K.endsWith("/")?K:`${K}/`;return ee.startsWith(Oe)}function Cs(K,ee){return{seenPaths:new Set(K.map(([,Oe])=>ee(Oe.source))),seenModuleNamePaths:new Map(K.map(([Oe,Ot])=>[Oe,ee(Ot.source)])),warnedModuleNames:new Set}}function Wr(K,ee,Oe,Ot,Ft,jt){for(let{moduleName:Gt,source:Mt}of fd(K,ee)){let Vt=Ft(Mt),Wt=Oe[Gt];if(Wt&&md(Wt.source)&&gd(Wt.source,Mt)){jt.seenPaths.delete(Ft(Wt.source)),Wt.source=Mt,jt.seenPaths.add(Vt),jt.seenModuleNamePaths.set(Gt,Vt);continue}if(jt.seenPaths.has(Vt))continue;jt.seenPaths.add(Vt);let Kt=jt.seenModuleNamePaths.get(Gt);if(Kt===void 0)jt.seenModuleNamePaths.set(Gt,Vt);else if(Kt!==Vt&&!jt.warnedModuleNames.has(Gt))jt.warnedModuleNames.add(Gt),console.warn(`Warning: multiple components named "${Gt}" found (${n(Gr(ee,Kt))} and ${n(Gr(ee,Vt))}). Both are included in TypeScript definitions, but only one can be the named export.`);Ot.push([Gt,{source:Mt,default:!1}])}}function Ur(K,ee,Oe,Ot){let Ft=id(K).isFile(),jt=Ft?ad(K):K,Gt=Oi(jt),Mt=new Map,Vt=(Ht)=>{let qt=Mt.get(Ht);if(qt===void 0)qt=pd(Ht)?Oi(Ht):Oi(Gt,Ht),Mt.set(Ht,qt);return qt},Wt={};if(Ft){let Ht=sd(K,"utf-8");try{Wt=xp(Ht,Gt,Ot,new Set([Oi(K)]),Oi(K))}catch(qt){if(!Oe)throw qt;let zt=qt instanceof Error?qt.message:String(qt);console.warn(`Warning: Failed to parse component exports from ${K}: ${zt}`)}}let Kt=Object.entries(Wt);if(ee){let Ht=Cs(Kt,Vt);if(Wr(Ot,Gt,Wt,Kt,Vt,Ht),!Ft)Wt=Object.fromEntries(Kt.map(([qt,zt])=>[qt,{...zt,default:!0}]))}return{exports:Wt,allComponentEntries:Kt,rootDir:Gt,resolveComponentFilePath:Vt}}function Cp(K,ee,Oe,Ot){if(Oe!==1||K!=="default")return K;return Ep(ee,Ot)}import{dirname as Yd}from"node:path";import{resolve as yd}from"node:path";var xd=/\r?\n/,vd=/^\s*\*+/;function bs(K){return{graph:K,cache:new Map,computing:new Set}}function gn(K){return K?.type==="Identifier"?K.name:void 0}function Ed(K){let ee=K.trimEnd();for(;;){let Oe=ee.lastIndexOf(`
|
|
137
|
+
`)+1;if(ee.slice(Oe).trimStart().startsWith("//")){ee=ee.slice(0,Oe).trimEnd();continue}let Ot=ee.endsWith("*/")?ee.lastIndexOf("/*",ee.length-3):-1;if(Ot!==-1&&ee[Ot+2]!=="*"){ee=ee.slice(0,Ot).trimEnd();continue}return ee}}function Sd(K,ee){let Oe=Ed(K.slice(0,ee));if(!Oe.endsWith("*/"))return;let Ot=Oe.length-2,Ft=Oe.lastIndexOf("/**",Ot);if(Ft===-1)return;return Oe.slice(Ft,Ot+2)}function Cd(K){let ee=[];for(let Oe of K.slice(3,-2).split(xd)){let Ot=Oe.replace(vd,"").trim();if(Ot.startsWith("@"))break;if(Ot)ee.push(Ot)}return ee.join(" ")||void 0}function ti(K,ee){if(!ee)return;return K.text.slice(ee.start,ee.end)}function bd(K,ee){return"typeAnnotation"in ee?ti(K,ee.typeAnnotation?.typeAnnotation):void 0}function wp(K,ee){return ti(K,ee.returnType?.typeAnnotation)}function Kr(K,ee,Oe){return`(${ee.params.map((Ft)=>ti(K,Ft)??"").join(", ")}) => ${wp(K,ee)??Oe??"any"}`}function Tp(K){if(K.type==="Literal"){let ee=K.value;if(typeof ee==="string")return"string";if(typeof ee==="number")return"number";if(typeof ee==="boolean")return"boolean"}if(K.type==="TemplateLiteral")return"string";if(K.type==="UnaryExpression"&&(K.operator==="-"||K.operator==="+"))return K.argument.type==="Literal"&&typeof K.argument.value==="number"?"number":void 0;if(K.type==="CallExpression"&&K.callee.type==="Identifier")return wd[K.callee.name];return}var wd={String:"string",Number:"number",Boolean:"boolean"};function kp(K){if(K.type==="Literal"){let ee=K.value;return typeof ee==="string"||typeof ee==="number"||typeof ee==="boolean"?ee:void 0}if(K.type==="UnaryExpression"&&K.operator==="-"){let ee=K.argument;return ee.type==="Literal"&&typeof ee.value==="number"?-ee.value:void 0}return K.type==="TemplateLiteral"?w(K)??void 0:void 0}function Td(K,ee){let Oe=ti(K,ee),Ot=kp(ee);if(Oe===void 0||Ot===void 0)return;return{raw:Oe,value:Ot,type:typeof Ot}}function kd(K,ee){if(K.type!=="CallExpression"&&K.type!=="NewExpression")return;let Oe=K.callee;if(!(gn(Oe)==="Symbol"||Oe.type==="MemberExpression"&&!Oe.computed&&gn(Oe.object)==="Symbol"&&gn(Oe.property)==="for"))return;let[Ft]=K.arguments;return(Ft?.type==="Literal"&&typeof Ft.value!=="string"?null:w(Ft))||ee}var Ad=new Set(["any","bigint","boolean","false","never","null","number","object","readonly","string","symbol","true","undefined","unknown","void"]),Pd=/"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'/g,_d=/(?<![\w$.])[A-Za-z_$][\w$]*(?![\w$]|\s*\??:)/g;function $d(K,ee){let Oe=ee?Nn().extractJsDocType(ee):void 0,Ot=K?{type:K,source:"typescript"}:Oe?{type:Oe,source:"jsdoc"}:void 0;if(!Ot||Ot.type.includes("`"))return;return(Ot.type.replace(Pd,'""').match(_d)??[]).every((jt)=>Ad.has(jt))?Ot:void 0}function Ap(K){if(K.async||K.generator||K.type==="TSDeclareFunction")return;let ee=K.body,Oe=ee.type==="BlockStatement"?Y(ee):[ee];if(Oe.length===0)return;let Ot;for(let Ft of Oe){if(!Ft)return;let jt=Tp(Ft);if(!jt)return;if(Ot===void 0)Ot=jt;else if(Ot!==jt)return}return Ot}function Nd(K){if(K.type==="TemplateLiteral")return;let ee=kp(K);return typeof ee==="boolean"?void 0:ee}function Dd(K){let ee=K.members;if(ee.length===0)return;let Oe=[],Ot=0;for(let Ft of ee){if(!Ft.initializer){Oe.push(String(Ot)),Ot+=1;continue}let jt=Nd(Ft.initializer);if(jt===void 0)return;Oe.push(typeof jt==="string"?JSON.stringify(jt):String(jt)),Ot=typeof jt==="number"?jt+1:Ot}return Oe.join(" | ")}function Hr(K,ee,Oe,Ot){let Ft=Sd(K.text,Oe),jt=Ft?Cd(Ft):void 0,Gt=Ft?Nn().extractJsDocReturnType(Ft):void 0,{deprecated:Mt,tags:Vt,internal:Wt}=Ft?Nn().extractJsDocDeprecatedAndTags(Ft):{deprecated:void 0,tags:void 0,internal:!1},Kt={description:jt,deprecated:Mt,tags:Vt,...Wt?{internal:!0}:{},declFile:K.filePath},Ht=(zt,Xt,Yt=!1)=>zt?[{name:zt,...Xt,...Kt,isTypeOnly:Yt}]:[],qt=(zt,Xt)=>wp(K,zt)??Gt??re(Xt)??Ap(zt);if(ee.type==="VariableDeclaration"){let zt=ee.kind==="let"||ee.kind==="var"?ee.kind:"const";return ee.declarations.flatMap((Xt)=>{let Yt=Xt.id,Jt=gn(Yt);if(!Jt)return[];let tn=bd(K,Yt),sn=tn,ln,cn,un,On,zn,Bn,yn=Xt.init;if(yn)if(yn.type==="ArrowFunctionExpression"||yn.type==="FunctionExpression"){if(Bn=yn,cn=qt(yn,sn),!sn)sn=Kr(K,yn,cn)}else{if(ln=ti(K,yn),!sn)sn=Tp(yn);let Zt=b(yn);if(un=w(Zt)??kd(Zt,Jt),zt==="const")On=Td(K,Zt),zn=$d(tn,Ft)}return Ht(Jt,{kind:zt,type:sn,value:ln,returnType:cn,literalValue:un,primitiveLiteral:On,declaredType:zn,functionNode:Bn})})}if(ee.type==="FunctionDeclaration"||ee.type==="TSDeclareFunction"){let zt=qt(ee);return Ht(gn(ee.id)??Ot,{kind:"function",type:Kr(K,ee,zt),returnType:zt,...ee.type==="FunctionDeclaration"?{functionNode:ee}:{}})}if(ee.type==="ClassDeclaration"){let zt=gn(ee.id);return Ht(zt??Ot,{kind:"class",...zt?{type:zt}:{}})}if(ee.type==="TSTypeAliasDeclaration")return Ht(gn(ee.id),{kind:"type",type:ti(K,ee.typeAnnotation)},!0);if(ee.type==="TSInterfaceDeclaration")return Ht(gn(ee.id),{kind:"interface",type:ti(K,ee.body)},!0);if(ee.type==="TSEnumDeclaration"){let zt=gn(ee.id);return Ht(zt,{kind:"enum",type:Dd(ee)??zt})}return[]}function Rd(K,ee,Oe){let Ot=ee.declaration;if(Ot.type==="FunctionDeclaration"||Ot.type==="TSDeclareFunction"||Ot.type==="ClassDeclaration"){let[Gt]=Hr(K,Ot,ee.start,"default");return Gt?{...Gt,name:"default"}:void 0}if(Ot.type==="FunctionExpression"||Ot.type==="ArrowFunctionExpression")return{name:"default",kind:"function",type:Kr(K,Ot,Ap(Ot)),functionNode:Ot,declFile:K.filePath,isTypeOnly:!1};let Ft=gn(Ot),jt=Ft?Oe(Ft):null;return jt?{...jt,name:"default"}:void 0}function Id(K,ee){for(let Oe of K){if(Oe.type!=="ImportDeclaration")continue;let Ot=Oe.source.value;for(let Ft of Oe.specifiers){if(Ft.local.name!==ee)continue;let jt=Oe.importKind==="type"||Ft.type==="ImportSpecifier"&&Ft.importKind==="type";if(Ft.type==="ImportDefaultSpecifier")return{specifier:Ot,importedName:"default",isTypeOnly:jt};if(Ft.type==="ImportNamespaceSpecifier")return{specifier:Ot,importedName:"*",isTypeOnly:jt};if(Ft.type==="ImportSpecifier"){let Gt=gn(Ft.imported)??ee;return{specifier:Ot,importedName:Gt,isTypeOnly:jt}}}}return null}function bp(K,ee,Oe){return{name:K,kind:"const",declFile:ee,namespaceFile:ee,isTypeOnly:Oe}}function ws(K,ee){let Oe=ee.cache.get(K);if(Oe)return Oe;if(ee.computing.has(K))return[];ee.computing.add(K);let Ot=ee.graph.parse(K);if(!Ot)return ee.computing.delete(K),ee.cache.set(K,[]),[];let{source:Ft,body:jt}=Ot,Gt=[],Mt=new Map;for(let qt of jt){let zt=qt.type==="ExportNamedDeclaration"?qt.declaration:qt;if(!zt)continue;for(let Xt of Hr(Ft,zt,zt.start))Mt.set(Xt.name,Xt)}let Vt=(qt,zt)=>({name:qt,kind:"const",declFile:yd(Ft.dir,zt),isTypeOnly:!1}),Wt=(qt)=>{let zt=Mt.get(qt);if(zt)return zt;let Xt=Id(jt,qt);if(!Xt)return null;if(Xt.specifier.endsWith(".svelte"))return Vt(qt,Xt.specifier);let Yt=ee.graph.resolve(Xt.specifier,Ft.dir);if(!Yt)return null;if(Xt.importedName==="*")return bp(qt,Yt,Xt.isTypeOnly);return ni(Yt,Xt.importedName,ee)??null},Kt=new Map;for(let qt of jt){if(qt.type==="ExportAllDeclaration"){let Jt=qt.source.value;if(Jt.endsWith(".svelte"))continue;let tn=ee.graph.resolve(Jt,Ft.dir);if(!tn)continue;let sn=qt.exportKind==="type",ln=gn(qt.exported);if(ln){Gt.push(bp(ln,tn,sn));continue}for(let cn of ws(tn,ee)){let un=Kt.get(cn.name)??[];un.push(sn?{...cn,isTypeOnly:!0}:cn),Kt.set(cn.name,un)}continue}if(qt.type==="ExportDefaultDeclaration"){let Jt=Rd(Ft,qt,Wt);if(Jt)Gt.push(Jt);continue}if(qt.type!=="ExportNamedDeclaration")continue;let zt=qt.declaration;if(zt){Gt.push(...Hr(Ft,zt,qt.start));continue}let Xt=qt.source?.value;if(Xt?.endsWith(".svelte")){for(let Jt of qt.specifiers){let tn=gn(Jt.exported);if(tn)Gt.push(Vt(tn,Xt))}continue}let Yt=qt.exportKind==="type";for(let Jt of qt.specifiers){let tn=gn(Jt.exported),sn=gn(Jt.local);if(!tn||!sn)continue;let ln=Yt||Jt.exportKind==="type",cn=null;if(Xt){let un=ee.graph.resolve(Xt,Ft.dir);if(un)cn=ni(un,sn,ee)??null}else cn=Wt(sn);if(cn)Gt.push({...cn,name:tn,isTypeOnly:cn.isTypeOnly||ln});else if(sn!=="default")Gt.push({name:tn,kind:ln?"type":"const",declFile:K,isTypeOnly:ln})}}let Ht=new Set(Gt.map((qt)=>qt.name));for(let[qt,zt]of Kt){if(Ht.has(qt)||qt==="default")continue;if(zt.every((Xt)=>Xt.declFile===zt[0].declFile))Gt.push(...zt);else ee.onAmbiguousStarExport?.(K,qt,zt)}return ee.computing.delete(K),ee.cache.set(K,Gt),Gt}function ni(K,ee,Oe){return ws(K,Oe).findLast((Ot)=>Ot.name===ee)}function gi(K,{importedName:ee,members:Oe=[]},Ot){let Ft=ni(K,ee,Ot);for(let jt of Oe){if(Ft?.namespaceFile===void 0)return;Ft=ni(Ft.namespaceFile,jt,Ot)}return Ft}function Hn(K,ee,Oe){if(K[ee]===void 0)delete K[ee];K[ee]=Oe}function Ts(K,ee){return(ee.location==="props"?K.props:K.moduleExports).find((Ot)=>Ot.name===ee.propName)}function ks(K,ee){if(ee.location!=="props")return;K.diagnostics=(K.diagnostics??[]).filter((Oe)=>!(Oe.kind==="prop-unknown-type"&&Oe.name===ee.propName))}var Od=/\.[^./\\]+$/;function Ld(K,ee){if(K.endsWith(".d.ts"))return null;let Oe=K.replace(Od,".d.ts");return ee.exists(Oe)?Oe:null}function Md(K,ee,Oe){return ee.map((Ot)=>{if(!Ot.importSource||!Ot.importedName)return{candidate:Ot};let Ft=Oe.graph.resolve(Ot.importSource,K);if(!Ft)return{candidate:Ot,failureReason:"module-not-found"};let jt=ni(Ft,Ot.importedName,Oe);if(!jt)return{candidate:Ot,failureReason:"export-not-found"};if(jt.returnType)return{candidate:Ot,type:jt.returnType};let Gt=Ld(Ft,Oe.graph);if(Gt){let Mt=ni(Gt,Ot.importedName,Oe);if(Mt?.returnType)return{candidate:Ot,type:Mt.returnType}}return{candidate:Ot,failureReason:"return-type-unresolved"}})}function Fd(K,ee){switch(ee){case"module-not-found":return`Prop "${K.propName}" default calls "${K.calleeName}()", but "${K.importSource}" could not be resolved; falling back to "any".`;case"export-not-found":return`Prop "${K.propName}" default calls "${K.calleeName}()", but "${K.importedName}" is not exported from "${K.importSource}"; falling back to "any".`;case"return-type-unresolved":return`Prop "${K.propName}" default calls "${K.calleeName}()" imported from "${K.importSource}", but its return type could not be resolved; falling back to "any".`}}function Bd(K,ee){for(let{candidate:Oe,type:Ot,failureReason:Ft}of ee){let jt=Ts(K,Oe);if(jt?.typeSource!=="unknown")continue;if(Ot){Hn(jt,"type",Ot),Hn(jt,"typeSource","typescript"),ks(K,Oe);continue}if(Oe.location==="props"&&Ft){let Gt=K.diagnostics?.find((Mt)=>Mt.kind==="prop-unknown-type"&&Mt.name===Oe.propName);if(Gt)Gt.message=Fd(Oe,Ft)}}}var Pp={collect:(K)=>K.pendingCallDefaultCandidates?.filter((ee)=>ee.importSource!==void 0)??[],resolve:Md,apply:Bd};function jd(K,ee,Oe){return ee.map((Ot)=>{let Ft=Oe.graph.resolve(Ot.importSource,K);if(!Ft)return{candidate:Ot};let jt=gi(Ft,Ot,Oe);if(!jt?.primitiveLiteral)return{candidate:Ot};return{candidate:Ot,literal:jt.primitiveLiteral,declaredType:jt.declaredType}})}function Vd(K,ee){for(let{candidate:Oe,literal:Ot,declaredType:Ft}of ee){if(!Ot)continue;let jt=Ts(K,Oe);if(!jt)continue;if(Hn(jt,"value",Ot.raw),Hn(jt,"defaultValue",{raw:Ot.raw,kind:"literal",value:Ot.value}),jt.typeSource!=="unknown")continue;Hn(jt,"type",Ft?.type??Ot.type),Hn(jt,"typeSource",Ft?.source??"default"),ks(K,Oe)}}var _p={collect:(K)=>K.pendingConstDefaultCandidates??[],resolve:jd,apply:Vd};function Gd(K,ee,Oe){return ee.map((Ot)=>{let Ft=Oe.graph.resolve(Ot.importSource,K);if(!Ft)return{candidate:Ot};let jt=gi(Ft,Ot,Oe);if(jt?.kind!=="const"||jt.literalValue===void 0)return{candidate:Ot};return{candidate:Ot,key:jt.literalValue}})}function Wd(K,ee){for(let{candidate:Oe,key:Ot}of ee){if(!Ot){let Mt=oe(Oe);pi(K,[a({component:K.filePath,kind:"context-key-unresolved",name:Mt,message:`setContext key \`${Mt}\` from "${Oe.importSource}" isn't an \`export const\` string or Symbol() sveld can read; the context is skipped.`,...Oe.source?{source:Oe.source}:{}})]);continue}let Ft=[...K.contexts??[]],jt=Ft.findIndex((Mt)=>Mt.key===Ot);if(jt!==-1){let Mt=Ft[jt],Vt=$p(Mt.source,Oe.source),Wt=Vt?Mt.source:Oe.source;if(pi(K,[a({component:K.filePath,kind:"context-duplicate-key",name:Ot,message:`setContext("${Ot}", ...) was called more than once; only the first call's shape is used.`,...Wt?{source:Wt}:{}})]),!Vt)continue;Ft.splice(jt,1)}let Gt=Ft.findIndex((Mt)=>$p(Mt.source,Oe.source));Ft.splice(Gt===-1?Ft.length:Gt,0,{key:Ot,typeName:z(Ot),...Oe.type===void 0?{}:{type:Oe.type},description:Oe.description,properties:Oe.properties,...Oe.hasUnresolvedSpread?{hasUnresolvedSpread:!0}:{},...Oe.internal?{internal:!0}:{},source:Oe.source}),K.contexts=Ft}}function $p(K,ee){if(!K||!ee)return!1;let{line:Oe,column:Ot}=K.start;return Oe>ee.start.line||Oe===ee.start.line&&Ot>ee.start.column}var Np={collect:(K)=>K.pendingContextKeyCandidates??[],resolve:Gd,apply:Wd};function Ud(K,ee,Oe){return ee.map((Ot)=>{let Ft=Oe.graph.resolve(Ot.importSource,K);if(!Ft)return{candidate:Ot,failureReason:"module-not-found"};let jt=gi(Ft,Ot,Oe)?.functionNode;if(!jt)return{candidate:Ot,failureReason:"not-a-function"};let Gt=Kd(jt,Ot);if(!Gt)return{candidate:Ot,failureReason:"parameter-not-found"};return zd(jt,Gt,Ot)})}function Dp(K){return K?.type==="AssignmentPattern"?K.left:K}function Kd(K,ee){let Oe=Dp(K.params[ee.argumentIndex]);if(ee.property===void 0)return Oe?.type==="Identifier"?{name:Oe.name}:void 0;if(!ee.property)return;if(Oe?.type==="Identifier")return{object:Oe.name,property:ee.property};if(Oe?.type!=="ObjectPattern")return;for(let Ot of Oe.properties){if(Ot.type!=="Property"||Ot.computed)continue;if(Ot.key.type!=="Identifier"||Ot.key.name!==ee.property)continue;let Ft=Dp(Ot.value);return Ft?.type==="Identifier"?{name:Ft.name}:void 0}return}function qr(K){if(!K)return null;if(K.type==="ConditionalExpression"){let Oe=qr(K.consequent),Ot=qr(K.alternate);return Oe&&Ot?[...Oe,...Ot]:null}let ee=w(K);return ee?[ee]:null}var Hd={variableType:()=>{return}};function qd(K){if(!K)return"null";let{deriveLiteralDetailType:ee,literalDetailToTypeText:Oe}=Nn();if(K.type==="Literal")return Oe(K.value);return ee(Hd,K)??"any"}function Rp(K,ee){if("name"in ee)return K.type==="Identifier"&&K.name===ee.name;if(K.type!=="MemberExpression"||K.computed)return!1;return K.object.type==="Identifier"&&K.object.name===ee.object&&K.property.type==="Identifier"&&K.property.name===ee.property}function zd(K,ee,Oe){let Ot=new Map,Ft="name"in ee?ee.name:ee.object,jt;if(o(K.body,{enter(Mt,Vt,Wt){if(Mt.type==="CallExpression"){if(!Rp(Mt.callee,ee))return;let Ht=Mt.arguments,qt=qr(Ht[0]);if(!qt)return jt="dynamic-event-name",x;for(let zt of qt){let Xt=Ot.get(zt)??new Set;Xt.add(qd(Ht[1])),Ot.set(zt,Xt)}return}let Kt=Vt?.type==="CallExpression"&&Wt==="callee";if(Mt.type==="MemberExpression"&&Rp(Mt,ee)&&!Kt)return jt="passed-on",x;if(Mt.type!=="Identifier"||Mt.name!==Ft)return;if(Kt)return;if(!("name"in ee)&&Vt?.type==="MemberExpression"&&Wt==="object")return;if(!G(Mt,Vt))return;return jt="passed-on",x}}),jt)return{candidate:Oe,failureReason:jt};let Gt=Array.from(Ot,([Mt,Vt])=>{let Wt=Array.from(Vt);return{name:Mt,detail:Wt.includes("any")?"any":Wt.join(" | ")}});return{candidate:Oe,events:Gt}}function Xd(K,ee){let Oe=K.members?`"${K.calleeText}"`:K.importedName==="default"?"the default export":`"${K.importedName}"`;switch(ee){case"module-not-found":return`"${K.importSource}" isn't a local module sveld can read`;case"not-a-function":return`${Oe} isn't a function declared in "${K.importSource}"`;case"parameter-not-found":return`no parameter of ${Oe} receives it`;case"dynamic-event-name":return"an event name isn't a string literal";case"passed-on":return`${Oe} passes it on`}}function Jd(K,ee,{deferredEventNoSourceDiagnostics:Oe=[],untypedJsDocEventNames:Ot=[]}){let Ft=new Map,jt=[...K.diagnostics??[]],Gt=!0;for(let{candidate:zt,events:Xt,failureReason:Yt}of ee){if(Yt){Gt=!1,jt.push(a({component:K.filePath,kind:"dispatch-escapes",name:zt.dispatcherName,message:`\`${zt.dispatcherName}\` is passed to \`${zt.calleeText}\`, but sveld couldn't read the events it dispatches: ${Xd(zt,Yt)}. Document them with @event tags.`,...zt.source?{source:zt.source}:{},...zt.ignored?{ignored:!0}:{}}));continue}for(let Jt of Xt??[]){if(Ft.has(Jt.name))continue;Ft.set(Jt.name,{type:"dispatched",name:Jt.name,detail:Jt.detail,...zt.source?{source:zt.source}:{}})}}if(Gt){for(let zt of Oe)if(!Ft.has(zt.name))jt.push(zt)}if(K.diagnostics=jt,Ft.size===0)return;let Mt=new Map,Vt=new Set;for(let zt of K.events)if(zt.type==="dispatched")Vt.add(zt.name);else if(!Mt.has(zt.name))Mt.set(zt.name,zt);let Wt=new Set(Ot),Kt=new Map,Ht=[];for(let zt of Ft.values()){if(Vt.has(zt.name)){if(Wt.has(zt.name)&&zt.detail!==void 0)Kt.set(zt.name,zt.detail);continue}let Xt=Mt.get(zt.name);if(!Xt){Ht.push(zt);continue}let Yt=zt.source??Xt.source;Ht.push({type:"dispatched",name:zt.name,detail:Xt.detail??zt.detail,...Xt.description?{description:Xt.description}:{},...Xt.deprecated===void 0?{}:{deprecated:Xt.deprecated},...Xt.tags?{tags:Xt.tags}:{},...Xt.internal?{internal:!0}:{},...Yt?{source:Yt}:{}})}if(Ht.length===0&&Kt.size===0)return;let qt=new Set(Ht.map((zt)=>zt.name));K.events=[...K.events.filter((zt)=>zt.type==="dispatched"||!qt.has(zt.name)).map((zt)=>{let Xt=zt.type==="dispatched"?Kt.get(zt.name):void 0;return Xt===void 0?zt:{...zt,detail:Xt}}),...Ht].sort(he)}var Ip={collect:(K)=>K.pendingDispatchEscapeCandidates??[],resolve:Ud,apply:Jd};function As(K){return(ee)=>{let Oe=K.collect(ee);if(Oe.length===0)return;return(Ot,Ft,jt)=>K.apply(Ot,K.resolve(Ft,Oe,jt),ee)}}var Qd=[As(Pp),As(_p),As(Np),As(Ip)];async function Op(K,ee,Oe,Ot){let Ft=[];for(let Gt of K){let Mt=Oe(Gt);if(Mt===void 0)continue;let Vt=Qd.flatMap((Wt)=>Wt(Mt)??[]);if(Vt.length>0)Ft.push({component:Gt,passes:Vt})}let jt=new Map;if(Ft.length===0)return jt;await Un();for(let{component:Gt,passes:Mt}of Ft){let Vt=bs(Ot),Wt=Yd(ee(Gt.filePath));for(let Kt of Mt)Kt(Gt,Wt,Vt);jt.set(Gt.filePath,Array.from(Vt.cache.keys()))}return jt}var Zd=/^```([\w-]*)\r?\n([\s\S]*?)\r?\n?```$/,ef=new Set(["","js","jsx","ts","tsx","javascript","typescript"]),tf=new Set(["svelte","html"]);function nf(K){let ee=K.trim();if(ee==="")return null;let Oe=ee.match(Zd);if(Oe){let Ot=Oe[1].toLowerCase(),Ft=Oe[2].trim();if(Ft==="")return null;if(ef.has(Ot))return{kind:"compile",code:Ft};if(tf.has(Ot))return{kind:"syntax",code:Ft};return null}if(ee.startsWith("<"))return null;return{kind:"compile",code:ee}}function Lp(K){if(!K.isFunction)return"any";return`(${(K.params??[]).map((Oe)=>`${Oe.name}${Oe.optional?"?":""}: any`).join(", ")}) => any`}function Ps(K,ee,Oe,Ot,Ft){let jt=(K??[]).filter((Mt)=>Mt.name==="example"),Gt=jt.length>1;return jt.flatMap((Mt,Vt)=>{let Wt=nf(Mt.body);if(Wt===null)return[];return[{id:Gt?`${ee}#${Vt}`:ee,name:Gt?`${Oe} (example ${Vt+1})`:Oe,type:Ot,code:Wt.code,kind:Wt.kind,...Ft?{source:Ft}:{}}]})}function sf(K){let ee=[];for(let Oe of K.props)ee.push(...Ps(Oe.tags,`prop:${Oe.name}`,Oe.name,Lp(Oe),Oe.source));for(let Oe of K.moduleExports)ee.push(...Ps(Oe.tags,`export:${Oe.name}`,Oe.name,Lp(Oe),Oe.source));for(let Oe of K.slots){let Ot=Oe.name??"default";ee.push(...Ps(Oe.tags,`slot:${Ot}`,Ot,"any",Oe.source))}for(let Oe of K.events)ee.push(...Ps(Oe.tags,`event:${Oe.name}`,Oe.name,"any",Oe.source));return ee}function Mp(K,ee){return K.flatMap(({component:Oe,sources:Ot})=>{let Ft=Ot.filter((jt)=>jt.kind===ee);return Ft.length===0?[]:[{component:Oe,sources:Ft}]})}async function rf(K){let{formatParseError:ee,parseSvelte:Oe}=await Un(),Ot=new Map;for(let{component:Ft,sources:jt}of K){let Gt=[];for(let Mt of jt)try{Oe(Mt.code)}catch(Vt){Gt.push(a({component:Ft.filePath,kind:"example-syntax-error",name:Mt.name,message:ee(Vt),...Mt.source?{source:Mt.source}:{}}))}Ot.set(Ft,Gt)}return Ot}async function of(K,ee,Oe){let Ot=await ee.checkExamples(K.map(({component:jt,sources:Gt})=>({moduleName:jt.moduleName,filePath:Oe(jt.filePath),sources:Gt}))),Ft=new Map;for(let{component:jt,sources:Gt}of K){let Mt=Ot.get(Oe(jt.filePath));if(!Mt||Mt.length===0)continue;let Vt=new Map(Gt.map((Wt)=>[Wt.id,Wt.source]));Ft.set(jt,Mt.map((Wt)=>{let Kt=Vt.get(Wt.id);return a({component:jt.filePath,kind:"example-compile-error",name:Wt.name,message:Wt.message,...Kt?{source:Kt}:{}})}))}return Ft}async function Fp(K,ee,Oe,Ot){let Ft=Array.from(K,(Wt)=>({component:Wt,sources:sf(Wt)})),jt=ee===!0?Mp(Ft,"compile"):[],Gt=Mp(Ft,"syntax"),Mt=new Map,Vt=(Wt)=>{for(let[Kt,Ht]of Wt)Mt.set(Kt,[...Mt.get(Kt)??[],...Ht])};if(Gt.length>0)Vt(await rf(Gt));if(jt.length>0){let{TypeResolver:Wt}=await import("./chunk-tm3wwspf.js"),Kt=await Wt.create(Oe);if(!Kt.ok)throw Error(`sveld: \`checkExamples\` ${Kt.message}.`);let Ht=Kt.resolver;try{Vt(await of(jt,Ht,Ot))}finally{await Ht.dispose()}}return Mt}import{hash as af}from"node:crypto";import{mkdirSync as pf,readFileSync as cf,renameSync as lf,writeFileSync as Bp}from"node:fs";import{dirname as jp,isAbsolute as uf,join as hf,resolve as zr}from"node:path";var Vp=11,df=hf("node_modules",".cache","sveld","parse-cache.json"),ff="35a19c95cb8f692d";function Gp(){return`${ls}+${ff}+svelte@${_i}`}function mf(K){let ee=j(K,["package.json"]);return ee===null?zr(K):jp(ee)}function Wp(K,ee){let Oe=mf(K);if(typeof ee==="string")return uf(ee)?ee:zr(Oe,ee);return zr(Oe,df)}function _s(K){return af("sha256",K,"hex")}function Xr(){return{formatVersion:Vp,toolchainVersion:Gp(),entries:{}}}function gf(K){try{let ee=JSON.parse(cf(K,"utf-8"));if(ee.formatVersion!==Vp||ee.toolchainVersion!==Gp())return Xr();return ee}catch{return Xr()}}class Jr{cacheFilePath;file;next=new Map;dirty=!1;savedEntryCount;constructor(K){this.cacheFilePath=K,this.file=gf(K),this.savedEntryCount=Object.keys(this.file.entries).length}has(K,ee){return this.lookup(K,ee)!==void 0}lookup(K,ee){let Oe=this.next.get(K);if(Oe?.hash===ee)return Oe;let Ot=this.file.entries[K];return Ot?.hash===ee?Ot:void 0}get(K,ee){let Oe=this.lookup(K,ee);if(Oe===void 0)return null;this.next.set(K,Oe);let{component:Ot,typeScriptMetadata:Ft,propIgnores:jt,pending:Gt}=structuredClone({component:Oe.component,typeScriptMetadata:Oe.typeScriptMetadata,propIgnores:Oe.propIgnores,pending:Oe.pending});if(Ft!==void 0)Ot[T]=Ft;if(jt!==void 0)Ot[I]=jt;return Gt===void 0?{component:Ot}:{component:Ot,pending:Gt}}set(K,ee,{component:Oe,pending:Ot}){this.dirty=!0,this.next.set(K,{hash:ee,...structuredClone({component:Oe,typeScriptMetadata:Oe[T],propIgnores:Oe[I],pending:Ot})})}getGeneratedText(K,ee){let Oe=this.next.get(K);if(Oe?.generatedText===void 0||Oe.generatedText.key!==ee)return;return Oe.generatedText.text}setGeneratedText(K,ee,Oe){let Ot=this.next.get(K);if(Ot===void 0)return;if(Ot.generatedText?.key===ee&&Ot.generatedText.text===Oe)return;Ot.generatedText={key:ee,text:Oe},this.dirty=!0}save(){if(!this.dirty&&this.next.size===this.savedEntryCount)return;this.dirty=!1,this.savedEntryCount=this.next.size,pf(jp(this.cacheFilePath),{recursive:!0});let K={...Xr(),entries:Object.fromEntries(this.next)},ee=JSON.stringify(K),Oe=`${this.cacheFilePath}.${process.pid}.tmp`;try{Bp(Oe,ee),lf(Oe,this.cacheFilePath)}catch{try{Bp(this.cacheFilePath,ee)}catch{}}}}import{dirname as yf,relative as xf,resolve as vf}from"node:path";async function Up(K,ee={}){await Un();let Oe=vf(K),Ot=yf(Oe),Ft=(Mt)=>n(`./${xf(Ot,Mt)}`),jt=ws(Oe,{...bs(ee.graph??new Kn),onAmbiguousStarExport:(Mt,Vt,Wt)=>{if(Mt!==Oe||!ee.diagnostics)return;if(Wt.every((zt)=>zt.declFile.endsWith(".svelte")))return;let Kt=Array.from(new Set(Wt.map((zt)=>Ft(zt.declFile)))),Ht=Kt.map((zt)=>`"${zt}"`),qt=`${Ht.slice(0,-1).join(", ")} and ${Ht[Ht.length-1]}`;ee.diagnostics.push(a({component:Ft(Oe),kind:"export-ambiguous",name:Vt,message:`"${Vt}" is exported by ${qt} through \`export *\`, so the barrel doesn't export it and the docs leave it out; export it explicitly from the barrel (e.g. \`export { ${Vt} } from "${Kt[0]}"\`).`}))}}),Gt=new Map;for(let Mt of jt){if(Mt.name==="default"||Mt.declFile.endsWith(".svelte"))continue;let{declFile:Vt,returnType:Wt,literalValue:Kt,primitiveLiteral:Ht,declaredType:qt,functionNode:zt,namespaceFile:Xt,...Yt}=Mt,Jt=Ft(Vt);if(Xt!==void 0)Yt.type=`typeof import(${JSON.stringify(Ft(Xt))})`;Gt.set(Mt.name,{...Yt,source:Jt})}return Array.from(Gt.values()).sort((Mt,Vt)=>u(Mt.name,Vt.name))}async function Cf(K){let ee=await Promise.all(Array.from(K,async(Oe)=>{try{return[Oe,await Sf(Oe,"utf-8")]}catch(Ot){return console.warn(`Warning: Failed to read file ${Oe}:`,Ot),[Oe,null]}}));return new Map(ee)}function Hp(K){if(K.length===0)return;console.error(`sveld: failed to parse ${K.length} component(s):`);for(let{filePath:ee,message:Oe}of K)console.error(` - ${ee}: ${Oe}`)}class Li{input;glob;options;graph=new Kn;collected;entryFile=null;globMergeState;cache;entryExports=[];entryDiagnostics=[];records=new Map;parseErrors=new Map;canonicalEntries=new Map;warnedModuleNames=new Set;constructor(K,ee,Oe={}){this.input=K,this.glob=ee,this.options=Oe}get documentExports(){return this.options.documentExports===!0}async build(){return this.graph=new Kn,this.collected=Ur(this.input,this.glob,this.documentExports,this.graph),this.globMergeState=Cs(this.collected.allComponentEntries,this.collected.resolveComponentFilePath),this.entryFile=Ef(this.input).isFile()?Kp(this.input):null,this.cache=this.options.cache===!1?void 0:new Jr(Wp(this.collected.rootDir,this.options.cache??!0)),await this.readEntryExports(),this.records.clear(),this.parseErrors.clear(),this.indexEntries(),await this.process(this.componentPaths()),Hp(Array.from(this.parseErrors.values())),this.assemble()}async update(K){let ee=K.map((Wt)=>Kp(Wt));if(this.graph.invalidate(...ee),ee.length===0)return{result:this.assemble(),reparsed:[]};let Oe=this.entryFile!==null&&ee.includes(this.entryFile)?await this.recollect():[];if(this.glob){let{rootDir:Wt,exports:Kt,allComponentEntries:Ht,resolveComponentFilePath:qt}=this.collected;Wr(this.graph,Wt,Kt,Ht,qt,this.globMergeState)}this.indexEntries();let Ot=this.componentPaths();for(let Wt of this.records.keys())if(!Ot.has(Wt))this.records.delete(Wt);for(let Wt of this.parseErrors.keys())if(!Ot.has(Wt))this.parseErrors.delete(Wt);let Ft=Array.from(this.records).flatMap(([Wt,{crossFileReads:Kt}])=>Kt?.some((Ht)=>ee.includes(Ht))?[Wt]:[]),jt=new Set([...ee.filter((Wt)=>Pn.test(Wt)),...Oe,...Ft]),Gt=new Set(Array.from(Ot).filter((Wt)=>jt.has(Wt))),Mt=await this.process(Gt),Vt=this.assemble();return Hp(Vt.errors),{result:Vt,reparsed:Mt}}async recollect(){let K=this.collected,ee=Ur(this.input,this.glob,this.documentExports,this.graph),Oe=[];for(let[Ot,Ft]of Object.entries(ee.exports)){let jt=ee.resolveComponentFilePath(Ft.source),Gt=Object.hasOwn(K.exports,Ot)?K.exports[Ot]:void 0;if(Gt===void 0||K.resolveComponentFilePath(Gt.source)!==jt)Oe.push(jt)}return this.collected=ee,this.globMergeState=Cs(ee.allComponentEntries,ee.resolveComponentFilePath),await this.readEntryExports(),Oe}async readEntryExports(){this.entryDiagnostics=[],this.entryExports=this.documentExports&&this.entryFile!==null?await Up(this.entryFile,{diagnostics:this.entryDiagnostics,graph:this.graph}):[]}componentPaths(){let{exports:K,allComponentEntries:ee,resolveComponentFilePath:Oe}=this.collected,Ot=new Set;for(let[,Ft]of[...Object.entries(K),...ee])if(di(Ft.source))Ot.add(Oe(Ft.source));return Ot}indexEntries(){let{exports:K,allComponentEntries:ee,resolveComponentFilePath:Oe}=this.collected;this.canonicalEntries=new Map;for(let Ot of[Object.entries(K),ee])for(let Ft of Ot){if(!di(Ft[1].source))continue;this.canonicalEntries.set(Oe(Ft[1].source),this.entryIdentity(Ot,Ft))}}entryIdentity(K,[ee,{source:Oe}]){return{moduleName:Cp(ee,Oe,K.length,this.warnedModuleNames),filePath:n(Oe)}}canonicalEntry(K){let ee=this.canonicalEntries.get(K);if(ee===void 0)throw Error(`sveld: no entry lists ${K}.`);return ee}async process(K){let ee=new Map,Oe=await this.parse(K,ee);this.cache?.save();let Ot=await this.settle(Oe);for(let Ft of K)this.records.delete(Ft),this.parseErrors.delete(Ft);for(let[Ft,jt]of Ot)this.records.set(Ft,jt);for(let[Ft,jt]of ee)this.parseErrors.set(Ft,jt);return Array.from(Ot.keys())}async parse(K,ee){let Oe=await Cf(K),Ot=this.cache,Ft=new Map,jt=new Set;if(Ot)for(let[Mt,Vt]of Oe){if(Vt===null)continue;let Wt=_s(Vt);if(Ft.set(Mt,Wt),!Ot.has(Mt,Wt))jt.add(Mt)}if(K.size>0&&(!Ot||jt.size>0))await Un();let Gt=new Map;for(let Mt of K){let Vt=Oe.get(Mt);if(Vt===null||Vt===void 0)continue;let Wt=this.parseOne(Mt,Vt,Ft.get(Mt),ee);if(Wt)Gt.set(Mt,Wt)}return Gt}parseOne(K,ee,Oe,Ot){let Ft=Oe===void 0?null:this.cache?.get(K,Oe);if(Ft)return Ft;let{moduleName:jt,filePath:Gt}=this.canonicalEntry(K),Mt;try{Mt=new(Nn()).ComponentParser().parse(ee,{moduleName:jt,filePath:Gt})}catch(Vt){if(this.options.failFast)throw Vt;Ot.set(K,{filePath:Gt,moduleName:jt,message:Vt instanceof Error?Vt.message:String(Vt),stack:Vt instanceof Error?Vt.stack:void 0});return}if(Oe!==void 0)this.cache?.set(K,Oe,Mt);return Mt}async settle(K){let{rootDir:ee,resolveComponentFilePath:Oe}=this.collected,Ot=new Map,Ft=new Map;for(let[Vt,{component:Wt,pending:Kt}]of K){let Ht={...this.canonicalEntry(Vt),...Wt};Ot.set(Vt,Ht),Ft.set(Ht,Kt)}let{checkExamples:jt}=this.options;if(jt){let Vt=await Fp(Ot.values(),jt,ee,Oe);for(let[Wt,Kt]of Vt)pi(Wt,Kt)}let Gt=await Op(Ot.values(),Oe,(Vt)=>Ft.get(Vt),this.graph),Mt=new Map;for(let[Vt,Wt]of Ot){let{moduleName:Kt,filePath:Ht,...qt}=Wt,zt=Gt.get(Ht);Mt.set(Vt,zt===void 0?{component:qt}:{component:qt,crossFileReads:zt})}return Mt}assemble(){let{exports:K,allComponentEntries:ee,resolveComponentFilePath:Oe}=this.collected,Ot=this.cache,Ft=(Ht,qt)=>{let{source:zt}=qt[1];if(!di(zt))return;let Xt=this.records.get(Oe(zt));if(Xt===void 0)return;return{component:{...this.entryIdentity(Ht,qt),...Xt.component},record:Xt}},jt=new Map,Gt=Ot?new Map:void 0,Mt=Ot?new Map:void 0;for(let Ht of ee){let qt=Ft(ee,Ht);if(qt===void 0)continue;let{filePath:zt}=qt.component;jt.set(zt,qt.component),(qt.record.crossFileReads===void 0?Gt:Mt)?.set(zt,Oe(Ht[1].source))}let Vt=tp(jt,Oe,this.graph);for(let Ht of jt.values())pi(Ht,[...Vt(Ht),...ep(Ht)]);let Wt=new Map,Kt=Object.entries(K);for(let Ht of Kt){let qt=Ft(Kt,Ht);if(qt===void 0)continue;let zt=jt.get(qt.component.filePath);if(zt)qt.component.diagnostics=zt.diagnostics;Wt.set(qt.component.moduleName,qt.component)}return{exports:K,entryExports:this.entryExports,components:Wt,allComponentsForTypes:jt,errors:Array.from(this.parseErrors.values()),diagnostics:wo(ko([...Array.from(jt.values()).flatMap((Ht)=>Ht.diagnostics??[]),...this.entryDiagnostics]),this.options.diagnostics?.ignore),cache:Ot,resolvedPathByFilePath:Gt,crossFileResolvedPathByFilePath:Mt}}}function Mi(K){return{failFast:K?.failFast,documentExports:K?.documentExports===!0,cache:K?.cache,checkExamples:K?.checkExamples==="syntax"?"syntax":K?.checkExamples===!0,diagnostics:K?.diagnostics}}async function Fi(K,ee,Oe={}){return new Li(K,ee,Oe).build()}import{existsSync as Yr,readFileSync as bf}from"node:fs";import{isAbsolute as wf,join as zp}from"node:path";var Bi='sveld: could not resolve a Svelte entry point. Set package.json#svelte, or pass the "entry" option.';function qp(K){return wf(K)?K:zp(process.cwd(),K)}function Re(K){if(K){let Ft=qp(K);if(Yr(Ft))return{entry:Z(K)};return{entry:null,configured:!0,message:`Invalid entry point: ${Ft}. Pass a valid --entry (or "entry" option), or unset it and set the "svelte" field in your package.json instead.`}}let ee=zp(process.cwd(),"package.json");if(!Yr(ee))return{entry:null,configured:!1,message:'Could not locate a package.json file. Specify an entry point with --entry (or the "entry" option).'};let Oe;try{Oe=ap(JSON.parse(bf(ee,"utf-8")))}catch(Ft){throw console.error("Error reading package.json:",Ft),Ft}let Ot=Oe.svelte?.trim();if(!Ot)return{entry:null,configured:!1,message:'Could not determine an entry point. Set the "svelte" field in your package.json, or pass --entry (or the "entry" option).'};if(!Yr(qp(Ot)))return{entry:null,configured:!0,message:`The "svelte" field in package.json points to "${Ot}", which does not exist.`};return{entry:Z(Ot)}}function $s(K){let ee=Re(K);if(ee.entry===null)console.error(ee.message);return ee.entry}async function Xp(K,ee,Oe={}){let Ot=new Li(K,ee,{...Oe,failFast:!1}),Ft=await Ot.build();return{get result(){return Promise.resolve(Ft)},async update(jt){let Gt=await Ot.update(jt);return Ft=Gt.result,Gt}}}import Zr from"node:path";function Jp(K){let ee=new Map,Oe=[];for(let[Ot,Ft]of Object.entries(K)){if(Ft.star){Oe.push(`export * from "${Ft.source}";`);continue}let jt=ee.get(Ft.source)??[];jt.push({id:Ot,exportee:Ft}),ee.set(Ft.source,jt)}for(let[Ot,Ft]of ee){let jt=Pn.test(Ot),Gt=Ft.some(({id:qt,exportee:zt})=>qt!=="default"&&zt.default),Mt=Ft.some(({exportee:qt})=>!qt.default),Vt=jt&&Gt&&Mt,Wt=[],Kt=[],Ht=[];for(let{id:qt,exportee:zt}of Ft){if(qt==="default"){Kt.push(`export { default } from "${Ot}";`);continue}if(zt.default)if(zt.mixed)Kt.push(`export { default as ${qt} } from "${Ot}";`),Kt.push(`export { default } from "${Ot}";`);else Ht.push(`default as ${qt}`);else if(jt&&!Vt)Ht.push(`default as ${qt}`);else Wt.push(qt)}if(Ht.length>0&&Wt.length>0)Oe.push(`export { ${[...Ht,...Wt].join(", ")} } from "${Ot}";`);else{if(Wt.length>0)Oe.push(`export { ${Wt.join(", ")} } from "${Ot}";`);if(Ht.length>0)Oe.push(`export { ${Ht.join(", ")} } from "${Ot}";`)}Oe.push(...Kt)}return Oe.join(`
|
|
138
|
+
`)}function Yp(K){return K.filter((ee)=>ee.names.length>0).map((ee)=>`export type { ${ee.names.join(", ")} } from "${ee.source}";`).join(`
|
|
139
|
+
`)}function Qp(K){return K.replace(Pn,"")}function Qr(K){return K.replace(Pn,".svelte.d.ts")}import{mkdir as Tf,readFile as kf,writeFile as Af}from"node:fs/promises";import{parse as Pf}from"node:path";class In{ensuredDirs=new Set;async write(K,ee){try{if(await kf(K,"utf-8")===ee)return!1}catch{}let Oe=Pf(K).dir;if(!this.ensuredDirs.has(Oe))await Tf(Oe,{recursive:!0}),this.ensuredDirs.add(Oe);return await Af(K,ee),!0}}function _f(K){return r(K)&&!Array.isArray(K)&&"start"in K&&"end"in K}function eo(K){if(Array.isArray(K))return K.map((ee)=>eo(ee));if(r(K)){let ee={};for(let[Oe,Ot]of Object.entries(K)){if((Oe==="source"||Oe==="componentCommentSource")&&_f(Ot))continue;ee[Oe]=eo(Ot)}return ee}return K}function $f(K,ee,Oe){if(!ee)return`${K.moduleName}.api.json`;if(!Oe.has(K.moduleName))Oe.add(K.moduleName),console.warn(`Warning: multiple components named "${K.moduleName}" found. Their JSON files are keyed by source path instead of name to avoid overwriting each other.`);return`${Qp(K.filePath)}.api.json`}async function Nf(K,ee,Oe){let Ot=Ns(K,{inputDir:ee.inputDir,source:ee.source}).components,Ft=new Map;for(let Mt of Ot)Ft.set(Mt.moduleName,(Ft.get(Mt.moduleName)??0)+1);let jt=new Set,Gt=new In;await Promise.all(Ot.map(async(Mt)=>{let Vt=(Ft.get(Mt.moduleName)??0)>1,Wt=$f(Mt,Vt,jt),Kt=Zr.resolve(Zr.join(Oe,Wt)),Ht=await Gt.write(Kt,Pi(Mt));Fn(`${Ht?"created":"unchanged"} "${Kt}".`)}))}function Ns(K,ee){let Oe=h(K,{entryExports:ee.entryExports}),Ot={...Oe,components:Oe.components.map((Ft)=>({...Ft,filePath:ma(Ft.filePath,ee.inputDir)}))};return ee.source===!1?eo(Ot):Ot}function to(K,ee){return Pi(Ns(K,ee))}async function no(K,ee){if(ee.outDir){await Nf(K,ee,ee.outDir);return}let Oe=await new In().write(Zr.resolve(ee.outFile),to(K,ee));Fn(`${Oe?"created":"unchanged"} "${ee.outFile}".`)}import{join as xc,resolve as co}from"node:path";var Zp=/`/g,ec=/\s+/g,qn="--",tc=`| Prop name | Required | Kind | Reactive | Binding | Type | Default value | Description |
|
|
140
140
|
| :- | :- | :- | :- | :- | :- | :- | :- |
|
|
141
|
-
`,
|
|
141
|
+
`,nc=`| Slot name | Default | Props | Fallback | Description |
|
|
142
142
|
| :- | :- | :- | :- | :- |
|
|
143
|
-
`,
|
|
143
|
+
`,ic=`| Event name | Type | Detail | Description |
|
|
144
144
|
| :- | :- | :- | :- |
|
|
145
|
-
`,
|
|
145
|
+
`,io=`| Name | Kind | Type | Description |
|
|
146
146
|
| :- | :- | :- | :- |
|
|
147
|
-
`,
|
|
147
|
+
`,Df=`| Member | Signature | Description |
|
|
148
148
|
| :- | :- | :- |
|
|
149
|
-
`,
|
|
149
|
+
`,sc=`| Part name | Description |
|
|
150
150
|
| :- | :- |
|
|
151
|
-
`,
|
|
151
|
+
`,rc=`| Property name | Type | Default value | Description |
|
|
152
152
|
| :- | :- | :- | :- |
|
|
153
|
-
`,
|
|
154
|
-
`)?K.replace(
|
|
155
|
-
`))});if(!
|
|
156
|
-
`),Ot=[],Ft=[];for(let jt=0;jt<Oe.length;jt++){let Gt=
|
|
157
|
-
`)}),Ft=[""]}if(Ft.length>1||Ot.length===0)Ot.push(ee(Ft));return Ot}function
|
|
158
|
-
`);if(jt)Ot(jt);for(let Mt of
|
|
153
|
+
`,oc=/\|/g,Rf=/</g,If=/>/g,Ds=/\n/g,Of=/^[A-Za-z_$][\w$]*$/,Lf=/\s*\n\s*/g,Mf=/&(?=#?\w+;)|<(?=[A-Za-z/!?])|[|`*]|\\(?=[!-/:-@[-`{-~])|(?<![A-Za-z0-9])_|_(?![A-Za-z0-9])/g,Ff=/[&<|`*\\_]/;function so(K){if(!Ff.test(K))return K;return K.replace(Mf,(ee)=>ee==="&"?"&":ee==="<"?"<":ee==="_"?"_":`&#${ee.charCodeAt(0)};`)}function Bf(K){return`<code>${so(K.includes(`
|
|
154
|
+
`)?K.replace(Lf," "):K)}</code>`}var jf=/\{@link\s+([^{}\s|]+)(?:\|([^{}]+))?\}/g;function Vf(K){if(!K.includes("{@link"))return K;return K.replace(jf,(ee,Oe,Ot)=>`[${Ot===void 0?Oe:Ot.trim()}](${Oe})`)}function Gf(K){return K.includes("```")||K.includes("~~~")}function Wf(K){return lc(Vf(K))}var Uf=/^([ \t]*)(`{3,}|~{3,})(.*)$/,Kf=/^\n/,Hf=/\n$/;function ac(K){let ee=(jt)=>({kind:"prose",text:Wf(jt.join(`
|
|
155
|
+
`))});if(!Gf(K))return[ee([K])];let Oe=K.split(`
|
|
156
|
+
`),Ot=[],Ft=[];for(let jt=0;jt<Oe.length;jt++){let Gt=Uf.exec(Oe[jt]),[,Mt="",Vt="",Wt=""]=Gt??[];if(!Gt||Vt[0]==="`"&&Wt.includes("`")){Ft.push(Oe[jt]);continue}if(Ft.push(""),Ft.length>1)Ot.push(ee(Ft));let Kt=[],Ht=new RegExp(`^[ \\t]*${Vt[0]}{${Vt.length},}[ \\t]*$`);for(jt++;jt<Oe.length&&!Ht.test(Oe[jt]);jt++){let qt=Oe[jt],zt=0;while(zt<Mt.length&&(qt[zt]===" "||qt[zt]==="\t"))zt++;Kt.push(qt.slice(zt))}Ot.push({kind:"code",code:Kt.join(`
|
|
157
|
+
`)}),Ft=[""]}if(Ft.length>1||Ot.length===0)Ot.push(ee(Ft));return Ot}function pc(K){let ee="";for(let Oe=0;Oe<K.length;Oe++){let Ot=K[Oe];if(Ot.kind==="code"){ee+=`<pre><code>${so(Ot.code).replace(Ds,"<br />")}</code></pre>`;continue}let Ft=Ot.text;if(K[Oe-1]?.kind==="code")Ft=Ft.replace(Kf,"");if(K[Oe+1]?.kind==="code")Ft=Ft.replace(Hf,"");ee+=Ft.replace(oc,"|").replace(Ds,"<br />")}return ee}function Sn(K){if(K===void 0)return qn;return Bf(K)}function cc(K){if(!K.reExport)return Sn(K.type);let{from:ee,imported:Oe}=K.reExport,Ot=Oe==="*"?"":Of.test(Oe)?`.${Oe}`:`[${JSON.stringify(Oe)}]`;return Sn(`typeof import(${JSON.stringify(ee)})${Ot}`)}function lc(K){if(!K.includes("<")&&!K.includes(">"))return K;return K.replace(Rf,"<").replace(If,">")}function ii(K,ee){if(ee===void 0)return K;let Oe=typeof ee==="string"&&ee.trim().length>0?`: ${lc(ee).replace(Ds," ").replace(oc,"|")}`:"";return`<s>${K}</s><br />**Deprecated**${Oe}`}function Rs(K){if(K===void 0||K.trim().length===0)return qn;return pc(ac(K))}function uc(K){if(K===void 0||K==="{}"||K==="Record<string, never>")return qn;return Sn(K.trim())}function hc(K){if(K===void 0)return qn;return`<code>${so(K).replace(Ds,"<br />")}</code>`}function yi(K,ee){let Oe=[],Ot=(jt)=>{let Gt=Oe.at(-1);if(Gt?.kind==="prose")Gt.text+=jt;else Oe.push({kind:"prose",text:jt})},Ft=(jt,Gt)=>{if(Oe.length>0)Ot(`
|
|
158
|
+
`);if(jt)Ot(jt);for(let Mt of ac(Gt))if(Mt.kind==="prose")Ot(Mt.text);else Oe.push(Mt)};if(K?.trim())Ft("",K);for(let{name:jt,body:Gt}of ee??[]){let Mt=Gt?.trim();Ft(Mt?`@${jt} `:`@${jt}`,Mt??"")}if(Oe.length===0)return qn;return pc(Oe)}function dc(K){return Sn(K)}function qf(K){let ee=[K.extends?`Extends ${Sn(K.extends)}.`:"",K.implements?.length?`Implements ${K.implements.map((Oe)=>Sn(Oe)).join(", ")}.`:""].filter(Boolean);return ee.length>0?ee.join(" "):void 0}function fc(K,ee){let Oe=new Set;for(let Ot of ee){if(Ot.kind!=="class")continue;let Ft=qf(Ot);if(!Ot.members?.length&&!Ft)continue;let jt=Ot.localName??Ot.name;if(Oe.has(jt))continue;if(Oe.add(jt),K.append("h4",`\`${jt}\` members`),Ft)K.append("raw",`${Ft}
|
|
159
159
|
|
|
160
|
-
`);if(!Ot.members?.length)continue;K.append("raw",
|
|
160
|
+
`);if(!Ot.members?.length)continue;K.append("raw",Df);for(let Gt of Ot.members)K.append("raw",`| ${ii(Gt.name,Gt.deprecated)} | ${Sn($r(Gt))} | ${yi(Gt.description,Gt.tags)} |
|
|
161
161
|
`);K.append("raw",`
|
|
162
|
-
`)}}function
|
|
162
|
+
`)}}function mc(K,ee,Oe){if(K.append("h1","Component Index"),K.append("h2","Components").tableOfContents(),K.append("divider"),Oe&&Oe.length>0)yc(K,Oe);for(let Ot of h(ee).components)oo(K,Ot)}function gc(K,ee,Oe){K.append("h1","Component Index"),K.append("h2","Components");for(let Ot of ee)K.append("raw",`- [${Ot.moduleName}](./${Ot.moduleName}.md)
|
|
163
163
|
`);if(K.append("raw",`
|
|
164
|
-
`),K.append("divider"),Oe&&Oe.length>0)
|
|
164
|
+
`),K.append("divider"),Oe&&Oe.length>0)yc(K,Oe)}function yc(K,ee){K.append("h2","Exports"),K.append("raw",io);for(let Oe of ee){let Ot=(Oe.type??Oe.value)?.replace(ec," ").trim();K.append("raw",`| ${ii(Oe.name,Oe.deprecated)} | <code>${Oe.kind}</code> | ${Sn(Ot)} | ${Rs(Oe.description)} |
|
|
165
165
|
`)}K.append("raw",`
|
|
166
|
-
`),K.append("divider")}function
|
|
166
|
+
`),K.append("divider")}function zf(K,ee){K.append("h3","Module exports"),K.append("raw",io);for(let Oe of ee)K.append("raw",`| ${ii(Oe.name,Oe.deprecated)} | <code>${Oe.kind}</code> | ${cc(Oe)} | ${yi(Oe.description,Oe.tags)} |
|
|
167
167
|
`);K.append("raw",`
|
|
168
|
-
`),
|
|
169
|
-
`);else K.append("p","None.")}function
|
|
170
|
-
${
|
|
168
|
+
`),fc(K,ee)}function ro(K,ee,Oe){if(ee.length>0)Oe(),K.append("raw",`
|
|
169
|
+
`);else K.append("p","None.")}function oo(K,ee){if(K.append("h2",`\`${ee.moduleName}\``),ee.generics)K.append("p",`**Type parameters:** ${Sn(`<${ee.generics[1]}>`)}`);if(ee.typedefs.length>0)K.append("h3","Types").append("raw",`\`\`\`ts
|
|
170
|
+
${vs({typedefs:ee.typedefs})}
|
|
171
171
|
\`\`\`
|
|
172
172
|
|
|
173
|
-
`);if(K.append("h3","Props"),
|
|
174
|
-
`)}}),ee.moduleExports.length>0)
|
|
175
|
-
`)}),K.append("h3","Events"),
|
|
176
|
-
`)}),ee.cssParts&&ee.cssParts.length>0){K.append("h3","CSS Parts"),K.append("raw",
|
|
173
|
+
`);if(K.append("h3","Props"),ro(K,ee.props,()=>{K.append("raw",tc);let Oe=(Ft)=>Ft.reactive?0:Ft.constant?2:1,Ot=ee.props.map((Ft,jt)=>({prop:Ft,index:jt})).sort((Ft,jt)=>Oe(Ft.prop)-Oe(jt.prop)||Ft.index-jt.index).map(({prop:Ft})=>Ft);for(let Ft of Ot){let jt=Es(Ft)?"accessor":Ft.kind;K.append("raw",`| ${ii(Ft.name,Ft.deprecated)} | ${Ft.isRequired?"Yes":"No"} | <code>${jt}</code> | ${Ft.reactive?"Yes":"No"} | ${Ft.binding??"--"} | ${Sn(Ft.type)} | ${Sn(Ft.value)} | ${yi(Ft.description,Ft.tags)} |
|
|
174
|
+
`)}}),ee.moduleExports.length>0)zf(K,ee.moduleExports);if(K.append("h3","Slots"),ro(K,ee.slots,()=>{K.append("raw",nc);for(let Oe of ee.slots)K.append("raw",`| ${ii(Oe.default?qn:Oe.name??qn,Oe.deprecated)} | ${Oe.default?"Yes":"No"} | ${uc(Oe.slot_props)} | ${hc(Oe.fallback)} | ${yi(Oe.description,Oe.tags)} |
|
|
175
|
+
`)}),K.append("h3","Events"),ro(K,ee.events,()=>{K.append("raw",ic);for(let Oe of ee.events)K.append("raw",`| ${ii(Oe.name,Oe.deprecated)} | ${Oe.type} | ${dc(Oe.detail)} | ${yi(Oe.description,Oe.tags)} |
|
|
176
|
+
`)}),ee.cssParts&&ee.cssParts.length>0){K.append("h3","CSS Parts"),K.append("raw",sc);for(let Oe of ee.cssParts)K.append("raw",`| ${Oe.name} | ${Rs(Oe.description)} |
|
|
177
177
|
`);K.append("raw",`
|
|
178
|
-
`)}if(ee.cssProperties&&ee.cssProperties.length>0){K.append("h3","CSS Custom Properties"),K.append("raw",
|
|
178
|
+
`)}if(ee.cssProperties&&ee.cssProperties.length>0){K.append("h3","CSS Custom Properties"),K.append("raw",rc);for(let Oe of ee.cssProperties)K.append("raw",`| ${Oe.name} | ${Sn(Oe.type)} | ${Sn(Oe.default)} | ${Rs(Oe.description)} |
|
|
179
179
|
`);K.append("raw",`
|
|
180
|
-
`)}}var
|
|
180
|
+
`)}}var Xf=/[^\w\- ]+/g,Jf=/\s+/g,ao="<!-- __TOC__ -->";function Yf(K,ee){let Oe=K.toLowerCase().replace(Zp,"").replace(Xf,"").replace(Jf,"-"),Ot=ee.get(Oe)??0;return ee.set(Oe,Ot+1),Ot===0?Oe:`${Oe}-${Ot}`}class po{sourceParts=[];hasToC=!1;toc=[];onAppend;constructor(K={}){this.onAppend=K.onAppend}get source(){return this.sourceParts.join("")}appendLineBreaks(){return this.sourceParts.push(`
|
|
181
181
|
|
|
182
|
-
`),this}append(K,ee){switch(K){case"h1":case"h2":case"h3":case"h4":case"h5":case"h6":{if(this.sourceParts.push(`${"#".repeat(Number(K.slice(-1)))} ${ee}`),this.hasToC&&K==="h2")this.toc.push({indent:0,raw:ee??""});break}case"quote":this.sourceParts.push(`> ${ee}`);break;case"p":this.sourceParts.push(ee??"");break;case"divider":this.sourceParts.push("---");break;case"raw":this.sourceParts.push(ee??"");break}if(K!=="raw")this.appendLineBreaks();return this.onAppend?.call(this,K,this),this}tableOfContents(){return this.sourceParts.push(
|
|
183
|
-
`);return K.slice(0,ee)+Ot+K.slice(ee+
|
|
184
|
-
${
|
|
182
|
+
`),this}append(K,ee){switch(K){case"h1":case"h2":case"h3":case"h4":case"h5":case"h6":{if(this.sourceParts.push(`${"#".repeat(Number(K.slice(-1)))} ${ee}`),this.hasToC&&K==="h2")this.toc.push({indent:0,raw:ee??""});break}case"quote":this.sourceParts.push(`> ${ee}`);break;case"p":this.sourceParts.push(ee??"");break;case"divider":this.sourceParts.push("---");break;case"raw":this.sourceParts.push(ee??"");break}if(K!=="raw")this.appendLineBreaks();return this.onAppend?.call(this,K,this),this}tableOfContents(){return this.sourceParts.push(ao),this.hasToC=!0,this.appendLineBreaks(),this}end(){let K=this.sourceParts.join("");if(!this.hasToC)return K;let ee=K.indexOf(ao);if(ee===-1)return K;let Oe=new Map,Ot=this.toc.map(({indent:Ft,raw:jt})=>`${" ".repeat(Ft)}- [${jt}](#${Yf(jt,Oe)})`).join(`
|
|
183
|
+
`);return K.slice(0,ee)+Ot+K.slice(ee+ao.length)}}function Is(K,ee){return new po({onAppend:(Oe,Ot)=>{ee?.onAppend?.call(null,Oe,Ot,K)}})}function ji(K,ee){let Oe=Is(K,ee);return mc(Oe,K,ee.entryExports),Oe.end()}async function Qf(K,ee,Oe){let Ot=h(K,{entryExports:ee.entryExports}),Ft=new In,jt=Is(K,ee);gc(jt,Ot.components,ee.entryExports);let Gt=co(xc(Oe,"README.md")),Mt=await Ft.write(Gt,jt.end());Fn(`${Mt?"created":"unchanged"} "${Gt}".`),await Promise.all(Ot.components.map(async(Vt)=>{let Wt=Is(K,ee);oo(Wt,Vt);let Kt=co(xc(Oe,`${Vt.moduleName}.md`)),Ht=await Ft.write(Kt,Wt.end());Fn(`${Ht?"created":"unchanged"} "${Kt}".`)}))}async function lo(K,ee){if(ee.outDir){await Qf(K,ee,ee.outDir);return}let Oe=co(ee.outFile),Ot=await new In().write(Oe,ji(K,ee));Fn(`${Ot?"created":"unchanged"} "${ee.outFile}".`)}import{join as Zf,resolve as em}from"node:path";function tm(K,ee){if(!ee.indexTypes)return[];let Oe=ee.format==="component",Ot=new Set,Ft=[];for(let jt of Object.values(ee.exports)){if(!jt.default||!Pn.test(jt.source))continue;let Gt=n(jt.source);if(Ot.has(Gt))continue;Ot.add(Gt);let Mt=K.components.find((Wt)=>Wt.filePath===Gt);if(!Mt)continue;let Vt=[mi(Mt.moduleName)];if(Oe)Vt.push(Ri(Mt.moduleName));Ft.push({source:jt.source,names:Vt})}return Ft}async function vc(K,ee,Oe){if(!K)return ee;try{let Ot=await K(ee,Oe);if(typeof Ot!=="string")throw TypeError(`must return a string, got ${typeof Ot}`);return Ot}catch(Ot){let Ft=Ot instanceof Error?Ot.message:String(Ot);throw Error(`sveld: typesOptions.transform failed for "${Oe.filePath}": ${Ft}`,{cause:Ot})}}function nm(K,ee){return`${K}
|
|
184
|
+
${Za(ee)}`}async function uo(K,ee){let Oe=em(ee.outDir,"index.d.ts"),Ot=new In,Ft=h(K),jt=Yp(tm(Ft,ee)),Gt=ee.preamble+[Jp(ee.exports),jt].filter((zt)=>zt!=="").join(`
|
|
185
185
|
|
|
186
|
-
`),Mt
|
|
187
|
-
${
|
|
188
|
-
`)})(),Kt=(await Promise.all([...Vt,Wt])).filter(Boolean).length,Ht=Vt.length+1,qt=Kt===0?`unchanged ${Ht}`:`created ${Kt} of ${Ht}`;
|
|
189
|
-
export{
|
|
186
|
+
`),Mt=Nr(ee),Vt=Ft.components.map(async(zt)=>{let Xt=Qr(Zf(ee.outDir,zt.filePath)),Yt=n(Qr(zt.filePath)),Jt=ee.resolvedPathByFilePath?.get(zt.filePath),tn=Jt?void 0:ee.crossFileResolvedPathByFilePath?.get(zt.filePath),sn=Jt??tn,ln=nm(zt.moduleName,Mt),cn=tn?`${ln}
|
|
187
|
+
${_s(JSON.stringify(zt))}`:ln,un=sn?ee.cache?.getGeneratedText(sn,cn):void 0;if(un===void 0){if(un=Dr(zt,Mt),sn)ee.cache?.setGeneratedText(sn,cn,un)}let On=await vc(ee.transform,un,{kind:"component",component:zt,filePath:Yt});return Ot.write(Xt,On)}),Wt=(async()=>{let zt=await vc(ee.transform,Gt,{kind:"index",filePath:"index.d.ts"});return Ot.write(Oe,`${zt}
|
|
188
|
+
`)})(),Kt=(await Promise.all([...Vt,Wt])).filter(Boolean).length,Ht=Vt.length+1,qt=Kt===0?`unchanged ${Ht}`:`created ${Kt} of ${Ht}`;Fn(`${qt} TypeScript definitions in "${ee.outDir}".`)}var im=["reportDiagnostics","strict","check","checkLevel","stdout","format"],sm=50;function rm(K){let ee=Promise.resolve();return()=>{ee=ee.then(K,K)}}function Lt(K){let ee=K?.watch===!0,Oe,Ot,Ft=K??{},jt,Gt=null,Mt,Vt=new Set,Kt=rm(async()=>{if(Gt==null||Ot==null||Vt.size===0)return;let qt=Array.from(Vt);Vt.clear();try{let{result:zt}=await Gt.update(qt);await Vi(zt,Ft,Ot)}catch(zt){console.error("sveld: failed to regenerate types in watch mode:",zt)}}),Ht=(qt)=>{if(!ee||Gt==null||!fa.test(qt))return;Vt.add(qt),clearTimeout(Mt),Mt=setTimeout(Kt,sm)};return{name:"vite-plugin-sveld",apply:ee?void 0:"build",enforce:"post",configResolved(qt){jt=qt.root},async buildStart(){if(K?.config){let zt=await J(K.config,jt??process.cwd(),!1);Ft=R(zt,K)}q(Ft);let qt=im.filter((zt)=>(zt in Ft));if(qt.length>0)console.warn(`sveld: the Vite plugin ignores ${qt.map((zt)=>`"${zt}"`).join(", ")}; run the sveld CLI or sveld() for them.`);if(F(Ft.quiet===!0),Ot=$s(Ft.entry),ee&&Ot!=null)try{Gt=await Xp(Ot,Ft.glob===!0,Mi(Ft)),await Vi(await Gt.result,Ft,Ot)}catch(zt){console.error("sveld: failed to generate initial types in watch mode:",zt)}},async generateBundle(){if(ee)return;if(Ot==null)this.error(Bi);Oe=await Fi(Ot,Ft.glob===!0,Mi(Ft))},async writeBundle(){if(ee)return;if(Ot==null)this.error(Bi);await Vi(Oe,Ft,Ot)},handleHotUpdate(qt){Ht(qt.file)},watchChange(qt){Ht(qt)}}}async function Vi(K,ee,Oe){let Ot=Ec(Oe);if(ee.types!==!1)await uo(K.allComponentsForTypes,{outDir:"types",preamble:"",...ee.typesOptions,exports:K.exports,inputDir:Ot,cache:K.cache,resolvedPathByFilePath:K.resolvedPathByFilePath,crossFileResolvedPathByFilePath:K.crossFileResolvedPathByFilePath});if(ee.json)await no(K.components,{outFile:"COMPONENT_API.json",...ee.jsonOptions,inputDir:Ot,entryExports:K.entryExports});if(ee.markdown)await lo(K.components,{outFile:"COMPONENT_INDEX.md",...ee.markdownOptions,entryExports:K.entryExports});K.cache?.save()}async function Sc(K,ee,Oe){if(ee.json){let Ot=to(K.components,{...ee.jsonOptions,inputDir:Ec(Oe),entryExports:K.entryExports});process.stdout.write(Ot);return}if(ee.markdown){let Ot=ji(K.components,{...ee.markdownOptions,entryExports:K.entryExports});process.stdout.write(Ot)}}import{dirname as om}from"node:path";function am(K){if(K.check&&!K.check.snapshotExists&&!K.writesSnapshot)return 1;if(K.check?.changes.some((ee)=>ee.kind==="schema"))return 1;if(K.errors.length>0)return 2;if(K.check&&Sa(K.check.bump,K.checkLevel??"major"))return 3;if(bo(K.diagnostics,K.strict).length>0)return 4;return 0}async function Ie(K,ee,Oe=!1){let Ot=await Fi(K,ee.glob===!0,Mi(ee)),Ft=ee.check?await Ne(Ot.components,Ca(ee),{entryExports:Ot.entryExports}):void 0;return await(Oe?Sc:Vi)(Ot,ee,K),{result:Ot,check:Ft}}function Le(K,ee,Oe){let Ot=Oe.reportDiagnostics||Oe.strict,Ft=Co(K.diagnostics,Ot);if(Ot&&Ft.length>0)if(Oe.format==="json")process.stderr.write(Po(Ft));else console.error(Ao(Ft));let jt=am({errors:K.errors,check:ee,writesSnapshot:ee?ba(Oe,ee.snapshotFile):!1,checkLevel:Oe.checkLevel,diagnostics:Ft,strict:Oe.strict});return{diagnostics:Ft,exitCode:jt}}async function Bt(K){if(K&&"input"in K)throw Error("sveld: the `input` option was renamed to `entry`.");if(typeof K?.config==="string")throw Error("sveld: `config` takes `true` or `false`; import another config file and pass its options instead.");let{entry:ee,...Oe}=K??{},Ot=await J(Oe.config,process.cwd(),!0),Ft=$s(ee??Ot.entry);if(Ft===null)throw Error(Bi);let jt=R(Ot,Oe,{entry:Ft});q(jt),F(jt.quiet===!0);let{result:Gt,check:Mt}=await Ie(Ft,jt),{diagnostics:Vt,exitCode:Wt}=Le(Gt,Mt,jt),Kt=Ns(Gt.components,{inputDir:om(Ft),entryExports:Gt.entryExports,source:jt.jsonOptions?.source});return{diagnostics:Vt,check:Mt,errors:Gt.errors,document:Kt,exitCode:Wt}}
|
|
189
|
+
export{T,I,te,g,P,xe,U,ne,Ee,G,x,p,o,r,S,t,k,l,d,b,Me,Se,w,c,L,A,i,W,v,C,re,ie,a,H,$e,_,O,y,u,z,se,X,oe,ke,Q,ae,Be,be,ce,Y,m,E,s,pe,le,e,Je,qe,je,Fe,Ve,Ue,Ge,We,He,ze,we,Xe,Qe,ve,Ye,Ze,Ke,et,Ce,De,tt,Pe,nt,rt,D,it,st,ot,at,ct,pt,lt,ut,ft,Ae,dt,mt,ht,gt,yt,Tt,ue,xt,Et,St,_e,kt,bt,wt,vt,f,Ct,Dt,Pt,fe,de,M,At,_t,B,me,he,N,n,Nt,h,Rt,Ne,ge,It,ye,$t,J,R,q,Z,j,F,Te,V,Re,Lt,Ie,Le,Bt};
|