sveld 0.38.6 → 0.38.8

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.
@@ -0,0 +1,189 @@
1
+ var x=Symbol("sveld.parsedComponentTypeScriptMetadata"),R=Symbol("sveld.parsedComponentPropIgnores");function uo(K){return K[R]}function ho(K){return K[x]}var Li=Array(2048).fill(void 0);function Sc(){Li.fill(void 0)}function fo(K,ee,Oe,Ot){let Ft=Ot&2047,jt=Li[Ft];if(jt!==void 0&&jt.length===Oe-ee&&K.startsWith(jt,ee))return jt;let Gt=K.slice(ee,Oe);return Li[Ft]=Gt,Gt}var is="",An=[0],Bn=0,ss=0,jn;function te(K){Sc(),is=K,An=[0],Bn=0,ss=0,jn=void 0}function Oi(K){while(Bn<=K){let ee=is.indexOf(`
2
+ `,Bn);if(ee===-1){Bn=Number.POSITIVE_INFINITY;return}Bn=ee+1,An.push(Bn)}}function bc(K){let ee=[0],Oe=K.indexOf(`
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,Cc=/[\r\u2028\u2029]/;function mo(K){if(jn===void 0){jn=Cc.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 go(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??=bc(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 wc=Object.assign(Object.create(null),rs),Tc=[],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 Pc(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?Tc:rs.Identifier;if(ee==="Literal")return rs.Literal;if(ee==="Text")return rs.Text;return wc[ee]}function Pc(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 $c(K){return r(K)&&K.type==="CallExpression"}function d(K,ee){return $c(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 Ac(K){return r(K)&&K.type==="NewExpression"}function Se(K,ee){return Ac(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 Nc=new Set(["Component","SvelteComponent","SvelteSelf"]),Dc=new Set(["RegularElement","SvelteElement"]);function L(K){return Nc.has(K)}function A(K){return Dc.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=_c(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 _c(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 Rc=new Set(["null","undefined"]);function ie(K){if(!K)return!1;let ee=i(K,"|").map((Ot)=>Ot.trim()).filter((Ot)=>Ot&&!Rc.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 Ic(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 yo(K,ee){return new RegExp(`^${Ic(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 xo(K,ee){if(ee)return K;return K.filter((Oe)=>Oe.kind!=="jsdoc-unknown-tag")}function vo(K,ee){if(!ee)return[];return K.filter((Oe)=>!Oe.ignored&&(ee!=="errors"||Oe.severity==="error"))}function Lc(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&&!yo(ee.component,K.component))return!1;return!0}function Eo(K,ee){if(!ee||ee.length===0)return K;return K.map((Oe)=>Oe.ignored||ee.some((Ot)=>Lc(Oe,Ot))?{...Oe,ignored:!0}:Oe)}var So=Object.keys(Bi),H=Object.fromEntries(So.map((K)=>[K,`sveld/${K}`]));function bo(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 Co(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 So){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 wo(K){return`${JSON.stringify({kind:"diagnostics",schemaVersion:$e,diagnostics:K},null,2)}
6
+ `}function os(K,ee){if(ee.length===0)return;K.diagnostics=[...K.diagnostics??[],...ee]}var Oc=/\*\//g,Mc=/[.*+?^${}()|[\]\\]/g;function _(K){return K.replace(Mc,"\\$&")}function O(K){return K.replace(Oc,"*\\/")}function y(K){return K.map((ee)=>`${ee.name}${ee.optional?"?":""}: ${ee.type}`).join(", ")}var Fc=new Intl.Collator("en");function l(K,ee){return Fc.compare(K,ee)}var jc=/(?:_|[^\p{ID_Continue}$])+/u,Bc=/^[\p{ID_Start}$]/u;function z(K){let Ot=`${K.split(jc).map((Ft)=>Ft.charAt(0).toUpperCase()+Ft.slice(1)).join("")}Context`;return Bc.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 Vi={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"},Gi="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",Vc={5:Gi,"5module":Gi+" export import",6:Gi+" const class extends export import super"},Ao=/^in(stanceof)?$/,Gc=/\p{ID_Start}/u,Wc=/[\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&&Gc.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&&Wc.test(String.fromCodePoint(K))}var on=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 Sn(K,ee){return new on(K,{beforeExpr:!0,binop:ee})}var bn={beforeExpr:!0},yn={startsExpr:!0},Hi={};function rn(K,ee){if(ee===void 0)ee={};return ee.keyword=K,Hi[K]=new on(K,ee)}var Ut={num:new on("num",yn),regexp:new on("regexp",yn),string:new on("string",yn),name:new on("name",yn),privateId:new on("privateId",yn),eof:new on("eof"),bracketL:new on("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new on("]"),braceL:new on("{",{beforeExpr:!0,startsExpr:!0}),braceR:new on("}"),parenL:new on("(",{beforeExpr:!0,startsExpr:!0}),parenR:new on(")"),comma:new on(",",bn),semi:new on(";",bn),colon:new on(":",bn),dot:new on("."),question:new on("?",bn),questionDot:new on("?."),arrow:new on("=>",bn),template:new on("template"),invalidTemplate:new on("invalidTemplate"),ellipsis:new on("...",bn),backQuote:new on("`",yn),dollarBraceL:new on("${",{beforeExpr:!0,startsExpr:!0}),eq:new on("=",{beforeExpr:!0,isAssign:!0}),assign:new on("_=",{beforeExpr:!0,isAssign:!0}),incDec:new on("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new on("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:Sn("||",1),logicalAND:Sn("&&",2),bitwiseOR:Sn("|",3),bitwiseXOR:Sn("^",4),bitwiseAND:Sn("&",5),equality:Sn("==/!=/===/!==",6),relational:Sn("</>/<=/>=",7),bitShift:Sn("<</>>/>>>",8),plusMin:new on("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:Sn("%",10),star:Sn("*",10),slash:Sn("/",10),starstar:new on("**",{beforeExpr:!0}),coalesce:Sn("??",1),_break:rn("break"),_case:rn("case",bn),_catch:rn("catch"),_continue:rn("continue"),_debugger:rn("debugger"),_default:rn("default",bn),_do:rn("do",{isLoop:!0,beforeExpr:!0}),_else:rn("else",bn),_finally:rn("finally"),_for:rn("for",{isLoop:!0}),_function:rn("function",yn),_if:rn("if"),_return:rn("return",bn),_switch:rn("switch"),_throw:rn("throw",bn),_try:rn("try"),_var:rn("var"),_const:rn("const"),_while:rn("while",{isLoop:!0}),_with:rn("with"),_new:rn("new",{beforeExpr:!0,startsExpr:!0}),_this:rn("this",yn),_super:rn("super",yn),_class:rn("class",yn),_extends:rn("extends",bn),_export:rn("export"),_import:rn("import",yn),_null:rn("null",yn),_true:rn("true",yn),_false:rn("false",yn),_in:rn("in",{beforeExpr:!0,binop:7}),_instanceof:rn("instanceof",{beforeExpr:!0,binop:7}),_typeof:rn("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:rn("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:rn("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},xn=/\r\n?|\n|\u2028|\u2029/,Uc=new RegExp(xn.source,"g");function as(K){return K===10||K===13||K===8232||K===8233}function No(K,ee,Oe){if(Oe===void 0)Oe=K.length;for(var Ot=ee;Ot<Oe;Ot++){var Ft=K.charCodeAt(Ot);if(as(Ft))return Ot<Oe-1&&Ft===13&&K.charCodeAt(Ot+1)===10?Ot+2:Ot+1}return-1}var Do=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,un=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,Kc=Object.prototype,{hasOwnProperty:Hc,toString:qc}=Kc,xs=Object.hasOwn||function(K,ee){return Hc.call(K,ee)},To=Array.isArray||function(K){return qc.call(K)==="[object Array]"},ko=Object.create(null);function Ks(K){return ko[K]||(ko[K]=new RegExp("^(?:"+K.replace(/ /g,"|")+")$"))}function Xs(K){if(K<=65535)return String.fromCharCode(K);return K-=65536,String.fromCharCode((K>>10)+55296,(K&1023)+56320)}var zc=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,ys=function(K,ee){this.line=K,this.column=ee};ys.prototype.offset=function(K){return new ys(this.line,this.column+K)};var Js=function(K,ee,Oe){if(this.start=ee,this.end=Oe,K.sourceFile!==null)this.source=K.sourceFile};function _o(K,ee){for(var Oe=1,Ot=0;;){var Ft=No(K,Ot,ee);if(Ft<0)return new ys(Oe,ee-Ot);++Oe,Ot=Ft}}var Wi={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},Po=!1;function Xc(K){var ee={};for(var Oe in Wi)ee[Oe]=K&&xs(K,Oe)?K[Oe]:Wi[Oe];if(ee.ecmaVersion==="latest")ee.ecmaVersion=1e8;else if(ee.ecmaVersion==null){if(!Po&&typeof console==="object"&&console.warn)Po=!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(To(ee.onToken)){var Ot=ee.onToken;ee.onToken=function(Ft){return Ot.push(Ft)}}if(To(ee.onComment))ee.onComment=Jc(ee,ee.onComment);if(ee.sourceType==="commonjs"&&ee.allowAwaitOutsideFunction)throw Error("Cannot use allowAwaitOutsideFunction with sourceType: commonjs");return ee}function Jc(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 Js(this,Gt,Mt);if(K.ranges)Vt.range=[Ft,jt];ee.push(Vt)}}var Jn=1,Yn=2,qi=4,Ro=8,zi=16,Io=32,Ys=64,Lo=128,Qn=256,vs=512,Oo=1024,Qs=Jn|Yn|Qn;function Xi(K,ee){return Yn|(K?qi:0)|(ee?Ro:0)}var Hs=0,Ji=1,On=2,Mo=3,Fo=4,jo=5,s=function(K,ee,Oe){this.options=K=Xc(K),this.sourceFile=K.sourceFile,this.keywords=Ks(Vc[K.ecmaVersion>=6?6:K.sourceType==="module"?"5module":5]);var Ot="";if(K.allowReserved!==!0){if(Ot=Vi[K.ecmaVersion>=6?6:K.ecmaVersion===5?5:3],K.sourceType==="module")Ot+=" await"}this.reservedWords=Ks(Ot);var Ft=(Ot?Ot+" ":"")+Vi.strict;if(this.reservedWordsStrict=Ks(Ft),this.reservedWordsStrictBind=Ks(Ft+" "+Vi.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(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&Ro)>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&Lo)>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&Oo)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,Yc=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;fn.strictDirective=function(K){if(this.options.ecmaVersion<5)return!1;for(;;){un.lastIndex=K,K+=un.exec(this.input)[0].length;var ee=Yc.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"},Qc={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(!Ao.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(Ao.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(Qc),this.enterScope(Oo);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 Zc=[];Yt.parseCatchClauseParam=function(){var K=this.parseBindingAtom(),ee=K.type==="Identifier";return this.enterScope(ee?Io:0),this.checkLValPattern(K,ee?Fo: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,Bo=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&Bo&&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:Mo)}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"&&el(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 el(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|Bo,!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=Zc,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(zc.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!==jo)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 kn=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 kn("{",!1),b_expr:new kn("{",!0),b_tmpl:new kn("${",!1),p_stat:new kn("(",!1),p_expr:new kn("(",!0),q_tmpl:new kn("`",!0,!0,function(K){return K.tryReadTemplateToken()}),f_stat:new kn("function",!1),f_expr:new kn("function",!0),f_expr_gen:new kn("function",!0,!1,null,!0),f_gen:new kn("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"&&Vo(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 Vo(K){return K.type==="Identifier"||K.type==="ParenthesizedExpression"&&Vo(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 tl=[];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=tl;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
+ `),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?Lo: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,jo);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=_o(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,nl=function(K){this.flags=K,this.var=[],this.lexical=[],this.functions=[]};Vn.enterScope=function(K){this.scopeStack.push(new nl(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===Fo){var jt=this.currentScope();jt.lexical.push(K)}else if(ee===Mo){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&Io&&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 Go(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 Go.call(this,K,ee,this.lastTokEnd,this.lastTokEndLoc)};Es.finishNodeAt=function(K,ee,Oe,Ot){return Go.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 Wo=function(){};Wo.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=No(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&&Do.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 Wo(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 sl(K,ee){if(ee)return parseInt(K,8);return parseFloat(K.replace(/_/g,""))}function Uo(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=Uo(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=Uo(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=sl(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 Ko={};nn.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(K){if(K===Ko)this.readInvalidTemplateToken();else throw K}this.inTemplateElement=!1};nn.invalidStringToken=function(K,ee){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw Ko;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+=`
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
+ `)++this.pos;case`
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 il="8.18.0";s.acorn={Parser:s,version:il,defaultOptions:Wi,Position:ys,SourceLocation:Js,getLineInfo:_o,Node:ei,TokenType:on,tokTypes:Ut,keywordTypes:Hi,TokContext:kn,tokContexts:an,isIdentifierChar:E,isIdentifierStart:m,Token:Qi,isNewLine:as,lineBreak:xn,lineBreakG:Uc,nonASCIIwhitespace:Do};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 $o=new WeakMap;function vn(K,ee){if(K===void 0)return!1;if(K.length<16)return K.includes(ee);let Oe=$o.get(K);if(Oe===void 0||Oe.length>K.length)Oe={names:new Set,length:0},$o.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,rl=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"]]),ol=new Set("public private protected readonly declare abstract override static accessor".split(" ")),al=new Set("public private protected readonly override".split(" ")),pl=new Set("var let const function class abstract enum interface type namespace module global".split(" ")),cl=new Set("var let const function class interface enum".split(" ")),Ho=new Set(["TSAsExpression","TSSatisfiesExpression","TSNonNullExpression","TSTypeAssertion"]),qo=1,ll=32,ul=256,hl=0,dl=1,Cs=2,fl=3,ml=4,er=6,zo=7,ea=256,ir=1024,gl=8|ir,yl=Cs|ea,Xo=1,xl=2,Jo=40,vl=41,El=44,Yo=46,Qo=58,ni=61,Zo=60,si=123,Sl=91,tr=42,bl=35,nr=34,sr=39,Cl=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 Cl;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=rl.get(this.value);if(Mt&&(this.type!==ee.name||!this.containsEsc&&this.$2()!==Yo)){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===Jo||Wt===Zo)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)===Qo}$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()&&pl.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&&cl.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,Xo,!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,zo),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,yl),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,gl),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(ul);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()===Jo){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?ll:0),this.checkLValPattern(Mt,Vt?ml: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&Xo;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&qo)this.declareName(Mt.id.name,ir,Mt.id.start);this.checkLValSimple(Mt.id,hl)}else if(!(Vt&xl)){let Xt=fl;if(this.strict||Mt.generator||Mt.async)Xt=this.treatFunctionsAsVar?dl: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===Sl||Vt===si||Vt===tr||Vt===Yo||Vt===bl||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&&al.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&&Ho.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&&Ho.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===zo){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&ea){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&qo)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&&ol.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===Qo||Vt===El||Vt===vl)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()===Zo;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 wl=/^\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=Tl(this.start.line-1,this.end.column)}}var ta=(K)=>K.replace(wl,(ee)=>" ".repeat(ee.length));function Tl(K,ee){let Oe=Math.max(0,K-2),Ot=[];for(let jt=Oe;jt<K+3;jt++){let Gt=go(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," ")}: ${ta(jt)}`;if(Oe+Gt!==K)return Mt;return`${Mt}
16
+ ${" ".repeat(Ft+2+ta(jt.slice(0,ee)).length)}^`}).join(`
17
+ `)}function Je(K){throw new e(K,"attribute_duplicate","Attributes need to be unique")}function je(K){throw new e(K,"attribute_empty_shorthand","Attribute shorthand cannot be empty")}function qe(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 kl(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 ut(K){throw new e(K,"style_duplicate","A component can have a single top-level `<style>` element")}function lt(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 xt(K){throw new e(K,"svelte_options_invalid_attribute","`<svelte:options>` can only receive static attributes")}function le(K,ee){throw new e(K,"svelte_options_invalid_attribute_value",`Value must be ${ee}, if specified`)}function Tt(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 cs="",ia=[],ri=0,hn=[],dn=0;function Pl(K,ee){cs=K,ia=ee,ri=0}function $l(){return ri}function Al(K,ee,Oe,Ot){ri=Ot}function Nl(K,ee,Oe,Ot,Ft,jt){ri=Ot;let Gt=ee;if(K&&Gt.includes(`
18
+ `)){let Vt=cs.lastIndexOf(`
19
+ `,Oe-1)+1,Wt=Vt,Kt=cs.charCodeAt(Wt);while(Kt===32||Kt===9)Kt=cs.charCodeAt(++Wt);if(Wt>Vt)Gt=Dl(Gt,cs.slice(Vt,Wt))}let Mt={type:K?"Block":"Line",value:Gt,start:Oe,end:Ot};if(Ft&&jt)Mt.loc={start:Ft,end:jt};ia.push(Mt)}function Dl(K,ee){let Oe=K.startsWith(ee)?ee.length:0,Ot="",Ft=K.indexOf(`
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 _l(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(hn=ee.slice(Ot).map(({type:jt,value:Gt,start:Mt,end:Vt})=>({type:jt,value:Gt,start:Mt,end:Vt})),dn=0,or(K,void 0,!1),dn<hn.length&&(hn[dn].start>=K.end||K.type==="Program")){K.trailingComments??=[];while(dn<hn.length)K.trailingComments.push(hn[dn++])}}var Rl=new Map([["BlockStatement","body"],["Program","body"],["ArrayExpression","elements"],["ObjectExpression","properties"]]);function na(K,ee){for(let Oe=K;Oe<ee;Oe++){let Ot=cs.charCodeAt(Oe);if(Ot!==44&&Ot!==41&&Ot!==32&&Ot!==9)return!0}return!1}function or(K,ee,Oe){while(dn<hn.length&&hn[dn].start<K.start)K.leadingComments??=[],K.leadingComments.push(hn[dn++]);if(dn>=hn.length)return;let Ot=hn[dn].start;if(Ot<K.end||!na(K.end,Ot)){let Ft=zn(K),jt=Rl.get(K.type),Gt=jt===void 0?void 0:Ft[jt],Mt=Array.isArray(Gt)&&Gt.length===0;for(let Vt in Ft){if(dn>=hn.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))or(qt,K,Kt?Ht===Wt.length-1:Mt)}}else if(Ln(Wt))or(Wt,K,Mt)}if(dn>=hn.length)return}if(ee!==void 0&&K.end===ee.end)return;if(Oe)while(dn<hn.length){if(ee&&hn[dn].start>=ee.end)break;K.trailingComments??=[],K.trailingComments.push(hn[dn++])}else if(K.end<=hn[dn].start&&!na(K.end,hn[dn].start))K.trailingComments=[hn[dn++]]}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(" ")),oi=!1,ws=1,Il=2,Ll=32,Ol=256,Ml=ws|Il|Ol,Fl=2,jl=3,Bl=4,Vl=/\r\n?|\n|\u2028|\u2029/,sa=new Map;function ii(K){if(!(K instanceof RegExp))return K;let ee=sa.get(K);if(!ee){let Oe=new Set(K.source.slice(4,-2).split("|"));ee={test:(Ot)=>Oe.has(Ot)},sa.set(K,ee)}return ee}var ar=Ss((K)=>class extends K{declareName(ee,Oe,Ot){let Ft=!1;if(Oe===Fl){let jt=this.currentScope();if(Ft=vn(jt.lexical,ee)||vn(jt.functions,ee)||vn(jt.var,ee),jt.lexical.push(ee),this.inModule&&jt.flags&ws)delete this.undefinedExports[ee]}else if(Oe===Bl)this.currentScope().lexical.push(ee);else if(Oe===jl){let jt=this.currentScope();Ft=this.treatFunctionsAsVar?vn(jt.lexical,ee):vn(jt.lexical,ee)||vn(jt.var,ee),jt.functions.push(ee)}else for(let jt=this.scopeStack.length-1;jt>=0;--jt){let Gt=this.scopeStack[jt];if(vn(Gt.lexical,ee)&&!(Gt.flags&Ll&&Gt.lexical[0]===ee)||!this.treatFunctionsAsVarInScope(Gt)&&vn(Gt.functions,ee)){Ft=!0;break}if(Gt.var.push(ee),this.inModule&&Gt.flags&ws)delete this.undefinedExports[ee];if(Gt.flags&Ml)break}if(Ft)this.raiseRecoverable(Ot,`Identifier '${ee}' has already been declared`)}}),pr=Ss((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=ii(this.keywords),this.reservedWords=ii(this.reservedWords),this.reservedWordsStrict=ii(this.reservedWordsStrict),this.reservedWordsStrictBind=ii(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(Vl).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!==ws||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(ws);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")oi=!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||bs(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,fo(jt,Gt,Mt,Wt)}readWord(){let jt=this.readWord1();return this.finishToken(Ot.get(jt)??Oe.name,jt)}}}),ra=ti(ar,pr),Gl=/ \(\d+:\d+\)$/;function Ts(K){return K}function oa(K){return K instanceof SyntaxError&&"pos"in K&&typeof K.pos==="number"}function cr(K,ee,Oe,Ot,Ft,jt=K.root.comments.length){let Gt=K.root.comments;Pl(ee,Gt);let Mt={onComment:K.comments?Nl:Al,sourceType:"module",ecmaVersion:16,locations:K.loc,preserveParens:Ot};if(K.lfOnly)Mt.startLocation=g(Oe);let Vt=K.isTypeScript?K.typescript:ra;if(!Vt)ue();let Wt;try{Wt=Ft(Vt,Mt)}catch(Kt){if(!oa(Kt))throw Kt;kl(Kt.pos,Kt.message.replace(Gl,""))}if(Gt.length>jt)_l(Ts(Wt),Gt,Oe);return Wt}function de(K,ee,Oe=0){return Ts(cr(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 Wl(K,ee){if(!ee)return{line:1,column:0};let{column:Oe}=g(K);return{line:mo(K-Oe)+1,column:Oe}}var Ul={count:0},rr,Kl=(K)=>K.parseExpression();function Hl(K,ee,Oe,Ot,Ft){let jt=rr;if(rr=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="",rr=jt,Mt}function aa(K,ee,Oe,Ot){return Ul.count+=1,oi=!1,cr(K,ee,Oe,!0,(Ft,jt)=>(jt.startLocation??=Wl(Oe,jt.locations),Hl(Ft,jt,ee,Oe,Ot)))}function M(K,ee,Oe,Ot=!1){let Ft=Ts(aa(K,ee,Oe,Kl)),jt=Math.max(Ft.end,$l());return{node:oi&&!Ot?lr(Ft):Ft,end:jt}}function At(K,ee,Oe){let Ot=K.root.comments.length,Ft=!0,jt=aa(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!==ra.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=Ts(jt);return oi?lr(Gt):Gt}function _t(K,ee,Oe){return Ts(cr(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(oa(Gt)&&Gt.pos===ee.length)f(ee.length);throw Gt}}))}function lr(K){let ee=K;while(ee.type==="ParenthesizedExpression")ee=ee.expression;return U(ee,lr),ee}var B=ti(ar,pe,pr);function pa(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 pa(K,ee,B)}function he(K,ee){let Oe=l(K.name,ee.name);if(Oe!==0)return Oe;let Ot=l(K.type,ee.type);if(Ot!==0)return Ot;if(K.type==="forwarded"&&ee.type==="forwarded"){let Ft=l(K.element,ee.element);if(Ft!==0)return Ft}return l(K.detail??"",ee.detail??"")}function ql(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=ql(K,jt);if(Gt<Ft)Ot=jt,Ft=Gt}return Ft<=Oe?Ot:void 0}import{readFile as Jl}from"node:fs/promises";import dr from"node:path";import ca,{sep as ur}from"node:path";var Nn=/\.svelte$/,ls=[".ts",".mts",".cts",".tsx",".js",".mjs",".cjs",".jsx",".d.ts"],la=/\.(?:svelte|[mc]?ts|[mc]?js|tsx|jsx)$/;function us(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&&(ur==="/"||Oe!==92)}function n(K){return ur==="/"?K:K.split(ur).join("/")}function ua(K,ee){return n(ca.join(ee,ca.normalize(K)))}function ks(K){return`${JSON.stringify(K,null,2)}
23
+ `}var ha="sveld",ai="0.38.8";var Nt={name:ha,version:ai,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.5.14","@types/bun":"^1.4.2","@types/jest":"^30.0.0","@typescript/typescript6":"^6.0.2",ajv:"^8.20.0",knip:"^6.41.0",ostia:"^0.2.7",sveast:"^0.9.3",svelte:"^5.57.1",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 Ps="5.57.1";var pi=1;function Gn(K){return K.some((ee)=>ee.internal)?K.filter((ee)=>!ee.internal):K}function Xl(K){return{...K,props:Gn(K.props),moduleExports:Gn(K.moduleExports),slots:Gn(K.slots),events:Gn(K.events),typedefs:Gn(K.typedefs),...K.contexts?{contexts:Gn(K.contexts).map((ee)=>({...ee,properties:Gn(ee.properties)}))}:{}}}function h(K,ee={}){let Oe=Array.from(K.values(),(jt)=>{let{diagnostics:Gt,...Mt}=jt;return Xl(Mt)}).sort((jt,Gt)=>l(jt.moduleName,Gt.moduleName)),Ot={schemaVersion:pi,generator:{name:ha,version:ai,svelteVersion:Ps},total:Oe.length,components:Oe},Ft=ee.entryExports?Gn(ee.entryExports):void 0;if(Ft&&Ft.length>0)Ot.totalExports=Ft.length,Ot.exports=Ft;return Ot}var Yl=/[:=]/,fr="COMPONENT_API.json",ci={none:0,patch:1,minor:2,major:3};function Ql(K,ee){return ci[ee]>ci[K]?ee:K}function Zl(K){return K.reduce((ee,Oe)=>Ql(ee,Oe.bump),"none")}function ya(K,ee){return ci[K]>=ci[ee]}function da(K){return new Set(i(K,"|").map((ee)=>ee.trim()).filter((ee)=>ee.length>0))}function fa(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 eu(K){return(K.split(Yl,1)[0]??"").trimEnd().endsWith("?")}function tu(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(eu)?"minor":"major"}function mr(K,ee){if(K===ee)return"none";if(K===void 0||ee===void 0)return"major";let Oe=fa(K),Ot=fa(ee);if(Oe&&Ot)return tu(Oe,Ot);let Ft=da(K),jt=da(ee),Gt=[...jt].some((Vt)=>!Ft.has(Vt));if(![...Ft].some((Vt)=>!jt.has(Vt)))return Gt?"minor":"none";return"major"}function ma(K){return K.bindable===!0||K.binding==="writable"}function ui(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 gr(K,ee,Oe,Ot){return(Ft,jt,Gt)=>K.push({component:ee,kind:Oe,name:Ft,bump:jt,message:`${Ot} "${Ft}" ${Gt}`})}function ga(K,ee,Oe,Ot){let Ft=[],jt=gr(Ft,K,ee,ee==="prop"?"prop":"export"),{added:Gt,removed:Mt,common:Vt}=ui(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=mr(Kt.type,Ht.type);if(qt!=="none")jt(Wt,qt,`type changed from \`${Kt.type??"unknown"}\` to \`${Ht.type??"unknown"}\``);let zt=ma(Ht);if(ma(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 nu(K,ee,Oe){let Ot=[],Ft=gr(Ot,K,"event","event"),{added:jt,removed:Gt,common:Mt}=ui(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=mr(Ht,qt);if(zt!=="none")Ft(Vt,zt,`detail changed from \`${Ht??"unknown"}\` to \`${qt??"unknown"}\``)}return Ot}function su(K,ee,Oe){let Ot=[],Ft=gr(Ot,K,"slot","slot"),{added:jt,removed:Gt,common:Mt}=ui(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=mr(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 iu=new Set(["description","source","componentCommentSource","tags"]);function li(K){if(Array.isArray(K))return K.map(li);if(r(K)){let ee={};for(let[Oe,Ot]of Object.entries(K)){if(iu.has(Oe))continue;ee[Oe]=li(Ot)}return ee}return K}var ru=["generics","rest_props","extends","contexts","typedefs"];function ou(K,ee,Oe){let Ot=[];for(let Ft of ru){let jt=JSON.stringify(li(ee[Ft])),Gt=JSON.stringify(li(Oe[Ft]));if(jt!==Gt)Ot.push({component:K,kind:"shape",name:Ft,bump:"major",message:`"${Ft}" changed (breaking)`})}return Ot}function au(K,ee){let Oe=ee.moduleName;return[...ga(Oe,"prop",K.props,ee.props),...ga(Oe,"moduleExport",K.moduleExports,ee.moduleExports),...nu(Oe,K.events,ee.events),...su(Oe,K.slots,ee.slots),...ou(Oe,K,ee)]}function It(K,ee){let Oe=[],{added:Ot,removed:Ft,common:jt}=ui(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(...au(Gt,Mt));return Oe}async function pu(K){let ee;try{ee=await Jl(dr.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 xa(K){if(typeof K.check==="string")return K.check;return K.jsonOptions?.outFile??fr}function va(K,ee){if(!K.json||K.stdout||K.jsonOptions?.outDir)return!1;return dr.resolve(K.jsonOptions?.outFile??fr)===dr.resolve(ee)}async function Ne(K,ee,Oe={}){let Ot=await pu(ee);if(Ot===null)return{snapshotExists:!1,snapshotFile:ee,changes:[],bump:"none"};if(Ot.schemaVersion!==pi)return{snapshotExists:!0,snapshotFile:ee,changes:[{component:"*",kind:"schema",bump:"none",message:`snapshot schemaVersion ${Ot.schemaVersion} differs from ${pi}; regenerate the snapshot`}],bump:"none"};let Ft=h(K,{entryExports:Oe.entryExports}),jt=It(Ot,Ft);return{snapshotExists:!0,snapshotFile:ee,changes:jt,bump:Zl(jt)}}var cu={major:"BREAKING",minor:"additive",patch:"patch",none:"no change"};function ge(K){if(!K.snapshotExists){let Ft=K.snapshotFile===fr?"`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":cu[Gt.bump];Oe.push(` [${Mt}] ${Gt.message}`)}}return Oe.join(`
24
+ `)}var Rt=1;function ye(K){let ee={kind:"check-report",schemaVersion:Rt,...K};return ks(ee)}import{existsSync as ba}from"node:fs";import{join as lu,resolve as uu}from"node:path";import{pathToFileURL as hu}from"node:url";var du=["sveld.config.js","sveld.config.mjs","sveld.config.ts"];function $t(K){return K}function fu(K=process.cwd()){for(let ee of du){let Oe=lu(K,ee);if(ba(Oe))return Oe}return null}async function Ca(K){let ee;try{ee=await import(`${hu(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 mu(K=process.cwd()){let ee=fu(K);return ee===null?{}:Ca(ee)}async function J(K,ee,Oe){if(typeof K==="string"){let Ot=uu(ee,K);if(!ba(Ot))throw Error(`sveld: config file "${K}" does not exist.`);return Ca(Ot)}return K??Oe?mu(ee):{}}function I(...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 Ea=["entry","glob","quiet","documentExports","types","typesOptions","json","jsonOptions","markdown","markdownOptions","failFast","watch","config","cache","checkExamples","reportDiagnostics","strict","check","checkLevel","stdout","format","diagnostics"],gu={typesOptions:["outDir","preamble","format","transform","indexTypes"],jsonOptions:["outFile","outDir","source"],markdownOptions:["outFile","outDir","onAppend"],diagnostics:["ignore"]};function Sa(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 j(K){for(let ee of Object.keys(K))if(!Ea.includes(ee))Sa(null,ee,Ea);for(let[ee,Oe]of Object.entries(gu)){let Ot=K[ee];if(!r(Ot))continue;for(let Ft of Object.keys(Ot))if(!Oe.includes(Ft))Sa(ee,Ft,Oe)}}import{dirname as gc}from"node:path";import{lstatSync as ff}from"node:fs";import{readFile as mf}from"node:fs/promises";import{resolve as Vp}from"node:path";import{dirname as $h}from"node:path";var yu=" ",xu=120,vu=/\binterface\s+[A-Za-z_$][\w$]*(\s*<[^{};]*>)?\s*$/,Eu=200,Pa=/\s/,Su=/\s{2}|[^\S ]/,bu=/["'`{}/]/g,Cu=/["'`{};/]/g,$a=9,yr=10,wu=13,$s=32,di=34,Tu=38,fi=39,ku=40,Pu=41,hi=42,wa=46,vr=47,Aa=59,$u=62,Au=91,Er=92,Nu=93,mi=96,Sr=123,Du=124,br=125;function _u(K){return vu.test(Iu(K,Eu))}var Ta=[""];function Ru(K){let ee=Ta[K];if(ee===void 0)ee=yu.repeat(K),Ta[K]=ee;return ee}function Iu(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 Lu(K){if(K.length===0)return!1;let ee=K[K.length-1];return ee.charCodeAt(ee.length-1)===yr}function Ou(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!==$s&&Ot!==$a)break;Oe--}if(Oe===ee.length)return;if(Oe===0){K.pop();continue}K[K.length-1]=ee.slice(0,Oe);return}}function Mu(K){while(K.length>0){let ee=K[K.length-1];if(!Pa.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 Fu(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)!==Er)ee=0;continue}if(Ft===di||Ft===fi||Ft===mi){ee=Ft;continue}if(Ft===Aa&&++Oe>=2)return!0}return!1}function ju(K){if(!Su.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(Pa.test(jt)){if(!Ot&&ee.length>0)ee+=" ",Ot=!0;continue}ee+=jt,Ot=!1}return ee.trimEnd()}function Na(K,ee){let Oe=K[ee],Ot=K.indexOf(Oe,ee+1);while(Ot!==-1&&K.charCodeAt(Ot-1)===Er)Ot=K.indexOf(Oe,Ot+1);return Ot}function Da(K,ee){let Oe=K.indexOf("*/",ee+1);return Oe===-1?-1:Oe+1}function Bu(K){let ee=new Map,Oe=[],Ot=bu,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===vr){if(K.charCodeAt(Ft+1)===hi){let Gt=Da(K,Ft);if(Gt===-1)break;Ft=Gt}}else if(jt===di||jt===fi||jt===mi){let Gt=Na(K,Ft);if(Gt===-1)break;Ft=Gt}else if(jt===Sr)Oe.push(Ft);else if(jt===br&&Oe.length>0)ee.set(Oe.pop(),Ft);Ft++}return ee}function Vu(K,ee,Oe){for(let Ot=ee;Ot<Oe;Ot++)if(!xr(K.charCodeAt(Ot)))return!1;return!0}function xr(K){if(K<=$s)return K===$s||K>=$a&&K<=wu;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 _a(K,ee,Oe,Ot){let Ft=[],jt=Cu,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===vr){if(K.charCodeAt(Mt+1)===hi){let Wt=Da(K,Mt);if(Wt===-1)break;Mt=Wt}Mt++;continue}if(Vt===di||Vt===fi||Vt===mi){let Wt=Na(K,Mt);if(Wt===-1)break;Mt=Wt+1;continue}if(Vt===Sr){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(Vu(K,Kt,Wt)){Ft.push("{}"),Mt=Wt+1,Gt=Mt;continue}let Ht=K.slice(Kt,Wt),qt=K.charCodeAt(Kt)===yr;if(!qt&&!Ht.includes("/*")&&!Fu(Ht)&&!_u(Ft)){let zt=_a(K,Kt,Wt,Ot),Xt=zt.trim();if(!Xt.includes(`
26
+ `)){let Qt=Xt.endsWith(";")?Xt.slice(0,-1):Xt,Jt=`{ ${ju(Qt)} }`;if(Jt.length<=xu){Ft.push(Jt),Mt=Wt+1,Gt=Mt;continue}}if(Ft.push("{"),zt.charCodeAt(0)!==Aa)Ft.push(`
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===br){if(Gt<Mt)Ft.push(K.slice(Gt,Mt));if(Ou(Ft),!Lu(Ft))Ft.push(`
29
+ `);Ft.push("}"),Mt++,Gt=Mt;continue}if(Gt<Mt)Ft.push(K.slice(Gt,Mt));if(Mu(Ft),Ft.push(";"),K.charCodeAt(Mt+1)!==yr)Ft.push(`
30
+ `);Mt++,Gt=Mt}if(Gt<Oe)Ft.push(K.slice(Gt,Oe));return Ft.join("")}function Gu(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)!==Er)Oe=0;continue}if(Ft===di||Ft===fi||Ft===mi){Oe=Ft,ee+=K[Ot];continue}if(Ft===$s&&ee.charCodeAt(ee.length-1)===$s)continue;ee+=K[Ot]}return ee}function Wu(K){return K===br||K===Nu||K===Pu||K===$u}function Uu(K,ee,Oe){return Oe-ee>=3&&K.charCodeAt(ee)===vr&&K.charCodeAt(ee+1)===hi&&K.charCodeAt(ee+2)===hi}function ka(K,ee,Oe){let Ot=K.indexOf("*/",ee);return Ot!==-1&&Ot+2<=Oe}function Ku(K,ee,Oe){let Ot=K.charCodeAt(ee);if(Ot===Du||Ot===Tu)return!0;return Ot===wa&&ee+1<Oe&&K.charCodeAt(ee+1)!==wa}function Hu(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&&xr(K.charCodeAt(qt)))qt++;while(zt>qt&&xr(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 cn=sn.charCodeAt(sn.length-1);if(cn!==Sr&&cn!==ku&&cn!==Au)ee.push(0),Oe.push("")}Mt=Ht;continue}if(jt){if(ee.push(Gt),Oe.push(` ${K.slice(qt,zt)}`),ka(K,qt,zt))jt=!1;Mt=Ht;continue}let Xt=Uu(K,qt,zt),Qt=Xt&&ka(K,qt,zt);if(Xt&&!Qt){ee.push(Ft),Oe.push(K.slice(qt,zt)),jt=!0,Gt=Ft,Mt=Ht;continue}let Jt=Wu(K.charCodeAt(qt)),tn=Math.max(0,Ft-(Jt?1:0))+(Ku(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(Gu(K.slice(qt,zt))),Mt=Ht,Qt)continue;Ft=Us(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(Ru(Ht));Wt.push(Oe[Kt])}return Wt.join("")}function Ra(K){return`${Hu(_a(K,0,K.length,Bu(K)))}
33
+ `}var Tn="any",qu="Record<string, any>",As="Record<string, never>",ja=/^[A-Za-z_$][A-Za-z0-9_$]*$/,zu=/CustomEvent/,Xu=/^[A-Z]/,Ju=/\n/,Yu=/=>/,Qu=/^\s*[(<]/,Zu=/(?:^|\n)@default\b/,eh=/^([ \t]*\*) +$/gm,th=/[^\S\r\n]*[\r\n]\s*/g,nh=/(^|[^.\w])Snippet(?:\s*<|\b)/,sh=/import\s+type\s+[^;]*\bSnippet\b[^;]*from\s+"svelte";/,ih=/^const\s+/,rh=/^export /,oh=/[^\w$]/g;function Ba(K){return K.replace(ih,"")}function Dn(K){if(K.length===0)return"";return`/**
34
+ * ${O(K.join(`
35
+ * `))}
36
+ */`}function Ns(K){return K?K.split(`
37
+ `):[]}function Va(K){if(K===void 0)return[];return(K===!0?"@deprecated":`@deprecated ${K}`).split(`
38
+ `)}function wr(K){let ee=[];for(let{name:Oe,body:Ot}of K??[])if(!Ot)ee.push(`@${Oe}`);else if(Ot.includes(`
39
+ `))ee.push(`@${Oe}`,...Ot.split(`
40
+ `));else ee.push(`@${Oe} ${Ot}`);return ee}function hs(K,ee,Oe){return[...Ns(K),...Va(ee),...wr(Oe)]}function Ga(K){if(!K)return"";return`/** ${O(K)} */`}function Tr(K){return K?.includes(`
41
+ `)?Dn(Ns(K)):Ga(K)}function kr(K,ee,Oe){let Ot=[...wr(ee),...Va(Oe)];if(Ot.length===0)return Tr(K);return Dn([...Ns(K),...Ot])}function Wa(K){if(K===void 0)return Tn;return`${K}
42
+ `}function gi(K){if(K.typedefs.length===0)return"";return K.typedefs.map((ee)=>{let Oe=Dn([...Ns(ee.description),...wr(ee.tags)]);return`${Oe?`${Oe}
43
+ `:""}export ${ee.ts}`.replace(eh,"$1")}).join(`
44
+
45
+ `)}var Ia=new Map;function ah(K,ee){let Oe=Ia.get(ee);if(Oe===void 0)Oe=new RegExp(`\\b${_(ee)}\\b`),Ia.set(ee,Oe);return Oe.test(K)}var La,Oa=[];function Ua(K){if(K!==La)La=K,Oa=i(K,",");return Oa}function ph(K){if(K===null)return[];return K[0].split(",").map((ee,Oe)=>({name:ee.trim(),constraint:(Ua(K[1]??"")[Oe]??ee).trim()}))}function Ka(K,ee){let Oe=ph(K).filter(({name:Ot})=>ah(ee,Ot));if(Oe.length===0)return{declSuffix:"",refSuffix:""};return{declSuffix:`<${Oe.map(({constraint:Ot})=>Ba(Ot)).join(", ")}>`,refSuffix:`<${Oe.map(({name:Ot})=>Ot).join(", ")}>`}}function Ha(K){if(!K.contexts||K.contexts.length===0)return"";return K.contexts.map((ee)=>{let Oe=ee.properties.map((Gt)=>{let Mt=Gt.description?`${Tr(Gt.description)}
46
+ `:"",Vt=Gt.optional?"?":"";return`${Mt}${Pn(Gt.name)}${Vt}: ${Gt.type};`}).join(`
47
+ `),Ot=ee.description?`${Dn(Ns(ee.description))}
48
+ `:"",{declSuffix:Ft}=Ka(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>":As};`;let jt=ee.hasUnresolvedSpread?" & Record<string, any>":"";return`${Ot}export type ${ee.typeName}${Ft} = {
50
+ ${Oe}
51
+ }${jt};`}).join(`
52
+
53
+ `)}function Pn(K){return ja.test(K)?K:JSON.stringify(K)}function Ma(K,ee){let Oe=kr(ee.description,ee.tags,ee.deprecated),Ot=Oe?`${Oe}
54
+ `:"",Ft=!ee.slot_props||ee.slot_props===As?"[]":lh(ee.slot_props),jt=Ft==="[]"?"(this: void) => void":`(this: void, ...args: ${Ft}) => void`;return`
55
+ ${Ot}${K}?: ${jt};`}function ch(K){let ee=K.props.filter((Zt)=>!yi(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 ns=typeof Zt.value==="string"?Zt.value.replace(th," "):Zt.value,Bs=Zu.test(Zt.description??"")||Zt.value===void 0||Zt.value==="undefined",Vs=Dn([...hs(Zt.description,Zt.deprecated,Zt.tags),...Zt.constant?["@constant"]:[],...Bs?[]:[`@default ${ns}`]]),Gs=Zt.constant&&!Zt.isFunction?Zt.value:Zt.type||Tn;return`
56
+ ${Vs}
57
+ ${Pn(Zt.name)}${Zt.isRequired?"":"?"}: ${Gs};`});for(let Zt of K.slots)if(!Zt.default&&Zt.name!=null&&!Oe.has(Zt.name))Ft.push(Ma(Pn(Zt.name),Zt));let jt=K.slots.find((Zt)=>Zt.default||Zt.name===null);if(jt&&!Oe.has("children"))Ft.push(Ma("children",jt));let Gt=Ft.join(`
58
+ `),Mt=ds(K.moduleName),Vt=K.generics?`<${Ua(K.generics[1]).map((Zt)=>Ba(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 ns=Gt.trim()===""?"":` & ${zt}`;Zt=[`type $Props${Vt} = ${K.canonicalPropsType}${ns};`,qt(Ht)]}else if(Gt.trim()==="")Zt=[qt(K.extends?.interface??As)];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
+
61
+ `),elementsImport:void 0}}let{name:Xt,thisValue:Qt,thisType:Jt,description:tn}=K.rest_props,sn;if(Xt!=="svelte:element")sn=Xt.split("|").map((Zt)=>`SvelteHTMLElements["${Zt.trim()}"]`).join(" & ");else if(Qt)sn=`SvelteHTMLElements["${Qt}"]`;else if(Jt)sn=`NoInfer<SvelteHTMLElements[${Jt}]>`;else sn="HTMLAttributes<HTMLElement>";let cn="[key: `data-${string}`]: unknown;",pn=tn?`${Tr(tn)}
62
+ `:"",ln=K.canonicalPropsType?`(${K.canonicalPropsType}) & `:"",In=Jt?{name:Vt,ref:Wt}:{name:"",ref:""},qn=K.extends===void 0?`keyof $Props${Wt}`:`keyof ($Props${Wt} & ${K.extends.interface})`,Fn=`Omit<$RestProps${In.ref}, ${qn}>`,gn=Jt?`(${Jt} extends any ? ${Fn} : never)`:Fn;return{props_name:Mt,prop_def:[`${pn}type $RestProps${In.name} = ${sn};`,`type $Props${Vt} = ${ln}{${Gt}
63
+
64
+ ${cn}
65
+ };`,qt(`${gn} & ${Ht}`)].join(`
66
+
67
+ `),elementsImport:sn.startsWith("HTMLAttributes")?"HTMLAttributes":"SvelteHTMLElements"}}function lh(K){return ji(K)?K:`[${K}]`}function uh(K){let ee=K.slots.filter((Ot)=>!ji(Ot.slot_props??""));if(ee.length===0)return As;let Oe=ee.map(({name:Ot,slot_props:Ft,...jt})=>{let Gt=jt.default||Ot===null?"default":Pn(Ot??""),Mt=kr(jt.description,jt.tags,jt.deprecated);return`${Mt?`${Mt}
68
+ `:""}${Gt}: ${Wa(Ft)};`}).join(`
69
+ `);return ee.length===1?`{${Oe}}`:`{
70
+ ${Oe}
71
+ }`}var hh=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 Cr(K=Tn){if(zu.test(K))return K;return`CustomEvent<${K}>`}function dh(K){switch(K.type){case"dispatched":return Cr(K.detail);case"forwarded":{let ee=K.element,Oe=ee&&Xu.test(ee),Ot=!Oe||hh.has(K.name);if(K.detail!==void 0&&K.detail!=="undefined"&&!(K.detail==="null"&&Ot&&!Oe))return Cr(K.detail);if(!Ot)return Cr();return`${ee==="svelte:document"?"DocumentEventMap":"WindowEventMap"}["${K.name}"]`}default:return K}}function Fa(K){if(K.events.length===0)return qu;let ee=K.events.map((Oe)=>{let Ot=kr(Oe.description,Oe.tags,Oe.deprecated);return`${Ot?`${Ot}
72
+ `:""}${Pn(Oe.name)}: ${dh(Oe)};
73
+ `}).join("");return K.events.length===1?`{${ee}}`:`{
74
+ ${ee}}`}function fh(K){let ee=K.type==="() => any";if(K.type&&Yu.test(K.type)&&!ee)return K.type;if(K.params&&K.params.length>0)return`(${y(K.params)}) => ${K.returnType||Tn}`;if(K.returnType)return`() => ${K.returnType}`;return K.type||Tn}function yi(K){return K.isFunctionDeclaration===!0||K.kind==="const"}function qa(K){return K.props.filter(yi).map((ee)=>`
75
+ ${Dn(hs(ee.description,ee.deprecated,ee.tags))}
76
+ ${Pn(ee.name)}: ${fh(ee)};`).join(`
77
+ `)}function mh(K){let ee=Ds(K.moduleName),Oe=qa({props:K.props});if(Oe.trim()==="")return{exports_ref:ee,exports_def:`export type ${ee} = ${As};`};let{declSuffix:Ot,refSuffix:Ft}=Ka(K.generics,Oe);return{exports_ref:`${ee}${Ft}`,exports_def:`export type ${ee}${Ot} = {${Oe}
78
+ };`}}function gh(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 za(K){return K==="default"?"$$Component":K}function yh(K){let ee=za(K.moduleName);return`declare const ${ee}: Component<
79
+ ${K.propsRef},
80
+ ${K.exportsRef},
81
+ ${K.bindings}
82
+ >;
83
+ export default ${ee};`}function xh(K){let ee=za(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
+ new ${K.generic}(
85
+ options: ComponentConstructorOptions<${K.propsRef}>
86
+ ): SvelteComponent<${K.propsRef}${K.eventsRef?`, ${K.eventsRef}`:""}> & ${K.exportsRef};
87
+ ${K.generic}(
88
+ this: void,
89
+ internals: ComponentInternals,
90
+ props: ${K.propsRef}
91
+ ): {
92
+ ${Ot}
93
+ $set?(props: Partial<${K.propsRef}>): void;
94
+ } & ${K.exportsRef};
95
+ element?: typeof HTMLElement;
96
+ z_$$bindings?: ${K.bindings};
97
+ }
98
+ declare const ${ee}: ${Oe};
99
+ export default ${ee};`}function vh(K){if(K.extends===void 0)return"";return`import type { ${Pr(K.extends.interface)} } from ${K.extends.import};`}function Pr(K){let ee=K.indexOf("<");return(ee===-1?K:K.slice(0,ee)).trim()}function Eh(K){if(!K.componentComment)return"";if(!Ju.test(K.componentComment))return Ga(K.componentComment.trim());return`/*${O(K.componentComment).split(`
100
+ `).map((ee)=>`* ${ee}`).join(`
101
+ `)}
102
+ */`}function Sh(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=Dn(hs(Ot.description,Ot.deprecated,Ot.tags)),Mt=Pn(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:`${Pn(jt)} as ${Mt}`)}return ee.map((Ot)=>{let Ft=Oe.get(Ot);if(!Ft)return Ot;return`${Ft.comment}
104
+ export { ${Ft.specifiers.join(", ")} } from ${JSON.stringify(Ft.from)};`}).join(`
105
+
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}${Pn(K.name)}${Oe}: ${K.type??Tn}`;if(K.kind==="index")return`${ee}${K.name}: ${K.type??Tn}`;let Ot=y(K.params??[]);if(K.kind==="constructor")return`constructor(${Ot})`;let Ft=K.typeParameters?`<${K.typeParameters}>`:"";return`${ee}${Pn(K.name)}${Oe}${Ft}(${Ot}): ${K.returnType??Tn}`}function bh(K,ee){let Oe=K.localName??K.name,Ot=Oe!==K.name,Ft=`export { ${Oe}${Ot?` as ${Pn(K.name)}`:""} };`;if(ee.has(Oe))return Ft;ee.add(Oe);let jt=K.typeParameters?`<${K.typeParameters}>`:"",Gt=(K.members??[]).map((Kt)=>[Dn(hs(Kt.description,Kt.deprecated,Kt.tags)),`${$r(Kt)};`].filter(Boolean).join(`
107
+ `)).join(`
108
+
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
+ ${[Dn(hs(K.description,K.deprecated,K.tags)),Gt?`${Vt} {
111
+ ${Gt}
112
+ }`:`${Vt} {}`,Ot?Ft:""].filter(Boolean).join(`
113
+ `)}`}function Ch(K){let ee=Sh(K),Oe=new Set,Ot=K.moduleExports.filter((Ft)=>Ft.kind!=="re-export").map((Ft)=>{if(Ft.kind==="class")return bh(Ft,Oe);let jt=!ja.test(Ft.name),Gt=jt?{...Ft,name:wh(Ft.name)}:Ft,Mt,Vt=Gt.type&&Qu.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||Tn};
114
+ `;else if(Gt.kind==="let")Mt=`export declare let ${Gt.name}: ${Gt.type||Tn};`;else if(Gt.params&&Gt.params.length>0)Mt=`export declare function ${Gt.name}${Wt}(${y(Gt.params)}): ${Gt.returnType||Tn};`;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||Tn};`;if(jt)Mt=`${Mt.replace(rh,"").trimEnd()}
115
+ export { ${Gt.name} as ${JSON.stringify(Ft.name)} };`;return`
116
+ ${Dn(hs(Gt.description,Gt.deprecated,Gt.tags))}
117
+ ${Mt}`}).join(`
118
+ `);return[ee,Ot].filter(Boolean).join(`
119
+
120
+ `)}function wh(K){return`__export_${K.replace(oh,"_")}`}var Th=120;function kh(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<=Th)return Ft}return`${Oe}
122
+ ${K.genericProps},
123
+ ${K.events},
124
+ ${K.slots}
125
+ > {
126
+ ${K.accessors}
127
+ }`}function ds(K){return`${K}Props`}function Ds(K){return`${K}Exports`}function Ar(K){return{format:K.format}}var Ph={format:"class"};function Xa(K){let ee=Ar(K??{}),Oe={};for(let[Ot,Ft]of Object.entries(ee))Oe[Ot]=Ft??Ph[Ot];return JSON.stringify(Oe)}function Nr(K,ee){let Oe=ho(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",Qt=jt!==null,{props_name:Jt,prop_def:tn,elementsImport:sn}=ch({moduleName:Ot,props:Gt,rest_props:Kt,extends:Ht,generics:jt,slots:Vt,canonicalPropNames:new Set(Oe?.canonicalPropNames??[]),canonicalPropsType:Oe?.canonicalPropsType}),cn=jt?`<${jt[1]}>`:"",pn=jt?`${Jt}<${jt[0]}>`:Jt,ln=Xt&&Wt.length>0?`type $Events${cn} = ${Fa({events:Wt})};`:"",In=jt?`$Events<${jt[0]}>`:"$Events",qn=Xt&&(Qt||ln!==""),Fn=Ch({moduleExports:Mt}),gn=gi({typedefs:Ft}),Zt=Ha({contexts:zt,generics:jt}),ns=(Oe?.typeImportStatements??[]).join(`
128
+ `),Bs=[...Oe?.localTypeDeclarations??[],...Oe?.moduleTypeDeclarations??[]].join(`
129
+
130
+ `),{exports_ref:Vs,exports_def:Gs}=Xt?mh({props:Gt,moduleName:Ot,generics:jt}):{exports_ref:"",exports_def:""},lo=Xt?gh({props:Gt}):"",_i=!sh.test(ns)&&[tn,Fn,gn,Zt,Bs,Gs].some((Ri)=>nh.test(Ri)),xc=[Xt?qn?`import type { SvelteComponent, ComponentConstructorOptions, ComponentInternals${_i?", Snippet":""} } from "svelte";`:`import type { Component${_i?", Snippet":""} } from "svelte";`:`import { SvelteComponentTyped${_i?", type Snippet":""} } from "svelte";`,sn?`import type { ${sn} } from "svelte/elements";`:"",ns,vh({extends:Ht})].filter(Boolean).join(`
131
+ `),vc=Xt?qn?xh({moduleName:Ot,generic:cn,propsRef:pn,exportsRef:Vs,bindings:lo,...ln?{eventsRef:In}:{}}):yh({moduleName:Ot,propsRef:pn,exportsRef:Vs,bindings:lo}):kh({moduleName:Ot,generic:cn,genericProps:pn,events:Fa({events:Wt}),slots:uh({slots:Vt}),accessors:qa({props:Gt})}),Ec=[Fn,gn,Bs,Zt,tn,Gs,ln,[Eh({componentComment:qt}),vc].filter(Boolean).join(`
132
+ `)].map((Ri)=>Ri.trim()).filter(Boolean).join(`
133
+
134
+ `);return Ra([xc,Ec].filter(Boolean).join(`
135
+
136
+ `))}var Ah=[...ls,".svelte"];function Nh(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 Ja(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 Ya(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=Nh(jt.import);if(Gt===void 0||!Gt.startsWith(".")&&!Gt.startsWith("/"))return[];let Mt=ee(Ft.filePath),Vt=Oe.resolve(Gt,$h(Mt),Ah);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(Pr(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=uo(Ft)?.[qt.name]?.some((tn)=>tn===""||tn===Xt.code);Ht.push(Jt?{...Xt,ignored:!0}:Xt)}}return Ht}}import{lstatSync as Yh,readFileSync as Qh,realpathSync as Zh,statSync as ed}from"node:fs";import{dirname as td,isAbsolute as nd,join as mp,parse as sd,relative as Br,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 dp}from"node:fs";import{dirname as Fr,join as Xh,relative as lp,resolve as up}from"node:path";import{readFileSync as Bh,statSync as Vh}from"node:fs";import{basename as Mr,dirname as xi,isAbsolute as Gh,join as Wh,resolve as Uh}from"node:path";import{existsSync as ep,readdirSync as Dh}from"node:fs";import{dirname as Qa,join as tp,resolve as _h}from"node:path";function q(K,ee){for(let Oe=_h(K);;Oe=Qa(Oe)){for(let Ot of ee){let Ft=tp(Oe,Ot);if(ep(Ft))return Ft}if(Qa(Oe)===Oe)return null}}function Za(K){return K.normalize("NFC").toLowerCase()}class Dr{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(Za(Ft),Ft)}let Ot=Oe.folded.get(Za(ee));return Ot!==void 0&&Ot!==ee&&ep(tp(K,ee))}read(K){let ee=this.listings.get(K);if(ee!==void 0)return ee;try{let Oe=Dh(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 _r=!1;function F(K){_r=K}function Mn(K){if(!_r)console.error(K)}function np(K){if(!_r)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,Rr=null;function Wn(){if(_s)return Promise.resolve(_s);if(!Rr)Rr=import("./chunk-4hn2yn5w.js").then((K)=>(_s=K,K));return Rr}function $n(){if(!_s)throw Error("sveld: internal error, parser stack read before loadParserStack() resolved.");return _s}import{existsSync as Ir,readFileSync as Rh}from"node:fs";import{dirname as ap,isAbsolute as pp,relative as Ih,resolve as Lr}from"node:path";function sp(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 ip(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 Lh=["tsconfig.json","jsconfig.json"],rp=new Map,Oh=/\/\*[\s\S]*?\*\/|\/\/.*/g,Mh=[".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 Fh(K){if(Ir(K))return!0;return Mh.some((ee)=>Ir(K+ee))}function op(K){let ee=K.indexOf("*");return ee===-1?K.length:ee}function cp(K,ee){if(ee.has(K))return ee.get(K)??null;try{let Oe=Rh(K,"utf-8"),Ot;try{Ot=JSON.parse(Oe)}catch{let jt=Oe.replace(Oh,"");Ot=JSON.parse(jt)}let Ft=ip(Ot);if(Ft.extends){let jt=pp(Ft.extends)?Ft.extends:Lr(ap(K),Ft.extends),Gt=jt.endsWith(".json")?jt:`${jt}.json`;if(Ir(Gt)){let Mt=cp(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 jh(K){let ee=rp.get(K);if(!ee){let Oe=K.split("*").map(_).join("(.*)");ee=new RegExp(`^${Oe}$`),rp.set(K,ee)}return ee}class Or{configs=new Map;lookup(K,ee){if(K.startsWith(".")||pp(K))return{resolved:K,unresolved:!1,searched:""};let Oe=q(ee,Lh),Ot=Oe?cp(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=Lr(ap(Oe),Ot.baseUrl??"."),Gt=Object.entries(Ft).sort(([Mt],[Vt])=>op(Vt)-op(Mt));for(let[Mt,Vt]of Gt){let Wt=K.match(jh(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=Lr(jt,qt);if(Kt??=zt,Fh(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(Ih(ee,Oe)))}}var Kh=/\.[mc]?jsx?$/,Hh={".js":[".ts",".tsx",".d.ts"],".jsx":[".tsx",".d.ts"],".mjs":[".mts",".d.mts"],".cjs":[".cts",".d.cts"]};function qh(K){return K==="."||K===".."||K.startsWith("./")||K.startsWith("../")||Gh(K)}class Un{aliases=new Or;listings=new Dr;modules=new Map;programs=new Map;listDirectory(K){return this.listings.entries(K)}exists(K){return this.listings.has(xi(K),Mr(K))}resolve(K,ee,Oe=ls){let Ot=this.aliases.absolute(K,ee);if(Ot===K&&!qh(K))return null;let Ft=Uh(ee,Ot),jt=xi(Ft),Gt=Mr(Ft),Mt=this.listings.has(jt,Gt),Vt;if(Mt){let Wt=this.listings.entry(jt,Gt);if(Vt=Wt&&!Wt.isSymbolicLink()?Wt:Vh(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 Wh(Ft,`index${Wt}`)}return null}parse(K){let ee=this.modules.get(K);if(ee===void 0)ee=zh(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=Kh.exec(K)?.[0];if(ee===void 0)return;let Oe=K.slice(0,-ee.length),Ot=xi(Oe),Ft=Mr(Oe);for(let jt of Hh[ee]??[])if(this.listings.has(Ot,Ft+jt))return Oe+jt;return}}function zh(K){let ee;try{ee=Bh(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 np(`Warning: sveld couldn't parse ${K} to read its exports (${xe(Oe)}); skipping it.`),null}}function hp(K){return K.type==="Identifier"?K.name:K.value}function Jh(K,ee,Oe,Ot){let Ft=K.resolve(ee,Oe);if(!Ft)return null;let jt=Fr(Ft);if(Ot.has(Ft))return{dir:jt,exports:{}};Ot.add(Ft);try{return{dir:jt,exports:jr(K,dp(Ft,"utf-8"),jt,Ot,Ft)}}catch{return{dir:jt,exports:{}}}finally{Ot.delete(Ft)}}function fp(K,ee,Oe=new Un,Ot=new Set,Ft=ee){return jr(Oe,K,ee,Ot,Ft)}function jr(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=dp(Wt,"utf-8"),Ht=jr(K,Kt,Fr(Wt),Ot,Wt);Ot.delete(Wt);for(let[qt,zt]of Object.entries(Ht)){let Xt=_n(n(zt.source.startsWith(".")?`./${lp(Oe,up(Fr(Wt),zt.source))}`:`./${Xh(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?Jh(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=hp(qt.exported),Xt=hp(qt.local),Qt=zt||Xt,Jt=Ht?.exports[Xt],tn=Jt?_n(n(`./${lp(Oe,up(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 id=/-/g,rd=/[^A-Za-z0-9_$]/g,od=/^[0-9]/;function ad(K,ee){let Oe=K.replace(rd,""),Ot=od.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 gp(K,ee){return ad(sd(K).name.replace(id,""),ee)}function yp(K,ee,Oe=[],Ot=new Set,Ft){let jt;try{jt=Ft??Zh(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=mp(ee,Mt.name),Wt=Mt.isSymbolicLink(),Kt=Wt?ed(Vt,{throwIfNoEntry:!1}):Mt;if(!Kt)continue;if(Kt.isDirectory())yp(K,Vt,Oe,Ot,Wt?void 0:mp(jt,Mt.name));else if(Kt.isFile()&&Mt.name.endsWith(".svelte"))Oe.push(Vt)}return Oe}function pd(K,ee){return yp(K,ee).map((Oe)=>({moduleName:gp(Oe),source:_n(n(`./${Br(ee,Oe)}`))})).sort((Oe,Ot)=>l(Oe.source,Ot.source))}function cd(K){return!us(K)}function ld(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 Vr(K,ee,Oe,Ot,Ft,jt){for(let{moduleName:Gt,source:Mt}of pd(K,ee)){let Vt=Ft(Mt),Wt=Oe[Gt];if(Wt&&cd(Wt.source)&&ld(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(Br(ee,Kt))} and ${n(Br(ee,Vt))}). Both are included in TypeScript definitions, but only one can be the named export.`);Ot.push([Gt,{source:Mt,default:!1}])}}function Gr(K,ee,Oe,Ot){let Ft=Yh(K).isFile(),jt=Ft?td(K):K,Gt=Rs(jt),Mt=new Map,Vt=(Ht)=>{let qt=Mt.get(Ht);if(qt===void 0)qt=nd(Ht)?Rs(Ht):Rs(Gt,Ht),Mt.set(Ht,qt);return qt},Wt={};if(Ft){let Ht=Qh(K,"utf-8");try{Wt=fp(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(Vr(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 xp(K,ee,Oe,Ot){if(Oe!==1||K!=="default")return K;return gp(ee,Ot)}import{dirname as Kd}from"node:path";import{resolve as ud}from"node:path";var hd=/\r?\n/,dd=/^\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 fd(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 md(K,ee){let Oe=fd(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 gd(K){let ee=[];for(let Oe of K.slice(3,-2).split(hd)){let Ot=Oe.replace(dd,"").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 yd(K,ee){return"typeAnnotation"in ee?Zn(K,ee.typeAnnotation?.typeAnnotation):void 0}function Ep(K,ee){return Zn(K,ee.returnType?.typeAnnotation)}function Wr(K,ee,Oe){return`(${ee.params.map((Ft)=>Zn(K,Ft)??"").join(", ")}) => ${Ep(K,ee)??Oe??"any"}`}function Sp(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 xd[K.callee.name];return}var xd={String:"string",Number:"number",Boolean:"boolean"};function bp(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 vd(K,ee){let Oe=Zn(K,ee),Ot=bp(ee);if(Oe===void 0||Ot===void 0)return;return{raw:Oe,value:Ot,type:typeof Ot}}function Ed(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 Sd=new Set(["any","bigint","boolean","false","never","null","number","object","readonly","string","symbol","true","undefined","unknown","void"]),bd=/"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'/g,Cd=/(?<![\w$.])[A-Za-z_$][\w$]*(?![\w$]|\s*\??:)/g;function wd(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(bd,'""').match(Cd)??[]).every((jt)=>Sd.has(jt))?Ot:void 0}function Cp(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=Sp(Ft);if(!jt)return;if(Ot===void 0)Ot=jt;else if(Ot!==jt)return}return Ot}function Td(K){if(K.type==="TemplateLiteral")return;let ee=bp(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=Td(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 Ur(K,ee,Oe,Ot){let Ft=md(K.text,Oe),jt=Ft?gd(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)=>Ep(K,zt)??Gt??re(Xt)??Cp(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=yd(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=Wr(K,gn,pn)}else{if(cn=Zn(K,gn),!sn)sn=Sp(gn);let Zt=b(gn);if(ln=w(Zt)??Ed(Zt,Jt),zt==="const")In=vd(K,Zt),qn=wd(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:Wr(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 Pd(K,ee,Oe){let Ot=ee.declaration;if(Ot.type==="FunctionDeclaration"||Ot.type==="TSDeclareFunction"||Ot.type==="ClassDeclaration"){let[Gt]=Ur(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:Wr(K,Ot,Cp(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 $d(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 vp(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 Ur(Ft,zt,zt.start))Mt.set(Xt.name,Xt)}let Vt=(qt,zt)=>({name:qt,kind:"const",declFile:ud(Ft.dir,zt),isTypeOnly:!1}),Wt=(qt)=>{let zt=Mt.get(qt);if(zt)return zt;let Xt=$d(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 vp(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(vp(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=Pd(Ft,qt,Wt);if(Jt)Gt.push(Jt);continue}if(qt.type!=="ExportNamedDeclaration")continue;let zt=qt.declaration;if(zt){Gt.push(...Ur(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 Ad=/\.[^./\\]+$/;function Nd(K,ee){if(K.endsWith(".d.ts"))return null;let Oe=K.replace(Ad,".d.ts");return ee.exists(Oe)?Oe:null}function Dd(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=Nd(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 _d(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 Rd(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=_d(Oe,Ft)}}}var wp={collect:(K)=>K.pendingCallDefaultCandidates?.filter((ee)=>ee.importSource!==void 0)??[],resolve:Dd,apply:Rd};function Id(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 Ld(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 Tp={collect:(K)=>K.pendingConstDefaultCandidates??[],resolve:Id,apply:Ld};function Od(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 Md(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 Pp={collect:(K)=>K.pendingContextKeyCandidates??[],resolve:Od,apply:Md};function Fd(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=jd(jt,Ot);if(!Gt)return{candidate:Ot,failureReason:"parameter-not-found"};return Gd(jt,Gt,Ot)})}function $p(K){return K?.type==="AssignmentPattern"?K.left:K}function jd(K,ee){let Oe=$p(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=$p(Ot.value);return Ft?.type==="Identifier"?{name:Ft.name}:void 0}return}function Kr(K){if(!K)return null;if(K.type==="ConditionalExpression"){let Oe=Kr(K.consequent),Ot=Kr(K.alternate);return Oe&&Ot?[...Oe,...Ot]:null}let ee=w(K);return ee?[ee]:null}var Bd={variableType:()=>{return}};function Vd(K){if(!K)return"null";let{deriveLiteralDetailType:ee,literalDetailToTypeText:Oe}=$n();if(K.type==="Literal")return Oe(K.value);return ee(Bd,K)??"any"}function Ap(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 Gd(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(!Ap(Mt.callee,ee))return;let Ht=Mt.arguments,qt=Kr(Ht[0]);if(!qt)return jt="dynamic-event-name",T;for(let zt of qt){let Xt=Ot.get(zt)??new Set;Xt.add(Vd(Ht[1])),Ot.set(zt,Xt)}return}let Kt=Vt?.type==="CallExpression"&&Wt==="callee";if(Mt.type==="MemberExpression"&&Ap(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 Wd(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 Ud(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: ${Wd(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 Np={collect:(K)=>K.pendingDispatchEscapeCandidates??[],resolve:Fd,apply:Ud};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 Hd=[wi(wp),wi(Tp),wi(Pp),wi(Np)];async function Dp(K,ee,Oe,Ot){let Ft=[];for(let Gt of K){let Mt=Oe(Gt);if(Mt===void 0)continue;let Vt=Hd.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=Kd(ee(Gt.filePath));for(let Kt of Mt)Kt(Gt,Wt,Vt);jt.set(Gt.filePath,Array.from(Vt.cache.keys()))}return jt}var qd=/^```([\w-]*)\r?\n([\s\S]*?)\r?\n?```$/,zd=new Set(["","js","jsx","ts","tsx","javascript","typescript"]),Xd=new Set(["svelte","html"]);function Jd(K){let ee=K.trim();if(ee==="")return null;let Oe=ee.match(qd);if(Oe){let Ot=Oe[1].toLowerCase(),Ft=Oe[2].trim();if(Ft==="")return null;if(zd.has(Ot))return{kind:"compile",code:Ft};if(Xd.has(Ot))return{kind:"syntax",code:Ft};return null}if(ee.startsWith("<"))return null;return{kind:"compile",code:ee}}function _p(K){if(!K.isFunction)return"any";return`(${(K.params??[]).map((Oe)=>`${Oe.name}${Oe.optional?"?":""}: any`).join(", ")}) => any`}function Ti(K,ee,Oe,Ot,Ft){let jt=(K??[]).filter((Mt)=>Mt.name==="example"),Gt=jt.length>1;return jt.flatMap((Mt,Vt)=>{let Wt=Jd(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 Yd(K){let ee=[];for(let Oe of K.props)ee.push(...Ti(Oe.tags,`prop:${Oe.name}`,Oe.name,_p(Oe),Oe.source));for(let Oe of K.moduleExports)ee.push(...Ti(Oe.tags,`export:${Oe.name}`,Oe.name,_p(Oe),Oe.source));for(let Oe of K.slots){let Ot=Oe.name??"default";ee.push(...Ti(Oe.tags,`slot:${Ot}`,Ot,"any",Oe.source))}for(let Oe of K.events)ee.push(...Ti(Oe.tags,`event:${Oe.name}`,Oe.name,"any",Oe.source));return ee}function Rp(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 Qd(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 Zd(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 Ip(K,ee,Oe,Ot){let Ft=Array.from(K,(Wt)=>({component:Wt,sources:Yd(Wt)})),jt=ee===!0?Rp(Ft,"compile"):[],Gt=Rp(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 Qd(Gt));if(jt.length>0){let{TypeResolver:Wt}=await import("./chunk-t6rwe82p.js"),Kt=await Wt.create(Oe);if(!Kt.ok)throw Error(`sveld: \`checkExamples\` ${Kt.message}.`);let Ht=Kt.resolver;try{Vt(await Zd(jt,Ht,Ot))}finally{await Ht.dispose()}}return Mt}import{hash as ef}from"node:crypto";import{mkdirSync as tf,readFileSync as nf,renameSync as sf,writeFileSync as Lp}from"node:fs";import{dirname as Op,isAbsolute as rf,join as of,resolve as Hr}from"node:path";var Mp=11,af=of("node_modules",".cache","sveld","parse-cache.json"),pf="ecbf6171a2e01b24";function Fp(){return`${ai}+${pf}+svelte@${Ps}`}function cf(K){let ee=q(K,["package.json"]);return ee===null?Hr(K):Op(ee)}function jp(K,ee){let Oe=cf(K);if(typeof ee==="string")return rf(ee)?ee:Hr(Oe,ee);return Hr(Oe,af)}function ki(K){return ef("sha256",K,"hex")}function qr(){return{formatVersion:Mp,toolchainVersion:Fp(),entries:{}}}function lf(K){try{let ee=JSON.parse(nf(K,"utf-8"));if(ee.formatVersion!==Mp||ee.toolchainVersion!==Fp())return qr();return ee}catch{return qr()}}class zr{cacheFilePath;file;next=new Map;dirty=!1;savedEntryCount;constructor(K){this.cacheFilePath=K,this.file=lf(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,tf(Op(this.cacheFilePath),{recursive:!0});let K={...qr(),entries:Object.fromEntries(this.next)},ee=JSON.stringify(K),Oe=`${this.cacheFilePath}.${process.pid}.tmp`;try{Lp(Oe,ee),sf(Oe,this.cacheFilePath)}catch{try{Lp(this.cacheFilePath,ee)}catch{}}}}import{dirname as uf,relative as hf,resolve as df}from"node:path";async function Bp(K,ee={}){await Wn();let Oe=df(K),Ot=uf(Oe),Ft=(Mt)=>n(`./${hf(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 gf(K){let ee=await Promise.all(Array.from(K,async(Oe)=>{try{return[Oe,await mf(Oe,"utf-8")]}catch(Ot){return console.warn(`Warning: Failed to read file ${Oe}:`,Ot),[Oe,null]}}));return new Map(ee)}function Gp(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=Gr(this.input,this.glob,this.documentExports,this.graph),this.globMergeState=vi(this.collected.allComponentEntries,this.collected.resolveComponentFilePath),this.entryFile=ff(this.input).isFile()?Vp(this.input):null,this.cache=this.options.cache===!1?void 0:new zr(jp(this.collected.rootDir,this.options.cache??!0)),await this.readEntryExports(),this.records.clear(),this.parseErrors.clear(),this.indexEntries(),await this.process(this.componentPaths()),Gp(Array.from(this.parseErrors.values())),this.assemble()}async update(K){let ee=K.map((Wt)=>Vp(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;Vr(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 Gp(Vt.errors),{result:Vt,reparsed:Mt}}async recollect(){let K=this.collected,ee=Gr(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 Bp(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:xp(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 gf(K),Ot=this.cache,Ft=new Map,jt=new Set;if(Ot)for(let[Mt,Vt]of Oe){if(Vt===null)continue;let Wt=ki(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 Ip(Ot.values(),jt,ee,Oe);for(let[Wt,Kt]of Vt)os(Wt,Kt)}let Gt=await Dp(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=Ya(jt,Oe,this.graph);for(let Ht of jt.values())os(Ht,[...Vt(Ht),...Ja(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:Eo(bo([...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 Xr,readFileSync as yf}from"node:fs";import{isAbsolute as xf,join as Up}from"node:path";var Ms='sveld: could not resolve a Svelte entry point. Set package.json#svelte, or pass the "entry" option.';function Wp(K){return xf(K)?K:Up(process.cwd(),K)}function Ie(K){if(K){let Ft=Wp(K);if(Xr(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=Up(process.cwd(),"package.json");if(!Xr(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=sp(JSON.parse(yf(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(!Xr(Wp(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 Kp(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 Yr from"node:path";function Hp(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 qp(K){return K.filter((ee)=>ee.names.length>0).map((ee)=>`export type { ${ee.names.join(", ")} } from "${ee.source}";`).join(`
139
+ `)}function zp(K){return K.replace(Nn,"")}function Jr(K){return K.replace(Nn,".svelte.d.ts")}import{mkdir as vf,readFile as Ef,writeFile as Sf}from"node:fs/promises";import{parse as bf}from"node:path";class Rn{ensuredDirs=new Set;async write(K,ee){try{if(await Ef(K,"utf-8")===ee)return!1}catch{}let Oe=bf(K).dir;if(!this.ensuredDirs.has(Oe))await vf(Oe,{recursive:!0}),this.ensuredDirs.add(Oe);return await Sf(K,ee),!0}}function Cf(K){return r(K)&&!Array.isArray(K)&&"start"in K&&"end"in K}function Qr(K){if(Array.isArray(K))return K.map((ee)=>Qr(ee));if(r(K)){let ee={};for(let[Oe,Ot]of Object.entries(K)){if((Oe==="source"||Oe==="componentCommentSource")&&Cf(Ot))continue;ee[Oe]=Qr(Ot)}return ee}return K}function wf(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`${zp(K.filePath)}.api.json`}async function Tf(K,ee,Oe){let Ot=$i(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 Rn;await Promise.all(Ot.map(async(Mt)=>{let Vt=(Ft.get(Mt.moduleName)??0)>1,Wt=wf(Mt,Vt,jt),Kt=Yr.resolve(Yr.join(Oe,Wt)),Ht=await Gt.write(Kt,ks(Mt));Mn(`${Ht?"created":"unchanged"} "${Kt}".`)}))}function $i(K,ee){let Oe=h(K,{entryExports:ee.entryExports}),Ot={...Oe,components:Oe.components.map((Ft)=>({...Ft,filePath:ua(Ft.filePath,ee.inputDir)}))};return ee.source===!1?Qr(Ot):Ot}function Zr(K,ee){return ks($i(K,ee))}async function eo(K,ee){if(ee.outDir){await Tf(K,ee,ee.outDir);return}let Oe=await new Rn().write(Yr.resolve(ee.outFile),Zr(K,ee));Mn(`${Oe?"created":"unchanged"} "${ee.outFile}".`)}import{join as fc,resolve as ao}from"node:path";var Xp=/`/g,Jp=/\s+/g,Hn="--",Yp=`| Prop name | Required | Kind | Reactive | Binding | Type | Default value | Description |
140
+ | :- | :- | :- | :- | :- | :- | :- | :- |
141
+ `,Qp=`| Slot name | Default | Props | Fallback | Description |
142
+ | :- | :- | :- | :- | :- |
143
+ `,Zp=`| Event name | Type | Detail | Description |
144
+ | :- | :- | :- | :- |
145
+ `,to=`| Name | Kind | Type | Description |
146
+ | :- | :- | :- | :- |
147
+ `,kf=`| Member | Signature | Description |
148
+ | :- | :- | :- |
149
+ `,ec=`| Part name | Description |
150
+ | :- | :- |
151
+ `,tc=`| Property name | Type | Default value | Description |
152
+ | :- | :- | :- | :- |
153
+ `,nc=/\|/g,Pf=/</g,$f=/>/g,Ai=/\n/g,Af=/^[A-Za-z_$][\w$]*$/,Nf=/\s*\n\s*/g,Df=/&(?=#?\w+;)|<(?=[A-Za-z/!?])|[|`*]|\\(?=[!-/:-@[-`{-~])|(?<![A-Za-z0-9])_|_(?![A-Za-z0-9])/g,_f=/[&<|`*\\_]/;function no(K){if(!_f.test(K))return K;return K.replace(Df,(ee)=>ee==="&"?"&amp;":ee==="<"?"&lt;":ee==="_"?"&#95;":`&#${ee.charCodeAt(0)};`)}function Rf(K){return`<code>${no(K.includes(`
154
+ `)?K.replace(Nf," "):K)}</code>`}var If=/\{@link\s+([^{}\s|]+)(?:\|([^{}]+))?\}/g;function Lf(K){if(!K.includes("{@link"))return K;return K.replace(If,(ee,Oe,Ot)=>`[${Ot===void 0?Oe:Ot.trim()}](${Oe})`)}function Of(K){return K.includes("```")||K.includes("~~~")}function Mf(K){return oc(Lf(K))}var Ff=/^([ \t]*)(`{3,}|~{3,})(.*)$/,jf=/^\n/,Bf=/\n$/;function sc(K){let ee=(jt)=>({kind:"prose",text:Mf(jt.join(`
155
+ `))});if(!Of(K))return[ee([K])];let Oe=K.split(`
156
+ `),Ot=[],Ft=[];for(let jt=0;jt<Oe.length;jt++){let Gt=Ff.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 ic(K){let ee="";for(let Oe=0;Oe<K.length;Oe++){let Ot=K[Oe];if(Ot.kind==="code"){ee+=`<pre><code>${no(Ot.code).replace(Ai,"<br />")}</code></pre>`;continue}let Ft=Ot.text;if(K[Oe-1]?.kind==="code")Ft=Ft.replace(jf,"");if(K[Oe+1]?.kind==="code")Ft=Ft.replace(Bf,"");ee+=Ft.replace(nc,"&#124;").replace(Ai,"<br />")}return ee}function En(K){if(K===void 0)return Hn;return Rf(K)}function rc(K){if(!K.reExport)return En(K.type);let{from:ee,imported:Oe}=K.reExport,Ot=Oe==="*"?"":Af.test(Oe)?`.${Oe}`:`[${JSON.stringify(Oe)}]`;return En(`typeof import(${JSON.stringify(ee)})${Ot}`)}function oc(K){if(!K.includes("<")&&!K.includes(">"))return K;return K.replace(Pf,"&lt;").replace($f,"&gt;")}function ts(K,ee){if(ee===void 0)return K;let Oe=typeof ee==="string"&&ee.trim().length>0?`: ${oc(ee).replace(Ai," ").replace(nc,"&#124;")}`:"";return`<s>${K}</s><br />**Deprecated**${Oe}`}function Ni(K){if(K===void 0||K.trim().length===0)return Hn;return ic(sc(K))}function ac(K){if(K===void 0||K==="{}"||K==="Record<string, never>")return Hn;return En(K.trim())}function pc(K){if(K===void 0)return Hn;return`<code>${no(K).replace(Ai,"<br />")}</code>`}function ms(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 sc(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 Hn;return ic(Oe)}function cc(K){return En(K)}function Vf(K){let ee=[K.extends?`Extends ${En(K.extends)}.`:"",K.implements?.length?`Implements ${K.implements.map((Oe)=>En(Oe)).join(", ")}.`:""].filter(Boolean);return ee.length>0?ee.join(" "):void 0}function lc(K,ee){let Oe=new Set;for(let Ot of ee){if(Ot.kind!=="class")continue;let Ft=Vf(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
+
160
+ `);if(!Ot.members?.length)continue;K.append("raw",kf);for(let Gt of Ot.members)K.append("raw",`| ${ts(Gt.name,Gt.deprecated)} | ${En($r(Gt))} | ${ms(Gt.description,Gt.tags)} |
161
+ `);K.append("raw",`
162
+ `)}}function uc(K,ee,Oe){if(K.append("h1","Component Index"),K.append("h2","Components").tableOfContents(),K.append("divider"),Oe&&Oe.length>0)dc(K,Oe);for(let Ot of h(ee).components)io(K,Ot)}function hc(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
+ `);if(K.append("raw",`
164
+ `),K.append("divider"),Oe&&Oe.length>0)dc(K,Oe)}function dc(K,ee){K.append("h2","Exports"),K.append("raw",to);for(let Oe of ee){let Ot=(Oe.type??Oe.value)?.replace(Jp," ").trim();K.append("raw",`| ${ts(Oe.name,Oe.deprecated)} | <code>${Oe.kind}</code> | ${En(Ot)} | ${Ni(Oe.description)} |
165
+ `)}K.append("raw",`
166
+ `),K.append("divider")}function Gf(K,ee){K.append("h3","Module exports"),K.append("raw",to);for(let Oe of ee)K.append("raw",`| ${ts(Oe.name,Oe.deprecated)} | <code>${Oe.kind}</code> | ${rc(Oe)} | ${ms(Oe.description,Oe.tags)} |
167
+ `);K.append("raw",`
168
+ `),lc(K,ee)}function so(K,ee,Oe){if(ee.length>0)Oe(),K.append("raw",`
169
+ `);else K.append("p","None.")}function io(K,ee){if(K.append("h2",`\`${ee.moduleName}\``),ee.generics)K.append("p",`**Type parameters:** ${En(`<${ee.generics[1]}>`)}`);if(ee.typedefs.length>0)K.append("h3","Types").append("raw",`\`\`\`ts
170
+ ${gi({typedefs:ee.typedefs})}
171
+ \`\`\`
172
+
173
+ `);if(K.append("h3","Props"),so(K,ee.props,()=>{K.append("raw",Yp);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=yi(Ft)?"accessor":Ft.kind;K.append("raw",`| ${ts(Ft.name,Ft.deprecated)} | ${Ft.isRequired?"Yes":"No"} | <code>${jt}</code> | ${Ft.reactive?"Yes":"No"} | ${Ft.binding??"--"} | ${En(Ft.type)} | ${En(Ft.value)} | ${ms(Ft.description,Ft.tags)} |
174
+ `)}}),ee.moduleExports.length>0)Gf(K,ee.moduleExports);if(K.append("h3","Slots"),so(K,ee.slots,()=>{K.append("raw",Qp);for(let Oe of ee.slots)K.append("raw",`| ${ts(Oe.default?Hn:Oe.name??Hn,Oe.deprecated)} | ${Oe.default?"Yes":"No"} | ${ac(Oe.slot_props)} | ${pc(Oe.fallback)} | ${ms(Oe.description,Oe.tags)} |
175
+ `)}),K.append("h3","Events"),so(K,ee.events,()=>{K.append("raw",Zp);for(let Oe of ee.events)K.append("raw",`| ${ts(Oe.name,Oe.deprecated)} | ${Oe.type} | ${cc(Oe.detail)} | ${ms(Oe.description,Oe.tags)} |
176
+ `)}),ee.cssParts&&ee.cssParts.length>0){K.append("h3","CSS Parts"),K.append("raw",ec);for(let Oe of ee.cssParts)K.append("raw",`| ${Oe.name} | ${Ni(Oe.description)} |
177
+ `);K.append("raw",`
178
+ `)}if(ee.cssProperties&&ee.cssProperties.length>0){K.append("h3","CSS Custom Properties"),K.append("raw",tc);for(let Oe of ee.cssProperties)K.append("raw",`| ${Oe.name} | ${En(Oe.type)} | ${En(Oe.default)} | ${Ni(Oe.description)} |
179
+ `);K.append("raw",`
180
+ `)}}var Wf=/[^\w\- ]+/g,Uf=/\s+/g,ro="<!-- __TOC__ -->";function Kf(K,ee){let Oe=K.toLowerCase().replace(Xp,"").replace(Wf,"").replace(Uf,"-"),Ot=ee.get(Oe)??0;return ee.set(Oe,Ot+1),Ot===0?Oe:`${Oe}-${Ot}`}class oo{sourceParts=[];hasToC=!1;toc=[];onAppend;constructor(K={}){this.onAppend=K.onAppend}get source(){return this.sourceParts.join("")}appendLineBreaks(){return this.sourceParts.push(`
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(ro),this.hasToC=!0,this.appendLineBreaks(),this}end(){let K=this.sourceParts.join("");if(!this.hasToC)return K;let ee=K.indexOf(ro);if(ee===-1)return K;let Oe=new Map,Ot=this.toc.map(({indent:Ft,raw:jt})=>`${" ".repeat(Ft)}- [${jt}](#${Kf(jt,Oe)})`).join(`
183
+ `);return K.slice(0,ee)+Ot+K.slice(ee+ro.length)}}function Di(K,ee){return new oo({onAppend:(Oe,Ot)=>{ee?.onAppend?.call(null,Oe,Ot,K)}})}function Fs(K,ee){let Oe=Di(K,ee);return uc(Oe,K,ee.entryExports),Oe.end()}async function Hf(K,ee,Oe){let Ot=h(K,{entryExports:ee.entryExports}),Ft=new Rn,jt=Di(K,ee);hc(jt,Ot.components,ee.entryExports);let Gt=ao(fc(Oe,"README.md")),Mt=await Ft.write(Gt,jt.end());Mn(`${Mt?"created":"unchanged"} "${Gt}".`),await Promise.all(Ot.components.map(async(Vt)=>{let Wt=Di(K,ee);io(Wt,Vt);let Kt=ao(fc(Oe,`${Vt.moduleName}.md`)),Ht=await Ft.write(Kt,Wt.end());Mn(`${Ht?"created":"unchanged"} "${Kt}".`)}))}async function po(K,ee){if(ee.outDir){await Hf(K,ee,ee.outDir);return}let Oe=ao(ee.outFile),Ot=await new Rn().write(Oe,Fs(K,ee));Mn(`${Ot?"created":"unchanged"} "${ee.outFile}".`)}import{join as qf,resolve as zf}from"node:path";function Xf(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||!Nn.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=[ds(Mt.moduleName)];if(Oe)Vt.push(Ds(Mt.moduleName));Ft.push({source:jt.source,names:Vt})}return Ft}async function mc(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 Jf(K,ee){return`${K}
184
+ ${Xa(ee)}`}async function co(K,ee){let Oe=zf(ee.outDir,"index.d.ts"),Ot=new Rn,Ft=h(K),jt=qp(Xf(Ft,ee)),Gt=ee.preamble+[Hp(ee.exports),jt].filter((zt)=>zt!=="").join(`
185
+
186
+ `),Mt=Ar(ee),Vt=Ft.components.map(async(zt)=>{let Xt=Jr(qf(ee.outDir,zt.filePath)),Qt=n(Jr(zt.filePath)),Jt=ee.resolvedPathByFilePath?.get(zt.filePath),tn=Jt?void 0:ee.crossFileResolvedPathByFilePath?.get(zt.filePath),sn=Jt??tn,cn=Jf(zt.moduleName,Mt),pn=tn?`${cn}
187
+ ${ki(JSON.stringify(zt))}`:cn,ln=sn?ee.cache?.getGeneratedText(sn,pn):void 0;if(ln===void 0){if(ln=Nr(zt,Mt),sn)ee.cache?.setGeneratedText(sn,pn,ln)}let In=await mc(ee.transform,ln,{kind:"component",component:zt,filePath:Qt});return Ot.write(Xt,In)}),Wt=(async()=>{let zt=await mc(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}`;Mn(`${qt} TypeScript definitions in "${ee.outDir}".`)}var Yf=["reportDiagnostics","strict","check","checkLevel","stdout","format"],Qf=50;function Zf(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=Zf(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 js(zt,Ft,Ot)}catch(zt){console.error("sveld: failed to regenerate types in watch mode:",zt)}}),Ht=(qt)=>{if(!ee||Gt==null||!la.test(qt))return;Vt.add(qt),clearTimeout(Mt),Mt=setTimeout(Kt,Qf)};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=I(zt,K)}j(Ft);let qt=Yf.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=Pi(Ft.entry),ee&&Ot!=null)try{Gt=await Kp(Ot,Ft.glob===!0,Ls(Ft)),await js(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(Ms);Oe=await Os(Ot,Ft.glob===!0,Ls(Ft))},async writeBundle(){if(ee)return;if(Ot==null)this.error(Ms);await js(Oe,Ft,Ot)},handleHotUpdate(qt){Ht(qt.file)},watchChange(qt){Ht(qt)}}}async function js(K,ee,Oe){let Ot=gc(Oe);if(ee.types!==!1)await co(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 eo(K.components,{outFile:"COMPONENT_API.json",...ee.jsonOptions,inputDir:Ot,entryExports:K.entryExports});if(ee.markdown)await po(K.components,{outFile:"COMPONENT_INDEX.md",...ee.markdownOptions,entryExports:K.entryExports});K.cache?.save()}async function yc(K,ee,Oe){if(ee.json){let Ot=Zr(K.components,{...ee.jsonOptions,inputDir:gc(Oe),entryExports:K.entryExports});process.stdout.write(Ot);return}if(ee.markdown){let Ot=Fs(K.components,{...ee.markdownOptions,entryExports:K.entryExports});process.stdout.write(Ot)}}import{dirname as em}from"node:path";function tm(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&&ya(K.check.bump,K.checkLevel??"major"))return 3;if(vo(K.diagnostics,K.strict).length>0)return 4;return 0}async function Re(K,ee,Oe=!1){let Ot=await Os(K,ee.glob===!0,Ls(ee)),Ft=ee.check?await Ne(Ot.components,xa(ee),{entryExports:Ot.entryExports}):void 0;return await(Oe?yc:js)(Ot,ee,K),{result:Ot,check:Ft}}function Le(K,ee,Oe){let Ot=Oe.reportDiagnostics||Oe.strict,Ft=xo(K.diagnostics,Ot);if(Ot&&Ft.length>0)if(Oe.format==="json")process.stderr.write(wo(Ft));else console.error(Co(Ft));let jt=tm({errors:K.errors,check:ee,writesSnapshot:ee?va(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=Pi(ee??Ot.entry);if(Ft===null)throw Error(Ms);let jt=I(Ot,Oe,{entry:Ft});j(jt),F(jt.quiet===!0);let{result:Gt,check:Mt}=await Re(Ft,jt),{diagnostics:Vt,exitCode:Wt}=Le(Gt,Mt,jt),Kt=$i(Gt.components,{inputDir:em(Ft),entryExports:Gt.entryExports,source:jt.jsonOptions?.source});return{diagnostics:Vt,check:Mt,errors:Gt.errors,document:Kt,exitCode:Wt}}
189
+ export{x,R,te,g,P,Te,U,ne,Ee,G,T,p,o,r,S,t,k,u,d,b,Me,Se,w,c,L,A,i,W,v,C,re,ie,a,H,$e,_,O,y,l,z,se,X,oe,ke,Q,ae,Be,be,ce,Y,m,E,s,pe,ue,e,Je,je,qe,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,ut,lt,ft,Ae,dt,mt,ht,gt,yt,xt,le,Tt,Et,St,_e,kt,bt,wt,vt,f,Ct,Dt,Pt,fe,de,M,At,_t,B,me,he,N,n,Nt,h,It,Ne,ge,Rt,ye,$t,J,I,j,Z,q,F,xe,V,Ie,Lt,Re,Le,Bt};