sveld 0.38.8 → 0.38.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -21
- package/browser.js +126 -126
- package/chunk-3aykpznf.js +40 -0
- package/chunk-dmh6cpfa.js +1 -0
- package/chunk-q988tzf8.js +191 -0
- package/chunk-sjga1h52.js +5 -0
- package/cli-entry.js +3 -3
- package/index.d.ts +9 -4
- package/index.js +1 -1
- package/package.json +1 -1
- package/chunk-1azsj0zd.js +0 -13
- package/chunk-4hn2yn5w.js +0 -1
- package/chunk-mnkbqz8m.js +0 -40
- package/chunk-sfnqvdg5.js +0 -189
- package/chunk-t6rwe82p.js +0 -5
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
var x=Symbol("sveld.parsedComponentTypeScriptMetadata"),I=Symbol("sveld.parsedComponentPropIgnores");function fo(Z){return Z[I]}function mo(Z){return Z[x]}var Fs=Array(2048).fill(void 0);function _c(){Fs.fill(void 0)}function go(Z,ee,Le,Ot){let Bt=Ot&2047,jt=Fs[Bt];if(jt!==void 0&&jt.length===Le-ee&&Z.startsWith(jt,ee))return jt;let Gt=Z.slice(ee,Le);return Fs[Bt]=Gt,Gt}var oi="",Dn=[0],Vn=0,ri=0,jn;function te(Z){_c(),oi=Z,Dn=[0],Vn=0,ri=0,jn=void 0}function Bs(Z){while(Vn<=Z){let ee=oi.indexOf(`
|
|
2
|
+
`,Vn);if(ee===-1){Vn=Number.POSITIVE_INFINITY;return}Vn=ee+1,Dn.push(Vn)}}function yo(Z){let ee=[0],Le=Z.indexOf(`
|
|
3
|
+
`);while(Le!==-1)ee.push(Le+1),Le=Z.indexOf(`
|
|
4
|
+
`,Le+1);return ee}function Ki(Z,ee,Le){let Ot=0,Bt=Z.length-1;if(ee>=Z[Le])Ot=Le;else Bt=Le-1;if(Ot<Bt&&ee<Z[Ot+1])Bt=Ot;while(Ot<Bt){let jt=Ot+Bt+1>>>1;if(Z[jt]<=ee)Ot=jt;else Bt=jt-1}return Ot}function g(Z){return Bs(Z),ri=Ki(Dn,Z,ri),{line:ri+1,column:Z-Dn[ri],character:Z}}var Ms=/\r\n?|\n|\u2028|\u2029/g,$c=/[\r\u2028\u2029]/;function xo(Z){if(jn===void 0){jn=$c.test(oi)?[]:null,Ms.lastIndex=0;while(jn!==null&&Ms.exec(oi)!==null)jn.push(Ms.lastIndex)}if(jn===null)return Bs(Z),Ki(Dn,Z,ri);let ee=0,Le=jn.length;while(ee<Le){let Ot=ee+Le>>>1;if(jn[Ot]<=Z)ee=Ot+1;else Le=Ot}return ee}function A(Z){let{line:ee,column:Le}=g(Z);return{line:ee,column:Le}}function vo(Z){while(Dn.length<=Z+1&&Vn!==Number.POSITIVE_INFINITY)Bs(Vn);if(Z>=Dn.length)return;let ee=Z+1<Dn.length?Dn[Z+1]-1:oi.length;return oi.slice(Dn[Z],ee)}function Ee(Z){let ee,Le=0;return(Ot)=>(ee??=yo(Z),Le=Ki(ee,Ot,Le),{line:Le+1,column:Ot-ee[Le]})}function Ln(Z){return typeof Z==="object"&&Z!==null&&typeof Xn(Z).type==="string"}function Xn(Z){return Z}function W(Z,ee){let Le=Xn(Z);for(let Ot in Le){let Bt=Le[Ot];if(Array.isArray(Bt)){for(let jt=0;jt<Bt.length;jt++)if(Ln(Bt[jt]))Bt[jt]=ee(Bt[jt])}else if(Ln(Bt))Le[Ot]=ee(Bt)}}function ne(Z,...ee){if(!ee.some((Le)=>Le===Z.type))throw Error(`expected ${ee.join(" or ")}, got ${Z.type}`)}function ve(Z){let ee=[];return Jn(Z,ee),ee}function Jn(Z,ee){switch(Z.type){case"Identifier":ee.push(Z);return;case"ObjectPattern":for(let Le of Z.properties)Jn(Le.type==="RestElement"?Le.argument:Le.value,ee);return;case"ArrayPattern":for(let Le of Z.elements)if(Le!==null)Jn(Le,ee);return;case"RestElement":Jn(Z.argument,ee);return;case"AssignmentPattern":Jn(Z.left,ee);return;case"TSParameterProperty":Jn(Z.parameter,ee);return;case"TSAsExpression":case"TSNonNullExpression":case"TSSatisfiesExpression":case"TSTypeAssertion":Jn(Z.expression,ee)}}function H(Z,ee){if(Z.type!=="Identifier")return!1;if(ee===null)return!0;switch(ee.type){case"MemberExpression":return ee.computed||Z===ee.object;case"MethodDefinition":return ee.computed;case"Property":case"PropertyDefinition":return ee.computed||Z===ee.value;case"ExportSpecifier":case"ImportSpecifier":return Z===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 Z===ee.expression;case"TSEnumMember":return Z===ee.initializer;case"TSParameterProperty":case"TSEnumDeclaration":case"TSImportEqualsDeclaration":return!0;default:return!ee.type.startsWith("TS")}}var Yn={Root:["module","instance","fragment","css"],Script:["attributes","content"],Fragment:["nodes"],Text:[],Comment:[],ExpressionTag:["expression"],HtmlTag:["expression"],ConstTag:["declaration"],DeclarationTag:["declaration"],DebugTag:["identifiers"],RenderTag:["expression"],AttachTag:["expression"],Attribute:["value"],SpreadAttribute:["expression"],AnimateDirective:["expression"],BindDirective:["expression"],ClassDirective:["expression"],LetDirective:["expression"],OnDirective:["expression"],StyleDirective:["value"],TransitionDirective:["expression"],UseDirective:["expression"],Component:["attributes","fragment"],TitleElement:["attributes","fragment"],SlotElement:["attributes","fragment"],RegularElement:["attributes","fragment"],SvelteBody:["attributes","fragment"],SvelteBoundary:["attributes","fragment"],SvelteComponent:["expression","attributes","fragment"],SvelteDocument:["attributes","fragment"],SvelteElement:["tag","attributes","fragment"],SvelteFragment:["attributes","fragment"],SvelteHead:["attributes","fragment"],SvelteOptions:["attributes","fragment"],SvelteSelf:["attributes","fragment"],SvelteWindow:["attributes","fragment"],IfBlock:["test","consequent","alternate"],EachBlock:["expression","context","key","body","fallback"],AwaitBlock:["expression","pending","value","then","error","catch"],KeyBlock:["expression","fragment"],SnippetBlock:["expression","parameters","body"],StyleSheet:["attributes","children"],Rule:["prelude","block"],Atrule:["block"],SelectorList:["children"],ComplexSelector:["children"],RelativeSelector:["combinator","selectors"],Combinator:[],TypeSelector:[],IdSelector:[],ClassSelector:[],AttributeSelector:[],PseudoElementSelector:["args"],PseudoClassSelector:["args"],Percentage:[],Nth:[],NestingSelector:[],Block:["children"],Declaration:[],Program:["body"],ExpressionStatement:["expression"],BlockStatement:["body"],StaticBlock:["body"],EmptyStatement:[],DebuggerStatement:[],WithStatement:["object","body"],ReturnStatement:["argument"],LabeledStatement:["label","body"],BreakStatement:["label"],ContinueStatement:["label"],IfStatement:["test","consequent","alternate"],SwitchStatement:["discriminant","cases"],SwitchCase:["test","consequent"],ThrowStatement:["argument"],TryStatement:["block","handler","finalizer"],CatchClause:["param","body"],WhileStatement:["test","body"],DoWhileStatement:["body","test"],ForStatement:["init","test","update","body"],ForInStatement:["left","right","body"],ForOfStatement:["left","right","body"],FunctionDeclaration:["id","typeParameters","params","returnType","body"],FunctionExpression:["id","typeParameters","params","returnType","body"],ArrowFunctionExpression:["typeParameters","params","returnType","body"],VariableDeclaration:["declarations"],VariableDeclarator:["id","init"],ClassDeclaration:["decorators","id","typeParameters","superClass","superTypeParameters","implements","body"],ClassExpression:["decorators","id","typeParameters","superClass","superTypeParameters","implements","body"],ClassBody:["body"],MethodDefinition:["decorators","key","typeParameters","value"],PropertyDefinition:["decorators","key","typeAnnotation","value"],Property:["decorators","key","value"],ThisExpression:[],Super:[],Literal:[],Identifier:["decorators","typeAnnotation"],PrivateIdentifier:[],ArrayExpression:["elements"],ObjectExpression:["properties"],UnaryExpression:["argument"],UpdateExpression:["argument"],BinaryExpression:["left","right"],LogicalExpression:["left","right"],AssignmentExpression:["left","right"],MemberExpression:["object","property"],ConditionalExpression:["test","consequent","alternate"],CallExpression:["callee","typeArguments","arguments"],NewExpression:["callee","typeArguments","arguments"],SequenceExpression:["expressions"],TemplateLiteral:["quasis","expressions"],TaggedTemplateExpression:["tag","typeArguments","quasi"],TemplateElement:[],SpreadElement:["argument"],RestElement:["decorators","argument","typeAnnotation"],YieldExpression:["argument"],AwaitExpression:["argument"],ImportExpression:["source","options","arguments"],ChainExpression:["expression"],ParenthesizedExpression:["expression"],MetaProperty:["meta","property"],ObjectPattern:["decorators","properties","typeAnnotation"],ArrayPattern:["decorators","elements","typeAnnotation"],AssignmentPattern:["decorators","left","right"],ImportDeclaration:["specifiers","source","attributes"],ImportSpecifier:["imported","local"],ImportDefaultSpecifier:["local"],ImportNamespaceSpecifier:["local"],ImportAttribute:["key","value"],ExportNamedDeclaration:["declaration","specifiers","source","attributes"],ExportSpecifier:["local","exported"],ExportDefaultDeclaration:["declaration"],ExportAllDeclaration:["exported","source","attributes"],Decorator:["expression"],TSTypeAnnotation:["typeAnnotation"],TSTypeParameterDeclaration:["params"],TSTypeParameterInstantiation:["params"],TSTypeParameter:["constraint","default"],TSAnyKeyword:[],TSBigIntKeyword:[],TSBooleanKeyword:[],TSNeverKeyword:[],TSNullKeyword:[],TSNumberKeyword:[],TSObjectKeyword:[],TSStringKeyword:[],TSSymbolKeyword:[],TSUndefinedKeyword:[],TSUnknownKeyword:[],TSVoidKeyword:[],TSThisType:[],TSArrayType:["elementType"],TSTupleType:["elementTypes"],TSNamedTupleMember:["label","elementType"],TSOptionalType:["typeAnnotation"],TSRestType:["typeAnnotation"],TSUnionType:["types"],TSIntersectionType:["types"],TSConditionalType:["checkType","extendsType","trueType","falseType"],TSInferType:["typeParameter"],TSParenthesizedType:["typeAnnotation"],TSTypeOperator:["typeAnnotation"],TSIndexedAccessType:["objectType","indexType"],TSMappedType:["typeParameter","nameType","typeAnnotation"],TSLiteralType:["literal"],TSTypeReference:["typeName","typeArguments"],TSQualifiedName:["left","right"],TSTypeQuery:["exprName","typeArguments"],TSImportType:["argument","qualifier","typeArguments"],TSTypeLiteral:["members"],TSPropertySignature:["key","typeAnnotation"],TSMethodSignature:["key","typeParameters","parameters","typeAnnotation"],TSCallSignatureDeclaration:["typeParameters","parameters","typeAnnotation"],TSConstructSignatureDeclaration:["typeParameters","parameters","typeAnnotation"],TSFunctionType:["typeParameters","parameters","typeAnnotation"],TSConstructorType:["typeParameters","parameters","typeAnnotation"],TSIndexSignature:["decorators","parameters","typeAnnotation"],TSTypePredicate:["parameterName","typeAnnotation"],TSInterfaceDeclaration:["id","typeParameters","extends","body"],TSInterfaceBody:["body"],TSExpressionWithTypeArguments:["expression","typeParameters"],TSTypeAliasDeclaration:["id","typeParameters","typeAnnotation"],TSEnumDeclaration:["id","members"],TSEnumMember:["id","initializer"],TSModuleDeclaration:["id","body"],TSModuleBlock:["body"],TSImportEqualsDeclaration:["id","moduleReference"],TSExternalModuleReference:["expression"],TSExportAssignment:["expression"],TSNamespaceExportDeclaration:["id"],TSDeclareFunction:["id","typeParameters","params","returnType"],TSDeclareMethod:["typeParameters","params","returnType"],TSParameterProperty:["parameter"],TSAsExpression:["expression","typeAnnotation"],TSSatisfiesExpression:["expression","typeAnnotation"],TSTypeAssertion:["typeAnnotation","expression"],TSNonNullExpression:["expression"],TSInstantiationExpression:["expression","typeArguments"]};var rn=[],ai={...Yn,FunctionDeclaration:["id","params","body"],FunctionExpression:["id","params","body"],ArrowFunctionExpression:["params","body"],ClassDeclaration:["decorators","id","superClass","body"],ClassExpression:["decorators","id","superClass","body"],MethodDefinition:["decorators","key","value"],PropertyDefinition:["decorators","key","value"],Identifier:["decorators"],CallExpression:["callee","arguments"],NewExpression:["callee","arguments"],TaggedTemplateExpression:["tag","quasi"],RestElement:["decorators","argument"],ObjectPattern:["decorators","properties"],ArrayPattern:["decorators","elements"],TSTypeAnnotation:rn,TSTypeParameterDeclaration:rn,TSTypeParameterInstantiation:rn,TSTypeParameter:rn,TSArrayType:rn,TSTupleType:rn,TSNamedTupleMember:rn,TSOptionalType:rn,TSRestType:rn,TSUnionType:rn,TSIntersectionType:rn,TSConditionalType:rn,TSInferType:rn,TSParenthesizedType:rn,TSTypeOperator:rn,TSIndexedAccessType:rn,TSMappedType:rn,TSLiteralType:rn,TSTypeReference:rn,TSTypeQuery:rn,TSImportType:rn,TSTypeLiteral:rn,TSPropertySignature:rn,TSMethodSignature:rn,TSCallSignatureDeclaration:rn,TSConstructSignatureDeclaration:rn,TSFunctionType:rn,TSConstructorType:rn,TSIndexSignature:rn,TSTypePredicate:rn,TSInterfaceDeclaration:rn,TSInterfaceBody:rn,TSExpressionWithTypeArguments:rn,TSTypeAliasDeclaration:rn,TSNamespaceExportDeclaration:rn,TSDeclareFunction:["id"],TSDeclareMethod:rn,TSAsExpression:["expression"],TSSatisfiesExpression:["expression"],TSTypeAssertion:["expression"],TSInstantiationExpression:["expression"]},Nc=Object.assign(Object.create(null),Yn),Dc=Object.assign(Object.create(null),ai),Eo=[],E=Symbol("sveast.walk.stop"),p=Symbol("sveast.walk.skip");function o(Z,ee,Le){Hi(Z,null,null,null,ee,Rc(Le))}function Rc(Z){if(Z===void 0||Z===Yn)return Oc;if(Z===ai)return Lc;return(ee)=>Ic(Z,ee.type)}function Ic(Z,ee){return Object.hasOwn(Z,ee)?Z[ee]:void 0}var Sm=Object.freeze([]);function Hi(Z,ee,Le,Ot,Bt,jt){let Gt=jt(Z);if(Gt===void 0)throw Error(`unknown node type: ${Z.type}`);let Lt=Bt.enter?.(Z,ee,Le,Ot);if(Lt===E)return!0;if(Lt!==p){if(Lt!==Z&&Ln(Lt))return Mc(Lt,ee,Le,Ot,Bt,jt);let Vt=Xn(Z);for(let Wt=0;Wt<Gt.length;Wt++){let Kt=Gt[Wt],Ht=Vt[Kt];if(Array.isArray(Ht))for(let qt=0;qt<Ht.length;qt++){let zt=Ht[qt];if(Ln(zt)&&Hi(zt,Z,Kt,qt,Bt,jt))return!0}else if(Ln(Ht)&&Hi(Ht,Z,Kt,null,Bt,jt))return!0}}return Bt.leave?.(Z,ee,Le,Ot)===E}function Oc(Z){let ee=Z.type;if(ee==="Identifier")return Z.typeAnnotation===void 0&&Z.decorators===void 0?Eo:Yn.Identifier;if(ee==="Literal")return Yn.Literal;if(ee==="Text")return Yn.Text;return Nc[ee]}function Lc(Z){let ee=Z.type;if(ee==="Identifier")return Z.decorators===void 0?Eo:ai.Identifier;if(ee==="Literal")return ai.Literal;if(ee==="Text")return ai.Text;return Dc[ee]}function Mc(Z,ee,Le,Ot,Bt,jt){if(ee===null||Le===null)throw Error("walk can't replace the node it was called with");let Gt=Xn(ee),Lt=Gt[Le];if(Ot===null)Gt[Le]=Z;else if(Array.isArray(Lt))Lt[Ot]=Z;return Hi(Z,ee,Le,Ot,Bt,jt)}function r(Z){return typeof Z==="object"&&Z!==null}function S(Z){return r(Z)&&Z.type==="Literal"}function t(Z){return r(Z)&&Z.type==="Identifier"&&typeof Z.name==="string"}function b(Z){return r(Z)&&Z.type==="MemberExpression"}function c(Z){return r(Z)&&Z.type==="ObjectExpression"&&Array.isArray(Z.properties)}function Fc(Z){return r(Z)&&Z.type==="CallExpression"}function f(Z,ee){return Fc(Z)&&t(Z.callee)&&Z.callee.name===ee}function T(Z){return Z?.type==="TSAsExpression"||Z?.type==="TSSatisfiesExpression"?T(Z.expression):Z}function Oe(Z){return Z?.type==="TSAsExpression"||Z?.type==="TSSatisfiesExpression"?Z.typeAnnotation:void 0}function Bc(Z){return r(Z)&&Z.type==="NewExpression"}function Se(Z,ee){return Bc(Z)&&t(Z.callee)&&Z.callee.name===ee}function C(Z){if(!r(Z))return null;if(Z.type==="Literal")return Z.value==null?null:String(Z.value);if(Z.type==="TemplateLiteral"){let ee=Z.quasis;if(ee?.length===1)return ee[0]?.value?.cooked??null}return null}function l(Z){if(t(Z))return Z.name;if(S(Z))return Z.value==null?void 0:String(Z.value);return}var jc=new Set(["Component","SvelteComponent","SvelteSelf"]),Vc=new Set(["RegularElement","SvelteElement"]);function L(Z){return jc.has(Z)}function D(Z){return Vc.has(Z)}function qi(Z,ee,Le=0,Ot=Z.length,Bt=0){let jt=Bt;for(let Gt=Le;Gt<Ot;Gt++){let Lt=Z.charCodeAt(Gt);if(Lt===34||Lt===39||Lt===96){Gt=Gc(Z,Gt,Ot);continue}if(Lt===123||Lt===40||Lt===91||Lt===60)jt++;else if(Lt===125||Lt===41||Lt===93||Lt===62&&Z.charCodeAt(Gt-1)!==61){if(jt>0)jt--}if(ee?.(Gt,jt)===!0)break}return jt}function Gc(Z,ee,Le){let Ot=Z.charCodeAt(ee);for(let Bt=ee+1;Bt<Le;Bt++){let jt=Z.charCodeAt(Bt);if(jt===92)Bt++;else if(jt===Ot)return Bt}return Le-1}function i(Z,ee){let Le=[],Ot=0;return qi(Z,(Bt,jt)=>{if(jt===0&&ee.includes(Z[Bt]))Le.push(Z.slice(Ot,Bt)),Ot=Bt+1;return!1}),Le.push(Z.slice(Ot)),Le}function js(Z,ee,Le=0){let Ot=-1;return qi(Z,(Bt,jt)=>{if(ee(Bt,jt))Ot=Bt;return Ot!==-1},Le),Ot}function U(Z,ee){return js(Z,(Le,Ot)=>Ot===0&&ee.includes(Z[Le]))}function k(Z){return js(Z,(ee,Le)=>Le===0&&Z[ee]==="="&&Z[ee+1]===">")}function w(Z,ee){return js(Z,(Le,Ot)=>Ot===0,ee)}function Vs(Z){let ee=Z.trim();return ee.startsWith("[")&&w(ee,0)===ee.length-1}function re(Z){if(!Z)return;let ee=k(Z);if(ee===-1)return;return Z.slice(ee+2).trim()||void 0}var Wc=new Set(["null","undefined"]);function ie(Z){if(!Z)return!1;let ee=i(Z,"|").map((Ot)=>Ot.trim()).filter((Ot)=>Ot&&!Wc.has(Ot));if(ee.length!==1)return!1;let[Le]=ee;while(Le.startsWith("(")&&w(Le,0)===Le.length-1)Le=Le.slice(1,-1).trim();return(Le.startsWith("(")||Le.startsWith("<"))&&k(Le)!==-1}function Uc(Z){let ee="";for(let Le=0;Le<Z.length;Le++){let Ot=Z[Le];if(Ot==="*"&&Z[Le+1]==="*"){if(Le++,Z[Le+1]==="/")ee+="(?:.*/)?",Le++;else ee+=".*";continue}if(Ot==="*"){ee+="[^/]*";continue}if(Ot==="?"){ee+="[^/]";continue}ee+=".+^$()[]{}|\\".includes(Ot)?`\\${Ot}`:Ot}return ee}function So(Z,ee){return new RegExp(`^${Uc(Z)}$`).test(ee)}var Gs={"prop-unknown-type":{severity:"warning",label:"Props without inferred types"},"context-any-type":{severity:"warning",label:"Context values typed as `any`"},"slot-missing-type":{severity:"warning",label:"@slot/@snippet tags missing a {Type} annotation"},"slot-not-rendered":{severity:"warning",label:"@slot/@snippet tags for slots the component doesn't render"},"event-no-source":{severity:"warning",label:"@event tags with no dispatch or callback"},"dispatch-escapes":{severity:"warning",label:"Dispatchers passed to functions sveld can't follow"},"example-compile-error":{severity:"error",label:"@example blocks that failed to compile"},"example-syntax-error":{severity:"error",label:"@example blocks that failed to parse"},"syntax-skipped":{severity:"error",label:"Component syntax sveld skipped"},"type-syntax-error":{severity:"error",label:"JSDoc types that aren't valid TypeScript"},"rest-props-unresolved":{severity:"warning",label:"$$restProps spread only onto components"},"context-duplicate-key":{severity:"warning",label:"Duplicate setContext keys"},"context-key-unresolved":{severity:"warning",label:"setContext keys sveld couldn't resolve"},"context-value-unresolved":{severity:"warning",label:"setContext values sveld couldn't describe"},"spread-unresolved":{severity:"warning",label:"Unresolved spreads widened to Record<string, any>"},"export-unresolved":{severity:"warning",label:"Unresolved named export specifiers"},"module-export-conflict":{severity:"warning",label:"Module-script exports colliding with generated names"},"extend-props-target-missing":{severity:"error",label:"@extends/@extendProps targets that couldn't be verified"},"extend-props-duplicate":{severity:"warning",label:"Duplicate @extends/@extendProps tags"},"extend-props-override":{severity:"warning",label:"Own props overriding an @extends target's prop"},"jsdoc-unknown-tag":{severity:"warning",label:"Unknown JSDoc tags"},"typedef-duplicate":{severity:"warning",label:"Duplicate @typedef/@callback names"},"property-duplicate":{severity:"warning",label:"Duplicate @property names"},"generics-conflict":{severity:"warning",label:"Duplicate @generics/@template names"},"event-description-ambiguous":{severity:"warning",label:"Text after an @event read as the next tag's description"},"jsdoc-tag-dropped":{severity:"warning",label:"Passthrough JSDoc tags that couldn't attach"},"internal-typedef-referenced":{severity:"error",label:"Public types referencing an @internal typedef"},"cross-file-unresolved":{severity:"warning",label:"Imports a standalone parse couldn't read"},"export-ambiguous":{severity:"warning",label:"Ambiguous `export *` names left out of the entry exports"}};function a(Z){return{...Z,code:z[Z.kind],severity:Gs[Z.kind].severity}}function Co(Z,ee){if(ee)return Z;return Z.filter((Le)=>Le.kind!=="jsdoc-unknown-tag")}function bo(Z,ee){if(!ee)return[];return Z.filter((Le)=>!Le.ignored&&(ee!=="errors"||Le.severity==="error"))}function Kc(Z,ee){if(ee.code!==void 0&&ee.code!==Z.code)return!1;if(ee.name!==void 0&&ee.name!==Z.name)return!1;if(ee.component!==void 0&&!So(ee.component,Z.component))return!1;return!0}function wo(Z,ee){if(!ee||ee.length===0)return Z;return Z.map((Le)=>Le.ignored||ee.some((Ot)=>Kc(Le,Ot))?{...Le,ignored:!0}:Le)}var To=Object.keys(Gs),z=Object.fromEntries(To.map((Z)=>[Z,`sveld/${Z}`]));function ko(Z){let ee=new Set,Le=[];for(let Ot of Z){let Bt=`${Ot.component}:${Ot.kind}:${Ot.name}`;if(ee.has(Bt))continue;ee.add(Bt),Le.push(Ot)}return Le}function Ao(Z){let ee=Z.filter((Vt)=>!Vt.ignored),Le=Z.length-ee.length,Ot=Le>0?` (${Le} ignored)`:"";if(ee.length===0)return`sveld: no diagnostics${Ot}.`;let Bt=[],jt=(Vt,Wt)=>`${Vt} ${Wt}${Vt===1?"":"s"}`,Gt=ee.filter((Vt)=>Vt.severity==="error").length,Lt=`${jt(Gt,"error")}, ${jt(ee.length-Gt,"warning")}`;Bt.push(`sveld: ${jt(ee.length,"diagnostic")} (${Lt})${Ot}.`);for(let Vt of To){let Wt=ee.filter((Ht)=>Ht.kind===Vt);if(Wt.length===0)continue;Bt.push(""),Bt.push(`${Gs[Vt].label} (${Wt.length}):`);let Kt=new Map;for(let Ht of Wt){let qt=Kt.get(Ht.component)??[];qt.push(Ht),Kt.set(Ht.component,qt)}for(let[Ht,qt]of Kt){Bt.push(` ${Ht}`);for(let zt of qt){let Xt=zt.source?` (${Ht}:${zt.source.start.line}:${zt.source.start.column})`:"";Bt.push(` - ${zt.message}${Xt} [${zt.code}]`)}}}return Bt.join(`
|
|
5
|
+
`)}function Po(Z){return Z.replaceAll("%","%25").replaceAll("\r","%0D").replaceAll(`
|
|
6
|
+
`,"%0A")}function Hc(Z){return Po(Z).replaceAll(":","%3A").replaceAll(",","%2C")}function qc(Z){let Le=[["file",Z.file],["line",Z.line],["col",Z.column],["endLine",Z.endLine],["endColumn",Z.endColumn],["title",Z.title]].filter((Ot)=>Ot[1]!==void 0).map(([Ot,Bt])=>`${Ot}=${Hc(String(Bt))}`).join(",");return`::${Z.severity} ${Le}::${Po(Z.message)}`}function _o(Z,ee){let Le=Z.filter((Bt)=>!Bt.ignored);return[...Le.filter((Bt)=>Bt.severity==="error"),...Le.filter((Bt)=>Bt.severity!=="error")].map(({source:Bt,...jt})=>{let Gt=Bt!==void 0&&Bt.start.line===Bt.end.line;return qc({severity:jt.severity,title:jt.code,message:jt.message,file:ee(jt.component),line:Bt?.start.line,column:Gt?Bt.start.column+1:void 0,endLine:Bt?.end.line,endColumn:Gt?Bt.end.column+1:void 0})}).join(`
|
|
7
|
+
`)}var Me=1;function $o(Z){return`${JSON.stringify({kind:"diagnostics",schemaVersion:Me,diagnostics:Z},null,2)}
|
|
8
|
+
`}function pi(Z,ee){if(ee.length===0)return;Z.diagnostics=[...Z.diagnostics??[],...ee]}var zc=/\*\//g,Xc=/[.*+?^${}()|[\]\\]/g;function N(Z){return Z.replace(Xc,"\\$&")}function O(Z){return Z.replace(zc,"*\\/")}function y(Z){return Z.map((ee)=>`${ee.name}${ee.optional?"?":""}: ${ee.type}`).join(", ")}var Jc=new Intl.Collator("en");function u(Z,ee){return Jc.compare(Z,ee)}var Yc=/(?:_|[^\p{ID_Continue}$])+/u,Qc=/^[\p{ID_Start}$]/u;function J(Z){let Ot=`${Z.split(Yc).map((Bt)=>Bt.charAt(0).toUpperCase()+Bt.slice(1)).join("")}Context`;return Qc.test(Ot)?Ot:`_${Ot}`}function se({imported:Z}){return Z.type==="Identifier"?Z.name:Z.value}function K(Z,ee){let Le=ee.source.value;if(typeof Le!=="string"||ee.importKind==="type")return;for(let Ot of ee.specifiers){if(Ot.type!=="ImportSpecifier"||Ot.importKind==="type")continue;let Bt=Ot.local.name,jt=se(Ot);Z.valueImportBindingsByLocalName.set(Bt,{localName:Bt,importedName:jt,source:Le})}}function oe(Z){return[Z.importedName,...Z.members??[]].join(".")}function be(Z,ee){let Le=[],Ot=ee;while(b(Ot)){if(Ot.computed||!t(Ot.property))return;Le.unshift(Ot.property.name),Ot=Ot.object}if(!t(Ot))return;return X(Z,Ot.name,Le)}function X(Z,ee,Le=[]){let Ot=(jt,Gt,Lt)=>Lt.length>0?{source:jt,importedName:Gt,members:Lt}:{source:jt,importedName:Gt},Bt=Z.valueImportBindingsByLocalName.get(ee);if(Bt)return Ot(Bt.source,Bt.importedName,Le);for(let jt of[Z.parsed?.instance,Z.parsed?.module])for(let Gt of jt?.content.body??[]){if(Gt.type!=="ImportDeclaration")continue;let Lt=Gt.source.value;if(Gt.importKind==="type"||typeof Lt!=="string")continue;let Vt=Gt.specifiers.find((Wt)=>Wt.local.name===ee);if(Vt?.type==="ImportDefaultSpecifier")return Ot(Lt,"default",Le);if(Vt?.type==="ImportNamespaceSpecifier"&&Le.length>0)return Ot(Lt,Le[0],Le.slice(1))}return}function ae(Z,ee){if(!b(ee))return;return be(Z,ee)}function Fe(Z){let ee=new Map;for(let Le of Z.content.body){if(Le.type!=="ImportDeclaration"||Le.importKind==="type")continue;let Ot=Le.source.value;if(typeof Ot!=="string")continue;for(let Bt of Le.specifiers){if(Bt.type==="ImportSpecifier"&&Bt.importKind==="type")continue;let jt=Bt.local.name,Gt;if(Bt.type==="ImportDefaultSpecifier")Gt="default";else if(Bt.type==="ImportNamespaceSpecifier")Gt="*";else Gt=se(Bt);ee.set(jt,{from:Ot,imported:Gt})}}return ee}function Te(Z,ee){for(let Le of ee?.content.body??[]){if(Le.type==="ImportDeclaration"){K(Z,Le);continue}let Ot=Le.type==="ExportNamedDeclaration"&&Le.declaration?Le.declaration:Le;if(Ot.type==="FunctionDeclaration"&&Ot.id?.name)Z.funcDecls.set(Ot.id.name,Ot)}}function le(Z){return Z==="TSTypeAnnotation"||Z==="TSTypeAliasDeclaration"||Z==="TSInterfaceDeclaration"||Z==="TSTypeParameterDeclaration"||Z==="TSTypeParameterInstantiation"}function Y(Z){let ee=[];return o(Z,{enter(Le){if(Le.type==="FunctionDeclaration"||Le.type==="FunctionExpression"||Le.type==="ArrowFunctionExpression")return p;if(Le.type==="ReturnStatement")ee.push(Le.argument??null)}}),ee}var Ws={3:"abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile",5:"class enum extends super const export import",6:"enum",strict:"implements interface let package private protected public static yield",strictBind:"eval arguments"},Us="break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this",Zc={5:Us,"5module":Us+" export import",6:Us+" const class extends export import super"},Oo=/^in(stanceof)?$/,el=/\p{ID_Start}/u,tl=/[\p{ID_Continue}\u200c\u200d]/u;function m(Z,ee){if(Z<65)return Z===36;if(Z<91)return!0;if(Z<97)return Z===95;if(Z<123)return!0;if(Z>65535&&ee===!1)return!1;return Z>=170&&el.test(String.fromCodePoint(Z))}function v(Z,ee){if(Z<48)return Z===36;if(Z<58)return!0;if(Z<65)return!1;if(Z<91)return!0;if(Z<97)return Z===95;if(Z<123)return!0;if(Z>65535&&ee===!1)return!1;return Z>=170&&tl.test(String.fromCodePoint(Z))}var an=function(Z,ee){if(ee===void 0)ee={};this.label=Z,this.keyword=ee.keyword,this.beforeExpr=!!ee.beforeExpr,this.startsExpr=!!ee.startsExpr,this.isLoop=!!ee.isLoop,this.isAssign=!!ee.isAssign,this.prefix=!!ee.prefix,this.postfix=!!ee.postfix,this.binop=ee.binop||null,this.updateContext=null};function Cn(Z,ee){return new an(Z,{beforeExpr:!0,binop:ee})}var bn={beforeExpr:!0},xn={startsExpr:!0},zs={};function on(Z,ee){if(ee===void 0)ee={};return ee.keyword=Z,zs[Z]=new an(Z,ee)}var Ut={num:new an("num",xn),regexp:new an("regexp",xn),string:new an("string",xn),name:new an("name",xn),privateId:new an("privateId",xn),eof:new an("eof"),bracketL:new an("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new an("]"),braceL:new an("{",{beforeExpr:!0,startsExpr:!0}),braceR:new an("}"),parenL:new an("(",{beforeExpr:!0,startsExpr:!0}),parenR:new an(")"),comma:new an(",",bn),semi:new an(";",bn),colon:new an(":",bn),dot:new an("."),question:new an("?",bn),questionDot:new an("?."),arrow:new an("=>",bn),template:new an("template"),invalidTemplate:new an("invalidTemplate"),ellipsis:new an("...",bn),backQuote:new an("`",xn),dollarBraceL:new an("${",{beforeExpr:!0,startsExpr:!0}),eq:new an("=",{beforeExpr:!0,isAssign:!0}),assign:new an("_=",{beforeExpr:!0,isAssign:!0}),incDec:new an("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new an("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:Cn("||",1),logicalAND:Cn("&&",2),bitwiseOR:Cn("|",3),bitwiseXOR:Cn("^",4),bitwiseAND:Cn("&",5),equality:Cn("==/!=/===/!==",6),relational:Cn("</>/<=/>=",7),bitShift:Cn("<</>>/>>>",8),plusMin:new an("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:Cn("%",10),star:Cn("*",10),slash:Cn("/",10),starstar:new an("**",{beforeExpr:!0}),coalesce:Cn("??",1),_break:on("break"),_case:on("case",bn),_catch:on("catch"),_continue:on("continue"),_debugger:on("debugger"),_default:on("default",bn),_do:on("do",{isLoop:!0,beforeExpr:!0}),_else:on("else",bn),_finally:on("finally"),_for:on("for",{isLoop:!0}),_function:on("function",xn),_if:on("if"),_return:on("return",bn),_switch:on("switch"),_throw:on("throw",bn),_try:on("try"),_var:on("var"),_const:on("const"),_while:on("while",{isLoop:!0}),_with:on("with"),_new:on("new",{beforeExpr:!0,startsExpr:!0}),_this:on("this",xn),_super:on("super",xn),_class:on("class",xn),_extends:on("extends",bn),_export:on("export"),_import:on("import",xn),_null:on("null",xn),_true:on("true",xn),_false:on("false",xn),_in:on("in",{beforeExpr:!0,binop:7}),_instanceof:on("instanceof",{beforeExpr:!0,binop:7}),_typeof:on("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:on("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:on("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},vn=/\r\n?|\n|\u2028|\u2029/,nl=new RegExp(vn.source,"g");function ci(Z){return Z===10||Z===13||Z===8232||Z===8233}function Lo(Z,ee,Le){if(Le===void 0)Le=Z.length;for(var Ot=ee;Ot<Le;Ot++){var Bt=Z.charCodeAt(Ot);if(ci(Bt))return Ot<Le-1&&Bt===13&&Z.charCodeAt(Ot+1)===10?Ot+2:Ot+1}return-1}var Mo=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,hn=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,il=Object.prototype,{hasOwnProperty:sl,toString:rl}=il,Ei=Object.hasOwn||function(Z,ee){return sl.call(Z,ee)},No=Array.isArray||function(Z){return rl.call(Z)==="[object Array]"},Do=Object.create(null);function zi(Z){return Do[Z]||(Do[Z]=new RegExp("^(?:"+Z.replace(/ /g,"|")+")$"))}function Qi(Z){if(Z<=65535)return String.fromCharCode(Z);return Z-=65536,String.fromCharCode((Z>>10)+55296,(Z&1023)+56320)}var ol=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,vi=function(Z,ee){this.line=Z,this.column=ee};vi.prototype.offset=function(Z){return new vi(this.line,this.column+Z)};var Zi=function(Z,ee,Le){if(this.start=ee,this.end=Le,Z.sourceFile!==null)this.source=Z.sourceFile};function Fo(Z,ee){for(var Le=1,Ot=0;;){var Bt=Lo(Z,Ot,ee);if(Bt<0)return new vi(Le,ee-Ot);++Le,Ot=Bt}}var Ks={ecmaVersion:null,sourceType:"script",strict:!1,onInsertedSemicolon:null,onTrailingComma:null,allowReserved:null,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowAwaitOutsideFunction:null,allowSuperOutsideMethod:null,allowHashBang:!1,checkPrivateFields:!0,locations:!1,startLocation:null,onToken:null,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null,preserveParens:!1},Ro=!1;function al(Z){var ee={};for(var Le in Ks)ee[Le]=Z&&Ei(Z,Le)?Z[Le]:Ks[Le];if(ee.ecmaVersion==="latest")ee.ecmaVersion=1e8;else if(ee.ecmaVersion==null){if(!Ro&&typeof console==="object"&&console.warn)Ro=!0,console.warn(`Since Acorn 8.0.0, options.ecmaVersion is required.
|
|
9
|
+
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(!Z||Z.allowHashBang==null)ee.allowHashBang=ee.ecmaVersion>=14;if(No(ee.onToken)){var Ot=ee.onToken;ee.onToken=function(Bt){return Ot.push(Bt)}}if(No(ee.onComment))ee.onComment=pl(ee,ee.onComment);if(ee.sourceType==="commonjs"&&ee.allowAwaitOutsideFunction)throw Error("Cannot use allowAwaitOutsideFunction with sourceType: commonjs");return ee}function pl(Z,ee){return function(Le,Ot,Bt,jt,Gt,Lt){var Vt={type:Le?"Block":"Line",value:Ot,start:Bt,end:jt};if(Z.locations)Vt.loc=new Zi(this,Gt,Lt);if(Z.ranges)Vt.range=[Bt,jt];ee.push(Vt)}}var Qn=1,Zn=2,Xs=4,Bo=8,Js=16,jo=32,es=64,Vo=128,ei=256,Si=512,Go=1024,ts=Qn|Zn|ei;function Ys(Z,ee){return Zn|(Z?Xs:0)|(ee?Bo:0)}var Xi=0,Qs=1,Mn=2,Wo=3,Uo=4,Ko=5,s=function(Z,ee,Le){this.options=Z=al(Z),this.sourceFile=Z.sourceFile,this.keywords=zi(Zc[Z.ecmaVersion>=6?6:Z.sourceType==="module"?"5module":5]);var Ot="";if(Z.allowReserved!==!0){if(Ot=Ws[Z.ecmaVersion>=6?6:Z.ecmaVersion===5?5:3],Z.sourceType==="module")Ot+=" await"}this.reservedWords=zi(Ot);var Bt=(Ot?Ot+" ":"")+Ws.strict;if(this.reservedWordsStrict=zi(Bt),this.reservedWordsStrictBind=zi(Bt+" "+Ws.strictBind),this.input=String(ee),this.containsEsc=!1,this.pos=Le||0,this.curLine=1,Z.startLocation)this.lineStart=this.pos-Z.startLocation.column,this.curLine=Z.startLocation.line;else if(Le){if(this.lineStart=this.input.lastIndexOf(`
|
|
10
|
+
`,Le-1)+1,this.options.locations)this.curLine=this.input.slice(0,this.lineStart).split(vn).length}else this.lineStart=0;if(this.type=Ut.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=this.initialContext(),this.exprAllowed=!0,this.inModule=Z.sourceType==="module",this.strict=this.inModule||Z.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&&Z.allowHashBang&&this.input.slice(0,2)==="#!")this.skipLineComment(2);this.scopeStack=[],this.enterScope(this.options.sourceType==="commonjs"?Zn:Qn),this.regexpState=null,this.privateNameStack=[]},wn={inFunction:{configurable:!0},inGenerator:{configurable:!0},inAsync:{configurable:!0},canAwait:{configurable:!0},allowReturn:{configurable:!0},allowSuper:{configurable:!0},allowDirectSuper:{configurable:!0},treatFunctionsAsVar:{configurable:!0},allowNewDotTarget:{configurable:!0},allowUsing:{configurable:!0},inClassStaticBlock:{configurable:!0}};s.prototype.parse=function(){var Z=this,ee=this.options.program||this.startNode();return this.nextToken(),this.catchStackOverflow(function(){return Z.parseTopLevel(ee)})};wn.inFunction.get=function(){return(this.currentVarScope().flags&Zn)>0};wn.inGenerator.get=function(){return(this.currentVarScope().flags&Bo)>0};wn.inAsync.get=function(){return(this.currentVarScope().flags&Xs)>0};wn.canAwait.get=function(){for(var Z=this.scopeStack.length-1;Z>=0;Z--){var ee=this.scopeStack[Z],Le=ee.flags;if(Le&(ei|Si))return!1;if(Le&Zn)return(Le&Xs)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction};wn.allowReturn.get=function(){if(this.inFunction)return!0;if(this.options.allowReturnOutsideFunction&&this.currentVarScope().flags&Qn)return!0;return!1};wn.allowSuper.get=function(){var Z=this.currentThisScope(),ee=Z.flags;return(ee&es)>0||this.options.allowSuperOutsideMethod};wn.allowDirectSuper.get=function(){return(this.currentThisScope().flags&Vo)>0};wn.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())};wn.allowNewDotTarget.get=function(){for(var Z=this.scopeStack.length-1;Z>=0;Z--){var ee=this.scopeStack[Z],Le=ee.flags;if(Le&(ei|Si)||Le&Zn&&!(Le&Js))return!0}return!1};wn.allowUsing.get=function(){var Z=this.currentScope(),ee=Z.flags;if(ee&Go)return!1;if(!this.inModule&&ee&Qn)return!1;return!0};wn.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&ei)>0};s.extend=function(){var Z=[],ee=arguments.length;while(ee--)Z[ee]=arguments[ee];var Le=this;for(var Ot=0;Ot<Z.length;Ot++)Le=Z[Ot](Le);return Le};s.parse=function(Z,ee){return new this(ee,Z).parse()};s.parseExpressionAt=function(Z,ee,Le){var Ot=new this(Le,Z,ee);return Ot.nextToken(),Ot.parseExpression()};s.tokenizer=function(Z,ee){return new this(ee,Z)};Object.defineProperties(s.prototype,wn);var mn=s.prototype,cl=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;mn.strictDirective=function(Z){if(this.options.ecmaVersion<5)return!1;for(;;){hn.lastIndex=Z,Z+=hn.exec(this.input)[0].length;var ee=cl.exec(this.input.slice(Z));if(!ee)return!1;if((ee[1]||ee[2])==="use strict"){hn.lastIndex=Z+ee[0].length;var Le=hn.exec(this.input),Ot=Le.index+Le[0].length,Bt=this.input.charAt(Ot);return Bt===";"||Bt==="}"||vn.test(Le[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(Bt)||Bt==="!"&&this.input.charAt(Ot+1)==="=")}if(Z+=ee[0].length,hn.lastIndex=Z,Z+=hn.exec(this.input)[0].length,this.input[Z]===";")Z++}};mn.eat=function(Z){if(this.type===Z)return this.next(),!0;else return!1};mn.isContextual=function(Z){return this.type===Ut.name&&this.value===Z&&!this.containsEsc};mn.eatContextual=function(Z){if(!this.isContextual(Z))return!1;return this.next(),!0};mn.catchStackOverflow=function(Z){try{return Z()}catch(ee){if(ee instanceof Error&&(/\bstack\b.*\b(exceeded|overflow)\b/i.test(ee.message)||/\btoo much recursion\b/i.test(ee.message)))this.raise(this.start,"Not enough stack space to parse input");else throw ee}};mn.expectContextual=function(Z){if(!this.eatContextual(Z))this.unexpected()};mn.canInsertSemicolon=function(){return this.type===Ut.eof||this.type===Ut.braceR||vn.test(this.input.slice(this.lastTokEnd,this.start))};mn.insertSemicolon=function(){if(this.canInsertSemicolon()){if(this.options.onInsertedSemicolon)this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc);return!0}};mn.semicolon=function(){if(!this.eat(Ut.semi)&&!this.insertSemicolon())this.unexpected()};mn.afterTrailingComma=function(Z,ee){if(this.type===Z){if(this.options.onTrailingComma)this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc);if(!ee)this.next();return!0}};mn.expect=function(Z){this.eat(Z)||this.unexpected()};mn.unexpected=function(Z){this.raise(Z!=null?Z:this.start,"Unexpected token")};var ns=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};mn.checkPatternErrors=function(Z,ee){if(!Z)return;if(Z.trailingComma>-1)this.raiseRecoverable(Z.trailingComma,"Comma is not permitted after the rest element");var Le=ee?Z.parenthesizedAssign:Z.parenthesizedBind;if(Le>-1)this.raiseRecoverable(Le,ee?"Assigning to rvalue":"Parenthesized pattern")};mn.checkExpressionErrors=function(Z,ee){if(!Z)return!1;var{shorthandAssign:Le,doubleProto:Ot}=Z;if(!ee)return Le>=0||Ot>=0;if(Le>=0)this.raise(Le,"Shorthand property assignments are valid only in destructuring patterns");if(Ot>=0)this.raiseRecoverable(Ot,"Redefinition of __proto__ property")};mn.checkYieldAwaitInDefaultParams=function(){if(this.yieldPos&&(!this.awaitPos||this.yieldPos<this.awaitPos))this.raise(this.yieldPos,"Yield expression cannot be a default value");if(this.awaitPos)this.raise(this.awaitPos,"Await expression cannot be a default value")};mn.isSimpleAssignTarget=function(Z){if(Z.type==="ParenthesizedExpression")return this.isSimpleAssignTarget(Z.expression);return Z.type==="Identifier"||Z.type==="MemberExpression"};var Qt=s.prototype;Qt.parseTopLevel=function(Z){var ee=Object.create(null);if(!Z.body)Z.body=[];while(this.type!==Ut.eof){var Le=this.parseStatement(null,!0,ee);Z.body.push(Le)}if(this.inModule)for(var Ot=0,Bt=Object.keys(this.undefinedExports);Ot<Bt.length;Ot+=1){var jt=Bt[Ot];this.raiseRecoverable(this.undefinedExports[jt].start,"Export '"+jt+"' is not defined")}return this.adaptDirectivePrologue(Z.body),this.next(),Z.sourceType=this.options.sourceType==="commonjs"?"script":this.options.sourceType,this.finishNode(Z,"Program")};var Zs={kind:"loop"},ll={kind:"switch"};Qt.isLet=function(Z){if(this.options.ecmaVersion<6||!this.isContextual("let"))return!1;hn.lastIndex=this.pos;var ee=hn.exec(this.input),Le=this.pos+ee[0].length,Ot=this.fullCharCodeAt(Le);if(Ot===91||Ot===92)return!0;if(Z)return!1;if(Ot===123)return!0;if(m(Ot)){var Bt=Le;do Le+=Ot<=65535?1:2;while(v(Ot=this.fullCharCodeAt(Le)));if(Ot===92)return!0;var jt=this.input.slice(Bt,Le);if(!Oo.test(jt))return!0}return!1};Qt.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;hn.lastIndex=this.pos;var Z=hn.exec(this.input),ee=this.pos+Z[0].length,Le;return!vn.test(this.input.slice(this.pos,ee))&&this.input.slice(ee,ee+8)==="function"&&(ee+8===this.input.length||!(v(Le=this.fullCharCodeAt(ee+8))||Le===92))};Qt.isUsingKeyword=function(Z,ee){if(this.options.ecmaVersion<17||!this.isContextual(Z?"await":"using"))return!1;hn.lastIndex=this.pos;var Le=hn.exec(this.input),Ot=this.pos+Le[0].length;if(vn.test(this.input.slice(this.pos,Ot)))return!1;if(Z){var Bt=Ot+5,jt;if(this.input.slice(Ot,Bt)!=="using"||Bt===this.input.length||v(jt=this.fullCharCodeAt(Bt))||jt===92)return!1;hn.lastIndex=Bt;var Gt=hn.exec(this.input);if(Ot=Bt+Gt[0].length,Gt&&vn.test(this.input.slice(Bt,Ot)))return!1}var Lt=this.fullCharCodeAt(Ot);if(!m(Lt)&&Lt!==92)return!1;var Vt=Ot;do Ot+=Lt<=65535?1:2;while(v(Lt=this.fullCharCodeAt(Ot)));if(Lt===92)return!0;var Wt=this.input.slice(Vt,Ot);if(Oo.test(Wt))return!1;if(ee&&!Z&&Wt==="of"){hn.lastIndex=Ot;var Kt=hn.exec(this.input);if(Ot=Ot+Kt[0].length,this.input.charCodeAt(Ot)!==61||(Lt=this.input.charCodeAt(Ot+1))===61||Lt===62)return!1}return!0};Qt.isAwaitUsing=function(Z){return this.isUsingKeyword(!0,Z)};Qt.isUsing=function(Z){return this.isUsingKeyword(!1,Z)};Qt.parseStatement=function(Z,ee,Le){var Ot=this.type,Bt=this.startNode(),jt;if(this.isLet(Z))Ot=Ut._var,jt="let";switch(Ot){case Ut._break:case Ut._continue:return this.parseBreakContinueStatement(Bt,Ot.keyword);case Ut._debugger:return this.parseDebuggerStatement(Bt);case Ut._do:return this.parseDoStatement(Bt);case Ut._for:return this.parseForStatement(Bt);case Ut._function:if(Z&&(this.strict||Z!=="if"&&Z!=="label")&&this.options.ecmaVersion>=6)this.unexpected();return this.parseFunctionStatement(Bt,!1,!Z);case Ut._class:if(Z)this.unexpected();return this.parseClass(Bt,!0);case Ut._if:return this.parseIfStatement(Bt);case Ut._return:return this.parseReturnStatement(Bt);case Ut._switch:return this.parseSwitchStatement(Bt);case Ut._throw:return this.parseThrowStatement(Bt);case Ut._try:return this.parseTryStatement(Bt);case Ut._const:case Ut._var:if(jt=jt||this.value,Z&&jt!=="var")this.unexpected();return this.parseVarStatement(Bt,jt);case Ut._while:return this.parseWhileStatement(Bt);case Ut._with:return this.parseWithStatement(Bt);case Ut.braceL:return this.parseBlock(!0,Bt);case Ut.semi:return this.parseEmptyStatement(Bt);case Ut._export:case Ut._import:if(this.options.ecmaVersion>10&&Ot===Ut._import){hn.lastIndex=this.pos;var Gt=hn.exec(this.input),Lt=this.pos+Gt[0].length,Vt=this.input.charCodeAt(Lt);if(Vt===40||Vt===46)return this.parseExpressionStatement(Bt,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(Bt):this.parseExport(Bt,Le);default:if(this.isAsyncFunction()){if(Z)this.unexpected();return this.next(),this.parseFunctionStatement(Bt,!0,!Z)}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(Z)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(Bt,!1,Wt),this.semicolon(),this.finishNode(Bt,"VariableDeclaration")}var Kt=this.value,Ht=this.parseExpression();if(Ot===Ut.name&&Ht.type==="Identifier"&&this.eat(Ut.colon))return this.parseLabeledStatement(Bt,Kt,Ht,Z);else return this.parseExpressionStatement(Bt,Ht)}};Qt.parseBreakContinueStatement=function(Z,ee){var Le=ee==="break";if(this.next(),this.eat(Ut.semi)||this.insertSemicolon())Z.label=null;else if(this.type!==Ut.name)this.unexpected();else Z.label=this.parseIdent(),this.semicolon();var Ot=0;for(;Ot<this.labels.length;++Ot){var Bt=this.labels[Ot];if(Z.label==null||Bt.name===Z.label.name){if(Bt.kind!=null&&(Le||Bt.kind==="loop"))break;if(Z.label&&Le)break}}if(Ot===this.labels.length)this.raise(Z.start,"Unsyntactic "+ee);return this.finishNode(Z,Le?"BreakStatement":"ContinueStatement")};Qt.parseDebuggerStatement=function(Z){return this.next(),this.semicolon(),this.finishNode(Z,"DebuggerStatement")};Qt.parseDoStatement=function(Z){if(this.next(),this.labels.push(Zs),Z.body=this.parseStatement("do"),this.labels.pop(),this.expect(Ut._while),Z.test=this.parseParenExpression(),this.options.ecmaVersion>=6)this.eat(Ut.semi);else this.semicolon();return this.finishNode(Z,"DoWhileStatement")};Qt.parseForStatement=function(Z){this.next();var ee=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(Zs),this.enterScope(0),this.expect(Ut.parenL),this.type===Ut.semi){if(ee>-1)this.unexpected(ee);return this.parseFor(Z,null)}var Le=this.isLet();if(this.type===Ut._var||this.type===Ut._const||Le){var Ot=this.startNode(),Bt=Le?"let":this.value;return this.next(),this.parseVar(Ot,!0,Bt),this.finishNode(Ot,"VariableDeclaration"),this.parseForAfterInit(Z,Ot,ee)}var jt=this.isContextual("let"),Gt=!1,Lt=this.isUsing(!0)?"using":this.isAwaitUsing(!0)?"await using":null;if(Lt){var Vt=this.startNode();if(this.next(),Lt==="await using"){if(!this.canAwait)this.raise(this.start,"Await using cannot appear outside of async function");this.next()}return this.parseVar(Vt,!0,Lt),this.finishNode(Vt,"VariableDeclaration"),this.parseForAfterInit(Z,Vt,ee)}var Wt=this.containsEsc,Kt=new ns,Ht=this.start,qt=ee>-1?this.parseExprSubscripts(Kt,"await"):this.parseExpression(!0,Kt);if(this.type===Ut._in||(Gt=this.options.ecmaVersion>=6&&this.isContextual("of"))){if(ee>-1){if(this.type===Ut._in)this.unexpected(ee);Z.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)Z.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(Z,qt)}else this.checkExpressionErrors(Kt,!0);if(ee>-1)this.unexpected(ee);return this.parseFor(Z,qt)};Qt.parseForAfterInit=function(Z,ee,Le){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&&Le>-1)this.unexpected(Le)}else if(this.options.ecmaVersion>=9)Z.await=Le>-1;return this.parseForIn(Z,ee)}if(Le>-1)this.unexpected(Le);return this.parseFor(Z,ee)};Qt.parseFunctionStatement=function(Z,ee,Le){return this.next(),this.parseFunction(Z,xi|(Le?0:Hs),!1,ee)};Qt.parseIfStatement=function(Z){return this.next(),Z.test=this.parseParenExpression(),Z.consequent=this.parseStatement("if"),Z.alternate=this.eat(Ut._else)?this.parseStatement("if"):null,this.finishNode(Z,"IfStatement")};Qt.parseReturnStatement=function(Z){if(!this.allowReturn)this.raise(this.start,"'return' outside of function");if(this.next(),this.eat(Ut.semi)||this.insertSemicolon())Z.argument=null;else Z.argument=this.parseExpression(),this.semicolon();return this.finishNode(Z,"ReturnStatement")};Qt.parseSwitchStatement=function(Z){this.next(),Z.discriminant=this.parseParenExpression(),Z.cases=[],this.expect(Ut.braceL),this.labels.push(ll),this.enterScope(Go);var ee;for(var Le=!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(Z.cases.push(ee=this.startNode()),ee.consequent=[],this.next(),Ot)ee.test=this.parseExpression();else{if(Le)this.raiseRecoverable(this.lastTokStart,"Multiple default clauses");Le=!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(Z,"SwitchStatement")};Qt.parseThrowStatement=function(Z){if(this.next(),vn.test(this.input.slice(this.lastTokEnd,this.start)))this.raise(this.lastTokEnd,"Illegal newline after throw");return Z.argument=this.parseExpression(),this.semicolon(),this.finishNode(Z,"ThrowStatement")};var ul=[];Qt.parseCatchClauseParam=function(){var Z=this.parseBindingAtom(),ee=Z.type==="Identifier";return this.enterScope(ee?jo:0),this.checkLValPattern(Z,ee?Uo:Mn),this.expect(Ut.parenR),Z};Qt.parseTryStatement=function(Z){if(this.next(),Z.block=this.parseBlock(),Z.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(),Z.handler=this.finishNode(ee,"CatchClause")}if(Z.finalizer=this.eat(Ut._finally)?this.parseBlock():null,!Z.handler&&!Z.finalizer)this.raise(Z.start,"Missing catch or finally clause");return this.finishNode(Z,"TryStatement")};Qt.parseVarStatement=function(Z,ee,Le){return this.next(),this.parseVar(Z,!1,ee,Le),this.semicolon(),this.finishNode(Z,"VariableDeclaration")};Qt.parseWhileStatement=function(Z){return this.next(),Z.test=this.parseParenExpression(),this.labels.push(Zs),Z.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(Z,"WhileStatement")};Qt.parseWithStatement=function(Z){if(this.strict)this.raise(this.start,"'with' in strict mode");return this.next(),Z.object=this.parseParenExpression(),Z.body=this.parseStatement("with"),this.finishNode(Z,"WithStatement")};Qt.parseEmptyStatement=function(Z){return this.next(),this.finishNode(Z,"EmptyStatement")};Qt.parseLabeledStatement=function(Z,ee,Le,Ot){for(var Bt=0,jt=this.labels;Bt<jt.length;Bt+=1){var Gt=jt[Bt];if(Gt.name===ee)this.raise(Le.start,"Label '"+ee+"' is already declared")}var Lt=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===Z.start)Wt.statementStart=this.start,Wt.kind=Lt;else break}return this.labels.push({name:ee,kind:Lt,statementStart:this.start}),Z.body=this.parseStatement(Ot?Ot.indexOf("label")===-1?Ot+"label":Ot:"label"),this.labels.pop(),Z.label=Le,this.finishNode(Z,"LabeledStatement")};Qt.parseExpressionStatement=function(Z,ee){return Z.expression=ee,this.semicolon(),this.finishNode(Z,"ExpressionStatement")};Qt.parseBlock=function(Z,ee,Le){if(Z===void 0)Z=!0;if(ee===void 0)ee=this.startNode();if(ee.body=[],this.expect(Ut.braceL),Z)this.enterScope(0);while(this.type!==Ut.braceR){var Ot=this.parseStatement(null);ee.body.push(Ot)}if(Le)this.strict=!1;if(this.next(),Z)this.exitScope();return this.finishNode(ee,"BlockStatement")};Qt.parseFor=function(Z,ee){return Z.init=ee,this.expect(Ut.semi),Z.test=this.type===Ut.semi?null:this.parseExpression(),this.expect(Ut.semi),Z.update=this.type===Ut.parenR?null:this.parseExpression(),this.expect(Ut.parenR),Z.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(Z,"ForStatement")};Qt.parseForIn=function(Z,ee){var Le=this.type===Ut._in;if(this.next(),ee.type==="VariableDeclaration"&&ee.declarations[0].init!=null&&(!Le||this.options.ecmaVersion<8||this.strict||ee.kind!=="var"||ee.declarations[0].id.type!=="Identifier"))this.raise(ee.start,(Le?"for-in":"for-of")+" loop variable declaration may not have an initializer");return Z.left=ee,Z.right=Le?this.parseExpression():this.parseMaybeAssign(),this.expect(Ut.parenR),Z.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(Z,Le?"ForInStatement":"ForOfStatement")};Qt.parseVar=function(Z,ee,Le,Ot){Z.declarations=[],Z.kind=Le;for(;;){var Bt=this.startNode();if(this.parseVarId(Bt,Le),this.eat(Ut.eq))Bt.init=this.parseMaybeAssign(ee);else if(!Ot&&Le==="const"&&!(this.type===Ut._in||this.options.ecmaVersion>=6&&this.isContextual("of")))this.unexpected();else if(!Ot&&(Le==="using"||Le==="await using")&&this.options.ecmaVersion>=17&&this.type!==Ut._in&&!this.isContextual("of"))this.raise(this.lastTokEnd,"Missing initializer in "+Le+" declaration");else if(!Ot&&Bt.id.type!=="Identifier"&&!(ee&&(this.type===Ut._in||this.isContextual("of"))))this.raise(this.lastTokEnd,"Complex binding patterns require an initialization value");else Bt.init=null;if(Z.declarations.push(this.finishNode(Bt,"VariableDeclarator")),!this.eat(Ut.comma))break}return Z};Qt.parseVarId=function(Z,ee){Z.id=ee==="using"||ee==="await using"?this.parseIdent():this.parseBindingAtom(),this.checkLValPattern(Z.id,ee==="var"?Qs:Mn,!1)};var xi=1,Hs=2,Ho=4;Qt.parseFunction=function(Z,ee,Le,Ot,Bt){if(this.initFunction(Z),this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!Ot){if(this.type===Ut.star&&ee&Hs)this.unexpected();Z.generator=this.eat(Ut.star)}if(this.options.ecmaVersion>=8)Z.async=!!Ot;if(ee&xi){if(Z.id=ee&Ho&&this.type!==Ut.name?null:this.parseIdent(),Z.id&&!(ee&Hs))this.checkLValSimple(Z.id,this.strict||Z.generator||Z.async?this.treatFunctionsAsVar?Qs:Mn:Wo)}var jt=this.yieldPos,Gt=this.awaitPos,Lt=this.awaitIdentPos;if(this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(Ys(Z.async,Z.generator)),!(ee&xi))Z.id=this.type===Ut.name?this.parseIdent():null;return this.parseFunctionParams(Z),this.parseFunctionBody(Z,Le,!1,Bt),this.yieldPos=jt,this.awaitPos=Gt,this.awaitIdentPos=Lt,this.finishNode(Z,ee&xi?"FunctionDeclaration":"FunctionExpression")};Qt.parseFunctionParams=function(Z){this.expect(Ut.parenL),Z.params=this.parseBindingList(Ut.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()};Qt.parseClass=function(Z,ee){this.next();var Le=this.strict;this.strict=!0,this.parseClassId(Z,ee),this.parseClassSuper(Z);var Ot=this.enterClassBody(),Bt=this.startNode(),jt=!1;Bt.body=[],this.expect(Ut.braceL);while(this.type!==Ut.braceR){var Gt=this.parseClassElement(Z.superClass!==null);if(Gt){if(Bt.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"&&hl(Ot,Gt))this.raiseRecoverable(Gt.key.start,"Identifier '#"+Gt.key.name+"' has already been declared")}}return this.strict=Le,this.next(),Z.body=this.finishNode(Bt,"ClassBody"),this.exitClassBody(),this.finishNode(Z,ee?"ClassDeclaration":"ClassExpression")};Qt.parseClassElement=function(Z){if(this.eat(Ut.semi))return null;var ee=this.options.ecmaVersion,Le=this.startNode(),Ot="",Bt=!1,jt=!1,Gt="method",Lt=!1;if(this.eatContextual("static")){if(ee>=13&&this.eat(Ut.braceL))return this.parseClassStaticBlock(Le),Le;if(this.isClassElementNameStart()||this.type===Ut.star)Lt=!0;else Ot="static"}if(Le.static=Lt,!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))Bt=!0;if(!Ot&&!jt&&!Bt){var Vt=this.value;if(this.eatContextual("get")||this.eatContextual("set"))if(this.isClassElementNameStart())Gt=Vt;else Ot=Vt}if(Ot)Le.computed=!1,Le.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),Le.key.name=Ot,this.finishNode(Le.key,"Identifier");else this.parseClassElementName(Le);if(ee<13||this.type===Ut.parenL||Gt!=="method"||Bt||jt){var Wt=!Le.static&&Ji(Le,"constructor"),Kt=Wt&&Z;if(Wt&&Gt!=="method")this.raise(Le.key.start,"Constructor can't have get/set modifier");Le.kind=Wt?"constructor":Gt,this.parseClassMethod(Le,Bt,jt,Kt)}else this.parseClassField(Le);return Le};Qt.isClassElementNameStart=function(){return this.type===Ut.name||this.type===Ut.privateId||this.type===Ut.num||this.type===Ut.string||this.type===Ut.bracketL||this.type.keyword};Qt.parseClassElementName=function(Z){if(this.type===Ut.privateId){if(this.value==="constructor")this.raise(this.start,"Classes can't have an element named '#constructor'");Z.computed=!1,Z.key=this.parsePrivateIdent()}else this.parsePropertyName(Z)};Qt.parseClassMethod=function(Z,ee,Le,Ot){var Bt=Z.key;if(Z.kind==="constructor"){if(ee)this.raise(Bt.start,"Constructor can't be a generator");if(Le)this.raise(Bt.start,"Constructor can't be an async method")}else if(Z.static&&Ji(Z,"prototype"))this.raise(Bt.start,"Classes may not have a static property named prototype");var jt=Z.value=this.parseMethod(ee,Le,Ot);if(Z.kind==="get"&&jt.params.length!==0)this.raiseRecoverable(jt.start,"getter should have no params");if(Z.kind==="set"&&jt.params.length!==1)this.raiseRecoverable(jt.start,"setter should have exactly one param");if(Z.kind==="set"&&jt.params[0].type==="RestElement")this.raiseRecoverable(jt.params[0].start,"Setter cannot use rest params");return this.finishNode(Z,"MethodDefinition")};Qt.parseClassField=function(Z){if(Ji(Z,"constructor"))this.raise(Z.key.start,"Classes can't have a field named 'constructor'");else if(Z.static&&Ji(Z,"prototype"))this.raise(Z.key.start,"Classes can't have a static field named 'prototype'");if(this.eat(Ut.eq))this.enterScope(Si|es),Z.value=this.parseMaybeAssign(),this.exitScope();else Z.value=null;return this.semicolon(),this.finishNode(Z,"PropertyDefinition")};Qt.parseClassStaticBlock=function(Z){Z.body=[];var ee=this.labels;this.labels=[],this.enterScope(ei|es);while(this.type!==Ut.braceR){var Le=this.parseStatement(null);Z.body.push(Le)}return this.next(),this.exitScope(),this.labels=ee,this.finishNode(Z,"StaticBlock")};Qt.parseClassId=function(Z,ee){if(this.type===Ut.name){if(Z.id=this.parseIdent(),ee)this.checkLValSimple(Z.id,Mn,!1)}else{if(ee===!0)this.unexpected();Z.id=null}};Qt.parseClassSuper=function(Z){Z.superClass=this.eat(Ut._extends)?this.parseExprSubscripts(null,!1):null};Qt.enterClassBody=function(){var Z={declared:Object.create(null),used:[]};return this.privateNameStack.push(Z),Z.declared};Qt.exitClassBody=function(){var Z=this.privateNameStack.pop(),{declared:ee,used:Le}=Z;if(!this.options.checkPrivateFields)return;var Ot=this.privateNameStack.length,Bt=Ot===0?null:this.privateNameStack[Ot-1];for(var jt=0;jt<Le.length;++jt){var Gt=Le[jt];if(!Ei(ee,Gt.name))if(Bt)Bt.used.push(Gt);else this.raiseRecoverable(Gt.start,"Private field '#"+Gt.name+"' must be declared in an enclosing class")}};function hl(Z,ee){var Le=ee.key.name,Ot=Z[Le],Bt="true";if(ee.type==="MethodDefinition"&&(ee.kind==="get"||ee.kind==="set"))Bt=(ee.static?"s":"i")+ee.kind;if(Ot==="iget"&&Bt==="iset"||Ot==="iset"&&Bt==="iget"||Ot==="sget"&&Bt==="sset"||Ot==="sset"&&Bt==="sget")return Z[Le]="true",!1;else if(!Ot)return Z[Le]=Bt,!1;else return!0}function Ji(Z,ee){var{computed:Le,key:Ot}=Z;return!Le&&(Ot.type==="Identifier"&&Ot.name===ee||Ot.type==="Literal"&&Ot.value===ee)}Qt.parseExportAllDeclaration=function(Z,ee){if(this.options.ecmaVersion>=11)if(this.eatContextual("as"))Z.exported=this.parseModuleExportName(),this.checkExport(ee,Z.exported,this.lastTokStart);else Z.exported=null;if(this.expectContextual("from"),this.type!==Ut.string)this.unexpected();if(Z.source=this.parseExprAtom(),this.options.ecmaVersion>=16)Z.attributes=this.parseWithClause();return this.semicolon(),this.finishNode(Z,"ExportAllDeclaration")};Qt.parseExport=function(Z,ee){if(this.next(),this.eat(Ut.star))return this.parseExportAllDeclaration(Z,ee);if(this.eat(Ut._default))return this.checkExport(ee,"default",this.lastTokStart),Z.declaration=this.parseExportDefaultDeclaration(),this.finishNode(Z,"ExportDefaultDeclaration");if(this.shouldParseExportStatement()){if(Z.declaration=this.parseExportDeclaration(Z),Z.declaration.type==="VariableDeclaration")this.checkVariableExport(ee,Z.declaration.declarations);else this.checkExport(ee,Z.declaration.id,Z.declaration.id.start);if(Z.specifiers=[],Z.source=null,this.options.ecmaVersion>=16)Z.attributes=[]}else{if(Z.declaration=null,Z.specifiers=this.parseExportSpecifiers(ee),this.eatContextual("from")){if(this.type!==Ut.string)this.unexpected();if(Z.source=this.parseExprAtom(),this.options.ecmaVersion>=16)Z.attributes=this.parseWithClause()}else{for(var Le=0,Ot=Z.specifiers;Le<Ot.length;Le+=1){var Bt=Ot[Le];if(this.checkUnreserved(Bt.local),this.checkLocalExport(Bt.local),Bt.local.type==="Literal")this.raise(Bt.local.start,"A string literal cannot be used as an exported binding without `from`.")}if(Z.source=null,this.options.ecmaVersion>=16)Z.attributes=[]}this.semicolon()}return this.finishNode(Z,"ExportNamedDeclaration")};Qt.parseExportDeclaration=function(Z){return this.parseStatement(null)};Qt.parseExportDefaultDeclaration=function(){var Z;if(this.type===Ut._function||(Z=this.isAsyncFunction())){var ee=this.startNode();if(this.next(),Z)this.next();return this.parseFunction(ee,xi|Ho,!1,Z)}else if(this.type===Ut._class){var Le=this.startNode();return this.parseClass(Le,"nullableID")}else{var Ot=this.parseMaybeAssign();return this.semicolon(),Ot}};Qt.checkExport=function(Z,ee,Le){if(!Z)return;if(typeof ee!=="string")ee=ee.type==="Identifier"?ee.name:ee.value;if(Ei(Z,ee))this.raiseRecoverable(Le,"Duplicate export '"+ee+"'");Z[ee]=!0};Qt.checkPatternExport=function(Z,ee){var Le=ee.type;if(Le==="Identifier")this.checkExport(Z,ee,ee.start);else if(Le==="ObjectPattern")for(var Ot=0,Bt=ee.properties;Ot<Bt.length;Ot+=1){var jt=Bt[Ot];this.checkPatternExport(Z,jt)}else if(Le==="ArrayPattern")for(var Gt=0,Lt=ee.elements;Gt<Lt.length;Gt+=1){var Vt=Lt[Gt];if(Vt)this.checkPatternExport(Z,Vt)}else if(Le==="Property")this.checkPatternExport(Z,ee.value);else if(Le==="AssignmentPattern")this.checkPatternExport(Z,ee.left);else if(Le==="RestElement")this.checkPatternExport(Z,ee.argument)};Qt.checkVariableExport=function(Z,ee){if(!Z)return;for(var Le=0,Ot=ee;Le<Ot.length;Le+=1){var Bt=Ot[Le];this.checkPatternExport(Z,Bt.id)}};Qt.shouldParseExportStatement=function(){return this.type.keyword==="var"||this.type.keyword==="const"||this.type.keyword==="class"||this.type.keyword==="function"||this.isLet()||this.isAsyncFunction()};Qt.parseExportSpecifier=function(Z){var ee=this.startNode();return ee.local=this.parseModuleExportName(),ee.exported=this.eatContextual("as")?this.parseModuleExportName():ee.local,this.checkExport(Z,ee.exported,ee.exported.start),this.finishNode(ee,"ExportSpecifier")};Qt.parseExportSpecifiers=function(Z){var ee=[],Le=!0;this.expect(Ut.braceL);while(!this.eat(Ut.braceR)){if(!Le){if(this.expect(Ut.comma),this.afterTrailingComma(Ut.braceR))break}else Le=!1;ee.push(this.parseExportSpecifier(Z))}return ee};Qt.parseImport=function(Z){if(this.next(),this.type===Ut.string)Z.specifiers=ul,Z.source=this.parseExprAtom();else Z.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),Z.source=this.type===Ut.string?this.parseExprAtom():this.unexpected();if(this.options.ecmaVersion>=16)Z.attributes=this.parseWithClause();return this.semicolon(),this.finishNode(Z,"ImportDeclaration")};Qt.parseImportSpecifier=function(){var Z=this.startNode();if(Z.imported=this.parseModuleExportName(),this.eatContextual("as"))Z.local=this.parseIdent();else this.checkUnreserved(Z.imported),Z.local=Z.imported;return this.checkLValSimple(Z.local,Mn),this.finishNode(Z,"ImportSpecifier")};Qt.parseImportDefaultSpecifier=function(){var Z=this.startNode();return Z.local=this.parseIdent(),this.checkLValSimple(Z.local,Mn),this.finishNode(Z,"ImportDefaultSpecifier")};Qt.parseImportNamespaceSpecifier=function(){var Z=this.startNode();return this.next(),this.expectContextual("as"),Z.local=this.parseIdent(),this.checkLValSimple(Z.local,Mn),this.finishNode(Z,"ImportNamespaceSpecifier")};Qt.parseImportSpecifiers=function(){var Z=[],ee=!0;if(this.type===Ut.name){if(Z.push(this.parseImportDefaultSpecifier()),!this.eat(Ut.comma))return Z}if(this.type===Ut.star)return Z.push(this.parseImportNamespaceSpecifier()),Z;this.expect(Ut.braceL);while(!this.eat(Ut.braceR)){if(!ee){if(this.expect(Ut.comma),this.afterTrailingComma(Ut.braceR))break}else ee=!1;Z.push(this.parseImportSpecifier())}return Z};Qt.parseWithClause=function(){var Z=[];if(!this.eat(Ut._with))return Z;this.expect(Ut.braceL);var ee={},Le=!0;while(!this.eat(Ut.braceR)){if(!Le){if(this.expect(Ut.comma),this.afterTrailingComma(Ut.braceR))break}else Le=!1;var Ot=this.parseImportAttribute(),Bt=Ot.key.type==="Identifier"?Ot.key.name:Ot.key.value;if(Ei(ee,Bt))this.raiseRecoverable(Ot.key.start,"Duplicate attribute key '"+Bt+"'");ee[Bt]=!0,Z.push(Ot)}return Z};Qt.parseImportAttribute=function(){var Z=this.startNode();if(Z.key=this.type===Ut.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never"),this.expect(Ut.colon),this.type!==Ut.string)this.unexpected();return Z.value=this.parseExprAtom(),this.finishNode(Z,"ImportAttribute")};Qt.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===Ut.string){var Z=this.parseLiteral(this.value);if(ol.test(Z.value))this.raise(Z.start,"An export name cannot include a lone surrogate.");return Z}return this.parseIdent(!0)};Qt.adaptDirectivePrologue=function(Z){for(var ee=0;ee<Z.length&&this.isDirectiveCandidate(Z[ee]);++ee)Z[ee].directive=Z[ee].expression.raw.slice(1,-1)};Qt.isDirectiveCandidate=function(Z){return this.options.ecmaVersion>=5&&Z.type==="ExpressionStatement"&&Z.expression.type==="Literal"&&typeof Z.expression.value==="string"&&(this.input[Z.start]==='"'||this.input[Z.start]==="'")};var Tn=s.prototype;Tn.toAssignable=function(Z,ee,Le){if(this.options.ecmaVersion>=6&&Z)switch(Z.type){case"Identifier":if(this.inAsync&&Z.name==="await")this.raise(Z.start,"Cannot use 'await' as identifier inside an async function");break;case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":break;case"ObjectExpression":if(Z.type="ObjectPattern",Le)this.checkPatternErrors(Le,!0);for(var Ot=0,Bt=Z.properties;Ot<Bt.length;Ot+=1){var jt=Bt[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(Z.kind!=="init")this.raise(Z.key.start,"Object pattern can't contain getter or setter");this.toAssignable(Z.value,ee);break;case"ArrayExpression":if(Z.type="ArrayPattern",Le)this.checkPatternErrors(Le,!0);this.toAssignableList(Z.elements,ee);break;case"SpreadElement":if(Z.type="RestElement",this.toAssignable(Z.argument,ee),Z.argument.type==="AssignmentPattern")this.raise(Z.argument.start,"Rest elements cannot have a default value");break;case"AssignmentExpression":if(Z.operator!=="=")this.raise(Z.left.end,"Only '=' operator can be used for specifying default value.");Z.type="AssignmentPattern",delete Z.operator,this.toAssignable(Z.left,ee);break;case"ParenthesizedExpression":this.toAssignable(Z.expression,ee,Le);break;case"ChainExpression":this.raiseRecoverable(Z.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":if(!ee)break;default:this.raise(Z.start,"Assigning to rvalue")}else if(Le)this.checkPatternErrors(Le,!0);return Z};Tn.toAssignableList=function(Z,ee){var Le=Z.length;for(var Ot=0;Ot<Le;Ot++){var Bt=Z[Ot];if(Bt)this.toAssignable(Bt,ee)}if(Le){var jt=Z[Le-1];if(this.options.ecmaVersion===6&&ee&&jt&&jt.type==="RestElement"&&jt.argument.type!=="Identifier")this.unexpected(jt.argument.start)}return Z};Tn.parseSpread=function(Z){var ee=this.startNode();return this.next(),ee.argument=this.parseMaybeAssign(!1,Z),this.finishNode(ee,"SpreadElement")};Tn.parseRestBinding=function(){var Z=this.startNode();if(this.next(),this.options.ecmaVersion===6&&this.type!==Ut.name)this.unexpected();return Z.argument=this.parseBindingAtom(),this.finishNode(Z,"RestElement")};Tn.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case Ut.bracketL:var Z=this.startNode();return this.next(),Z.elements=this.parseBindingList(Ut.bracketR,!0,!0),this.finishNode(Z,"ArrayPattern");case Ut.braceL:return this.parseObj(!0)}return this.parseIdent()};Tn.parseBindingList=function(Z,ee,Le,Ot){var Bt=[],jt=!0;while(!this.eat(Z)){if(jt)jt=!1;else this.expect(Ut.comma);if(ee&&this.type===Ut.comma)Bt.push(null);else if(Le&&this.afterTrailingComma(Z))break;else if(this.type===Ut.ellipsis){var Gt=this.parseRestBinding();if(this.parseBindingListItem(Gt),Bt.push(Gt),this.type===Ut.comma)this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");this.expect(Z);break}else Bt.push(this.parseAssignableListItem(Ot))}return Bt};Tn.parseAssignableListItem=function(Z){var ee=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(ee),ee};Tn.parseBindingListItem=function(Z){return Z};Tn.parseMaybeDefault=function(Z,ee,Le){if(Le=Le||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(Ut.eq))return Le;var Ot=this.startNodeAt(Z,ee);return Ot.left=Le,Ot.right=this.parseMaybeAssign(),this.finishNode(Ot,"AssignmentPattern")};Tn.checkLValSimple=function(Z,ee,Le){if(ee===void 0)ee=Xi;var Ot=ee!==Xi;switch(Z.type){case"Identifier":if(this.strict&&this.reservedWordsStrictBind.test(Z.name))this.raiseRecoverable(Z.start,(Ot?"Binding ":"Assigning to ")+Z.name+" in strict mode");if(Ot){if(ee===Mn&&Z.name==="let")this.raiseRecoverable(Z.start,"let is disallowed as a lexically bound name");if(Le){if(Ei(Le,Z.name))this.raiseRecoverable(Z.start,"Argument name clash");Le[Z.name]=!0}if(ee!==Ko)this.declareName(Z.name,ee,Z.start)}break;case"ChainExpression":this.raiseRecoverable(Z.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":if(Ot)this.raiseRecoverable(Z.start,"Binding member expression");break;case"ParenthesizedExpression":if(Ot)this.raiseRecoverable(Z.start,"Binding parenthesized expression");return this.checkLValSimple(Z.expression,ee,Le);default:this.raise(Z.start,(Ot?"Binding":"Assigning to")+" rvalue")}};Tn.checkLValPattern=function(Z,ee,Le){if(ee===void 0)ee=Xi;switch(Z.type){case"ObjectPattern":for(var Ot=0,Bt=Z.properties;Ot<Bt.length;Ot+=1){var jt=Bt[Ot];this.checkLValInnerPattern(jt,ee,Le)}break;case"ArrayPattern":for(var Gt=0,Lt=Z.elements;Gt<Lt.length;Gt+=1){var Vt=Lt[Gt];if(Vt)this.checkLValInnerPattern(Vt,ee,Le)}break;default:this.checkLValSimple(Z,ee,Le)}};Tn.checkLValInnerPattern=function(Z,ee,Le){if(ee===void 0)ee=Xi;switch(Z.type){case"Property":this.checkLValInnerPattern(Z.value,ee,Le);break;case"AssignmentPattern":this.checkLValPattern(Z.left,ee,Le);break;case"RestElement":this.checkLValPattern(Z.argument,ee,Le);break;default:this.checkLValPattern(Z,ee,Le)}};var An=function(Z,ee,Le,Ot,Bt){this.token=Z,this.isExpr=!!ee,this.preserveSpace=!!Le,this.override=Ot,this.generator=!!Bt},pn={b_stat:new An("{",!1),b_expr:new An("{",!0),b_tmpl:new An("${",!1),p_stat:new An("(",!1),p_expr:new An("(",!0),q_tmpl:new An("`",!0,!0,function(Z){return Z.tryReadTemplateToken()}),f_stat:new An("function",!1),f_expr:new An("function",!0),f_expr_gen:new An("function",!0,!1,null,!0),f_gen:new An("function",!1,!1,null,!0)},li=s.prototype;li.initialContext=function(){return[pn.b_stat]};li.curContext=function(){return this.context[this.context.length-1]};li.braceIsBlock=function(Z){var ee=this.curContext();if(ee===pn.f_expr||ee===pn.f_stat)return!0;if(Z===Ut.colon&&(ee===pn.b_stat||ee===pn.b_expr))return!ee.isExpr;if(Z===Ut._return||Z===Ut.name&&this.exprAllowed)return vn.test(this.input.slice(this.lastTokEnd,this.start));if(Z===Ut._else||Z===Ut.semi||Z===Ut.eof||Z===Ut.parenR||Z===Ut.arrow)return!0;if(Z===Ut.braceL)return ee===pn.b_stat;if(Z===Ut._var||Z===Ut._const||Z===Ut.name)return!1;return!this.exprAllowed};li.inGeneratorContext=function(){for(var Z=this.context.length-1;Z>=1;Z--){var ee=this.context[Z];if(ee.token==="function")return ee.generator}return!1};li.updateContext=function(Z){var ee,Le=this.type;if(Le.keyword&&Z===Ut.dot)this.exprAllowed=!1;else if(ee=Le.updateContext)ee.call(this,Z);else this.exprAllowed=Le.beforeExpr};li.overrideContext=function(Z){if(this.curContext()!==Z)this.context[this.context.length-1]=Z};Ut.parenR.updateContext=Ut.braceR.updateContext=function(){if(this.context.length===1){this.exprAllowed=!0;return}var Z=this.context.pop();if(Z===pn.b_stat&&this.curContext().token==="function")Z=this.context.pop();this.exprAllowed=!Z.isExpr};Ut.braceL.updateContext=function(Z){this.context.push(this.braceIsBlock(Z)?pn.b_stat:pn.b_expr),this.exprAllowed=!0};Ut.dollarBraceL.updateContext=function(){this.context.push(pn.b_tmpl),this.exprAllowed=!0};Ut.parenL.updateContext=function(Z){var ee=Z===Ut._if||Z===Ut._for||Z===Ut._with||Z===Ut._while;this.context.push(ee?pn.p_stat:pn.p_expr),this.exprAllowed=!0};Ut.incDec.updateContext=function(){};Ut._function.updateContext=Ut._class.updateContext=function(Z){if(Z.beforeExpr&&Z!==Ut._else&&!(Z===Ut.semi&&this.curContext()!==pn.p_stat)&&!(Z===Ut._return&&vn.test(this.input.slice(this.lastTokEnd,this.start)))&&!((Z===Ut.colon||Z===Ut.braceL)&&this.curContext()===pn.b_stat))this.context.push(pn.f_expr);else this.context.push(pn.f_stat);this.exprAllowed=!1};Ut.colon.updateContext=function(){if(this.curContext().token==="function")this.context.pop();this.exprAllowed=!0};Ut.backQuote.updateContext=function(){if(this.curContext()===pn.q_tmpl)this.context.pop();else this.context.push(pn.q_tmpl);this.exprAllowed=!1};Ut.star.updateContext=function(Z){if(Z===Ut._function){var ee=this.context.length-1;if(this.context[ee]===pn.f_expr)this.context[ee]=pn.f_expr_gen;else this.context[ee]=pn.f_gen}this.exprAllowed=!0};Ut.name.updateContext=function(Z){var ee=!1;if(this.options.ecmaVersion>=6&&Z!==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(Z,ee,Le){if(this.options.ecmaVersion>=9&&Z.type==="SpreadElement")return;if(this.options.ecmaVersion>=6&&(Z.computed||Z.method||Z.shorthand))return;var Ot=Z.key,Bt;switch(Ot.type){case"Identifier":Bt=Ot.name;break;case"Literal":Bt=String(Ot.value);break;default:return}var jt=Z.kind;if(this.options.ecmaVersion>=6){if(Bt==="__proto__"&&jt==="init"){if(ee.proto)if(Le){if(Le.doubleProto<0)Le.doubleProto=Ot.start}else this.raiseRecoverable(Ot.start,"Redefinition of __proto__ property");ee.proto=!0}return}Bt="$"+Bt;var Gt=ee[Bt];if(Gt){var Lt;if(jt==="init")Lt=this.strict&&Gt.init||Gt.get||Gt.set;else Lt=Gt.init||Gt[jt];if(Lt)this.raiseRecoverable(Ot.start,"Redefinition of property")}else Gt=ee[Bt]={init:!1,get:!1,set:!1};Gt[jt]=!0};en.parseExpression=function(Z,ee){var Le=this;return this.catchStackOverflow(function(){var{start:Ot,startLoc:Bt}=Le,jt=Le.parseMaybeAssign(Z,ee);if(Le.type===Ut.comma){var Gt=Le.startNodeAt(Ot,Bt);Gt.expressions=[jt];while(Le.eat(Ut.comma))Gt.expressions.push(Le.parseMaybeAssign(Z,ee));return Le.finishNode(Gt,"SequenceExpression")}return jt})};en.parseMaybeAssign=function(Z,ee,Le){if(this.isContextual("yield"))if(this.inGenerator)return this.parseYield(Z);else this.exprAllowed=!1;var Ot=!1,Bt=-1,jt=-1,Gt=-1;if(ee)Bt=ee.parenthesizedAssign,jt=ee.trailingComma,Gt=ee.doubleProto,ee.parenthesizedAssign=ee.trailingComma=-1;else ee=new ns,Ot=!0;var Lt=this.start,Vt=this.startLoc;if(this.type===Ut.parenL||this.type===Ut.name)this.potentialArrowAt=this.start,this.potentialArrowInForAwait=Z==="await";var Wt=this.parseMaybeConditional(Z,ee);if(Le)Wt=Le.call(this,Wt,Lt,Vt);if(this.type.isAssign){var Kt=this.startNodeAt(Lt,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(Z),Gt>-1)ee.doubleProto=Gt;return this.finishNode(Kt,"AssignmentExpression")}else if(Ot)this.checkExpressionErrors(ee,!0);if(Bt>-1)ee.parenthesizedAssign=Bt;if(jt>-1)ee.trailingComma=jt;return Wt};en.parseMaybeConditional=function(Z,ee){var Le=this.start,Ot=this.startLoc,Bt=this.parseExprOps(Z,ee);if(this.checkExpressionErrors(ee))return Bt;if(!(Bt.type==="ArrowFunctionExpression"&&Bt.start===Le)&&this.eat(Ut.question)){var jt=this.startNodeAt(Le,Ot);return jt.test=Bt,jt.consequent=this.parseMaybeAssign(),this.expect(Ut.colon),jt.alternate=this.parseMaybeAssign(Z),this.finishNode(jt,"ConditionalExpression")}return Bt};en.parseExprOps=function(Z,ee){var Le=this.start,Ot=this.startLoc,Bt=this.parseMaybeUnary(ee,!1,!1,Z);if(this.checkExpressionErrors(ee))return Bt;return Bt.start===Le&&Bt.type==="ArrowFunctionExpression"?Bt:this.parseExprOp(Bt,Le,Ot,-1,Z)};en.parseExprOp=function(Z,ee,Le,Ot,Bt){var jt=this.type.binop;if(jt!=null&&(!Bt||this.type!==Ut._in)){if(jt>Ot){var Gt=this.type===Ut.logicalOR||this.type===Ut.logicalAND,Lt=this.type===Ut.coalesce;if(Lt)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,Bt),Wt,Kt,jt,Bt),qt=this.buildBinary(ee,Le,Z,Ht,Vt,Gt||Lt);if(Gt&&this.type===Ut.coalesce||Lt&&(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,Le,Ot,Bt)}}return Z};en.buildBinary=function(Z,ee,Le,Ot,Bt,jt){if(Ot.type==="PrivateIdentifier")this.raise(Ot.start,"Private identifier can only be left side of binary expression");var Gt=this.startNodeAt(Z,ee);return Gt.left=Le,Gt.operator=Bt,Gt.right=Ot,this.finishNode(Gt,jt?"LogicalExpression":"BinaryExpression")};en.parseMaybeUnary=function(Z,ee,Le,Ot){var Bt=this.start,jt=this.startLoc,Gt;if(this.isContextual("await")&&this.canAwait)Gt=this.parseAwait(Ot),ee=!0;else if(this.type.prefix){var Lt=this.startNode(),Vt=this.type===Ut.incDec;if(Lt.operator=this.value,Lt.prefix=!0,this.next(),Lt.argument=this.parseMaybeUnary(null,!0,Vt,Ot),this.checkExpressionErrors(Z,!0),Vt)this.checkLValSimple(Lt.argument);else if(this.strict&&Lt.operator==="delete"&&qo(Lt.argument))this.raiseRecoverable(Lt.start,"Deleting local variable in strict mode");else if(Lt.operator==="delete"&&qs(Lt.argument))this.raiseRecoverable(Lt.start,"Private fields can not be deleted");else ee=!0;Gt=this.finishNode(Lt,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(Z,Ot),this.checkExpressionErrors(Z))return Gt;while(this.type.postfix&&!this.canInsertSemicolon()){var Wt=this.startNodeAt(Bt,jt);Wt.operator=this.value,Wt.prefix=!1,Wt.argument=Gt,this.checkLValSimple(Gt),this.next(),Gt=this.finishNode(Wt,"UpdateExpression")}}if(!Le&&!(Gt.type==="ArrowFunctionExpression"&&Gt.start===Bt)&&this.eat(Ut.starstar))if(ee)this.unexpected(this.lastTokStart);else return this.buildBinary(Bt,jt,Gt,this.parseMaybeUnary(null,!1,!1,Ot),"**",!1);else return Gt};function qo(Z){return Z.type==="Identifier"||Z.type==="ParenthesizedExpression"&&qo(Z.expression)}function qs(Z){return Z.type==="MemberExpression"&&Z.property.type==="PrivateIdentifier"||Z.type==="ChainExpression"&&qs(Z.expression)||Z.type==="ParenthesizedExpression"&&qs(Z.expression)}en.parseExprSubscripts=function(Z,ee){var Le=this.start,Ot=this.startLoc,Bt=this.parseExprAtom(Z,ee);if(Bt.type==="ArrowFunctionExpression"&&this.input.slice(this.lastTokStart,this.lastTokEnd)!==")")return Bt;var jt=this.parseSubscripts(Bt,Le,Ot,!1,ee);if(Z&&jt.type==="MemberExpression"){if(Z.parenthesizedAssign>=jt.start)Z.parenthesizedAssign=-1;if(Z.parenthesizedBind>=jt.start)Z.parenthesizedBind=-1;if(Z.trailingComma>=jt.start)Z.trailingComma=-1}return jt};en.parseSubscripts=function(Z,ee,Le,Ot,Bt){var jt=this.options.ecmaVersion>=8&&Z.type==="Identifier"&&Z.name==="async"&&this.lastTokEnd===Z.end&&!this.canInsertSemicolon()&&Z.end-Z.start===5&&this.potentialArrowAt===Z.start,Gt=!1;while(!0){var Lt=this.parseSubscript(Z,ee,Le,Ot,jt,Gt,Bt);if(Lt.optional)Gt=!0;if(Lt===Z||Lt.type==="ArrowFunctionExpression"){if(Gt){var Vt=this.startNodeAt(ee,Le);Vt.expression=Lt,Lt=this.finishNode(Vt,"ChainExpression")}return Lt}Z=Lt}};en.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(Ut.arrow)};en.parseSubscriptAsyncArrow=function(Z,ee,Le,Ot){return this.parseArrowExpression(this.startNodeAt(Z,ee),Le,!0,Ot)};en.parseSubscript=function(Z,ee,Le,Ot,Bt,jt,Gt){var Lt=this.options.ecmaVersion>=11,Vt=Lt&&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,Le);if(Kt.object=Z,Wt)Kt.property=this.parseExpression(),this.expect(Ut.bracketR);else if(this.type===Ut.privateId&&Z.type!=="Super")Kt.property=this.parsePrivateIdent();else Kt.property=this.parseIdent(this.options.allowReserved!=="never");if(Kt.computed=!!Wt,Lt)Kt.optional=Vt;Z=this.finishNode(Kt,"MemberExpression")}else if(!Ot&&this.eat(Ut.parenL)){var Ht=new ns,qt=this.yieldPos,zt=this.awaitPos,Xt=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var Yt=this.parseExprList(Ut.parenR,this.options.ecmaVersion>=8,!1,Ht);if(Bt&&!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,Le,Yt,Gt)}this.checkExpressionErrors(Ht,!0),this.yieldPos=qt||this.yieldPos,this.awaitPos=zt||this.awaitPos,this.awaitIdentPos=Xt||this.awaitIdentPos;var Jt=this.startNodeAt(ee,Le);if(Jt.callee=Z,Jt.arguments=Yt,Lt)Jt.optional=Vt;Z=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,Le);tn.tag=Z,tn.quasi=this.parseTemplate({isTagged:!0}),Z=this.finishNode(tn,"TaggedTemplateExpression")}return Z};en.parseExprAtom=function(Z,ee,Le){if(this.type===Ut.slash)this.readRegexp();var Ot,Bt=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,Lt=this.containsEsc,Vt=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!Lt&&Vt.name==="async"&&!this.canInsertSemicolon()&&this.eat(Ut._function))return this.overrideContext(pn.f_expr),this.parseFunction(this.startNodeAt(jt,Gt),0,!1,!0,ee);if(Bt&&!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&&!Lt&&(!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(Bt,ee);if(Z){if(Z.parenthesizedAssign<0&&!this.isSimpleAssignTarget(Ht))Z.parenthesizedAssign=Kt;if(Z.parenthesizedBind<0)Z.parenthesizedBind=Kt}return Ht;case Ut.bracketL:return Ot=this.startNode(),this.next(),Ot.elements=this.parseExprList(Ut.bracketR,!0,!0,Z),this.finishNode(Ot,"ArrayExpression");case Ut.braceL:return this.overrideContext(pn.b_expr),this.parseObj(!1,Z);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(Le);else return this.unexpected();default:return this.parseExprAtomDefault()}};en.parseExprAtomDefault=function(){this.unexpected()};en.parseExprImport=function(Z){var ee=this.startNode();if(this.containsEsc)this.raiseRecoverable(this.start,"Escape sequence in keyword import");if(this.next(),this.type===Ut.parenL&&!Z)return this.parseDynamicImport(ee);else if(this.type===Ut.dot){var Le=this.startNodeAt(ee.start,ee.loc&&ee.loc.start);return Le.name="import",ee.meta=this.finishNode(Le,"Identifier"),this.parseImportMeta(ee)}else this.unexpected()};en.parseDynamicImport=function(Z){if(this.next(),Z.source=this.parseMaybeAssign(),this.options.ecmaVersion>=16)if(!this.eat(Ut.parenR))if(this.expect(Ut.comma),!this.afterTrailingComma(Ut.parenR)){if(Z.options=this.parseMaybeAssign(),!this.eat(Ut.parenR)){if(this.expect(Ut.comma),!this.afterTrailingComma(Ut.parenR))this.unexpected()}}else Z.options=null;else Z.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(Z,"ImportExpression")};en.parseImportMeta=function(Z){this.next();var ee=this.containsEsc;if(Z.property=this.parseIdent(!0),Z.property.name!=="meta")this.raiseRecoverable(Z.property.start,"The only valid meta property for import is 'import.meta'");if(ee)this.raiseRecoverable(Z.start,"'import.meta' must not contain escaped characters");if(this.options.sourceType!=="module"&&!this.options.allowImportExportEverywhere)this.raiseRecoverable(Z.start,"Cannot use 'import.meta' outside a module");return this.finishNode(Z,"MetaProperty")};en.parseLiteral=function(Z){var ee=this.startNode();if(ee.value=Z,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 Z=this.parseExpression();return this.expect(Ut.parenR),Z};en.shouldParseArrow=function(Z){return!this.canInsertSemicolon()};en.parseParenAndDistinguishExpression=function(Z,ee){var Le=this.start,Ot=this.startLoc,Bt,jt=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var Gt=this.start,Lt=this.startLoc,Vt=[],Wt=!0,Kt=!1,Ht=new ns,qt=this.yieldPos,zt=this.awaitPos,Xt;this.yieldPos=0,this.awaitPos=0;while(this.type!==Ut.parenR)if(Wt?Wt=!1:this.expect(Ut.comma),jt&&this.afterTrailingComma(Ut.parenR,!0)){Kt=!0;break}else if(this.type===Ut.ellipsis){if(Xt=this.start,Vt.push(this.parseParenItem(this.parseRestBinding())),this.type===Ut.comma)this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");break}else Vt.push(this.parseMaybeAssign(!1,Ht,this.parseParenItem));var Yt=this.lastTokEnd,Jt=this.lastTokEndLoc;if(this.expect(Ut.parenR),Z&&this.shouldParseArrow(Vt)&&this.eat(Ut.arrow))return this.checkPatternErrors(Ht,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=qt,this.awaitPos=zt,this.parseParenArrowList(Le,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)Bt=this.startNodeAt(Gt,Lt),Bt.expressions=Vt,this.finishNodeAt(Bt,"SequenceExpression",Yt,Jt);else Bt=Vt[0]}else Bt=this.parseParenExpression();if(this.options.preserveParens){var tn=this.startNodeAt(Le,Ot);return tn.expression=Bt,this.finishNode(tn,"ParenthesizedExpression")}else return Bt};en.parseParenItem=function(Z){return Z};en.parseParenArrowList=function(Z,ee,Le,Ot){return this.parseArrowExpression(this.startNodeAt(Z,ee),Le,!1,Ot)};var dl=[];en.parseNew=function(){if(this.containsEsc)this.raiseRecoverable(this.start,"Escape sequence in keyword new");var Z=this.startNode();if(this.next(),this.options.ecmaVersion>=6&&this.type===Ut.dot){var ee=this.startNodeAt(Z.start,Z.loc&&Z.loc.start);ee.name="new",Z.meta=this.finishNode(ee,"Identifier"),this.next();var Le=this.containsEsc;if(Z.property=this.parseIdent(!0),Z.property.name!=="target")this.raiseRecoverable(Z.property.start,"The only valid meta property for new is 'new.target'");if(Le)this.raiseRecoverable(Z.start,"'new.target' must not contain escaped characters");if(!this.allowNewDotTarget)this.raiseRecoverable(Z.start,"'new.target' can only be used in functions and class static block");return this.finishNode(Z,"MetaProperty")}var Ot=this.start,Bt=this.startLoc;if(Z.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),Ot,Bt,!0,!1),Z.callee.type==="Super")this.raiseRecoverable(Ot,"Invalid use of 'super'");if(this.eat(Ut.parenL))Z.arguments=this.parseExprList(Ut.parenR,this.options.ecmaVersion>=8,!1);else Z.arguments=dl;return this.finishNode(Z,"NewExpression")};en.parseTemplateElement=function(Z){var ee=Z.isTagged,Le=this.startNode();if(this.type===Ut.invalidTemplate){if(!ee)this.raiseRecoverable(this.start,"Bad escape sequence in untagged template literal");Le.value={raw:this.value.replace(/\r\n?/g,`
|
|
11
|
+
`),cooked:null}}else Le.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,`
|
|
12
|
+
`),cooked:this.value};return this.next(),Le.tail=this.type===Ut.backQuote,this.finishNode(Le,"TemplateElement")};en.parseTemplate=function(Z){if(Z===void 0)Z={};var ee=Z.isTagged;if(ee===void 0)ee=!1;var Le=this.startNode();this.next(),Le.expressions=[];var Ot=this.parseTemplateElement({isTagged:ee});Le.quasis=[Ot];while(!Ot.tail){if(this.type===Ut.eof)this.raise(this.pos,"Unterminated template literal");this.expect(Ut.dollarBraceL),Le.expressions.push(this.parseExpression()),this.expect(Ut.braceR),Le.quasis.push(Ot=this.parseTemplateElement({isTagged:ee}))}return this.next(),this.finishNode(Le,"TemplateLiteral")};en.isAsyncProp=function(Z){return!Z.computed&&Z.key.type==="Identifier"&&Z.key.name==="async"&&(this.type===Ut.name||this.type===Ut.num||this.type===Ut.string||this.type===Ut.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===Ut.star)&&!vn.test(this.input.slice(this.lastTokEnd,this.start))};en.parseObj=function(Z,ee){var Le=this.startNode(),Ot=!0,Bt={};Le.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(Z,ee);if(!Z)this.checkPropClash(jt,Bt,ee);Le.properties.push(jt)}return this.finishNode(Le,Z?"ObjectPattern":"ObjectExpression")};en.parseProperty=function(Z,ee){var Le=this.startNode(),Ot,Bt,jt,Gt;if(this.options.ecmaVersion>=9&&this.eat(Ut.ellipsis)){if(Z){if(Le.argument=this.parseIdent(!1),this.type===Ut.comma)this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");return this.finishNode(Le,"RestElement")}if(Le.argument=this.parseMaybeAssign(!1,ee),this.type===Ut.comma&&ee&&ee.trailingComma<0)ee.trailingComma=this.start;return this.finishNode(Le,"SpreadElement")}if(this.options.ecmaVersion>=6){if(Le.method=!1,Le.shorthand=!1,Z||ee)jt=this.start,Gt=this.startLoc;if(!Z)Ot=this.eat(Ut.star)}var Lt=this.containsEsc;if(this.parsePropertyName(Le),!Z&&!Lt&&this.options.ecmaVersion>=8&&!Ot&&this.isAsyncProp(Le))Bt=!0,Ot=this.options.ecmaVersion>=9&&this.eat(Ut.star),this.parsePropertyName(Le);else Bt=!1;return this.parsePropertyValue(Le,Z,Ot,Bt,jt,Gt,ee,Lt),this.finishNode(Le,"Property")};en.parseGetterSetter=function(Z){var ee=Z.key.name;this.parsePropertyName(Z),Z.value=this.parseMethod(!1),Z.kind=ee;var Le=Z.kind==="get"?0:1;if(Z.value.params.length!==Le){var Ot=Z.value.start;if(Z.kind==="get")this.raiseRecoverable(Ot,"getter should have no params");else this.raiseRecoverable(Ot,"setter should have exactly one param")}else if(Z.kind==="set"&&Z.value.params[0].type==="RestElement")this.raiseRecoverable(Z.value.params[0].start,"Setter cannot use rest params")};en.parsePropertyValue=function(Z,ee,Le,Ot,Bt,jt,Gt,Lt){if((Le||Ot)&&this.type===Ut.colon)this.unexpected();if(this.eat(Ut.colon))Z.value=ee?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,Gt),Z.kind="init";else if(this.options.ecmaVersion>=6&&this.type===Ut.parenL){if(ee)this.unexpected();Z.method=!0,Z.value=this.parseMethod(Le,Ot),Z.kind="init"}else if(!ee&&!Lt&&this.options.ecmaVersion>=5&&!Z.computed&&Z.key.type==="Identifier"&&(Z.key.name==="get"||Z.key.name==="set")&&(this.type!==Ut.comma&&this.type!==Ut.braceR&&this.type!==Ut.eq)){if(Le||Ot)this.unexpected();this.parseGetterSetter(Z)}else if(this.options.ecmaVersion>=6&&!Z.computed&&Z.key.type==="Identifier"){if(Le||Ot)this.unexpected();if(this.checkUnreserved(Z.key),Z.key.name==="await"&&!this.awaitIdentPos)this.awaitIdentPos=Bt;if(ee)Z.value=this.parseMaybeDefault(Bt,jt,this.copyNode(Z.key));else if(this.type===Ut.eq&&Gt){if(Gt.shorthandAssign<0)Gt.shorthandAssign=this.start;Z.value=this.parseMaybeDefault(Bt,jt,this.copyNode(Z.key))}else Z.value=this.copyNode(Z.key);Z.kind="init",Z.shorthand=!0}else this.unexpected()};en.parsePropertyName=function(Z){if(this.options.ecmaVersion>=6)if(this.eat(Ut.bracketL))return Z.computed=!0,Z.key=this.parseMaybeAssign(),this.expect(Ut.bracketR),Z.key;else Z.computed=!1;return Z.key=this.type===Ut.num||this.type===Ut.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never")};en.initFunction=function(Z){if(Z.id=null,this.options.ecmaVersion>=6)Z.generator=Z.expression=!1;if(this.options.ecmaVersion>=8)Z.async=!1};en.parseMethod=function(Z,ee,Le){var Ot=this.startNode(),Bt=this.yieldPos,jt=this.awaitPos,Gt=this.awaitIdentPos;if(this.initFunction(Ot),this.options.ecmaVersion>=6)Ot.generator=Z;if(this.options.ecmaVersion>=8)Ot.async=!!ee;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(Ys(ee,Ot.generator)|es|(Le?Vo: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=Bt,this.awaitPos=jt,this.awaitIdentPos=Gt,this.finishNode(Ot,"FunctionExpression")};en.parseArrowExpression=function(Z,ee,Le,Ot){var Bt=this.yieldPos,jt=this.awaitPos,Gt=this.awaitIdentPos;if(this.enterScope(Ys(Le,!1)|Js),this.initFunction(Z),this.options.ecmaVersion>=8)Z.async=!!Le;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,Z.params=this.toAssignableList(ee,!0),this.parseFunctionBody(Z,!0,!1,Ot),this.yieldPos=Bt,this.awaitPos=jt,this.awaitIdentPos=Gt,this.finishNode(Z,"ArrowFunctionExpression")};en.parseFunctionBody=function(Z,ee,Le,Ot){var Bt=ee&&this.type!==Ut.braceL,jt=this.strict,Gt=!1;if(Bt)Z.body=this.parseMaybeAssign(Ot),Z.expression=!0,this.checkParams(Z,!1);else{var Lt=this.options.ecmaVersion>=7&&!this.isSimpleParamList(Z.params);if(!jt||Lt){if(Gt=this.strictDirective(this.end),Gt&&Lt)this.raiseRecoverable(Z.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(Z,!jt&&!Gt&&!ee&&!Le&&this.isSimpleParamList(Z.params)),this.strict&&Z.id)this.checkLValSimple(Z.id,Ko);Z.body=this.parseBlock(!1,void 0,Gt&&!jt),Z.expression=!1,this.adaptDirectivePrologue(Z.body.body),this.labels=Vt}this.exitScope()};en.isSimpleParamList=function(Z){for(var ee=0,Le=Z;ee<Le.length;ee+=1){var Ot=Le[ee];if(Ot.type!=="Identifier")return!1}return!0};en.checkParams=function(Z,ee){var Le=Object.create(null);for(var Ot=0,Bt=Z.params;Ot<Bt.length;Ot+=1){var jt=Bt[Ot];this.checkLValInnerPattern(jt,Qs,ee?null:Le)}};en.parseExprList=function(Z,ee,Le,Ot){var Bt=[],jt=!0;while(!this.eat(Z)){if(!jt){if(this.expect(Ut.comma),ee&&this.afterTrailingComma(Z))break}else jt=!1;var Gt=void 0;if(Le&&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);Bt.push(Gt)}return Bt};en.checkUnreserved=function(Z){var{start:ee,end:Le,name:Ot}=Z;if(this.inGenerator&&Ot==="yield")this.raiseRecoverable(ee,"Cannot use 'yield' as identifier inside a generator");if(this.inAsync&&Ot==="await")this.raiseRecoverable(ee,"Cannot use 'await' as identifier inside an async function");if(!(this.currentThisScope().flags&ts)&&Ot==="arguments")this.raiseRecoverable(ee,"Cannot use 'arguments' in class field initializer");if(this.inClassStaticBlock&&(Ot==="arguments"||Ot==="await"))this.raise(ee,"Cannot use "+Ot+" in class static initialization block");if(this.keywords.test(Ot))this.raise(ee,"Unexpected keyword '"+Ot+"'");if(this.options.ecmaVersion<6&&this.input.slice(ee,Le).indexOf("\\")!==-1)return;var Bt=this.strict?this.reservedWordsStrict:this.reservedWords;if(Bt.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(Z){var ee=this.parseIdentNode();if(this.next(!!Z),this.finishNode(ee,"Identifier"),!Z){if(this.checkUnreserved(ee),ee.name==="await"&&!this.awaitIdentPos)this.awaitIdentPos=ee.start}return ee};en.parseIdentNode=function(){var Z=this.startNode();if(this.type===Ut.name)Z.name=this.value;else if(this.type.keyword){if(Z.name=this.type.keyword,(Z.name==="class"||Z.name==="function")&&(this.lastTokEnd!==this.lastTokStart+1||this.input.charCodeAt(this.lastTokStart)!==46))this.context.pop();this.type=Ut.name}else this.unexpected();return Z};en.parsePrivateIdent=function(){var Z=this.startNode();if(this.type===Ut.privateId)Z.name=this.value;else this.unexpected();if(this.next(),this.finishNode(Z,"PrivateIdentifier"),this.options.checkPrivateFields)if(this.privateNameStack.length===0)this.raise(Z.start,"Private field '#"+Z.name+"' must be declared in an enclosing class");else this.privateNameStack[this.privateNameStack.length-1].used.push(Z);return Z};en.parseYield=function(Z){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(Z);return this.finishNode(ee,"YieldExpression")};en.parseAwait=function(Z){if(!this.awaitPos)this.awaitPos=this.start;var ee=this.startNode();return this.next(),ee.argument=this.parseMaybeUnary(null,!0,!1,Z),this.finishNode(ee,"AwaitExpression")};var Yi=s.prototype;Yi.raise=function(Z,ee){var Le=Fo(this.input,Z);if(ee+=" ("+Le.line+":"+Le.column+")",this.sourceFile)ee+=" in "+this.sourceFile;var Ot=SyntaxError(ee);throw Ot.pos=Z,Ot.loc=Le,Ot.raisedAt=this.pos,Ot};Yi.raiseRecoverable=Yi.raise;Yi.curPosition=function(){if(this.options.locations)return new vi(this.curLine,this.pos-this.lineStart)};var Gn=s.prototype,fl=function(Z){this.flags=Z,this.var=[],this.lexical=[],this.functions=[]};Gn.enterScope=function(Z){this.scopeStack.push(new fl(Z))};Gn.exitScope=function(){this.scopeStack.pop()};Gn.treatFunctionsAsVarInScope=function(Z){return Z.flags&Zn||!this.inModule&&Z.flags&Qn};Gn.declareName=function(Z,ee,Le){var Ot=!1;if(ee===Mn){var Bt=this.currentScope();if(Ot=Bt.lexical.indexOf(Z)>-1||Bt.functions.indexOf(Z)>-1||Bt.var.indexOf(Z)>-1,Bt.lexical.push(Z),this.inModule&&Bt.flags&Qn)delete this.undefinedExports[Z]}else if(ee===Uo){var jt=this.currentScope();jt.lexical.push(Z)}else if(ee===Wo){var Gt=this.currentScope();if(this.treatFunctionsAsVar)Ot=Gt.lexical.indexOf(Z)>-1;else Ot=Gt.lexical.indexOf(Z)>-1||Gt.var.indexOf(Z)>-1;Gt.functions.push(Z)}else for(var Lt=this.scopeStack.length-1;Lt>=0;--Lt){var Vt=this.scopeStack[Lt];if(Vt.lexical.indexOf(Z)>-1&&!(Vt.flags&jo&&Vt.lexical[0]===Z)||!this.treatFunctionsAsVarInScope(Vt)&&Vt.functions.indexOf(Z)>-1){Ot=!0;break}if(Vt.var.push(Z),this.inModule&&Vt.flags&Qn)delete this.undefinedExports[Z];if(Vt.flags&ts)break}if(Ot)this.raiseRecoverable(Le,"Identifier '"+Z+"' has already been declared")};Gn.checkLocalExport=function(Z){if(this.scopeStack[0].lexical.indexOf(Z.name)===-1&&this.scopeStack[0].var.indexOf(Z.name)===-1)this.undefinedExports[Z.name]=Z};Gn.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]};Gn.currentVarScope=function(){for(var Z=this.scopeStack.length-1;;Z--){var ee=this.scopeStack[Z];if(ee.flags&(ts|Si|ei))return ee}};Gn.currentThisScope=function(){for(var Z=this.scopeStack.length-1;;Z--){var ee=this.scopeStack[Z];if(ee.flags&(ts|Si|ei)&&!(ee.flags&Js))return ee}};var is=function(Z,ee,Le){if(this.type="",this.start=ee,this.end=0,Z.options.locations)this.loc=new Zi(Z,Le);if(Z.options.directSourceFile)this.sourceFile=Z.options.directSourceFile;if(Z.options.ranges)this.range=[ee,0]},Ci=s.prototype;Ci.startNode=function(){return new is(this,this.start,this.startLoc)};Ci.startNodeAt=function(Z,ee){return new is(this,Z,ee)};function zo(Z,ee,Le,Ot){if(Z.type=ee,Z.end=Le,this.options.locations)Z.loc.end=Ot;if(this.options.ranges)Z.range[1]=Le;return Z}Ci.finishNode=function(Z,ee){return zo.call(this,Z,ee,this.lastTokEnd,this.lastTokEndLoc)};Ci.finishNodeAt=function(Z,ee,Le,Ot){return zo.call(this,Z,ee,Le,Ot)};Ci.copyNode=function(Z){var ee=new is(this,Z.start,this.startLoc);for(var Le in Z)ee[Le]=Z[Le];return ee};var Xo=function(){};Xo.prototype.reset=function(){};s.prototype.validateRegExpFlags=function(){};s.prototype.validateRegExpPattern=function(){};var er=function(Z){if(this.type=Z.type,this.value=Z.value,this.start=Z.start,this.end=Z.end,Z.options.locations)this.loc=new Zi(Z,Z.startLoc,Z.endLoc);if(Z.options.ranges)this.range=[Z.start,Z.end]},nn=s.prototype;nn.next=function(Z){if(!Z&&this.type.keyword&&this.containsEsc)this.raiseRecoverable(this.start,"Escape sequence in keyword "+this.type.keyword);if(this.options.onToken)this.options.onToken(new er(this));this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()};nn.getToken=function(){return this.next(),new er(this)};if(typeof Symbol<"u")nn[Symbol.iterator]=function(){var Z=this;return{next:function(){var ee=Z.getToken();return{done:ee.type===Ut.eof,value:ee}}}};nn.nextToken=function(){var Z=this.curContext();if(!Z||!Z.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(Z.override)return Z.override(this);else this.readToken(this.fullCharCodeAtPos())};nn.readToken=function(Z){if(m(Z,this.options.ecmaVersion>=6)||Z===92)return this.readWord();return this.getTokenFromCode(Z)};nn.fullCharCodeAt=function(Z){var ee=this.input.charCodeAt(Z);if(ee<=55295||ee>=56320)return ee;var Le=this.input.charCodeAt(Z+1);return Le<=56319||Le>=57344?ee:(ee<<10)+Le-56613888};nn.fullCharCodeAtPos=function(){return this.fullCharCodeAt(this.pos)};nn.skipBlockComment=function(){var Z=this.options.onComment&&this.curPosition(),ee=this.pos,Le=this.input.indexOf("*/",this.pos+=2);if(Le===-1)this.raise(this.pos-2,"Unterminated comment");if(this.pos=Le+2,this.options.locations)for(var Ot=void 0,Bt=ee;(Ot=Lo(this.input,Bt,this.pos))>-1;)++this.curLine,Bt=this.lineStart=Ot;if(this.options.onComment)this.options.onComment(!0,this.input.slice(ee+2,Le),ee,this.pos,Z,this.curPosition())};nn.skipLineComment=function(Z){var ee=this.pos,Le=this.options.onComment&&this.curPosition(),Ot=this.input.charCodeAt(this.pos+=Z);while(this.pos<this.input.length&&!ci(Ot))Ot=this.input.charCodeAt(++this.pos);if(this.options.onComment)this.options.onComment(!1,this.input.slice(ee+Z,this.pos),ee,this.pos,Le,this.curPosition())};nn.skipSpace=function(){e:while(this.pos<this.input.length){var Z=this.input.charCodeAt(this.pos);switch(Z){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(Z>8&&Z<14||Z>=5760&&Mo.test(String.fromCharCode(Z)))++this.pos;else break e}}};nn.finishToken=function(Z,ee){if(this.end=this.pos,this.options.locations)this.endLoc=this.curPosition();var Le=this.type;this.type=Z,this.value=ee,this.updateContext(Le)};nn.readToken_dot=function(){var Z=this.input.charCodeAt(this.pos+1);if(Z>=48&&Z<=57)return this.readNumber(!0);var ee=this.input.charCodeAt(this.pos+2);if(this.options.ecmaVersion>=6&&Z===46&&ee===46)return this.pos+=3,this.finishToken(Ut.ellipsis);else return++this.pos,this.finishToken(Ut.dot)};nn.readToken_slash=function(){var Z=this.input.charCodeAt(this.pos+1);if(this.exprAllowed)return++this.pos,this.readRegexp();if(Z===61)return this.finishOp(Ut.assign,2);return this.finishOp(Ut.slash,1)};nn.readToken_mult_modulo_exp=function(Z){var ee=this.input.charCodeAt(this.pos+1),Le=1,Ot=Z===42?Ut.star:Ut.modulo;if(this.options.ecmaVersion>=7&&Z===42&&ee===42)++Le,Ot=Ut.starstar,ee=this.input.charCodeAt(this.pos+2);if(ee===61)return this.finishOp(Ut.assign,Le+1);return this.finishOp(Ot,Le)};nn.readToken_pipe_amp=function(Z){var ee=this.input.charCodeAt(this.pos+1);if(ee===Z){if(this.options.ecmaVersion>=12){var Le=this.input.charCodeAt(this.pos+2);if(Le===61)return this.finishOp(Ut.assign,3)}return this.finishOp(Z===124?Ut.logicalOR:Ut.logicalAND,2)}if(ee===61)return this.finishOp(Ut.assign,2);return this.finishOp(Z===124?Ut.bitwiseOR:Ut.bitwiseAND,1)};nn.readToken_caret=function(){var Z=this.input.charCodeAt(this.pos+1);if(Z===61)return this.finishOp(Ut.assign,2);return this.finishOp(Ut.bitwiseXOR,1)};nn.readToken_plus_min=function(Z){var ee=this.input.charCodeAt(this.pos+1);if(ee===Z){if(ee===45&&!this.inModule&&this.input.charCodeAt(this.pos+2)===62&&(this.lastTokEnd===0||vn.test(this.input.slice(this.lastTokEnd,this.pos))))return this.skipLineComment(3),this.skipSpace(),this.nextToken();return this.finishOp(Ut.incDec,2)}if(ee===61)return this.finishOp(Ut.assign,2);return this.finishOp(Ut.plusMin,1)};nn.readToken_lt_gt=function(Z){var ee=this.input.charCodeAt(this.pos+1),Le=1;if(ee===Z){if(Le=Z===62&&this.input.charCodeAt(this.pos+2)===62?3:2,this.input.charCodeAt(this.pos+Le)===61)return this.finishOp(Ut.assign,Le+1);return this.finishOp(Ut.bitShift,Le)}if(ee===33&&Z===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)Le=2;return this.finishOp(Ut.relational,Le)};nn.readToken_eq_excl=function(Z){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(Z===61&&ee===62&&this.options.ecmaVersion>=6)return this.pos+=2,this.finishToken(Ut.arrow);return this.finishOp(Z===61?Ut.eq:Ut.prefix,1)};nn.readToken_question=function(){var Z=this.options.ecmaVersion;if(Z>=11){var ee=this.input.charCodeAt(this.pos+1);if(ee===46){var Le=this.input.charCodeAt(this.pos+2);if(Le<48||Le>57)return this.finishOp(Ut.questionDot,2)}if(ee===63){if(Z>=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 Z=this.options.ecmaVersion,ee=35;if(Z>=13){if(++this.pos,ee=this.fullCharCodeAtPos(),m(ee,!0)||ee===92)return this.finishToken(Ut.privateId,this.readWord1())}this.raise(this.pos,"Unexpected character '"+Qi(ee)+"'")};nn.getTokenFromCode=function(Z){switch(Z){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(Z);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo_exp(Z);case 124:case 38:return this.readToken_pipe_amp(Z);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(Z);case 60:case 62:return this.readToken_lt_gt(Z);case 61:case 33:return this.readToken_eq_excl(Z);case 63:return this.readToken_question();case 126:return this.finishOp(Ut.prefix,1);case 35:return this.readToken_numberSign()}this.raise(this.pos,"Unexpected character '"+Qi(Z)+"'")};nn.finishOp=function(Z,ee){var Le=this.input.slice(this.pos,this.pos+ee);return this.pos+=ee,this.finishToken(Z,Le)};nn.readRegexp=function(){var Z,ee,Le=this.pos;for(;;){if(this.pos>=this.input.length)this.raise(Le,"Unterminated regular expression");var Ot=this.input.charAt(this.pos);if(vn.test(Ot))this.raise(Le,"Unterminated regular expression");if(!Z){if(Ot==="[")ee=!0;else if(Ot==="]"&&ee)ee=!1;else if(Ot==="/"&&!ee)break;Z=Ot==="\\"}else Z=!1;++this.pos}var Bt=this.input.slice(Le,this.pos);++this.pos;var jt=this.pos,Gt=this.readWord1();if(this.containsEsc)this.unexpected(jt);var Lt=this.regexpState||(this.regexpState=new Xo(this));Lt.reset(Le,Bt,Gt),this.validateRegExpFlags(Lt),this.validateRegExpPattern(Lt);var Vt=null;try{Vt=new RegExp(Bt,Gt)}catch(Wt){}return this.finishToken(Ut.regexp,{pattern:Bt,flags:Gt,value:Vt})};nn.readInt=function(Z,ee,Le){var Ot=this.options.ecmaVersion>=12&&ee===void 0,Bt=Le&&this.input.charCodeAt(this.pos)===48,jt=this.pos,Gt=0,Lt=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(Bt)this.raiseRecoverable(this.pos,"Numeric separator is not allowed in legacy octal numeric literals");if(Lt===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");Lt=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>=Z)break;Lt=Kt,Gt=Gt*Z+Ht}if(Ot&&Lt===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 ml(Z,ee){if(ee)return parseInt(Z,8);return parseFloat(Z.replace(/_/g,""))}function Jo(Z){if(typeof BigInt!=="function")return null;return BigInt(Z.replace(/_/g,""))}nn.readRadixNumber=function(Z){var ee=this.pos;this.pos+=2;var Le=this.readInt(Z);if(Le==null)this.raise(this.start+2,"Expected number in radix "+Z);if(this.options.ecmaVersion>=11&&this.input.charCodeAt(this.pos)===110)Le=Jo(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,Le)};nn.readNumber=function(Z){var ee=this.pos;if(!Z&&this.readInt(10,void 0,!0)===null)this.raise(ee,"Invalid number");var Le=this.pos-ee>=2&&this.input.charCodeAt(ee)===48;if(Le&&this.strict)this.raise(ee,"Invalid number");var Ot=this.input.charCodeAt(this.pos);if(!Le&&!Z&&this.options.ecmaVersion>=11&&Ot===110){var Bt=Jo(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,Bt)}if(Le&&/[89]/.test(this.input.slice(ee,this.pos)))Le=!1;if(Ot===46&&!Le)++this.pos,this.readInt(10),Ot=this.input.charCodeAt(this.pos);if((Ot===69||Ot===101)&&!Le){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=ml(this.input.slice(ee,this.pos),Le);return this.finishToken(Ut.num,jt)};nn.readCodePoint=function(){var Z=this.input.charCodeAt(this.pos),ee;if(Z===123){if(this.options.ecmaVersion<6)this.unexpected();var Le=++this.pos;if(ee=this.readHexChar(this.input.indexOf("}",this.pos)-this.pos),++this.pos,ee>1114111)this.invalidStringToken(Le,"Code point out of bounds")}else ee=this.readHexChar(4);return ee};nn.readString=function(Z){var ee="",Le=++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===Z)break;if(Ot===92)ee+=this.input.slice(Le,this.pos),ee+=this.readEscapedChar(!1),Le=this.pos;else if(Ot===8232||Ot===8233){if(this.options.ecmaVersion<10)this.raise(this.start,"Unterminated string constant");if(++this.pos,this.options.locations)this.curLine++,this.lineStart=this.pos}else{if(ci(Ot))this.raise(this.start,"Unterminated string constant");++this.pos}}return ee+=this.input.slice(Le,this.pos++),this.finishToken(Ut.string,ee)};var Yo={};nn.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(Z){if(Z===Yo)this.readInvalidTemplateToken();else throw Z}this.inTemplateElement=!1};nn.invalidStringToken=function(Z,ee){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw Yo;else this.raise(Z,ee)};nn.readTmplToken=function(){var Z="",ee=this.pos;for(;;){if(this.pos>=this.input.length)this.raise(this.start,"Unterminated template");var Le=this.input.charCodeAt(this.pos);if(Le===96||Le===36&&this.input.charCodeAt(this.pos+1)===123){if(this.pos===this.start&&(this.type===Ut.template||this.type===Ut.invalidTemplate))if(Le===36)return this.pos+=2,this.finishToken(Ut.dollarBraceL);else return++this.pos,this.finishToken(Ut.backQuote);return Z+=this.input.slice(ee,this.pos),this.finishToken(Ut.template,Z)}if(Le===92)Z+=this.input.slice(ee,this.pos),Z+=this.readEscapedChar(!0),ee=this.pos;else if(ci(Le)){switch(Z+=this.input.slice(ee,this.pos),++this.pos,Le){case 13:if(this.input.charCodeAt(this.pos)===10)++this.pos;case 10:Z+=`
|
|
13
|
+
`;break;default:Z+=String.fromCharCode(Le);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]===`
|
|
14
|
+
`)++this.pos;case`
|
|
15
|
+
`:case"\u2028":case"\u2029":++this.curLine,this.lineStart=this.pos+1;break}this.raise(this.start,"Unterminated template")};nn.readEscapedChar=function(Z){var ee=this.input.charCodeAt(++this.pos);switch(++this.pos,ee){case 110:return`
|
|
16
|
+
`;case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return Qi(this.readCodePoint());case 116:return"\t";case 98:return"\b";case 118:return"\v";case 102:return"\f";case 13:if(this.input.charCodeAt(this.pos)===10)++this.pos;case 10:if(this.options.locations)this.lineStart=this.pos,++this.curLine;return"";case 56:case 57:if(this.strict)this.invalidStringToken(this.pos-1,"Invalid escape sequence");if(Z){var Le=this.pos-1;this.invalidStringToken(Le,"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],Bt=parseInt(Ot,8);if(Bt>255)Ot=Ot.slice(0,-1),Bt=parseInt(Ot,8);if(this.pos+=Ot.length-1,ee=this.input.charCodeAt(this.pos),(Ot!=="0"||ee===56||ee===57)&&(this.strict||Z))this.invalidStringToken(this.pos-1-Ot.length,Z?"Octal literal in template string":"Octal literal in strict mode");return String.fromCharCode(Bt)}if(ci(ee)){if(this.options.locations)this.lineStart=this.pos,++this.curLine;return""}return String.fromCharCode(ee)}};nn.readHexChar=function(Z){var ee=this.pos,Le=this.readInt(16,Z);if(Le===null)this.invalidStringToken(ee,"Bad character escape sequence");return Le};nn.readWord1=function(){this.containsEsc=!1;var Z="",ee=!0,Le=this.pos,Ot=this.options.ecmaVersion>=6;while(this.pos<this.input.length){var Bt=this.fullCharCodeAtPos();if(v(Bt,Ot))this.pos+=Bt<=65535?1:2;else if(Bt===92){this.containsEsc=!0,Z+=this.input.slice(Le,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:v)(Gt,Ot))this.invalidStringToken(jt,"Invalid Unicode escape");Z+=Qi(Gt),Le=this.pos}else break;ee=!1}return Z+this.input.slice(Le,this.pos)};nn.readWord=function(){var Z=this.readWord1(),ee=Ut.name;if(this.keywords.test(Z))ee=zs[Z];return this.finishToken(ee,Z)};var gl="8.18.0";s.acorn={Parser:s,version:gl,defaultOptions:Ks,Position:vi,SourceLocation:Zi,getLineInfo:Fo,Node:is,TokenType:an,tokTypes:Ut,keywordTypes:zs,TokContext:An,tokContexts:pn,isIdentifierChar:v,isIdentifierStart:m,Token:er,isNewLine:ci,lineBreak:vn,lineBreakG:nl,nonASCIIwhitespace:Mo};function bi(Z){return(ee)=>Z(ee)}function ss(...Z){return s.extend(...Z)}function wi(Z,ee,Le){for(let Ot=ee;Ot<Le;Ot++){let Bt=Z.charCodeAt(Ot);if(Bt===10||Bt===13||Bt===8232||Bt===8233)return!0}return!1}var Io=new WeakMap;function En(Z,ee){if(Z===void 0)return!1;if(Z.length<16)return Z.includes(ee);let Le=Io.get(Z);if(Le===void 0||Le.length>Z.length)Le={names:new Set,length:0},Io.set(Z,Le);while(Le.length<Z.length)Le.names.add(Z[Le.length++]);return Le.names.has(ee)}var tr=/(?:\s|\/\/.*|\/\*[\s\S]*?\*\/)*/g,yl=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"]]),xl=new Set("public private protected readonly declare abstract override static accessor".split(" ")),vl=new Set("public private protected readonly override".split(" ")),El=new Set("var let const function class abstract enum interface type namespace module global".split(" ")),Sl=new Set("var let const function class interface enum".split(" ")),Qo=new Set(["TSAsExpression","TSSatisfiesExpression","TSNonNullExpression","TSTypeAssertion"]),Zo=1,Cl=32,bl=256,wl=0,Tl=1,Ti=2,kl=3,Al=4,nr=6,ea=7,oa=256,or=1024,Pl=8|or,_l=Ti|oa,ta=1,$l=2,na=40,Nl=41,Dl=44,ia=46,sa=58,rs=61,ra=60,os=123,Rl=91,ir=42,Il=35,sr=34,rr=39,Ol=SyntaxError("speculative parse failed"),pe=bi((Z)=>{let{tokTypes:ee,keywordTypes:Le,isIdentifierChar:Ot,isIdentifierStart:Bt}=Z.acorn,jt=new Z.acorn.TokenType("@");class Gt extends Z{inType=!1;$4=!1;$5=!1;$7=null;$k=null;$l=!1;$m=!1;$f=null;$9=[[]];$n=0;$t=0;$o=-1;constructor(Lt,Vt,Wt){super(Lt,Vt,Wt);let Kt=this.options.onComment;if(typeof Kt==="function")this.options.onComment=(Ht,qt,zt,Xt,Yt,Jt)=>{if(zt<this.$t)return;this.$t=Xt,Kt.call(this,Ht,qt,zt,Xt,Yt,Jt)}}reset(){this.inType=!1,this.$4=!1,this.$5=!1,this.$7=null,this.$k=null,this.$l=!1,this.$m=!1,this.$f=null,this.$9=[[]],this.$n=0,this.$t=0,this.$o=-1}getTokenFromCode(Lt){if(Lt===64)return++this.pos,this.finishToken(jt);return super.getTokenFromCode(Lt)}readToken_lt_gt(Lt){if(this.inType)return this.finishOp(ee.relational,1);return super.readToken_lt_gt(Lt)}$a(Lt){let Vt=this.inType;this.inType=!0;let Wt=Lt();if(this.inType=Vt,!Vt&&this.type===ee.relational)this.pos=this.start,this.nextToken();return Wt}$1(){return this.type===ee.relational&&this.value==="<"}$p(){if(this.type===ee.bitShift&&this.value==="<<")this.pos=this.start+1,this.finishToken(ee.relational,"<");return this.$1()}$c(){return this.type===ee.relational&&this.value===">"}$u(){return this.type===ee.prefix&&this.value==="!"}hasPrecedingLineBreak(){return wi(this.input,this.lastTokEnd,this.start)}$d(Lt=this.pos){return tr.lastIndex=Lt,tr.exec(this.input),tr.lastIndex}$2(){return this.input.charCodeAt(this.$d())}$3(){let Lt=this.$d(),Vt=Lt;while(Vt<this.input.length&&Ot(this.input.charCodeAt(Vt)))Vt++;return this.input.slice(Lt,Vt)}$b(){return!wi(this.input,this.pos,this.$d())}$14(){return this.$b()&&Bt(this.$2())&&!Object.hasOwn(Le,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(Lt){this.pos=Lt.pos,this.type=Lt.type,this.value=Lt.value,this.start=Lt.start,this.end=Lt.end,this.startLoc=Lt.startLoc,this.endLoc=Lt.endLoc,this.lastTokStart=Lt.lastTokStart,this.lastTokEnd=Lt.lastTokEnd,this.lastTokStartLoc=Lt.lastTokStartLoc,this.lastTokEndLoc=Lt.lastTokEndLoc,this.curLine=Lt.curLine,this.lineStart=Lt.lineStart,this.context=Lt.context,this.exprAllowed=Lt.exprAllowed,this.containsEsc=Lt.containsEsc,this.inType=Lt.inType,this.$4=Lt.$4,this.$5=Lt.$5,this.$7=Lt.$7,this.scopeStack.length=Lt.scopes,this.privateNameStack.length=Lt.privateNames,this.labels=Lt.labels,this.labels.length=Lt.labelCount,this.strict=Lt.strict,this.yieldPos=Lt.yieldPos,this.awaitPos=Lt.awaitPos,this.awaitIdentPos=Lt.awaitIdentPos,this.potentialArrowAt=Lt.potentialArrowAt,this.potentialArrowInForAwait=Lt.potentialArrowInForAwait}raise(Lt,Vt){if(this.$n>0)throw Ol;return super.raise(Lt,Vt)}$1y(Lt,Vt){try{super.raise(Lt,Vt)}catch(Wt){if(Wt instanceof SyntaxError)Wt.$1z=!0;throw Wt}throw Error("unreachable")}$g(Lt,Vt=!1){let Wt=this.$15();this.$n++;try{let Kt=Lt();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(Lt){return this.$g(Lt,!0)===!0}$17(Lt){if(Lt.end=this.lastTokEnd,this.options.locations)Lt.loc.end=this.lastTokEndLoc}$q(Lt,Vt){if(Lt.start=Vt.start,this.options.locations)Lt.loc.start=Vt.loc.start}$6(Lt=!1){let Vt=this.startNode();return Vt.typeAnnotation=this.$a(()=>(this.next(),Lt?this.$20():this.$0())),this.finishNode(Vt,"TSTypeAnnotation")}$h(Lt,Vt){if(Vt&&this.eat(ee.question))Lt.optional=!0,this.$17(Lt);if(this.type===ee.colon)Lt.typeAnnotation=this.$6(),this.$17(Lt);return Lt}$20(){if(this.type!==ee.name&&this.type!==ee._this)return this.$0();if(this.isContextual("asserts")&&this.$b()&&Bt(this.$2())){let Lt=this.startNode();if(this.next(),Lt.parameterName=this.type===ee._this?this.$w():this.parseIdent(),this.isContextual("is")&&!this.hasPrecedingLineBreak())return this.$x(Lt,!0);return Lt.asserts=!0,Lt.typeAnnotation=null,this.finishNode(Lt,"TSTypePredicate")}if(this.$3()==="is"&&this.$b()){let Lt=this.startNode();return Lt.parameterName=this.type===ee._this?this.$w():this.parseIdent(!0),this.$x(Lt,!1)}return this.$0()}$x(Lt,Vt){this.next();let Wt=this.startNode();return Wt.typeAnnotation=this.$0(),Lt.typeAnnotation=this.finishNode(Wt,"TSTypeAnnotation"),Lt.asserts=Vt,this.finishNode(Lt,"TSTypePredicate")}$w(){let Lt=this.startNode();return this.next(),this.finishNode(Lt,"TSThisType")}parseWholeType(){this.inType=!0,this.nextToken();let Lt=this.$0();if(this.type!==ee.eof)this.unexpected();return Lt}$0(){let Lt=this.$18();if(this.$4||this.type!==ee._extends||this.hasPrecedingLineBreak())return Lt;let Vt=this.startNodeAt(Lt.start,Lt.loc?.start);return this.next(),Vt.checkType=Lt,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(Lt,Vt){let Wt=this.$4;this.$4=Lt;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(Lt){let Vt=this.startNode();if(Lt==="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,Lt)}$r(Lt,Vt){if(this.$1())Lt.typeParameters=this.$8();if(this.expect(ee.parenL),Lt.parameters=this.parseBindingList(ee.parenR,!1,!0),this.type===Vt)Lt.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 Lt=this.type;if(Lt===ee.colon||Lt===ee.comma||Lt===ee.question||Lt===ee.eq)return!0;if(Lt!==ee.parenR)return!1;return this.next(),this.type===ee.arrow})}$1a(Lt,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,Lt)}$1b(){if(this.type===ee.name&&!this.containsEsc){let Lt=this.value;if(Lt==="keyof"||Lt==="unique"||Lt==="readonly"){let Vt=this.startNode();return this.next(),Vt.operator=Lt,Vt.typeAnnotation=this.$1b(),this.finishNode(Vt,"TSTypeOperator")}if(Lt==="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 Lt=this.$i(!0,()=>this.$0());return this.$4||this.type!==ee.question?Lt:void 0}$y(){if(this.type!==ee.name&&!this.type.keyword)this.unexpected();let Lt=this.type===ee.name?this.value:this.type.keyword;return this.next(),Lt}$23(){let Lt=this.$24();while(!this.hasPrecedingLineBreak()&&this.eat(ee.bracketL)){let Vt=this.startNodeAt(Lt.start,Lt.loc?.start);if(this.eat(ee.bracketR))Vt.elementType=Lt,Lt=this.finishNode(Vt,"TSArrayType");else Vt.objectType=Lt,Vt.indexType=this.$0(),this.expect(ee.bracketR),Lt=this.finishNode(Vt,"TSIndexedAccessType")}return Lt}$24(){switch(this.type){case ee.name:case ee._void:case ee._null:{let Lt=yl.get(this.value);if(Lt&&(this.type!==ee.name||!this.containsEsc&&this.$2()!==ia)){let Vt=this.startNode();return this.next(),this.finishNode(Vt,Lt)}return this.$1c()}case ee.string:case ee.num:case ee._true:case ee._false:{let Lt=this.startNode();return Lt.literal=this.parseExprAtom(),this.finishNode(Lt,"TSLiteralType")}case ee.plusMin:{if(this.value!=="-")break;let Lt=this.startNode(),Vt=this.startNode();if(this.next(),this.type!==ee.num)this.unexpected();return Vt.operator="-",Vt.prefix=!0,Vt.argument=this.parseExprAtom(),Lt.literal=this.finishNode(Vt,"UnaryExpression"),this.finishNode(Lt,"TSLiteralType")}case ee.backQuote:return this.$25();case ee._this:{let Lt=this.$w();if(this.isContextual("is")&&!this.hasPrecedingLineBreak()){let Vt=this.startNodeAt(Lt.start,Lt.loc?.start);return Vt.parameterName=Lt,this.$x(Vt,!1)}return Lt}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 Lt=this.startNode();return this.next(),Lt.typeAnnotation=this.$0(),this.expect(ee.parenR),this.finishNode(Lt,"TSParenthesizedType")}default:if(this.type.keyword)return this.$1c()}return this.unexpected()}$1c(){let Lt=this.startNode();if(Lt.typeName=this.$j(),!this.hasPrecedingLineBreak()&&this.$1())Lt.typeArguments=this.$e();return this.finishNode(Lt,"TSTypeReference")}$j(){let Lt=this.parseIdent(!0);while(this.eat(ee.dot)){let Vt=this.startNodeAt(Lt.start,Lt.loc?.start);Vt.left=Lt,Vt.right=this.parseIdent(!0),Lt=this.finishNode(Vt,"TSQualifiedName")}return Lt}$26(){let Lt=this.startNode();if(this.next(),Lt.exprName=this.type===ee._import?this.$1d():this.$j(),!this.hasPrecedingLineBreak()&&this.$1())Lt.typeArguments=this.$e();return this.finishNode(Lt,"TSTypeQuery")}$1d(){let Lt=this.startNode();if(this.next(),Lt.argument=this.$1e(),this.eat(ee.dot))Lt.qualifier=this.$j();if(this.$1())Lt.typeArguments=this.$e();return this.finishNode(Lt,"TSImportType")}$z(){if(this.type!==ee.string)this.unexpected();return this.parseExprAtom()}$1e(){this.expect(ee.parenL);let Lt=this.$z();return this.expect(ee.parenR),Lt}$25(){let Lt=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(),Lt.literal=this.finishNode(Vt,"TemplateLiteral"),this.finishNode(Lt,"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 Lt=this.startNode();if(this.expect(ee.braceL),this.type===ee.plusMin)Lt.readonly=this.value,this.next(),this.expectContextual("readonly");else if(this.eatContextual("readonly"))Lt.readonly=!0;this.expect(ee.bracketL);let Vt=this.startNode();if(Vt.name=this.$y(),this.expect(ee._in),Vt.constraint=this.$0(),Lt.typeParameter=this.finishNode(Vt,"TSTypeParameter"),Lt.nameType=this.eatContextual("as")?this.$0():null,this.expect(ee.bracketR),this.type===ee.plusMin)Lt.optional=this.value,this.next(),this.expect(ee.question);else if(this.eat(ee.question))Lt.optional=!0;if(this.eat(ee.colon))Lt.typeAnnotation=this.$0();return this.semicolon(),this.expect(ee.braceR),this.finishNode(Lt,"TSMappedType")}$29(){let Lt=this.startNode();return Lt.members=this.$1f(),this.finishNode(Lt,"TSTypeLiteral")}$1f(){this.expect(ee.braceL);let Lt=[];while(!this.eat(ee.braceR))Lt.push(this.$2b());return Lt}$2b(){let Lt=this.startNode(),Vt="TSPropertySignature",Wt=this.type===ee._new?this.$2():-1;if(this.type===ee.parenL||this.$1())Vt="TSCallSignatureDeclaration",this.$r(Lt,ee.colon);else if(Wt===na||Wt===ra)Vt="TSConstructSignatureDeclaration",this.next(),this.$r(Lt,ee.colon);else{let Kt=this.type===ee._new?this.parseIdent(!0):null;if(this.isContextual("readonly")&&this.$s(!0))this.next(),Lt.readonly=!0;if(this.type===ee.bracketL&&this.$1g())return this.$1h(Lt);let Ht="method";if(Kt)Lt.key=Kt;else{if((this.isContextual("get")||this.isContextual("set"))&&this.$s(!1))Ht=this.value,this.next();this.parsePropertyName(Lt)}if(this.eat(ee.question))Lt.optional=!0;if(this.type===ee.parenL||this.$1()){if(Vt="TSMethodSignature",Ht!=="method")Lt.kind=Ht;this.$r(Lt,ee.colon),Lt.kind=Ht}else if(this.type===ee.colon)Lt.typeAnnotation=this.$6()}return this.$1i(),this.finishNode(Lt,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(Lt){if(this.expect(ee.bracketL),Lt.parameters=[this.$h(this.parseIdent(),!1)],this.expect(ee.bracketR),this.type===ee.colon)Lt.typeAnnotation=this.$6();return this.$1i(),this.finishNode(Lt,"TSIndexSignature")}$2a(){let Lt=this.startNode();this.expect(ee.bracketL),Lt.elementTypes=[];while(!this.eat(ee.bracketR))if(Lt.elementTypes.push(this.$2c()),this.type!==ee.bracketR)this.expect(ee.comma);return this.finishNode(Lt,"TSTupleType")}$2c(){let Lt=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(Lt,Vt);Ht.typeAnnotation=Kt,Kt=this.finishNode(Ht,"TSRestType")}return Kt}$2d(){let Lt=this.$d();if(this.input.charCodeAt(Lt)===63)Lt=this.$d(Lt+1);return this.input.charCodeAt(Lt)===sa}$8(){return this.$a(()=>{let Lt=this.startNode();this.next(),Lt.params=[];while(!this.$c()){let Vt=this.startNode();while((this.type===ee._const||this.type===ee._in||this.isContextual("out"))&&Bt(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(Lt.params.push(this.finishNode(Vt,"TSTypeParameter")),!this.$c()){if(this.expect(ee.comma),this.$c())Lt.extra={trailingComma:this.lastTokStart}}}if(this.next(),Lt.params.length===0)this.$1y(this.start,"Type parameter list cannot be empty.");return this.finishNode(Lt,"TSTypeParameterDeclaration")})}$e(){return this.$a(()=>{let Lt=this.startNode();this.next(),Lt.params=[];while(!this.$c())if(Lt.params.push(this.$0()),!this.$c())this.expect(ee.comma);if(Lt.params.length===0)this.unexpected();return this.next(),this.finishNode(Lt,"TSTypeParameterInstantiation")})}$1j(){let Lt=[];do{let Vt=this.startNode();if(Vt.expression=this.$j(),this.$1())Vt.typeParameters=this.$e();Lt.push(this.finishNode(Vt,"TSExpressionWithTypeArguments"))}while(this.eat(ee.comma));return Lt}$1k(Lt=!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(Lt);return this.$1l(this.startNode(),this.value)}$2e(Lt){switch(Lt){case"interface":case"type":case"namespace":return this.$14();case"enum":return Bt(this.$2());case"abstract":return this.$b()&&this.$3()==="class";case"module":{let Vt=this.$2();return this.$b()&&(Vt===sr||Vt===rr||Bt(Vt))}case"declare":return this.$b()&&El.has(this.$3());case"global":return this.$b()&&this.$2()===os}return!1}$1l(Lt,Vt){switch(Vt){case"interface":return this.$1m(Lt);case"type":return this.$2g(Lt);case"enum":return this.$10(Lt);case"abstract":return this.$1n(Lt,!0);case"global":return Lt.global=!0,Lt.id=this.parseIdent(),Lt.body=this.$11(),this.finishNode(Lt,"TSModuleDeclaration")}return this.$2h(Lt)}$2f(Lt){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(!Lt&&Sl.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,ta,!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(Lt,Vt){return this.next(),Lt.abstract=!0,this.parseClass(Lt,Vt)}$1m(Lt){if(this.next(),Lt.id=this.parseIdent(),this.checkLValSimple(Lt.id,ea),this.$1())Lt.typeParameters=this.$8();return this.$a(()=>{if(this.eat(ee._extends))Lt.extends=this.$1j();let Vt=this.startNode();Vt.body=this.$1f(),Lt.body=this.finishNode(Vt,"TSInterfaceBody")}),this.finishNode(Lt,"TSInterfaceDeclaration")}$2g(Lt){if(this.next(),Lt.id=this.parseIdent(),this.checkLValSimple(Lt.id,nr),this.$1())Lt.typeParameters=this.$8();return Lt.typeAnnotation=this.$a(()=>(this.expect(ee.eq),this.$0())),this.semicolon(),this.finishNode(Lt,"TSTypeAliasDeclaration")}$10(Lt){if(this.type===ee._const)Lt.const=!0,this.next();this.next(),Lt.id=this.parseIdent(),this.checkLValSimple(Lt.id,_l),this.expect(ee.braceL),Lt.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(Lt.members.push(this.finishNode(Vt,"TSEnumMember")),this.type!==ee.braceR)this.expect(ee.comma)}return this.finishNode(Lt,"TSEnumDeclaration")}$2h(Lt){if(this.next(),this.type===ee.string){if(Lt.id=this.parseExprAtom(),this.type===ee.braceL)Lt.body=this.$11();else this.semicolon();return this.finishNode(Lt,"TSModuleDeclaration")}return Lt.id=this.parseIdent(),this.checkLValSimple(Lt.id,Pl),this.$1o(Lt)}$1o(Lt){if(this.eat(ee.dot)){let Vt=this.startNode();Vt.id=this.parseIdent(),Lt.body=this.$1o(Vt)}else Lt.body=this.$11();return this.finishNode(Lt,"TSModuleDeclaration")}$11(){this.enterScope(bl);let Lt=this.startNode();this.enterScope(0),this.expect(ee.braceL),Lt.body=[];while(!this.eat(ee.braceR))Lt.body.push(this.parseStatement(null,!0));return this.exitScope(),this.exitScope(),this.finishNode(Lt,"TSModuleBlock")}$1p(Lt,Vt){if(Lt.isExport=Vt,Lt.id=this.parseIdent(),this.checkLValSimple(Lt.id,Ti),this.expect(ee.eq),this.isContextual("require")&&this.$2()===na){let Wt=this.startNode();this.next(),Wt.expression=this.$1e(),Lt.moduleReference=this.finishNode(Wt,"TSExternalModuleReference")}else Lt.moduleReference=this.$j();return this.semicolon(),this.finishNode(Lt,"TSImportEqualsDeclaration")}$2i(){let Lt=this.$d();if(this.input.charCodeAt(Lt)!==rs)return!1;let Vt=this.input.charCodeAt(Lt+1);return Vt!==rs&&Vt!==62}parseStatement(Lt,Vt,Wt){if(this.type===jt)this.$1q(!0);let Kt=this.$1k();if(Kt)return Kt;return super.parseStatement(Lt,Vt,Wt)}parseVarStatement(Lt,Vt,Wt){return super.parseVarStatement(Lt,Vt,Wt||this.$5)}parseVarId(Lt,Vt){if(super.parseVarId(Lt,Vt),Lt.id.type==="Identifier"&&this.$u()&&!this.hasPrecedingLineBreak())this.next(),Lt.definite=!0;this.$h(Lt.id,!1)}parseCatchClauseParam(){let Lt=this.$h(this.parseBindingAtom(),!1),Vt=Lt.type==="Identifier";return this.enterScope(Vt?Cl:0),this.checkLValPattern(Lt,Vt?Al:Ti),this.expect(ee.parenR),Lt}parseImport(Lt){if(this.next(),Lt.importKind="value",this.type===ee.string)Lt.specifiers=[],Lt.source=this.parseExprAtom();else{if(this.isContextual("type")){let Vt=this.$2();if(Vt===os||Vt===ir||Bt(Vt)&&this.$3()!=="from")Lt.importKind="type",this.next()}if(this.type===ee.name&&this.$2i())return this.$1p(Lt,!1);Lt.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),Lt.source=this.$z()}return this.$1r(Lt),this.semicolon(),this.finishNode(Lt,"ImportDeclaration")}parseWithClause(){if(this.isContextual("assert")&&!this.hasPrecedingLineBreak())this.type=ee._with;return this.type===ee._with?super.parseWithClause():void 0}$1r(Lt){let Vt=this.parseWithClause();if(Vt)Lt.attributes=Vt}parseImportSpecifier(){return this.$1s("importKind",()=>super.parseImportSpecifier())}parseExportSpecifier(Lt){return this.$1s("exportKind",()=>super.parseExportSpecifier(Lt))}$1s(Lt,Vt){let Wt=this.isContextual("type")?this.$2():-1;if(Wt===sr||Wt===rr||Bt(Wt)&&this.$3()!=="as"){let Ht=this.startNode();this.next();let qt=Vt();return this.$q(qt,Ht),qt[Lt]="type",qt}let Kt=Vt();return Kt[Lt]="value",Kt}parseExport(Lt,Vt){if(this.next(),this.eat(ee._import)){if(Lt.importKind="value",this.isContextual("type")&&Bt(this.$2())&&this.$3()!=="from")Lt.importKind="type",this.next();return this.$1p(Lt,!0)}if(this.eat(ee.eq))return Lt.expression=this.parseExpression(),this.semicolon(),this.finishNode(Lt,"TSExportAssignment");if(this.eatContextual("as"))return this.expectContextual("namespace"),Lt.id=this.parseIdent(),this.semicolon(),this.finishNode(Lt,"TSNamespaceExportDeclaration");if(Lt.exportKind="value",this.isContextual("type")){let Ht=this.$2();if(Ht===os||Ht===ir)Lt.exportKind="type",this.next()}if(this.eat(ee.star))return this.parseExportAllDeclaration(Lt,Vt);if(this.eat(ee._default)){if(this.isContextual("interface")&&this.$14())Lt.declaration=this.$1m(this.startNode());else if(this.isContextual("abstract")&&this.$3()==="class")Lt.declaration=this.$1n(this.startNode(),"nullableID");else Lt.declaration=this.parseExportDefaultDeclaration();return this.finishNode(Lt,"ExportDefaultDeclaration")}let Wt=this.isContextual("declare"),Kt=this.$1k(!0);if(Kt||this.shouldParseExportStatement()){if(Lt.declaration=Kt??this.parseStatement(null),Wt||Lt.declaration.type==="TSInterfaceDeclaration"||Lt.declaration.type==="TSTypeAliasDeclaration")Lt.exportKind="type";return Lt.specifiers=[],Lt.source=null,this.finishNode(Lt,"ExportNamedDeclaration")}if(Lt.declaration=null,Lt.specifiers=this.parseExportSpecifiers(Vt),this.eatContextual("from"))Lt.source=this.$z(),this.$1r(Lt);else{for(let Ht of Lt.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`.");Lt.source=null}return this.semicolon(),this.finishNode(Lt,"ExportNamedDeclaration")}parseFunction(Lt,Vt,Wt,Kt,Ht){let qt=Vt&ta;if(qt)this.$f=Lt,this.$o=Lt.start;super.parseFunction(Lt,Vt,Wt,Kt,Ht),this.$f=null;let zt=!Lt.body;if(zt)Lt.type="TSDeclareFunction";if(qt&&Lt.id){if(zt){if(this.$5&&this.currentScope().flags&Zo)this.declareName(Lt.id.name,or,Lt.id.start);this.checkLValSimple(Lt.id,wl)}else if(!(Vt&$l)){let Xt=kl;if(this.strict||Lt.generator||Lt.async)Xt=this.treatFunctionsAsVar?Tl:Ti;this.checkLValSimple(Lt.id,Xt)}}return Lt}parseFunctionParams(Lt){if(this.$1())Lt.typeParameters=this.$8();if(super.parseFunctionParams(Lt),this.type===ee.colon)Lt.returnType=this.$6(!0)}parseFunctionBody(Lt,Vt,Wt,Kt){if(Wt&&this.type===ee.colon)Lt.returnType=this.$6(!0);if(Vt||this.type===ee.braceL||Lt.start!==this.$o){super.parseFunctionBody(Lt,Vt,Wt,Kt);return}this.semicolon(),this.exitScope()}parseMethod(Lt,Vt,Wt){let Kt=this.$k;this.$k=null;let Ht=super.parseMethod(Lt,Vt,Wt);if(!Ht.body)Ht.type="TSDeclareMethod";if(Kt)Ht.typeParameters=Kt;return Ht}parseBindingList(Lt,Vt,Wt,Kt){let Ht=Kt===!0||this.$l;return this.$l=!1,super.parseBindingList(Lt,Vt,Wt,Ht)}$s(Lt){if(!Lt&&!this.$b())return!1;let Vt=this.$2();return Vt===Rl||Vt===os||Vt===ir||Vt===ia||Vt===Il||Vt===sr||Vt===rr||Vt>=48&&Vt<=57||Bt(Vt)}parseAssignableListItem(Lt){let Vt=this.$12(),Wt=this.start,Kt=this.startLoc,Ht,qt=!1,zt=!1;if(Lt)while(this.type===ee.name&&vl.has(this.value)&&!this.containsEsc&&this.$s(!1)){if(this.value==="readonly")qt=!0;else if(this.value==="override")zt=!0;else Ht=this.value;this.next()}let Xt;if(this.type===ee._this)Xt=this.startNode(),Xt.name="this",this.next(),this.finishNode(Xt,"Identifier");else Xt=this.parseBindingAtom();let Yt=this.type===ee.eq?this.parseMaybeDefault(Wt,Kt,Xt):this.parseMaybeDefault(Xt.start,Xt.loc?.start,this.$h(Xt,!0));if(Vt.length>0)Yt.decorators=Vt;if(!Ht&&!qt&&!zt)return Yt;let Jt=this.startNodeAt(Wt,Kt);if(Ht)Jt.accessibility=Ht;if(qt)Jt.readonly=!0;if(zt)Jt.override=!0;return Jt.parameter=Yt,this.finishNode(Jt,"TSParameterProperty")}parseBindingListItem(Lt){if(Lt.type==="RestElement")this.$h(Lt,!0);return Lt}checkLValSimple(Lt,Vt,Wt){if(this.$f&&Lt===this.$f.id){this.$f=null;return}if(!Vt&&Qo.has(Lt.type)){this.checkLValSimple(Lt.expression,Vt,Wt);return}switch(Lt.type){case"TSParameterProperty":this.checkLValInnerPattern(Lt.parameter,Vt,Wt);return;case"Identifier":if(Lt.name==="this")return}super.checkLValSimple(Lt,Vt,Wt)}toAssignable(Lt,Vt,Wt){if(Lt&&!Vt&&Qo.has(Lt.type))return Lt;return super.toAssignable(Lt,Vt,Wt)}declareName(Lt,Vt,Wt){let Kt=this.currentScope();if(Vt&or){this.$1t(Kt,Lt),Kt.$1u??=[],Kt.$1u.push(Lt);return}if(Vt===nr||Vt===ea){if(Kt.$13??=[],Vt===nr&&En(Kt.$13,Lt))this.raise(Wt,`type '${Lt}' has already been declared.`);Kt.$13.push(Lt),this.$1t(Kt,Lt);return}if(Vt&oa){if(Kt.$1v??=[],En(Kt.$1v,Lt))return;super.declareName(Lt,Ti,Wt),Kt.$1v.push(Lt);return}super.declareName(Lt,Vt,Wt)}$1t(Lt,Vt){if(this.inModule&&Lt.flags&Zo)delete this.undefinedExports[Vt]}checkLocalExport(Lt){for(let Vt=this.scopeStack.length-1;Vt>=0;Vt--){let Wt=this.scopeStack[Vt];if(En(Wt.$13,Lt.name)||En(Wt.$1u,Lt.name))return}super.checkLocalExport(Lt)}checkExport(){}raiseRecoverable(Lt,Vt){if(Vt==="Duplicate constructor in the same class")return;super.raiseRecoverable(Lt,Vt)}$12(){let Lt=[];while(this.type===jt)Lt.push(this.$1w());return Lt}$1q(Lt){let Vt=this.$9[this.$9.length-1];while(this.type===jt)Vt.push(this.$1w());if(this.type===ee._export){if(!Lt)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 Lt=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 Lt.expression=Kt,this.$9.pop(),this.finishNode(Lt,"Decorator")}shouldParseExportStatement(){return this.type===jt||super.shouldParseExportStatement()}parseExprAtom(Lt,Vt,Wt){if(this.type===jt)this.$1q(!1);return super.parseExprAtom(Lt,Vt,Wt)}parseProperty(Lt,Vt){if(Lt||this.type!==jt)return super.parseProperty(Lt,Vt);let Wt=this.$12(),Kt=super.parseProperty(Lt,Vt);if(Kt.type==="SpreadElement")this.raise(Kt.start,"Decorators can't be used with SpreadElement");return Kt.decorators=Wt,Kt}parseClassId(Lt,Vt){let Wt=this.$9.length-1,Kt=this.$9[Wt];if(Kt.length>0)Lt.decorators=Kt,this.$q(Lt,Kt[0]),this.$9[Wt]=[];if(!this.isContextual("implements")||Vt===!0)super.parseClassId(Lt,Vt);if(this.$1())Lt.typeParameters=this.$8()}parseClassSuper(Lt){if(super.parseClassSuper(Lt),Lt.superClass&&this.$1())Lt.superTypeParameters=this.$e();if(this.eatContextual("implements"))Lt.implements=this.$a(()=>this.$1j())}parseClassElement(Lt){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(Lt);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&&xl.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&&Lt)}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(Lt,Vt,Wt){if(this.$p()){let Kt=this.$g(()=>{let Ht=this.$8(),qt=super.parseMaybeAssign(Lt,Vt,Wt);if(qt.type!=="ArrowFunctionExpression")return;return qt.typeParameters=Ht,this.$q(qt,Ht),qt});if(Kt)return Kt}return super.parseMaybeAssign(Lt,Vt,Wt)}parseMaybeUnary(Lt,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(Lt,Vt,Wt,Kt)}parseMaybeConditional(Lt,Vt){let Wt=this.start,Kt=this.startLoc,Ht=this.parseExprOps(Lt,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(Lt),this.finishNode(qt,"ConditionalExpression")}return Ht}$2j(){let Lt=this.$d(),Vt=this.input.charCodeAt(Lt);if(Vt===sa||Vt===Dl||Vt===Nl)return!0;return Vt===rs&&this.input.charCodeAt(Lt+1)!==rs}parseParenItem(Lt){return this.$h(Lt,!0)}$1x(){if(this.type!==ee.colon)return!0;let Lt=this.$g(()=>{let Vt=this.$6(!0);return this.type===ee.arrow&&!this.canInsertSemicolon()?Vt:void 0});if(!Lt)return!1;return this.$7=Lt,!0}shouldParseArrow(Lt){return this.$1x()&&super.shouldParseArrow(Lt)}shouldParseAsyncArrow(){return this.$1x()&&super.shouldParseAsyncArrow()}parseArrowExpression(Lt,Vt,Wt,Kt){if(this.$7)Lt.returnType=this.$7,this.$7=null;return super.parseArrowExpression(Lt,Vt,Wt,Kt)}parseExprList(Lt,Vt,Wt,Kt){if(!this.$m)return super.parseExprList(Lt,Vt,Wt,Kt);this.$m=!1;let Ht=[],qt=!0;while(!this.eat(Lt)){if(qt)qt=!1;else if(this.expect(ee.comma),Vt&&this.afterTrailingComma(Lt))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(Lt,Vt,Wt,Kt,Ht,qt,zt){if(this.$u()&&!this.hasPrecedingLineBreak()){let Yt=this.startNodeAt(Vt,Wt);return this.exprAllowed=!1,this.next(),Yt.expression=Lt,this.finishNode(Yt,"TSNonNullExpression")}if(Ht&&this.$1()){let Yt=this.$g(()=>this.$2k(Vt,Wt,zt));if(Yt)return Yt}let Xt=this.type===ee.questionDot&&this.$2()===ra;if(this.$1()||Xt||this.type===ee.bitShift&&this.value==="<<"){let Yt=this.$g(()=>{if(Xt)this.next();this.$p();let Jt=this.$e();if(this.type===ee.parenL&&!Kt)return Jt;if(this.type===ee.backQuote)return Xt?void 0:Jt;if(Xt)return;if(this.$c()||this.type===ee.bitShift||this.type.startsExpr&&this.type!==ee.parenL&&!this.hasPrecedingLineBreak())return;return Jt});if(Yt){let Jt=this.startNodeAt(Vt,Wt);if(this.type===ee.parenL&&!Kt){if(this.next(),Jt.callee=Lt,Jt.arguments=this.parseExprList(ee.parenR,!0,!1),Jt.typeArguments=Yt,Xt)Lt.optional=!0;if(Xt||qt)Jt.optional=Xt;return this.finishNode(Jt,"CallExpression")}if(this.type===ee.backQuote)return Jt.tag=Lt,Jt.quasi=this.parseTemplate({isTagged:!0}),Jt.typeArguments=Yt,this.finishNode(Jt,"TaggedTemplateExpression");return Jt.expression=Lt,Jt.typeArguments=Yt,this.finishNode(Jt,"TSInstantiationExpression")}}if(Ht&&this.type===ee.parenL)this.$m=!0;return super.parseSubscript(Lt,Vt,Wt,Kt,Ht,qt,zt)}$2k(Lt,Vt,Wt){let Kt=this.startNodeAt(Lt,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(Lt){if(this.next(),Lt.source=this.parseMaybeAssign(),this.eat(ee.comma)&&this.type!==ee.parenR)Lt.arguments=[this.parseExpression()];return this.expect(ee.parenR),this.finishNode(Lt,"ImportExpression")}parseNew(){let Lt=super.parseNew();if(Lt.callee?.type!=="TSInstantiationExpression")return Lt;let Vt=this.startNodeAt(Lt.start,Lt.loc?.start);return Vt.callee=Lt.callee.expression,Vt.typeArguments=Lt.callee.typeArguments,Vt.arguments=Lt.arguments,this.finishNodeAt(Vt,"NewExpression",Lt.end,Lt.loc?.end)}parseExprOp(Lt,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=Lt,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(Lt,Vt,Wt,Kt,Ht)}parseGetterSetter(Lt){Lt.kind=Lt.key.name,super.parseGetterSetter(Lt)}parsePropertyValue(Lt,Vt,Wt,Kt,Ht,qt,zt,Xt){if(!Vt&&this.$1()){if(this.$k=this.$8(),this.type!==ee.parenL)this.unexpected();Lt.kind="init"}return super.parsePropertyValue(Lt,Vt,Wt,Kt,Ht,qt,zt,Xt)}}return Gt});function ce(){throw Error('sveast: parsing TypeScript needs `typescript` from "sveast/typescript": createParser({ typescript }) or createModuleParser({ typescript })')}var Ll=/^\t+/;class e extends Error{name="ParseError";code;reason;position;start;end;frame;constructor(Z,ee,Le){super(`${Le}
|
|
17
|
+
https://svelte.dev/e/${ee}`);this.code=ee,this.reason=Le;let Ot=typeof Z==="number"?Z:Z?.start,Bt=typeof Z==="number"?Z:Z?.end;if(Ot!==void 0)this.position=[Ot,Bt??Ot],this.start=g(this.position[0]),this.end=g(this.position[1]),this.frame=Ml(this.start.line-1,this.end.column)}}var aa=(Z)=>Z.replace(Ll,(ee)=>" ".repeat(ee.length));function Ml(Z,ee){let Le=Math.max(0,Z-2),Ot=[];for(let jt=Le;jt<Z+3;jt++){let Gt=vo(jt);if(Gt===void 0)break;Ot.push(Gt)}let Bt=String(Le+Ot.length+1).length;return Ot.map((jt,Gt)=>{let Lt=`${String(Le+Gt+1).padStart(Bt," ")}: ${aa(jt)}`;if(Le+Gt!==Z)return Lt;return`${Lt}
|
|
18
|
+
${" ".repeat(Bt+2+aa(jt.slice(0,ee)).length)}^`}).join(`
|
|
19
|
+
`)}function Be(Z){throw new e(Z,"attribute_duplicate","Attributes need to be unique")}function je(Z){throw new e(Z,"attribute_empty_shorthand","Attribute shorthand cannot be empty")}function Ve(Z,ee){throw new e(Z,"block_duplicate_clause",`${ee} cannot appear more than once within a block`)}function qe(Z){throw new e(Z,"block_invalid_continuation_placement","{:...} block is invalid at this position (did you forget to close the preceding element or block?)")}function Ge(Z){throw new e(Z,"block_invalid_elseif","'elseif' should be 'else if'")}function We(Z,ee,Le){throw new e(Z,"block_invalid_placement",`{#${ee} ...} block cannot be ${Le}`)}function He(Z){throw new e(Z,"block_unclosed","Block was left open")}function Ue(Z){throw new e(Z,"block_unexpected_close","Unexpected block closing tag")}function ze(Z){throw new e(Z,"const_tag_invalid_expression","{@const ...} must consist of a single variable declaration")}function Je(Z){throw new e(Z,"css_empty_declaration","Declaration cannot be empty")}function Ce(Z){throw new e(Z,"css_expected_identifier","Expected a valid CSS identifier")}function Ke(Z){throw new e(Z,"css_selector_invalid","Invalid selector")}function Xe(Z){throw new e(Z,"debug_tag_invalid_arguments","{@debug ...} arguments must be identifiers, not arbitrary expressions")}function ke(Z){throw new e(Z,"declaration_tag_invalid_type","Declaration tags must be `let` or `const` declarations")}function Ye(Z){throw new e(Z,"directive_invalid_value","Directive value must be a JavaScript expression enclosed in curly braces")}function Qe(Z,ee){throw new e(Z,"directive_missing_name",`\`${ee}\` name cannot be empty`)}function Ze(Z,ee){throw new e(Z,"element_invalid_closing_tag",`\`</${ee}>\` attempted to close an element that was not open`)}function et(Z,ee,Le){throw new e(Z,"element_invalid_closing_tag_autoclosed",`\`</${ee}>\` attempted to close element that was already automatically closed by \`<${Le}>\` (cannot nest \`<${Le}>\` inside \`<${ee}>\`)`)}function we(Z,ee){throw new e(Z,"element_unclosed",`\`<${ee}>\` was left open`)}function Pe(Z){throw new e(Z,"expected_attribute_value","Expected attribute value")}function tt(Z){throw new e(Z,"expected_block_type","Expected 'if', 'each', 'await', 'key' or 'snippet'")}function Ae(Z){throw new e(Z,"expected_identifier","Expected an identifier")}function nt(Z){throw new e(Z,"expected_pattern","Expected identifier or destructure pattern")}function rt(Z){throw new e(Z,"expected_tag","Expected 'html', 'render', 'attach', 'const', or 'debug'")}function P(Z,ee){throw new e(Z,"expected_token",`Expected token ${ee}`)}function it(Z){throw new e(Z,"expected_whitespace","Expected whitespace")}function Fl(Z,ee){throw new e(Z,"js_parse_error",`${ee}`)}function st(Z){throw new e(Z,"render_tag_invalid_expression","`{@render ...}` tags can only contain call expressions")}function ot(Z){throw new e(Z,"script_duplicate","A component can have a single top-level `<script>` element and/or a single top-level `<script module>` element")}function at(Z,ee){throw new e(Z,"script_invalid_attribute_value",`If the \`${ee}\` attribute is supplied, it must be a boolean attribute`)}function lt(Z){throw new e(Z,"script_invalid_context",'If the context attribute is supplied, its value must be "module"')}function pt(Z,ee){throw new e(Z,"script_reserved_attribute",`The \`${ee}\` attribute is reserved and cannot be used`)}function ct(Z){throw new e(Z,"style_duplicate","A component can have a single top-level `<style>` element")}function ut(Z){throw new e(Z,"svelte_component_invalid_this","Invalid component definition — must be an `{expression}`")}function dt(Z){throw new e(Z,"svelte_component_missing_this","`<svelte:component>` must have a 'this' attribute")}function De(Z){throw new e(Z,"svelte_element_missing_this","`<svelte:element>` must have a 'this' attribute with a value")}function ft(Z,ee){throw new e(Z,"svelte_meta_duplicate",`A component can only have one \`<${ee}>\` element`)}function mt(Z,ee){throw new e(Z,"svelte_meta_invalid_content",`<${ee}> cannot have children`)}function ht(Z,ee){throw new e(Z,"svelte_meta_invalid_placement",`\`<${ee}>\` tags cannot be inside elements or blocks`)}function gt(Z,ee){throw new e(Z,"svelte_meta_invalid_tag",`Valid \`<svelte:...>\` tag names are ${ee}`)}function yt(Z){throw new e(Z,"svelte_options_deprecated_tag",'"tag" option is deprecated — use "customElement" instead')}function xt(Z){throw new e(Z,"svelte_options_invalid_attribute","`<svelte:options>` can only receive static attributes")}function ue(Z,ee){throw new e(Z,"svelte_options_invalid_attribute_value",`Value must be ${ee}, if specified`)}function Et(Z){throw new e(Z,"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 vt(Z){throw new e(Z,"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(Z){throw new e(Z,"svelte_options_invalid_customelement_shadow",'"shadow" must be either "open", "none" or `ShadowRootInit` object.')}function Ne(Z){throw new e(Z,"svelte_options_invalid_tagname","Tag name must be lowercase and hyphenated")}function bt(Z){throw new e(Z,"svelte_options_reserved_tagname","Tag name is reserved")}function Tt(Z,ee){throw new e(Z,"svelte_options_unknown_attribute",`\`<svelte:options>\` unknown attribute '${ee}'`)}function Ct(Z){throw new e(Z,"tag_invalid_name","Expected a valid element or component name. Components must have a valid variable name or dot notation expression")}function kt(Z,ee,Le){throw new e(Z,"tag_invalid_placement",`{@${ee} ...} tag cannot be ${Le}`)}function d(Z){throw new e(Z,"unexpected_eof","Unexpected end of input")}function wt(Z,ee){throw new e(Z,"unexpected_reserved_word",`'${ee}' is a reserved word in JavaScript and cannot be used here`)}function Pt(Z){throw new e(Z,"unterminated_string_constant","Unterminated string constant")}function At(Z){throw new e(Z,"void_element_invalid_content","Void elements cannot have children or closing tags")}var ui="",la=[],ps=0,dn=[],fn=0;function Bl(Z,ee){ui=Z,la=ee,ps=0}function jl(){return ps}function Vl(Z,ee,Le,Ot){ps=Ot}function Gl(Z,ee,Le,Ot,Bt,jt){ps=Ot;let Gt=ee;if(Z&&Gt.includes(`
|
|
20
|
+
`)){let Vt=ui.lastIndexOf(`
|
|
21
|
+
`,Le-1)+1,Wt=Vt,Kt=ui.charCodeAt(Wt);while(Kt===32||Kt===9)Kt=ui.charCodeAt(++Wt);if(Wt>Vt)Gt=Wl(Gt,ui.slice(Vt,Wt))}let Lt={type:Z?"Block":"Line",value:Gt,start:Le,end:Ot};if(Bt&&jt)Lt.loc={start:Bt,end:jt};la.push(Lt)}function Wl(Z,ee){let Le=Z.startsWith(ee)?ee.length:0,Ot="",Bt=Z.indexOf(`
|
|
22
|
+
`,Le);while(Bt!==-1){if(Ot+=Z.slice(Le,Bt+1),Le=Bt+1,Z.startsWith(ee,Le))Le+=ee.length;Bt=Z.indexOf(`
|
|
23
|
+
`,Le)}return Ot+Z.slice(Le)}function Ul(Z,ee,Le){let Ot=0,Bt=ee.length;while(Ot<Bt){let jt=Ot+Bt>>>1;if(ee[jt].start<Le)Ot=jt+1;else Bt=jt}if(Ot>=ee.length)return;if(dn=ee.slice(Ot).map(({type:jt,value:Gt,start:Lt,end:Vt})=>({type:jt,value:Gt,start:Lt,end:Vt})),fn=0,pr(Z,void 0,!1),fn<dn.length&&(dn[fn].start>=Z.end||Z.type==="Program")){Z.trailingComments??=[];while(fn<dn.length)Z.trailingComments.push(dn[fn++])}}var Kl=new Map([["BlockStatement","body"],["Program","body"],["ArrayExpression","elements"],["ObjectExpression","properties"]]);function pa(Z,ee){for(let Le=Z;Le<ee;Le++){let Ot=ui.charCodeAt(Le);if(Ot!==44&&Ot!==41&&Ot!==32&&Ot!==9)return!0}return!1}function pr(Z,ee,Le){while(fn<dn.length&&dn[fn].start<Z.start)Z.leadingComments??=[],Z.leadingComments.push(dn[fn++]);if(fn>=dn.length)return;let Ot=dn[fn].start;if(Ot<Z.end||!pa(Z.end,Ot)){let Bt=Xn(Z),jt=Kl.get(Z.type),Gt=jt===void 0?void 0:Bt[jt],Lt=Array.isArray(Gt)&&Gt.length===0;for(let Vt in Bt){if(fn>=dn.length)return;if(Vt==="type")continue;let Wt=Bt[Vt];if(Array.isArray(Wt)){let Kt=Vt===jt;for(let Ht=0;Ht<Wt.length;Ht++){let qt=Wt[Ht];if(Ln(qt))pr(qt,Z,Kt?Ht===Wt.length-1:Lt)}}else if(Ln(Wt))pr(Wt,Z,Lt)}if(fn>=dn.length)return}if(ee!==void 0&&Z.end===ee.end)return;if(Le)while(fn<dn.length){if(ee&&dn[fn].start>=ee.end)break;Z.trailingComments??=[],Z.trailingComments.push(dn[fn++])}else if(Z.end<=dn[fn].start&&!pa(Z.end,dn[fn].start))Z.trailingComments=[dn[fn++]]}var de=new Set("arguments await break case catch class const continue debugger default delete do else enum eval export extends false finally for function if implements import in instanceof interface let new null package private protected public return static super switch this throw true try typeof var void while with yield".split(" ")),cs=!1,ki=1,Hl=2,ql=32,zl=256,Xl=ki|Hl|zl,Jl=2,Yl=3,Ql=4,Zl=/\r\n?|\n|\u2028|\u2029/,ca=new Map;function as(Z){if(!(Z instanceof RegExp))return Z;let ee=ca.get(Z);if(!ee){let Le=new Set(Z.source.slice(4,-2).split("|"));ee={test:(Ot)=>Le.has(Ot)},ca.set(Z,ee)}return ee}var cr=bi((Z)=>class extends Z{declareName(ee,Le,Ot){let Bt=!1;if(Le===Jl){let jt=this.currentScope();if(Bt=En(jt.lexical,ee)||En(jt.functions,ee)||En(jt.var,ee),jt.lexical.push(ee),this.inModule&&jt.flags&ki)delete this.undefinedExports[ee]}else if(Le===Ql)this.currentScope().lexical.push(ee);else if(Le===Yl){let jt=this.currentScope();Bt=this.treatFunctionsAsVar?En(jt.lexical,ee):En(jt.lexical,ee)||En(jt.var,ee),jt.functions.push(ee)}else for(let jt=this.scopeStack.length-1;jt>=0;--jt){let Gt=this.scopeStack[jt];if(En(Gt.lexical,ee)&&!(Gt.flags&ql&&Gt.lexical[0]===ee)||!this.treatFunctionsAsVarInScope(Gt)&&En(Gt.functions,ee)){Bt=!0;break}if(Gt.var.push(ee),this.inModule&&Gt.flags&ki)delete this.undefinedExports[ee];if(Gt.flags&Xl)break}if(Bt)this.raiseRecoverable(Ot,`Identifier '${ee}' has already been declared`)}}),lr=bi((Z)=>{let{keywordTypes:ee,tokTypes:Le}=Z.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]])),Bt;return class extends Z{constructor(jt,Gt,Lt){super(jt,Gt,Lt);this.keywords=as(this.keywords),this.reservedWords=as(this.reservedWords),this.reservedWordsStrict=as(this.reservedWordsStrict),this.reservedWordsStrictBind=as(this.reservedWordsStrictBind),Bt??=this.context[0]}reset(jt,Gt,Lt){if(super.reset?.(jt,Gt,Lt),this.input=jt,this.containsEsc=!1,this.pos=Gt,Lt)this.lineStart=Gt-Lt.column,this.curLine=Lt.line;else this.lineStart=jt.lastIndexOf(`
|
|
24
|
+
`,Gt-1)+1,this.curLine=this.options.locations?jt.slice(0,this.lineStart).split(Zl).length:1;this.type=Le.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]!==Bt)this.context=this.initialContext();if(this.exprAllowed=!0,this.strict=!0,this.potentialArrowAt=-1,this.potentialArrowInForAwait=!1,this.yieldPos=this.awaitPos=this.awaitIdentPos=0,this.labels.length>0)this.labels=[];for(let Ht in this.undefinedExports){this.undefinedExports=Object.create(null);break}let Wt=this.scopeStack,Kt=Wt[0];if(Wt.length!==1||Kt.flags!==ki||Kt.var.length>0||Kt.lexical.length>0||Kt.functions.length>0||Kt.tsTypes!==void 0||Kt.tsExportOnly!==void 0||Kt.tsEnums!==void 0)this.scopeStack=[],this.enterScope(ki);if(this.regexpState=null,this.privateNameStack.length>0)this.privateNameStack=[];this.inTemplateElement=!1}parseParenAndDistinguishExpression(jt,Gt){let Lt=super.parseParenAndDistinguishExpression(jt,Gt);if(Lt.type==="ParenthesizedExpression")cs=!0;return Lt}checkUnreserved(jt){if(de.has(jt.name))super.checkUnreserved(jt)}canInsertSemicolon(){let jt=this.type;return jt===Le.eof||jt===Le.braceR||wi(this.input,this.lastTokEnd,this.start)}checkLocalExport(){}skipSpace(){let jt=this.input,Gt=this.options.locations,Lt=this.pos,Vt=jt.charCodeAt(Lt);for(;;)if(Vt===32||Vt===9)Vt=jt.charCodeAt(++Lt);else if(Vt===10){if(Vt=jt.charCodeAt(++Lt),Gt)this.curLine++,this.lineStart=Lt}else break;if(this.pos=Lt,Vt===47||Vt<33||Vt>=128)super.skipSpace()}readWord1(){let jt=this.input,Gt=this.pos,Lt=Gt,Vt=jt.charCodeAt(Lt),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(++Lt);if(Vt>=128||Vt===92)return super.readWord1();return this.containsEsc=!1,this.pos=Lt,go(jt,Gt,Lt,Wt)}readWord(){let jt=this.readWord1();return this.finishToken(Ot.get(jt)??Le.name,jt)}}}),ua=ss(cr,lr),eu=/ \(\d+:\d+\)$/;function Ai(Z){return Z}function ha(Z){return Z instanceof SyntaxError&&"pos"in Z&&typeof Z.pos==="number"}function ur(Z,ee,Le,Ot,Bt,jt=Z.root.comments.length){let Gt=Z.root.comments;Bl(ee,Gt);let Lt={onComment:Z.comments?Gl:Vl,sourceType:"module",ecmaVersion:16,locations:Z.loc,preserveParens:Ot};if(Z.lfOnly)Lt.startLocation=g(Le);let Vt=Z.isTypeScript?Z.typescript:ua;if(!Vt)ce();let Wt;try{Wt=Bt(Vt,Lt)}catch(Kt){if(!ha(Kt))throw Kt;Fl(Kt.pos,Kt.message.replace(eu,""))}if(Gt.length>jt)Ul(Ai(Wt),Gt,Le);return Wt}function fe(Z,ee,Le=0){return Ai(ur(Z,ee,0,!1,(Ot,Bt)=>{if(Le>0&&Bt.locations)Bt.startLocation=g(Le);let jt=new Ot(Bt,ee,Le).parse();return jt.start=0,jt},0))}function tu(Z,ee){if(!ee)return{line:1,column:0};let{column:Le}=g(Z);return{line:xo(Z-Le)+1,column:Le}}var nu={count:0},ar,iu=(Z)=>Z.parseExpression();function su(Z,ee,Le,Ot,Bt){let jt=ar;if(ar=void 0,jt?.ParserClass===Z&&jt.onComment===ee.onComment&&jt.locations===ee.locations&&jt.parser.reset)jt.parser.reset(Le,Ot,ee.startLocation);else jt={ParserClass:Z,onComment:ee.onComment,locations:ee.locations,parser:new Z(ee,Le,Ot)};let Gt=jt.parser;Gt.nextToken();let Lt=Bt(Gt);return Gt.input="",ar=jt,Lt}function da(Z,ee,Le,Ot){return nu.count+=1,cs=!1,ur(Z,ee,Le,!0,(Bt,jt)=>(jt.startLocation??=tu(Le,jt.locations),su(Bt,jt,ee,Le,Ot)))}function M(Z,ee,Le,Ot=!1){let Bt=Ai(da(Z,ee,Le,iu)),jt=Math.max(Bt.end,jl());return{node:cs&&!Ot?hr(Bt):Bt,end:jt}}function Dt(Z,ee,Le){let Ot=Z.root.comments.length,Bt=!0,jt=da(Z,ee,Le,(Lt)=>{let Vt={shorthandAssign:-1,trailingComma:-1,parenthesizedAssign:-1,parenthesizedBind:-1,doubleProto:-1},Wt=Lt.parseMaybeConditional(void 0,Vt);if(Lt.type!==ua.acorn.tokTypes.eof)return Bt=!1,Wt;let Kt=Lt.toAssignable(Wt,!1,Vt);return Lt.checkLValPattern(Kt),Kt});if(!Bt){Z.root.comments.length=Ot;return}let Gt=Ai(jt);return cs?hr(Gt):Gt}function Nt(Z,ee,Le){return Ai(ur(Z,ee,Le,!1,(Ot,Bt)=>{let jt=new Ot(Bt,ee,Le);try{return jt.nextToken(),jt.parseStatement(null,!0,Object.create(null))}catch(Gt){if(ha(Gt)&&Gt.pos===ee.length)d(ee.length);throw Gt}}))}function hr(Z){let ee=Z;while(ee.type==="ParenthesizedExpression")ee=ee.expression;return W(ee,hr),ee}var F=ss(cr,pe,lr);function fa(Z,ee,Le){return te(Z),fe({isTypeScript:ee.typescript??!1,typescript:Le,loc:ee.loc??!1,comments:ee.comments??!0,root:{comments:[]}},Z)}function me(Z,ee={}){return fa(Z,ee,F)}function he(Z,ee){let Le=u(Z.name,ee.name);if(Le!==0)return Le;let Ot=u(Z.type,ee.type);if(Ot!==0)return Ot;if(Z.type==="forwarded"&&ee.type==="forwarded"){let Bt=u(Z.element,ee.element);if(Bt!==0)return Bt}return u(Z.detail??"",ee.detail??"")}function ru(Z,ee){let Le=Z.length+1,Ot=ee.length+1,Bt=Array.from({length:Le},()=>Array(Ot).fill(0));for(let jt=0;jt<Le;jt++)Bt[jt][0]=jt;for(let jt=0;jt<Ot;jt++)Bt[0][jt]=jt;for(let jt=1;jt<Le;jt++)for(let Gt=1;Gt<Ot;Gt++){let Lt=Z[jt-1]===ee[Gt-1]?0:1;if(Bt[jt][Gt]=Math.min(Bt[jt-1][Gt]+1,Bt[jt][Gt-1]+1,Bt[jt-1][Gt-1]+Lt),jt>1&&Gt>1&&Z[jt-1]===ee[Gt-2]&&Z[jt-2]===ee[Gt-1])Bt[jt][Gt]=Math.min(Bt[jt][Gt],Bt[jt-2][Gt-2]+1)}return Bt[Le-1][Ot-1]}function _(Z,ee,Le=3){let Ot,Bt=Number.POSITIVE_INFINITY;for(let jt of ee){let Gt=ru(Z,jt);if(Gt<Bt)Ot=jt,Bt=Gt}return Bt<=Le?Ot:void 0}import{readFile as pu}from"node:fs/promises";import mr from"node:path";import ma,{sep as dr}from"node:path";var Pn=/\.svelte$/,hi=[".ts",".mts",".cts",".tsx",".js",".mjs",".cjs",".jsx",".d.ts"],ga=/\.(?:svelte|[mc]?ts|[mc]?js|tsx|jsx)$/;function di(Z){if(!Z.endsWith(".svelte"))return!1;let ee=Z.length-7;if(ee===0)return!1;let Le=Z.charCodeAt(ee-1);return Le!==47&&(dr==="/"||Le!==92)}function n(Z){return dr==="/"?Z:Z.split(dr).join("/")}function ya(Z,ee){return n(ma.join(ee,ma.normalize(Z)))}function Pi(Z){return`${JSON.stringify(Z,null,2)}
|
|
25
|
+
`}var xa="sveld",ls="0.38.10";var _t={name:xa,version:ls,license:"Apache-2.0",description:"Generate TypeScript definitions and component documentation for your Svelte components.",type:"module",main:"./dist/index.js",types:"./dist/index.d.ts",exports:{".":{types:"./dist/index.d.ts",import:"./dist/index.js",default:"./dist/index.js"},"./browser":{types:"./dist/browser.d.ts",import:"./dist/browser.js",default:"./dist/browser.js"},"./schema/component-api.schema.json":"./schema/component-api.schema.json"},scripts:{test:"bun test --parallel","test:update":"SVELD_UPDATE_FIXTURES=1 bun test tests/fixtures.test.ts","test:fixtures-types":"bun check --project tsconfig.fixtures.json","test:types-matrix":"bun scripts/typecheck-option-matrix.ts","test:svelte-versions":"bun scripts/typecheck-svelte-versions.ts","test:e2e":"bun tests/test-e2e.ts","test:inferred-types":"bun scripts/check-inferred-types.ts",format:"biome format --write .",lint:"biome check --error-on-warnings .","lint:fix":"biome check --write --unsafe .","lint:fix:changed":"biome check --write --unsafe --changed --no-errors-on-unmatched",knip:"knip-bun",build:"bun scripts/build.ts",bench:"bun scripts/bench.ts","bench:cache":"bun scripts/bench.ts --cache","bench:ostia":"ostia bench scripts/bench-ostia.ts",typecheck:"bun check && bun check --project tsconfig.excluded.json"},devDependencies:{"@biomejs/biome":"2.6.3","@types/bun":"^1.4.4","@types/jest":"^30.0.0","@typescript/typescript6":"^6.0.2",ajv:"^8.20.0",knip:"^6.43.0",ostia:"^0.2.11",sveast:"^0.9.6",svelte:"^5.57.2",typescript:"^7.0.2"},bin:{sveld:"dist/cli.js"},repository:{type:"git",url:"git+https://github.com/carbon-design-system/sveld.git"},homepage:"https://github.com/carbon-design-system/sveld",bugs:"https://github.com/carbon-design-system/sveld/issues",keywords:["svelte","svelte component","documentation","docgen","typescript","definitions","JSDocs","vite","vite-plugin"],maintainers:["Eric Liu (https://github.com/metonym)"]};var _i="5.57.2";var us=1;function Wn(Z){return Z.some((ee)=>ee.internal)?Z.filter((ee)=>!ee.internal):Z}function au(Z){return{...Z,props:Wn(Z.props),moduleExports:Wn(Z.moduleExports),slots:Wn(Z.slots),events:Wn(Z.events),typedefs:Wn(Z.typedefs),...Z.contexts?{contexts:Wn(Z.contexts).map((ee)=>({...ee,properties:Wn(ee.properties)}))}:{}}}function h(Z,ee={}){let Le=Array.from(Z.values(),(jt)=>{let{diagnostics:Gt,...Lt}=jt;return au(Lt)}).sort((jt,Gt)=>u(jt.moduleName,Gt.moduleName)),Ot={schemaVersion:us,generator:{name:xa,version:ls,svelteVersion:_i},total:Le.length,components:Le},Bt=ee.entryExports?Wn(ee.entryExports):void 0;if(Bt&&Bt.length>0)Ot.totalExports=Bt.length,Ot.exports=Bt;return Ot}var cu=/[:=]/,gr="COMPONENT_API.json",hs={none:0,patch:1,minor:2,major:3};function lu(Z,ee){return hs[ee]>hs[Z]?ee:Z}function uu(Z){return Z.reduce((ee,Le)=>lu(ee,Le.bump),"none")}function ba(Z,ee){return hs[Z]>=hs[ee]}function va(Z){return new Set(i(Z,"|").map((ee)=>ee.trim()).filter((ee)=>ee.length>0))}function Ea(Z){let ee=k(Z);if(ee===-1)return;let Le=Z.slice(0,ee).trim(),Ot=Z.slice(ee+2).trim();if(!Le.startsWith("(")||!Le.endsWith(")"))return;let Bt=Le.slice(1,-1).trim();return{params:Bt.length===0?[]:i(Bt,",").map((Gt)=>Gt.trim()),returnType:Ot}}function hu(Z){return(Z.split(cu,1)[0]??"").trimEnd().endsWith("?")}function du(Z,ee){if(Z.returnType!==ee.returnType)return"major";if(ee.params.length<Z.params.length)return"major";for(let Ot=0;Ot<Z.params.length;Ot++)if(Z.params[Ot]!==ee.params[Ot])return"major";if(ee.params.length===Z.params.length)return"none";return ee.params.slice(Z.params.length).every(hu)?"minor":"major"}function yr(Z,ee){if(Z===ee)return"none";if(Z===void 0||ee===void 0)return"major";let Le=Ea(Z),Ot=Ea(ee);if(Le&&Ot)return du(Le,Ot);let Bt=va(Z),jt=va(ee),Gt=[...jt].some((Vt)=>!Bt.has(Vt));if(![...Bt].some((Vt)=>!jt.has(Vt)))return Gt?"minor":"none";return"major"}function Sa(Z){return Z.bindable===!0||Z.binding==="writable"}function fs(Z,ee,Le){let Ot=new Map(Z.map((Vt)=>[Le(Vt),Vt])),Bt=new Map(ee.map((Vt)=>[Le(Vt),Vt])),jt=[...Bt].filter(([Vt])=>!Ot.has(Vt)),Gt=[...Ot.keys()].filter((Vt)=>!Bt.has(Vt)),Lt=[];for(let[Vt,Wt]of Ot){let Kt=Bt.get(Vt);if(Kt)Lt.push([Vt,Wt,Kt])}return{added:jt,removed:Gt,common:Lt}}function xr(Z,ee,Le,Ot){return(Bt,jt,Gt)=>Z.push({component:ee,kind:Le,name:Bt,bump:jt,message:`${Ot} "${Bt}" ${Gt}`})}function Ca(Z,ee,Le,Ot){let Bt=[],jt=xr(Bt,Z,ee,ee==="prop"?"prop":"export"),{added:Gt,removed:Lt,common:Vt}=fs(Le,Ot,(Wt)=>Wt.name);for(let[Wt,Kt]of Gt)jt(Wt,Kt.isRequired?"major":"minor",`added${Kt.isRequired?" (required)":""}`);for(let Wt of Lt)jt(Wt,"major","removed");for(let[Wt,Kt,Ht]of Vt){if(Kt.isRequired!==Ht.isRequired)jt(Wt,Ht.isRequired?"major":"minor",`became ${Ht.isRequired?"required":"optional"}`);let qt=yr(Kt.type,Ht.type);if(qt!=="none")jt(Wt,qt,`type changed from \`${Kt.type??"unknown"}\` to \`${Ht.type??"unknown"}\``);let zt=Sa(Ht);if(Sa(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 Bt}function fu(Z,ee,Le){let Ot=[],Bt=xr(Ot,Z,"event","event"),{added:jt,removed:Gt,common:Lt}=fs(ee,Le,(Vt)=>Vt.name);for(let[Vt]of jt)Bt(Vt,"minor","added");for(let Vt of Gt)Bt(Vt,"major","removed");for(let[Vt,Wt,Kt]of Lt){if(Wt.type!==Kt.type){Bt(Vt,"major",`changed from ${Wt.type} to ${Kt.type}`);continue}let Ht=Wt.type==="dispatched"?Wt.detail:void 0,qt=Kt.type==="dispatched"?Kt.detail:void 0,zt=yr(Ht,qt);if(zt!=="none")Bt(Vt,zt,`detail changed from \`${Ht??"unknown"}\` to \`${qt??"unknown"}\``)}return Ot}function mu(Z,ee,Le){let Ot=[],Bt=xr(Ot,Z,"slot","slot"),{added:jt,removed:Gt,common:Lt}=fs(ee,Le,(Vt)=>Vt.name??"default");for(let[Vt]of jt)Bt(Vt,"minor","added");for(let Vt of Gt)Bt(Vt,"major","removed");for(let[Vt,Wt,Kt]of Lt){let Ht=yr(Wt.slot_props,Kt.slot_props);if(Ht!=="none")Bt(Vt,Ht,`props changed from \`${Wt.slot_props??"none"}\` to \`${Kt.slot_props??"none"}\``)}return Ot}var gu=new Set(["description","source","componentCommentSource","tags"]);function ds(Z){if(Array.isArray(Z))return Z.map(ds);if(r(Z)){let ee={};for(let[Le,Ot]of Object.entries(Z)){if(gu.has(Le))continue;ee[Le]=ds(Ot)}return ee}return Z}var yu=["generics","rest_props","extends","contexts","typedefs"];function xu(Z,ee,Le){let Ot=[];for(let Bt of yu){let jt=JSON.stringify(ds(ee[Bt])),Gt=JSON.stringify(ds(Le[Bt]));if(jt!==Gt)Ot.push({component:Z,kind:"shape",name:Bt,bump:"major",message:`"${Bt}" changed (breaking)`})}return Ot}function vu(Z,ee){let Le=ee.moduleName;return[...Ca(Le,"prop",Z.props,ee.props),...Ca(Le,"moduleExport",Z.moduleExports,ee.moduleExports),...fu(Le,Z.events,ee.events),...mu(Le,Z.slots,ee.slots),...xu(Le,Z,ee)]}function Rt(Z,ee){let Le=[],{added:Ot,removed:Bt,common:jt}=fs(Z.components,ee.components,(Gt)=>Gt.moduleName);for(let[Gt]of Ot)Le.push({component:Gt,kind:"component",bump:"minor",message:`component "${Gt}" added`});for(let Gt of Bt)Le.push({component:Gt,kind:"component",bump:"major",message:`component "${Gt}" removed`});for(let[,Gt,Lt]of jt)Le.push(...vu(Gt,Lt));return Le}async function Eu(Z){let ee;try{ee=await pu(mr.resolve(Z),"utf-8")}catch(Le){if(Le.code==="ENOENT")return null;throw Le}try{return JSON.parse(ee)}catch{throw Error(`sveld: could not parse "${Z}" as JSON. Is it a sveld COMPONENT_API.json snapshot?`)}}function wa(Z){if(typeof Z.check==="string")return Z.check;return Z.jsonOptions?.outFile??gr}function Ta(Z,ee){if(!Z.json||Z.stdout||Z.jsonOptions?.outDir)return!1;return mr.resolve(Z.jsonOptions?.outFile??gr)===mr.resolve(ee)}async function _e(Z,ee,Le={}){let Ot=await Eu(ee);if(Ot===null)return{snapshotExists:!1,snapshotFile:ee,changes:[],bump:"none"};if(Ot.schemaVersion!==us)return{snapshotExists:!0,snapshotFile:ee,changes:[{component:"*",kind:"schema",bump:"none",message:`snapshot schemaVersion ${Ot.schemaVersion} differs from ${us}; regenerate the snapshot`}],bump:"none"};let Bt=h(Z,{entryExports:Le.entryExports}),jt=Rt(Ot,Bt);return{snapshotExists:!0,snapshotFile:ee,changes:jt,bump:uu(jt)}}var Su={major:"BREAKING",minor:"additive",patch:"patch",none:"no change"};function ge(Z){if(!Z.snapshotExists){let Bt=Z.snapshotFile===gr?"`sveld --json`":`\`sveld --json\` with \`jsonOptions.outFile: "${Z.snapshotFile}"\``;return`sveld --check: no snapshot found at "${Z.snapshotFile}". Generate it with ${Bt} and commit it.`}if(Z.changes.length===0)return`sveld --check: no API changes detected against "${Z.snapshotFile}".`;let ee=Z.changes.length,Le=[`sveld --check: ${ee} API change${ee===1?"":"s"} detected against "${Z.snapshotFile}".`,`Suggested semver bump: ${Z.bump}.`],Ot=new Map;for(let Bt of Z.changes){let jt=Ot.get(Bt.component)??[];jt.push(Bt),Ot.set(Bt.component,jt)}for(let[Bt,jt]of Ot){Le.push("",` ${Bt}`);for(let Gt of jt){let Lt=Gt.kind==="schema"?"schema":Su[Gt.bump];Le.push(` [${Lt}] ${Gt.message}`)}}return Le.join(`
|
|
26
|
+
`)}var $t=1;function ye(Z){let ee={kind:"check-report",schemaVersion:$t,...Z};return Pi(ee)}import{existsSync as Pa}from"node:fs";import{join as Cu,resolve as bu}from"node:path";import{pathToFileURL as wu}from"node:url";var Tu=["sveld.config.js","sveld.config.mjs","sveld.config.ts"];function Mt(Z){return Z}function ku(Z=process.cwd()){for(let ee of Tu){let Le=Cu(Z,ee);if(Pa(Le))return Le}return null}async function _a(Z){let ee;try{ee=await import(`${wu(Z).href}?t=${Date.now()}`)}catch(Ot){let Bt=Ot instanceof Error?Ot.message:String(Ot);throw Error(`sveld: failed to load config file "${Z}".
|
|
27
|
+
${Bt}`)}let Le=ee.default;if(!r(Le)||Array.isArray(Le))throw Error(`sveld: config file "${Z}" must export a configuration object as its default export. Did you forget \`export default defineConfig({ ... })\`?`);return Le}async function Au(Z=process.cwd()){let ee=ku(Z);return ee===null?{}:_a(ee)}async function B(Z,ee,Le){if(typeof Z==="string"){let Ot=bu(ee,Z);if(!Pa(Ot))throw Error(`sveld: config file "${Z}" does not exist.`);return _a(Ot)}return Z??Le?Au(ee):{}}function R(...Z){let ee={};for(let Le of Z){if(!Le)continue;for(let[Ot,Bt]of Object.entries(Le)){let jt=ee[Ot];ee[Ot]=r(jt)&&!Array.isArray(jt)&&r(Bt)&&!Array.isArray(Bt)?{...jt,...Bt}:Bt}}return ee}var ka=["entry","glob","quiet","documentExports","types","typesOptions","json","jsonOptions","markdown","markdownOptions","failFast","watch","config","cache","checkExamples","reportDiagnostics","strict","check","checkLevel","stdout","format","diagnostics"],Pu={typesOptions:["outDir","preamble","format","transform","indexTypes"],jsonOptions:["outFile","outDir","source"],markdownOptions:["outFile","outDir","onAppend"],diagnostics:["ignore"]};function Aa(Z,ee,Le){let Ot=Z===null?ee:`${Z}.${ee}`,Bt=_(ee,Le),jt=Bt===void 0?void 0:Z===null?Bt:`${Z}.${Bt}`;console.warn(`sveld: unknown option "${Ot}".${jt?` Did you mean "${jt}"?`:""}`)}function j(Z){for(let ee of Object.keys(Z))if(!ka.includes(ee))Aa(null,ee,ka);for(let[ee,Le]of Object.entries(Pu)){let Ot=Z[ee];if(!r(Ot))continue;for(let Bt of Object.keys(Ot))if(!Le.includes(Bt))Aa(ee,Bt,Le)}}import{dirname as Cc}from"node:path";import{lstatSync as kf}from"node:fs";import{readFile as Af}from"node:fs/promises";import{resolve as qp}from"node:path";import{dirname as jh}from"node:path";var _u=" ",$u=120,Nu=/\binterface\s+[A-Za-z_$][\w$]*(\s*<[^{};]*>)?\s*$/,Du=200,Ra=/\s/,Ru=/\s{2}|[^\S ]/,Iu=/["'`{}/]/g,Ou=/["'`{};/]/g,Ia=9,vr=10,Lu=13,$i=32,gs=34,Mu=38,ys=39,Fu=40,Bu=41,ms=42,$a=46,Sr=47,Oa=59,ju=62,Vu=91,Cr=92,Gu=93,xs=96,br=123,Wu=124,wr=125;function Uu(Z){return Nu.test(Hu(Z,Du))}var Na=[""];function Ku(Z){let ee=Na[Z];if(ee===void 0)ee=_u.repeat(Z),Na[Z]=ee;return ee}function Hu(Z,ee){let Le="";for(let Ot=Z.length-1;Ot>=0&&Le.length<ee;Ot--)Le=Z[Ot]+Le;return Le.length>ee?Le.slice(-ee):Le}function qu(Z){if(Z.length===0)return!1;let ee=Z[Z.length-1];return ee.charCodeAt(ee.length-1)===vr}function zu(Z){while(Z.length>0){let ee=Z[Z.length-1],Le=ee.length;while(Le>0){let Ot=ee.charCodeAt(Le-1);if(Ot!==$i&&Ot!==Ia)break;Le--}if(Le===ee.length)return;if(Le===0){Z.pop();continue}Z[Z.length-1]=ee.slice(0,Le);return}}function Xu(Z){while(Z.length>0){let ee=Z[Z.length-1];if(!Ra.test(ee[ee.length-1]))return;let Le=ee.trimEnd();if(Le.length===ee.length)return;if(Le.length===0){Z.pop();continue}Z[Z.length-1]=Le;return}}function Ju(Z){if(Z.includes("{"))return!1;let ee=0,Le=0;for(let Ot=0;Ot<Z.length;Ot++){let Bt=Z.charCodeAt(Ot);if(ee!==0){if(Bt===ee&&Z.charCodeAt(Ot-1)!==Cr)ee=0;continue}if(Bt===gs||Bt===ys||Bt===xs){ee=Bt;continue}if(Bt===Oa&&++Le>=2)return!0}return!1}function Yu(Z){if(!Ru.test(Z))return Z.trimEnd();let ee="",Le=null,Ot=!1;for(let Bt=0;Bt<Z.length;Bt++){let jt=Z[Bt],Gt=Z[Bt-1];if(Le){if(ee+=jt,Le==="double"&&jt==='"'&&Gt!=="\\"||Le==="single"&&jt==="'"&&Gt!=="\\"||Le==="template"&&jt==="`"&&Gt!=="\\")Le=null;Ot=!1;continue}if(jt==='"'||jt==="'"||jt==="`"){Le=jt==='"'?"double":jt==="'"?"single":"template",ee+=jt,Ot=!1;continue}if(Ra.test(jt)){if(!Ot&&ee.length>0)ee+=" ",Ot=!0;continue}ee+=jt,Ot=!1}return ee.trimEnd()}function La(Z,ee){let Le=Z[ee],Ot=Z.indexOf(Le,ee+1);while(Ot!==-1&&Z.charCodeAt(Ot-1)===Cr)Ot=Z.indexOf(Le,Ot+1);return Ot}function Ma(Z,ee){let Le=Z.indexOf("*/",ee+1);return Le===-1?-1:Le+1}function Qu(Z){let ee=new Map,Le=[],Ot=Iu,Bt=0;while(Bt<Z.length){if(Ot.lastIndex=Bt,!Ot.test(Z))break;Bt=Ot.lastIndex-1;let jt=Z.charCodeAt(Bt);if(jt===Sr){if(Z.charCodeAt(Bt+1)===ms){let Gt=Ma(Z,Bt);if(Gt===-1)break;Bt=Gt}}else if(jt===gs||jt===ys||jt===xs){let Gt=La(Z,Bt);if(Gt===-1)break;Bt=Gt}else if(jt===br)Le.push(Bt);else if(jt===wr&&Le.length>0)ee.set(Le.pop(),Bt);Bt++}return ee}function Zu(Z,ee,Le){for(let Ot=ee;Ot<Le;Ot++)if(!Er(Z.charCodeAt(Ot)))return!1;return!0}function Er(Z){if(Z<=$i)return Z===$i||Z>=Ia&&Z<=Lu;if(Z<160)return!1;return Z===160||Z===5760||Z>=8192&&Z<=8202||Z===8232||Z===8233||Z===8239||Z===8287||Z===12288||Z===65279}function Fa(Z,ee,Le,Ot){let Bt=[],jt=Ou,Gt=ee,Lt=ee;while(Lt<Le){if(jt.lastIndex=Lt,!jt.test(Z))break;if(Lt=jt.lastIndex-1,Lt>=Le)break;let Vt=Z.charCodeAt(Lt);if(Vt===Sr){if(Z.charCodeAt(Lt+1)===ms){let Wt=Ma(Z,Lt);if(Wt===-1)break;Lt=Wt}Lt++;continue}if(Vt===gs||Vt===ys||Vt===xs){let Wt=La(Z,Lt);if(Wt===-1)break;Lt=Wt+1;continue}if(Vt===br){let Wt=Ot.get(Lt);if(Wt===void 0||Wt>=Le){Lt++;continue}if(Gt<Lt)Bt.push(Z.slice(Gt,Lt));let Kt=Lt+1;if(Zu(Z,Kt,Wt)){Bt.push("{}"),Lt=Wt+1,Gt=Lt;continue}let Ht=Z.slice(Kt,Wt),qt=Z.charCodeAt(Kt)===vr;if(!qt&&!Ht.includes("/*")&&!Ju(Ht)&&!Uu(Bt)){let zt=Fa(Z,Kt,Wt,Ot),Xt=zt.trim();if(!Xt.includes(`
|
|
28
|
+
`)){let Yt=Xt.endsWith(";")?Xt.slice(0,-1):Xt,Jt=`{ ${Yu(Yt)} }`;if(Jt.length<=$u){Bt.push(Jt),Lt=Wt+1,Gt=Lt;continue}}if(Bt.push("{"),zt.charCodeAt(0)!==Oa)Bt.push(`
|
|
29
|
+
`);if(zt.length>0)Bt.push(zt);Lt=Wt,Gt=Wt;continue}if(Bt.push("{"),!qt)Bt.push(`
|
|
30
|
+
`);Lt=Kt,Gt=Kt;continue}if(Vt===wr){if(Gt<Lt)Bt.push(Z.slice(Gt,Lt));if(zu(Bt),!qu(Bt))Bt.push(`
|
|
31
|
+
`);Bt.push("}"),Lt++,Gt=Lt;continue}if(Gt<Lt)Bt.push(Z.slice(Gt,Lt));if(Xu(Bt),Bt.push(";"),Z.charCodeAt(Lt+1)!==vr)Bt.push(`
|
|
32
|
+
`);Lt++,Gt=Lt}if(Gt<Le)Bt.push(Z.slice(Gt,Le));return Bt.join("")}function eh(Z){if(!Z.includes(" "))return Z;let ee="",Le=0;for(let Ot=0;Ot<Z.length;Ot++){let Bt=Z.charCodeAt(Ot);if(Le!==0){if(ee+=Z[Ot],Bt===Le&&Z.charCodeAt(Ot-1)!==Cr)Le=0;continue}if(Bt===gs||Bt===ys||Bt===xs){Le=Bt,ee+=Z[Ot];continue}if(Bt===$i&&ee.charCodeAt(ee.length-1)===$i)continue;ee+=Z[Ot]}return ee}function th(Z){return Z===wr||Z===Gu||Z===Bu||Z===ju}function nh(Z,ee,Le){return Le-ee>=3&&Z.charCodeAt(ee)===Sr&&Z.charCodeAt(ee+1)===ms&&Z.charCodeAt(ee+2)===ms}function Da(Z,ee,Le){let Ot=Z.indexOf("*/",ee);return Ot!==-1&&Ot+2<=Le}function ih(Z,ee,Le){let Ot=Z.charCodeAt(ee);if(Ot===Wu||Ot===Mu)return!0;return Ot===$a&&ee+1<Le&&Z.charCodeAt(ee+1)!==$a}function sh(Z){let ee=[],Le=[],Ot=Z.length,Bt=0,jt=!1,Gt=0,Lt=0;while(Lt<=Ot){let Kt=Z.indexOf(`
|
|
33
|
+
`,Lt);if(Kt===-1)Kt=Ot;let Ht=Kt+1,qt=Lt,zt=Kt;while(qt<zt&&Er(Z.charCodeAt(qt)))qt++;while(zt>qt&&Er(Z.charCodeAt(zt-1)))zt--;if(qt===zt){let sn=Le.length>0?Le[Le.length-1]:void 0;if(sn!==void 0&&sn!==""){let ln=sn.charCodeAt(sn.length-1);if(ln!==br&&ln!==Fu&&ln!==Vu)ee.push(0),Le.push("")}Lt=Ht;continue}if(jt){if(ee.push(Gt),Le.push(` ${Z.slice(qt,zt)}`),Da(Z,qt,zt))jt=!1;Lt=Ht;continue}let Xt=nh(Z,qt,zt),Yt=Xt&&Da(Z,qt,zt);if(Xt&&!Yt){ee.push(Bt),Le.push(Z.slice(qt,zt)),jt=!0,Gt=Bt,Lt=Ht;continue}let Jt=th(Z.charCodeAt(qt)),tn=Math.max(0,Bt-(Jt?1:0))+(ih(Z,qt,zt)?1:0);if(Jt&&tn===0&&Le.length>0&&Le[Le.length-1]==="")ee.pop(),Le.pop();if(ee.push(tn),Le.push(eh(Z.slice(qt,zt))),Lt=Ht,Yt)continue;Bt=qi(Z,void 0,qt,zt,Bt)}let Vt=Le.length;while(Vt>0&&Le[Vt-1]==="")Vt--;let Wt=[];for(let Kt=0;Kt<Vt;Kt++){if(Kt>0)Wt.push(`
|
|
34
|
+
`);let Ht=ee[Kt];if(Ht>0)Wt.push(Ku(Ht));Wt.push(Le[Kt])}return Wt.join("")}function Ba(Z){return`${sh(Fa(Z,0,Z.length,Qu(Z)))}
|
|
35
|
+
`}var kn="any",rh="Record<string, any>",Ni="Record<string, never>",Ka=/^[A-Za-z_$][A-Za-z0-9_$]*$/,oh=/CustomEvent/,ah=/^[A-Z]/,ph=/\n/,ch=/=>/,lh=/^\s*[(<]/,uh=/(?:^|\n)@default\b/,hh=/^([ \t]*\*) +$/gm,dh=/[^\S\r\n]*[\r\n]\s*/g,fh=/(^|[^.\w])Snippet(?:\s*<|\b)/,mh=/import\s+type\s+[^;]*\bSnippet\b[^;]*from\s+"svelte";/,gh=/^const\s+/,yh=/^export /,xh=/[^\w$]/g;function Ha(Z){return Z.replace(gh,"")}function Rn(Z){if(Z.length===0)return"";return`/**
|
|
36
|
+
* ${O(Z.join(`
|
|
37
|
+
* `))}
|
|
38
|
+
*/`}function Di(Z){return Z?Z.split(`
|
|
39
|
+
`):[]}function qa(Z){if(Z===void 0)return[];return(Z===!0?"@deprecated":`@deprecated ${Z}`).split(`
|
|
40
|
+
`)}function kr(Z){let ee=[];for(let{name:Le,body:Ot}of Z??[])if(!Ot)ee.push(`@${Le}`);else if(Ot.includes(`
|
|
41
|
+
`))ee.push(`@${Le}`,...Ot.split(`
|
|
42
|
+
`));else ee.push(`@${Le} ${Ot}`);return ee}function fi(Z,ee,Le){return[...Di(Z),...qa(ee),...kr(Le)]}function za(Z){if(!Z)return"";return`/** ${O(Z)} */`}function Ar(Z){return Z?.includes(`
|
|
43
|
+
`)?Rn(Di(Z)):za(Z)}function Pr(Z,ee,Le){let Ot=[...kr(ee),...qa(Le)];if(Ot.length===0)return Ar(Z);return Rn([...Di(Z),...Ot])}function Xa(Z){if(Z===void 0)return kn;return`${Z}
|
|
44
|
+
`}function vs(Z){if(Z.typedefs.length===0)return"";return Z.typedefs.map((ee)=>{let Le=Rn([...Di(ee.description),...kr(ee.tags)]);return`${Le?`${Le}
|
|
45
|
+
`:""}export ${ee.ts}`.replace(hh,"$1")}).join(`
|
|
46
|
+
|
|
47
|
+
`)}var ja=new Map;function vh(Z,ee){let Le=ja.get(ee);if(Le===void 0)Le=new RegExp(`\\b${N(ee)}\\b`),ja.set(ee,Le);return Le.test(Z)}var Va,Ga=[];function Ja(Z){if(Z!==Va)Va=Z,Ga=i(Z,",");return Ga}function Eh(Z){if(Z===null)return[];return Z[0].split(",").map((ee,Le)=>({name:ee.trim(),constraint:(Ja(Z[1]??"")[Le]??ee).trim()}))}function Ya(Z,ee){let Le=Eh(Z).filter(({name:Ot})=>vh(ee,Ot));if(Le.length===0)return{declSuffix:"",refSuffix:""};return{declSuffix:`<${Le.map(({constraint:Ot})=>Ha(Ot)).join(", ")}>`,refSuffix:`<${Le.map(({name:Ot})=>Ot).join(", ")}>`}}function Qa(Z){if(!Z.contexts||Z.contexts.length===0)return"";return Z.contexts.map((ee)=>{let Le=ee.properties.map((Gt)=>{let Lt=Gt.description?`${Ar(Gt.description)}
|
|
48
|
+
`:"",Vt=Gt.optional?"?":"";return`${Lt}${_n(Gt.name)}${Vt}: ${Gt.type};`}).join(`
|
|
49
|
+
`),Ot=ee.description?`${Rn(Di(ee.description))}
|
|
50
|
+
`:"",{declSuffix:Bt}=Ya(Z.generics,[ee.type??"",...ee.properties.map((Gt)=>Gt.type)].join(`
|
|
51
|
+
`));if(ee.type!==void 0)return`${Ot}export type ${ee.typeName}${Bt} = ${ee.type};`;if(ee.properties.length===0)return`${Ot}export type ${ee.typeName} = ${ee.hasUnresolvedSpread?"Record<string, any>":Ni};`;let jt=ee.hasUnresolvedSpread?" & Record<string, any>":"";return`${Ot}export type ${ee.typeName}${Bt} = {
|
|
52
|
+
${Le}
|
|
53
|
+
}${jt};`}).join(`
|
|
54
|
+
|
|
55
|
+
`)}function _n(Z){return Ka.test(Z)?Z:JSON.stringify(Z)}function Wa(Z,ee){let Le=Pr(ee.description,ee.tags,ee.deprecated),Ot=Le?`${Le}
|
|
56
|
+
`:"",Bt=!ee.slot_props||ee.slot_props===Ni?"[]":Ch(ee.slot_props),jt=Bt==="[]"?"(this: void) => void":`(this: void, ...args: ${Bt}) => void`;return`
|
|
57
|
+
${Ot}${Z}?: ${jt};`}function Sh(Z){let ee=Z.props.filter((Zt)=>!Es(Zt)),Le=new Set([...ee.map((Zt)=>Zt.name),...Array.from(Z.canonicalPropNames??[])]),Bt=(Z.canonicalPropsType?ee.filter((Zt)=>!Z.canonicalPropNames?.has(Zt.name)):ee).map((Zt)=>{let si=typeof Zt.value==="string"?Zt.value.replace(dh," "):Zt.value,Gi=uh.test(Zt.description??"")||Zt.value===void 0||Zt.value==="undefined",Wi=Rn([...fi(Zt.description,Zt.deprecated,Zt.tags),...Zt.constant?["@constant"]:[],...Gi?[]:[`@default ${si}`]]),Ui=Zt.constant&&!Zt.isFunction?Zt.value:Zt.type||kn;return`
|
|
58
|
+
${Wi}
|
|
59
|
+
${_n(Zt.name)}${Zt.isRequired?"":"?"}: ${Ui};`});for(let Zt of Z.slots)if(!Zt.default&&Zt.name!=null&&!Le.has(Zt.name))Bt.push(Wa(_n(Zt.name),Zt));let jt=Z.slots.find((Zt)=>Zt.default||Zt.name===null);if(jt&&!Le.has("children"))Bt.push(Wa("children",jt));let Gt=Bt.join(`
|
|
60
|
+
`),Lt=mi(Z.moduleName),Vt=Z.generics?`<${Ja(Z.generics[1]).map((Zt)=>Ha(Zt.trim())).join(", ")}>`:"",Wt=Z.generics?`<${Z.generics[0]}>`:"",Ht=`${Z.extends===void 0?"":`Omit<${Z.extends.interface}, keyof $Props${Wt}> & `}$Props${Wt}`,qt=(Zt)=>`export type ${Lt}${Vt} = ${Zt};`,zt=`{${Gt}
|
|
61
|
+
}`;if(Z.rest_props?.type!=="Element"){let Zt;if(Z.canonicalPropsType){let si=Gt.trim()===""?"":` & ${zt}`;Zt=[`type $Props${Vt} = ${Z.canonicalPropsType}${si};`,qt(Ht)]}else if(Gt.trim()==="")Zt=[qt(Z.extends?.interface??Ni)];else if(Z.extends===void 0)Zt=[qt(zt)];else Zt=[`type $Props${Vt} = ${zt};`,qt(Ht)];return{props_name:Lt,prop_def:Zt.join(`
|
|
62
|
+
|
|
63
|
+
`),elementsImport:void 0}}let{name:Xt,thisValue:Yt,thisType:Jt,description:tn}=Z.rest_props,sn;if(Xt!=="svelte:element")sn=Xt.split("|").map((Zt)=>`SvelteHTMLElements["${Zt.trim()}"]`).join(" & ");else if(Yt)sn=`SvelteHTMLElements["${Yt}"]`;else if(Jt)sn=`NoInfer<SvelteHTMLElements[${Jt}]>`;else sn="HTMLAttributes<HTMLElement>";let ln="[key: `data-${string}`]: unknown;",cn=tn?`${Ar(tn)}
|
|
64
|
+
`:"",un=Z.canonicalPropsType?`(${Z.canonicalPropsType}) & `:"",On=Jt?{name:Vt,ref:Wt}:{name:"",ref:""},zn=Z.extends===void 0?`keyof $Props${Wt}`:`keyof ($Props${Wt} & ${Z.extends.interface})`,Bn=`Omit<$RestProps${On.ref}, ${zn}>`,yn=Jt?`(${Jt} extends any ? ${Bn} : never)`:Bn;return{props_name:Lt,prop_def:[`${cn}type $RestProps${On.name} = ${sn};`,`type $Props${Vt} = ${un}{${Gt}
|
|
65
|
+
|
|
66
|
+
${ln}
|
|
67
|
+
};`,qt(`${yn} & ${Ht}`)].join(`
|
|
68
|
+
|
|
69
|
+
`),elementsImport:sn.startsWith("HTMLAttributes")?"HTMLAttributes":"SvelteHTMLElements"}}function Ch(Z){return Vs(Z)?Z:`[${Z}]`}function bh(Z){let ee=Z.slots.filter((Ot)=>!Vs(Ot.slot_props??""));if(ee.length===0)return Ni;let Le=ee.map(({name:Ot,slot_props:Bt,...jt})=>{let Gt=jt.default||Ot===null?"default":_n(Ot??""),Lt=Pr(jt.description,jt.tags,jt.deprecated);return`${Lt?`${Lt}
|
|
70
|
+
`:""}${Gt}: ${Xa(Bt)};`}).join(`
|
|
71
|
+
`);return ee.length===1?`{${Le}}`:`{
|
|
72
|
+
${Le}
|
|
73
|
+
}`}var wh=new Set(["click","dblclick","mousedown","mouseup","mousemove","mouseover","mouseout","mouseenter","mouseleave","contextmenu","wheel","keydown","keyup","keypress","submit","change","input","focus","blur","focusin","focusout","reset","select","touchstart","touchend","touchmove","touchcancel","drag","dragstart","dragend","dragover","dragenter","dragleave","drop","pointerdown","pointerup","pointermove","pointerover","pointerout","pointerenter","pointerleave","pointercancel","gotpointercapture","lostpointercapture","play","pause","ended","volumechange","timeupdate","loadeddata","loadedmetadata","canplay","canplaythrough","seeking","seeked","playing","waiting","stalled","suspend","abort","error","emptied","ratechange","durationchange","loadstart","progress","loadend","animationstart","animationend","animationiteration","animationcancel","transitionstart","transitionend","transitionrun","transitioncancel","scroll","resize","load","unload","beforeunload","cut","copy","paste","compositionstart","compositionupdate","compositionend"]);function Tr(Z=kn){if(oh.test(Z))return Z;return`CustomEvent<${Z}>`}function Th(Z){switch(Z.type){case"dispatched":return Tr(Z.detail);case"forwarded":{let ee=Z.element,Le=ee&&ah.test(ee),Ot=!Le||wh.has(Z.name);if(Z.detail!==void 0&&Z.detail!=="undefined"&&!(Z.detail==="null"&&Ot&&!Le))return Tr(Z.detail);if(!Ot)return Tr();return`${ee==="svelte:document"?"DocumentEventMap":"WindowEventMap"}["${Z.name}"]`}default:return Z}}function Ua(Z){if(Z.events.length===0)return rh;let ee=Z.events.map((Le)=>{let Ot=Pr(Le.description,Le.tags,Le.deprecated);return`${Ot?`${Ot}
|
|
74
|
+
`:""}${_n(Le.name)}: ${Th(Le)};
|
|
75
|
+
`}).join("");return Z.events.length===1?`{${ee}}`:`{
|
|
76
|
+
${ee}}`}function kh(Z){let ee=Z.type==="() => any";if(Z.type&&ch.test(Z.type)&&!ee)return Z.type;if(Z.params&&Z.params.length>0)return`(${y(Z.params)}) => ${Z.returnType||kn}`;if(Z.returnType)return`() => ${Z.returnType}`;return Z.type||kn}function Es(Z){return Z.isFunctionDeclaration===!0||Z.kind==="const"}function Za(Z){return Z.props.filter(Es).map((ee)=>`
|
|
77
|
+
${Rn(fi(ee.description,ee.deprecated,ee.tags))}
|
|
78
|
+
${_n(ee.name)}: ${kh(ee)};`).join(`
|
|
79
|
+
`)}function Ah(Z){let ee=Ri(Z.moduleName),Le=Za({props:Z.props});if(Le.trim()==="")return{exports_ref:ee,exports_def:`export type ${ee} = ${Ni};`};let{declSuffix:Ot,refSuffix:Bt}=Ya(Z.generics,Le);return{exports_ref:`${ee}${Bt}`,exports_def:`export type ${ee}${Ot} = {${Le}
|
|
80
|
+
};`}}function Ph(Z){let ee=Z.props.filter((Le)=>Le.bindable===!0||Le.binding==="writable").map((Le)=>JSON.stringify(Le.name));return ee.length>0?ee.join(" | "):'""'}function ep(Z){return Z==="default"?"$$Component":Z}function _h(Z){let ee=ep(Z.moduleName);return`declare const ${ee}: Component<
|
|
81
|
+
${Z.propsRef},
|
|
82
|
+
${Z.exportsRef},
|
|
83
|
+
${Z.bindings}
|
|
84
|
+
>;
|
|
85
|
+
export default ${ee};`}function $h(Z){let ee=ep(Z.moduleName),Le=`${ee}Component`,Ot=Z.eventsRef?`$on?<K extends keyof ${Z.eventsRef} & string>(type: K, callback: (e: ${Z.eventsRef}[K]) => void): () => void;`:"$on?(type: string, callback: (e: any) => void): () => void;";return`interface ${Le} {
|
|
86
|
+
new ${Z.generic}(
|
|
87
|
+
options: ComponentConstructorOptions<${Z.propsRef}>
|
|
88
|
+
): SvelteComponent<${Z.propsRef}${Z.eventsRef?`, ${Z.eventsRef}`:""}> & ${Z.exportsRef};
|
|
89
|
+
${Z.generic}(
|
|
90
|
+
this: void,
|
|
91
|
+
internals: ComponentInternals,
|
|
92
|
+
props: ${Z.propsRef}
|
|
93
|
+
): {
|
|
94
|
+
${Ot}
|
|
95
|
+
$set?(props: Partial<${Z.propsRef}>): void;
|
|
96
|
+
} & ${Z.exportsRef};
|
|
97
|
+
element?: typeof HTMLElement;
|
|
98
|
+
z_$$bindings?: ${Z.bindings};
|
|
99
|
+
}
|
|
100
|
+
declare const ${ee}: ${Le};
|
|
101
|
+
export default ${ee};`}function Nh(Z){if(Z.extends===void 0)return"";return`import type { ${_r(Z.extends.interface)} } from ${Z.extends.import};`}function _r(Z){let ee=Z.indexOf("<");return(ee===-1?Z:Z.slice(0,ee)).trim()}function Dh(Z){if(!Z.componentComment)return"";if(!ph.test(Z.componentComment))return za(Z.componentComment.trim());return`/*${O(Z.componentComment).split(`
|
|
102
|
+
`).map((ee)=>`* ${ee}`).join(`
|
|
103
|
+
`)}
|
|
104
|
+
*/`}function Rh(Z){let ee=[],Le=new Map;for(let Ot of Z.moduleExports){if(Ot.kind!=="re-export"||!Ot.reExport)continue;let{from:Bt,imported:jt}=Ot.reExport,Gt=Rn(fi(Ot.description,Ot.deprecated,Ot.tags)),Lt=_n(Ot.name);if(jt==="*"){let Kt=Ot.name==="*"?"*":`* as ${Lt}`;ee.push(`${Gt}
|
|
105
|
+
export ${Kt} from ${JSON.stringify(Bt)};`);continue}let Vt=`${Bt}\x00${Gt}`,Wt=Le.get(Vt);if(!Wt)Wt={comment:Gt,from:Bt,specifiers:[]},Le.set(Vt,Wt),ee.push(Vt);Wt.specifiers.push(jt===Ot.name?Lt:`${_n(jt)} as ${Lt}`)}return ee.map((Ot)=>{let Bt=Le.get(Ot);if(!Bt)return Ot;return`${Bt.comment}
|
|
106
|
+
export { ${Bt.specifiers.join(", ")} } from ${JSON.stringify(Bt.from)};`}).join(`
|
|
107
|
+
|
|
108
|
+
`)}function $r(Z){let ee=[Z.static?"static ":"",Z.abstract?"abstract ":"",Z.readonly?"readonly ":""].join(""),Le=Z.optional?"?":"";if(Z.kind==="property")return`${ee}${_n(Z.name)}${Le}: ${Z.type??kn}`;if(Z.kind==="index")return`${ee}${Z.name}: ${Z.type??kn}`;let Ot=y(Z.params??[]);if(Z.kind==="constructor")return`constructor(${Ot})`;let Bt=Z.typeParameters?`<${Z.typeParameters}>`:"";return`${ee}${_n(Z.name)}${Le}${Bt}(${Ot}): ${Z.returnType??kn}`}function Ih(Z,ee){let Le=Z.localName??Z.name,Ot=Le!==Z.name,Bt=`export { ${Le}${Ot?` as ${_n(Z.name)}`:""} };`;if(ee.has(Le))return Bt;ee.add(Le);let jt=Z.typeParameters?`<${Z.typeParameters}>`:"",Gt=(Z.members??[]).map((Kt)=>[Rn(fi(Kt.description,Kt.deprecated,Kt.tags)),`${$r(Kt)};`].filter(Boolean).join(`
|
|
109
|
+
`)).join(`
|
|
110
|
+
|
|
111
|
+
`),Lt=`${Z.extends?` extends ${Z.extends}`:""}${Z.implements?.length?` implements ${Z.implements.join(", ")}`:""}`,Vt=`${Ot?"":"export "}declare ${Z.abstract?"abstract ":""}class ${Le}${jt}${Lt}`;return`
|
|
112
|
+
${[Rn(fi(Z.description,Z.deprecated,Z.tags)),Gt?`${Vt} {
|
|
113
|
+
${Gt}
|
|
114
|
+
}`:`${Vt} {}`,Ot?Bt:""].filter(Boolean).join(`
|
|
115
|
+
`)}`}function Oh(Z){let ee=Rh(Z),Le=new Set,Ot=Z.moduleExports.filter((Bt)=>Bt.kind!=="re-export").map((Bt)=>{if(Bt.kind==="class")return Ih(Bt,Le);let jt=!Ka.test(Bt.name),Gt=jt?{...Bt,name:Lh(Bt.name)}:Bt,Lt,Vt=Gt.type&&lh.test(Gt.type)?k(Gt.type):-1,Wt=Gt.typeParameters?`<${Gt.typeParameters}>`:"";if(Gt.kind==="const"&&Vt===-1)Lt=`export declare const ${Gt.name}: ${Gt.type||kn};
|
|
116
|
+
`;else if(Gt.kind==="let")Lt=`export declare let ${Gt.name}: ${Gt.type||kn};`;else if(Gt.params&&Gt.params.length>0)Lt=`export declare function ${Gt.name}${Wt}(${y(Gt.params)}): ${Gt.returnType||kn};`;else if(Gt.returnType)Lt=`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();Lt=`export declare function ${Gt.name}${Kt}: ${Ht};`}else Lt=`export declare let ${Gt.name}: ${Gt.type||kn};`;if(jt)Lt=`${Lt.replace(yh,"").trimEnd()}
|
|
117
|
+
export { ${Gt.name} as ${JSON.stringify(Bt.name)} };`;return`
|
|
118
|
+
${Rn(fi(Gt.description,Gt.deprecated,Gt.tags))}
|
|
119
|
+
${Lt}`}).join(`
|
|
120
|
+
`);return[ee,Ot].filter(Boolean).join(`
|
|
121
|
+
|
|
122
|
+
`)}function Lh(Z){return`__export_${Z.replace(xh,"_")}`}var Mh=120;function Fh(Z){let Le=`export default class ${Z.moduleName==="default"?"":Z.moduleName}${Z.generic} extends SvelteComponentTyped<`,Ot=[Z.genericProps,Z.events,Z.slots];if(Z.accessors.trim()===""&&Ot.every((Bt)=>!Bt.includes(`
|
|
123
|
+
`))){let Bt=`${Le}${Ot.join(", ")}> {}`;if(Bt.length<=Mh)return Bt}return`${Le}
|
|
124
|
+
${Z.genericProps},
|
|
125
|
+
${Z.events},
|
|
126
|
+
${Z.slots}
|
|
127
|
+
> {
|
|
128
|
+
${Z.accessors}
|
|
129
|
+
}`}function mi(Z){return`${Z}Props`}function Ri(Z){return`${Z}Exports`}function Nr(Z){return{format:Z.format}}var Bh={format:"class"};function tp(Z){let ee=Nr(Z??{}),Le={};for(let[Ot,Bt]of Object.entries(ee))Le[Ot]=Bt??Bh[Ot];return JSON.stringify(Le)}function Dr(Z,ee){let Le=mo(Z),{moduleName:Ot,typedefs:Bt,generics:jt,props:Gt,moduleExports:Lt,slots:Vt,events:Wt,rest_props:Kt,extends:Ht,componentComment:qt,contexts:zt}=Z,Xt=ee?.format==="component",Yt=jt!==null,{props_name:Jt,prop_def:tn,elementsImport:sn}=Sh({moduleName:Ot,props:Gt,rest_props:Kt,extends:Ht,generics:jt,slots:Vt,canonicalPropNames:new Set(Le?.canonicalPropNames??[]),canonicalPropsType:Le?.canonicalPropsType}),ln=jt?`<${jt[1]}>`:"",cn=jt?`${Jt}<${jt[0]}>`:Jt,un=Xt&&Wt.length>0?`type $Events${ln} = ${Ua({events:Wt})};`:"",On=jt?`$Events<${jt[0]}>`:"$Events",zn=Xt&&(Yt||un!==""),Bn=Oh({moduleExports:Lt}),yn=vs({typedefs:Bt}),Zt=Qa({contexts:zt,generics:jt}),si=(Le?.typeImportStatements??[]).join(`
|
|
130
|
+
`),Gi=[...Le?.localTypeDeclarations??[],...Le?.moduleTypeDeclarations??[]].join(`
|
|
131
|
+
|
|
132
|
+
`),{exports_ref:Wi,exports_def:Ui}=Xt?Ah({props:Gt,moduleName:Ot,generics:jt}):{exports_ref:"",exports_def:""},ho=Xt?Ph({props:Gt}):"",Os=!mh.test(si)&&[tn,Bn,yn,Zt,Gi,Ui].some((Ls)=>fh.test(Ls)),kc=[Xt?zn?`import type { SvelteComponent, ComponentConstructorOptions, ComponentInternals${Os?", Snippet":""} } from "svelte";`:`import type { Component${Os?", Snippet":""} } from "svelte";`:`import { SvelteComponentTyped${Os?", type Snippet":""} } from "svelte";`,sn?`import type { ${sn} } from "svelte/elements";`:"",si,Nh({extends:Ht})].filter(Boolean).join(`
|
|
133
|
+
`),Ac=Xt?zn?$h({moduleName:Ot,generic:ln,propsRef:cn,exportsRef:Wi,bindings:ho,...un?{eventsRef:On}:{}}):_h({moduleName:Ot,propsRef:cn,exportsRef:Wi,bindings:ho}):Fh({moduleName:Ot,generic:ln,genericProps:cn,events:Ua({events:Wt}),slots:bh({slots:Vt}),accessors:Za({props:Gt})}),Pc=[Bn,yn,Gi,Zt,tn,Ui,un,[Dh({componentComment:qt}),Ac].filter(Boolean).join(`
|
|
134
|
+
`)].map((Ls)=>Ls.trim()).filter(Boolean).join(`
|
|
135
|
+
|
|
136
|
+
`);return Ba([kc,Pc].filter(Boolean).join(`
|
|
137
|
+
|
|
138
|
+
`))}var Vh=[...hi,".svelte"];function Gh(Z){let ee=Z.trim();if(ee.length<2)return;let Le=ee[0],Ot=ee[ee.length-1];if((Le==='"'||Le==="'"||Le==="`")&&Le===Ot)return ee.slice(1,-1);return}function np(Z){let ee=[],Le=Z.moduleExports.filter((Bt)=>Bt.kind==="re-export");if(Le.length===0)return ee;let Ot=new Set([mi(Z.moduleName),Ri(Z.moduleName)]);for(let Bt of Le){if(!Ot.has(Bt.name))continue;ee.push(a({component:Z.filePath,kind:"module-export-conflict",name:Bt.name,message:`Re-export "${Bt.name}" has the same name as the generated "${Bt.name}" type; the .d.ts won't type-check if "${Bt.reExport?.from}" exports a type by that name.`,source:Bt.source}))}return ee}function ip(Z,ee,Le){let Ot=new Map(Array.from(Z.values()).map((Bt)=>[ee(Bt.filePath),Bt]));return(Bt)=>{let jt=Bt.extends;if(!jt)return[];let Gt=Gh(jt.import);if(Gt===void 0||!Gt.startsWith(".")&&!Gt.startsWith("/"))return[];let Lt=ee(Bt.filePath),Vt=Le.resolve(Gt,jh(Lt),Vh);if(Vt===null)return[a({component:Bt.filePath,kind:"extend-props-target-missing",name:jt.interface,message:`@extends/@extendProps target "${Gt}" was not found on disk.`})];let Wt=Ot.get(Vt);if(!Wt)return[];let Kt=mi(Wt.moduleName);if(_r(jt.interface)!==Kt)return[a({component:Bt.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 Bt.props){let zt=Wt.props.find((Xt)=>Xt.name===qt.name);if(zt&&zt.type!==qt.type){let Xt=a({component:Bt.filePath,kind:"extend-props-override",name:qt.name,message:`Own prop "${qt.name}" (${qt.type}) overrides "${Kt}"'s "${qt.name}" (${zt.type}).`,source:qt.source}),Jt=fo(Bt)?.[qt.name]?.some((tn)=>tn===""||tn===Xt.code);Ht.push(Jt?{...Xt,ignored:!0}:Xt)}}return Ht}}import{lstatSync as cd,readFileSync as ld,realpathSync as ud,statSync as hd}from"node:fs";import{dirname as dd,isAbsolute as fd,join as Sp,parse as md,relative as Gr,resolve as Oi}from"node:path";function Q(Z){return Z}function $n(Z){if(Z==="")return Z;return Z==="."||Z===".."||Z.startsWith("./")||Z.startsWith("../")?Z:`./${Z}`}import{readFileSync as vp}from"node:fs";import{dirname as jr,join as ad,relative as gp,resolve as yp}from"node:path";import{readFileSync as Qh,statSync as Zh}from"node:fs";import{basename as Br,dirname as Ss,isAbsolute as ed,join as td,resolve as nd}from"node:path";import{existsSync as op,readdirSync as Wh}from"node:fs";import{dirname as sp,join as ap,resolve as Uh}from"node:path";function V(Z,ee){for(let Le=Uh(Z);;Le=sp(Le)){for(let Ot of ee){let Bt=ap(Le,Ot);if(op(Bt))return Bt}if(sp(Le)===Le)return null}}function rp(Z){return Z.normalize("NFC").toLowerCase()}class Rr{listings=new Map;clear(){this.listings.clear()}entries(Z){return this.read(Z)?.entries??null}entry(Z,ee){let Le=this.read(Z);if(Le===null)return;if(Le.byName===void 0){Le.byName=new Map;for(let Ot of Le.entries)Le.byName.set(Ot.name,Ot)}return Le.byName.get(ee)}has(Z,ee){let Le=this.read(Z);if(Le===null)return!1;if(Le.names.has(ee))return!0;if(Le.folded===void 0){Le.folded=new Map;for(let Bt of Le.names)Le.folded.set(rp(Bt),Bt)}let Ot=Le.folded.get(rp(ee));return Ot!==void 0&&Ot!==ee&&op(ap(Z,ee))}read(Z){let ee=this.listings.get(Z);if(ee!==void 0)return ee;try{let Le=Wh(Z,{withFileTypes:!0}),Ot=new Set;for(let Bt of Le)Ot.add(Bt.name);ee={entries:Le,names:Ot}}catch{ee=null}return this.listings.set(Z,ee),ee}}var Ir=!1;function q(Z){Ir=Z}function Fn(Z){if(!Ir)console.error(Z)}function pp(Z){if(!Ir)console.error(Z)}function xe(Z){if(Z instanceof e)return Z.start?`${Z.reason} (${Z.start.line}:${Z.start.column})`:Z.reason;return Z instanceof Error?Z.message:String(Z)}var Ii=null,Or=null;function Un(){if(Ii)return Promise.resolve(Ii);if(!Or)Or=import("./chunk-dmh6cpfa.js").then((Z)=>(Ii=Z,Z));return Or}function Nn(){if(!Ii)throw Error("sveld: internal error, parser stack read before loadParserStack() resolved.");return Ii}import{existsSync as Lr,readFileSync as Kh}from"node:fs";import{dirname as dp,isAbsolute as fp,relative as Hh,resolve as Mr}from"node:path";function cp(Z){if(!r(Z))return{};let ee={};if(typeof Z.svelte==="string")ee.svelte=Z.svelte;if(typeof Z.name==="string")ee.name=Z.name;if(typeof Z.description==="string")ee.description=Z.description;return ee}function lp(Z){if(!r(Z))return{};let ee={};if(typeof Z.extends==="string")ee.extends=Z.extends;if(r(Z.compilerOptions)){let Le={};if(typeof Z.compilerOptions.baseUrl==="string")Le.baseUrl=Z.compilerOptions.baseUrl;if(r(Z.compilerOptions.paths)){let Ot={};for(let[Bt,jt]of Object.entries(Z.compilerOptions.paths))if(Array.isArray(jt)&&jt.every((Gt)=>typeof Gt==="string"))Ot[Bt]=jt;if(Object.keys(Ot).length>0)Le.paths=Ot}if(Object.keys(Le).length>0)ee.compilerOptions=Le}return ee}var qh=["tsconfig.json","jsconfig.json"],up=new Map,zh=/\/\*[\s\S]*?\*\/|\/\/.*/g,Xh=[".svelte",...hi];class G extends Error{specifier;fromFile;searched;constructor(Z,ee,Le){super(`cannot resolve "${Z}" from ${ee||"."} (${Le})`);this.name="UnresolvedModuleError",this.specifier=Z,this.fromFile=ee,this.searched=Le}}function Jh(Z){if(Lr(Z))return!0;return Xh.some((ee)=>Lr(Z+ee))}function hp(Z){let ee=Z.indexOf("*");return ee===-1?Z.length:ee}function mp(Z,ee){if(ee.has(Z))return ee.get(Z)??null;try{let Le=Kh(Z,"utf-8"),Ot;try{Ot=JSON.parse(Le)}catch{let jt=Le.replace(zh,"");Ot=JSON.parse(jt)}let Bt=lp(Ot);if(Bt.extends){let jt=fp(Bt.extends)?Bt.extends:Mr(dp(Z),Bt.extends),Gt=jt.endsWith(".json")?jt:`${jt}.json`;if(Lr(Gt)){let Lt=mp(Gt,ee);if(Lt)Bt.compilerOptions={...Lt.compilerOptions,...Bt.compilerOptions,paths:{...Lt.compilerOptions?.paths,...Bt.compilerOptions?.paths}}}}return ee.set(Z,Bt),Bt}catch{return ee.set(Z,null),null}}function Yh(Z){let ee=up.get(Z);if(!ee){let Le=Z.split("*").map(N).join("(.*)");ee=new RegExp(`^${Le}$`),up.set(Z,ee)}return ee}class Fr{configs=new Map;lookup(Z,ee){if(Z.startsWith(".")||fp(Z))return{resolved:Z,unresolved:!1,searched:""};let Le=V(ee,qh),Ot=Le?mp(Le,this.configs)?.compilerOptions:void 0,Bt=Ot?.paths;if(!Le||!Ot||!Bt)return{resolved:Z,unresolved:!0,searched:"no tsconfig/jsconfig paths found"};let jt=Mr(dp(Le),Ot.baseUrl??"."),Gt=Object.entries(Bt).sort(([Lt],[Vt])=>hp(Vt)-hp(Lt));for(let[Lt,Vt]of Gt){let Wt=Z.match(Yh(Lt));if(!Wt)continue;let Kt;for(let Ht of Vt){let qt=Ht;for(let Xt=1;Xt<Wt.length;Xt++)qt=qt.replace("*",Wt[Xt]);let zt=Mr(jt,qt);if(Kt??=zt,Jh(zt))return{resolved:zt,unresolved:!1,searched:Le}}return{resolved:Kt??Z,unresolved:!1,searched:Le}}return{resolved:Z,unresolved:!0,searched:`tsconfig paths (${Le})`}}absolute(Z,ee){return this.lookup(Z,ee).resolved}relative(Z,ee){let Le=this.absolute(Z,ee);if(Le===Z)return Z;return $n(n(Hh(ee,Le)))}}var id=/\.[mc]?jsx?$/,sd={".js":[".ts",".tsx",".d.ts"],".jsx":[".tsx",".d.ts"],".mjs":[".mts",".d.mts"],".cjs":[".cts",".d.cts"]};function rd(Z){return Z==="."||Z===".."||Z.startsWith("./")||Z.startsWith("../")||ed(Z)}class Kn{aliases=new Fr;listings=new Rr;modules=new Map;programs=new Map;listDirectory(Z){return this.listings.entries(Z)}exists(Z){return this.listings.has(Ss(Z),Br(Z))}resolve(Z,ee,Le=hi){let Ot=this.aliases.absolute(Z,ee);if(Ot===Z&&!rd(Z))return null;let Bt=nd(ee,Ot),jt=Ss(Bt),Gt=Br(Bt),Lt=this.listings.has(jt,Gt),Vt;if(Lt){let Wt=this.listings.entry(jt,Gt);if(Vt=Wt&&!Wt.isSymbolicLink()?Wt:Zh(Bt,{throwIfNoEntry:!1}),Vt?.isFile())return Bt}for(let Wt of Le)if(this.listings.has(jt,Gt+Wt))return Bt+Wt;if(!Lt)return this.typeScriptCounterpart(Bt)??null;if(Vt?.isDirectory()){for(let Wt of Le)if(this.listings.has(Bt,`index${Wt}`))return td(Bt,`index${Wt}`)}return null}parse(Z){let ee=this.modules.get(Z);if(ee===void 0)ee=od(Z),this.modules.set(Z,ee);return ee}parseJavaScript(Z,ee){let Le=this.programs.get(Z);if(Le?.source===ee)return Le.ast;let Ot;try{Ot=me(ee)}catch(Bt){throw Error(xe(Bt))}return this.programs.set(Z,{source:ee,ast:Ot}),Ot}invalidate(...Z){this.listings.clear();for(let ee of Z)this.modules.delete(ee),this.programs.delete(ee)}typeScriptCounterpart(Z){let ee=id.exec(Z)?.[0];if(ee===void 0)return;let Le=Z.slice(0,-ee.length),Ot=Ss(Le),Bt=Br(Le);for(let jt of sd[ee]??[])if(this.listings.has(Ot,Bt+jt))return Le+jt;return}}function od(Z){let ee;try{ee=Qh(Z,"utf-8")}catch{return null}try{let Le=Z.endsWith(".svelte")?Nn().parseSvelteScripts(ee).module?.content.body??[]:Nn().parseModule(ee,{typescript:!0}).body;return{source:{text:ee,filePath:Z,dir:Ss(Z)},body:Le}}catch(Le){return pp(`Warning: sveld couldn't parse ${Z} to read its exports (${xe(Le)}); skipping it.`),null}}function xp(Z){return Z.type==="Identifier"?Z.name:Z.value}function pd(Z,ee,Le,Ot){let Bt=Z.resolve(ee,Le);if(!Bt)return null;let jt=jr(Bt);if(Ot.has(Bt))return{dir:jt,exports:{}};Ot.add(Bt);try{return{dir:jt,exports:Vr(Z,vp(Bt,"utf-8"),jt,Ot,Bt)}}catch{return{dir:jt,exports:{}}}finally{Ot.delete(Bt)}}function Ep(Z,ee,Le=new Kn,Ot=new Set,Bt=ee){return Vr(Le,Z,ee,Ot,Bt)}function Vr(Z,ee,Le,Ot,Bt){let jt=Z.parseJavaScript(Bt,ee),Gt={};for(let Lt of jt.body)if(Lt.type==="ExportDefaultDeclaration"){if(Lt.declaration.type!=="Identifier")continue;let Vt=Lt.declaration.name;if(Vt in Gt)Gt[Vt].default=!0;else Gt[Vt]={source:$n(""),default:!0}}else if(Lt.type==="ExportAllDeclaration"){let Vt=Lt.source.value,Wt=Z.resolve(Vt,Le);if(!Wt){let zt=Z.aliases.lookup(Vt,Le);throw new G(Vt,Bt,zt.unresolved?zt.searched:"no matching file or index found")}if(Ot.has(Wt))continue;Ot.add(Wt);let Kt=vp(Wt,"utf-8"),Ht=Vr(Z,Kt,jr(Wt),Ot,Wt);Ot.delete(Wt);let qt=Object.entries(Ht);if(qt.length===0&&!Pn.test(Vt)){let zt=$n(n(Vt));Gt[`*:${Vt}`]={source:zt,default:!1,star:!0}}for(let[zt,Xt]of qt){let Yt=$n(n(Xt.source.startsWith(".")?`./${gp(Le,yp(jr(Wt),Xt.source))}`:`./${ad(Vt,Xt.source)}`));Gt[zt]={...Xt,source:Yt}}}else if(Lt.type==="ExportNamedDeclaration"){let Vt=Lt.source?.value,Wt=Vt!==void 0&&Pn.test(Vt);if(Wt){let qt=Z.aliases.lookup(Vt,Le);if(qt.unresolved)throw new G(Vt,Bt,qt.searched)}let Ht=Vt!==void 0&&!Wt?pd(Z,Vt,Le,Ot):void 0;if(Ht===null){console.warn(`sveld: could not resolve re-exported module "${Vt}" from barrel "${Le||"."}"; skipping.`);continue}for(let qt of Lt.specifiers){let zt=xp(qt.exported),Xt=xp(qt.local),Yt=zt||Xt,Jt=Ht?.exports[Xt],tn=Jt?$n(n(`./${gp(Le,yp(Ht.dir,Jt.source))}`)):$n(Z.aliases.relative(Vt??"",Le)),sn=Jt?Jt.default:Xt==="default";if(Yt in Gt){if(Gt[Yt].mixed=!0,!Gt[Yt].source)Gt[Yt].source=tn}else Gt[Yt]={source:tn,default:sn}}}else if(Lt.type==="ImportDeclaration"){let Vt=Lt.specifiers[0];if(!Vt)continue;let Wt=Vt.local.name,Kt=$n(Z.aliases.relative(Lt.source.value,Le));if(Wt in Gt){if(!Gt[Wt].source)Gt[Wt].source=Kt}else Gt[Wt]={source:Kt,default:Wt==="default"}}return Gt}var gd=/-/g,yd=/[^A-Za-z0-9_$]/g,xd=/^[0-9]/;function vd(Z,ee){let Le=Z.replace(yd,""),Ot=xd.test(Le)?`_${Le}`:Le;if(Ot!==Z&&!ee?.has(Z))ee?.add(Z),console.warn(`Warning: "${Z}" is not a valid identifier; using "${Ot}" instead.`);return Ot}function Cp(Z,ee){return vd(md(Z).name.replace(gd,""),ee)}function bp(Z,ee,Le=[],Ot=new Set,Bt){let jt;try{jt=Bt??ud(ee)}catch{return Le}if(Ot.has(jt))return Le;Ot.add(jt);let Gt=Z.listDirectory(ee);if(Gt===null)return Le;for(let Lt of Gt){if(Lt.name.startsWith("."))continue;let Vt=Sp(ee,Lt.name),Wt=Lt.isSymbolicLink(),Kt=Wt?hd(Vt,{throwIfNoEntry:!1}):Lt;if(!Kt)continue;if(Kt.isDirectory())bp(Z,Vt,Le,Ot,Wt?void 0:Sp(jt,Lt.name));else if(Kt.isFile()&&Lt.name.endsWith(".svelte"))Le.push(Vt)}return Le}function Ed(Z,ee){return bp(Z,ee).map((Le)=>({moduleName:Cp(Le),source:$n(n(`./${Gr(ee,Le)}`))})).sort((Le,Ot)=>u(Le.source,Ot.source))}function Sd(Z){return!di(Z)}function Cd(Z,ee){let Le=Z.endsWith("/")?Z:`${Z}/`;return ee.startsWith(Le)}function Cs(Z,ee){return{seenPaths:new Set(Z.map(([,Le])=>ee(Le.source))),seenModuleNamePaths:new Map(Z.map(([Le,Ot])=>[Le,ee(Ot.source)])),warnedModuleNames:new Set}}function Wr(Z,ee,Le,Ot,Bt,jt){for(let{moduleName:Gt,source:Lt}of Ed(Z,ee)){let Vt=Bt(Lt),Wt=Le[Gt];if(Wt&&Sd(Wt.source)&&Cd(Wt.source,Lt)){jt.seenPaths.delete(Bt(Wt.source)),Wt.source=Lt,jt.seenPaths.add(Vt),jt.seenModuleNamePaths.set(Gt,Vt);continue}if(jt.seenPaths.has(Vt))continue;jt.seenPaths.add(Vt);let Kt=jt.seenModuleNamePaths.get(Gt);if(Kt===void 0)jt.seenModuleNamePaths.set(Gt,Vt);else if(Kt!==Vt&&!jt.warnedModuleNames.has(Gt))jt.warnedModuleNames.add(Gt),console.warn(`Warning: multiple components named "${Gt}" found (${n(Gr(ee,Kt))} and ${n(Gr(ee,Vt))}). Both are included in TypeScript definitions, but only one can be the named export.`);Ot.push([Gt,{source:Lt,default:!1}])}}function Ur(Z,ee,Le,Ot){let Bt=cd(Z).isFile(),jt=Bt?dd(Z):Z,Gt=Oi(jt),Lt=new Map,Vt=(Ht)=>{let qt=Lt.get(Ht);if(qt===void 0)qt=fd(Ht)?Oi(Ht):Oi(Gt,Ht),Lt.set(Ht,qt);return qt},Wt={};if(Bt){let Ht=ld(Z,"utf-8");try{Wt=Ep(Ht,Gt,Ot,new Set([Oi(Z)]),Oi(Z))}catch(qt){if(!Le)throw qt;let zt=qt instanceof Error?qt.message:String(qt);console.warn(`Warning: Failed to parse component exports from ${Z}: ${zt}`)}}let Kt=Object.entries(Wt);if(ee){let Ht=Cs(Kt,Vt);if(Wr(Ot,Gt,Wt,Kt,Vt,Ht),!Bt)Wt=Object.fromEntries(Kt.map(([qt,zt])=>[qt,{...zt,default:!0}]))}return{exports:Wt,allComponentEntries:Kt,rootDir:Gt,resolveComponentFilePath:Vt}}function wp(Z,ee,Le,Ot){if(Le!==1||Z!=="default")return Z;return Cp(ee,Ot)}import{dirname as sf}from"node:path";import{resolve as bd}from"node:path";var wd=/\r?\n/,Td=/^\s*\*+/;function bs(Z){return{graph:Z,cache:new Map,computing:new Set}}function gn(Z){return Z?.type==="Identifier"?Z.name:void 0}function kd(Z){let ee=Z.trimEnd();for(;;){let Le=ee.lastIndexOf(`
|
|
139
|
+
`)+1;if(ee.slice(Le).trimStart().startsWith("//")){ee=ee.slice(0,Le).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 Ad(Z,ee){let Le=kd(Z.slice(0,ee));if(!Le.endsWith("*/"))return;let Ot=Le.length-2,Bt=Le.lastIndexOf("/**",Ot);if(Bt===-1)return;return Le.slice(Bt,Ot+2)}function Pd(Z){let ee=[];for(let Le of Z.slice(3,-2).split(wd)){let Ot=Le.replace(Td,"").trim();if(Ot.startsWith("@"))break;if(Ot)ee.push(Ot)}return ee.join(" ")||void 0}function ti(Z,ee){if(!ee)return;return Z.text.slice(ee.start,ee.end)}function _d(Z,ee){return"typeAnnotation"in ee?ti(Z,ee.typeAnnotation?.typeAnnotation):void 0}function kp(Z,ee){return ti(Z,ee.returnType?.typeAnnotation)}function Kr(Z,ee,Le){return`(${ee.params.map((Bt)=>ti(Z,Bt)??"").join(", ")}) => ${kp(Z,ee)??Le??"any"}`}function Ap(Z){if(Z.type==="Literal"){let ee=Z.value;if(typeof ee==="string")return"string";if(typeof ee==="number")return"number";if(typeof ee==="boolean")return"boolean"}if(Z.type==="TemplateLiteral")return"string";if(Z.type==="UnaryExpression"&&(Z.operator==="-"||Z.operator==="+"))return Z.argument.type==="Literal"&&typeof Z.argument.value==="number"?"number":void 0;if(Z.type==="CallExpression"&&Z.callee.type==="Identifier")return $d[Z.callee.name];return}var $d={String:"string",Number:"number",Boolean:"boolean"};function Pp(Z){if(Z.type==="Literal"){let ee=Z.value;return typeof ee==="string"||typeof ee==="number"||typeof ee==="boolean"?ee:void 0}if(Z.type==="UnaryExpression"&&Z.operator==="-"){let ee=Z.argument;return ee.type==="Literal"&&typeof ee.value==="number"?-ee.value:void 0}return Z.type==="TemplateLiteral"?C(Z)??void 0:void 0}function Nd(Z,ee){let Le=ti(Z,ee),Ot=Pp(ee);if(Le===void 0||Ot===void 0)return;return{raw:Le,value:Ot,type:typeof Ot}}function Dd(Z,ee){if(Z.type!=="CallExpression"&&Z.type!=="NewExpression")return;let Le=Z.callee;if(!(gn(Le)==="Symbol"||Le.type==="MemberExpression"&&!Le.computed&&gn(Le.object)==="Symbol"&&gn(Le.property)==="for"))return;let[Bt]=Z.arguments;return(Bt?.type==="Literal"&&typeof Bt.value!=="string"?null:C(Bt))||ee}var Rd=new Set(["any","bigint","boolean","false","never","null","number","object","readonly","string","symbol","true","undefined","unknown","void"]),Id=/"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'/g,Od=/(?<![\w$.])[A-Za-z_$][\w$]*(?![\w$]|\s*\??:)/g;function Ld(Z,ee){let Le=ee?Nn().extractJsDocType(ee):void 0,Ot=Z?{type:Z,source:"typescript"}:Le?{type:Le,source:"jsdoc"}:void 0;if(!Ot||Ot.type.includes("`"))return;return(Ot.type.replace(Id,'""').match(Od)??[]).every((jt)=>Rd.has(jt))?Ot:void 0}function _p(Z){if(Z.async||Z.generator||Z.type==="TSDeclareFunction")return;let ee=Z.body,Le=ee.type==="BlockStatement"?Y(ee):[ee];if(Le.length===0)return;let Ot;for(let Bt of Le){if(!Bt)return;let jt=Ap(Bt);if(!jt)return;if(Ot===void 0)Ot=jt;else if(Ot!==jt)return}return Ot}function Md(Z){if(Z.type==="TemplateLiteral")return;let ee=Pp(Z);return typeof ee==="boolean"?void 0:ee}function Fd(Z){let ee=Z.members;if(ee.length===0)return;let Le=[],Ot=0;for(let Bt of ee){if(!Bt.initializer){Le.push(String(Ot)),Ot+=1;continue}let jt=Md(Bt.initializer);if(jt===void 0)return;Le.push(typeof jt==="string"?JSON.stringify(jt):String(jt)),Ot=typeof jt==="number"?jt+1:Ot}return Le.join(" | ")}function Hr(Z,ee,Le,Ot){let Bt=Ad(Z.text,Le),jt=Bt?Pd(Bt):void 0,Gt=Bt?Nn().extractJsDocReturnType(Bt):void 0,{deprecated:Lt,tags:Vt,internal:Wt}=Bt?Nn().extractJsDocDeprecatedAndTags(Bt):{deprecated:void 0,tags:void 0,internal:!1},Kt={description:jt,deprecated:Lt,tags:Vt,...Wt?{internal:!0}:{},declFile:Z.filePath},Ht=(zt,Xt,Yt=!1)=>zt?[{name:zt,...Xt,...Kt,isTypeOnly:Yt}]:[],qt=(zt,Xt)=>kp(Z,zt)??Gt??re(Xt)??_p(zt);if(ee.type==="VariableDeclaration"){let zt=ee.kind==="let"||ee.kind==="var"?ee.kind:"const";return ee.declarations.flatMap((Xt)=>{let Yt=Xt.id,Jt=gn(Yt);if(!Jt)return[];let tn=_d(Z,Yt),sn=tn,ln,cn,un,On,zn,Bn,yn=Xt.init;if(yn)if(yn.type==="ArrowFunctionExpression"||yn.type==="FunctionExpression"){if(Bn=yn,cn=qt(yn,sn),!sn)sn=Kr(Z,yn,cn)}else{if(ln=ti(Z,yn),!sn)sn=Ap(yn);let Zt=T(yn);if(un=C(Zt)??Dd(Zt,Jt),zt==="const")On=Nd(Z,Zt),zn=Ld(tn,Bt)}return Ht(Jt,{kind:zt,type:sn,value:ln,returnType:cn,literalValue:un,primitiveLiteral:On,declaredType:zn,functionNode:Bn})})}if(ee.type==="FunctionDeclaration"||ee.type==="TSDeclareFunction"){let zt=qt(ee);return Ht(gn(ee.id)??Ot,{kind:"function",type:Kr(Z,ee,zt),returnType:zt,...ee.type==="FunctionDeclaration"?{functionNode:ee}:{}})}if(ee.type==="ClassDeclaration"){let zt=gn(ee.id);return Ht(zt??Ot,{kind:"class",...zt?{type:zt}:{}})}if(ee.type==="TSTypeAliasDeclaration")return Ht(gn(ee.id),{kind:"type",type:ti(Z,ee.typeAnnotation)},!0);if(ee.type==="TSInterfaceDeclaration")return Ht(gn(ee.id),{kind:"interface",type:ti(Z,ee.body)},!0);if(ee.type==="TSEnumDeclaration"){let zt=gn(ee.id);return Ht(zt,{kind:"enum",type:Fd(ee)??zt})}return[]}function Bd(Z,ee,Le){let Ot=ee.declaration;if(Ot.type==="FunctionDeclaration"||Ot.type==="TSDeclareFunction"||Ot.type==="ClassDeclaration"){let[Gt]=Hr(Z,Ot,ee.start,"default");return Gt?{...Gt,name:"default"}:void 0}if(Ot.type==="FunctionExpression"||Ot.type==="ArrowFunctionExpression")return{name:"default",kind:"function",type:Kr(Z,Ot,_p(Ot)),functionNode:Ot,declFile:Z.filePath,isTypeOnly:!1};let Bt=gn(Ot),jt=Bt?Le(Bt):null;return jt?{...jt,name:"default"}:void 0}function jd(Z,ee){for(let Le of Z){if(Le.type!=="ImportDeclaration")continue;let Ot=Le.source.value;for(let Bt of Le.specifiers){if(Bt.local.name!==ee)continue;let jt=Le.importKind==="type"||Bt.type==="ImportSpecifier"&&Bt.importKind==="type";if(Bt.type==="ImportDefaultSpecifier")return{specifier:Ot,importedName:"default",isTypeOnly:jt};if(Bt.type==="ImportNamespaceSpecifier")return{specifier:Ot,importedName:"*",isTypeOnly:jt};if(Bt.type==="ImportSpecifier"){let Gt=gn(Bt.imported)??ee;return{specifier:Ot,importedName:Gt,isTypeOnly:jt}}}}return null}function Tp(Z,ee,Le){return{name:Z,kind:"const",declFile:ee,namespaceFile:ee,isTypeOnly:Le}}function ws(Z,ee){let Le=ee.cache.get(Z);if(Le)return Le;if(ee.computing.has(Z))return[];ee.computing.add(Z);let Ot=ee.graph.parse(Z);if(!Ot)return ee.computing.delete(Z),ee.cache.set(Z,[]),[];let{source:Bt,body:jt}=Ot,Gt=[],Lt=new Map;for(let qt of jt){let zt=qt.type==="ExportNamedDeclaration"?qt.declaration:qt;if(!zt)continue;for(let Xt of Hr(Bt,zt,zt.start))Lt.set(Xt.name,Xt)}let Vt=(qt,zt)=>({name:qt,kind:"const",declFile:bd(Bt.dir,zt),isTypeOnly:!1}),Wt=(qt)=>{let zt=Lt.get(qt);if(zt)return zt;let Xt=jd(jt,qt);if(!Xt)return null;if(Xt.specifier.endsWith(".svelte"))return Vt(qt,Xt.specifier);let Yt=ee.graph.resolve(Xt.specifier,Bt.dir);if(!Yt)return null;if(Xt.importedName==="*")return Tp(qt,Yt,Xt.isTypeOnly);return ni(Yt,Xt.importedName,ee)??null},Kt=new Map;for(let qt of jt){if(qt.type==="ExportAllDeclaration"){let Jt=qt.source.value;if(Jt.endsWith(".svelte"))continue;let tn=ee.graph.resolve(Jt,Bt.dir);if(!tn)continue;let sn=qt.exportKind==="type",ln=gn(qt.exported);if(ln){Gt.push(Tp(ln,tn,sn));continue}for(let cn of ws(tn,ee)){let un=Kt.get(cn.name)??[];un.push(sn?{...cn,isTypeOnly:!0}:cn),Kt.set(cn.name,un)}continue}if(qt.type==="ExportDefaultDeclaration"){let Jt=Bd(Bt,qt,Wt);if(Jt)Gt.push(Jt);continue}if(qt.type!=="ExportNamedDeclaration")continue;let zt=qt.declaration;if(zt){Gt.push(...Hr(Bt,zt,qt.start));continue}let Xt=qt.source?.value;if(Xt?.endsWith(".svelte")){for(let Jt of qt.specifiers){let tn=gn(Jt.exported);if(tn)Gt.push(Vt(tn,Xt))}continue}let Yt=qt.exportKind==="type";for(let Jt of qt.specifiers){let tn=gn(Jt.exported),sn=gn(Jt.local);if(!tn||!sn)continue;let ln=Yt||Jt.exportKind==="type",cn=null;if(Xt){let un=ee.graph.resolve(Xt,Bt.dir);if(un)cn=ni(un,sn,ee)??null}else cn=Wt(sn);if(cn)Gt.push({...cn,name:tn,isTypeOnly:cn.isTypeOnly||ln});else if(sn!=="default")Gt.push({name:tn,kind:ln?"type":"const",declFile:Z,isTypeOnly:ln})}}let Ht=new Set(Gt.map((qt)=>qt.name));for(let[qt,zt]of Kt){if(Ht.has(qt)||qt==="default")continue;if(zt.every((Xt)=>Xt.declFile===zt[0].declFile))Gt.push(...zt);else ee.onAmbiguousStarExport?.(Z,qt,zt)}return ee.computing.delete(Z),ee.cache.set(Z,Gt),Gt}function ni(Z,ee,Le){return ws(Z,Le).findLast((Ot)=>Ot.name===ee)}function gi(Z,{importedName:ee,members:Le=[]},Ot){let Bt=ni(Z,ee,Ot);for(let jt of Le){if(Bt?.namespaceFile===void 0)return;Bt=ni(Bt.namespaceFile,jt,Ot)}return Bt}function Hn(Z,ee,Le){if(Z[ee]===void 0)delete Z[ee];Z[ee]=Le}function Ts(Z,ee){return(ee.location==="props"?Z.props:Z.moduleExports).find((Ot)=>Ot.name===ee.propName)}function ks(Z,ee){if(ee.location!=="props")return;Z.diagnostics=(Z.diagnostics??[]).filter((Le)=>!(Le.kind==="prop-unknown-type"&&Le.name===ee.propName))}var Vd=/\.[^./\\]+$/;function Gd(Z,ee){if(Z.endsWith(".d.ts"))return null;let Le=Z.replace(Vd,".d.ts");return ee.exists(Le)?Le:null}function Wd(Z,ee,Le){return ee.map((Ot)=>{if(!Ot.importSource||!Ot.importedName)return{candidate:Ot};let Bt=Le.graph.resolve(Ot.importSource,Z);if(!Bt)return{candidate:Ot,failureReason:"module-not-found"};let jt=ni(Bt,Ot.importedName,Le);if(!jt)return{candidate:Ot,failureReason:"export-not-found"};if(jt.returnType)return{candidate:Ot,type:jt.returnType};let Gt=Gd(Bt,Le.graph);if(Gt){let Lt=ni(Gt,Ot.importedName,Le);if(Lt?.returnType)return{candidate:Ot,type:Lt.returnType}}return{candidate:Ot,failureReason:"return-type-unresolved"}})}function Ud(Z,ee){switch(ee){case"module-not-found":return`Prop "${Z.propName}" default calls "${Z.calleeName}()", but "${Z.importSource}" could not be resolved; falling back to "any".`;case"export-not-found":return`Prop "${Z.propName}" default calls "${Z.calleeName}()", but "${Z.importedName}" is not exported from "${Z.importSource}"; falling back to "any".`;case"return-type-unresolved":return`Prop "${Z.propName}" default calls "${Z.calleeName}()" imported from "${Z.importSource}", but its return type could not be resolved; falling back to "any".`}}function Kd(Z,ee){for(let{candidate:Le,type:Ot,failureReason:Bt}of ee){let jt=Ts(Z,Le);if(jt?.typeSource!=="unknown")continue;if(Ot){Hn(jt,"type",Ot),Hn(jt,"typeSource","typescript"),ks(Z,Le);continue}if(Le.location==="props"&&Bt){let Gt=Z.diagnostics?.find((Lt)=>Lt.kind==="prop-unknown-type"&&Lt.name===Le.propName);if(Gt)Gt.message=Ud(Le,Bt)}}}var $p={collect:(Z)=>Z.pendingCallDefaultCandidates?.filter((ee)=>ee.importSource!==void 0)??[],resolve:Wd,apply:Kd};function Hd(Z,ee,Le){return ee.map((Ot)=>{let Bt=Le.graph.resolve(Ot.importSource,Z);if(!Bt)return{candidate:Ot};let jt=gi(Bt,Ot,Le);if(!jt?.primitiveLiteral)return{candidate:Ot};return{candidate:Ot,literal:jt.primitiveLiteral,declaredType:jt.declaredType}})}function qd(Z,ee){for(let{candidate:Le,literal:Ot,declaredType:Bt}of ee){if(!Ot)continue;let jt=Ts(Z,Le);if(!jt)continue;if(Hn(jt,"value",Ot.raw),Hn(jt,"defaultValue",{raw:Ot.raw,kind:"literal",value:Ot.value}),jt.typeSource!=="unknown")continue;Hn(jt,"type",Bt?.type??Ot.type),Hn(jt,"typeSource",Bt?.source??"default"),ks(Z,Le)}}var Np={collect:(Z)=>Z.pendingConstDefaultCandidates??[],resolve:Hd,apply:qd};function zd(Z,ee,Le){return ee.map((Ot)=>{let Bt=Le.graph.resolve(Ot.importSource,Z);if(!Bt)return{candidate:Ot};let jt=gi(Bt,Ot,Le);if(jt?.kind!=="const"||jt.literalValue===void 0)return{candidate:Ot};return{candidate:Ot,key:jt.literalValue}})}function Xd(Z,ee){for(let{candidate:Le,key:Ot}of ee){if(!Ot){let Lt=oe(Le);pi(Z,[a({component:Z.filePath,kind:"context-key-unresolved",name:Lt,message:`setContext key \`${Lt}\` from "${Le.importSource}" isn't an \`export const\` string or Symbol() sveld can read; the context is skipped.`,...Le.source?{source:Le.source}:{}})]);continue}let Bt=[...Z.contexts??[]],jt=Bt.findIndex((Lt)=>Lt.key===Ot);if(jt!==-1){let Lt=Bt[jt],Vt=Dp(Lt.source,Le.source),Wt=Vt?Lt.source:Le.source;if(pi(Z,[a({component:Z.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;Bt.splice(jt,1)}let Gt=Bt.findIndex((Lt)=>Dp(Lt.source,Le.source));Bt.splice(Gt===-1?Bt.length:Gt,0,{key:Ot,typeName:J(Ot),...Le.type===void 0?{}:{type:Le.type},description:Le.description,properties:Le.properties,...Le.hasUnresolvedSpread?{hasUnresolvedSpread:!0}:{},...Le.internal?{internal:!0}:{},source:Le.source}),Z.contexts=Bt}}function Dp(Z,ee){if(!Z||!ee)return!1;let{line:Le,column:Ot}=Z.start;return Le>ee.start.line||Le===ee.start.line&&Ot>ee.start.column}var Rp={collect:(Z)=>Z.pendingContextKeyCandidates??[],resolve:zd,apply:Xd};function Jd(Z,ee,Le){return ee.map((Ot)=>{let Bt=Le.graph.resolve(Ot.importSource,Z);if(!Bt)return{candidate:Ot,failureReason:"module-not-found"};let jt=gi(Bt,Ot,Le)?.functionNode;if(!jt)return{candidate:Ot,failureReason:"not-a-function"};let Gt=Yd(jt,Ot);if(!Gt)return{candidate:Ot,failureReason:"parameter-not-found"};return ef(jt,Gt,Ot)})}function Ip(Z){return Z?.type==="AssignmentPattern"?Z.left:Z}function Yd(Z,ee){let Le=Ip(Z.params[ee.argumentIndex]);if(ee.property===void 0)return Le?.type==="Identifier"?{name:Le.name}:void 0;if(!ee.property)return;if(Le?.type==="Identifier")return{object:Le.name,property:ee.property};if(Le?.type!=="ObjectPattern")return;for(let Ot of Le.properties){if(Ot.type!=="Property"||Ot.computed)continue;if(Ot.key.type!=="Identifier"||Ot.key.name!==ee.property)continue;let Bt=Ip(Ot.value);return Bt?.type==="Identifier"?{name:Bt.name}:void 0}return}function qr(Z){if(!Z)return null;if(Z.type==="ConditionalExpression"){let Le=qr(Z.consequent),Ot=qr(Z.alternate);return Le&&Ot?[...Le,...Ot]:null}let ee=C(Z);return ee?[ee]:null}var Qd={variableType:()=>{return}};function Zd(Z){if(!Z)return"null";let{deriveLiteralDetailType:ee,literalDetailToTypeText:Le}=Nn();if(Z.type==="Literal")return Le(Z.value);return ee(Qd,Z)??"any"}function Op(Z,ee){if("name"in ee)return Z.type==="Identifier"&&Z.name===ee.name;if(Z.type!=="MemberExpression"||Z.computed)return!1;return Z.object.type==="Identifier"&&Z.object.name===ee.object&&Z.property.type==="Identifier"&&Z.property.name===ee.property}function ef(Z,ee,Le){let Ot=new Map,Bt="name"in ee?ee.name:ee.object,jt;if(o(Z.body,{enter(Lt,Vt,Wt){if(Lt.type==="CallExpression"){if(!Op(Lt.callee,ee))return;let Ht=Lt.arguments,qt=qr(Ht[0]);if(!qt)return jt="dynamic-event-name",E;for(let zt of qt){let Xt=Ot.get(zt)??new Set;Xt.add(Zd(Ht[1])),Ot.set(zt,Xt)}return}let Kt=Vt?.type==="CallExpression"&&Wt==="callee";if(Lt.type==="MemberExpression"&&Op(Lt,ee)&&!Kt)return jt="passed-on",E;if(Lt.type!=="Identifier"||Lt.name!==Bt)return;if(Kt)return;if(!("name"in ee)&&Vt?.type==="MemberExpression"&&Wt==="object")return;if(!H(Lt,Vt))return;return jt="passed-on",E}}),jt)return{candidate:Le,failureReason:jt};let Gt=Array.from(Ot,([Lt,Vt])=>{let Wt=Array.from(Vt);return{name:Lt,detail:Wt.includes("any")?"any":Wt.join(" | ")}});return{candidate:Le,events:Gt}}function tf(Z,ee){let Le=Z.members?`"${Z.calleeText}"`:Z.importedName==="default"?"the default export":`"${Z.importedName}"`;switch(ee){case"module-not-found":return`"${Z.importSource}" isn't a local module sveld can read`;case"not-a-function":return`${Le} isn't a function declared in "${Z.importSource}"`;case"parameter-not-found":return`no parameter of ${Le} receives it`;case"dynamic-event-name":return"an event name isn't a string literal";case"passed-on":return`${Le} passes it on`}}function nf(Z,ee,{deferredEventNoSourceDiagnostics:Le=[],untypedJsDocEventNames:Ot=[]}){let Bt=new Map,jt=[...Z.diagnostics??[]],Gt=!0;for(let{candidate:zt,events:Xt,failureReason:Yt}of ee){if(Yt){Gt=!1,jt.push(a({component:Z.filePath,kind:"dispatch-escapes",name:zt.dispatcherName,message:`\`${zt.dispatcherName}\` is passed to \`${zt.calleeText}\`, but sveld couldn't read the events it dispatches: ${tf(zt,Yt)}. Document them with @event tags.`,...zt.source?{source:zt.source}:{},...zt.ignored?{ignored:!0}:{}}));continue}for(let Jt of Xt??[]){if(Bt.has(Jt.name))continue;Bt.set(Jt.name,{type:"dispatched",name:Jt.name,detail:Jt.detail,...zt.source?{source:zt.source}:{}})}}if(Gt){for(let zt of Le)if(!Bt.has(zt.name))jt.push(zt)}if(Z.diagnostics=jt,Bt.size===0)return;let Lt=new Map,Vt=new Set;for(let zt of Z.events)if(zt.type==="dispatched")Vt.add(zt.name);else if(!Lt.has(zt.name))Lt.set(zt.name,zt);let Wt=new Set(Ot),Kt=new Map,Ht=[];for(let zt of Bt.values()){if(Vt.has(zt.name)){if(Wt.has(zt.name)&&zt.detail!==void 0)Kt.set(zt.name,zt.detail);continue}let Xt=Lt.get(zt.name);if(!Xt){Ht.push(zt);continue}let Yt=zt.source??Xt.source;Ht.push({type:"dispatched",name:zt.name,detail:Xt.detail??zt.detail,...Xt.description?{description:Xt.description}:{},...Xt.deprecated===void 0?{}:{deprecated:Xt.deprecated},...Xt.tags?{tags:Xt.tags}:{},...Xt.internal?{internal:!0}:{},...Yt?{source:Yt}:{}})}if(Ht.length===0&&Kt.size===0)return;let qt=new Set(Ht.map((zt)=>zt.name));Z.events=[...Z.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 Lp={collect:(Z)=>Z.pendingDispatchEscapeCandidates??[],resolve:Jd,apply:nf};function As(Z){return(ee)=>{let Le=Z.collect(ee);if(Le.length===0)return;return(Ot,Bt,jt)=>Z.apply(Ot,Z.resolve(Bt,Le,jt),ee)}}var rf=[As($p),As(Np),As(Rp),As(Lp)];async function Mp(Z,ee,Le,Ot){let Bt=[];for(let Gt of Z){let Lt=Le(Gt);if(Lt===void 0)continue;let Vt=rf.flatMap((Wt)=>Wt(Lt)??[]);if(Vt.length>0)Bt.push({component:Gt,passes:Vt})}let jt=new Map;if(Bt.length===0)return jt;await Un();for(let{component:Gt,passes:Lt}of Bt){let Vt=bs(Ot),Wt=sf(ee(Gt.filePath));for(let Kt of Lt)Kt(Gt,Wt,Vt);jt.set(Gt.filePath,Array.from(Vt.cache.keys()))}return jt}var of=/^```([\w-]*)\r?\n([\s\S]*?)\r?\n?```$/,af=new Set(["","js","jsx","ts","tsx","javascript","typescript"]),pf=new Set(["svelte","html"]);function cf(Z){let ee=Z.trim();if(ee==="")return null;let Le=ee.match(of);if(Le){let Ot=Le[1].toLowerCase(),Bt=Le[2].trim();if(Bt==="")return null;if(af.has(Ot))return{kind:"compile",code:Bt};if(pf.has(Ot))return{kind:"syntax",code:Bt};return null}if(ee.startsWith("<"))return null;return{kind:"compile",code:ee}}function Fp(Z){if(!Z.isFunction)return"any";return`(${(Z.params??[]).map((Le)=>`${Le.name}${Le.optional?"?":""}: any`).join(", ")}) => any`}function Ps(Z,ee,Le,Ot,Bt){let jt=(Z??[]).filter((Lt)=>Lt.name==="example"),Gt=jt.length>1;return jt.flatMap((Lt,Vt)=>{let Wt=cf(Lt.body);if(Wt===null)return[];return[{id:Gt?`${ee}#${Vt}`:ee,name:Gt?`${Le} (example ${Vt+1})`:Le,type:Ot,code:Wt.code,kind:Wt.kind,...Bt?{source:Bt}:{}}]})}function lf(Z){let ee=[];for(let Le of Z.props)ee.push(...Ps(Le.tags,`prop:${Le.name}`,Le.name,Fp(Le),Le.source));for(let Le of Z.moduleExports)ee.push(...Ps(Le.tags,`export:${Le.name}`,Le.name,Fp(Le),Le.source));for(let Le of Z.slots){let Ot=Le.name??"default";ee.push(...Ps(Le.tags,`slot:${Ot}`,Ot,"any",Le.source))}for(let Le of Z.events)ee.push(...Ps(Le.tags,`event:${Le.name}`,Le.name,"any",Le.source));return ee}function Bp(Z,ee){return Z.flatMap(({component:Le,sources:Ot})=>{let Bt=Ot.filter((jt)=>jt.kind===ee);return Bt.length===0?[]:[{component:Le,sources:Bt}]})}async function uf(Z){let{formatParseError:ee,parseSvelte:Le}=await Un(),Ot=new Map;for(let{component:Bt,sources:jt}of Z){let Gt=[];for(let Lt of jt)try{Le(Lt.code)}catch(Vt){Gt.push(a({component:Bt.filePath,kind:"example-syntax-error",name:Lt.name,message:ee(Vt),...Lt.source?{source:Lt.source}:{}}))}Ot.set(Bt,Gt)}return Ot}async function hf(Z,ee,Le){let Ot=await ee.checkExamples(Z.map(({component:jt,sources:Gt})=>({moduleName:jt.moduleName,filePath:Le(jt.filePath),sources:Gt}))),Bt=new Map;for(let{component:jt,sources:Gt}of Z){let Lt=Ot.get(Le(jt.filePath));if(!Lt||Lt.length===0)continue;let Vt=new Map(Gt.map((Wt)=>[Wt.id,Wt.source]));Bt.set(jt,Lt.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 Bt}async function jp(Z,ee,Le,Ot){let Bt=Array.from(Z,(Wt)=>({component:Wt,sources:lf(Wt)})),jt=ee===!0?Bp(Bt,"compile"):[],Gt=Bp(Bt,"syntax"),Lt=new Map,Vt=(Wt)=>{for(let[Kt,Ht]of Wt)Lt.set(Kt,[...Lt.get(Kt)??[],...Ht])};if(Gt.length>0)Vt(await uf(Gt));if(jt.length>0){let{TypeResolver:Wt}=await import("./chunk-sjga1h52.js"),Kt=await Wt.create(Le);if(!Kt.ok)throw Error(`sveld: \`checkExamples\` ${Kt.message}.`);let Ht=Kt.resolver;try{Vt(await hf(jt,Ht,Ot))}finally{await Ht.dispose()}}return Lt}import{hash as df}from"node:crypto";import{mkdirSync as ff,readFileSync as mf,renameSync as gf,writeFileSync as Vp}from"node:fs";import{dirname as Gp,isAbsolute as yf,join as xf,resolve as zr}from"node:path";var Wp=11,vf=xf("node_modules",".cache","sveld","parse-cache.json"),Ef="040e16f5b09e02c0";function Up(){return`${ls}+${Ef}+svelte@${_i}`}function Sf(Z){let ee=V(Z,["package.json"]);return ee===null?zr(Z):Gp(ee)}function Kp(Z,ee){let Le=Sf(Z);if(typeof ee==="string")return yf(ee)?ee:zr(Le,ee);return zr(Le,vf)}function _s(Z){return df("sha256",Z,"hex")}function Xr(){return{formatVersion:Wp,toolchainVersion:Up(),entries:{}}}function Cf(Z){try{let ee=JSON.parse(mf(Z,"utf-8"));if(ee.formatVersion!==Wp||ee.toolchainVersion!==Up())return Xr();return ee}catch{return Xr()}}class Jr{cacheFilePath;file;next=new Map;dirty=!1;savedEntryCount;constructor(Z){this.cacheFilePath=Z,this.file=Cf(Z),this.savedEntryCount=Object.keys(this.file.entries).length}has(Z,ee){return this.lookup(Z,ee)!==void 0}lookup(Z,ee){let Le=this.next.get(Z);if(Le?.hash===ee)return Le;let Ot=this.file.entries[Z];return Ot?.hash===ee?Ot:void 0}get(Z,ee){let Le=this.lookup(Z,ee);if(Le===void 0)return null;this.next.set(Z,Le);let{component:Ot,typeScriptMetadata:Bt,propIgnores:jt,pending:Gt}=structuredClone({component:Le.component,typeScriptMetadata:Le.typeScriptMetadata,propIgnores:Le.propIgnores,pending:Le.pending});if(Bt!==void 0)Ot[x]=Bt;if(jt!==void 0)Ot[I]=jt;return Gt===void 0?{component:Ot}:{component:Ot,pending:Gt}}set(Z,ee,{component:Le,pending:Ot}){this.dirty=!0,this.next.set(Z,{hash:ee,...structuredClone({component:Le,typeScriptMetadata:Le[x],propIgnores:Le[I],pending:Ot})})}getGeneratedText(Z,ee){let Le=this.next.get(Z);if(Le?.generatedText===void 0||Le.generatedText.key!==ee)return;return Le.generatedText.text}setGeneratedText(Z,ee,Le){let Ot=this.next.get(Z);if(Ot===void 0)return;if(Ot.generatedText?.key===ee&&Ot.generatedText.text===Le)return;Ot.generatedText={key:ee,text:Le},this.dirty=!0}save(){if(!this.dirty&&this.next.size===this.savedEntryCount)return;this.dirty=!1,this.savedEntryCount=this.next.size,ff(Gp(this.cacheFilePath),{recursive:!0});let Z={...Xr(),entries:Object.fromEntries(this.next)},ee=JSON.stringify(Z),Le=`${this.cacheFilePath}.${process.pid}.tmp`;try{Vp(Le,ee),gf(Le,this.cacheFilePath)}catch{try{Vp(this.cacheFilePath,ee)}catch{}}}}import{dirname as bf,relative as wf,resolve as Tf}from"node:path";async function Hp(Z,ee={}){await Un();let Le=Tf(Z),Ot=bf(Le),Bt=(Lt)=>n(`./${wf(Ot,Lt)}`),jt=ws(Le,{...bs(ee.graph??new Kn),onAmbiguousStarExport:(Lt,Vt,Wt)=>{if(Lt!==Le||!ee.diagnostics)return;if(Wt.every((zt)=>zt.declFile.endsWith(".svelte")))return;let Kt=Array.from(new Set(Wt.map((zt)=>Bt(zt.declFile)))),Ht=Kt.map((zt)=>`"${zt}"`),qt=`${Ht.slice(0,-1).join(", ")} and ${Ht[Ht.length-1]}`;ee.diagnostics.push(a({component:Bt(Le),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 Lt of jt){if(Lt.name==="default"||Lt.declFile.endsWith(".svelte"))continue;let{declFile:Vt,returnType:Wt,literalValue:Kt,primitiveLiteral:Ht,declaredType:qt,functionNode:zt,namespaceFile:Xt,...Yt}=Lt,Jt=Bt(Vt);if(Xt!==void 0)Yt.type=`typeof import(${JSON.stringify(Bt(Xt))})`;Gt.set(Lt.name,{...Yt,source:Jt})}return Array.from(Gt.values()).sort((Lt,Vt)=>u(Lt.name,Vt.name))}async function Pf(Z){let ee=await Promise.all(Array.from(Z,async(Le)=>{try{return[Le,await Af(Le,"utf-8")]}catch(Ot){return console.warn(`Warning: Failed to read file ${Le}:`,Ot),[Le,null]}}));return new Map(ee)}function zp(Z){if(Z.length===0)return;console.error(`sveld: failed to parse ${Z.length} component(s):`);for(let{filePath:ee,message:Le}of Z)console.error(` - ${ee}: ${Le}`)}class Li{input;glob;options;graph=new Kn;collected;entryFile=null;globMergeState;cache;entryExports=[];entryDiagnostics=[];records=new Map;parseErrors=new Map;canonicalEntries=new Map;warnedModuleNames=new Set;constructor(Z,ee,Le={}){this.input=Z,this.glob=ee,this.options=Le}get documentExports(){return this.options.documentExports===!0}async build(){return this.graph=new Kn,this.collected=Ur(this.input,this.glob,this.documentExports,this.graph),this.globMergeState=Cs(this.collected.allComponentEntries,this.collected.resolveComponentFilePath),this.entryFile=kf(this.input).isFile()?qp(this.input):null,this.cache=this.options.cache===!1?void 0:new Jr(Kp(this.collected.rootDir,this.options.cache??!0)),await this.readEntryExports(),this.records.clear(),this.parseErrors.clear(),this.indexEntries(),await this.process(this.componentPaths()),zp(Array.from(this.parseErrors.values())),this.assemble()}async update(Z){let ee=Z.map((Wt)=>qp(Wt));if(this.graph.invalidate(...ee),ee.length===0)return{result:this.assemble(),reparsed:[]};let Le=this.entryFile!==null&&ee.includes(this.entryFile)?await this.recollect():[];if(this.glob){let{rootDir:Wt,exports:Kt,allComponentEntries:Ht,resolveComponentFilePath:qt}=this.collected;Wr(this.graph,Wt,Kt,Ht,qt,this.globMergeState)}this.indexEntries();let Ot=this.componentPaths();for(let Wt of this.records.keys())if(!Ot.has(Wt))this.records.delete(Wt);for(let Wt of this.parseErrors.keys())if(!Ot.has(Wt))this.parseErrors.delete(Wt);let Bt=Array.from(this.records).flatMap(([Wt,{crossFileReads:Kt}])=>Kt?.some((Ht)=>ee.includes(Ht))?[Wt]:[]),jt=new Set([...ee.filter((Wt)=>Pn.test(Wt)),...Le,...Bt]),Gt=new Set(Array.from(Ot).filter((Wt)=>jt.has(Wt))),Lt=await this.process(Gt),Vt=this.assemble();return zp(Vt.errors),{result:Vt,reparsed:Lt}}async recollect(){let Z=this.collected,ee=Ur(this.input,this.glob,this.documentExports,this.graph),Le=[];for(let[Ot,Bt]of Object.entries(ee.exports)){let jt=ee.resolveComponentFilePath(Bt.source),Gt=Object.hasOwn(Z.exports,Ot)?Z.exports[Ot]:void 0;if(Gt===void 0||Z.resolveComponentFilePath(Gt.source)!==jt)Le.push(jt)}return this.collected=ee,this.globMergeState=Cs(ee.allComponentEntries,ee.resolveComponentFilePath),await this.readEntryExports(),Le}async readEntryExports(){this.entryDiagnostics=[],this.entryExports=this.documentExports&&this.entryFile!==null?await Hp(this.entryFile,{diagnostics:this.entryDiagnostics,graph:this.graph}):[]}componentPaths(){let{exports:Z,allComponentEntries:ee,resolveComponentFilePath:Le}=this.collected,Ot=new Set;for(let[,Bt]of[...Object.entries(Z),...ee])if(di(Bt.source))Ot.add(Le(Bt.source));return Ot}indexEntries(){let{exports:Z,allComponentEntries:ee,resolveComponentFilePath:Le}=this.collected;this.canonicalEntries=new Map;for(let Ot of[Object.entries(Z),ee])for(let Bt of Ot){if(!di(Bt[1].source))continue;this.canonicalEntries.set(Le(Bt[1].source),this.entryIdentity(Ot,Bt))}}entryIdentity(Z,[ee,{source:Le}]){return{moduleName:wp(ee,Le,Z.length,this.warnedModuleNames),filePath:n(Le)}}canonicalEntry(Z){let ee=this.canonicalEntries.get(Z);if(ee===void 0)throw Error(`sveld: no entry lists ${Z}.`);return ee}async process(Z){let ee=new Map,Le=await this.parse(Z,ee);this.cache?.save();let Ot=await this.settle(Le);for(let Bt of Z)this.records.delete(Bt),this.parseErrors.delete(Bt);for(let[Bt,jt]of Ot)this.records.set(Bt,jt);for(let[Bt,jt]of ee)this.parseErrors.set(Bt,jt);return Array.from(Ot.keys())}async parse(Z,ee){let Le=await Pf(Z),Ot=this.cache,Bt=new Map,jt=new Set;if(Ot)for(let[Lt,Vt]of Le){if(Vt===null)continue;let Wt=_s(Vt);if(Bt.set(Lt,Wt),!Ot.has(Lt,Wt))jt.add(Lt)}if(Z.size>0&&(!Ot||jt.size>0))await Un();let Gt=new Map;for(let Lt of Z){let Vt=Le.get(Lt);if(Vt===null||Vt===void 0)continue;let Wt=this.parseOne(Lt,Vt,Bt.get(Lt),ee);if(Wt)Gt.set(Lt,Wt)}return Gt}parseOne(Z,ee,Le,Ot){let Bt=Le===void 0?null:this.cache?.get(Z,Le);if(Bt)return Bt;let{moduleName:jt,filePath:Gt}=this.canonicalEntry(Z),Lt;try{Lt=new(Nn()).ComponentParser().parse(ee,{moduleName:jt,filePath:Gt})}catch(Vt){if(this.options.failFast)throw Vt;Ot.set(Z,{filePath:Gt,moduleName:jt,message:Vt instanceof Error?Vt.message:String(Vt),stack:Vt instanceof Error?Vt.stack:void 0});return}if(Le!==void 0)this.cache?.set(Z,Le,Lt);return Lt}async settle(Z){let{rootDir:ee,resolveComponentFilePath:Le}=this.collected,Ot=new Map,Bt=new Map;for(let[Vt,{component:Wt,pending:Kt}]of Z){let Ht={...this.canonicalEntry(Vt),...Wt};Ot.set(Vt,Ht),Bt.set(Ht,Kt)}let{checkExamples:jt}=this.options;if(jt){let Vt=await jp(Ot.values(),jt,ee,Le);for(let[Wt,Kt]of Vt)pi(Wt,Kt)}let Gt=await Mp(Ot.values(),Le,(Vt)=>Bt.get(Vt),this.graph),Lt=new Map;for(let[Vt,Wt]of Ot){let{moduleName:Kt,filePath:Ht,...qt}=Wt,zt=Gt.get(Ht);Lt.set(Vt,zt===void 0?{component:qt}:{component:qt,crossFileReads:zt})}return Lt}assemble(){let{exports:Z,allComponentEntries:ee,resolveComponentFilePath:Le}=this.collected,Ot=this.cache,Bt=(Ht,qt)=>{let{source:zt}=qt[1];if(!di(zt))return;let Xt=this.records.get(Le(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,Lt=Ot?new Map:void 0;for(let Ht of ee){let qt=Bt(ee,Ht);if(qt===void 0)continue;let{filePath:zt}=qt.component;jt.set(zt,qt.component),(qt.record.crossFileReads===void 0?Gt:Lt)?.set(zt,Le(Ht[1].source))}let Vt=ip(jt,Le,this.graph);for(let Ht of jt.values())pi(Ht,[...Vt(Ht),...np(Ht)]);let Wt=new Map,Kt=Object.entries(Z);for(let Ht of Kt){let qt=Bt(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:Z,entryExports:this.entryExports,components:Wt,allComponentsForTypes:jt,errors:Array.from(this.parseErrors.values()),diagnostics:wo(ko([...Array.from(jt.values()).flatMap((Ht)=>Ht.diagnostics??[]),...this.entryDiagnostics]),this.options.diagnostics?.ignore),cache:Ot,resolvedPathByFilePath:Gt,crossFileResolvedPathByFilePath:Lt}}}function Mi(Z){return{failFast:Z?.failFast,documentExports:Z?.documentExports===!0,cache:Z?.cache,checkExamples:Z?.checkExamples==="syntax"?"syntax":Z?.checkExamples===!0,diagnostics:Z?.diagnostics}}async function Fi(Z,ee,Le={}){return new Li(Z,ee,Le).build()}import{existsSync as Yr,readFileSync as _f}from"node:fs";import{isAbsolute as $f,join as Jp}from"node:path";var Bi='sveld: could not resolve a Svelte entry point. Set package.json#svelte, or pass the "entry" option.';function Xp(Z){return $f(Z)?Z:Jp(process.cwd(),Z)}function Re(Z){if(Z){let Bt=Xp(Z);if(Yr(Bt))return{entry:Q(Z)};return{entry:null,configured:!0,message:`Invalid entry point: ${Bt}. Pass a valid --entry (or "entry" option), or unset it and set the "svelte" field in your package.json instead.`}}let ee=Jp(process.cwd(),"package.json");if(!Yr(ee))return{entry:null,configured:!1,message:'Could not locate a package.json file. Specify an entry point with --entry (or the "entry" option).'};let Le;try{Le=cp(JSON.parse(_f(ee,"utf-8")))}catch(Bt){throw console.error("Error reading package.json:",Bt),Bt}let Ot=Le.svelte?.trim();if(!Ot)return{entry:null,configured:!1,message:'Could not determine an entry point. Set the "svelte" field in your package.json, or pass --entry (or the "entry" option).'};if(!Yr(Xp(Ot)))return{entry:null,configured:!0,message:`The "svelte" field in package.json points to "${Ot}", which does not exist.`};return{entry:Q(Ot)}}function $s(Z){let ee=Re(Z);if(ee.entry===null)console.error(ee.message);return ee.entry}async function Yp(Z,ee,Le={}){let Ot=new Li(Z,ee,{...Le,failFast:!1}),Bt=await Ot.build();return{get result(){return Promise.resolve(Bt)},async update(jt){let Gt=await Ot.update(jt);return Bt=Gt.result,Gt}}}import Zr from"node:path";function Qp(Z){let ee=new Map,Le=[];for(let[Ot,Bt]of Object.entries(Z)){if(Bt.star){Le.push(`export * from "${Bt.source}";`);continue}let jt=ee.get(Bt.source)??[];jt.push({id:Ot,exportee:Bt}),ee.set(Bt.source,jt)}for(let[Ot,Bt]of ee){let jt=Pn.test(Ot),Gt=Bt.some(({id:qt,exportee:zt})=>qt!=="default"&&zt.default),Lt=Bt.some(({exportee:qt})=>!qt.default),Vt=jt&&Gt&&Lt,Wt=[],Kt=[],Ht=[];for(let{id:qt,exportee:zt}of Bt){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)Le.push(`export { ${[...Ht,...Wt].join(", ")} } from "${Ot}";`);else{if(Wt.length>0)Le.push(`export { ${Wt.join(", ")} } from "${Ot}";`);if(Ht.length>0)Le.push(`export { ${Ht.join(", ")} } from "${Ot}";`)}Le.push(...Kt)}return Le.join(`
|
|
140
|
+
`)}function Zp(Z){return Z.filter((ee)=>ee.names.length>0).map((ee)=>`export type { ${ee.names.join(", ")} } from "${ee.source}";`).join(`
|
|
141
|
+
`)}function ec(Z){return Z.replace(Pn,"")}function Qr(Z){return Z.replace(Pn,".svelte.d.ts")}import{mkdir as Nf,readFile as Df,writeFile as Rf}from"node:fs/promises";import{parse as If}from"node:path";class In{ensuredDirs=new Set;async write(Z,ee){try{if(await Df(Z,"utf-8")===ee)return!1}catch{}let Le=If(Z).dir;if(!this.ensuredDirs.has(Le))await Nf(Le,{recursive:!0}),this.ensuredDirs.add(Le);return await Rf(Z,ee),!0}}function Of(Z){return r(Z)&&!Array.isArray(Z)&&"start"in Z&&"end"in Z}function eo(Z){if(Array.isArray(Z))return Z.map((ee)=>eo(ee));if(r(Z)){let ee={};for(let[Le,Ot]of Object.entries(Z)){if((Le==="source"||Le==="componentCommentSource")&&Of(Ot))continue;ee[Le]=eo(Ot)}return ee}return Z}function Lf(Z,ee,Le){if(!ee)return`${Z.moduleName}.api.json`;if(!Le.has(Z.moduleName))Le.add(Z.moduleName),console.warn(`Warning: multiple components named "${Z.moduleName}" found. Their JSON files are keyed by source path instead of name to avoid overwriting each other.`);return`${ec(Z.filePath)}.api.json`}async function Mf(Z,ee,Le){let Ot=Ns(Z,{inputDir:ee.inputDir,source:ee.source}).components,Bt=new Map;for(let Lt of Ot)Bt.set(Lt.moduleName,(Bt.get(Lt.moduleName)??0)+1);let jt=new Set,Gt=new In;await Promise.all(Ot.map(async(Lt)=>{let Vt=(Bt.get(Lt.moduleName)??0)>1,Wt=Lf(Lt,Vt,jt),Kt=Zr.resolve(Zr.join(Le,Wt)),Ht=await Gt.write(Kt,Pi(Lt));Fn(`${Ht?"created":"unchanged"} "${Kt}".`)}))}function Ns(Z,ee){let Le=h(Z,{entryExports:ee.entryExports}),Ot={...Le,components:Le.components.map((Bt)=>({...Bt,filePath:ya(Bt.filePath,ee.inputDir)}))};return ee.source===!1?eo(Ot):Ot}function to(Z,ee){return Pi(Ns(Z,ee))}async function no(Z,ee){if(ee.outDir){await Mf(Z,ee,ee.outDir);return}let Le=await new In().write(Zr.resolve(ee.outFile),to(Z,ee));Fn(`${Le?"created":"unchanged"} "${ee.outFile}".`)}import{join as Ec,resolve as co}from"node:path";var tc=/`/g,nc=/\s+/g,qn="--",ic=`| Prop name | Required | Kind | Reactive | Binding | Type | Default value | Description |
|
|
142
|
+
| :- | :- | :- | :- | :- | :- | :- | :- |
|
|
143
|
+
`,sc=`| Slot name | Default | Props | Fallback | Description |
|
|
144
|
+
| :- | :- | :- | :- | :- |
|
|
145
|
+
`,rc=`| Event name | Type | Detail | Description |
|
|
146
|
+
| :- | :- | :- | :- |
|
|
147
|
+
`,io=`| Name | Kind | Type | Description |
|
|
148
|
+
| :- | :- | :- | :- |
|
|
149
|
+
`,Ff=`| Member | Signature | Description |
|
|
150
|
+
| :- | :- | :- |
|
|
151
|
+
`,oc=`| Part name | Description |
|
|
152
|
+
| :- | :- |
|
|
153
|
+
`,ac=`| Property name | Type | Default value | Description |
|
|
154
|
+
| :- | :- | :- | :- |
|
|
155
|
+
`,pc=/\|/g,Bf=/</g,jf=/>/g,Ds=/\n/g,Vf=/^[A-Za-z_$][\w$]*$/,Gf=/\s*\n\s*/g,Wf=/&(?=#?\w+;)|<(?=[A-Za-z/!?])|[|`*]|\\(?=[!-/:-@[-`{-~])|(?<![A-Za-z0-9])_|_(?![A-Za-z0-9])/g,Uf=/[&<|`*\\_]/;function so(Z){if(!Uf.test(Z))return Z;return Z.replace(Wf,(ee)=>ee==="&"?"&":ee==="<"?"<":ee==="_"?"_":`&#${ee.charCodeAt(0)};`)}function Kf(Z){return`<code>${so(Z.includes(`
|
|
156
|
+
`)?Z.replace(Gf," "):Z)}</code>`}var Hf=/\{@link\s+([^{}\s|]+)(?:\|([^{}]+))?\}/g;function qf(Z){if(!Z.includes("{@link"))return Z;return Z.replace(Hf,(ee,Le,Ot)=>`[${Ot===void 0?Le:Ot.trim()}](${Le})`)}function zf(Z){return Z.includes("```")||Z.includes("~~~")}function Xf(Z){return hc(qf(Z))}var Jf=/^([ \t]*)(`{3,}|~{3,})(.*)$/,Yf=/^\n/,Qf=/\n$/;function cc(Z){let ee=(jt)=>({kind:"prose",text:Xf(jt.join(`
|
|
157
|
+
`))});if(!zf(Z))return[ee([Z])];let Le=Z.split(`
|
|
158
|
+
`),Ot=[],Bt=[];for(let jt=0;jt<Le.length;jt++){let Gt=Jf.exec(Le[jt]),[,Lt="",Vt="",Wt=""]=Gt??[];if(!Gt||Vt[0]==="`"&&Wt.includes("`")){Bt.push(Le[jt]);continue}if(Bt.push(""),Bt.length>1)Ot.push(ee(Bt));let Kt=[],Ht=new RegExp(`^[ \\t]*${Vt[0]}{${Vt.length},}[ \\t]*$`);for(jt++;jt<Le.length&&!Ht.test(Le[jt]);jt++){let qt=Le[jt],zt=0;while(zt<Lt.length&&(qt[zt]===" "||qt[zt]==="\t"))zt++;Kt.push(qt.slice(zt))}Ot.push({kind:"code",code:Kt.join(`
|
|
159
|
+
`)}),Bt=[""]}if(Bt.length>1||Ot.length===0)Ot.push(ee(Bt));return Ot}function lc(Z){let ee="";for(let Le=0;Le<Z.length;Le++){let Ot=Z[Le];if(Ot.kind==="code"){ee+=`<pre><code>${so(Ot.code).replace(Ds,"<br />")}</code></pre>`;continue}let Bt=Ot.text;if(Z[Le-1]?.kind==="code")Bt=Bt.replace(Yf,"");if(Z[Le+1]?.kind==="code")Bt=Bt.replace(Qf,"");ee+=Bt.replace(pc,"|").replace(Ds,"<br />")}return ee}function Sn(Z){if(Z===void 0)return qn;return Kf(Z)}function uc(Z){if(!Z.reExport)return Sn(Z.type);let{from:ee,imported:Le}=Z.reExport,Ot=Le==="*"?"":Vf.test(Le)?`.${Le}`:`[${JSON.stringify(Le)}]`;return Sn(`typeof import(${JSON.stringify(ee)})${Ot}`)}function hc(Z){if(!Z.includes("<")&&!Z.includes(">"))return Z;return Z.replace(Bf,"<").replace(jf,">")}function ii(Z,ee){if(ee===void 0)return Z;let Le=typeof ee==="string"&&ee.trim().length>0?`: ${hc(ee).replace(Ds," ").replace(pc,"|")}`:"";return`<s>${Z}</s><br />**Deprecated**${Le}`}function Rs(Z){if(Z===void 0||Z.trim().length===0)return qn;return lc(cc(Z))}function dc(Z){if(Z===void 0||Z==="{}"||Z==="Record<string, never>")return qn;return Sn(Z.trim())}function fc(Z){if(Z===void 0)return qn;return`<code>${so(Z).replace(Ds,"<br />")}</code>`}function yi(Z,ee){let Le=[],Ot=(jt)=>{let Gt=Le.at(-1);if(Gt?.kind==="prose")Gt.text+=jt;else Le.push({kind:"prose",text:jt})},Bt=(jt,Gt)=>{if(Le.length>0)Ot(`
|
|
160
|
+
`);if(jt)Ot(jt);for(let Lt of cc(Gt))if(Lt.kind==="prose")Ot(Lt.text);else Le.push(Lt)};if(Z?.trim())Bt("",Z);for(let{name:jt,body:Gt}of ee??[]){let Lt=Gt?.trim();Bt(Lt?`@${jt} `:`@${jt}`,Lt??"")}if(Le.length===0)return qn;return lc(Le)}function mc(Z){return Sn(Z)}function Zf(Z){let ee=[Z.extends?`Extends ${Sn(Z.extends)}.`:"",Z.implements?.length?`Implements ${Z.implements.map((Le)=>Sn(Le)).join(", ")}.`:""].filter(Boolean);return ee.length>0?ee.join(" "):void 0}function gc(Z,ee){let Le=new Set;for(let Ot of ee){if(Ot.kind!=="class")continue;let Bt=Zf(Ot);if(!Ot.members?.length&&!Bt)continue;let jt=Ot.localName??Ot.name;if(Le.has(jt))continue;if(Le.add(jt),Z.append("h4",`\`${jt}\` members`),Bt)Z.append("raw",`${Bt}
|
|
161
|
+
|
|
162
|
+
`);if(!Ot.members?.length)continue;Z.append("raw",Ff);for(let Gt of Ot.members)Z.append("raw",`| ${ii(Gt.name,Gt.deprecated)} | ${Sn($r(Gt))} | ${yi(Gt.description,Gt.tags)} |
|
|
163
|
+
`);Z.append("raw",`
|
|
164
|
+
`)}}function yc(Z,ee,Le){if(Z.append("h1","Component Index"),Z.append("h2","Components").tableOfContents(),Z.append("divider"),Le&&Le.length>0)vc(Z,Le);for(let Ot of h(ee).components)oo(Z,Ot)}function xc(Z,ee,Le){Z.append("h1","Component Index"),Z.append("h2","Components");for(let Ot of ee)Z.append("raw",`- [${Ot.moduleName}](./${Ot.moduleName}.md)
|
|
165
|
+
`);if(Z.append("raw",`
|
|
166
|
+
`),Z.append("divider"),Le&&Le.length>0)vc(Z,Le)}function vc(Z,ee){Z.append("h2","Exports"),Z.append("raw",io);for(let Le of ee){let Ot=(Le.type??Le.value)?.replace(nc," ").trim();Z.append("raw",`| ${ii(Le.name,Le.deprecated)} | <code>${Le.kind}</code> | ${Sn(Ot)} | ${Rs(Le.description)} |
|
|
167
|
+
`)}Z.append("raw",`
|
|
168
|
+
`),Z.append("divider")}function em(Z,ee){Z.append("h3","Module exports"),Z.append("raw",io);for(let Le of ee)Z.append("raw",`| ${ii(Le.name,Le.deprecated)} | <code>${Le.kind}</code> | ${uc(Le)} | ${yi(Le.description,Le.tags)} |
|
|
169
|
+
`);Z.append("raw",`
|
|
170
|
+
`),gc(Z,ee)}function ro(Z,ee,Le){if(ee.length>0)Le(),Z.append("raw",`
|
|
171
|
+
`);else Z.append("p","None.")}function oo(Z,ee){if(Z.append("h2",`\`${ee.moduleName}\``),ee.generics)Z.append("p",`**Type parameters:** ${Sn(`<${ee.generics[1]}>`)}`);if(ee.typedefs.length>0)Z.append("h3","Types").append("raw",`\`\`\`ts
|
|
172
|
+
${vs({typedefs:ee.typedefs})}
|
|
173
|
+
\`\`\`
|
|
174
|
+
|
|
175
|
+
`);if(Z.append("h3","Props"),ro(Z,ee.props,()=>{Z.append("raw",ic);let Le=(Bt)=>Bt.reactive?0:Bt.constant?2:1,Ot=ee.props.map((Bt,jt)=>({prop:Bt,index:jt})).sort((Bt,jt)=>Le(Bt.prop)-Le(jt.prop)||Bt.index-jt.index).map(({prop:Bt})=>Bt);for(let Bt of Ot){let jt=Es(Bt)?"accessor":Bt.kind;Z.append("raw",`| ${ii(Bt.name,Bt.deprecated)} | ${Bt.isRequired?"Yes":"No"} | <code>${jt}</code> | ${Bt.reactive?"Yes":"No"} | ${Bt.binding??"--"} | ${Sn(Bt.type)} | ${Sn(Bt.value)} | ${yi(Bt.description,Bt.tags)} |
|
|
176
|
+
`)}}),ee.moduleExports.length>0)em(Z,ee.moduleExports);if(Z.append("h3","Slots"),ro(Z,ee.slots,()=>{Z.append("raw",sc);for(let Le of ee.slots)Z.append("raw",`| ${ii(Le.default?qn:Le.name??qn,Le.deprecated)} | ${Le.default?"Yes":"No"} | ${dc(Le.slot_props)} | ${fc(Le.fallback)} | ${yi(Le.description,Le.tags)} |
|
|
177
|
+
`)}),Z.append("h3","Events"),ro(Z,ee.events,()=>{Z.append("raw",rc);for(let Le of ee.events)Z.append("raw",`| ${ii(Le.name,Le.deprecated)} | ${Le.type} | ${mc(Le.detail)} | ${yi(Le.description,Le.tags)} |
|
|
178
|
+
`)}),ee.cssParts&&ee.cssParts.length>0){Z.append("h3","CSS Parts"),Z.append("raw",oc);for(let Le of ee.cssParts)Z.append("raw",`| ${Le.name} | ${Rs(Le.description)} |
|
|
179
|
+
`);Z.append("raw",`
|
|
180
|
+
`)}if(ee.cssProperties&&ee.cssProperties.length>0){Z.append("h3","CSS Custom Properties"),Z.append("raw",ac);for(let Le of ee.cssProperties)Z.append("raw",`| ${Le.name} | ${Sn(Le.type)} | ${Sn(Le.default)} | ${Rs(Le.description)} |
|
|
181
|
+
`);Z.append("raw",`
|
|
182
|
+
`)}}var tm=/[^\w\- ]+/g,nm=/\s+/g,ao="<!-- __TOC__ -->";function im(Z,ee){let Le=Z.toLowerCase().replace(tc,"").replace(tm,"").replace(nm,"-"),Ot=ee.get(Le)??0;return ee.set(Le,Ot+1),Ot===0?Le:`${Le}-${Ot}`}class po{sourceParts=[];hasToC=!1;toc=[];onAppend;constructor(Z={}){this.onAppend=Z.onAppend}get source(){return this.sourceParts.join("")}appendLineBreaks(){return this.sourceParts.push(`
|
|
183
|
+
|
|
184
|
+
`),this}append(Z,ee){switch(Z){case"h1":case"h2":case"h3":case"h4":case"h5":case"h6":{if(this.sourceParts.push(`${"#".repeat(Number(Z.slice(-1)))} ${ee}`),this.hasToC&&Z==="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(Z!=="raw")this.appendLineBreaks();return this.onAppend?.call(this,Z,this),this}tableOfContents(){return this.sourceParts.push(ao),this.hasToC=!0,this.appendLineBreaks(),this}end(){let Z=this.sourceParts.join("");if(!this.hasToC)return Z;let ee=Z.indexOf(ao);if(ee===-1)return Z;let Le=new Map,Ot=this.toc.map(({indent:Bt,raw:jt})=>`${" ".repeat(Bt)}- [${jt}](#${im(jt,Le)})`).join(`
|
|
185
|
+
`);return Z.slice(0,ee)+Ot+Z.slice(ee+ao.length)}}function Is(Z,ee){return new po({onAppend:(Le,Ot)=>{ee?.onAppend?.call(null,Le,Ot,Z)}})}function ji(Z,ee){let Le=Is(Z,ee);return yc(Le,Z,ee.entryExports),Le.end()}async function sm(Z,ee,Le){let Ot=h(Z,{entryExports:ee.entryExports}),Bt=new In,jt=Is(Z,ee);xc(jt,Ot.components,ee.entryExports);let Gt=co(Ec(Le,"README.md")),Lt=await Bt.write(Gt,jt.end());Fn(`${Lt?"created":"unchanged"} "${Gt}".`),await Promise.all(Ot.components.map(async(Vt)=>{let Wt=Is(Z,ee);oo(Wt,Vt);let Kt=co(Ec(Le,`${Vt.moduleName}.md`)),Ht=await Bt.write(Kt,Wt.end());Fn(`${Ht?"created":"unchanged"} "${Kt}".`)}))}async function lo(Z,ee){if(ee.outDir){await sm(Z,ee,ee.outDir);return}let Le=co(ee.outFile),Ot=await new In().write(Le,ji(Z,ee));Fn(`${Ot?"created":"unchanged"} "${ee.outFile}".`)}import{join as rm,resolve as om}from"node:path";function am(Z,ee){if(!ee.indexTypes)return[];let Le=ee.format==="component",Ot=new Set,Bt=[];for(let jt of Object.values(ee.exports)){if(!jt.default||!Pn.test(jt.source))continue;let Gt=n(jt.source);if(Ot.has(Gt))continue;Ot.add(Gt);let Lt=Z.components.find((Wt)=>Wt.filePath===Gt);if(!Lt)continue;let Vt=[mi(Lt.moduleName)];if(Le)Vt.push(Ri(Lt.moduleName));Bt.push({source:jt.source,names:Vt})}return Bt}async function Sc(Z,ee,Le){if(!Z)return ee;try{let Ot=await Z(ee,Le);if(typeof Ot!=="string")throw TypeError(`must return a string, got ${typeof Ot}`);return Ot}catch(Ot){let Bt=Ot instanceof Error?Ot.message:String(Ot);throw Error(`sveld: typesOptions.transform failed for "${Le.filePath}": ${Bt}`,{cause:Ot})}}function pm(Z,ee){return`${Z}
|
|
186
|
+
${tp(ee)}`}async function uo(Z,ee){let Le=om(ee.outDir,"index.d.ts"),Ot=new In,Bt=h(Z),jt=Zp(am(Bt,ee)),Gt=ee.preamble+[Qp(ee.exports),jt].filter((zt)=>zt!=="").join(`
|
|
187
|
+
|
|
188
|
+
`),Lt=Nr(ee),Vt=Bt.components.map(async(zt)=>{let Xt=Qr(rm(ee.outDir,zt.filePath)),Yt=n(Qr(zt.filePath)),Jt=ee.resolvedPathByFilePath?.get(zt.filePath),tn=Jt?void 0:ee.crossFileResolvedPathByFilePath?.get(zt.filePath),sn=Jt??tn,ln=pm(zt.moduleName,Lt),cn=tn?`${ln}
|
|
189
|
+
${_s(JSON.stringify(zt))}`:ln,un=sn?ee.cache?.getGeneratedText(sn,cn):void 0;if(un===void 0){if(un=Dr(zt,Lt),sn)ee.cache?.setGeneratedText(sn,cn,un)}let On=await Sc(ee.transform,un,{kind:"component",component:zt,filePath:Yt});return Ot.write(Xt,On)}),Wt=(async()=>{let zt=await Sc(ee.transform,Gt,{kind:"index",filePath:"index.d.ts"});return Ot.write(Le,`${zt}
|
|
190
|
+
`)})(),Kt=(await Promise.all([...Vt,Wt])).filter(Boolean).length,Ht=Vt.length+1,qt=Kt===0?`unchanged ${Ht}`:`created ${Kt} of ${Ht}`;Fn(`${qt} TypeScript definitions in "${ee.outDir}".`)}var cm=["reportDiagnostics","strict","check","checkLevel","stdout","format"],lm=50;function um(Z){let ee=Promise.resolve();return()=>{ee=ee.then(Z,Z)}}function It(Z){let ee=Z?.watch===!0,Le,Ot,Bt=Z??{},jt,Gt=null,Lt,Vt=new Set,Kt=um(async()=>{if(Gt==null||Ot==null||Vt.size===0)return;let qt=Array.from(Vt);Vt.clear();try{let{result:zt}=await Gt.update(qt);await Vi(zt,Bt,Ot)}catch(zt){console.error("sveld: failed to regenerate types in watch mode:",zt)}}),Ht=(qt)=>{if(!ee||Gt==null||!ga.test(qt))return;Vt.add(qt),clearTimeout(Lt),Lt=setTimeout(Kt,lm)};return{name:"vite-plugin-sveld",apply:ee?void 0:"build",enforce:"post",configResolved(qt){jt=qt.root},async buildStart(){if(Z?.config){let zt=await B(Z.config,jt??process.cwd(),!1);Bt=R(zt,Z)}j(Bt);let qt=cm.filter((zt)=>(zt in Bt));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(q(Bt.quiet===!0),Ot=$s(Bt.entry),ee&&Ot!=null)try{Gt=await Yp(Ot,Bt.glob===!0,Mi(Bt)),await Vi(await Gt.result,Bt,Ot)}catch(zt){console.error("sveld: failed to generate initial types in watch mode:",zt)}},async generateBundle(){if(ee)return;if(Ot==null)this.error(Bi);Le=await Fi(Ot,Bt.glob===!0,Mi(Bt))},async writeBundle(){if(ee)return;if(Ot==null)this.error(Bi);await Vi(Le,Bt,Ot)},handleHotUpdate(qt){Ht(qt.file)},watchChange(qt){Ht(qt)}}}async function Vi(Z,ee,Le){let Ot=Cc(Le);if(ee.types!==!1)await uo(Z.allComponentsForTypes,{outDir:"types",preamble:"",...ee.typesOptions,exports:Z.exports,inputDir:Ot,cache:Z.cache,resolvedPathByFilePath:Z.resolvedPathByFilePath,crossFileResolvedPathByFilePath:Z.crossFileResolvedPathByFilePath});if(ee.json)await no(Z.components,{outFile:"COMPONENT_API.json",...ee.jsonOptions,inputDir:Ot,entryExports:Z.entryExports});if(ee.markdown)await lo(Z.components,{outFile:"COMPONENT_INDEX.md",...ee.markdownOptions,entryExports:Z.entryExports});Z.cache?.save()}async function bc(Z,ee,Le){if(ee.json){let Ot=to(Z.components,{...ee.jsonOptions,inputDir:Cc(Le),entryExports:Z.entryExports});process.stdout.write(Ot);return}if(ee.markdown){let Ot=ji(Z.components,{...ee.markdownOptions,entryExports:Z.entryExports});process.stdout.write(Ot)}}import{realpathSync as wc,statSync as hm}from"node:fs";import{dirname as Tc,relative as dm,resolve as fm}from"node:path";function mm(Z){if(Z.check&&!Z.check.snapshotExists&&!Z.writesSnapshot)return 1;if(Z.check?.changes.some((ee)=>ee.kind==="schema"))return 1;if(Z.errors.length>0)return 2;if(Z.check&&ba(Z.check.bump,Z.checkLevel??"major"))return 3;if(bo(Z.diagnostics,Z.strict).length>0)return 4;return 0}async function $e(Z,ee,Le=!1){let Ot=await Fi(Z,ee.glob===!0,Mi(ee)),Bt=ee.check?await _e(Ot.components,wa(ee),{entryExports:Ot.entryExports}):void 0;return await(Le?bc:Vi)(Ot,ee,Z),{result:Ot,check:Bt}}function gm(Z){let ee=wc(hm(Z).isFile()?Tc(Z):Z),Le=wc(process.env.GITHUB_WORKSPACE||process.cwd());return(Ot)=>n(dm(Le,fm(ee,Ot)))}function Ie(Z,ee,Le,Ot){let Bt=Le.reportDiagnostics||Le.strict,jt=Co(Z.diagnostics,Bt);if(Bt&&jt.length>0)if(Le.format==="json")process.stderr.write($o(jt));else{if(Le.format==="github"){let Lt=_o(jt,gm(Ot));if(Lt)console.error(Lt)}console.error(Ao(jt))}let Gt=mm({errors:Z.errors,check:ee,writesSnapshot:ee?Ta(Le,ee.snapshotFile):!1,checkLevel:Le.checkLevel,diagnostics:jt,strict:Le.strict});return{diagnostics:jt,exitCode:Gt}}async function Ft(Z){if(Z&&"input"in Z)throw Error("sveld: the `input` option was renamed to `entry`.");if(typeof Z?.config==="string")throw Error("sveld: `config` takes `true` or `false`; import another config file and pass its options instead.");let{entry:ee,...Le}=Z??{},Ot=await B(Le.config,process.cwd(),!0),Bt=$s(ee??Ot.entry);if(Bt===null)throw Error(Bi);let jt=R(Ot,Le,{entry:Bt});j(jt),q(jt.quiet===!0);let{result:Gt,check:Lt}=await $e(Bt,jt),{diagnostics:Vt,exitCode:Wt}=Ie(Gt,Lt,jt,Bt),Kt=Ns(Gt.components,{inputDir:Tc(Bt),entryExports:Gt.entryExports,source:jt.jsonOptions?.source});return{diagnostics:Vt,check:Lt,errors:Gt.errors,document:Kt,exitCode:Wt}}
|
|
191
|
+
export{x,I,te,g,A,Ee,W,ne,ve,H,E,p,o,r,S,t,b,c,f,T,Oe,Se,C,l,L,D,i,U,k,w,re,ie,a,z,Me,N,O,y,u,J,se,K,oe,be,X,ae,Fe,Te,le,Y,m,v,s,pe,ce,e,Be,je,Ve,qe,Ge,We,He,Ue,ze,Je,Ce,Ke,Xe,ke,Ye,Qe,Ze,et,we,Pe,tt,Ae,nt,rt,P,it,st,ot,at,lt,pt,ct,ut,dt,De,ft,mt,ht,gt,yt,xt,ue,Et,vt,St,Ne,bt,Tt,Ct,kt,d,wt,Pt,At,de,fe,M,Dt,Nt,F,me,he,_,n,_t,h,Rt,_e,ge,$t,ye,Mt,B,R,j,Q,V,q,xe,G,Re,It,$e,Ie,Ft};
|