sveld 0.38.2 → 0.38.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser.js +126 -126
- package/chunk-1azsj0zd.js +13 -0
- package/chunk-asxze8b8.js +1 -0
- package/chunk-nv6dzbmp.js +29 -0
- package/{chunk-261qwh99.js → chunk-q19n9qm3.js} +1 -1
- package/chunk-ssa3mr5n.js +234 -0
- package/cli-entry.js +2 -2
- package/index.js +1 -1
- package/package.json +1 -1
- package/chunk-28h1esfd.js +0 -29
- package/chunk-80eafzch.js +0 -1
- package/chunk-rn01dzny.js +0 -234
- package/chunk-wpqsw5ca.js +0 -13
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
var x=Symbol("sveld.parsedComponentTypeScriptMetadata");function ko(M){return M[x]}var Li=Array(2048).fill(void 0);function kc(){Li.fill(void 0)}function To(M,ee,we,Je){let Gt=Je&2047,Wt=Li[Gt];if(Wt!==void 0&&Wt.length===we-ee&&M.startsWith(Wt,ee))return Wt;let Ht=M.slice(ee,we);return Li[Gt]=Ht,Ht}var cs="",Rn=[0],Wn=0,ps=0,Gn;function te(M){kc(),cs=M,Rn=[0],Wn=0,ps=0,Gn=void 0}function Oi(M){while(Wn<=M){let ee=cs.indexOf(`
|
|
2
|
+
`,Wn);if(ee===-1){Wn=Number.POSITIVE_INFINITY;return}Wn=ee+1,Rn.push(Wn)}}function Tc(M){let ee=[0],we=M.indexOf(`
|
|
3
|
+
`);while(we!==-1)ee.push(we+1),we=M.indexOf(`
|
|
4
|
+
`,we+1);return ee}function Mi(M,ee,we){let Je=0,Gt=M.length-1;if(ee>=M[we])Je=we;else Gt=we-1;if(Je<Gt&&ee<M[Je+1])Gt=Je;while(Je<Gt){let Wt=Je+Gt+1>>>1;if(M[Wt]<=ee)Je=Wt;else Gt=Wt-1}return Je}function g(M){return Oi(M),ps=Mi(Rn,M,ps),{line:ps+1,column:M-Rn[ps],character:M}}var Ii=/\r\n?|\n|\u2028|\u2029/g,Pc=/[\r\u2028\u2029]/;function Po(M){if(Gn===void 0){Gn=Pc.test(cs)?[]:null,Ii.lastIndex=0;while(Gn!==null&&Ii.exec(cs)!==null)Gn.push(Ii.lastIndex)}if(Gn===null)return Oi(M),Mi(Rn,M,ps);let ee=0,we=Gn.length;while(ee<we){let Je=ee+we>>>1;if(Gn[Je]<=M)ee=Je+1;else we=Je}return ee}function P(M){let{line:ee,column:we}=g(M);return{line:ee,column:we}}function $o(M){while(Rn.length<=M+1&&Wn!==Number.POSITIVE_INFINITY)Oi(Wn);if(M>=Rn.length)return;let ee=M+1<Rn.length?Rn[M+1]-1:cs.length;return cs.slice(Rn[M],ee)}function ve(M){let ee,we=0;return(Je)=>(ee??=Tc(M),we=Mi(ee,Je,we),{line:we+1,column:Je-ee[we]})}function jn(M){return typeof M==="object"&&M!==null&&typeof Yn(M).type==="string"}function Yn(M){return M}function G(M,ee){let we=Yn(M);for(let Je in we){let Gt=we[Je];if(Array.isArray(Gt)){for(let Wt=0;Wt<Gt.length;Wt++)if(jn(Gt[Wt]))Gt[Wt]=ee(Gt[Wt])}else if(jn(Gt))we[Je]=ee(Gt)}}function ne(M,...ee){if(!ee.some((we)=>we===M.type))throw Error(`expected ${ee.join(" or ")}, got ${M.type}`)}function Ce(M){let ee=[];return Qn(M,ee),ee}function Qn(M,ee){switch(M.type){case"Identifier":ee.push(M);return;case"ObjectPattern":for(let we of M.properties)Qn(we.type==="RestElement"?we.argument:we.value,ee);return;case"ArrayPattern":for(let we of M.elements)if(we!==null)Qn(we,ee);return;case"RestElement":Qn(M.argument,ee);return;case"AssignmentPattern":Qn(M.left,ee);return;case"TSParameterProperty":Qn(M.parameter,ee);return;case"TSAsExpression":case"TSNonNullExpression":case"TSSatisfiesExpression":case"TSTypeAssertion":Qn(M.expression,ee)}}function W(M,ee){if(M.type!=="Identifier")return!1;if(ee===null)return!0;switch(ee.type){case"MemberExpression":return ee.computed||M===ee.object;case"MethodDefinition":return ee.computed;case"Property":case"PropertyDefinition":return ee.computed||M===ee.value;case"ExportSpecifier":case"ImportSpecifier":return M===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 M===ee.expression;case"TSEnumMember":return M===ee.initializer;case"TSParameterProperty":case"TSEnumDeclaration":case"TSImportEqualsDeclaration":return!0;default:return!ee.type.startsWith("TS")}}var ls={Root:["module","instance","fragment","css"],Script:["attributes","content"],Fragment:["nodes"],Text:[],Comment:[],ExpressionTag:["expression"],HtmlTag:["expression"],ConstTag:["declaration"],DeclarationTag:["declaration"],DebugTag:["identifiers"],RenderTag:["expression"],AttachTag:["expression"],Attribute:["value"],SpreadAttribute:["expression"],AnimateDirective:["expression"],BindDirective:["expression"],ClassDirective:["expression"],LetDirective:["expression"],OnDirective:["expression"],StyleDirective:["value"],TransitionDirective:["expression"],UseDirective:["expression"],Component:["attributes","fragment"],TitleElement:["attributes","fragment"],SlotElement:["attributes","fragment"],RegularElement:["attributes","fragment"],SvelteBody:["attributes","fragment"],SvelteBoundary:["attributes","fragment"],SvelteComponent:["expression","attributes","fragment"],SvelteDocument:["attributes","fragment"],SvelteElement:["tag","attributes","fragment"],SvelteFragment:["attributes","fragment"],SvelteHead:["attributes","fragment"],SvelteOptions:["attributes","fragment"],SvelteSelf:["attributes","fragment"],SvelteWindow:["attributes","fragment"],IfBlock:["test","consequent","alternate"],EachBlock:["expression","context","key","body","fallback"],AwaitBlock:["expression","pending","value","then","error","catch"],KeyBlock:["expression","fragment"],SnippetBlock:["expression","parameters","body"],StyleSheet:["attributes","children"],Rule:["prelude","block"],Atrule:["block"],SelectorList:["children"],ComplexSelector:["children"],RelativeSelector:["combinator","selectors"],Combinator:[],TypeSelector:[],IdSelector:[],ClassSelector:[],AttributeSelector:[],PseudoElementSelector:["args"],PseudoClassSelector:["args"],Percentage:[],Nth:[],NestingSelector:[],Block:["children"],Declaration:[],Program:["body"],ExpressionStatement:["expression"],BlockStatement:["body"],StaticBlock:["body"],EmptyStatement:[],DebuggerStatement:[],WithStatement:["object","body"],ReturnStatement:["argument"],LabeledStatement:["label","body"],BreakStatement:["label"],ContinueStatement:["label"],IfStatement:["test","consequent","alternate"],SwitchStatement:["discriminant","cases"],SwitchCase:["test","consequent"],ThrowStatement:["argument"],TryStatement:["block","handler","finalizer"],CatchClause:["param","body"],WhileStatement:["test","body"],DoWhileStatement:["body","test"],ForStatement:["init","test","update","body"],ForInStatement:["left","right","body"],ForOfStatement:["left","right","body"],FunctionDeclaration:["id","typeParameters","params","returnType","body"],FunctionExpression:["id","typeParameters","params","returnType","body"],ArrowFunctionExpression:["typeParameters","params","returnType","body"],VariableDeclaration:["declarations"],VariableDeclarator:["id","init"],ClassDeclaration:["decorators","id","typeParameters","superClass","superTypeParameters","implements","body"],ClassExpression:["decorators","id","typeParameters","superClass","superTypeParameters","implements","body"],ClassBody:["body"],MethodDefinition:["decorators","key","typeParameters","value"],PropertyDefinition:["decorators","key","typeAnnotation","value"],Property:["decorators","key","value"],ThisExpression:[],Super:[],Literal:[],Identifier:["decorators","typeAnnotation"],PrivateIdentifier:[],ArrayExpression:["elements"],ObjectExpression:["properties"],UnaryExpression:["argument"],UpdateExpression:["argument"],BinaryExpression:["left","right"],LogicalExpression:["left","right"],AssignmentExpression:["left","right"],MemberExpression:["object","property"],ConditionalExpression:["test","consequent","alternate"],CallExpression:["callee","typeArguments","arguments"],NewExpression:["callee","typeArguments","arguments"],SequenceExpression:["expressions"],TemplateLiteral:["quasis","expressions"],TaggedTemplateExpression:["tag","typeArguments","quasi"],TemplateElement:[],SpreadElement:["argument"],RestElement:["decorators","argument","typeAnnotation"],YieldExpression:["argument"],AwaitExpression:["argument"],ImportExpression:["source","options","arguments"],ChainExpression:["expression"],MetaProperty:["meta","property"],ObjectPattern:["decorators","properties","typeAnnotation"],ArrayPattern:["decorators","elements","typeAnnotation"],AssignmentPattern:["decorators","left","right"],ImportDeclaration:["specifiers","source","attributes"],ImportSpecifier:["imported","local"],ImportDefaultSpecifier:["local"],ImportNamespaceSpecifier:["local"],ImportAttribute:["key","value"],ExportNamedDeclaration:["declaration","specifiers","source","attributes"],ExportSpecifier:["local","exported"],ExportDefaultDeclaration:["declaration"],ExportAllDeclaration:["exported","source","attributes"],Decorator:["expression"],TSTypeAnnotation:["typeAnnotation"],TSTypeParameterDeclaration:["params"],TSTypeParameterInstantiation:["params"],TSTypeParameter:["constraint","default"],TSAnyKeyword:[],TSBigIntKeyword:[],TSBooleanKeyword:[],TSNeverKeyword:[],TSNullKeyword:[],TSNumberKeyword:[],TSObjectKeyword:[],TSStringKeyword:[],TSSymbolKeyword:[],TSUndefinedKeyword:[],TSUnknownKeyword:[],TSVoidKeyword:[],TSThisType:[],TSArrayType:["elementType"],TSTupleType:["elementTypes"],TSNamedTupleMember:["label","elementType"],TSOptionalType:["typeAnnotation"],TSRestType:["typeAnnotation"],TSUnionType:["types"],TSIntersectionType:["types"],TSConditionalType:["checkType","extendsType","trueType","falseType"],TSInferType:["typeParameter"],TSParenthesizedType:["typeAnnotation"],TSTypeOperator:["typeAnnotation"],TSIndexedAccessType:["objectType","indexType"],TSMappedType:["typeParameter","nameType","typeAnnotation"],TSLiteralType:["literal"],TSTypeReference:["typeName","typeArguments"],TSQualifiedName:["left","right"],TSTypeQuery:["exprName","typeArguments"],TSImportType:["argument","qualifier","typeArguments"],TSTypeLiteral:["members"],TSPropertySignature:["key","typeAnnotation"],TSMethodSignature:["key","typeParameters","parameters","typeAnnotation"],TSCallSignatureDeclaration:["typeParameters","parameters","typeAnnotation"],TSConstructSignatureDeclaration:["typeParameters","parameters","typeAnnotation"],TSFunctionType:["typeParameters","parameters","typeAnnotation"],TSConstructorType:["typeParameters","parameters","typeAnnotation"],TSIndexSignature:["decorators","parameters","typeAnnotation"],TSTypePredicate:["parameterName","typeAnnotation"],TSInterfaceDeclaration:["id","typeParameters","extends","body"],TSInterfaceBody:["body"],TSExpressionWithTypeArguments:["expression","typeParameters"],TSTypeAliasDeclaration:["id","typeParameters","typeAnnotation"],TSEnumDeclaration:["id","members"],TSEnumMember:["id","initializer"],TSModuleDeclaration:["id","body"],TSModuleBlock:["body"],TSImportEqualsDeclaration:["id","moduleReference"],TSExternalModuleReference:["expression"],TSExportAssignment:["expression"],TSNamespaceExportDeclaration:["id"],TSDeclareFunction:["id","typeParameters","params","returnType"],TSDeclareMethod:["typeParameters","params","returnType"],TSParameterProperty:["parameter"],TSAsExpression:["expression","typeAnnotation"],TSSatisfiesExpression:["expression","typeAnnotation"],TSTypeAssertion:["typeAnnotation","expression"],TSNonNullExpression:["expression"],TSInstantiationExpression:["expression","typeArguments"]};var $c=Object.assign(Object.create(null),ls),Ac=[],T=Symbol("sveast.walk.stop"),u=Symbol("sveast.walk.skip");function a(M,ee,we){Vs(M,null,null,null,ee,we===void 0||we===ls?Dc:(Je)=>Object.hasOwn(we,Je.type)?we[Je.type]:void 0)}function Vs(M,ee,we,Je,Gt,Wt){let Ht=Wt(M);if(Ht===void 0)throw Error(`unknown node type: ${M.type}`);let Ft=Gt.enter?.(M,ee,we,Je);if(Ft===T)return!0;if(Ft!==u){if(Ft!==M&&jn(Ft))return Nc(Ft,ee,we,Je,Gt,Wt);let Kt=Yn(M);for(let zt=0;zt<Ht.length;zt++){let Xt=Ht[zt],Zt=Kt[Xt];if(Array.isArray(Zt))for(let Qt=0;Qt<Zt.length;Qt++){let en=Zt[Qt];if(jn(en)&&Vs(en,M,Xt,Qt,Gt,Wt))return!0}else if(jn(Zt)&&Vs(Zt,M,Xt,null,Gt,Wt))return!0}}return Gt.leave?.(M,ee,we,Je)===T}function Dc(M){let ee=M.type;if(ee==="Identifier")return M.typeAnnotation===void 0&&M.decorators===void 0?Ac:ls.Identifier;if(ee==="Literal")return ls.Literal;if(ee==="Text")return ls.Text;return $c[ee]}function Nc(M,ee,we,Je,Gt,Wt){if(ee===null||we===null)throw Error("walk can't replace the node it was called with");let Ht=Yn(ee),Ft=Ht[we];if(Je===null)Ht[we]=M;else if(Array.isArray(Ft))Ft[Je]=M;return Vs(M,ee,we,Je,Gt,Wt)}function i(M){return typeof M==="object"&&M!==null}function qe(M){return i(M)&&M.type==="VariableDeclaration"&&Array.isArray(M.declarations)}function A(M){return i(M)&&M.type==="Literal"}function t(M){return i(M)&&M.type==="Identifier"&&typeof M.name==="string"}function b(M){return i(M)&&M.type==="MemberExpression"}function p(M){return i(M)&&M.type==="ObjectExpression"&&Array.isArray(M.properties)}function _c(M){return i(M)&&M.type==="CallExpression"}function f(M,ee){return _c(M)&&t(M.callee)&&M.callee.name===ee}function w(M){return M?.type==="TSAsExpression"||M?.type==="TSSatisfiesExpression"?w(M.expression):M}function Fe(M){return M?.type==="TSAsExpression"||M?.type==="TSSatisfiesExpression"?M.typeAnnotation:void 0}function Rc(M){return i(M)&&M.type==="NewExpression"}function De(M,ee){return Rc(M)&&t(M.callee)&&M.callee.name===ee}function v(M){if(!i(M)||typeof M.type!=="string")return null;if(M.type==="Literal"){let ee=M.value;if(typeof ee==="string")return ee;return ee==null?null:String(ee)}if(M.type==="TemplateLiteral"){let ee=M.quasis;if(ee?.length===1)return ee[0]?.value?.cooked??null}return null}function c(M){if(t(M))return M.name;if(A(M))return M.value==null?void 0:String(M.value);return}function us(M,ee,we=0,Je=M.length,Gt=0){let Wt=Gt;for(let Ht=we;Ht<Je;Ht++){let Ft=M.charCodeAt(Ht);if(Ft===34||Ft===39||Ft===96){Ht=Ic(M,Ht,Je);continue}if(Ft===123||Ft===40||Ft===91||Ft===60)Wt++;else if(Ft===125||Ft===41||Ft===93||Ft===62&&M.charCodeAt(Ht-1)!==61){if(Wt>0)Wt--}if(ee?.(Ht,Wt)===!0)break}return Wt}function Ic(M,ee,we){let Je=M.charCodeAt(ee);for(let Gt=ee+1;Gt<we;Gt++){let Wt=M.charCodeAt(Gt);if(Wt===92)Gt++;else if(Wt===Je)return Gt}return we-1}function s(M,ee){let we=[],Je=0;return us(M,(Gt,Wt)=>{if(Wt===0&&ee.includes(M[Gt]))we.push(M.slice(Je,Gt)),Je=Gt+1;return!1}),we.push(M.slice(Je)),we}function re(M,ee){let we=-1;return us(M,(Je,Gt)=>{if(Gt===0&&ee.includes(M[Je]))we=Je;return we!==-1}),we}function Fi(M){let ee=-1;return us(M,(we,Je)=>{if(Je===0&&M[we]==="="&&M[we+1]===">")ee=we;return ee!==-1}),ee}function _(M,ee){let we=-1;return us(M,(Je,Gt)=>{if(Gt===0)we=Je;return we!==-1},ee),we}function ji(M){let ee=M.trim();return ee.startsWith("[")&&_(ee,0)===ee.length-1}function ie(M){if(!M)return;let ee=Fi(M);if(ee===-1)return;return M.slice(ee+2).trim()||void 0}function Lc(M){let ee="";for(let we=0;we<M.length;we++){let Je=M[we];if(Je==="*"&&M[we+1]==="*"){if(ee+=".*",we++,M[we+1]==="/")we++;continue}if(Je==="*"){ee+="[^/]*";continue}if(Je==="?"){ee+="[^/]";continue}ee+=".+^$()[]{}|\\".includes(Je)?`\\${Je}`:Je}return ee}function Ao(M,ee){return new RegExp(`^${Lc(M)}$`).test(ee)}var Oc={"prop-unknown-type":"warning","context-any-type":"warning","slot-missing-type":"warning","slot-not-rendered":"warning","event-no-source":"warning","dispatch-escapes":"warning","example-compile-error":"error","example-syntax-error":"error","syntax-skipped":"error","type-syntax-error":"error","rest-props-unresolved":"warning","context-duplicate-key":"warning","context-key-unresolved":"warning","context-value-unresolved":"warning","spread-unresolved":"warning","export-unresolved":"warning","module-export-conflict":"warning","extend-props-target-missing":"error","extend-props-duplicate":"warning","extend-props-override":"warning","jsdoc-unknown-tag":"warning","typedef-duplicate":"warning","property-duplicate":"warning","generics-conflict":"warning","event-description-ambiguous":"warning","jsdoc-tag-dropped":"warning","internal-typedef-referenced":"error","cross-file-unresolved":"warning","export-ambiguous":"warning"};function o(M){return{...M,code:H[M.kind],severity:Oc[M.kind]}}function se(M,ee){if(ee)return M;return M.filter((we)=>we.kind!=="jsdoc-unknown-tag")}function Do(M,ee){if(!ee)return[];return M.filter((we)=>!we.ignored&&(ee!=="errors"||we.severity==="error"))}function Mc(M,ee){if(ee.code!==void 0&&ee.code!==M.code)return!1;if(ee.name!==void 0&&ee.name!==M.name)return!1;if(ee.component!==void 0&&!Ao(ee.component,M.component))return!1;return!0}function No(M,ee){if(!ee||ee.length===0)return M;return M.map((we)=>we.ignored||ee.some((Je)=>Mc(we,Je))?{...we,ignored:!0}:we)}var _o={"prop-unknown-type":"Props without inferred types","context-any-type":"Context values typed as `any`","slot-missing-type":"@slot/@snippet tags missing a {Type} annotation","slot-not-rendered":"@slot/@snippet tags for slots the component doesn't render","event-no-source":"@event tags with no dispatch or callback","dispatch-escapes":"Dispatchers passed to functions sveld can't follow","example-compile-error":"@example blocks that failed to compile","example-syntax-error":"@example blocks that failed to parse","syntax-skipped":"Component syntax sveld skipped","type-syntax-error":"JSDoc types that aren't valid TypeScript","rest-props-unresolved":"$$restProps spread only onto components","context-duplicate-key":"Duplicate setContext keys","context-key-unresolved":"setContext keys sveld couldn't resolve","context-value-unresolved":"setContext values sveld couldn't describe","spread-unresolved":"Unresolved spreads widened to Record<string, any>","export-unresolved":"Unresolved named export specifiers","module-export-conflict":"Module-script exports colliding with generated names","extend-props-target-missing":"@extends/@extendProps targets that couldn't be verified","extend-props-duplicate":"Duplicate @extends/@extendProps tags","extend-props-override":"Own props overriding an @extends target's prop","jsdoc-unknown-tag":"Unknown JSDoc tags","typedef-duplicate":"Duplicate @typedef/@callback names","property-duplicate":"Duplicate @property names","generics-conflict":"Duplicate @generics/@template names","event-description-ambiguous":"Text after an @event read as the next tag's description","jsdoc-tag-dropped":"Passthrough JSDoc tags that couldn't attach","internal-typedef-referenced":"Public types referencing an @internal typedef","cross-file-unresolved":"Imports a standalone parse couldn't read","export-ambiguous":"Ambiguous `export *` names left out of the entry exports"},Ro=Object.keys(_o),H=Object.fromEntries(Ro.map((M)=>[M,`sveld/${M}`]));function Io(M){let ee=new Set,we=[];for(let Je of M){let Gt=`${Je.component}:${Je.kind}:${Je.name}`;if(ee.has(Gt))continue;ee.add(Gt),we.push(Je)}return we}function oe(M){let ee=M.filter((Kt)=>!Kt.ignored),we=M.length-ee.length,Je=we>0?` (${we} ignored)`:"";if(ee.length===0)return`sveld: no diagnostics${Je}.`;let Gt=[],Wt=(Kt,zt)=>`${Kt} ${zt}${Kt===1?"":"s"}`,Ht=ee.filter((Kt)=>Kt.severity==="error").length,Ft=`${Wt(Ht,"error")}, ${Wt(ee.length-Ht,"warning")}`;Gt.push(`sveld: ${Wt(ee.length,"diagnostic")} (${Ft})${Je}.`);for(let Kt of Ro){let zt=ee.filter((Zt)=>Zt.kind===Kt);if(zt.length===0)continue;Gt.push(""),Gt.push(`${_o[Kt]} (${zt.length}):`);let Xt=new Map;for(let Zt of zt){let Qt=Xt.get(Zt.component)??[];Qt.push(Zt),Xt.set(Zt.component,Qt)}for(let[Zt,Qt]of Xt){Gt.push(` ${Zt}`);for(let en of Qt){let tn=en.source?` (${Zt}:${en.source.start.line}:${en.source.start.column})`:"";Gt.push(` - ${en.message}${tn} [${en.code}]`)}}}return Gt.join(`
|
|
5
|
+
`)}var Ve=1;function ae(M){return`${JSON.stringify({kind:"diagnostics",schemaVersion:Ve,diagnostics:M},null,2)}
|
|
6
|
+
`}function Bi(M,ee){if(ee.length===0)return;M.diagnostics=[...M.diagnostics??[],...ee]}var Vi="/**",Lo="*",Gs="*/",Fc="```",Gi=/^\s+/,Oo=/\s/,jc=/^@[^\s/]+(?=\s|$)/,Bc=/^@(\S+)\s*/,Vc=new Set(["extends","extendProps","generics","template","typedef"]);function z(M){let ee=0;while(ee<M.length){let we=M.charCodeAt(ee);if(we!==32&&we!==9&&we!==13&&we!==10&&!Oo.test(M[ee]))break;ee++}return ee}function Gc(M,ee){let we=M.slice(z(M)),Je=!1;if(ee)we=we.slice(Vi.length),Je=!0;else if(we.startsWith(Lo)&&!we.startsWith(Gs))we=we.slice(Lo.length),Je=!0;let Gt=we.slice(0,z(we));we=we.slice(Gt.length);let Wt=we.trimEnd(),Ht=Wt.endsWith(Gs)?Wt.slice(0,-Gs.length).trimEnd():we;return{indent:Je?Gt.slice(1):Gt,content:Ht}}function Wc(M,ee,we){let Je=we>ee&&M.charCodeAt(we-1)===13?we-1:we;return M.slice(ee,Je)}function Uc(M){let ee=[],we=0;while(!0){let Je=M.indexOf(Vi,we);if(Je===-1)break;let Gt=M.lastIndexOf(`
|
|
7
|
+
`,Je-1)+1;if(M.charCodeAt(Je+Vi.length)===42||M.slice(Gt,Je).trim()!==""){we=Je+1;continue}let Wt=[],Ht=Gt,Ft=!1,Kt=0;while(Ht<=M.length){let zt=M.indexOf(`
|
|
8
|
+
`,Ht),Xt=zt===-1?M.length:zt,Zt=Wc(M,Ht,Xt),{indent:Qt,content:en}=Gc(Zt,Wt.length===0);Wt.push({raw:Zt,start:Ht,number:Wt.length,indent:Qt,content:en});let tn=Zt.trimEnd();if(tn.endsWith(Gs)){Ft=!0,Kt=Ht+tn.length,we=Xt;break}if(zt===-1)break;Ht=zt+1}if(!Ft)break;ee.push({start:Je,end:Kt,lines:Wt})}return ee}function Kc(M){let ee=M;if(ee.length>0&&ee[0].content==="")ee=ee.slice(1);if(ee.length>0&&ee[ee.length-1].content==="")ee=ee.slice(0,-1);return ee}function Hc(M){let ee=[[]],we=!1;for(let Je of M){if(jc.test(Je.content)&&!we)ee.push([Je]);else ee[ee.length-1].push(Je);if(X(Je.content))we=!we}return ee}function X(M){return qc(M,Fc)%2===1}function qc(M,ee){let we=0,Je=M.indexOf(ee);while(Je!==-1)we++,Je=M.indexOf(ee,Je+ee.length);return we}function Mo(M){return M.map((ee)=>ee.indent+ee.content).join(`
|
|
9
|
+
`)}function zc(M){let ee=0;while(ee<M.length-1&&M[ee].content.trim()==="")ee++;if(M[ee].content[0]!=="{")return null;let we=M.slice(ee).map((Kt)=>Kt.content).join(`
|
|
10
|
+
`),Je=_(we,0);if(Je===-1)return null;let Gt=[],Wt=Je+1;for(let Kt=ee;Wt>0;Kt++){let zt=M[Kt].content.length;Gt.push(Math.min(Wt,zt)),Wt-=zt+1}let Ht=ee+Gt.length-1;return{type:Gt.map((Kt,zt)=>{let Xt=ee+zt,Zt=M[Xt].content.slice(0,Kt);if(M[Xt].content=M[Xt].content.slice(Kt).replace(Gi,""),Xt>0)M[Xt].continuesType=!0;return zt===0?Zt:M[Xt].indent+Zt}).join(`
|
|
11
|
+
`).slice(1,-1),endIndex:Ht}}function Xc(M){let ee=M.content.match(Gi)?.[0]??"",we=M.content.slice(ee.length),Je=0,Gt=0;for(let zt of we){if(Je===0&&Oo.test(zt))break;if(zt==="[")Je++;if(zt==="]")Je--;Gt++}let Wt=Je===0?we.slice(0,Gt):"";if(!Wt)return null;let Ht=Wt,Ft=!1,Kt;if(Wt.startsWith("[")&&Wt.endsWith("]")){Ft=!0;let Xt=Wt.slice(1,-1).split("=");if(Ht=Xt[0].trim(),Xt.length>1)Kt=Xt.slice(1).join("=").trim();if(!Ht)return null}if(Ht.length>1&&(Ht[0]==='"'||Ht[0]==="'")&&Ht[Ht.length-1]===Ht[0])Ht=Ht.slice(1,-1);return M.content=we.slice(Gt).replace(Gi,""),{name:Ht,optional:Ft,default:Kt}}function Jc(M){let ee=M[0],we=ee.content.match(Bc),Je=we?we[1]:"",Gt=we?ee.content.slice(we[0].length):ee.content,Wt=Gt.trimEnd(),Ht=M.slice(1).map((en)=>en.indent+en.content),Ft=(Wt?[Wt,...Ht]:Ht).join(`
|
|
12
|
+
`);ee.content=Gt,ee.tag=Je;let Kt=zc(M),zt=Kt?.type??"",Xt=Kt?.endIndex??0;if(Vc.has(Je))while(Xt<M.length-1&&M[Xt].content.trim()==="")Xt++;let Zt=Xc(M[Xt]),Qt=Mo(M.slice(Xt));return{tag:Je,name:Zt?.name??"",type:zt,optional:Zt?.optional??!1,default:Zt?.default,description:Qt,text:Ft,lines:M}}function Yc(M,ee,we){let Je=Kc(M);Je.forEach((Ht,Ft)=>{Ht.number=Ft});let Gt=Hc(Je),Wt=Gt.slice(1).map(Jc);return{description:Mo(Gt[0]),tags:Wt,start:ee,end:we,lines:Je}}function E(M){return Uc(M).map(({start:ee,end:we,lines:Je})=>Yc(Je,ee,we))}var Qc=/\*\//g,Zc=/[.*+?^${}()|[\]\\]/g;function Q(M){return M.replace(Zc,"\\$&")}function S(M){return M.replace(Qc,"*\\/")}function y(M){return M.map((ee)=>`${ee.name}${ee.optional?"?":""}: ${ee.type}`).join(", ")}var el=new Intl.Collator("en");function l(M,ee){return el.compare(M,ee)}var tl=/(?:_|[^\p{ID_Continue}$])+/u,nl=/^[\p{ID_Start}$]/u;function O(M){let Je=`${M.split(tl).map((Gt)=>Gt.charAt(0).toUpperCase()+Gt.slice(1)).join("")}Context`;return nl.test(Je)?Je:`_${Je}`}function Y(M,ee){let we=ee.source.value;if(typeof we!=="string"||ee.importKind==="type")return;for(let Je of ee.specifiers){if(Je.type!=="ImportSpecifier"||Je.importKind==="type")continue;let Gt=Je.local.name,{imported:Wt}=Je,Ht=Wt.type==="Identifier"?Wt.name:typeof Wt.value==="string"?Wt.value:Gt;M.valueImportBindingsByLocalName.set(Gt,{localName:Gt,importedName:Ht,source:we})}}function ce(M){return[M.importedName,...M.members??[]].join(".")}function Pe(M,ee){let we=[],Je=ee;while(b(Je)){if(Je.computed||!t(Je.property))return;we.unshift(Je.property.name),Je=Je.object}if(!t(Je))return;return Ae(M,Je.name,we)}function Ae(M,ee,we=[]){let Je=(Wt,Ht,Ft)=>Ft.length>0?{source:Wt,importedName:Ht,members:Ft}:{source:Wt,importedName:Ht},Gt=M.valueImportBindingsByLocalName.get(ee);if(Gt)return Je(Gt.source,Gt.importedName,we);for(let Wt of[M.parsed?.instance,M.parsed?.module])for(let Ht of Wt?.content.body??[]){if(Ht.type!=="ImportDeclaration")continue;let Ft=Ht.source.value;if(Ht.importKind==="type"||typeof Ft!=="string")continue;let Kt=Ht.specifiers.find((zt)=>zt.local.name===ee);if(Kt?.type==="ImportDefaultSpecifier")return Je(Ft,"default",we);if(Kt?.type==="ImportNamespaceSpecifier"&&we.length>0)return Je(Ft,we[0],we.slice(1))}return}function pe(M,ee){if(!b(ee))return;return Pe(M,ee)}function Ue(M){let ee=new Map;for(let we of M.content.body){if(we.type!=="ImportDeclaration"||we.importKind==="type")continue;let Je=we.source.value;if(typeof Je!=="string")continue;for(let Gt of we.specifiers){if(Gt.type==="ImportSpecifier"&&Gt.importKind==="type")continue;let Wt=Gt.local.name,Ht;if(Gt.type==="ImportDefaultSpecifier")Ht="default";else if(Gt.type==="ImportNamespaceSpecifier")Ht="*";else if(Gt.imported.type==="Identifier")Ht=Gt.imported.name;else Ht=String(Gt.imported.value??Wt);ee.set(Wt,{from:Je,imported:Ht})}}return ee}function _e(M,ee){for(let we of ee?.content.body??[]){if(we.type==="ImportDeclaration"){Y(M,we);continue}let Je=we.type==="ExportNamedDeclaration"&&we.declaration?we.declaration:we;if(Je.type==="FunctionDeclaration"&&Je.id?.name)M.funcDecls.set(Je.id.name,Je)}}function ue(M){return M==="TSTypeAnnotation"||M==="TSTypeAliasDeclaration"||M==="TSInterfaceDeclaration"||M==="TSTypeParameterDeclaration"||M==="TSTypeParameterInstantiation"}function le(M){let ee=[];return a(M,{enter(we){if(we.type==="FunctionDeclaration"||we.type==="FunctionExpression"||we.type==="ArrowFunctionExpression")return u;if(we.type==="ReturnStatement")ee.push(we.argument??null)}}),ee}var Wi={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"},Ui="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",sl={5:Ui,"5module":Ui+" export import",6:Ui+" const class extends export import super"},Go=/^in(stanceof)?$/,il=/\p{ID_Start}/u,rl=/[\p{ID_Continue}\u200c\u200d]/u;function h(M,ee){if(M<65)return M===36;if(M<91)return!0;if(M<97)return M===95;if(M<123)return!0;if(M>65535&&ee===!1)return!1;return M>=170&&il.test(String.fromCodePoint(M))}function k(M,ee){if(M<48)return M===36;if(M<58)return!0;if(M<65)return!1;if(M<91)return!0;if(M<97)return M===95;if(M<123)return!0;if(M>65535&&ee===!1)return!1;return M>=170&&rl.test(String.fromCodePoint(M))}var ln=function(M,ee){if(ee===void 0)ee={};this.label=M,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 kn(M,ee){return new ln(M,{beforeExpr:!0,binop:ee})}var Tn={beforeExpr:!0},bn={startsExpr:!0},zi={};function cn(M,ee){if(ee===void 0)ee={};return ee.keyword=M,zi[M]=new ln(M,ee)}var Yt={num:new ln("num",bn),regexp:new ln("regexp",bn),string:new ln("string",bn),name:new ln("name",bn),privateId:new ln("privateId",bn),eof:new ln("eof"),bracketL:new ln("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new ln("]"),braceL:new ln("{",{beforeExpr:!0,startsExpr:!0}),braceR:new ln("}"),parenL:new ln("(",{beforeExpr:!0,startsExpr:!0}),parenR:new ln(")"),comma:new ln(",",Tn),semi:new ln(";",Tn),colon:new ln(":",Tn),dot:new ln("."),question:new ln("?",Tn),questionDot:new ln("?."),arrow:new ln("=>",Tn),template:new ln("template"),invalidTemplate:new ln("invalidTemplate"),ellipsis:new ln("...",Tn),backQuote:new ln("`",bn),dollarBraceL:new ln("${",{beforeExpr:!0,startsExpr:!0}),eq:new ln("=",{beforeExpr:!0,isAssign:!0}),assign:new ln("_=",{beforeExpr:!0,isAssign:!0}),incDec:new ln("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new ln("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:kn("||",1),logicalAND:kn("&&",2),bitwiseOR:kn("|",3),bitwiseXOR:kn("^",4),bitwiseAND:kn("&",5),equality:kn("==/!=/===/!==",6),relational:kn("</>/<=/>=",7),bitShift:kn("<</>>/>>>",8),plusMin:new ln("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:kn("%",10),star:kn("*",10),slash:kn("/",10),starstar:new ln("**",{beforeExpr:!0}),coalesce:kn("??",1),_break:cn("break"),_case:cn("case",Tn),_catch:cn("catch"),_continue:cn("continue"),_debugger:cn("debugger"),_default:cn("default",Tn),_do:cn("do",{isLoop:!0,beforeExpr:!0}),_else:cn("else",Tn),_finally:cn("finally"),_for:cn("for",{isLoop:!0}),_function:cn("function",bn),_if:cn("if"),_return:cn("return",Tn),_switch:cn("switch"),_throw:cn("throw",Tn),_try:cn("try"),_var:cn("var"),_const:cn("const"),_while:cn("while",{isLoop:!0}),_with:cn("with"),_new:cn("new",{beforeExpr:!0,startsExpr:!0}),_this:cn("this",bn),_super:cn("super",bn),_class:cn("class",bn),_extends:cn("extends",Tn),_export:cn("export"),_import:cn("import",bn),_null:cn("null",bn),_true:cn("true",bn),_false:cn("false",bn),_in:cn("in",{beforeExpr:!0,binop:7}),_instanceof:cn("instanceof",{beforeExpr:!0,binop:7}),_typeof:cn("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:cn("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:cn("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},Sn=/\r\n?|\n|\u2028|\u2029/,ol=new RegExp(Sn.source,"g");function hs(M){return M===10||M===13||M===8232||M===8233}function Wo(M,ee,we){if(we===void 0)we=M.length;for(var Je=ee;Je<we;Je++){var Gt=M.charCodeAt(Je);if(hs(Gt))return Je<we-1&&Gt===13&&M.charCodeAt(Je+1)===10?Je+2:Je+1}return-1}var Uo=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,mn=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,al=Object.prototype,{hasOwnProperty:pl,toString:cl}=al,ks=Object.hasOwn||function(M,ee){return pl.call(M,ee)},Fo=Array.isArray||function(M){return cl.call(M)==="[object Array]"},jo=Object.create(null);function Ws(M){return jo[M]||(jo[M]=new RegExp("^(?:"+M.replace(/ /g,"|")+")$"))}function qs(M){if(M<=65535)return String.fromCharCode(M);return M-=65536,String.fromCharCode((M>>10)+55296,(M&1023)+56320)}var ll=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,ws=function(M,ee){this.line=M,this.column=ee};ws.prototype.offset=function(M){return new ws(this.line,this.column+M)};var zs=function(M,ee,we){if(this.start=ee,this.end=we,M.sourceFile!==null)this.source=M.sourceFile};function Ko(M,ee){for(var we=1,Je=0;;){var Gt=Wo(M,Je,ee);if(Gt<0)return new ws(we,ee-Je);++we,Je=Gt}}var Ki={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},Bo=!1;function ul(M){var ee={};for(var we in Ki)ee[we]=M&&ks(M,we)?M[we]:Ki[we];if(ee.ecmaVersion==="latest")ee.ecmaVersion=1e8;else if(ee.ecmaVersion==null){if(!Bo&&typeof console==="object"&&console.warn)Bo=!0,console.warn(`Since Acorn 8.0.0, options.ecmaVersion is required.
|
|
13
|
+
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(!M||M.allowHashBang==null)ee.allowHashBang=ee.ecmaVersion>=14;if(Fo(ee.onToken)){var Je=ee.onToken;ee.onToken=function(Gt){return Je.push(Gt)}}if(Fo(ee.onComment))ee.onComment=hl(ee,ee.onComment);if(ee.sourceType==="commonjs"&&ee.allowAwaitOutsideFunction)throw Error("Cannot use allowAwaitOutsideFunction with sourceType: commonjs");return ee}function hl(M,ee){return function(we,Je,Gt,Wt,Ht,Ft){var Kt={type:we?"Block":"Line",value:Je,start:Gt,end:Wt};if(M.locations)Kt.loc=new zs(this,Ht,Ft);if(M.ranges)Kt.range=[Gt,Wt];ee.push(Kt)}}var Zn=1,es=2,Xi=4,Ho=8,Ji=16,qo=32,Xs=64,zo=128,ts=256,Ts=512,Xo=1024,Js=Zn|es|ts;function Yi(M,ee){return es|(M?Xi:0)|(ee?Ho:0)}var Us=0,Qi=1,Bn=2,Jo=3,Yo=4,Qo=5,r=function(M,ee,we){this.options=M=ul(M),this.sourceFile=M.sourceFile,this.keywords=Ws(sl[M.ecmaVersion>=6?6:M.sourceType==="module"?"5module":5]);var Je="";if(M.allowReserved!==!0){if(Je=Wi[M.ecmaVersion>=6?6:M.ecmaVersion===5?5:3],M.sourceType==="module")Je+=" await"}this.reservedWords=Ws(Je);var Gt=(Je?Je+" ":"")+Wi.strict;if(this.reservedWordsStrict=Ws(Gt),this.reservedWordsStrictBind=Ws(Gt+" "+Wi.strictBind),this.input=String(ee),this.containsEsc=!1,this.pos=we||0,this.curLine=1,M.startLocation)this.lineStart=this.pos-M.startLocation.column,this.curLine=M.startLocation.line;else if(we){if(this.lineStart=this.input.lastIndexOf(`
|
|
14
|
+
`,we-1)+1,this.options.locations)this.curLine=this.input.slice(0,this.lineStart).split(Sn).length}else this.lineStart=0;if(this.type=Yt.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=M.sourceType==="module",this.strict=this.inModule||M.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&&M.allowHashBang&&this.input.slice(0,2)==="#!")this.skipLineComment(2);this.scopeStack=[],this.enterScope(this.options.sourceType==="commonjs"?es:Zn),this.regexpState=null,this.privateNameStack=[]},Pn={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}};r.prototype.parse=function(){var M=this,ee=this.options.program||this.startNode();return this.nextToken(),this.catchStackOverflow(function(){return M.parseTopLevel(ee)})};Pn.inFunction.get=function(){return(this.currentVarScope().flags&es)>0};Pn.inGenerator.get=function(){return(this.currentVarScope().flags&Ho)>0};Pn.inAsync.get=function(){return(this.currentVarScope().flags&Xi)>0};Pn.canAwait.get=function(){for(var M=this.scopeStack.length-1;M>=0;M--){var ee=this.scopeStack[M],we=ee.flags;if(we&(ts|Ts))return!1;if(we&es)return(we&Xi)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction};Pn.allowReturn.get=function(){if(this.inFunction)return!0;if(this.options.allowReturnOutsideFunction&&this.currentVarScope().flags&Zn)return!0;return!1};Pn.allowSuper.get=function(){var M=this.currentThisScope(),ee=M.flags;return(ee&Xs)>0||this.options.allowSuperOutsideMethod};Pn.allowDirectSuper.get=function(){return(this.currentThisScope().flags&zo)>0};Pn.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())};Pn.allowNewDotTarget.get=function(){for(var M=this.scopeStack.length-1;M>=0;M--){var ee=this.scopeStack[M],we=ee.flags;if(we&(ts|Ts)||we&es&&!(we&Ji))return!0}return!1};Pn.allowUsing.get=function(){var M=this.currentScope(),ee=M.flags;if(ee&Xo)return!1;if(!this.inModule&&ee&Zn)return!1;return!0};Pn.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&ts)>0};r.extend=function(){var M=[],ee=arguments.length;while(ee--)M[ee]=arguments[ee];var we=this;for(var Je=0;Je<M.length;Je++)we=M[Je](we);return we};r.parse=function(M,ee){return new this(ee,M).parse()};r.parseExpressionAt=function(M,ee,we){var Je=new this(we,M,ee);return Je.nextToken(),Je.parseExpression()};r.tokenizer=function(M,ee){return new this(ee,M)};Object.defineProperties(r.prototype,Pn);var xn=r.prototype,dl=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;xn.strictDirective=function(M){if(this.options.ecmaVersion<5)return!1;for(;;){mn.lastIndex=M,M+=mn.exec(this.input)[0].length;var ee=dl.exec(this.input.slice(M));if(!ee)return!1;if((ee[1]||ee[2])==="use strict"){mn.lastIndex=M+ee[0].length;var we=mn.exec(this.input),Je=we.index+we[0].length,Gt=this.input.charAt(Je);return Gt===";"||Gt==="}"||Sn.test(we[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(Gt)||Gt==="!"&&this.input.charAt(Je+1)==="=")}if(M+=ee[0].length,mn.lastIndex=M,M+=mn.exec(this.input)[0].length,this.input[M]===";")M++}};xn.eat=function(M){if(this.type===M)return this.next(),!0;else return!1};xn.isContextual=function(M){return this.type===Yt.name&&this.value===M&&!this.containsEsc};xn.eatContextual=function(M){if(!this.isContextual(M))return!1;return this.next(),!0};xn.catchStackOverflow=function(M){try{return M()}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}};xn.expectContextual=function(M){if(!this.eatContextual(M))this.unexpected()};xn.canInsertSemicolon=function(){return this.type===Yt.eof||this.type===Yt.braceR||Sn.test(this.input.slice(this.lastTokEnd,this.start))};xn.insertSemicolon=function(){if(this.canInsertSemicolon()){if(this.options.onInsertedSemicolon)this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc);return!0}};xn.semicolon=function(){if(!this.eat(Yt.semi)&&!this.insertSemicolon())this.unexpected()};xn.afterTrailingComma=function(M,ee){if(this.type===M){if(this.options.onTrailingComma)this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc);if(!ee)this.next();return!0}};xn.expect=function(M){this.eat(M)||this.unexpected()};xn.unexpected=function(M){this.raise(M!=null?M:this.start,"Unexpected token")};var Ys=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};xn.checkPatternErrors=function(M,ee){if(!M)return;if(M.trailingComma>-1)this.raiseRecoverable(M.trailingComma,"Comma is not permitted after the rest element");var we=ee?M.parenthesizedAssign:M.parenthesizedBind;if(we>-1)this.raiseRecoverable(we,ee?"Assigning to rvalue":"Parenthesized pattern")};xn.checkExpressionErrors=function(M,ee){if(!M)return!1;var{shorthandAssign:we,doubleProto:Je}=M;if(!ee)return we>=0||Je>=0;if(we>=0)this.raise(we,"Shorthand property assignments are valid only in destructuring patterns");if(Je>=0)this.raiseRecoverable(Je,"Redefinition of __proto__ property")};xn.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")};xn.isSimpleAssignTarget=function(M){if(M.type==="ParenthesizedExpression")return this.isSimpleAssignTarget(M.expression);return M.type==="Identifier"||M.type==="MemberExpression"};var rn=r.prototype;rn.parseTopLevel=function(M){var ee=Object.create(null);if(!M.body)M.body=[];while(this.type!==Yt.eof){var we=this.parseStatement(null,!0,ee);M.body.push(we)}if(this.inModule)for(var Je=0,Gt=Object.keys(this.undefinedExports);Je<Gt.length;Je+=1){var Wt=Gt[Je];this.raiseRecoverable(this.undefinedExports[Wt].start,"Export '"+Wt+"' is not defined")}return this.adaptDirectivePrologue(M.body),this.next(),M.sourceType=this.options.sourceType==="commonjs"?"script":this.options.sourceType,this.finishNode(M,"Program")};var Zi={kind:"loop"},fl={kind:"switch"};rn.isLet=function(M){if(this.options.ecmaVersion<6||!this.isContextual("let"))return!1;mn.lastIndex=this.pos;var ee=mn.exec(this.input),we=this.pos+ee[0].length,Je=this.fullCharCodeAt(we);if(Je===91||Je===92)return!0;if(M)return!1;if(Je===123)return!0;if(h(Je)){var Gt=we;do we+=Je<=65535?1:2;while(k(Je=this.fullCharCodeAt(we)));if(Je===92)return!0;var Wt=this.input.slice(Gt,we);if(!Go.test(Wt))return!0}return!1};rn.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;mn.lastIndex=this.pos;var M=mn.exec(this.input),ee=this.pos+M[0].length,we;return!Sn.test(this.input.slice(this.pos,ee))&&this.input.slice(ee,ee+8)==="function"&&(ee+8===this.input.length||!(k(we=this.fullCharCodeAt(ee+8))||we===92))};rn.isUsingKeyword=function(M,ee){if(this.options.ecmaVersion<17||!this.isContextual(M?"await":"using"))return!1;mn.lastIndex=this.pos;var we=mn.exec(this.input),Je=this.pos+we[0].length;if(Sn.test(this.input.slice(this.pos,Je)))return!1;if(M){var Gt=Je+5,Wt;if(this.input.slice(Je,Gt)!=="using"||Gt===this.input.length||k(Wt=this.fullCharCodeAt(Gt))||Wt===92)return!1;mn.lastIndex=Gt;var Ht=mn.exec(this.input);if(Je=Gt+Ht[0].length,Ht&&Sn.test(this.input.slice(Gt,Je)))return!1}var Ft=this.fullCharCodeAt(Je);if(!h(Ft)&&Ft!==92)return!1;var Kt=Je;do Je+=Ft<=65535?1:2;while(k(Ft=this.fullCharCodeAt(Je)));if(Ft===92)return!0;var zt=this.input.slice(Kt,Je);if(Go.test(zt))return!1;if(ee&&!M&&zt==="of"){mn.lastIndex=Je;var Xt=mn.exec(this.input);if(Je=Je+Xt[0].length,this.input.charCodeAt(Je)!==61||(Ft=this.input.charCodeAt(Je+1))===61||Ft===62)return!1}return!0};rn.isAwaitUsing=function(M){return this.isUsingKeyword(!0,M)};rn.isUsing=function(M){return this.isUsingKeyword(!1,M)};rn.parseStatement=function(M,ee,we){var Je=this.type,Gt=this.startNode(),Wt;if(this.isLet(M))Je=Yt._var,Wt="let";switch(Je){case Yt._break:case Yt._continue:return this.parseBreakContinueStatement(Gt,Je.keyword);case Yt._debugger:return this.parseDebuggerStatement(Gt);case Yt._do:return this.parseDoStatement(Gt);case Yt._for:return this.parseForStatement(Gt);case Yt._function:if(M&&(this.strict||M!=="if"&&M!=="label")&&this.options.ecmaVersion>=6)this.unexpected();return this.parseFunctionStatement(Gt,!1,!M);case Yt._class:if(M)this.unexpected();return this.parseClass(Gt,!0);case Yt._if:return this.parseIfStatement(Gt);case Yt._return:return this.parseReturnStatement(Gt);case Yt._switch:return this.parseSwitchStatement(Gt);case Yt._throw:return this.parseThrowStatement(Gt);case Yt._try:return this.parseTryStatement(Gt);case Yt._const:case Yt._var:if(Wt=Wt||this.value,M&&Wt!=="var")this.unexpected();return this.parseVarStatement(Gt,Wt);case Yt._while:return this.parseWhileStatement(Gt);case Yt._with:return this.parseWithStatement(Gt);case Yt.braceL:return this.parseBlock(!0,Gt);case Yt.semi:return this.parseEmptyStatement(Gt);case Yt._export:case Yt._import:if(this.options.ecmaVersion>10&&Je===Yt._import){mn.lastIndex=this.pos;var Ht=mn.exec(this.input),Ft=this.pos+Ht[0].length,Kt=this.input.charCodeAt(Ft);if(Kt===40||Kt===46)return this.parseExpressionStatement(Gt,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 Je===Yt._import?this.parseImport(Gt):this.parseExport(Gt,we);default:if(this.isAsyncFunction()){if(M)this.unexpected();return this.next(),this.parseFunctionStatement(Gt,!0,!M)}var zt=this.isAwaitUsing(!1)?"await using":this.isUsing(!1)?"using":null;if(zt){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(M)this.raise(this.start,"Using declaration is not allowed in single-statement positions");if(zt==="await using"){if(!this.canAwait)this.raise(this.start,"Await using cannot appear outside of async function");this.next()}return this.next(),this.parseVar(Gt,!1,zt),this.semicolon(),this.finishNode(Gt,"VariableDeclaration")}var Xt=this.value,Zt=this.parseExpression();if(Je===Yt.name&&Zt.type==="Identifier"&&this.eat(Yt.colon))return this.parseLabeledStatement(Gt,Xt,Zt,M);else return this.parseExpressionStatement(Gt,Zt)}};rn.parseBreakContinueStatement=function(M,ee){var we=ee==="break";if(this.next(),this.eat(Yt.semi)||this.insertSemicolon())M.label=null;else if(this.type!==Yt.name)this.unexpected();else M.label=this.parseIdent(),this.semicolon();var Je=0;for(;Je<this.labels.length;++Je){var Gt=this.labels[Je];if(M.label==null||Gt.name===M.label.name){if(Gt.kind!=null&&(we||Gt.kind==="loop"))break;if(M.label&&we)break}}if(Je===this.labels.length)this.raise(M.start,"Unsyntactic "+ee);return this.finishNode(M,we?"BreakStatement":"ContinueStatement")};rn.parseDebuggerStatement=function(M){return this.next(),this.semicolon(),this.finishNode(M,"DebuggerStatement")};rn.parseDoStatement=function(M){if(this.next(),this.labels.push(Zi),M.body=this.parseStatement("do"),this.labels.pop(),this.expect(Yt._while),M.test=this.parseParenExpression(),this.options.ecmaVersion>=6)this.eat(Yt.semi);else this.semicolon();return this.finishNode(M,"DoWhileStatement")};rn.parseForStatement=function(M){this.next();var ee=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(Zi),this.enterScope(0),this.expect(Yt.parenL),this.type===Yt.semi){if(ee>-1)this.unexpected(ee);return this.parseFor(M,null)}var we=this.isLet();if(this.type===Yt._var||this.type===Yt._const||we){var Je=this.startNode(),Gt=we?"let":this.value;return this.next(),this.parseVar(Je,!0,Gt),this.finishNode(Je,"VariableDeclaration"),this.parseForAfterInit(M,Je,ee)}var Wt=this.isContextual("let"),Ht=!1,Ft=this.isUsing(!0)?"using":this.isAwaitUsing(!0)?"await using":null;if(Ft){var Kt=this.startNode();if(this.next(),Ft==="await using"){if(!this.canAwait)this.raise(this.start,"Await using cannot appear outside of async function");this.next()}return this.parseVar(Kt,!0,Ft),this.finishNode(Kt,"VariableDeclaration"),this.parseForAfterInit(M,Kt,ee)}var zt=this.containsEsc,Xt=new Ys,Zt=this.start,Qt=ee>-1?this.parseExprSubscripts(Xt,"await"):this.parseExpression(!0,Xt);if(this.type===Yt._in||(Ht=this.options.ecmaVersion>=6&&this.isContextual("of"))){if(ee>-1){if(this.type===Yt._in)this.unexpected(ee);M.await=!0}else if(Ht&&this.options.ecmaVersion>=8){if(Qt.start===Zt&&!zt&&Qt.type==="Identifier"&&Qt.name==="async")this.unexpected();else if(this.options.ecmaVersion>=9)M.await=!1}if(Wt&&Ht)this.raise(Qt.start,"The left-hand side of a for-of loop may not start with 'let'.");return this.toAssignable(Qt,!1,Xt),this.checkLValPattern(Qt),this.parseForIn(M,Qt)}else this.checkExpressionErrors(Xt,!0);if(ee>-1)this.unexpected(ee);return this.parseFor(M,Qt)};rn.parseForAfterInit=function(M,ee,we){if((this.type===Yt._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&ee.declarations.length===1){if(this.type===Yt._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&&we>-1)this.unexpected(we)}else if(this.options.ecmaVersion>=9)M.await=we>-1;return this.parseForIn(M,ee)}if(we>-1)this.unexpected(we);return this.parseFor(M,ee)};rn.parseFunctionStatement=function(M,ee,we){return this.next(),this.parseFunction(M,Cs|(we?0:Hi),!1,ee)};rn.parseIfStatement=function(M){return this.next(),M.test=this.parseParenExpression(),M.consequent=this.parseStatement("if"),M.alternate=this.eat(Yt._else)?this.parseStatement("if"):null,this.finishNode(M,"IfStatement")};rn.parseReturnStatement=function(M){if(!this.allowReturn)this.raise(this.start,"'return' outside of function");if(this.next(),this.eat(Yt.semi)||this.insertSemicolon())M.argument=null;else M.argument=this.parseExpression(),this.semicolon();return this.finishNode(M,"ReturnStatement")};rn.parseSwitchStatement=function(M){this.next(),M.discriminant=this.parseParenExpression(),M.cases=[],this.expect(Yt.braceL),this.labels.push(fl),this.enterScope(Xo);var ee;for(var we=!1;this.type!==Yt.braceR;)if(this.type===Yt._case||this.type===Yt._default){var Je=this.type===Yt._case;if(ee)this.finishNode(ee,"SwitchCase");if(M.cases.push(ee=this.startNode()),ee.consequent=[],this.next(),Je)ee.test=this.parseExpression();else{if(we)this.raiseRecoverable(this.lastTokStart,"Multiple default clauses");we=!0,ee.test=null}this.expect(Yt.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(M,"SwitchStatement")};rn.parseThrowStatement=function(M){if(this.next(),Sn.test(this.input.slice(this.lastTokEnd,this.start)))this.raise(this.lastTokEnd,"Illegal newline after throw");return M.argument=this.parseExpression(),this.semicolon(),this.finishNode(M,"ThrowStatement")};var ml=[];rn.parseCatchClauseParam=function(){var M=this.parseBindingAtom(),ee=M.type==="Identifier";return this.enterScope(ee?qo:0),this.checkLValPattern(M,ee?Yo:Bn),this.expect(Yt.parenR),M};rn.parseTryStatement=function(M){if(this.next(),M.block=this.parseBlock(),M.handler=null,this.type===Yt._catch){var ee=this.startNode();if(this.next(),this.eat(Yt.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(),M.handler=this.finishNode(ee,"CatchClause")}if(M.finalizer=this.eat(Yt._finally)?this.parseBlock():null,!M.handler&&!M.finalizer)this.raise(M.start,"Missing catch or finally clause");return this.finishNode(M,"TryStatement")};rn.parseVarStatement=function(M,ee,we){return this.next(),this.parseVar(M,!1,ee,we),this.semicolon(),this.finishNode(M,"VariableDeclaration")};rn.parseWhileStatement=function(M){return this.next(),M.test=this.parseParenExpression(),this.labels.push(Zi),M.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(M,"WhileStatement")};rn.parseWithStatement=function(M){if(this.strict)this.raise(this.start,"'with' in strict mode");return this.next(),M.object=this.parseParenExpression(),M.body=this.parseStatement("with"),this.finishNode(M,"WithStatement")};rn.parseEmptyStatement=function(M){return this.next(),this.finishNode(M,"EmptyStatement")};rn.parseLabeledStatement=function(M,ee,we,Je){for(var Gt=0,Wt=this.labels;Gt<Wt.length;Gt+=1){var Ht=Wt[Gt];if(Ht.name===ee)this.raise(we.start,"Label '"+ee+"' is already declared")}var Ft=this.type.isLoop?"loop":this.type===Yt._switch?"switch":null;for(var Kt=this.labels.length-1;Kt>=0;Kt--){var zt=this.labels[Kt];if(zt.statementStart===M.start)zt.statementStart=this.start,zt.kind=Ft;else break}return this.labels.push({name:ee,kind:Ft,statementStart:this.start}),M.body=this.parseStatement(Je?Je.indexOf("label")===-1?Je+"label":Je:"label"),this.labels.pop(),M.label=we,this.finishNode(M,"LabeledStatement")};rn.parseExpressionStatement=function(M,ee){return M.expression=ee,this.semicolon(),this.finishNode(M,"ExpressionStatement")};rn.parseBlock=function(M,ee,we){if(M===void 0)M=!0;if(ee===void 0)ee=this.startNode();if(ee.body=[],this.expect(Yt.braceL),M)this.enterScope(0);while(this.type!==Yt.braceR){var Je=this.parseStatement(null);ee.body.push(Je)}if(we)this.strict=!1;if(this.next(),M)this.exitScope();return this.finishNode(ee,"BlockStatement")};rn.parseFor=function(M,ee){return M.init=ee,this.expect(Yt.semi),M.test=this.type===Yt.semi?null:this.parseExpression(),this.expect(Yt.semi),M.update=this.type===Yt.parenR?null:this.parseExpression(),this.expect(Yt.parenR),M.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(M,"ForStatement")};rn.parseForIn=function(M,ee){var we=this.type===Yt._in;if(this.next(),ee.type==="VariableDeclaration"&&ee.declarations[0].init!=null&&(!we||this.options.ecmaVersion<8||this.strict||ee.kind!=="var"||ee.declarations[0].id.type!=="Identifier"))this.raise(ee.start,(we?"for-in":"for-of")+" loop variable declaration may not have an initializer");return M.left=ee,M.right=we?this.parseExpression():this.parseMaybeAssign(),this.expect(Yt.parenR),M.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(M,we?"ForInStatement":"ForOfStatement")};rn.parseVar=function(M,ee,we,Je){M.declarations=[],M.kind=we;for(;;){var Gt=this.startNode();if(this.parseVarId(Gt,we),this.eat(Yt.eq))Gt.init=this.parseMaybeAssign(ee);else if(!Je&&we==="const"&&!(this.type===Yt._in||this.options.ecmaVersion>=6&&this.isContextual("of")))this.unexpected();else if(!Je&&(we==="using"||we==="await using")&&this.options.ecmaVersion>=17&&this.type!==Yt._in&&!this.isContextual("of"))this.raise(this.lastTokEnd,"Missing initializer in "+we+" declaration");else if(!Je&&Gt.id.type!=="Identifier"&&!(ee&&(this.type===Yt._in||this.isContextual("of"))))this.raise(this.lastTokEnd,"Complex binding patterns require an initialization value");else Gt.init=null;if(M.declarations.push(this.finishNode(Gt,"VariableDeclarator")),!this.eat(Yt.comma))break}return M};rn.parseVarId=function(M,ee){M.id=ee==="using"||ee==="await using"?this.parseIdent():this.parseBindingAtom(),this.checkLValPattern(M.id,ee==="var"?Qi:Bn,!1)};var Cs=1,Hi=2,Zo=4;rn.parseFunction=function(M,ee,we,Je,Gt){if(this.initFunction(M),this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!Je){if(this.type===Yt.star&&ee&Hi)this.unexpected();M.generator=this.eat(Yt.star)}if(this.options.ecmaVersion>=8)M.async=!!Je;if(ee&Cs){if(M.id=ee&Zo&&this.type!==Yt.name?null:this.parseIdent(),M.id&&!(ee&Hi))this.checkLValSimple(M.id,this.strict||M.generator||M.async?this.treatFunctionsAsVar?Qi:Bn:Jo)}var Wt=this.yieldPos,Ht=this.awaitPos,Ft=this.awaitIdentPos;if(this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(Yi(M.async,M.generator)),!(ee&Cs))M.id=this.type===Yt.name?this.parseIdent():null;return this.parseFunctionParams(M),this.parseFunctionBody(M,we,!1,Gt),this.yieldPos=Wt,this.awaitPos=Ht,this.awaitIdentPos=Ft,this.finishNode(M,ee&Cs?"FunctionDeclaration":"FunctionExpression")};rn.parseFunctionParams=function(M){this.expect(Yt.parenL),M.params=this.parseBindingList(Yt.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()};rn.parseClass=function(M,ee){this.next();var we=this.strict;this.strict=!0,this.parseClassId(M,ee),this.parseClassSuper(M);var Je=this.enterClassBody(),Gt=this.startNode(),Wt=!1;Gt.body=[],this.expect(Yt.braceL);while(this.type!==Yt.braceR){var Ht=this.parseClassElement(M.superClass!==null);if(Ht){if(Gt.body.push(Ht),Ht.type==="MethodDefinition"&&Ht.kind==="constructor"){if(Wt)this.raiseRecoverable(Ht.start,"Duplicate constructor in the same class");Wt=!0}else if(Ht.key&&Ht.key.type==="PrivateIdentifier"&&gl(Je,Ht))this.raiseRecoverable(Ht.key.start,"Identifier '#"+Ht.key.name+"' has already been declared")}}return this.strict=we,this.next(),M.body=this.finishNode(Gt,"ClassBody"),this.exitClassBody(),this.finishNode(M,ee?"ClassDeclaration":"ClassExpression")};rn.parseClassElement=function(M){if(this.eat(Yt.semi))return null;var ee=this.options.ecmaVersion,we=this.startNode(),Je="",Gt=!1,Wt=!1,Ht="method",Ft=!1;if(this.eatContextual("static")){if(ee>=13&&this.eat(Yt.braceL))return this.parseClassStaticBlock(we),we;if(this.isClassElementNameStart()||this.type===Yt.star)Ft=!0;else Je="static"}if(we.static=Ft,!Je&&ee>=8&&this.eatContextual("async"))if((this.isClassElementNameStart()||this.type===Yt.star)&&!this.canInsertSemicolon())Wt=!0;else Je="async";if(!Je&&(ee>=9||!Wt)&&this.eat(Yt.star))Gt=!0;if(!Je&&!Wt&&!Gt){var Kt=this.value;if(this.eatContextual("get")||this.eatContextual("set"))if(this.isClassElementNameStart())Ht=Kt;else Je=Kt}if(Je)we.computed=!1,we.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),we.key.name=Je,this.finishNode(we.key,"Identifier");else this.parseClassElementName(we);if(ee<13||this.type===Yt.parenL||Ht!=="method"||Gt||Wt){var zt=!we.static&&Ks(we,"constructor"),Xt=zt&&M;if(zt&&Ht!=="method")this.raise(we.key.start,"Constructor can't have get/set modifier");we.kind=zt?"constructor":Ht,this.parseClassMethod(we,Gt,Wt,Xt)}else this.parseClassField(we);return we};rn.isClassElementNameStart=function(){return this.type===Yt.name||this.type===Yt.privateId||this.type===Yt.num||this.type===Yt.string||this.type===Yt.bracketL||this.type.keyword};rn.parseClassElementName=function(M){if(this.type===Yt.privateId){if(this.value==="constructor")this.raise(this.start,"Classes can't have an element named '#constructor'");M.computed=!1,M.key=this.parsePrivateIdent()}else this.parsePropertyName(M)};rn.parseClassMethod=function(M,ee,we,Je){var Gt=M.key;if(M.kind==="constructor"){if(ee)this.raise(Gt.start,"Constructor can't be a generator");if(we)this.raise(Gt.start,"Constructor can't be an async method")}else if(M.static&&Ks(M,"prototype"))this.raise(Gt.start,"Classes may not have a static property named prototype");var Wt=M.value=this.parseMethod(ee,we,Je);if(M.kind==="get"&&Wt.params.length!==0)this.raiseRecoverable(Wt.start,"getter should have no params");if(M.kind==="set"&&Wt.params.length!==1)this.raiseRecoverable(Wt.start,"setter should have exactly one param");if(M.kind==="set"&&Wt.params[0].type==="RestElement")this.raiseRecoverable(Wt.params[0].start,"Setter cannot use rest params");return this.finishNode(M,"MethodDefinition")};rn.parseClassField=function(M){if(Ks(M,"constructor"))this.raise(M.key.start,"Classes can't have a field named 'constructor'");else if(M.static&&Ks(M,"prototype"))this.raise(M.key.start,"Classes can't have a static field named 'prototype'");if(this.eat(Yt.eq))this.enterScope(Ts|Xs),M.value=this.parseMaybeAssign(),this.exitScope();else M.value=null;return this.semicolon(),this.finishNode(M,"PropertyDefinition")};rn.parseClassStaticBlock=function(M){M.body=[];var ee=this.labels;this.labels=[],this.enterScope(ts|Xs);while(this.type!==Yt.braceR){var we=this.parseStatement(null);M.body.push(we)}return this.next(),this.exitScope(),this.labels=ee,this.finishNode(M,"StaticBlock")};rn.parseClassId=function(M,ee){if(this.type===Yt.name){if(M.id=this.parseIdent(),ee)this.checkLValSimple(M.id,Bn,!1)}else{if(ee===!0)this.unexpected();M.id=null}};rn.parseClassSuper=function(M){M.superClass=this.eat(Yt._extends)?this.parseExprSubscripts(null,!1):null};rn.enterClassBody=function(){var M={declared:Object.create(null),used:[]};return this.privateNameStack.push(M),M.declared};rn.exitClassBody=function(){var M=this.privateNameStack.pop(),{declared:ee,used:we}=M;if(!this.options.checkPrivateFields)return;var Je=this.privateNameStack.length,Gt=Je===0?null:this.privateNameStack[Je-1];for(var Wt=0;Wt<we.length;++Wt){var Ht=we[Wt];if(!ks(ee,Ht.name))if(Gt)Gt.used.push(Ht);else this.raiseRecoverable(Ht.start,"Private field '#"+Ht.name+"' must be declared in an enclosing class")}};function gl(M,ee){var we=ee.key.name,Je=M[we],Gt="true";if(ee.type==="MethodDefinition"&&(ee.kind==="get"||ee.kind==="set"))Gt=(ee.static?"s":"i")+ee.kind;if(Je==="iget"&&Gt==="iset"||Je==="iset"&&Gt==="iget"||Je==="sget"&&Gt==="sset"||Je==="sset"&&Gt==="sget")return M[we]="true",!1;else if(!Je)return M[we]=Gt,!1;else return!0}function Ks(M,ee){var{computed:we,key:Je}=M;return!we&&(Je.type==="Identifier"&&Je.name===ee||Je.type==="Literal"&&Je.value===ee)}rn.parseExportAllDeclaration=function(M,ee){if(this.options.ecmaVersion>=11)if(this.eatContextual("as"))M.exported=this.parseModuleExportName(),this.checkExport(ee,M.exported,this.lastTokStart);else M.exported=null;if(this.expectContextual("from"),this.type!==Yt.string)this.unexpected();if(M.source=this.parseExprAtom(),this.options.ecmaVersion>=16)M.attributes=this.parseWithClause();return this.semicolon(),this.finishNode(M,"ExportAllDeclaration")};rn.parseExport=function(M,ee){if(this.next(),this.eat(Yt.star))return this.parseExportAllDeclaration(M,ee);if(this.eat(Yt._default))return this.checkExport(ee,"default",this.lastTokStart),M.declaration=this.parseExportDefaultDeclaration(),this.finishNode(M,"ExportDefaultDeclaration");if(this.shouldParseExportStatement()){if(M.declaration=this.parseExportDeclaration(M),M.declaration.type==="VariableDeclaration")this.checkVariableExport(ee,M.declaration.declarations);else this.checkExport(ee,M.declaration.id,M.declaration.id.start);if(M.specifiers=[],M.source=null,this.options.ecmaVersion>=16)M.attributes=[]}else{if(M.declaration=null,M.specifiers=this.parseExportSpecifiers(ee),this.eatContextual("from")){if(this.type!==Yt.string)this.unexpected();if(M.source=this.parseExprAtom(),this.options.ecmaVersion>=16)M.attributes=this.parseWithClause()}else{for(var we=0,Je=M.specifiers;we<Je.length;we+=1){var Gt=Je[we];if(this.checkUnreserved(Gt.local),this.checkLocalExport(Gt.local),Gt.local.type==="Literal")this.raise(Gt.local.start,"A string literal cannot be used as an exported binding without `from`.")}if(M.source=null,this.options.ecmaVersion>=16)M.attributes=[]}this.semicolon()}return this.finishNode(M,"ExportNamedDeclaration")};rn.parseExportDeclaration=function(M){return this.parseStatement(null)};rn.parseExportDefaultDeclaration=function(){var M;if(this.type===Yt._function||(M=this.isAsyncFunction())){var ee=this.startNode();if(this.next(),M)this.next();return this.parseFunction(ee,Cs|Zo,!1,M)}else if(this.type===Yt._class){var we=this.startNode();return this.parseClass(we,"nullableID")}else{var Je=this.parseMaybeAssign();return this.semicolon(),Je}};rn.checkExport=function(M,ee,we){if(!M)return;if(typeof ee!=="string")ee=ee.type==="Identifier"?ee.name:ee.value;if(ks(M,ee))this.raiseRecoverable(we,"Duplicate export '"+ee+"'");M[ee]=!0};rn.checkPatternExport=function(M,ee){var we=ee.type;if(we==="Identifier")this.checkExport(M,ee,ee.start);else if(we==="ObjectPattern")for(var Je=0,Gt=ee.properties;Je<Gt.length;Je+=1){var Wt=Gt[Je];this.checkPatternExport(M,Wt)}else if(we==="ArrayPattern")for(var Ht=0,Ft=ee.elements;Ht<Ft.length;Ht+=1){var Kt=Ft[Ht];if(Kt)this.checkPatternExport(M,Kt)}else if(we==="Property")this.checkPatternExport(M,ee.value);else if(we==="AssignmentPattern")this.checkPatternExport(M,ee.left);else if(we==="RestElement")this.checkPatternExport(M,ee.argument)};rn.checkVariableExport=function(M,ee){if(!M)return;for(var we=0,Je=ee;we<Je.length;we+=1){var Gt=Je[we];this.checkPatternExport(M,Gt.id)}};rn.shouldParseExportStatement=function(){return this.type.keyword==="var"||this.type.keyword==="const"||this.type.keyword==="class"||this.type.keyword==="function"||this.isLet()||this.isAsyncFunction()};rn.parseExportSpecifier=function(M){var ee=this.startNode();return ee.local=this.parseModuleExportName(),ee.exported=this.eatContextual("as")?this.parseModuleExportName():ee.local,this.checkExport(M,ee.exported,ee.exported.start),this.finishNode(ee,"ExportSpecifier")};rn.parseExportSpecifiers=function(M){var ee=[],we=!0;this.expect(Yt.braceL);while(!this.eat(Yt.braceR)){if(!we){if(this.expect(Yt.comma),this.afterTrailingComma(Yt.braceR))break}else we=!1;ee.push(this.parseExportSpecifier(M))}return ee};rn.parseImport=function(M){if(this.next(),this.type===Yt.string)M.specifiers=ml,M.source=this.parseExprAtom();else M.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),M.source=this.type===Yt.string?this.parseExprAtom():this.unexpected();if(this.options.ecmaVersion>=16)M.attributes=this.parseWithClause();return this.semicolon(),this.finishNode(M,"ImportDeclaration")};rn.parseImportSpecifier=function(){var M=this.startNode();if(M.imported=this.parseModuleExportName(),this.eatContextual("as"))M.local=this.parseIdent();else this.checkUnreserved(M.imported),M.local=M.imported;return this.checkLValSimple(M.local,Bn),this.finishNode(M,"ImportSpecifier")};rn.parseImportDefaultSpecifier=function(){var M=this.startNode();return M.local=this.parseIdent(),this.checkLValSimple(M.local,Bn),this.finishNode(M,"ImportDefaultSpecifier")};rn.parseImportNamespaceSpecifier=function(){var M=this.startNode();return this.next(),this.expectContextual("as"),M.local=this.parseIdent(),this.checkLValSimple(M.local,Bn),this.finishNode(M,"ImportNamespaceSpecifier")};rn.parseImportSpecifiers=function(){var M=[],ee=!0;if(this.type===Yt.name){if(M.push(this.parseImportDefaultSpecifier()),!this.eat(Yt.comma))return M}if(this.type===Yt.star)return M.push(this.parseImportNamespaceSpecifier()),M;this.expect(Yt.braceL);while(!this.eat(Yt.braceR)){if(!ee){if(this.expect(Yt.comma),this.afterTrailingComma(Yt.braceR))break}else ee=!1;M.push(this.parseImportSpecifier())}return M};rn.parseWithClause=function(){var M=[];if(!this.eat(Yt._with))return M;this.expect(Yt.braceL);var ee={},we=!0;while(!this.eat(Yt.braceR)){if(!we){if(this.expect(Yt.comma),this.afterTrailingComma(Yt.braceR))break}else we=!1;var Je=this.parseImportAttribute(),Gt=Je.key.type==="Identifier"?Je.key.name:Je.key.value;if(ks(ee,Gt))this.raiseRecoverable(Je.key.start,"Duplicate attribute key '"+Gt+"'");ee[Gt]=!0,M.push(Je)}return M};rn.parseImportAttribute=function(){var M=this.startNode();if(M.key=this.type===Yt.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never"),this.expect(Yt.colon),this.type!==Yt.string)this.unexpected();return M.value=this.parseExprAtom(),this.finishNode(M,"ImportAttribute")};rn.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===Yt.string){var M=this.parseLiteral(this.value);if(ll.test(M.value))this.raise(M.start,"An export name cannot include a lone surrogate.");return M}return this.parseIdent(!0)};rn.adaptDirectivePrologue=function(M){for(var ee=0;ee<M.length&&this.isDirectiveCandidate(M[ee]);++ee)M[ee].directive=M[ee].expression.raw.slice(1,-1)};rn.isDirectiveCandidate=function(M){return this.options.ecmaVersion>=5&&M.type==="ExpressionStatement"&&M.expression.type==="Literal"&&typeof M.expression.value==="string"&&(this.input[M.start]==='"'||this.input[M.start]==="'")};var $n=r.prototype;$n.toAssignable=function(M,ee,we){if(this.options.ecmaVersion>=6&&M)switch(M.type){case"Identifier":if(this.inAsync&&M.name==="await")this.raise(M.start,"Cannot use 'await' as identifier inside an async function");break;case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":break;case"ObjectExpression":if(M.type="ObjectPattern",we)this.checkPatternErrors(we,!0);for(var Je=0,Gt=M.properties;Je<Gt.length;Je+=1){var Wt=Gt[Je];if(this.toAssignable(Wt,ee),Wt.type==="RestElement"&&(Wt.argument.type==="ArrayPattern"||Wt.argument.type==="ObjectPattern"))this.raise(Wt.argument.start,"Unexpected token")}break;case"Property":if(M.kind!=="init")this.raise(M.key.start,"Object pattern can't contain getter or setter");this.toAssignable(M.value,ee);break;case"ArrayExpression":if(M.type="ArrayPattern",we)this.checkPatternErrors(we,!0);this.toAssignableList(M.elements,ee);break;case"SpreadElement":if(M.type="RestElement",this.toAssignable(M.argument,ee),M.argument.type==="AssignmentPattern")this.raise(M.argument.start,"Rest elements cannot have a default value");break;case"AssignmentExpression":if(M.operator!=="=")this.raise(M.left.end,"Only '=' operator can be used for specifying default value.");M.type="AssignmentPattern",delete M.operator,this.toAssignable(M.left,ee);break;case"ParenthesizedExpression":this.toAssignable(M.expression,ee,we);break;case"ChainExpression":this.raiseRecoverable(M.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":if(!ee)break;default:this.raise(M.start,"Assigning to rvalue")}else if(we)this.checkPatternErrors(we,!0);return M};$n.toAssignableList=function(M,ee){var we=M.length;for(var Je=0;Je<we;Je++){var Gt=M[Je];if(Gt)this.toAssignable(Gt,ee)}if(we){var Wt=M[we-1];if(this.options.ecmaVersion===6&&ee&&Wt&&Wt.type==="RestElement"&&Wt.argument.type!=="Identifier")this.unexpected(Wt.argument.start)}return M};$n.parseSpread=function(M){var ee=this.startNode();return this.next(),ee.argument=this.parseMaybeAssign(!1,M),this.finishNode(ee,"SpreadElement")};$n.parseRestBinding=function(){var M=this.startNode();if(this.next(),this.options.ecmaVersion===6&&this.type!==Yt.name)this.unexpected();return M.argument=this.parseBindingAtom(),this.finishNode(M,"RestElement")};$n.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case Yt.bracketL:var M=this.startNode();return this.next(),M.elements=this.parseBindingList(Yt.bracketR,!0,!0),this.finishNode(M,"ArrayPattern");case Yt.braceL:return this.parseObj(!0)}return this.parseIdent()};$n.parseBindingList=function(M,ee,we,Je){var Gt=[],Wt=!0;while(!this.eat(M)){if(Wt)Wt=!1;else this.expect(Yt.comma);if(ee&&this.type===Yt.comma)Gt.push(null);else if(we&&this.afterTrailingComma(M))break;else if(this.type===Yt.ellipsis){var Ht=this.parseRestBinding();if(this.parseBindingListItem(Ht),Gt.push(Ht),this.type===Yt.comma)this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");this.expect(M);break}else Gt.push(this.parseAssignableListItem(Je))}return Gt};$n.parseAssignableListItem=function(M){var ee=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(ee),ee};$n.parseBindingListItem=function(M){return M};$n.parseMaybeDefault=function(M,ee,we){if(we=we||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(Yt.eq))return we;var Je=this.startNodeAt(M,ee);return Je.left=we,Je.right=this.parseMaybeAssign(),this.finishNode(Je,"AssignmentPattern")};$n.checkLValSimple=function(M,ee,we){if(ee===void 0)ee=Us;var Je=ee!==Us;switch(M.type){case"Identifier":if(this.strict&&this.reservedWordsStrictBind.test(M.name))this.raiseRecoverable(M.start,(Je?"Binding ":"Assigning to ")+M.name+" in strict mode");if(Je){if(ee===Bn&&M.name==="let")this.raiseRecoverable(M.start,"let is disallowed as a lexically bound name");if(we){if(ks(we,M.name))this.raiseRecoverable(M.start,"Argument name clash");we[M.name]=!0}if(ee!==Qo)this.declareName(M.name,ee,M.start)}break;case"ChainExpression":this.raiseRecoverable(M.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":if(Je)this.raiseRecoverable(M.start,"Binding member expression");break;case"ParenthesizedExpression":if(Je)this.raiseRecoverable(M.start,"Binding parenthesized expression");return this.checkLValSimple(M.expression,ee,we);default:this.raise(M.start,(Je?"Binding":"Assigning to")+" rvalue")}};$n.checkLValPattern=function(M,ee,we){if(ee===void 0)ee=Us;switch(M.type){case"ObjectPattern":for(var Je=0,Gt=M.properties;Je<Gt.length;Je+=1){var Wt=Gt[Je];this.checkLValInnerPattern(Wt,ee,we)}break;case"ArrayPattern":for(var Ht=0,Ft=M.elements;Ht<Ft.length;Ht+=1){var Kt=Ft[Ht];if(Kt)this.checkLValInnerPattern(Kt,ee,we)}break;default:this.checkLValSimple(M,ee,we)}};$n.checkLValInnerPattern=function(M,ee,we){if(ee===void 0)ee=Us;switch(M.type){case"Property":this.checkLValInnerPattern(M.value,ee,we);break;case"AssignmentPattern":this.checkLValPattern(M.left,ee,we);break;case"RestElement":this.checkLValPattern(M.argument,ee,we);break;default:this.checkLValPattern(M,ee,we)}};var Dn=function(M,ee,we,Je,Gt){this.token=M,this.isExpr=!!ee,this.preserveSpace=!!we,this.override=Je,this.generator=!!Gt},hn={b_stat:new Dn("{",!1),b_expr:new Dn("{",!0),b_tmpl:new Dn("${",!1),p_stat:new Dn("(",!1),p_expr:new Dn("(",!0),q_tmpl:new Dn("`",!0,!0,function(M){return M.tryReadTemplateToken()}),f_stat:new Dn("function",!1),f_expr:new Dn("function",!0),f_expr_gen:new Dn("function",!0,!1,null,!0),f_gen:new Dn("function",!1,!1,null,!0)},ds=r.prototype;ds.initialContext=function(){return[hn.b_stat]};ds.curContext=function(){return this.context[this.context.length-1]};ds.braceIsBlock=function(M){var ee=this.curContext();if(ee===hn.f_expr||ee===hn.f_stat)return!0;if(M===Yt.colon&&(ee===hn.b_stat||ee===hn.b_expr))return!ee.isExpr;if(M===Yt._return||M===Yt.name&&this.exprAllowed)return Sn.test(this.input.slice(this.lastTokEnd,this.start));if(M===Yt._else||M===Yt.semi||M===Yt.eof||M===Yt.parenR||M===Yt.arrow)return!0;if(M===Yt.braceL)return ee===hn.b_stat;if(M===Yt._var||M===Yt._const||M===Yt.name)return!1;return!this.exprAllowed};ds.inGeneratorContext=function(){for(var M=this.context.length-1;M>=1;M--){var ee=this.context[M];if(ee.token==="function")return ee.generator}return!1};ds.updateContext=function(M){var ee,we=this.type;if(we.keyword&&M===Yt.dot)this.exprAllowed=!1;else if(ee=we.updateContext)ee.call(this,M);else this.exprAllowed=we.beforeExpr};ds.overrideContext=function(M){if(this.curContext()!==M)this.context[this.context.length-1]=M};Yt.parenR.updateContext=Yt.braceR.updateContext=function(){if(this.context.length===1){this.exprAllowed=!0;return}var M=this.context.pop();if(M===hn.b_stat&&this.curContext().token==="function")M=this.context.pop();this.exprAllowed=!M.isExpr};Yt.braceL.updateContext=function(M){this.context.push(this.braceIsBlock(M)?hn.b_stat:hn.b_expr),this.exprAllowed=!0};Yt.dollarBraceL.updateContext=function(){this.context.push(hn.b_tmpl),this.exprAllowed=!0};Yt.parenL.updateContext=function(M){var ee=M===Yt._if||M===Yt._for||M===Yt._with||M===Yt._while;this.context.push(ee?hn.p_stat:hn.p_expr),this.exprAllowed=!0};Yt.incDec.updateContext=function(){};Yt._function.updateContext=Yt._class.updateContext=function(M){if(M.beforeExpr&&M!==Yt._else&&!(M===Yt.semi&&this.curContext()!==hn.p_stat)&&!(M===Yt._return&&Sn.test(this.input.slice(this.lastTokEnd,this.start)))&&!((M===Yt.colon||M===Yt.braceL)&&this.curContext()===hn.b_stat))this.context.push(hn.f_expr);else this.context.push(hn.f_stat);this.exprAllowed=!1};Yt.colon.updateContext=function(){if(this.curContext().token==="function")this.context.pop();this.exprAllowed=!0};Yt.backQuote.updateContext=function(){if(this.curContext()===hn.q_tmpl)this.context.pop();else this.context.push(hn.q_tmpl);this.exprAllowed=!1};Yt.star.updateContext=function(M){if(M===Yt._function){var ee=this.context.length-1;if(this.context[ee]===hn.f_expr)this.context[ee]=hn.f_expr_gen;else this.context[ee]=hn.f_gen}this.exprAllowed=!0};Yt.name.updateContext=function(M){var ee=!1;if(this.options.ecmaVersion>=6&&M!==Yt.dot){if(this.value==="of"&&!this.exprAllowed||this.value==="yield"&&this.inGeneratorContext())ee=!0}this.exprAllowed=ee};var on=r.prototype;on.checkPropClash=function(M,ee,we){if(this.options.ecmaVersion>=9&&M.type==="SpreadElement")return;if(this.options.ecmaVersion>=6&&(M.computed||M.method||M.shorthand))return;var Je=M.key,Gt;switch(Je.type){case"Identifier":Gt=Je.name;break;case"Literal":Gt=String(Je.value);break;default:return}var Wt=M.kind;if(this.options.ecmaVersion>=6){if(Gt==="__proto__"&&Wt==="init"){if(ee.proto)if(we){if(we.doubleProto<0)we.doubleProto=Je.start}else this.raiseRecoverable(Je.start,"Redefinition of __proto__ property");ee.proto=!0}return}Gt="$"+Gt;var Ht=ee[Gt];if(Ht){var Ft;if(Wt==="init")Ft=this.strict&&Ht.init||Ht.get||Ht.set;else Ft=Ht.init||Ht[Wt];if(Ft)this.raiseRecoverable(Je.start,"Redefinition of property")}else Ht=ee[Gt]={init:!1,get:!1,set:!1};Ht[Wt]=!0};on.parseExpression=function(M,ee){var we=this;return this.catchStackOverflow(function(){var{start:Je,startLoc:Gt}=we,Wt=we.parseMaybeAssign(M,ee);if(we.type===Yt.comma){var Ht=we.startNodeAt(Je,Gt);Ht.expressions=[Wt];while(we.eat(Yt.comma))Ht.expressions.push(we.parseMaybeAssign(M,ee));return we.finishNode(Ht,"SequenceExpression")}return Wt})};on.parseMaybeAssign=function(M,ee,we){if(this.isContextual("yield"))if(this.inGenerator)return this.parseYield(M);else this.exprAllowed=!1;var Je=!1,Gt=-1,Wt=-1,Ht=-1;if(ee)Gt=ee.parenthesizedAssign,Wt=ee.trailingComma,Ht=ee.doubleProto,ee.parenthesizedAssign=ee.trailingComma=-1;else ee=new Ys,Je=!0;var Ft=this.start,Kt=this.startLoc;if(this.type===Yt.parenL||this.type===Yt.name)this.potentialArrowAt=this.start,this.potentialArrowInForAwait=M==="await";var zt=this.parseMaybeConditional(M,ee);if(we)zt=we.call(this,zt,Ft,Kt);if(this.type.isAssign){var Xt=this.startNodeAt(Ft,Kt);if(Xt.operator=this.value,this.type===Yt.eq)zt=this.toAssignable(zt,!1,ee);if(!Je)ee.parenthesizedAssign=ee.trailingComma=ee.doubleProto=-1;if(ee.shorthandAssign>=zt.start)ee.shorthandAssign=-1;if(this.type===Yt.eq)this.checkLValPattern(zt);else this.checkLValSimple(zt);if(Xt.left=zt,this.next(),Xt.right=this.parseMaybeAssign(M),Ht>-1)ee.doubleProto=Ht;return this.finishNode(Xt,"AssignmentExpression")}else if(Je)this.checkExpressionErrors(ee,!0);if(Gt>-1)ee.parenthesizedAssign=Gt;if(Wt>-1)ee.trailingComma=Wt;return zt};on.parseMaybeConditional=function(M,ee){var we=this.start,Je=this.startLoc,Gt=this.parseExprOps(M,ee);if(this.checkExpressionErrors(ee))return Gt;if(!(Gt.type==="ArrowFunctionExpression"&&Gt.start===we)&&this.eat(Yt.question)){var Wt=this.startNodeAt(we,Je);return Wt.test=Gt,Wt.consequent=this.parseMaybeAssign(),this.expect(Yt.colon),Wt.alternate=this.parseMaybeAssign(M),this.finishNode(Wt,"ConditionalExpression")}return Gt};on.parseExprOps=function(M,ee){var we=this.start,Je=this.startLoc,Gt=this.parseMaybeUnary(ee,!1,!1,M);if(this.checkExpressionErrors(ee))return Gt;return Gt.start===we&&Gt.type==="ArrowFunctionExpression"?Gt:this.parseExprOp(Gt,we,Je,-1,M)};on.parseExprOp=function(M,ee,we,Je,Gt){var Wt=this.type.binop;if(Wt!=null&&(!Gt||this.type!==Yt._in)){if(Wt>Je){var Ht=this.type===Yt.logicalOR||this.type===Yt.logicalAND,Ft=this.type===Yt.coalesce;if(Ft)Wt=Yt.logicalAND.binop;var Kt=this.value;this.next();var zt=this.start,Xt=this.startLoc,Zt=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,Gt),zt,Xt,Wt,Gt),Qt=this.buildBinary(ee,we,M,Zt,Kt,Ht||Ft);if(Ht&&this.type===Yt.coalesce||Ft&&(this.type===Yt.logicalOR||this.type===Yt.logicalAND))this.raiseRecoverable(this.start,"Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses");return this.parseExprOp(Qt,ee,we,Je,Gt)}}return M};on.buildBinary=function(M,ee,we,Je,Gt,Wt){if(Je.type==="PrivateIdentifier")this.raise(Je.start,"Private identifier can only be left side of binary expression");var Ht=this.startNodeAt(M,ee);return Ht.left=we,Ht.operator=Gt,Ht.right=Je,this.finishNode(Ht,Wt?"LogicalExpression":"BinaryExpression")};on.parseMaybeUnary=function(M,ee,we,Je){var Gt=this.start,Wt=this.startLoc,Ht;if(this.isContextual("await")&&this.canAwait)Ht=this.parseAwait(Je),ee=!0;else if(this.type.prefix){var Ft=this.startNode(),Kt=this.type===Yt.incDec;if(Ft.operator=this.value,Ft.prefix=!0,this.next(),Ft.argument=this.parseMaybeUnary(null,!0,Kt,Je),this.checkExpressionErrors(M,!0),Kt)this.checkLValSimple(Ft.argument);else if(this.strict&&Ft.operator==="delete"&&ea(Ft.argument))this.raiseRecoverable(Ft.start,"Deleting local variable in strict mode");else if(Ft.operator==="delete"&&qi(Ft.argument))this.raiseRecoverable(Ft.start,"Private fields can not be deleted");else ee=!0;Ht=this.finishNode(Ft,Kt?"UpdateExpression":"UnaryExpression")}else if(!ee&&this.type===Yt.privateId){if((Je||this.privateNameStack.length===0)&&this.options.checkPrivateFields)this.unexpected();if(Ht=this.parsePrivateIdent(),this.type!==Yt._in)this.unexpected()}else{if(Ht=this.parseExprSubscripts(M,Je),this.checkExpressionErrors(M))return Ht;while(this.type.postfix&&!this.canInsertSemicolon()){var zt=this.startNodeAt(Gt,Wt);zt.operator=this.value,zt.prefix=!1,zt.argument=Ht,this.checkLValSimple(Ht),this.next(),Ht=this.finishNode(zt,"UpdateExpression")}}if(!we&&!(Ht.type==="ArrowFunctionExpression"&&Ht.start===Gt)&&this.eat(Yt.starstar))if(ee)this.unexpected(this.lastTokStart);else return this.buildBinary(Gt,Wt,Ht,this.parseMaybeUnary(null,!1,!1,Je),"**",!1);else return Ht};function ea(M){return M.type==="Identifier"||M.type==="ParenthesizedExpression"&&ea(M.expression)}function qi(M){return M.type==="MemberExpression"&&M.property.type==="PrivateIdentifier"||M.type==="ChainExpression"&&qi(M.expression)||M.type==="ParenthesizedExpression"&&qi(M.expression)}on.parseExprSubscripts=function(M,ee){var we=this.start,Je=this.startLoc,Gt=this.parseExprAtom(M,ee);if(Gt.type==="ArrowFunctionExpression"&&this.input.slice(this.lastTokStart,this.lastTokEnd)!==")")return Gt;var Wt=this.parseSubscripts(Gt,we,Je,!1,ee);if(M&&Wt.type==="MemberExpression"){if(M.parenthesizedAssign>=Wt.start)M.parenthesizedAssign=-1;if(M.parenthesizedBind>=Wt.start)M.parenthesizedBind=-1;if(M.trailingComma>=Wt.start)M.trailingComma=-1}return Wt};on.parseSubscripts=function(M,ee,we,Je,Gt){var Wt=this.options.ecmaVersion>=8&&M.type==="Identifier"&&M.name==="async"&&this.lastTokEnd===M.end&&!this.canInsertSemicolon()&&M.end-M.start===5&&this.potentialArrowAt===M.start,Ht=!1;while(!0){var Ft=this.parseSubscript(M,ee,we,Je,Wt,Ht,Gt);if(Ft.optional)Ht=!0;if(Ft===M||Ft.type==="ArrowFunctionExpression"){if(Ht){var Kt=this.startNodeAt(ee,we);Kt.expression=Ft,Ft=this.finishNode(Kt,"ChainExpression")}return Ft}M=Ft}};on.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(Yt.arrow)};on.parseSubscriptAsyncArrow=function(M,ee,we,Je){return this.parseArrowExpression(this.startNodeAt(M,ee),we,!0,Je)};on.parseSubscript=function(M,ee,we,Je,Gt,Wt,Ht){var Ft=this.options.ecmaVersion>=11,Kt=Ft&&this.eat(Yt.questionDot);if(Je&&Kt)this.raise(this.lastTokStart,"Optional chaining cannot appear in the callee of new expressions");var zt=this.eat(Yt.bracketL);if(zt||Kt&&this.type!==Yt.parenL&&this.type!==Yt.backQuote||this.eat(Yt.dot)){var Xt=this.startNodeAt(ee,we);if(Xt.object=M,zt)Xt.property=this.parseExpression(),this.expect(Yt.bracketR);else if(this.type===Yt.privateId&&M.type!=="Super")Xt.property=this.parsePrivateIdent();else Xt.property=this.parseIdent(this.options.allowReserved!=="never");if(Xt.computed=!!zt,Ft)Xt.optional=Kt;M=this.finishNode(Xt,"MemberExpression")}else if(!Je&&this.eat(Yt.parenL)){var Zt=new Ys,Qt=this.yieldPos,en=this.awaitPos,tn=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var sn=this.parseExprList(Yt.parenR,this.options.ecmaVersion>=8,!1,Zt);if(Gt&&!Kt&&this.shouldParseAsyncArrow()){if(this.checkPatternErrors(Zt,!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=en,this.awaitIdentPos=tn,this.parseSubscriptAsyncArrow(ee,we,sn,Ht)}this.checkExpressionErrors(Zt,!0),this.yieldPos=Qt||this.yieldPos,this.awaitPos=en||this.awaitPos,this.awaitIdentPos=tn||this.awaitIdentPos;var nn=this.startNodeAt(ee,we);if(nn.callee=M,nn.arguments=sn,Ft)nn.optional=Kt;M=this.finishNode(nn,"CallExpression")}else if(this.type===Yt.backQuote){if(Kt||Wt)this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions");var an=this.startNodeAt(ee,we);an.tag=M,an.quasi=this.parseTemplate({isTagged:!0}),M=this.finishNode(an,"TaggedTemplateExpression")}return M};on.parseExprAtom=function(M,ee,we){if(this.type===Yt.slash)this.readRegexp();var Je,Gt=this.potentialArrowAt===this.start;switch(this.type){case Yt._super:if(!this.allowSuper)this.raise(this.start,"'super' keyword outside a method");if(Je=this.startNode(),this.next(),this.type===Yt.parenL&&!this.allowDirectSuper)this.raise(Je.start,"super() call outside constructor of a subclass");if(this.type!==Yt.dot&&this.type!==Yt.bracketL&&this.type!==Yt.parenL)this.unexpected();return this.finishNode(Je,"Super");case Yt._this:return Je=this.startNode(),this.next(),this.finishNode(Je,"ThisExpression");case Yt.name:var Wt=this.start,Ht=this.startLoc,Ft=this.containsEsc,Kt=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!Ft&&Kt.name==="async"&&!this.canInsertSemicolon()&&this.eat(Yt._function))return this.overrideContext(hn.f_expr),this.parseFunction(this.startNodeAt(Wt,Ht),0,!1,!0,ee);if(Gt&&!this.canInsertSemicolon()){if(this.eat(Yt.arrow))return this.parseArrowExpression(this.startNodeAt(Wt,Ht),[Kt],!1,ee);if(this.options.ecmaVersion>=8&&Kt.name==="async"&&this.type===Yt.name&&!Ft&&(!this.potentialArrowInForAwait||this.value!=="of"||this.containsEsc)){if(Kt=this.parseIdent(!1),this.canInsertSemicolon()||!this.eat(Yt.arrow))this.unexpected();return this.parseArrowExpression(this.startNodeAt(Wt,Ht),[Kt],!0,ee)}}return Kt;case Yt.regexp:var zt=this.value;return Je=this.parseLiteral(zt.value),Je.regex={pattern:zt.pattern,flags:zt.flags},Je;case Yt.num:case Yt.string:return this.parseLiteral(this.value);case Yt._null:case Yt._true:case Yt._false:return Je=this.startNode(),Je.value=this.type===Yt._null?null:this.type===Yt._true,Je.raw=this.type.keyword,this.next(),this.finishNode(Je,"Literal");case Yt.parenL:var Xt=this.start,Zt=this.parseParenAndDistinguishExpression(Gt,ee);if(M){if(M.parenthesizedAssign<0&&!this.isSimpleAssignTarget(Zt))M.parenthesizedAssign=Xt;if(M.parenthesizedBind<0)M.parenthesizedBind=Xt}return Zt;case Yt.bracketL:return Je=this.startNode(),this.next(),Je.elements=this.parseExprList(Yt.bracketR,!0,!0,M),this.finishNode(Je,"ArrayExpression");case Yt.braceL:return this.overrideContext(hn.b_expr),this.parseObj(!1,M);case Yt._function:return Je=this.startNode(),this.next(),this.parseFunction(Je,0);case Yt._class:return this.parseClass(this.startNode(),!1);case Yt._new:return this.parseNew();case Yt.backQuote:return this.parseTemplate();case Yt._import:if(this.options.ecmaVersion>=11)return this.parseExprImport(we);else return this.unexpected();default:return this.parseExprAtomDefault()}};on.parseExprAtomDefault=function(){this.unexpected()};on.parseExprImport=function(M){var ee=this.startNode();if(this.containsEsc)this.raiseRecoverable(this.start,"Escape sequence in keyword import");if(this.next(),this.type===Yt.parenL&&!M)return this.parseDynamicImport(ee);else if(this.type===Yt.dot){var we=this.startNodeAt(ee.start,ee.loc&&ee.loc.start);return we.name="import",ee.meta=this.finishNode(we,"Identifier"),this.parseImportMeta(ee)}else this.unexpected()};on.parseDynamicImport=function(M){if(this.next(),M.source=this.parseMaybeAssign(),this.options.ecmaVersion>=16)if(!this.eat(Yt.parenR))if(this.expect(Yt.comma),!this.afterTrailingComma(Yt.parenR)){if(M.options=this.parseMaybeAssign(),!this.eat(Yt.parenR)){if(this.expect(Yt.comma),!this.afterTrailingComma(Yt.parenR))this.unexpected()}}else M.options=null;else M.options=null;else if(!this.eat(Yt.parenR)){var ee=this.start;if(this.eat(Yt.comma)&&this.eat(Yt.parenR))this.raiseRecoverable(ee,"Trailing comma is not allowed in import()");else this.unexpected(ee)}return this.finishNode(M,"ImportExpression")};on.parseImportMeta=function(M){this.next();var ee=this.containsEsc;if(M.property=this.parseIdent(!0),M.property.name!=="meta")this.raiseRecoverable(M.property.start,"The only valid meta property for import is 'import.meta'");if(ee)this.raiseRecoverable(M.start,"'import.meta' must not contain escaped characters");if(this.options.sourceType!=="module"&&!this.options.allowImportExportEverywhere)this.raiseRecoverable(M.start,"Cannot use 'import.meta' outside a module");return this.finishNode(M,"MetaProperty")};on.parseLiteral=function(M){var ee=this.startNode();if(ee.value=M,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")};on.parseParenExpression=function(){this.expect(Yt.parenL);var M=this.parseExpression();return this.expect(Yt.parenR),M};on.shouldParseArrow=function(M){return!this.canInsertSemicolon()};on.parseParenAndDistinguishExpression=function(M,ee){var we=this.start,Je=this.startLoc,Gt,Wt=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var Ht=this.start,Ft=this.startLoc,Kt=[],zt=!0,Xt=!1,Zt=new Ys,Qt=this.yieldPos,en=this.awaitPos,tn;this.yieldPos=0,this.awaitPos=0;while(this.type!==Yt.parenR)if(zt?zt=!1:this.expect(Yt.comma),Wt&&this.afterTrailingComma(Yt.parenR,!0)){Xt=!0;break}else if(this.type===Yt.ellipsis){if(tn=this.start,Kt.push(this.parseParenItem(this.parseRestBinding())),this.type===Yt.comma)this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");break}else Kt.push(this.parseMaybeAssign(!1,Zt,this.parseParenItem));var sn=this.lastTokEnd,nn=this.lastTokEndLoc;if(this.expect(Yt.parenR),M&&this.shouldParseArrow(Kt)&&this.eat(Yt.arrow))return this.checkPatternErrors(Zt,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=Qt,this.awaitPos=en,this.parseParenArrowList(we,Je,Kt,ee);if(!Kt.length||Xt)this.unexpected(this.lastTokStart);if(tn)this.unexpected(tn);if(this.checkExpressionErrors(Zt,!0),this.yieldPos=Qt||this.yieldPos,this.awaitPos=en||this.awaitPos,Kt.length>1)Gt=this.startNodeAt(Ht,Ft),Gt.expressions=Kt,this.finishNodeAt(Gt,"SequenceExpression",sn,nn);else Gt=Kt[0]}else Gt=this.parseParenExpression();if(this.options.preserveParens){var an=this.startNodeAt(we,Je);return an.expression=Gt,this.finishNode(an,"ParenthesizedExpression")}else return Gt};on.parseParenItem=function(M){return M};on.parseParenArrowList=function(M,ee,we,Je){return this.parseArrowExpression(this.startNodeAt(M,ee),we,!1,Je)};var yl=[];on.parseNew=function(){if(this.containsEsc)this.raiseRecoverable(this.start,"Escape sequence in keyword new");var M=this.startNode();if(this.next(),this.options.ecmaVersion>=6&&this.type===Yt.dot){var ee=this.startNodeAt(M.start,M.loc&&M.loc.start);ee.name="new",M.meta=this.finishNode(ee,"Identifier"),this.next();var we=this.containsEsc;if(M.property=this.parseIdent(!0),M.property.name!=="target")this.raiseRecoverable(M.property.start,"The only valid meta property for new is 'new.target'");if(we)this.raiseRecoverable(M.start,"'new.target' must not contain escaped characters");if(!this.allowNewDotTarget)this.raiseRecoverable(M.start,"'new.target' can only be used in functions and class static block");return this.finishNode(M,"MetaProperty")}var Je=this.start,Gt=this.startLoc;if(M.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),Je,Gt,!0,!1),M.callee.type==="Super")this.raiseRecoverable(Je,"Invalid use of 'super'");if(this.eat(Yt.parenL))M.arguments=this.parseExprList(Yt.parenR,this.options.ecmaVersion>=8,!1);else M.arguments=yl;return this.finishNode(M,"NewExpression")};on.parseTemplateElement=function(M){var ee=M.isTagged,we=this.startNode();if(this.type===Yt.invalidTemplate){if(!ee)this.raiseRecoverable(this.start,"Bad escape sequence in untagged template literal");we.value={raw:this.value.replace(/\r\n?/g,`
|
|
15
|
+
`),cooked:null}}else we.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,`
|
|
16
|
+
`),cooked:this.value};return this.next(),we.tail=this.type===Yt.backQuote,this.finishNode(we,"TemplateElement")};on.parseTemplate=function(M){if(M===void 0)M={};var ee=M.isTagged;if(ee===void 0)ee=!1;var we=this.startNode();this.next(),we.expressions=[];var Je=this.parseTemplateElement({isTagged:ee});we.quasis=[Je];while(!Je.tail){if(this.type===Yt.eof)this.raise(this.pos,"Unterminated template literal");this.expect(Yt.dollarBraceL),we.expressions.push(this.parseExpression()),this.expect(Yt.braceR),we.quasis.push(Je=this.parseTemplateElement({isTagged:ee}))}return this.next(),this.finishNode(we,"TemplateLiteral")};on.isAsyncProp=function(M){return!M.computed&&M.key.type==="Identifier"&&M.key.name==="async"&&(this.type===Yt.name||this.type===Yt.num||this.type===Yt.string||this.type===Yt.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===Yt.star)&&!Sn.test(this.input.slice(this.lastTokEnd,this.start))};on.parseObj=function(M,ee){var we=this.startNode(),Je=!0,Gt={};we.properties=[],this.next();while(!this.eat(Yt.braceR)){if(!Je){if(this.expect(Yt.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(Yt.braceR))break}else Je=!1;var Wt=this.parseProperty(M,ee);if(!M)this.checkPropClash(Wt,Gt,ee);we.properties.push(Wt)}return this.finishNode(we,M?"ObjectPattern":"ObjectExpression")};on.parseProperty=function(M,ee){var we=this.startNode(),Je,Gt,Wt,Ht;if(this.options.ecmaVersion>=9&&this.eat(Yt.ellipsis)){if(M){if(we.argument=this.parseIdent(!1),this.type===Yt.comma)this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");return this.finishNode(we,"RestElement")}if(we.argument=this.parseMaybeAssign(!1,ee),this.type===Yt.comma&&ee&&ee.trailingComma<0)ee.trailingComma=this.start;return this.finishNode(we,"SpreadElement")}if(this.options.ecmaVersion>=6){if(we.method=!1,we.shorthand=!1,M||ee)Wt=this.start,Ht=this.startLoc;if(!M)Je=this.eat(Yt.star)}var Ft=this.containsEsc;if(this.parsePropertyName(we),!M&&!Ft&&this.options.ecmaVersion>=8&&!Je&&this.isAsyncProp(we))Gt=!0,Je=this.options.ecmaVersion>=9&&this.eat(Yt.star),this.parsePropertyName(we);else Gt=!1;return this.parsePropertyValue(we,M,Je,Gt,Wt,Ht,ee,Ft),this.finishNode(we,"Property")};on.parseGetterSetter=function(M){var ee=M.key.name;this.parsePropertyName(M),M.value=this.parseMethod(!1),M.kind=ee;var we=M.kind==="get"?0:1;if(M.value.params.length!==we){var Je=M.value.start;if(M.kind==="get")this.raiseRecoverable(Je,"getter should have no params");else this.raiseRecoverable(Je,"setter should have exactly one param")}else if(M.kind==="set"&&M.value.params[0].type==="RestElement")this.raiseRecoverable(M.value.params[0].start,"Setter cannot use rest params")};on.parsePropertyValue=function(M,ee,we,Je,Gt,Wt,Ht,Ft){if((we||Je)&&this.type===Yt.colon)this.unexpected();if(this.eat(Yt.colon))M.value=ee?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,Ht),M.kind="init";else if(this.options.ecmaVersion>=6&&this.type===Yt.parenL){if(ee)this.unexpected();M.method=!0,M.value=this.parseMethod(we,Je),M.kind="init"}else if(!ee&&!Ft&&this.options.ecmaVersion>=5&&!M.computed&&M.key.type==="Identifier"&&(M.key.name==="get"||M.key.name==="set")&&(this.type!==Yt.comma&&this.type!==Yt.braceR&&this.type!==Yt.eq)){if(we||Je)this.unexpected();this.parseGetterSetter(M)}else if(this.options.ecmaVersion>=6&&!M.computed&&M.key.type==="Identifier"){if(we||Je)this.unexpected();if(this.checkUnreserved(M.key),M.key.name==="await"&&!this.awaitIdentPos)this.awaitIdentPos=Gt;if(ee)M.value=this.parseMaybeDefault(Gt,Wt,this.copyNode(M.key));else if(this.type===Yt.eq&&Ht){if(Ht.shorthandAssign<0)Ht.shorthandAssign=this.start;M.value=this.parseMaybeDefault(Gt,Wt,this.copyNode(M.key))}else M.value=this.copyNode(M.key);M.kind="init",M.shorthand=!0}else this.unexpected()};on.parsePropertyName=function(M){if(this.options.ecmaVersion>=6)if(this.eat(Yt.bracketL))return M.computed=!0,M.key=this.parseMaybeAssign(),this.expect(Yt.bracketR),M.key;else M.computed=!1;return M.key=this.type===Yt.num||this.type===Yt.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never")};on.initFunction=function(M){if(M.id=null,this.options.ecmaVersion>=6)M.generator=M.expression=!1;if(this.options.ecmaVersion>=8)M.async=!1};on.parseMethod=function(M,ee,we){var Je=this.startNode(),Gt=this.yieldPos,Wt=this.awaitPos,Ht=this.awaitIdentPos;if(this.initFunction(Je),this.options.ecmaVersion>=6)Je.generator=M;if(this.options.ecmaVersion>=8)Je.async=!!ee;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(Yi(ee,Je.generator)|Xs|(we?zo:0)),this.expect(Yt.parenL),Je.params=this.parseBindingList(Yt.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(Je,!1,!0,!1),this.yieldPos=Gt,this.awaitPos=Wt,this.awaitIdentPos=Ht,this.finishNode(Je,"FunctionExpression")};on.parseArrowExpression=function(M,ee,we,Je){var Gt=this.yieldPos,Wt=this.awaitPos,Ht=this.awaitIdentPos;if(this.enterScope(Yi(we,!1)|Ji),this.initFunction(M),this.options.ecmaVersion>=8)M.async=!!we;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,M.params=this.toAssignableList(ee,!0),this.parseFunctionBody(M,!0,!1,Je),this.yieldPos=Gt,this.awaitPos=Wt,this.awaitIdentPos=Ht,this.finishNode(M,"ArrowFunctionExpression")};on.parseFunctionBody=function(M,ee,we,Je){var Gt=ee&&this.type!==Yt.braceL,Wt=this.strict,Ht=!1;if(Gt)M.body=this.parseMaybeAssign(Je),M.expression=!0,this.checkParams(M,!1);else{var Ft=this.options.ecmaVersion>=7&&!this.isSimpleParamList(M.params);if(!Wt||Ft){if(Ht=this.strictDirective(this.end),Ht&&Ft)this.raiseRecoverable(M.start,"Illegal 'use strict' directive in function with non-simple parameter list")}var Kt=this.labels;if(this.labels=[],Ht)this.strict=!0;if(this.checkParams(M,!Wt&&!Ht&&!ee&&!we&&this.isSimpleParamList(M.params)),this.strict&&M.id)this.checkLValSimple(M.id,Qo);M.body=this.parseBlock(!1,void 0,Ht&&!Wt),M.expression=!1,this.adaptDirectivePrologue(M.body.body),this.labels=Kt}this.exitScope()};on.isSimpleParamList=function(M){for(var ee=0,we=M;ee<we.length;ee+=1){var Je=we[ee];if(Je.type!=="Identifier")return!1}return!0};on.checkParams=function(M,ee){var we=Object.create(null);for(var Je=0,Gt=M.params;Je<Gt.length;Je+=1){var Wt=Gt[Je];this.checkLValInnerPattern(Wt,Qi,ee?null:we)}};on.parseExprList=function(M,ee,we,Je){var Gt=[],Wt=!0;while(!this.eat(M)){if(!Wt){if(this.expect(Yt.comma),ee&&this.afterTrailingComma(M))break}else Wt=!1;var Ht=void 0;if(we&&this.type===Yt.comma)Ht=null;else if(this.type===Yt.ellipsis){if(Ht=this.parseSpread(Je),Je&&this.type===Yt.comma&&Je.trailingComma<0)Je.trailingComma=this.start}else Ht=this.parseMaybeAssign(!1,Je);Gt.push(Ht)}return Gt};on.checkUnreserved=function(M){var{start:ee,end:we,name:Je}=M;if(this.inGenerator&&Je==="yield")this.raiseRecoverable(ee,"Cannot use 'yield' as identifier inside a generator");if(this.inAsync&&Je==="await")this.raiseRecoverable(ee,"Cannot use 'await' as identifier inside an async function");if(!(this.currentThisScope().flags&Js)&&Je==="arguments")this.raiseRecoverable(ee,"Cannot use 'arguments' in class field initializer");if(this.inClassStaticBlock&&(Je==="arguments"||Je==="await"))this.raise(ee,"Cannot use "+Je+" in class static initialization block");if(this.keywords.test(Je))this.raise(ee,"Unexpected keyword '"+Je+"'");if(this.options.ecmaVersion<6&&this.input.slice(ee,we).indexOf("\\")!==-1)return;var Gt=this.strict?this.reservedWordsStrict:this.reservedWords;if(Gt.test(Je)){if(!this.inAsync&&Je==="await")this.raiseRecoverable(ee,"Cannot use keyword 'await' outside an async function");this.raiseRecoverable(ee,"The keyword '"+Je+"' is reserved")}};on.parseIdent=function(M){var ee=this.parseIdentNode();if(this.next(!!M),this.finishNode(ee,"Identifier"),!M){if(this.checkUnreserved(ee),ee.name==="await"&&!this.awaitIdentPos)this.awaitIdentPos=ee.start}return ee};on.parseIdentNode=function(){var M=this.startNode();if(this.type===Yt.name)M.name=this.value;else if(this.type.keyword){if(M.name=this.type.keyword,(M.name==="class"||M.name==="function")&&(this.lastTokEnd!==this.lastTokStart+1||this.input.charCodeAt(this.lastTokStart)!==46))this.context.pop();this.type=Yt.name}else this.unexpected();return M};on.parsePrivateIdent=function(){var M=this.startNode();if(this.type===Yt.privateId)M.name=this.value;else this.unexpected();if(this.next(),this.finishNode(M,"PrivateIdentifier"),this.options.checkPrivateFields)if(this.privateNameStack.length===0)this.raise(M.start,"Private field '#"+M.name+"' must be declared in an enclosing class");else this.privateNameStack[this.privateNameStack.length-1].used.push(M);return M};on.parseYield=function(M){if(!this.yieldPos)this.yieldPos=this.start;var ee=this.startNode();if(this.next(),this.type===Yt.semi||this.canInsertSemicolon()||this.type!==Yt.star&&!this.type.startsExpr)ee.delegate=!1,ee.argument=null;else ee.delegate=this.eat(Yt.star),ee.argument=this.parseMaybeAssign(M);return this.finishNode(ee,"YieldExpression")};on.parseAwait=function(M){if(!this.awaitPos)this.awaitPos=this.start;var ee=this.startNode();return this.next(),ee.argument=this.parseMaybeUnary(null,!0,!1,M),this.finishNode(ee,"AwaitExpression")};var Hs=r.prototype;Hs.raise=function(M,ee){var we=Ko(this.input,M);if(ee+=" ("+we.line+":"+we.column+")",this.sourceFile)ee+=" in "+this.sourceFile;var Je=SyntaxError(ee);throw Je.pos=M,Je.loc=we,Je.raisedAt=this.pos,Je};Hs.raiseRecoverable=Hs.raise;Hs.curPosition=function(){if(this.options.locations)return new ws(this.curLine,this.pos-this.lineStart)};var Un=r.prototype,xl=function(M){this.flags=M,this.var=[],this.lexical=[],this.functions=[]};Un.enterScope=function(M){this.scopeStack.push(new xl(M))};Un.exitScope=function(){this.scopeStack.pop()};Un.treatFunctionsAsVarInScope=function(M){return M.flags&es||!this.inModule&&M.flags&Zn};Un.declareName=function(M,ee,we){var Je=!1;if(ee===Bn){var Gt=this.currentScope();if(Je=Gt.lexical.indexOf(M)>-1||Gt.functions.indexOf(M)>-1||Gt.var.indexOf(M)>-1,Gt.lexical.push(M),this.inModule&&Gt.flags&Zn)delete this.undefinedExports[M]}else if(ee===Yo){var Wt=this.currentScope();Wt.lexical.push(M)}else if(ee===Jo){var Ht=this.currentScope();if(this.treatFunctionsAsVar)Je=Ht.lexical.indexOf(M)>-1;else Je=Ht.lexical.indexOf(M)>-1||Ht.var.indexOf(M)>-1;Ht.functions.push(M)}else for(var Ft=this.scopeStack.length-1;Ft>=0;--Ft){var Kt=this.scopeStack[Ft];if(Kt.lexical.indexOf(M)>-1&&!(Kt.flags&qo&&Kt.lexical[0]===M)||!this.treatFunctionsAsVarInScope(Kt)&&Kt.functions.indexOf(M)>-1){Je=!0;break}if(Kt.var.push(M),this.inModule&&Kt.flags&Zn)delete this.undefinedExports[M];if(Kt.flags&Js)break}if(Je)this.raiseRecoverable(we,"Identifier '"+M+"' has already been declared")};Un.checkLocalExport=function(M){if(this.scopeStack[0].lexical.indexOf(M.name)===-1&&this.scopeStack[0].var.indexOf(M.name)===-1)this.undefinedExports[M.name]=M};Un.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]};Un.currentVarScope=function(){for(var M=this.scopeStack.length-1;;M--){var ee=this.scopeStack[M];if(ee.flags&(Js|Ts|ts))return ee}};Un.currentThisScope=function(){for(var M=this.scopeStack.length-1;;M--){var ee=this.scopeStack[M];if(ee.flags&(Js|Ts|ts)&&!(ee.flags&Ji))return ee}};var Qs=function(M,ee,we){if(this.type="",this.start=ee,this.end=0,M.options.locations)this.loc=new zs(M,we);if(M.options.directSourceFile)this.sourceFile=M.options.directSourceFile;if(M.options.ranges)this.range=[ee,0]},Ps=r.prototype;Ps.startNode=function(){return new Qs(this,this.start,this.startLoc)};Ps.startNodeAt=function(M,ee){return new Qs(this,M,ee)};function ta(M,ee,we,Je){if(M.type=ee,M.end=we,this.options.locations)M.loc.end=Je;if(this.options.ranges)M.range[1]=we;return M}Ps.finishNode=function(M,ee){return ta.call(this,M,ee,this.lastTokEnd,this.lastTokEndLoc)};Ps.finishNodeAt=function(M,ee,we,Je){return ta.call(this,M,ee,we,Je)};Ps.copyNode=function(M){var ee=new Qs(this,M.start,this.startLoc);for(var we in M)ee[we]=M[we];return ee};var na=function(){};na.prototype.reset=function(){};r.prototype.validateRegExpFlags=function(){};r.prototype.validateRegExpPattern=function(){};var er=function(M){if(this.type=M.type,this.value=M.value,this.start=M.start,this.end=M.end,M.options.locations)this.loc=new zs(M,M.startLoc,M.endLoc);if(M.options.ranges)this.range=[M.start,M.end]},pn=r.prototype;pn.next=function(M){if(!M&&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()};pn.getToken=function(){return this.next(),new er(this)};if(typeof Symbol<"u")pn[Symbol.iterator]=function(){var M=this;return{next:function(){var ee=M.getToken();return{done:ee.type===Yt.eof,value:ee}}}};pn.nextToken=function(){var M=this.curContext();if(!M||!M.preserveSpace)this.skipSpace();if(this.start=this.pos,this.options.locations)this.startLoc=this.curPosition();if(this.pos>=this.input.length)return this.finishToken(Yt.eof);if(M.override)return M.override(this);else this.readToken(this.fullCharCodeAtPos())};pn.readToken=function(M){if(h(M,this.options.ecmaVersion>=6)||M===92)return this.readWord();return this.getTokenFromCode(M)};pn.fullCharCodeAt=function(M){var ee=this.input.charCodeAt(M);if(ee<=55295||ee>=56320)return ee;var we=this.input.charCodeAt(M+1);return we<=56319||we>=57344?ee:(ee<<10)+we-56613888};pn.fullCharCodeAtPos=function(){return this.fullCharCodeAt(this.pos)};pn.skipBlockComment=function(){var M=this.options.onComment&&this.curPosition(),ee=this.pos,we=this.input.indexOf("*/",this.pos+=2);if(we===-1)this.raise(this.pos-2,"Unterminated comment");if(this.pos=we+2,this.options.locations)for(var Je=void 0,Gt=ee;(Je=Wo(this.input,Gt,this.pos))>-1;)++this.curLine,Gt=this.lineStart=Je;if(this.options.onComment)this.options.onComment(!0,this.input.slice(ee+2,we),ee,this.pos,M,this.curPosition())};pn.skipLineComment=function(M){var ee=this.pos,we=this.options.onComment&&this.curPosition(),Je=this.input.charCodeAt(this.pos+=M);while(this.pos<this.input.length&&!hs(Je))Je=this.input.charCodeAt(++this.pos);if(this.options.onComment)this.options.onComment(!1,this.input.slice(ee+M,this.pos),ee,this.pos,we,this.curPosition())};pn.skipSpace=function(){e:while(this.pos<this.input.length){var M=this.input.charCodeAt(this.pos);switch(M){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(M>8&&M<14||M>=5760&&Uo.test(String.fromCharCode(M)))++this.pos;else break e}}};pn.finishToken=function(M,ee){if(this.end=this.pos,this.options.locations)this.endLoc=this.curPosition();var we=this.type;this.type=M,this.value=ee,this.updateContext(we)};pn.readToken_dot=function(){var M=this.input.charCodeAt(this.pos+1);if(M>=48&&M<=57)return this.readNumber(!0);var ee=this.input.charCodeAt(this.pos+2);if(this.options.ecmaVersion>=6&&M===46&&ee===46)return this.pos+=3,this.finishToken(Yt.ellipsis);else return++this.pos,this.finishToken(Yt.dot)};pn.readToken_slash=function(){var M=this.input.charCodeAt(this.pos+1);if(this.exprAllowed)return++this.pos,this.readRegexp();if(M===61)return this.finishOp(Yt.assign,2);return this.finishOp(Yt.slash,1)};pn.readToken_mult_modulo_exp=function(M){var ee=this.input.charCodeAt(this.pos+1),we=1,Je=M===42?Yt.star:Yt.modulo;if(this.options.ecmaVersion>=7&&M===42&&ee===42)++we,Je=Yt.starstar,ee=this.input.charCodeAt(this.pos+2);if(ee===61)return this.finishOp(Yt.assign,we+1);return this.finishOp(Je,we)};pn.readToken_pipe_amp=function(M){var ee=this.input.charCodeAt(this.pos+1);if(ee===M){if(this.options.ecmaVersion>=12){var we=this.input.charCodeAt(this.pos+2);if(we===61)return this.finishOp(Yt.assign,3)}return this.finishOp(M===124?Yt.logicalOR:Yt.logicalAND,2)}if(ee===61)return this.finishOp(Yt.assign,2);return this.finishOp(M===124?Yt.bitwiseOR:Yt.bitwiseAND,1)};pn.readToken_caret=function(){var M=this.input.charCodeAt(this.pos+1);if(M===61)return this.finishOp(Yt.assign,2);return this.finishOp(Yt.bitwiseXOR,1)};pn.readToken_plus_min=function(M){var ee=this.input.charCodeAt(this.pos+1);if(ee===M){if(ee===45&&!this.inModule&&this.input.charCodeAt(this.pos+2)===62&&(this.lastTokEnd===0||Sn.test(this.input.slice(this.lastTokEnd,this.pos))))return this.skipLineComment(3),this.skipSpace(),this.nextToken();return this.finishOp(Yt.incDec,2)}if(ee===61)return this.finishOp(Yt.assign,2);return this.finishOp(Yt.plusMin,1)};pn.readToken_lt_gt=function(M){var ee=this.input.charCodeAt(this.pos+1),we=1;if(ee===M){if(we=M===62&&this.input.charCodeAt(this.pos+2)===62?3:2,this.input.charCodeAt(this.pos+we)===61)return this.finishOp(Yt.assign,we+1);return this.finishOp(Yt.bitShift,we)}if(ee===33&&M===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)we=2;return this.finishOp(Yt.relational,we)};pn.readToken_eq_excl=function(M){var ee=this.input.charCodeAt(this.pos+1);if(ee===61)return this.finishOp(Yt.equality,this.input.charCodeAt(this.pos+2)===61?3:2);if(M===61&&ee===62&&this.options.ecmaVersion>=6)return this.pos+=2,this.finishToken(Yt.arrow);return this.finishOp(M===61?Yt.eq:Yt.prefix,1)};pn.readToken_question=function(){var M=this.options.ecmaVersion;if(M>=11){var ee=this.input.charCodeAt(this.pos+1);if(ee===46){var we=this.input.charCodeAt(this.pos+2);if(we<48||we>57)return this.finishOp(Yt.questionDot,2)}if(ee===63){if(M>=12){var Je=this.input.charCodeAt(this.pos+2);if(Je===61)return this.finishOp(Yt.assign,3)}return this.finishOp(Yt.coalesce,2)}}return this.finishOp(Yt.question,1)};pn.readToken_numberSign=function(){var M=this.options.ecmaVersion,ee=35;if(M>=13){if(++this.pos,ee=this.fullCharCodeAtPos(),h(ee,!0)||ee===92)return this.finishToken(Yt.privateId,this.readWord1())}this.raise(this.pos,"Unexpected character '"+qs(ee)+"'")};pn.getTokenFromCode=function(M){switch(M){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(Yt.parenL);case 41:return++this.pos,this.finishToken(Yt.parenR);case 59:return++this.pos,this.finishToken(Yt.semi);case 44:return++this.pos,this.finishToken(Yt.comma);case 91:return++this.pos,this.finishToken(Yt.bracketL);case 93:return++this.pos,this.finishToken(Yt.bracketR);case 123:return++this.pos,this.finishToken(Yt.braceL);case 125:return++this.pos,this.finishToken(Yt.braceR);case 58:return++this.pos,this.finishToken(Yt.colon);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(Yt.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(M);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo_exp(M);case 124:case 38:return this.readToken_pipe_amp(M);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(M);case 60:case 62:return this.readToken_lt_gt(M);case 61:case 33:return this.readToken_eq_excl(M);case 63:return this.readToken_question();case 126:return this.finishOp(Yt.prefix,1);case 35:return this.readToken_numberSign()}this.raise(this.pos,"Unexpected character '"+qs(M)+"'")};pn.finishOp=function(M,ee){var we=this.input.slice(this.pos,this.pos+ee);return this.pos+=ee,this.finishToken(M,we)};pn.readRegexp=function(){var M,ee,we=this.pos;for(;;){if(this.pos>=this.input.length)this.raise(we,"Unterminated regular expression");var Je=this.input.charAt(this.pos);if(Sn.test(Je))this.raise(we,"Unterminated regular expression");if(!M){if(Je==="[")ee=!0;else if(Je==="]"&&ee)ee=!1;else if(Je==="/"&&!ee)break;M=Je==="\\"}else M=!1;++this.pos}var Gt=this.input.slice(we,this.pos);++this.pos;var Wt=this.pos,Ht=this.readWord1();if(this.containsEsc)this.unexpected(Wt);var Ft=this.regexpState||(this.regexpState=new na(this));Ft.reset(we,Gt,Ht),this.validateRegExpFlags(Ft),this.validateRegExpPattern(Ft);var Kt=null;try{Kt=new RegExp(Gt,Ht)}catch(zt){}return this.finishToken(Yt.regexp,{pattern:Gt,flags:Ht,value:Kt})};pn.readInt=function(M,ee,we){var Je=this.options.ecmaVersion>=12&&ee===void 0,Gt=we&&this.input.charCodeAt(this.pos)===48,Wt=this.pos,Ht=0,Ft=0;for(var Kt=0,zt=ee==null?1/0:ee;Kt<zt;++Kt,++this.pos){var Xt=this.input.charCodeAt(this.pos),Zt=void 0;if(Je&&Xt===95){if(Gt)this.raiseRecoverable(this.pos,"Numeric separator is not allowed in legacy octal numeric literals");if(Ft===95)this.raiseRecoverable(this.pos,"Numeric separator must be exactly one underscore");if(Kt===0)this.raiseRecoverable(this.pos,"Numeric separator is not allowed at the first of digits");Ft=Xt;continue}if(Xt>=97)Zt=Xt-97+10;else if(Xt>=65)Zt=Xt-65+10;else if(Xt>=48&&Xt<=57)Zt=Xt-48;else Zt=1/0;if(Zt>=M)break;Ft=Xt,Ht=Ht*M+Zt}if(Je&&Ft===95)this.raiseRecoverable(this.pos-1,"Numeric separator is not allowed at the last of digits");if(this.pos===Wt||ee!=null&&this.pos-Wt!==ee)return null;return Ht};function vl(M,ee){if(ee)return parseInt(M,8);return parseFloat(M.replace(/_/g,""))}function sa(M){if(typeof BigInt!=="function")return null;return BigInt(M.replace(/_/g,""))}pn.readRadixNumber=function(M){var ee=this.pos;this.pos+=2;var we=this.readInt(M);if(we==null)this.raise(this.start+2,"Expected number in radix "+M);if(this.options.ecmaVersion>=11&&this.input.charCodeAt(this.pos)===110)we=sa(this.input.slice(ee,this.pos)),++this.pos;else if(h(this.fullCharCodeAtPos()))this.raise(this.pos,"Identifier directly after number");return this.finishToken(Yt.num,we)};pn.readNumber=function(M){var ee=this.pos;if(!M&&this.readInt(10,void 0,!0)===null)this.raise(ee,"Invalid number");var we=this.pos-ee>=2&&this.input.charCodeAt(ee)===48;if(we&&this.strict)this.raise(ee,"Invalid number");var Je=this.input.charCodeAt(this.pos);if(!we&&!M&&this.options.ecmaVersion>=11&&Je===110){var Gt=sa(this.input.slice(ee,this.pos));if(++this.pos,h(this.fullCharCodeAtPos()))this.raise(this.pos,"Identifier directly after number");return this.finishToken(Yt.num,Gt)}if(we&&/[89]/.test(this.input.slice(ee,this.pos)))we=!1;if(Je===46&&!we)++this.pos,this.readInt(10),Je=this.input.charCodeAt(this.pos);if((Je===69||Je===101)&&!we){if(Je=this.input.charCodeAt(++this.pos),Je===43||Je===45)++this.pos;if(this.readInt(10)===null)this.raise(ee,"Invalid number")}if(h(this.fullCharCodeAtPos()))this.raise(this.pos,"Identifier directly after number");var Wt=vl(this.input.slice(ee,this.pos),we);return this.finishToken(Yt.num,Wt)};pn.readCodePoint=function(){var M=this.input.charCodeAt(this.pos),ee;if(M===123){if(this.options.ecmaVersion<6)this.unexpected();var we=++this.pos;if(ee=this.readHexChar(this.input.indexOf("}",this.pos)-this.pos),++this.pos,ee>1114111)this.invalidStringToken(we,"Code point out of bounds")}else ee=this.readHexChar(4);return ee};pn.readString=function(M){var ee="",we=++this.pos;for(;;){if(this.pos>=this.input.length)this.raise(this.start,"Unterminated string constant");var Je=this.input.charCodeAt(this.pos);if(Je===M)break;if(Je===92)ee+=this.input.slice(we,this.pos),ee+=this.readEscapedChar(!1),we=this.pos;else if(Je===8232||Je===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(hs(Je))this.raise(this.start,"Unterminated string constant");++this.pos}}return ee+=this.input.slice(we,this.pos++),this.finishToken(Yt.string,ee)};var ia={};pn.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(M){if(M===ia)this.readInvalidTemplateToken();else throw M}this.inTemplateElement=!1};pn.invalidStringToken=function(M,ee){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw ia;else this.raise(M,ee)};pn.readTmplToken=function(){var M="",ee=this.pos;for(;;){if(this.pos>=this.input.length)this.raise(this.start,"Unterminated template");var we=this.input.charCodeAt(this.pos);if(we===96||we===36&&this.input.charCodeAt(this.pos+1)===123){if(this.pos===this.start&&(this.type===Yt.template||this.type===Yt.invalidTemplate))if(we===36)return this.pos+=2,this.finishToken(Yt.dollarBraceL);else return++this.pos,this.finishToken(Yt.backQuote);return M+=this.input.slice(ee,this.pos),this.finishToken(Yt.template,M)}if(we===92)M+=this.input.slice(ee,this.pos),M+=this.readEscapedChar(!0),ee=this.pos;else if(hs(we)){switch(M+=this.input.slice(ee,this.pos),++this.pos,we){case 13:if(this.input.charCodeAt(this.pos)===10)++this.pos;case 10:M+=`
|
|
17
|
+
`;break;default:M+=String.fromCharCode(we);break}if(this.options.locations)++this.curLine,this.lineStart=this.pos;ee=this.pos}else++this.pos}};pn.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(Yt.invalidTemplate,this.input.slice(this.start,this.pos));case"\r":if(this.input[this.pos+1]===`
|
|
18
|
+
`)++this.pos;case`
|
|
19
|
+
`:case"\u2028":case"\u2029":++this.curLine,this.lineStart=this.pos+1;break}this.raise(this.start,"Unterminated template")};pn.readEscapedChar=function(M){var ee=this.input.charCodeAt(++this.pos);switch(++this.pos,ee){case 110:return`
|
|
20
|
+
`;case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return qs(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(M){var we=this.pos-1;this.invalidStringToken(we,"Invalid escape sequence in template string")}default:if(ee>=48&&ee<=55){var Je=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],Gt=parseInt(Je,8);if(Gt>255)Je=Je.slice(0,-1),Gt=parseInt(Je,8);if(this.pos+=Je.length-1,ee=this.input.charCodeAt(this.pos),(Je!=="0"||ee===56||ee===57)&&(this.strict||M))this.invalidStringToken(this.pos-1-Je.length,M?"Octal literal in template string":"Octal literal in strict mode");return String.fromCharCode(Gt)}if(hs(ee)){if(this.options.locations)this.lineStart=this.pos,++this.curLine;return""}return String.fromCharCode(ee)}};pn.readHexChar=function(M){var ee=this.pos,we=this.readInt(16,M);if(we===null)this.invalidStringToken(ee,"Bad character escape sequence");return we};pn.readWord1=function(){this.containsEsc=!1;var M="",ee=!0,we=this.pos,Je=this.options.ecmaVersion>=6;while(this.pos<this.input.length){var Gt=this.fullCharCodeAtPos();if(k(Gt,Je))this.pos+=Gt<=65535?1:2;else if(Gt===92){this.containsEsc=!0,M+=this.input.slice(we,this.pos);var Wt=this.pos;if(this.input.charCodeAt(++this.pos)!==117)this.invalidStringToken(this.pos,"Expecting Unicode escape sequence \\uXXXX");++this.pos;var Ht=this.readCodePoint();if(!(ee?h:k)(Ht,Je))this.invalidStringToken(Wt,"Invalid Unicode escape");M+=qs(Ht),we=this.pos}else break;ee=!1}return M+this.input.slice(we,this.pos)};pn.readWord=function(){var M=this.readWord1(),ee=Yt.name;if(this.keywords.test(M))ee=zi[M];return this.finishToken(ee,M)};var El="8.18.0";r.acorn={Parser:r,version:El,defaultOptions:Ki,Position:ws,SourceLocation:zs,getLineInfo:Ko,Node:Qs,TokenType:ln,tokTypes:Yt,keywordTypes:zi,TokContext:Dn,tokContexts:hn,isIdentifierChar:k,isIdentifierStart:h,Token:er,isNewLine:hs,lineBreak:Sn,lineBreakG:ol,nonASCIIwhitespace:Uo};function $s(M){return(ee)=>M(ee)}function Zs(...M){return r.extend(...M)}function As(M,ee,we){for(let Je=ee;Je<we;Je++){let Gt=M.charCodeAt(Je);if(Gt===10||Gt===13||Gt===8232||Gt===8233)return!0}return!1}var Vo=new WeakMap;function Cn(M,ee){if(M===void 0)return!1;if(M.length<16)return M.includes(ee);let we=Vo.get(M);if(we===void 0||we.length>M.length)we={names:new Set,length:0},Vo.set(M,we);while(we.length<M.length)we.names.add(M[we.length++]);return we.names.has(ee)}var tr=/(?:\s|\/\/.*|\/\*[\s\S]*?\*\/)*/g,bl=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"]]),Sl=new Set("public private protected readonly declare abstract override static accessor".split(" ")),Cl=new Set("public private protected readonly override".split(" ")),wl=new Set("var let const function class abstract enum interface type namespace module global".split(" ")),kl=new Set("var let const function class interface enum".split(" ")),ra=new Set(["TSAsExpression","TSSatisfiesExpression","TSNonNullExpression","TSTypeAssertion"]),oa=1,Tl=32,Pl=256,$l=0,Al=1,Ds=2,Dl=3,Nl=4,nr=6,aa=7,da=256,or=1024,_l=8|or,Rl=Ds|da,pa=1,Il=2,ca=40,Ll=41,Ol=44,la=46,ua=58,ei=61,ha=60,ti=123,Ml=91,sr=42,Fl=35,ir=34,rr=39,jl=SyntaxError("speculative parse failed"),fe=$s((M)=>{let{tokTypes:ee,keywordTypes:we,isIdentifierChar:Je,isIdentifierStart:Gt}=M.acorn,Wt=new M.acorn.TokenType("@");class Ht extends M{inType=!1;$4=!1;$5=!1;$7=null;$k=null;$l=!1;$m=!1;$f=null;$9=[[]];$n=0;$t=0;$o=-1;constructor(Ft,Kt,zt){super(Ft,Kt,zt);let Xt=this.options.onComment;if(typeof Xt==="function")this.options.onComment=(Zt,Qt,en,tn,sn,nn)=>{if(en<this.$t)return;this.$t=tn,Xt.call(this,Zt,Qt,en,tn,sn,nn)}}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(Ft){if(Ft===64)return++this.pos,this.finishToken(Wt);return super.getTokenFromCode(Ft)}readToken_lt_gt(Ft){if(this.inType)return this.finishOp(ee.relational,1);return super.readToken_lt_gt(Ft)}$a(Ft){let Kt=this.inType;this.inType=!0;let zt=Ft();if(this.inType=Kt,!Kt&&this.type===ee.relational)this.pos=this.start,this.nextToken();return zt}$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 As(this.input,this.lastTokEnd,this.start)}$d(Ft=this.pos){return tr.lastIndex=Ft,tr.exec(this.input),tr.lastIndex}$2(){return this.input.charCodeAt(this.$d())}$3(){let Ft=this.$d(),Kt=Ft;while(Kt<this.input.length&&Je(this.input.charCodeAt(Kt)))Kt++;return this.input.slice(Ft,Kt)}$b(){return!As(this.input,this.pos,this.$d())}$14(){return this.$b()&&Gt(this.$2())&&!Object.hasOwn(we,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(Ft){this.pos=Ft.pos,this.type=Ft.type,this.value=Ft.value,this.start=Ft.start,this.end=Ft.end,this.startLoc=Ft.startLoc,this.endLoc=Ft.endLoc,this.lastTokStart=Ft.lastTokStart,this.lastTokEnd=Ft.lastTokEnd,this.lastTokStartLoc=Ft.lastTokStartLoc,this.lastTokEndLoc=Ft.lastTokEndLoc,this.curLine=Ft.curLine,this.lineStart=Ft.lineStart,this.context=Ft.context,this.exprAllowed=Ft.exprAllowed,this.containsEsc=Ft.containsEsc,this.inType=Ft.inType,this.$4=Ft.$4,this.$5=Ft.$5,this.$7=Ft.$7,this.scopeStack.length=Ft.scopes,this.privateNameStack.length=Ft.privateNames,this.labels=Ft.labels,this.labels.length=Ft.labelCount,this.strict=Ft.strict,this.yieldPos=Ft.yieldPos,this.awaitPos=Ft.awaitPos,this.awaitIdentPos=Ft.awaitIdentPos,this.potentialArrowAt=Ft.potentialArrowAt,this.potentialArrowInForAwait=Ft.potentialArrowInForAwait}raise(Ft,Kt){if(this.$n>0)throw jl;return super.raise(Ft,Kt)}$1y(Ft,Kt){try{super.raise(Ft,Kt)}catch(zt){if(zt instanceof SyntaxError)zt.$1z=!0;throw zt}throw Error("unreachable")}$g(Ft,Kt=!1){let zt=this.$15();this.$n++;try{let Xt=Ft();if(Kt||Xt===void 0)this.$16(zt);return Xt}catch(Xt){if(!(Xt instanceof SyntaxError)||!Kt&&Xt.$1z)throw Xt;this.$16(zt);return}finally{this.$n--}}$v(Ft){return this.$g(Ft,!0)===!0}$17(Ft){if(Ft.end=this.lastTokEnd,this.options.locations)Ft.loc.end=this.lastTokEndLoc}$q(Ft,Kt){if(Ft.start=Kt.start,this.options.locations)Ft.loc.start=Kt.loc.start}$6(Ft=!1){let Kt=this.startNode();return Kt.typeAnnotation=this.$a(()=>(this.next(),Ft?this.$20():this.$0())),this.finishNode(Kt,"TSTypeAnnotation")}$h(Ft,Kt){if(Kt&&this.eat(ee.question))Ft.optional=!0,this.$17(Ft);if(this.type===ee.colon)Ft.typeAnnotation=this.$6(),this.$17(Ft);return Ft}$20(){if(this.type!==ee.name&&this.type!==ee._this)return this.$0();if(this.isContextual("asserts")&&this.$b()&&Gt(this.$2())){let Ft=this.startNode();if(this.next(),Ft.parameterName=this.type===ee._this?this.$w():this.parseIdent(),this.isContextual("is")&&!this.hasPrecedingLineBreak())return this.$x(Ft,!0);return Ft.asserts=!0,Ft.typeAnnotation=null,this.finishNode(Ft,"TSTypePredicate")}if(this.$3()==="is"&&this.$b()){let Ft=this.startNode();return Ft.parameterName=this.type===ee._this?this.$w():this.parseIdent(!0),this.$x(Ft,!1)}return this.$0()}$x(Ft,Kt){this.next();let zt=this.startNode();return zt.typeAnnotation=this.$0(),Ft.typeAnnotation=this.finishNode(zt,"TSTypeAnnotation"),Ft.asserts=Kt,this.finishNode(Ft,"TSTypePredicate")}$w(){let Ft=this.startNode();return this.next(),this.finishNode(Ft,"TSThisType")}parseWholeType(){this.inType=!0,this.nextToken();let Ft=this.$0();if(this.type!==ee.eof)this.unexpected();return Ft}$0(){let Ft=this.$18();if(this.$4||this.type!==ee._extends||this.hasPrecedingLineBreak())return Ft;let Kt=this.startNodeAt(Ft.start,Ft.loc?.start);return this.next(),Kt.checkType=Ft,Kt.extendsType=this.$i(!0,()=>this.$18()),this.expect(ee.question),Kt.trueType=this.$i(!1,()=>this.$0()),this.expect(ee.colon),Kt.falseType=this.$i(!1,()=>this.$0()),this.finishNode(Kt,"TSConditionalType")}$i(Ft,Kt){let zt=this.$4;this.$4=Ft;let Xt=Kt();return this.$4=zt,Xt}$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(Ft){let Kt=this.startNode();if(Ft==="TSConstructorType"){if(Kt.abstract=this.isContextual("abstract"),Kt.abstract)this.next();this.next()}return this.$i(!1,()=>this.$r(Kt,ee.arrow)),this.finishNode(Kt,Ft)}$r(Ft,Kt){if(this.$1())Ft.typeParameters=this.$8();if(this.expect(ee.parenL),Ft.parameters=this.parseBindingList(ee.parenR,!1,!0),this.type===Kt)Ft.typeAnnotation=this.$6(!0);else if(Kt===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 Ft=this.type;if(Ft===ee.colon||Ft===ee.comma||Ft===ee.question||Ft===ee.eq)return!0;if(Ft!==ee.parenR)return!1;return this.next(),this.type===ee.arrow})}$1a(Ft,Kt,zt){let Xt=this.startNode(),Zt=this.eat(Kt),Qt=[];do Qt.push(zt());while(this.eat(Kt));if(Qt.length===1&&!Zt)return Qt[0];return Xt.types=Qt,this.finishNode(Xt,Ft)}$1b(){if(this.type===ee.name&&!this.containsEsc){let Ft=this.value;if(Ft==="keyof"||Ft==="unique"||Ft==="readonly"){let Kt=this.startNode();return this.next(),Kt.operator=Ft,Kt.typeAnnotation=this.$1b(),this.finishNode(Kt,"TSTypeOperator")}if(Ft==="infer"){let Kt=this.startNode();this.next();let zt=this.startNode();zt.name=this.$y();let Xt=this.$g(()=>this.$22());if(Xt)zt.constraint=Xt;return Kt.typeParameter=this.finishNode(zt,"TSTypeParameter"),this.finishNode(Kt,"TSInferType")}}return this.$i(!1,()=>this.$23())}$22(){if(!this.eat(ee._extends))return;let Ft=this.$i(!0,()=>this.$0());return this.$4||this.type!==ee.question?Ft:void 0}$y(){if(this.type!==ee.name&&!this.type.keyword)this.unexpected();let Ft=this.type===ee.name?this.value:this.type.keyword;return this.next(),Ft}$23(){let Ft=this.$24();while(!this.hasPrecedingLineBreak()&&this.eat(ee.bracketL)){let Kt=this.startNodeAt(Ft.start,Ft.loc?.start);if(this.eat(ee.bracketR))Kt.elementType=Ft,Ft=this.finishNode(Kt,"TSArrayType");else Kt.objectType=Ft,Kt.indexType=this.$0(),this.expect(ee.bracketR),Ft=this.finishNode(Kt,"TSIndexedAccessType")}return Ft}$24(){switch(this.type){case ee.name:case ee._void:case ee._null:{let Ft=bl.get(this.value);if(Ft&&(this.type!==ee.name||!this.containsEsc&&this.$2()!==la)){let Kt=this.startNode();return this.next(),this.finishNode(Kt,Ft)}return this.$1c()}case ee.string:case ee.num:case ee._true:case ee._false:{let Ft=this.startNode();return Ft.literal=this.parseExprAtom(),this.finishNode(Ft,"TSLiteralType")}case ee.plusMin:{if(this.value!=="-")break;let Ft=this.startNode(),Kt=this.startNode();if(this.next(),this.type!==ee.num)this.unexpected();return Kt.operator="-",Kt.prefix=!0,Kt.argument=this.parseExprAtom(),Ft.literal=this.finishNode(Kt,"UnaryExpression"),this.finishNode(Ft,"TSLiteralType")}case ee.backQuote:return this.$25();case ee._this:{let Ft=this.$w();if(this.isContextual("is")&&!this.hasPrecedingLineBreak()){let Kt=this.startNodeAt(Ft.start,Ft.loc?.start);return Kt.parameterName=Ft,this.$x(Kt,!1)}return Ft}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 Ft=this.startNode();return this.next(),Ft.typeAnnotation=this.$0(),this.expect(ee.parenR),this.finishNode(Ft,"TSParenthesizedType")}default:if(this.type.keyword)return this.$1c()}return this.unexpected()}$1c(){let Ft=this.startNode();if(Ft.typeName=this.$j(),!this.hasPrecedingLineBreak()&&this.$1())Ft.typeArguments=this.$e();return this.finishNode(Ft,"TSTypeReference")}$j(){let Ft=this.parseIdent(!0);while(this.eat(ee.dot)){let Kt=this.startNodeAt(Ft.start,Ft.loc?.start);Kt.left=Ft,Kt.right=this.parseIdent(!0),Ft=this.finishNode(Kt,"TSQualifiedName")}return Ft}$26(){let Ft=this.startNode();if(this.next(),Ft.exprName=this.type===ee._import?this.$1d():this.$j(),!this.hasPrecedingLineBreak()&&this.$1())Ft.typeArguments=this.$e();return this.finishNode(Ft,"TSTypeQuery")}$1d(){let Ft=this.startNode();if(this.next(),Ft.argument=this.$1e(),this.eat(ee.dot))Ft.qualifier=this.$j();if(this.$1())Ft.typeArguments=this.$e();return this.finishNode(Ft,"TSImportType")}$z(){if(this.type!==ee.string)this.unexpected();return this.parseExprAtom()}$1e(){this.expect(ee.parenL);let Ft=this.$z();return this.expect(ee.parenR),Ft}$25(){let Ft=this.startNode(),Kt=this.startNode();this.next(),Kt.expressions=[];let zt=this.parseTemplateElement({isTagged:!1});Kt.quasis=[zt];while(!zt.tail){if(this.type===ee.eof)this.raise(this.pos,"Unterminated template literal");this.expect(ee.dollarBraceL),Kt.expressions.push(this.$0()),this.expect(ee.braceR),zt=this.parseTemplateElement({isTagged:!1}),Kt.quasis.push(zt)}return this.next(),Ft.literal=this.finishNode(Kt,"TemplateLiteral"),this.finishNode(Ft,"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 Ft=this.startNode();if(this.expect(ee.braceL),this.type===ee.plusMin)Ft.readonly=this.value,this.next(),this.expectContextual("readonly");else if(this.eatContextual("readonly"))Ft.readonly=!0;this.expect(ee.bracketL);let Kt=this.startNode();if(Kt.name=this.$y(),this.expect(ee._in),Kt.constraint=this.$0(),Ft.typeParameter=this.finishNode(Kt,"TSTypeParameter"),Ft.nameType=this.eatContextual("as")?this.$0():null,this.expect(ee.bracketR),this.type===ee.plusMin)Ft.optional=this.value,this.next(),this.expect(ee.question);else if(this.eat(ee.question))Ft.optional=!0;if(this.eat(ee.colon))Ft.typeAnnotation=this.$0();return this.semicolon(),this.expect(ee.braceR),this.finishNode(Ft,"TSMappedType")}$29(){let Ft=this.startNode();return Ft.members=this.$1f(),this.finishNode(Ft,"TSTypeLiteral")}$1f(){this.expect(ee.braceL);let Ft=[];while(!this.eat(ee.braceR))Ft.push(this.$2b());return Ft}$2b(){let Ft=this.startNode(),Kt="TSPropertySignature",zt=this.type===ee._new?this.$2():-1;if(this.type===ee.parenL||this.$1())Kt="TSCallSignatureDeclaration",this.$r(Ft,ee.colon);else if(zt===ca||zt===ha)Kt="TSConstructSignatureDeclaration",this.next(),this.$r(Ft,ee.colon);else{let Xt=this.type===ee._new?this.parseIdent(!0):null;if(this.isContextual("readonly")&&this.$s(!0))this.next(),Ft.readonly=!0;if(this.type===ee.bracketL&&this.$1g())return this.$1h(Ft);let Zt="method";if(Xt)Ft.key=Xt;else{if((this.isContextual("get")||this.isContextual("set"))&&this.$s(!1))Zt=this.value,this.next();this.parsePropertyName(Ft)}if(this.eat(ee.question))Ft.optional=!0;if(this.type===ee.parenL||this.$1()){if(Kt="TSMethodSignature",Zt!=="method")Ft.kind=Zt;this.$r(Ft,ee.colon),Ft.kind=Zt}else if(this.type===ee.colon)Ft.typeAnnotation=this.$6()}return this.$1i(),this.finishNode(Ft,Kt)}$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(Ft){if(this.expect(ee.bracketL),Ft.parameters=[this.$h(this.parseIdent(),!1)],this.expect(ee.bracketR),this.type===ee.colon)Ft.typeAnnotation=this.$6();return this.$1i(),this.finishNode(Ft,"TSIndexSignature")}$2a(){let Ft=this.startNode();this.expect(ee.bracketL),Ft.elementTypes=[];while(!this.eat(ee.bracketR))if(Ft.elementTypes.push(this.$2c()),this.type!==ee.bracketR)this.expect(ee.comma);return this.finishNode(Ft,"TSTupleType")}$2c(){let Ft=this.start,Kt=this.startLoc,zt=this.eat(ee.ellipsis),Xt;if((this.type===ee.name||this.type.keyword)&&this.$2d()){let Zt=this.startNode();Zt.label=this.parseIdent(!0),Zt.optional=this.eat(ee.question),this.expect(ee.colon),Zt.elementType=this.$0(),Xt=this.finishNode(Zt,"TSNamedTupleMember")}else if(Xt=this.$0(),this.eat(ee.question)){let Zt=this.startNodeAt(Xt.start,Xt.loc?.start);Zt.typeAnnotation=Xt,Xt=this.finishNode(Zt,"TSOptionalType")}if(zt){let Zt=this.startNodeAt(Ft,Kt);Zt.typeAnnotation=Xt,Xt=this.finishNode(Zt,"TSRestType")}return Xt}$2d(){let Ft=this.$d();if(this.input.charCodeAt(Ft)===63)Ft=this.$d(Ft+1);return this.input.charCodeAt(Ft)===ua}$8(){return this.$a(()=>{let Ft=this.startNode();this.next(),Ft.params=[];while(!this.$c()){let Kt=this.startNode();while((this.type===ee._const||this.type===ee._in||this.isContextual("out"))&&Gt(this.$2()))Kt[this.value]=!0,this.next();if(Kt.name=this.$y(),this.eat(ee._extends))Kt.constraint=this.$0();if(this.eat(ee.eq))Kt.default=this.$0();if(Ft.params.push(this.finishNode(Kt,"TSTypeParameter")),!this.$c()){if(this.expect(ee.comma),this.$c())Ft.extra={trailingComma:this.lastTokStart}}}if(this.next(),Ft.params.length===0)this.$1y(this.start,"Type parameter list cannot be empty.");return this.finishNode(Ft,"TSTypeParameterDeclaration")})}$e(){return this.$a(()=>{let Ft=this.startNode();this.next(),Ft.params=[];while(!this.$c())if(Ft.params.push(this.$0()),!this.$c())this.expect(ee.comma);if(Ft.params.length===0)this.unexpected();return this.next(),this.finishNode(Ft,"TSTypeParameterInstantiation")})}$1j(){let Ft=[];do{let Kt=this.startNode();if(Kt.expression=this.$j(),this.$1())Kt.typeParameters=this.$e();Ft.push(this.finishNode(Kt,"TSExpressionWithTypeArguments"))}while(this.eat(ee.comma));return Ft}$1k(Ft=!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(Ft);return this.$1l(this.startNode(),this.value)}$2e(Ft){switch(Ft){case"interface":case"type":case"namespace":return this.$14();case"enum":return Gt(this.$2());case"abstract":return this.$b()&&this.$3()==="class";case"module":{let Kt=this.$2();return this.$b()&&(Kt===ir||Kt===rr||Gt(Kt))}case"declare":return this.$b()&&wl.has(this.$3());case"global":return this.$b()&&this.$2()===ti}return!1}$1l(Ft,Kt){switch(Kt){case"interface":return this.$1m(Ft);case"type":return this.$2g(Ft);case"enum":return this.$10(Ft);case"abstract":return this.$1n(Ft,!0);case"global":return Ft.global=!0,Ft.id=this.parseIdent(),Ft.body=this.$11(),this.finishNode(Ft,"TSModuleDeclaration")}return this.$2h(Ft)}$2f(Ft){let Kt=this.$5;this.$5=!0;let zt=this.startNode();this.next();let Xt=this.value;if(Xt==="const"&&this.$3()==="enum")zt.const=!0;if(!Ft&&kl.has(Xt))zt.declare=!0;let Zt;if(zt.const)Zt=this.$10(zt);else if(Xt==="var"||Xt==="let"||Xt==="const")Zt=this.parseVarStatement(zt,Xt,!0);else if(Xt==="function")this.next(),Zt=this.parseFunction(zt,pa,!1,!1);else if(Xt==="class")Zt=this.parseClass(zt,!0);else Zt=this.$1l(zt,Xt);return Zt.declare=!0,this.$5=Kt,Zt}$1n(Ft,Kt){return this.next(),Ft.abstract=!0,this.parseClass(Ft,Kt)}$1m(Ft){if(this.next(),Ft.id=this.parseIdent(),this.checkLValSimple(Ft.id,aa),this.$1())Ft.typeParameters=this.$8();return this.$a(()=>{if(this.eat(ee._extends))Ft.extends=this.$1j();let Kt=this.startNode();Kt.body=this.$1f(),Ft.body=this.finishNode(Kt,"TSInterfaceBody")}),this.finishNode(Ft,"TSInterfaceDeclaration")}$2g(Ft){if(this.next(),Ft.id=this.parseIdent(),this.checkLValSimple(Ft.id,nr),this.$1())Ft.typeParameters=this.$8();return Ft.typeAnnotation=this.$a(()=>(this.expect(ee.eq),this.$0())),this.semicolon(),this.finishNode(Ft,"TSTypeAliasDeclaration")}$10(Ft){if(this.type===ee._const)Ft.const=!0,this.next();this.next(),Ft.id=this.parseIdent(),this.checkLValSimple(Ft.id,Rl),this.expect(ee.braceL),Ft.members=[];while(!this.eat(ee.braceR)){let Kt=this.startNode();if(Kt.id=this.type===ee.string?this.parseExprAtom():this.parseIdent(!0),this.eat(ee.eq))Kt.initializer=this.parseMaybeAssign();if(Ft.members.push(this.finishNode(Kt,"TSEnumMember")),this.type!==ee.braceR)this.expect(ee.comma)}return this.finishNode(Ft,"TSEnumDeclaration")}$2h(Ft){if(this.next(),this.type===ee.string){if(Ft.id=this.parseExprAtom(),this.type===ee.braceL)Ft.body=this.$11();else this.semicolon();return this.finishNode(Ft,"TSModuleDeclaration")}return Ft.id=this.parseIdent(),this.checkLValSimple(Ft.id,_l),this.$1o(Ft)}$1o(Ft){if(this.eat(ee.dot)){let Kt=this.startNode();Kt.id=this.parseIdent(),Ft.body=this.$1o(Kt)}else Ft.body=this.$11();return this.finishNode(Ft,"TSModuleDeclaration")}$11(){this.enterScope(Pl);let Ft=this.startNode();this.enterScope(0),this.expect(ee.braceL),Ft.body=[];while(!this.eat(ee.braceR))Ft.body.push(this.parseStatement(null,!0));return this.exitScope(),this.exitScope(),this.finishNode(Ft,"TSModuleBlock")}$1p(Ft,Kt){if(Ft.isExport=Kt,Ft.id=this.parseIdent(),this.checkLValSimple(Ft.id,Ds),this.expect(ee.eq),this.isContextual("require")&&this.$2()===ca){let zt=this.startNode();this.next(),zt.expression=this.$1e(),Ft.moduleReference=this.finishNode(zt,"TSExternalModuleReference")}else Ft.moduleReference=this.$j();return this.semicolon(),this.finishNode(Ft,"TSImportEqualsDeclaration")}$2i(){let Ft=this.$d();if(this.input.charCodeAt(Ft)!==ei)return!1;let Kt=this.input.charCodeAt(Ft+1);return Kt!==ei&&Kt!==62}parseStatement(Ft,Kt,zt){if(this.type===Wt)this.$1q(!0);let Xt=this.$1k();if(Xt)return Xt;return super.parseStatement(Ft,Kt,zt)}parseVarStatement(Ft,Kt,zt){return super.parseVarStatement(Ft,Kt,zt||this.$5)}parseVarId(Ft,Kt){if(super.parseVarId(Ft,Kt),Ft.id.type==="Identifier"&&this.$u()&&!this.hasPrecedingLineBreak())this.next(),Ft.definite=!0;this.$h(Ft.id,!1)}parseCatchClauseParam(){let Ft=this.$h(this.parseBindingAtom(),!1),Kt=Ft.type==="Identifier";return this.enterScope(Kt?Tl:0),this.checkLValPattern(Ft,Kt?Nl:Ds),this.expect(ee.parenR),Ft}parseImport(Ft){if(this.next(),Ft.importKind="value",this.type===ee.string)Ft.specifiers=[],Ft.source=this.parseExprAtom();else{if(this.isContextual("type")){let Kt=this.$2();if(Kt===ti||Kt===sr||Gt(Kt)&&this.$3()!=="from")Ft.importKind="type",this.next()}if(this.type===ee.name&&this.$2i())return this.$1p(Ft,!1);Ft.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),Ft.source=this.$z()}return this.$1r(Ft),this.semicolon(),this.finishNode(Ft,"ImportDeclaration")}parseWithClause(){if(this.isContextual("assert")&&!this.hasPrecedingLineBreak())this.type=ee._with;return this.type===ee._with?super.parseWithClause():void 0}$1r(Ft){let Kt=this.parseWithClause();if(Kt)Ft.attributes=Kt}parseImportSpecifier(){return this.$1s("importKind",()=>super.parseImportSpecifier())}parseExportSpecifier(Ft){return this.$1s("exportKind",()=>super.parseExportSpecifier(Ft))}$1s(Ft,Kt){let zt=this.isContextual("type")?this.$2():-1;if(zt===ir||zt===rr||Gt(zt)&&this.$3()!=="as"){let Zt=this.startNode();this.next();let Qt=Kt();return this.$q(Qt,Zt),Qt[Ft]="type",Qt}let Xt=Kt();return Xt[Ft]="value",Xt}parseExport(Ft,Kt){if(this.next(),this.eat(ee._import)){if(Ft.importKind="value",this.isContextual("type")&&Gt(this.$2())&&this.$3()!=="from")Ft.importKind="type",this.next();return this.$1p(Ft,!0)}if(this.eat(ee.eq))return Ft.expression=this.parseExpression(),this.semicolon(),this.finishNode(Ft,"TSExportAssignment");if(this.eatContextual("as"))return this.expectContextual("namespace"),Ft.id=this.parseIdent(),this.semicolon(),this.finishNode(Ft,"TSNamespaceExportDeclaration");if(Ft.exportKind="value",this.isContextual("type")){let Zt=this.$2();if(Zt===ti||Zt===sr)Ft.exportKind="type",this.next()}if(this.eat(ee.star))return this.parseExportAllDeclaration(Ft,Kt);if(this.eat(ee._default)){if(this.isContextual("interface")&&this.$14())Ft.declaration=this.$1m(this.startNode());else if(this.isContextual("abstract")&&this.$3()==="class")Ft.declaration=this.$1n(this.startNode(),"nullableID");else Ft.declaration=this.parseExportDefaultDeclaration();return this.finishNode(Ft,"ExportDefaultDeclaration")}let zt=this.isContextual("declare"),Xt=this.$1k(!0);if(Xt||this.shouldParseExportStatement()){if(Ft.declaration=Xt??this.parseStatement(null),zt||Ft.declaration.type==="TSInterfaceDeclaration"||Ft.declaration.type==="TSTypeAliasDeclaration")Ft.exportKind="type";return Ft.specifiers=[],Ft.source=null,this.finishNode(Ft,"ExportNamedDeclaration")}if(Ft.declaration=null,Ft.specifiers=this.parseExportSpecifiers(Kt),this.eatContextual("from"))Ft.source=this.$z(),this.$1r(Ft);else{for(let Zt of Ft.specifiers)if(this.checkUnreserved(Zt.local),this.checkLocalExport(Zt.local),Zt.local.type==="Literal")this.raise(Zt.local.start,"A string literal cannot be used as an exported binding without `from`.");Ft.source=null}return this.semicolon(),this.finishNode(Ft,"ExportNamedDeclaration")}parseFunction(Ft,Kt,zt,Xt,Zt){let Qt=Kt&pa;if(Qt)this.$f=Ft,this.$o=Ft.start;super.parseFunction(Ft,Kt,zt,Xt,Zt),this.$f=null;let en=!Ft.body;if(en)Ft.type="TSDeclareFunction";if(Qt&&Ft.id){if(en){if(this.$5&&this.currentScope().flags&oa)this.declareName(Ft.id.name,or,Ft.id.start);this.checkLValSimple(Ft.id,$l)}else if(!(Kt&Il)){let tn=Dl;if(this.strict||Ft.generator||Ft.async)tn=this.treatFunctionsAsVar?Al:Ds;this.checkLValSimple(Ft.id,tn)}}return Ft}parseFunctionParams(Ft){if(this.$1())Ft.typeParameters=this.$8();if(super.parseFunctionParams(Ft),this.type===ee.colon)Ft.returnType=this.$6(!0)}parseFunctionBody(Ft,Kt,zt,Xt){if(zt&&this.type===ee.colon)Ft.returnType=this.$6(!0);if(Kt||this.type===ee.braceL||Ft.start!==this.$o){super.parseFunctionBody(Ft,Kt,zt,Xt);return}this.semicolon(),this.exitScope()}parseMethod(Ft,Kt,zt){let Xt=this.$k;this.$k=null;let Zt=super.parseMethod(Ft,Kt,zt);if(!Zt.body)Zt.type="TSDeclareMethod";if(Xt)Zt.typeParameters=Xt;return Zt}parseBindingList(Ft,Kt,zt,Xt){let Zt=Xt===!0||this.$l;return this.$l=!1,super.parseBindingList(Ft,Kt,zt,Zt)}$s(Ft){if(!Ft&&!this.$b())return!1;let Kt=this.$2();return Kt===Ml||Kt===ti||Kt===sr||Kt===la||Kt===Fl||Kt===ir||Kt===rr||Kt>=48&&Kt<=57||Gt(Kt)}parseAssignableListItem(Ft){let Kt=this.$12(),zt=this.start,Xt=this.startLoc,Zt,Qt=!1,en=!1;if(Ft)while(this.type===ee.name&&Cl.has(this.value)&&!this.containsEsc&&this.$s(!1)){if(this.value==="readonly")Qt=!0;else if(this.value==="override")en=!0;else Zt=this.value;this.next()}let tn;if(this.type===ee._this)tn=this.startNode(),tn.name="this",this.next(),this.finishNode(tn,"Identifier");else tn=this.parseBindingAtom();let sn=this.type===ee.eq?this.parseMaybeDefault(zt,Xt,tn):this.parseMaybeDefault(tn.start,tn.loc?.start,this.$h(tn,!0));if(Kt.length>0)sn.decorators=Kt;if(!Zt&&!Qt&&!en)return sn;let nn=this.startNodeAt(zt,Xt);if(Zt)nn.accessibility=Zt;if(Qt)nn.readonly=!0;if(en)nn.override=!0;return nn.parameter=sn,this.finishNode(nn,"TSParameterProperty")}parseBindingListItem(Ft){if(Ft.type==="RestElement")this.$h(Ft,!0);return Ft}checkLValSimple(Ft,Kt,zt){if(this.$f&&Ft===this.$f.id){this.$f=null;return}if(!Kt&&ra.has(Ft.type)){this.checkLValSimple(Ft.expression,Kt,zt);return}switch(Ft.type){case"TSParameterProperty":this.checkLValInnerPattern(Ft.parameter,Kt,zt);return;case"Identifier":if(Ft.name==="this")return}super.checkLValSimple(Ft,Kt,zt)}toAssignable(Ft,Kt,zt){if(Ft&&!Kt&&ra.has(Ft.type))return Ft;return super.toAssignable(Ft,Kt,zt)}declareName(Ft,Kt,zt){let Xt=this.currentScope();if(Kt&or){this.$1t(Xt,Ft),Xt.$1u??=[],Xt.$1u.push(Ft);return}if(Kt===nr||Kt===aa){if(Xt.$13??=[],Kt===nr&&Cn(Xt.$13,Ft))this.raise(zt,`type '${Ft}' has already been declared.`);Xt.$13.push(Ft),this.$1t(Xt,Ft);return}if(Kt&da){if(Xt.$1v??=[],Cn(Xt.$1v,Ft))return;super.declareName(Ft,Ds,zt),Xt.$1v.push(Ft);return}super.declareName(Ft,Kt,zt)}$1t(Ft,Kt){if(this.inModule&&Ft.flags&oa)delete this.undefinedExports[Kt]}checkLocalExport(Ft){for(let Kt=this.scopeStack.length-1;Kt>=0;Kt--){let zt=this.scopeStack[Kt];if(Cn(zt.$13,Ft.name)||Cn(zt.$1u,Ft.name))return}super.checkLocalExport(Ft)}checkExport(){}raiseRecoverable(Ft,Kt){if(Kt==="Duplicate constructor in the same class")return;super.raiseRecoverable(Ft,Kt)}$12(){let Ft=[];while(this.type===Wt)Ft.push(this.$1w());return Ft}$1q(Ft){let Kt=this.$9[this.$9.length-1];while(this.type===Wt)Kt.push(this.$1w());if(this.type===ee._export){if(!Ft)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 Ft=this.startNode();this.next(),this.$9.push([]);let Kt=this.start,zt=this.startLoc,Xt;if(this.type===ee.parenL){if(this.next(),Xt=this.parseExpression(),this.expect(ee.parenR),this.options.preserveParens){let Qt=this.startNodeAt(Kt,zt);Qt.expression=Xt,Xt=this.finishNode(Qt,"ParenthesizedExpression")}}else{Xt=this.parseIdent(!1);while(this.eat(ee.dot)){let Qt=this.startNodeAt(Kt,zt);Qt.object=Xt,Qt.property=this.parseIdent(!0),Qt.computed=!1,Xt=this.finishNode(Qt,"MemberExpression")}}let Zt=this.$p()?this.$e():void 0;if(this.eat(ee.parenL)){let Qt=this.startNodeAt(Xt.start,Xt.loc?.start);if(Qt.callee=Xt,Qt.arguments=this.parseExprList(ee.parenR,!1,!1),Zt)Qt.typeArguments=Zt;Xt=this.finishNode(Qt,"CallExpression")}else if(Zt){let Qt=this.startNodeAt(Xt.start,Xt.loc?.start);Qt.expression=Xt,Qt.typeArguments=Zt,Xt=this.finishNode(Qt,"TSInstantiationExpression")}return Ft.expression=Xt,this.$9.pop(),this.finishNode(Ft,"Decorator")}shouldParseExportStatement(){return this.type===Wt||super.shouldParseExportStatement()}parseExprAtom(Ft,Kt,zt){if(this.type===Wt)this.$1q(!1);return super.parseExprAtom(Ft,Kt,zt)}parseProperty(Ft,Kt){if(Ft||this.type!==Wt)return super.parseProperty(Ft,Kt);let zt=this.$12(),Xt=super.parseProperty(Ft,Kt);if(Xt.type==="SpreadElement")this.raise(Xt.start,"Decorators can't be used with SpreadElement");return Xt.decorators=zt,Xt}parseClassId(Ft,Kt){let zt=this.$9.length-1,Xt=this.$9[zt];if(Xt.length>0)Ft.decorators=Xt,this.$q(Ft,Xt[0]),this.$9[zt]=[];if(!this.isContextual("implements")||Kt===!0)super.parseClassId(Ft,Kt);if(this.$1())Ft.typeParameters=this.$8()}parseClassSuper(Ft){if(super.parseClassSuper(Ft),Ft.superClass&&this.$1())Ft.superTypeParameters=this.$e();if(this.eatContextual("implements"))Ft.implements=this.$a(()=>this.$1j())}parseClassElement(Ft){if(this.type===Wt){let en=this.$12();if(this.type===ee.braceR)this.raise(this.start,"Decorators must be attached to a class element.");let tn=this.parseClassElement(Ft);return tn.decorators=en,this.$q(tn,en[0]),tn}if(this.eat(ee.semi))return null;let Kt=this.startNode();while(this.type===ee.name&&Sl.has(this.value)&&!this.containsEsc&&this.$s(this.value==="static")){let en=this.value;if(this.next(),en==="static"&&this.type===ee.braceL)return this.next(),this.parseClassStaticBlock(Kt),Kt;if(en==="public"||en==="private"||en==="protected")Kt.accessibility=en;else Kt[en]=!0}if(this.type===ee.bracketL&&this.$1g())return this.$1h(Kt);Kt.static??=!1;let zt="",Xt=!1,Zt=!1,Qt="method";if(this.eatContextual("async"))if((this.isClassElementNameStart()||this.type===ee.star)&&!this.canInsertSemicolon())Zt=!0;else zt="async";if(!zt&&this.eat(ee.star))Xt=!0;if(!zt&&!Zt&&!Xt){let en=this.value;if(this.eatContextual("get")||this.eatContextual("set"))if(this.isClassElementNameStart())Qt=en;else zt=en}if(zt)Kt.computed=!1,Kt.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),Kt.key.name=zt,this.finishNode(Kt.key,"Identifier");else this.parseClassElementName(Kt);if(this.eat(ee.question))Kt.optional=!0;if(this.type===ee.parenL||this.$1()||Qt!=="method"||Xt||Zt){let en=Kt.key,tn=!Kt.static&&!Kt.computed&&(en.type==="Identifier"&&en.name==="constructor"||en.type==="Literal"&&en.value==="constructor");if(Kt.kind=tn?"constructor":Qt,this.$1())Kt.typeParameters=this.$8();this.$l=tn,this.$o=this.start,this.parseClassMethod(Kt,Xt,Zt,tn&&Ft)}else{if(!Kt.optional&&this.$u())this.next(),Kt.definite=!0;if(this.type===ee.colon)Kt.typeAnnotation=this.$6();this.parseClassField(Kt)}return Kt}parseMaybeAssign(Ft,Kt,zt){if(this.$p()){let Xt=this.$g(()=>{let Zt=this.$8(),Qt=super.parseMaybeAssign(Ft,Kt,zt);if(Qt.type!=="ArrowFunctionExpression")return;return Qt.typeParameters=Zt,this.$q(Qt,Zt),Qt});if(Xt)return Xt}return super.parseMaybeAssign(Ft,Kt,zt)}parseMaybeUnary(Ft,Kt,zt,Xt){if(this.$p()){let Zt=this.startNode();return Zt.typeAnnotation=this.$a(()=>{this.next();let Qt=this.$0();if(!this.$c())this.unexpected();return this.next(),Qt}),Zt.expression=this.parseMaybeUnary(null,!1,!1,Xt),this.finishNode(Zt,"TSTypeAssertion")}return super.parseMaybeUnary(Ft,Kt,zt,Xt)}parseMaybeConditional(Ft,Kt){let zt=this.start,Xt=this.startLoc,Zt=this.parseExprOps(Ft,Kt);if(this.checkExpressionErrors(Kt))return Zt;if(this.type===ee.question&&!(Zt.type==="ArrowFunctionExpression"&&Zt.start===zt)&&!this.$2j()){this.next();let Qt=this.startNodeAt(zt,Xt);return Qt.test=Zt,Qt.consequent=this.parseMaybeAssign(),this.expect(ee.colon),Qt.alternate=this.parseMaybeAssign(Ft),this.finishNode(Qt,"ConditionalExpression")}return Zt}$2j(){let Ft=this.$d(),Kt=this.input.charCodeAt(Ft);if(Kt===ua||Kt===Ol||Kt===Ll)return!0;return Kt===ei&&this.input.charCodeAt(Ft+1)!==ei}parseParenItem(Ft){return this.$h(Ft,!0)}$1x(){if(this.type!==ee.colon)return!0;let Ft=this.$g(()=>{let Kt=this.$6(!0);return this.type===ee.arrow&&!this.canInsertSemicolon()?Kt:void 0});if(!Ft)return!1;return this.$7=Ft,!0}shouldParseArrow(Ft){return this.$1x()&&super.shouldParseArrow(Ft)}shouldParseAsyncArrow(){return this.$1x()&&super.shouldParseAsyncArrow()}parseArrowExpression(Ft,Kt,zt,Xt){if(this.$7)Ft.returnType=this.$7,this.$7=null;return super.parseArrowExpression(Ft,Kt,zt,Xt)}parseExprList(Ft,Kt,zt,Xt){if(!this.$m)return super.parseExprList(Ft,Kt,zt,Xt);this.$m=!1;let Zt=[],Qt=!0;while(!this.eat(Ft)){if(Qt)Qt=!1;else if(this.expect(ee.comma),Kt&&this.afterTrailingComma(Ft))break;if(this.type===ee.ellipsis){let en=this.parseSpread(Xt);if(this.eat(ee.question))en.optional=!0;if(this.type===ee.colon)en.typeAnnotation=this.$6();Zt.push(en)}else Zt.push(this.parseMaybeAssign(!1,Xt,this.parseParenItem))}return Zt}parseSubscript(Ft,Kt,zt,Xt,Zt,Qt,en){if(this.$u()&&!this.hasPrecedingLineBreak()){let sn=this.startNodeAt(Kt,zt);return this.exprAllowed=!1,this.next(),sn.expression=Ft,this.finishNode(sn,"TSNonNullExpression")}if(Zt&&this.$1()){let sn=this.$g(()=>this.$2k(Kt,zt,en));if(sn)return sn}let tn=this.type===ee.questionDot&&this.$2()===ha;if(this.$1()||tn||this.type===ee.bitShift&&this.value==="<<"){let sn=this.$g(()=>{if(tn)this.next();this.$p();let nn=this.$e();if(this.type===ee.parenL&&!Xt)return nn;if(this.type===ee.backQuote)return tn?void 0:nn;if(tn)return;if(this.$c()||this.type===ee.bitShift||this.type.startsExpr&&this.type!==ee.parenL&&!this.hasPrecedingLineBreak())return;return nn});if(sn){let nn=this.startNodeAt(Kt,zt);if(this.type===ee.parenL&&!Xt){if(this.next(),nn.callee=Ft,nn.arguments=this.parseExprList(ee.parenR,!0,!1),nn.typeArguments=sn,tn)Ft.optional=!0;if(tn||Qt)nn.optional=tn;return this.finishNode(nn,"CallExpression")}if(this.type===ee.backQuote)return nn.tag=Ft,nn.quasi=this.parseTemplate({isTagged:!0}),nn.typeArguments=sn,this.finishNode(nn,"TaggedTemplateExpression");return nn.expression=Ft,nn.typeArguments=sn,this.finishNode(nn,"TSInstantiationExpression")}}if(Zt&&this.type===ee.parenL)this.$m=!0;return super.parseSubscript(Ft,Kt,zt,Xt,Zt,Qt,en)}$2k(Ft,Kt,zt){let Xt=this.startNodeAt(Ft,Kt);if(Xt.typeParameters=this.$8(),this.expect(ee.parenL),Xt.params=this.parseBindingList(ee.parenR,!1,!0),this.type===ee.colon)Xt.returnType=this.$6(!0);if(this.type!==ee.arrow||this.canInsertSemicolon())return;return this.next(),this.parseArrowExpression(Xt,Xt.params,!0,zt)}parseDynamicImport(Ft){if(this.next(),Ft.source=this.parseMaybeAssign(),this.eat(ee.comma)&&this.type!==ee.parenR)Ft.arguments=[this.parseExpression()];return this.expect(ee.parenR),this.finishNode(Ft,"ImportExpression")}parseNew(){let Ft=super.parseNew();if(Ft.callee?.type!=="TSInstantiationExpression")return Ft;let Kt=this.startNodeAt(Ft.start,Ft.loc?.start);return Kt.callee=Ft.callee.expression,Kt.typeArguments=Ft.callee.typeArguments,Kt.arguments=Ft.arguments,this.finishNodeAt(Kt,"NewExpression",Ft.end,Ft.loc?.end)}parseExprOp(Ft,Kt,zt,Xt,Zt){if(ee._in.binop>Xt&&this.type===ee.name&&(this.value==="as"||this.value==="satisfies")&&!this.containsEsc&&!this.hasPrecedingLineBreak()){let Qt=this.value==="satisfies",en=this.startNodeAt(Kt,zt);return en.expression=Ft,en.typeAnnotation=this.$a(()=>{if(this.next(),!Qt&&this.type===ee._const){let tn=this.startNode();return tn.typeName=this.parseIdent(!0),this.finishNode(tn,"TSTypeReference")}return this.$0()}),this.finishNode(en,Qt?"TSSatisfiesExpression":"TSAsExpression"),this.parseExprOp(en,Kt,zt,Xt,Zt)}return super.parseExprOp(Ft,Kt,zt,Xt,Zt)}parseGetterSetter(Ft){Ft.kind=Ft.key.name,super.parseGetterSetter(Ft)}parsePropertyValue(Ft,Kt,zt,Xt,Zt,Qt,en,tn){if(!Kt&&this.$1()){if(this.$k=this.$8(),this.type!==ee.parenL)this.unexpected();Ft.kind="init"}return super.parsePropertyValue(Ft,Kt,zt,Xt,Zt,Qt,en,tn)}}return Ht});function de(){throw Error('sveast: parsing TypeScript needs `typescript` from "sveast/typescript": createParser({ typescript }) or createModuleParser({ typescript })')}var Bl=/^\t+/;class e extends Error{name="ParseError";code;reason;position;start;end;frame;constructor(M,ee,we){super(`${we}
|
|
21
|
+
https://svelte.dev/e/${ee}`);this.code=ee,this.reason=we;let Je=typeof M==="number"?M:M?.start,Gt=typeof M==="number"?M:M?.end;if(Je!==void 0)this.position=[Je,Gt??Je],this.start=g(this.position[0]),this.end=g(this.position[1]),this.frame=Vl(this.start.line-1,this.end.column)}}var fa=(M)=>M.replace(Bl,(ee)=>" ".repeat(ee.length));function Vl(M,ee){let we=Math.max(0,M-2),Je=[];for(let Wt=we;Wt<M+3;Wt++){let Ht=$o(Wt);if(Ht===void 0)break;Je.push(Ht)}let Gt=String(we+Je.length+1).length;return Je.map((Wt,Ht)=>{let Ft=`${String(we+Ht+1).padStart(Gt," ")}: ${fa(Wt)}`;if(we+Ht!==M)return Ft;return`${Ft}
|
|
22
|
+
${" ".repeat(Gt+2+fa(Wt.slice(0,ee)).length)}^`}).join(`
|
|
23
|
+
`)}function Ge(M){throw new e(M,"attribute_duplicate","Attributes need to be unique")}function We(M){throw new e(M,"attribute_empty_shorthand","Attribute shorthand cannot be empty")}function He(M,ee){throw new e(M,"block_duplicate_clause",`${ee} cannot appear more than once within a block`)}function ze(M){throw new e(M,"block_invalid_continuation_placement","{:...} block is invalid at this position (did you forget to close the preceding element or block?)")}function Xe(M){throw new e(M,"block_invalid_elseif","'elseif' should be 'else if'")}function Qe(M,ee,we){throw new e(M,"block_invalid_placement",`{#${ee} ...} block cannot be ${we}`)}function Ye(M){throw new e(M,"block_unclosed","Block was left open")}function Ze(M){throw new e(M,"block_unexpected_close","Unexpected block closing tag")}function Ke(M){throw new e(M,"const_tag_invalid_expression","{@const ...} must consist of a single variable declaration")}function et(M){throw new e(M,"css_empty_declaration","Declaration cannot be empty")}function Ne(M){throw new e(M,"css_expected_identifier","Expected a valid CSS identifier")}function tt(M){throw new e(M,"css_selector_invalid","Invalid selector")}function nt(M){throw new e(M,"debug_tag_invalid_arguments","{@debug ...} arguments must be identifiers, not arbitrary expressions")}function Ie(M){throw new e(M,"declaration_tag_invalid_type","Declaration tags must be `let` or `const` declarations")}function rt(M){throw new e(M,"directive_invalid_value","Directive value must be a JavaScript expression enclosed in curly braces")}function it(M,ee){throw new e(M,"directive_missing_name",`\`${ee}\` name cannot be empty`)}function st(M,ee){throw new e(M,"element_invalid_closing_tag",`\`</${ee}>\` attempted to close an element that was not open`)}function ot(M,ee,we){throw new e(M,"element_invalid_closing_tag_autoclosed",`\`</${ee}>\` attempted to close element that was already automatically closed by \`<${we}>\` (cannot nest \`<${we}>\` inside \`<${ee}>\`)`)}function Re(M,ee){throw new e(M,"element_unclosed",`\`<${ee}>\` was left open`)}function Le(M){throw new e(M,"expected_attribute_value","Expected attribute value")}function at(M){throw new e(M,"expected_block_type","Expected 'if', 'each', 'await', 'key' or 'snippet'")}function Me(M){throw new e(M,"expected_identifier","Expected an identifier")}function ct(M){throw new e(M,"expected_pattern","Expected identifier or destructure pattern")}function pt(M){throw new e(M,"expected_tag","Expected 'html', 'render', 'attach', 'const', or 'debug'")}function C(M,ee){throw new e(M,"expected_token",`Expected token ${ee}`)}function ut(M){throw new e(M,"expected_whitespace","Expected whitespace")}function Gl(M,ee){throw new e(M,"js_parse_error",`${ee}`)}function lt(M){throw new e(M,"render_tag_invalid_expression","`{@render ...}` tags can only contain call expressions")}function ft(M){throw new e(M,"script_duplicate","A component can have a single top-level `<script>` element and/or a single top-level `<script module>` element")}function dt(M,ee){throw new e(M,"script_invalid_attribute_value",`If the \`${ee}\` attribute is supplied, it must be a boolean attribute`)}function mt(M){throw new e(M,"script_invalid_context",'If the context attribute is supplied, its value must be "module"')}function ht(M,ee){throw new e(M,"script_reserved_attribute",`The \`${ee}\` attribute is reserved and cannot be used`)}function gt(M){throw new e(M,"style_duplicate","A component can have a single top-level `<style>` element")}function yt(M){throw new e(M,"svelte_component_invalid_this","Invalid component definition — must be an `{expression}`")}function xt(M){throw new e(M,"svelte_component_missing_this","`<svelte:component>` must have a 'this' attribute")}function Oe(M){throw new e(M,"svelte_element_missing_this","`<svelte:element>` must have a 'this' attribute with a value")}function Tt(M,ee){throw new e(M,"svelte_meta_duplicate",`A component can only have one \`<${ee}>\` element`)}function Et(M,ee){throw new e(M,"svelte_meta_invalid_content",`<${ee}> cannot have children`)}function St(M,ee){throw new e(M,"svelte_meta_invalid_placement",`\`<${ee}>\` tags cannot be inside elements or blocks`)}function kt(M,ee){throw new e(M,"svelte_meta_invalid_tag",`Valid \`<svelte:...>\` tag names are ${ee}`)}function bt(M){throw new e(M,"svelte_options_deprecated_tag",'"tag" option is deprecated — use "customElement" instead')}function wt(M){throw new e(M,"svelte_options_invalid_attribute","`<svelte:options>` can only receive static attributes")}function me(M,ee){throw new e(M,"svelte_options_invalid_attribute_value",`Value must be ${ee}, if specified`)}function vt(M){throw new e(M,"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 Ct(M){throw new e(M,"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 Dt(M){throw new e(M,"svelte_options_invalid_customelement_shadow",'"shadow" must be either "open", "none" or `ShadowRootInit` object.')}function $e(M){throw new e(M,"svelte_options_invalid_tagname","Tag name must be lowercase and hyphenated")}function Pt(M){throw new e(M,"svelte_options_reserved_tagname","Tag name is reserved")}function At(M,ee){throw new e(M,"svelte_options_unknown_attribute",`\`<svelte:options>\` unknown attribute '${ee}'`)}function _t(M){throw new e(M,"tag_invalid_name","Expected a valid element or component name. Components must have a valid variable name or dot notation expression")}function Nt(M,ee,we){throw new e(M,"tag_invalid_placement",`{@${ee} ...} tag cannot be ${we}`)}function d(M){throw new e(M,"unexpected_eof","Unexpected end of input")}function It(M,ee){throw new e(M,"unexpected_reserved_word",`'${ee}' is a reserved word in JavaScript and cannot be used here`)}function Rt(M){throw new e(M,"unterminated_string_constant","Unterminated string constant")}function Lt(M){throw new e(M,"void_element_invalid_content","Void elements cannot have children or closing tags")}var fs="",ya=[],si=0,gn=[],yn=0;function Wl(M,ee){fs=M,ya=ee,si=0}function Ul(){return si}function Kl(M,ee,we,Je){si=Je}function Hl(M,ee,we,Je,Gt,Wt){si=Je;let Ht=ee;if(M&&Ht.includes(`
|
|
24
|
+
`)){let Kt=fs.lastIndexOf(`
|
|
25
|
+
`,we-1)+1,zt=Kt,Xt=fs.charCodeAt(zt);while(Xt===32||Xt===9)Xt=fs.charCodeAt(++zt);if(zt>Kt)Ht=ql(Ht,fs.slice(Kt,zt))}let Ft={type:M?"Block":"Line",value:Ht,start:we,end:Je};if(Gt&&Wt)Ft.loc={start:Gt,end:Wt};ya.push(Ft)}function ql(M,ee){let we=M.startsWith(ee)?ee.length:0,Je="",Gt=M.indexOf(`
|
|
26
|
+
`,we);while(Gt!==-1){if(Je+=M.slice(we,Gt+1),we=Gt+1,M.startsWith(ee,we))we+=ee.length;Gt=M.indexOf(`
|
|
27
|
+
`,we)}return Je+M.slice(we)}function zl(M,ee,we){let Je=0,Gt=ee.length;while(Je<Gt){let Wt=Je+Gt>>>1;if(ee[Wt].start<we)Je=Wt+1;else Gt=Wt}if(Je>=ee.length)return;if(gn=ee.slice(Je).map(({type:Wt,value:Ht,start:Ft,end:Kt})=>({type:Wt,value:Ht,start:Ft,end:Kt})),yn=0,pr(M,void 0,!1),yn<gn.length&&(gn[yn].start>=M.end||M.type==="Program")){M.trailingComments??=[];while(yn<gn.length)M.trailingComments.push(gn[yn++])}}var Xl=new Map([["BlockStatement","body"],["Program","body"],["ArrayExpression","elements"],["ObjectExpression","properties"]]);function ma(M,ee){for(let we=M;we<ee;we++){let Je=fs.charCodeAt(we);if(Je!==44&&Je!==41&&Je!==32&&Je!==9)return!0}return!1}function pr(M,ee,we){while(yn<gn.length&&gn[yn].start<M.start)M.leadingComments??=[],M.leadingComments.push(gn[yn++]);if(yn>=gn.length)return;let Je=gn[yn].start;if(Je<M.end||!ma(M.end,Je)){let Gt=Yn(M),Wt=Xl.get(M.type),Ht=Wt===void 0?void 0:Gt[Wt],Ft=Array.isArray(Ht)&&Ht.length===0;for(let Kt in Gt){if(yn>=gn.length)return;if(Kt==="type")continue;let zt=Gt[Kt];if(Array.isArray(zt)){let Xt=Kt===Wt;for(let Zt=0;Zt<zt.length;Zt++){let Qt=zt[Zt];if(jn(Qt))pr(Qt,M,Xt?Zt===zt.length-1:Ft)}}else if(jn(zt))pr(zt,M,Ft)}if(yn>=gn.length)return}if(ee!==void 0&&M.end===ee.end)return;if(we)while(yn<gn.length){if(ee&&gn[yn].start>=ee.end)break;M.trailingComments??=[],M.trailingComments.push(gn[yn++])}else if(M.end<=gn[yn].start&&!ma(M.end,gn[yn].start))M.trailingComments=[gn[yn++]]}var he=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(" ")),ii=!1,Ns=1,Jl=2,Yl=32,Ql=256,Zl=Ns|Jl|Ql,eu=2,tu=3,nu=4,su=/\r\n?|\n|\u2028|\u2029/,ga=new Map;function ni(M){if(!(M instanceof RegExp))return M;let ee=ga.get(M);if(!ee){let we=new Set(M.source.slice(4,-2).split("|"));ee={test:(Je)=>we.has(Je)},ga.set(M,ee)}return ee}var cr=$s((M)=>class extends M{declareName(ee,we,Je){let Gt=!1;if(we===eu){let Wt=this.currentScope();if(Gt=Cn(Wt.lexical,ee)||Cn(Wt.functions,ee)||Cn(Wt.var,ee),Wt.lexical.push(ee),this.inModule&&Wt.flags&Ns)delete this.undefinedExports[ee]}else if(we===nu)this.currentScope().lexical.push(ee);else if(we===tu){let Wt=this.currentScope();Gt=this.treatFunctionsAsVar?Cn(Wt.lexical,ee):Cn(Wt.lexical,ee)||Cn(Wt.var,ee),Wt.functions.push(ee)}else for(let Wt=this.scopeStack.length-1;Wt>=0;--Wt){let Ht=this.scopeStack[Wt];if(Cn(Ht.lexical,ee)&&!(Ht.flags&Yl&&Ht.lexical[0]===ee)||!this.treatFunctionsAsVarInScope(Ht)&&Cn(Ht.functions,ee)){Gt=!0;break}if(Ht.var.push(ee),this.inModule&&Ht.flags&Ns)delete this.undefinedExports[ee];if(Ht.flags&Zl)break}if(Gt)this.raiseRecoverable(Je,`Identifier '${ee}' has already been declared`)}}),lr=$s((M)=>{let{keywordTypes:ee,tokTypes:we}=M.acorn,Je=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((Wt)=>[Wt,ee[Wt]])),Gt;return class extends M{constructor(Wt,Ht,Ft){super(Wt,Ht,Ft);this.keywords=ni(this.keywords),this.reservedWords=ni(this.reservedWords),this.reservedWordsStrict=ni(this.reservedWordsStrict),this.reservedWordsStrictBind=ni(this.reservedWordsStrictBind),Gt??=this.context[0]}reset(Wt,Ht,Ft){if(super.reset?.(Wt,Ht,Ft),this.input=Wt,this.containsEsc=!1,this.pos=Ht,Ft)this.lineStart=Ht-Ft.column,this.curLine=Ft.line;else this.lineStart=Wt.lastIndexOf(`
|
|
28
|
+
`,Ht-1)+1,this.curLine=this.options.locations?Wt.slice(0,this.lineStart).split(su).length:1;this.type=we.eof,this.value=null,this.start=this.end=Ht,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=Ht;let Kt=this.context;if(Kt.length!==1||Kt[0]!==Gt)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 Zt in this.undefinedExports){this.undefinedExports=Object.create(null);break}let zt=this.scopeStack,Xt=zt[0];if(zt.length!==1||Xt.flags!==Ns||Xt.var.length>0||Xt.lexical.length>0||Xt.functions.length>0||Xt.tsTypes!==void 0||Xt.tsExportOnly!==void 0||Xt.tsEnums!==void 0)this.scopeStack=[],this.enterScope(Ns);if(this.regexpState=null,this.privateNameStack.length>0)this.privateNameStack=[];this.inTemplateElement=!1}parseParenAndDistinguishExpression(Wt,Ht){let Ft=super.parseParenAndDistinguishExpression(Wt,Ht);if(Ft.type==="ParenthesizedExpression")ii=!0;return Ft}checkUnreserved(Wt){if(he.has(Wt.name))super.checkUnreserved(Wt)}canInsertSemicolon(){let Wt=this.type;return Wt===we.eof||Wt===we.braceR||As(this.input,this.lastTokEnd,this.start)}checkLocalExport(){}skipSpace(){let Wt=this.input,Ht=this.options.locations,Ft=this.pos,Kt=Wt.charCodeAt(Ft);for(;;)if(Kt===32||Kt===9)Kt=Wt.charCodeAt(++Ft);else if(Kt===10){if(Kt=Wt.charCodeAt(++Ft),Ht)this.curLine++,this.lineStart=Ft}else break;if(this.pos=Ft,Kt===47||Kt<33||Kt>=128)super.skipSpace()}readWord1(){let Wt=this.input,Ht=this.pos,Ft=Ht,Kt=Wt.charCodeAt(Ft),zt=0;while(Kt>=97&&Kt<=122||Kt>=65&&Kt<=90||Kt>=48&&Kt<=57||Kt===95||Kt===36)zt=Math.imul(zt,31)+Kt|0,Kt=Wt.charCodeAt(++Ft);if(Kt>=128||Kt===92)return super.readWord1();return this.containsEsc=!1,this.pos=Ft,To(Wt,Ht,Ft,zt)}readWord(){let Wt=this.readWord1();return this.finishToken(Je.get(Wt)??we.name,Wt)}}}),xa=Zs(cr,lr),iu=/ \(\d+:\d+\)$/;function _s(M){return M}function va(M){return M instanceof SyntaxError&&"pos"in M&&typeof M.pos==="number"}function ur(M,ee,we,Je,Gt,Wt=M.root.comments.length){let Ht=M.root.comments;Wl(ee,Ht);let Ft={onComment:M.comments?Hl:Kl,sourceType:"module",ecmaVersion:16,locations:M.loc,preserveParens:Je};if(M.lfOnly)Ft.startLocation=g(we);let Kt=M.isTypeScript?M.typescript:xa;if(!Kt)de();let zt;try{zt=Gt(Kt,Ft)}catch(Xt){if(!va(Xt))throw Xt;Gl(Xt.pos,Xt.message.replace(iu,""))}if(Ht.length>Wt)zl(_s(zt),Ht,we);return zt}function ge(M,ee,we=0){return _s(ur(M,ee,0,!1,(Je,Gt)=>{if(we>0&&Gt.locations)Gt.startLocation=g(we);let Wt=new Je(Gt,ee,we).parse();return Wt.start=0,Wt},0))}function ru(M,ee){if(!ee)return{line:1,column:0};let{column:we}=g(M);return{line:Po(M-we)+1,column:we}}var ou={count:0},ar,au=(M)=>M.parseExpression();function pu(M,ee,we,Je,Gt){let Wt=ar;if(ar=void 0,Wt?.ParserClass===M&&Wt.onComment===ee.onComment&&Wt.locations===ee.locations&&Wt.parser.reset)Wt.parser.reset(we,Je,ee.startLocation);else Wt={ParserClass:M,onComment:ee.onComment,locations:ee.locations,parser:new M(ee,we,Je)};let Ht=Wt.parser;Ht.nextToken();let Ft=Gt(Ht);return Ht.input="",ar=Wt,Ft}function Ea(M,ee,we,Je){return ou.count+=1,ii=!1,ur(M,ee,we,!0,(Gt,Wt)=>(Wt.startLocation??=ru(we,Wt.locations),pu(Gt,Wt,ee,we,Je)))}function B(M,ee,we,Je=!1){let Gt=_s(Ea(M,ee,we,au)),Wt=Math.max(Gt.end,Ul());return{node:ii&&!Je?hr(Gt):Gt,end:Wt}}function Mt(M,ee,we){let Je=M.root.comments.length,Gt=!0,Wt=Ea(M,ee,we,(Ft)=>{let Kt={shorthandAssign:-1,trailingComma:-1,parenthesizedAssign:-1,parenthesizedBind:-1,doubleProto:-1},zt=Ft.parseMaybeConditional(void 0,Kt);if(Ft.type!==xa.acorn.tokTypes.eof)return Gt=!1,zt;let Xt=Ft.toAssignable(zt,!1,Kt);return Ft.checkLValPattern(Xt),Xt});if(!Gt){M.root.comments.length=Je;return}let Ht=_s(Wt);return ii?hr(Ht):Ht}function Ot(M,ee,we){return _s(ur(M,ee,we,!1,(Je,Gt)=>{let Wt=new Je(Gt,ee,we);try{return Wt.nextToken(),Wt.parseStatement(null,!0,Object.create(null))}catch(Ht){if(va(Ht)&&Ht.pos===ee.length)d(ee.length);throw Ht}}))}function hr(M){let ee=M;while(ee.type==="ParenthesizedExpression")ee=ee.expression;return G(ee,hr),ee}var j=Zs(cr,fe,lr);function ba(M,ee,we){return te(M),ge({isTypeScript:ee.typescript??!1,typescript:we,loc:ee.loc??!1,comments:ee.comments??!0,root:{comments:[]}},M)}function ye(M,ee={}){return ba(M,ee,j)}function xe(M,ee){let we=l(M.name,ee.name);if(we!==0)return we;let Je=l(M.type,ee.type);if(Je!==0)return Je;if(M.type==="forwarded"&&ee.type==="forwarded"){let Gt=l(M.element,ee.element);if(Gt!==0)return Gt}return l(M.detail??"",ee.detail??"")}function cu(M,ee){let we=M.length+1,Je=ee.length+1,Gt=Array.from({length:we},()=>Array(Je).fill(0));for(let Wt=0;Wt<we;Wt++)Gt[Wt][0]=Wt;for(let Wt=0;Wt<Je;Wt++)Gt[0][Wt]=Wt;for(let Wt=1;Wt<we;Wt++)for(let Ht=1;Ht<Je;Ht++){let Ft=M[Wt-1]===ee[Ht-1]?0:1;if(Gt[Wt][Ht]=Math.min(Gt[Wt-1][Ht]+1,Gt[Wt][Ht-1]+1,Gt[Wt-1][Ht-1]+Ft),Wt>1&&Ht>1&&M[Wt-1]===ee[Ht-2]&&M[Wt-2]===ee[Ht-1])Gt[Wt][Ht]=Math.min(Gt[Wt][Ht],Gt[Wt-2][Ht-2]+1)}return Gt[we-1][Je-1]}function N(M,ee,we=3){let Je,Gt=Number.POSITIVE_INFINITY;for(let Wt of ee){let Ht=cu(M,Wt);if(Ht<Gt)Je=Wt,Gt=Ht}return Gt<=we?Je:void 0}import{readFile as hu}from"node:fs/promises";import mr from"node:path";import Sa,{sep as dr}from"node:path";var In=/\.svelte$/,ms=[".ts",".mts",".cts",".tsx",".js",".mjs",".cjs",".jsx",".d.ts"],Ca=/\.(?:svelte|[mc]?ts|[mc]?js|tsx|jsx)$/;function gs(M){if(!M.endsWith(".svelte"))return!1;let ee=M.length-7;if(ee===0)return!1;let we=M.charCodeAt(ee-1);return we!==47&&(dr==="/"||we!==92)}function n(M){return dr==="/"?M:M.split(dr).join("/")}function wa(M,ee){return n(Sa.join(ee,Sa.normalize(M)))}function Rs(M){return`${JSON.stringify(M,null,2)}
|
|
29
|
+
`}var ka="sveld",ri="0.38.3";var $t={name:ka,version:ri,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",build:"bun scripts/build.ts",bench:"bun scripts/bench.ts","bench:cache":"bun scripts/bench.ts --cache","bench:ostia":"ostia bench scripts/bench-ostia.ts",typecheck:"bun check && bun check --project tsconfig.excluded.json"},devDependencies:{"@biomejs/biome":"2.5.14","@types/bun":"^1.4.2","@types/jest":"^30.0.0","@typescript/typescript6":"^6.0.2",ajv:"^8.20.0",ostia:"^0.2.7",sveast:"^0.9.3",svelte:"^5.57.1",typescript:"^7.0.2"},bin:{sveld:"dist/cli.js"},repository:{type:"git",url:"git+https://github.com/carbon-design-system/sveld.git"},homepage:"https://github.com/carbon-design-system/sveld",bugs:"https://github.com/carbon-design-system/sveld/issues",keywords:["svelte","svelte component","documentation","docgen","typescript","definitions","JSDocs","vite","vite-plugin"],maintainers:["Eric Liu (https://github.com/metonym)"]};var Is="5.57.1";var oi=1;function Kn(M){return M.some((ee)=>ee.internal)?M.filter((ee)=>!ee.internal):M}function uu(M){return{...M,props:Kn(M.props),moduleExports:Kn(M.moduleExports),slots:Kn(M.slots),events:Kn(M.events),typedefs:Kn(M.typedefs),...M.contexts?{contexts:Kn(M.contexts).map((ee)=>({...ee,properties:Kn(ee.properties)}))}:{}}}function m(M,ee={}){let we=Array.from(M.values(),(Wt)=>{let{diagnostics:Ht,...Ft}=Wt;return uu(Ft)}).sort((Wt,Ht)=>l(Wt.moduleName,Ht.moduleName)),Je={schemaVersion:oi,generator:{name:ka,version:ri,svelteVersion:Is},total:we.length,components:we},Gt=ee.entryExports?Kn(ee.entryExports):void 0;if(Gt&&Gt.length>0)Je.totalExports=Gt.length,Je.exports=Gt;return Je}var du=/[:=]/,gr="COMPONENT_API.json",ai={none:0,patch:1,minor:2,major:3};function fu(M,ee){return ai[ee]>ai[M]?ee:M}function mu(M){return M.reduce((ee,we)=>fu(ee,we.bump),"none")}function Da(M,ee){return ai[M]>=ai[ee]}function Ta(M){return new Set(s(M,"|").map((ee)=>ee.trim()).filter((ee)=>ee.length>0))}function Pa(M){let ee=Fi(M);if(ee===-1)return;let we=M.slice(0,ee).trim(),Je=M.slice(ee+2).trim();if(!we.startsWith("(")||!we.endsWith(")"))return;let Gt=we.slice(1,-1).trim();return{params:Gt.length===0?[]:s(Gt,",").map((Ht)=>Ht.trim()),returnType:Je}}function gu(M){return(M.split(du,1)[0]??"").trimEnd().endsWith("?")}function yu(M,ee){if(M.returnType!==ee.returnType)return"major";if(ee.params.length<M.params.length)return"major";for(let Je=0;Je<M.params.length;Je++)if(M.params[Je]!==ee.params[Je])return"major";if(ee.params.length===M.params.length)return"none";return ee.params.slice(M.params.length).every(gu)?"minor":"major"}function yr(M,ee){if(M===ee)return"none";if(M===void 0||ee===void 0)return"major";let we=Pa(M),Je=Pa(ee);if(we&&Je)return yu(we,Je);let Gt=Ta(M),Wt=Ta(ee),Ht=[...Wt].some((Kt)=>!Gt.has(Kt));if(![...Gt].some((Kt)=>!Wt.has(Kt)))return Ht?"minor":"none";return"major"}function $a(M){return M.bindable===!0||M.binding==="writable"}function ci(M,ee,we){let Je=new Map(M.map((Kt)=>[we(Kt),Kt])),Gt=new Map(ee.map((Kt)=>[we(Kt),Kt])),Wt=[...Gt].filter(([Kt])=>!Je.has(Kt)),Ht=[...Je.keys()].filter((Kt)=>!Gt.has(Kt)),Ft=[];for(let[Kt,zt]of Je){let Xt=Gt.get(Kt);if(Xt)Ft.push([Kt,zt,Xt])}return{added:Wt,removed:Ht,common:Ft}}function Aa(M,ee,we,Je){let Gt=ee==="prop"?"prop":"export",Wt=[],Ht=(Xt,Zt,Qt)=>Wt.push({component:M,kind:ee,name:Xt,bump:Zt,message:`${Gt} "${Xt}" ${Qt}`}),{added:Ft,removed:Kt,common:zt}=ci(we,Je,(Xt)=>Xt.name);for(let[Xt,Zt]of Ft)Ht(Xt,Zt.isRequired?"major":"minor",`added${Zt.isRequired?" (required)":""}`);for(let Xt of Kt)Ht(Xt,"major","removed");for(let[Xt,Zt,Qt]of zt){if(Zt.isRequired!==Qt.isRequired)Ht(Xt,Qt.isRequired?"major":"minor",`became ${Qt.isRequired?"required":"optional"}`);let en=yr(Zt.type,Qt.type);if(en!=="none")Ht(Xt,en,`type changed from \`${Zt.type??"unknown"}\` to \`${Qt.type??"unknown"}\``);let tn=$a(Qt);if($a(Zt)!==tn)Ht(Xt,tn?"minor":"major",tn?"gained a writable binding":"lost its writable binding");if(Zt.value!==Qt.value&&en==="none")Ht(Xt,"patch",`default changed from \`${Zt.value??"none"}\` to \`${Qt.value??"none"}\``);let sn=Qt.deprecated!==void 0;if(Zt.deprecated!==void 0!==sn)Ht(Xt,sn?"minor":"patch",sn?"marked as deprecated":"no longer deprecated");if(Zt.constant!==Qt.constant)Ht(Xt,"minor",Qt.constant?"became constant":"became mutable");if(Zt.reactive!==Qt.reactive)Ht(Xt,"minor",Qt.reactive?"became reactive":"stopped being reactive")}return Wt}function xu(M,ee,we){let Je=[],{added:Gt,removed:Wt,common:Ht}=ci(ee,we,(Ft)=>Ft.name);for(let[Ft]of Gt)Je.push({component:M,kind:"event",name:Ft,bump:"minor",message:`event "${Ft}" added`});for(let Ft of Wt)Je.push({component:M,kind:"event",name:Ft,bump:"major",message:`event "${Ft}" removed`});for(let[Ft,Kt,zt]of Ht){if(Kt.type!==zt.type){Je.push({component:M,kind:"event",name:Ft,bump:"major",message:`event "${Ft}" changed from ${Kt.type} to ${zt.type}`});continue}let Xt=Kt.type==="dispatched"?Kt.detail:void 0,Zt=zt.type==="dispatched"?zt.detail:void 0,Qt=yr(Xt,Zt);if(Qt!=="none")Je.push({component:M,kind:"event",name:Ft,bump:Qt,message:`event "${Ft}" detail changed from \`${Xt??"unknown"}\` to \`${Zt??"unknown"}\``})}return Je}function vu(M,ee,we){let Je=[],{added:Gt,removed:Wt,common:Ht}=ci(ee,we,(Ft)=>Ft.name??"default");for(let[Ft]of Gt)Je.push({component:M,kind:"slot",name:Ft,bump:"minor",message:`slot "${Ft}" added`});for(let Ft of Wt)Je.push({component:M,kind:"slot",name:Ft,bump:"major",message:`slot "${Ft}" removed`});for(let[Ft,Kt,zt]of Ht){let Xt=yr(Kt.slot_props,zt.slot_props);if(Xt!=="none")Je.push({component:M,kind:"slot",name:Ft,bump:Xt,message:`slot "${Ft}" props changed from \`${Kt.slot_props??"none"}\` to \`${zt.slot_props??"none"}\``})}return Je}var Eu=new Set(["description","source","componentCommentSource","tags"]);function pi(M){if(Array.isArray(M))return M.map(pi);if(M!==null&&typeof M==="object"){let ee={};for(let[we,Je]of Object.entries(M)){if(Eu.has(we))continue;ee[we]=pi(Je)}return ee}return M}var bu=["generics","rest_props","extends","contexts","typedefs"];function Su(M,ee,we){let Je=[];for(let Gt of bu){let Wt=JSON.stringify(pi(ee[Gt])),Ht=JSON.stringify(pi(we[Gt]));if(Wt!==Ht)Je.push({component:M,kind:"shape",name:Gt,bump:"major",message:`"${Gt}" changed (breaking)`})}return Je}function Cu(M,ee){let we=ee.moduleName;return[...Aa(we,"prop",M.props,ee.props),...Aa(we,"moduleExport",M.moduleExports,ee.moduleExports),...xu(we,M.events,ee.events),...vu(we,M.slots,ee.slots),...Su(we,M,ee)]}function Bt(M,ee){let we=[],{added:Je,removed:Gt,common:Wt}=ci(M.components,ee.components,(Ht)=>Ht.moduleName);for(let[Ht]of Je)we.push({component:Ht,kind:"component",bump:"minor",message:`component "${Ht}" added`});for(let Ht of Gt)we.push({component:Ht,kind:"component",bump:"major",message:`component "${Ht}" removed`});for(let[,Ht,Ft]of Wt)we.push(...Cu(Ht,Ft));return we}async function wu(M){let ee;try{ee=await hu(mr.resolve(M),"utf-8")}catch(we){if(we.code==="ENOENT")return null;throw we}try{return JSON.parse(ee)}catch{throw Error(`sveld: could not parse "${M}" as JSON. Is it a sveld COMPONENT_API.json snapshot?`)}}function Te(M){if(typeof M.check==="string")return M.check;return M.jsonOptions?.outFile??gr}function Ee(M,ee){if(!M.json||M.stdout||M.jsonOptions?.outDir)return!1;return mr.resolve(M.jsonOptions?.outFile??gr)===mr.resolve(ee)}async function J(M,ee,we={}){let Je=await wu(ee);if(Je===null)return{snapshotExists:!1,snapshotFile:ee,changes:[],bump:"none"};if(Je.schemaVersion!==oi)return{snapshotExists:!0,snapshotFile:ee,changes:[{component:"*",kind:"schema",bump:"none",message:`snapshot schemaVersion ${Je.schemaVersion} differs from ${oi}; regenerate the snapshot`}],bump:"none"};let Gt=m(M,{entryExports:we.entryExports}),Wt=Bt(Je,Gt);return{snapshotExists:!0,snapshotFile:ee,changes:Wt,bump:mu(Wt)}}var ku={major:"BREAKING",minor:"additive",patch:"patch",none:"no change"};function Se(M){if(!M.snapshotExists){let Gt=M.snapshotFile===gr?"`sveld --json`":`\`sveld --json\` with \`jsonOptions.outFile: "${M.snapshotFile}"\``;return`sveld --check: no snapshot found at "${M.snapshotFile}". Generate it with ${Gt} and commit it.`}if(M.changes.length===0)return`sveld --check: no API changes detected against "${M.snapshotFile}".`;let ee=M.changes.length,we=[`sveld --check: ${ee} API change${ee===1?"":"s"} detected against "${M.snapshotFile}".`,`Suggested semver bump: ${M.bump}.`],Je=new Map;for(let Gt of M.changes){let Wt=Je.get(Gt.component)??[];Wt.push(Gt),Je.set(Gt.component,Wt)}for(let[Gt,Wt]of Je){we.push("",` ${Gt}`);for(let Ht of Wt){let Ft=Ht.kind==="schema"?"schema":ku[Ht.bump];we.push(` [${Ft}] ${Ht.message}`)}}return we.join(`
|
|
30
|
+
`)}var jt=1;function ke(M){let ee={kind:"check-report",schemaVersion:jt,...M};return Rs(ee)}import{existsSync as Tu}from"node:fs";import{join as Pu}from"node:path";import{pathToFileURL as $u}from"node:url";var Au=["sveld.config.js","sveld.config.mjs","sveld.config.ts"];function Vt(M){return M}function Du(M=process.cwd()){for(let ee of Au){let we=Pu(M,ee);if(Tu(we))return we}return null}async function Z(M){let ee;try{ee=await import(`${$u(M).href}?t=${Date.now()}`)}catch(Je){let Gt=Je instanceof Error?Je.message:String(Je);throw Error(`sveld: failed to load config file "${M}".
|
|
31
|
+
${Gt}`)}let we=ee.default;if(!i(we)||Array.isArray(we))throw Error(`sveld: config file "${M}" must export a configuration object as its default export. Did you forget \`export default defineConfig({ ... })\`?`);return we}async function q(M=process.cwd()){let ee=Du(M);return ee===null?{}:Z(ee)}function I(...M){let ee={};for(let we of M){if(!we)continue;for(let[Je,Gt]of Object.entries(we)){let Wt=ee[Je];ee[Je]=i(Wt)&&!Array.isArray(Wt)&&i(Gt)&&!Array.isArray(Gt)?{...Wt,...Gt}:Gt}}return ee}var Na=["entry","glob","quiet","documentExports","types","typesOptions","json","jsonOptions","markdown","markdownOptions","failFast","watch","config","cache","checkExamples","reportDiagnostics","strict","check","checkLevel","stdout","format","diagnostics"],Nu={typesOptions:["outDir","preamble","format","transform","indexTypes"],jsonOptions:["outFile","outDir","source"],markdownOptions:["outFile","outDir","onAppend"],diagnostics:["ignore"]};function _a(M,ee,we){let Je=M===null?ee:`${M}.${ee}`,Gt=N(ee,we),Wt=Gt===void 0?void 0:M===null?Gt:`${M}.${Gt}`;console.warn(`sveld: unknown option "${Je}".${Wt?` Did you mean "${Wt}"?`:""}`)}function F(M){for(let ee of Object.keys(M))if(!Na.includes(ee))_a(null,ee,Na);for(let[ee,we]of Object.entries(Nu)){let Je=M[ee];if(!i(Je))continue;for(let Gt of Object.keys(Je))if(!we.includes(Gt))_a(ee,Gt,we)}}import{dirname as xc,isAbsolute as ym,resolve as xm}from"node:path";import{lstatSync as Of}from"node:fs";import{readFile as Mf}from"node:fs/promises";import{resolve as Wp}from"node:path";import{dirname as Uh}from"node:path";var _u=" ",Ru=120,Iu=/\binterface\s+[A-Za-z_$][\w$]*(\s*<[^{};]*>)?\s*$/,Lu=200,Oa=/\s/,Ou=/\s{2}|[^\S ]/,Mu=/["'`{}/]/g,Fu=/["'`{};/]/g,Ma=9,xr=10,ju=13,Ls=32,ui=34,Bu=38,hi=39,Vu=40,Gu=41,li=42,Ra=46,Er=47,Fa=59,Wu=62,Uu=91,br=92,Ku=93,di=96,Sr=123,Hu=124,Cr=125;function qu(M){return Iu.test(Xu(M,Lu))}var Ia=[""];function zu(M){let ee=Ia[M];if(ee===void 0)ee=_u.repeat(M),Ia[M]=ee;return ee}function Xu(M,ee){let we="";for(let Je=M.length-1;Je>=0&&we.length<ee;Je--)we=M[Je]+we;return we.length>ee?we.slice(-ee):we}function Ju(M){if(M.length===0)return!1;let ee=M[M.length-1];return ee.charCodeAt(ee.length-1)===xr}function Yu(M){while(M.length>0){let ee=M[M.length-1],we=ee.length;while(we>0){let Je=ee.charCodeAt(we-1);if(Je!==Ls&&Je!==Ma)break;we--}if(we===ee.length)return;if(we===0){M.pop();continue}M[M.length-1]=ee.slice(0,we);return}}function Qu(M){while(M.length>0){let ee=M[M.length-1];if(!Oa.test(ee[ee.length-1]))return;let we=ee.trimEnd();if(we.length===ee.length)return;if(we.length===0){M.pop();continue}M[M.length-1]=we;return}}function Zu(M){if(M.includes("{"))return!1;let ee=0,we=0;for(let Je=0;Je<M.length;Je++){let Gt=M.charCodeAt(Je);if(ee!==0){if(Gt===ee&&M.charCodeAt(Je-1)!==br)ee=0;continue}if(Gt===ui||Gt===hi||Gt===di){ee=Gt;continue}if(Gt===Fa&&++we>=2)return!0}return!1}function eh(M){if(!Ou.test(M))return M.trimEnd();let ee="",we=null,Je=!1;for(let Gt=0;Gt<M.length;Gt++){let Wt=M[Gt],Ht=M[Gt-1];if(we){if(ee+=Wt,we==="double"&&Wt==='"'&&Ht!=="\\"||we==="single"&&Wt==="'"&&Ht!=="\\"||we==="template"&&Wt==="`"&&Ht!=="\\")we=null;Je=!1;continue}if(Wt==='"'||Wt==="'"||Wt==="`"){we=Wt==='"'?"double":Wt==="'"?"single":"template",ee+=Wt,Je=!1;continue}if(Oa.test(Wt)){if(!Je&&ee.length>0)ee+=" ",Je=!0;continue}ee+=Wt,Je=!1}return ee.trimEnd()}function ja(M,ee){let we=M[ee],Je=M.indexOf(we,ee+1);while(Je!==-1&&M.charCodeAt(Je-1)===br)Je=M.indexOf(we,Je+1);return Je}function Ba(M,ee){let we=M.indexOf("*/",ee+1);return we===-1?-1:we+1}function th(M){let ee=new Map,we=[],Je=Mu,Gt=0;while(Gt<M.length){if(Je.lastIndex=Gt,!Je.test(M))break;Gt=Je.lastIndex-1;let Wt=M.charCodeAt(Gt);if(Wt===Er){if(M.charCodeAt(Gt+1)===li){let Ht=Ba(M,Gt);if(Ht===-1)break;Gt=Ht}}else if(Wt===ui||Wt===hi||Wt===di){let Ht=ja(M,Gt);if(Ht===-1)break;Gt=Ht}else if(Wt===Sr)we.push(Gt);else if(Wt===Cr&&we.length>0)ee.set(we.pop(),Gt);Gt++}return ee}function nh(M,ee,we){for(let Je=ee;Je<we;Je++)if(!vr(M.charCodeAt(Je)))return!1;return!0}function vr(M){if(M<=Ls)return M===Ls||M>=Ma&&M<=ju;if(M<160)return!1;return M===160||M===5760||M>=8192&&M<=8202||M===8232||M===8233||M===8239||M===8287||M===12288||M===65279}function Va(M,ee,we,Je){let Gt=[],Wt=Fu,Ht=ee,Ft=ee;while(Ft<we){if(Wt.lastIndex=Ft,!Wt.test(M))break;if(Ft=Wt.lastIndex-1,Ft>=we)break;let Kt=M.charCodeAt(Ft);if(Kt===Er){if(M.charCodeAt(Ft+1)===li){let zt=Ba(M,Ft);if(zt===-1)break;Ft=zt}Ft++;continue}if(Kt===ui||Kt===hi||Kt===di){let zt=ja(M,Ft);if(zt===-1)break;Ft=zt+1;continue}if(Kt===Sr){let zt=Je.get(Ft);if(zt===void 0||zt>=we){Ft++;continue}if(Ht<Ft)Gt.push(M.slice(Ht,Ft));let Xt=Ft+1;if(nh(M,Xt,zt)){Gt.push("{}"),Ft=zt+1,Ht=Ft;continue}let Zt=M.slice(Xt,zt),Qt=M.charCodeAt(Xt)===xr;if(!Qt&&!Zt.includes("/*")&&!Zu(Zt)&&!qu(Gt)){let en=Va(M,Xt,zt,Je),tn=en.trim();if(!tn.includes(`
|
|
32
|
+
`)){let sn=tn.endsWith(";")?tn.slice(0,-1):tn,nn=`{ ${eh(sn)} }`;if(nn.length<=Ru){Gt.push(nn),Ft=zt+1,Ht=Ft;continue}}if(Gt.push("{"),en.charCodeAt(0)!==Fa)Gt.push(`
|
|
33
|
+
`);if(en.length>0)Gt.push(en);Ft=zt,Ht=zt;continue}if(Gt.push("{"),!Qt)Gt.push(`
|
|
34
|
+
`);Ft=Xt,Ht=Xt;continue}if(Kt===Cr){if(Ht<Ft)Gt.push(M.slice(Ht,Ft));if(Yu(Gt),!Ju(Gt))Gt.push(`
|
|
35
|
+
`);Gt.push("}"),Ft++,Ht=Ft;continue}if(Ht<Ft)Gt.push(M.slice(Ht,Ft));if(Qu(Gt),Gt.push(";"),M.charCodeAt(Ft+1)!==xr)Gt.push(`
|
|
36
|
+
`);Ft++,Ht=Ft}if(Ht<we)Gt.push(M.slice(Ht,we));return Gt.join("")}function sh(M){if(!M.includes(" "))return M;let ee="",we=0;for(let Je=0;Je<M.length;Je++){let Gt=M.charCodeAt(Je);if(we!==0){if(ee+=M[Je],Gt===we&&M.charCodeAt(Je-1)!==br)we=0;continue}if(Gt===ui||Gt===hi||Gt===di){we=Gt,ee+=M[Je];continue}if(Gt===Ls&&ee.charCodeAt(ee.length-1)===Ls)continue;ee+=M[Je]}return ee}function ih(M){return M===Cr||M===Ku||M===Gu||M===Wu}function rh(M,ee,we){return we-ee>=3&&M.charCodeAt(ee)===Er&&M.charCodeAt(ee+1)===li&&M.charCodeAt(ee+2)===li}function La(M,ee,we){let Je=M.indexOf("*/",ee);return Je!==-1&&Je+2<=we}function oh(M,ee,we){let Je=M.charCodeAt(ee);if(Je===Hu||Je===Bu)return!0;return Je===Ra&&ee+1<we&&M.charCodeAt(ee+1)!==Ra}function ah(M){let ee=[],we=[],Je=M.length,Gt=0,Wt=!1,Ht=0,Ft=0;while(Ft<=Je){let Xt=M.indexOf(`
|
|
37
|
+
`,Ft);if(Xt===-1)Xt=Je;let Zt=Xt+1,Qt=Ft,en=Xt;while(Qt<en&&vr(M.charCodeAt(Qt)))Qt++;while(en>Qt&&vr(M.charCodeAt(en-1)))en--;if(Qt===en){let un=we.length>0?we[we.length-1]:void 0;if(un!==void 0&&un!==""){let dn=un.charCodeAt(un.length-1);if(dn!==Sr&&dn!==Vu&&dn!==Uu)ee.push(0),we.push("")}Ft=Zt;continue}if(Wt){if(ee.push(Ht),we.push(` ${M.slice(Qt,en)}`),La(M,Qt,en))Wt=!1;Ft=Zt;continue}let tn=rh(M,Qt,en),sn=tn&&La(M,Qt,en);if(tn&&!sn){ee.push(Gt),we.push(M.slice(Qt,en)),Wt=!0,Ht=Gt,Ft=Zt;continue}let nn=ih(M.charCodeAt(Qt)),an=Math.max(0,Gt-(nn?1:0))+(oh(M,Qt,en)?1:0);if(nn&&an===0&&we.length>0&&we[we.length-1]==="")ee.pop(),we.pop();if(ee.push(an),we.push(sh(M.slice(Qt,en))),Ft=Zt,sn)continue;Gt=us(M,void 0,Qt,en,Gt)}let Kt=we.length;while(Kt>0&&we[Kt-1]==="")Kt--;let zt=[];for(let Xt=0;Xt<Kt;Xt++){if(Xt>0)zt.push(`
|
|
38
|
+
`);let Zt=ee[Xt];if(Zt>0)zt.push(zu(Zt));zt.push(we[Xt])}return zt.join("")}function Ga(M){return`${ah(Va(M,0,M.length,th(M)))}
|
|
39
|
+
`}var Ln="any",On="",ph="Record<string, any>",Os="Record<string, never>",za=/^[A-Za-z_$][A-Za-z0-9_$]*$/,ch=/CustomEvent/,lh=/^[A-Z]/,uh=/\n/,Xa=/=>/,hh=/(?:^|\n)@default\b/,kr=/\n/g,dh=/^([ \t]*\*) +$/gm,fh=/\s+/g,ys=/(^|[^.\w])Snippet(?:\s*<|\b)/,mh=/import\s+type\s+[^;]*\bSnippet\b[^;]*from\s+"svelte";/,gh=/^const\s+/,yh=/^export /,xh=/[^\w$]/g;function Ja(M){return M.replace(gh,"")}function vh(M){if(!M)return;return M.replace(kr,`
|
|
40
|
+
* `)}function Tr(M){if(!M)return"";return`/** ${S(M)} */`}function Pr(M){if(!M)return"";return`/**
|
|
41
|
+
* ${S(M).replace(kr,`
|
|
42
|
+
* `)}
|
|
43
|
+
*/`}function Ya(M){return M?.includes(`
|
|
44
|
+
`)?Pr(M):Tr(M)}function Qa(M){if(M===void 0)return;return M===!0?"@deprecated":`@deprecated ${M}`}function Eh(M){let ee=Qa(M);if(ee===void 0)return;return`* ${ee.replace(kr,`
|
|
45
|
+
* `)}
|
|
46
|
+
`}function bh(M,ee){if(!ee)return[`@${M}`];if(!ee.includes(`
|
|
47
|
+
`))return[`@${M} ${ee}`];return[`@${M}`,...ee.split(`
|
|
48
|
+
`)]}function $r(M){let ee=[];for(let{name:we,body:Je}of M??[])ee.push(...bh(we,Je));return ee}function Ar(M,ee,we){let Je=Qa(we),Gt=$r(ee);if(!(Gt.length>0)&&!Je)return Ya(M);let Ht=[];if(M)Ht.push(...M.split(`
|
|
49
|
+
`));if(Ht.push(...Gt),Je)Ht.push(...Je.split(`
|
|
50
|
+
`));return`/**
|
|
51
|
+
* ${S(Ht.join(`
|
|
52
|
+
* `))}
|
|
53
|
+
*/`}function Sh(M){let ee=$r(M);if(ee.length===0)return"";return ee.map((we)=>`* ${we}
|
|
54
|
+
`).join("")}function fi(M){if(M===void 0)return Ln;return`${M}
|
|
55
|
+
`}function mi(M){if(M.typedefs.length===0)return On;return M.typedefs.map((ee)=>{let we,Je=$r(ee.tags);if(Je.length===0)we=ee.description?`${Pr(ee.description)}
|
|
56
|
+
`:"";else{let Gt=ee.description?[...ee.description.split(`
|
|
57
|
+
`),...Je]:Je;we=`/**
|
|
58
|
+
* ${S(Gt.join(`
|
|
59
|
+
* `))}
|
|
60
|
+
*/
|
|
61
|
+
`}return`${we}export ${ee.ts}`.replace(dh,"$1")}).join(`
|
|
62
|
+
|
|
63
|
+
`)}var Wa=new Map;function Ch(M,ee){let we=Wa.get(ee);if(we===void 0)we=new RegExp(`\\b${Q(ee)}\\b`),Wa.set(ee,we);return we.test(M)}var Ua,Ka=[];function Za(M){if(M!==Ua)Ua=M,Ka=s(M,",");return Ka}function wh(M){if(M===null)return[];return M[0].split(",").map((ee,we)=>({name:ee.trim(),constraint:(Za(M[1]??"")[we]??ee).trim()}))}function ep(M,ee){let we=wh(M).filter(({name:Je})=>Ch(ee,Je));if(we.length===0)return{declSuffix:On,refSuffix:On};return{declSuffix:`<${we.map(({constraint:Je})=>Ja(Je)).join(", ")}>`,refSuffix:`<${we.map(({name:Je})=>Je).join(", ")}>`}}function tp(M){if(!M.contexts||M.contexts.length===0)return On;return M.contexts.map((ee)=>{let we=ee.properties.map((Ht)=>{let Ft=Ht.description?`${Tr(Ht.description)}
|
|
64
|
+
`:"",Kt=Ht.optional?"?":"";return`${Ft}${Ht.name}${Kt}: ${Ht.type};`}).join(`
|
|
65
|
+
`),Je=ee.description?`${Pr(ee.description)}
|
|
66
|
+
`:"",{declSuffix:Gt}=ep(M.generics,[ee.type??"",...ee.properties.map((Ht)=>Ht.type)].join(`
|
|
67
|
+
`));if(ee.type!==void 0)return`${Je}export type ${ee.typeName}${Gt} = ${ee.type};`;if(ee.properties.length===0)return`${Je}export type ${ee.typeName} = ${ee.hasUnresolvedSpread?"Record<string, any>":Os};`;let Wt=ee.hasUnresolvedSpread?" & Record<string, any>":"";return`${Je}export type ${ee.typeName}${Gt} = {
|
|
68
|
+
${we}
|
|
69
|
+
}${Wt};`}).join(`
|
|
70
|
+
|
|
71
|
+
`)}function Mn(M){return za.test(M)?M:JSON.stringify(M)}function np(M,ee){if(!M)return;return`* ${ee||M}
|
|
72
|
+
`}function xs(M,ee,we){return[np(vh(M)),Eh(ee),Sh(we)].filter(Boolean).join("")}function ns(M){return M.length>0?`/**
|
|
73
|
+
${S(M)}*/`:On}function Ha(M,ee){let we=Ar(ee.description,ee.tags,ee.deprecated),Je=we?`${we}
|
|
74
|
+
`:"",Gt=!ee.slot_props||ee.slot_props===Os?"[]":Th(ee.slot_props),Wt=Gt==="[]"?"(this: void) => void":`(this: void, ...args: ${Gt}) => void`;return`
|
|
75
|
+
${Je}${M}?: ${Wt};`}function kh(M){let ee=M.props.filter((Qt)=>!Qt.isFunctionDeclaration&&Qt.kind!=="const"),we=new Set([...ee.map((Qt)=>Qt.name),...Array.from(M.canonicalPropNames??[])]),Gt=(M.canonicalPropsType?ee.filter((Qt)=>!M.canonicalPropNames?.has(Qt.name)):ee).map((Qt)=>{let en=typeof Qt.value==="string"?Qt.value.replace(fh," "):Qt.value,tn=hh.test(Qt.description??"")||Qt.value===void 0||Qt.value==="undefined",sn=[xs(Qt.description,Qt.deprecated,Qt.tags),np(Qt.constant,"@constant"),tn?null:`* @default ${en}
|
|
76
|
+
`].filter(Boolean).join(""),nn=Qt.constant&&!Qt.isFunction?Qt.value:Qt.type||Ln;return`
|
|
77
|
+
${ns(sn)}
|
|
78
|
+
${Mn(Qt.name)}${Qt.isRequired?"":"?"}: ${nn};`});for(let Qt of M.slots)if(!Qt.default&&Qt.name!=null&&!we.has(Qt.name))Gt.push(Ha(Mn(Qt.name),Qt));let Wt=M.slots.find((Qt)=>Qt.default||Qt.name===null);if(Wt&&!we.has("children"))Gt.push(Ha("children",Wt));let Ht=Gt.join(`
|
|
79
|
+
`),Ft=vs(M.moduleName),Kt=M.generics?`<${Za(M.generics[1]).map((Qt)=>Ja(Qt.trim())).join(", ")}>`:"",zt=M.generics?`<${M.generics[0]}>`:"",Xt=M.extends===void 0?"":`Omit<${M.extends.interface}, keyof $Props${zt}> & `;if(M.rest_props?.type==="Element"){let{name:Qt,thisValue:en,description:tn}=M.rest_props,sn;if(Qt!=="svelte:element")sn=Qt.split("|").map((fn)=>`SvelteHTMLElements["${fn.trim()}"]`).join(" & ");else if(en)sn=`SvelteHTMLElements["${en}"]`;else sn="HTMLAttributes<HTMLElement>";let nn="[key: `data-${string}`]: unknown;",an=tn?`${Ya(tn)}
|
|
80
|
+
`:"",un=M.canonicalPropsType?`type $Props${Kt} = (${M.canonicalPropsType}) & {${Ht}
|
|
81
|
+
|
|
82
|
+
${nn}
|
|
83
|
+
};`:`type $Props${Kt} = {
|
|
84
|
+
${Ht}
|
|
85
|
+
|
|
86
|
+
${nn}
|
|
87
|
+
};`,dn=M.extends===void 0?`keyof $Props${zt}`:`keyof ($Props${zt} & ${M.extends.interface})`;return{props_name:Ft,prop_def:`
|
|
88
|
+
${an}type $RestProps = ${sn};
|
|
89
|
+
|
|
90
|
+
${un}
|
|
91
|
+
|
|
92
|
+
export type ${Ft}${Kt} = Omit<$RestProps, ${dn}> & ${Xt}$Props${zt};
|
|
93
|
+
`}}let Zt;if(M.canonicalPropsType)Zt=`
|
|
94
|
+
${`
|
|
95
|
+
type $Props${Kt} = ${M.canonicalPropsType}${Ht.trim()===""?"":` & {${Ht}
|
|
96
|
+
}`};
|
|
97
|
+
`}
|
|
98
|
+
export type ${Ft}${Kt} = ${Xt}$Props${zt};
|
|
99
|
+
`;else if(M.extends===void 0)Zt=Ht.trim()===""?`
|
|
100
|
+
export type ${Ft}${Kt} = ${Os};
|
|
101
|
+
`:`
|
|
102
|
+
export type ${Ft}${Kt} = {
|
|
103
|
+
${Ht}
|
|
104
|
+
};
|
|
105
|
+
`;else Zt=`
|
|
106
|
+
type $Props${Kt} = {
|
|
107
|
+
${Ht}
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
export type ${Ft}${Kt} = ${Xt}$Props${zt};
|
|
111
|
+
`;return{props_name:Ft,prop_def:Zt}}function Th(M){return ji(M)?M:`[${M}]`}function Ph(M){let ee=M.slots.filter((Je)=>!ji(Je.slot_props??""));if(ee.length===0)return Os;let we=ee.map(({name:Je,slot_props:Gt,...Wt})=>{let Ht=Wt.default||Je===null?"default":Mn(Je??""),Ft=Ar(Wt.description,Wt.tags,Wt.deprecated);return`${Ft?`${Ft}
|
|
112
|
+
`:""}${Ht}: ${fi(Gt)};`}).join(`
|
|
113
|
+
`);return ee.length===1?`{${we}}`:`{
|
|
114
|
+
${we}
|
|
115
|
+
}`}var $h=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 wr(M=Ln){if(ch.test(M))return M;return`CustomEvent<${M}>`}function Ah(M){switch(M.type){case"dispatched":return wr(M.detail);case"forwarded":{let ee=M.element,Je=!(ee&&lh.test(ee))||$h.has(M.name),Gt=M.detail!==void 0&&M.detail!=="undefined"&&!(M.detail==="null"&&Je),Wt=M.detail==="null"&&!Je;if(Gt||Wt)return wr(M.detail);return Je?`WindowEventMap["${M.name}"]`:wr()}default:return M}}function qa(M){if(M.events.length===0)return ph;let ee=M.events.map((we)=>{let Je=Ar(we.description,we.tags,we.deprecated);return`${Je?`${Je}
|
|
116
|
+
`:""}${Mn(we.name)}: ${Ah(we)};
|
|
117
|
+
`}).join("");return M.events.length===1?`{${ee}}`:`{
|
|
118
|
+
${ee}}`}function Dh(M){let ee=M.type==="() => any";if(M.type&&Xa.test(M.type)&&!ee)return M.type;if(M.params&&M.params.length>0)return`(${y(M.params)}) => ${M.returnType||Ln}`;if(M.returnType)return`() => ${M.returnType}`;return M.type||Ln}function sp(M){return M.props.filter((ee)=>ee.isFunctionDeclaration||ee.kind==="const").map((ee)=>{let we=xs(ee.description,ee.deprecated,ee.tags);return`
|
|
119
|
+
${ns(we)}
|
|
120
|
+
${Mn(ee.name)}: ${Dh(ee)};`}).join(`
|
|
121
|
+
`)}function Nh(M){let ee=Ms(M.moduleName),we=sp({props:M.props});if(we.trim()==="")return{exports_name:ee,exports_ref:ee,exports_def:`export type ${ee} = ${Os};`};let{declSuffix:Je,refSuffix:Gt}=ep(M.generics,we);return{exports_name:ee,exports_ref:`${ee}${Gt}`,exports_def:`export type ${ee}${Je} = {${we}
|
|
122
|
+
};`}}function _h(M){return M.props.filter((ee)=>ee.bindable===!0||ee.binding==="writable").map((ee)=>JSON.stringify(ee.name)).join(" | ")}function ip(M){return M==="default"?"$$Component":M}function Rh(M){let ee=ip(M.moduleName),we=M.bindings===On?'""':M.bindings;return`declare const ${ee}: Component<
|
|
123
|
+
${M.propsRef},
|
|
124
|
+
${M.exportsRef},
|
|
125
|
+
${we}
|
|
126
|
+
>;
|
|
127
|
+
export default ${ee};`}function Ih(M){let ee=ip(M.moduleName),we=`${ee}Component`,Je=M.bindings===On?'""':M.bindings,Gt=M.eventsRef?`$on?<K extends keyof ${M.eventsRef} & string>(type: K, callback: (e: ${M.eventsRef}[K]) => void): () => void;`:"$on?(type: string, callback: (e: any) => void): () => void;";return`interface ${we} {
|
|
128
|
+
new ${M.generic}(
|
|
129
|
+
options: ComponentConstructorOptions<${M.propsRef}>
|
|
130
|
+
): SvelteComponent<${M.propsRef}${M.eventsRef?`, ${M.eventsRef}`:""}> & ${M.exportsRef};
|
|
131
|
+
${M.generic}(
|
|
132
|
+
this: void,
|
|
133
|
+
internals: ComponentInternals,
|
|
134
|
+
props: ${M.propsRef}
|
|
135
|
+
): {
|
|
136
|
+
${Gt}
|
|
137
|
+
$set?(props: Partial<${M.propsRef}>): void;
|
|
138
|
+
} & ${M.exportsRef};
|
|
139
|
+
element?: typeof HTMLElement;
|
|
140
|
+
z_$$bindings?: ${Je};
|
|
141
|
+
}
|
|
142
|
+
declare const ${ee}: ${we};
|
|
143
|
+
export default ${ee};`}function Lh(M){if(M.extends===void 0)return"";return`import type { ${M.extends.interface} } from ${M.extends.import};`}function Oh(M){if(!M.componentComment)return"";if(!uh.test(M.componentComment))return Tr(M.componentComment.trim());return`/*${S(M.componentComment).split(`
|
|
144
|
+
`).map((ee)=>`* ${ee}`).join(`
|
|
145
|
+
`)}
|
|
146
|
+
*/`}function Mh(M){let ee=[],we=new Map;for(let Je of M.moduleExports){if(Je.kind!=="re-export"||!Je.reExport)continue;let{from:Gt,imported:Wt}=Je.reExport,Ht=xs(Je.description,Je.deprecated,Je.tags),Ft=Mn(Je.name);if(Wt==="*"){let Xt=Je.name==="*"?"*":`* as ${Ft}`;ee.push(`${ns(Ht)}
|
|
147
|
+
export ${Xt} from ${JSON.stringify(Gt)};`);continue}let Kt=`${Gt}\x00${Ht}`,zt=we.get(Kt);if(!zt)zt={comments:Ht,from:Gt,specifiers:[]},we.set(Kt,zt),ee.push(Kt);zt.specifiers.push(Wt===Je.name?Ft:`${Mn(Wt)} as ${Ft}`)}return ee.map((Je)=>{let Gt=we.get(Je);if(!Gt)return Je;return`${ns(Gt.comments)}
|
|
148
|
+
export { ${Gt.specifiers.join(", ")} } from ${JSON.stringify(Gt.from)};`}).join(`
|
|
149
|
+
|
|
150
|
+
`)}function Dr(M){let ee=[M.static?"static ":"",M.abstract?"abstract ":"",M.readonly?"readonly ":""].join(""),we=M.optional?"?":"";if(M.kind==="property")return`${ee}${Mn(M.name)}${we}: ${M.type??Ln}`;let Je=y(M.params??[]);if(M.kind==="constructor")return`constructor(${Je})`;let Gt=M.typeParameters?`<${M.typeParameters}>`:"";return`${ee}${Mn(M.name)}${we}${Gt}(${Je}): ${M.returnType??Ln}`}function Fh(M,ee){let we=M.localName??M.name,Je=we!==M.name,Gt=`export { ${we}${Je?` as ${Mn(M.name)}`:""} };`;if(ee.has(we))return Gt;ee.add(we);let Wt=M.typeParameters?`<${M.typeParameters}>`:"",Ht=(M.members??[]).map((Xt)=>[ns(xs(Xt.description,Xt.deprecated,Xt.tags)),`${Dr(Xt)};`].filter(Boolean).join(`
|
|
151
|
+
`)).join(`
|
|
152
|
+
|
|
153
|
+
`),Ft=`${M.extends?` extends ${M.extends}`:""}${M.implements?.length?` implements ${M.implements.join(", ")}`:""}`,Kt=`${Je?"":"export "}declare ${M.abstract?"abstract ":""}class ${we}${Wt}${Ft}`;return`
|
|
154
|
+
${[ns(xs(M.description,M.deprecated,M.tags)),Ht?`${Kt} {
|
|
155
|
+
${Ht}
|
|
156
|
+
}`:`${Kt} {}`,Je?Gt:""].filter(Boolean).join(`
|
|
157
|
+
`)}`}function jh(M){let ee=Mh(M),we=new Set,Je=M.moduleExports.filter((Gt)=>Gt.kind!=="re-export").map((Gt)=>{if(Gt.kind==="class")return Fh(Gt,we);let Wt=!za.test(Gt.name),Ht=Wt?{...Gt,name:Bh(Gt.name)}:Gt,Ft=xs(Ht.description,Ht.deprecated,Ht.tags),Kt,zt=Ht.type!==void 0&&Xa.test(Ht.type),Xt=Ht.typeParameters?`<${Ht.typeParameters}>`:"";if(Ht.kind==="const"&&!zt)Kt=`export declare const ${Ht.name}: ${Ht.type||Ln};
|
|
158
|
+
`;else if(Ht.params&&Ht.params.length>0)Kt=`export declare function ${Ht.name}${Xt}(${y(Ht.params)}): ${Ht.returnType||Ln};`;else if(Ht.returnType)Kt=`export declare function ${Ht.name}${Xt}(): ${Ht.returnType};`;else if(zt&&Ht.type){let[Zt,Qt,...en]=Ht.type.split("=>"),tn=en.map((sn)=>` => ${sn.trim()}`).join("");Kt=`export declare function ${Ht.name}${Zt.trimEnd()}: ${Qt.trim()}${tn};`}else Kt=`export declare let ${Ht.name}: ${Ht.type||Ln};`;if(Wt)Kt=`${Kt.replace(yh,"").trimEnd()}
|
|
159
|
+
export { ${Ht.name} as ${JSON.stringify(Gt.name)} };`;return`
|
|
160
|
+
${ns(Ft)}
|
|
161
|
+
${Kt}`}).join(`
|
|
162
|
+
`);return[ee,Je].filter(Boolean).join(`
|
|
163
|
+
|
|
164
|
+
`)}function Bh(M){return`__export_${M.replace(xh,"_")}`}var Vh=120;function Gh(M){let we=`export default class ${M.moduleName==="default"?"":M.moduleName}${M.generic} extends SvelteComponentTyped<`,Je=[M.genericProps,M.events,M.slots];if(M.accessors.trim()===""&&Je.every((Gt)=>!Gt.includes(`
|
|
165
|
+
`))){let Gt=`${we}${Je.join(", ")}> {}`;if(Gt.length<=Vh)return Gt}return`${we}
|
|
166
|
+
${M.genericProps},
|
|
167
|
+
${M.events},
|
|
168
|
+
${M.slots}
|
|
169
|
+
> {
|
|
170
|
+
${M.accessors}
|
|
171
|
+
}`}function vs(M){return`${M}Props`}function Ms(M){return`${M}Exports`}function Nr(M){return{format:M.format}}var Wh={format:"class"};function rp(M){let ee=Nr(M??{}),we={};for(let[Je,Gt]of Object.entries(ee))we[Je]=Gt??Wh[Je];return JSON.stringify(we)}function _r(M,ee){let we=ko(M),{moduleName:Je,typedefs:Gt,generics:Wt,props:Ht,moduleExports:Ft,slots:Kt,events:zt,rest_props:Xt,extends:Zt,componentComment:Qt,contexts:en}=M,tn=ee?.format==="component",sn=Wt!==null,{props_name:nn,prop_def:an}=kh({moduleName:Je,props:Ht,rest_props:Xt,extends:Zt,generics:Wt,slots:Kt,canonicalPropNames:new Set(we?.canonicalPropNames??[]),canonicalPropsType:we?.canonicalPropsType}),un=Wt?`<${Wt[1]}>`:"",dn=Wt?`${nn}<${Wt[0]}>`:nn,fn=tn&&zt.length>0?`type $Events${un} = ${qa({events:zt})};`:"",vn=Wt?`$Events<${Wt[0]}>`:"$Events",Jn=tn&&(sn||fn!==""),Ss=jh({moduleExports:Ft}),wn=mi({typedefs:Gt}),as=tp({contexts:en,generics:Wt}),Eo=(we?.typeImportStatements??[]).join(`
|
|
172
|
+
`),bo=[...we?.localTypeDeclarations??[],...we?.moduleTypeDeclarations??[]].join(`
|
|
173
|
+
|
|
174
|
+
`),{exports_ref:So,exports_def:Co}=tn?Nh({props:Ht,moduleName:Je,generics:Wt}):{exports_ref:On,exports_def:On},wo=tn?_h({props:Ht}):On,Ri=!mh.test(Eo)&&(ys.test(an)||ys.test(Ss)||ys.test(wn)||ys.test(as)||ys.test(bo)||ys.test(Co)),vc=Xt?.type==="Element"&&(Xt.name!=="svelte:element"||Xt.thisValue),Ec=Xt?.type==="Element"&&Xt.name==="svelte:element"&&!Xt.thisValue,bc=[tn?Jn?`import type { SvelteComponent, ComponentConstructorOptions, ComponentInternals${Ri?", Snippet":""} } from "svelte";`:`import type { Component${Ri?", Snippet":""} } from "svelte";`:`import { SvelteComponentTyped${Ri?", type Snippet":""} } from "svelte";`,vc?'import type { SvelteHTMLElements } from "svelte/elements";':"",Ec?'import type { HTMLAttributes } from "svelte/elements";':"",Eo,Lh({extends:Zt})].filter(Boolean).join(`
|
|
175
|
+
`),Sc=tn?Jn?Ih({moduleName:Je,generic:un,propsRef:dn,exportsRef:So,bindings:wo,...fn?{eventsRef:vn}:{}}):Rh({moduleName:Je,propsRef:dn,exportsRef:So,bindings:wo}):Gh({moduleName:Je,generic:un,genericProps:dn,events:qa({events:zt}),slots:Ph({slots:Kt}),accessors:sp({props:Ht})}),Cc=[Ss,wn,bo,as,an,Co,fn,[Oh({componentComment:Qt}),Sc].filter(Boolean).join(`
|
|
176
|
+
`)].map((wc)=>wc.trim()).filter(Boolean).join(`
|
|
177
|
+
|
|
178
|
+
`);return Ga([bc,Cc].filter(Boolean).join(`
|
|
179
|
+
|
|
180
|
+
`))}var Kh=[...ms,".svelte"];function Hh(M){let ee=M.trim();if(ee.length<2)return;let we=ee[0],Je=ee[ee.length-1];if((we==='"'||we==="'"||we==="`")&&we===Je)return ee.slice(1,-1);return}function op(M){let ee=[],we=M.moduleExports.filter((Gt)=>Gt.kind==="re-export");if(we.length===0)return ee;let Je=new Set([vs(M.moduleName),Ms(M.moduleName)]);for(let Gt of we){if(!Je.has(Gt.name))continue;ee.push(o({component:M.filePath,kind:"module-export-conflict",name:Gt.name,message:`Re-export "${Gt.name}" has the same name as the generated "${Gt.name}" type; the .d.ts won't type-check if "${Gt.reExport?.from}" exports a type by that name.`,source:Gt.source}))}return ee}function ap(M,ee,we){let Je=new Map(Array.from(M.values()).map((Gt)=>[ee(Gt.filePath),Gt]));return(Gt)=>{let Wt=Gt.extends;if(!Wt)return[];let Ht=Hh(Wt.import);if(Ht===void 0||!Ht.startsWith(".")&&!Ht.startsWith("/"))return[];let Ft=ee(Gt.filePath),Kt=we.resolve(Ht,Uh(Ft),Kh);if(Kt===null)return[o({component:Gt.filePath,kind:"extend-props-target-missing",name:Wt.interface,message:`@extends/@extendProps target "${Ht}" was not found on disk.`})];let zt=Je.get(Kt);if(!zt)return[];let Xt=vs(zt.moduleName);if(Wt.interface!==Xt)return[o({component:Gt.filePath,kind:"extend-props-target-missing",name:Wt.interface,message:`@extends/@extendProps names "${Wt.interface}", but "${Ht}" generates "${Xt}".`})];let Zt=[];for(let Qt of Gt.props){let en=zt.props.find((tn)=>tn.name===Qt.name);if(en&&en.type!==Qt.type)Zt.push(o({component:Gt.filePath,kind:"extend-props-override",name:Qt.name,message:`Own prop "${Qt.name}" (${Qt.type}) overrides "${Xt}"'s "${Qt.name}" (${en.type}).`}))}return Zt}}import{lstatSync as yd,readFileSync as xd,realpathSync as vd,statSync as Ed}from"node:fs";import{dirname as bd,isAbsolute as Sd,join as Ep,parse as Cd,relative as Vr,resolve as vi}from"node:path";function K(M){return M}function Hn(M){if(M==="")return M;return M.startsWith(".")?M:`./${M}`}import{readFileSync as xp}from"node:fs";import{dirname as jr,join as md,relative as mp,resolve as gp}from"node:path";import{readFileSync as od,statSync as ad}from"node:fs";import{basename as Fr,dirname as xi,isAbsolute as pd,join as cd,resolve as ld}from"node:path";import{existsSync as qh,readdirSync as zh}from"node:fs";import{join as Xh}from"node:path";function pp(M){return M.normalize("NFC").toLowerCase()}class Rr{listings=new Map;clear(){this.listings.clear()}entries(M){return this.read(M)?.entries??null}entry(M,ee){let we=this.read(M);if(we===null)return;if(we.byName===void 0){we.byName=new Map;for(let Je of we.entries)we.byName.set(Je.name,Je)}return we.byName.get(ee)}has(M,ee){let we=this.read(M);if(we===null)return!1;if(we.names.has(ee))return!0;if(we.folded===void 0){we.folded=new Map;for(let Gt of we.names)we.folded.set(pp(Gt),Gt)}let Je=we.folded.get(pp(ee));return Je!==void 0&&Je!==ee&&qh(Xh(M,ee))}read(M){let ee=this.listings.get(M);if(ee!==void 0)return ee;try{let we=zh(M,{withFileTypes:!0}),Je=new Set;for(let Gt of we)Je.add(Gt.name);ee={entries:we,names:Je}}catch{ee=null}return this.listings.set(M,ee),ee}}var Ir=!1;function V(M){Ir=M}function Vn(M){if(!Ir)console.error(M)}function cp(M){if(!Ir)console.error(M)}function be(M){if(M instanceof e)return M.start?`${M.reason} (${M.start.line}:${M.start.column})`:M.reason;return M instanceof Error?M.message:String(M)}var Fs=null,Lr=null;function qn(){if(Fs)return Promise.resolve(Fs);if(!Lr)Lr=import("./chunk-asxze8b8.js").then((M)=>(Fs=M,M));return Lr}function Nn(){if(!Fs)throw Error("sveld: internal error, parser stack read before loadParserStack() resolved.");return Fs}import{existsSync as gi,readFileSync as Jh}from"node:fs";import{dirname as Or,isAbsolute as Yh,join as Qh,relative as Zh,resolve as yi}from"node:path";function lp(M){if(!i(M))return{};let ee={};if(typeof M.svelte==="string")ee.svelte=M.svelte;if(typeof M.name==="string")ee.name=M.name;if(typeof M.description==="string")ee.description=M.description;return ee}function up(M){if(!i(M))return{};let ee={};if(typeof M.extends==="string")ee.extends=M.extends;if(i(M.compilerOptions)){let we={};if(typeof M.compilerOptions.baseUrl==="string")we.baseUrl=M.compilerOptions.baseUrl;if(i(M.compilerOptions.paths)){let Je={};for(let[Gt,Wt]of Object.entries(M.compilerOptions.paths))if(Array.isArray(Wt)&&Wt.every((Ht)=>typeof Ht==="string"))Je[Gt]=Wt;if(Object.keys(Je).length>0)we.paths=Je}if(Object.keys(we).length>0)ee.compilerOptions=we}return ee}var hp=new Map,ed=/\/\*[\s\S]*?\*\/|\/\/.*/g,td=/[.+?^${}()|[\]\\]/g,nd=[".svelte",...ms];class U extends Error{specifier;fromFile;searched;constructor(M,ee,we){super(`cannot resolve "${M}" from ${ee||"."} (${we})`);this.name="UnresolvedModuleError",this.specifier=M,this.fromFile=ee,this.searched=we}}function sd(M){if(gi(M))return!0;return nd.some((ee)=>gi(M+ee))}function dp(M){let ee=M.indexOf("*");return ee===-1?M.length:ee}function id(M){let ee=M,we=yi(ee,"/");while(ee!==we){for(let Je of["tsconfig.json","jsconfig.json"]){let Gt=Qh(ee,Je);if(gi(Gt))return Gt}ee=Or(ee)}return null}function fp(M,ee){if(ee.has(M))return ee.get(M)??null;try{let we=Jh(M,"utf-8"),Je;try{Je=JSON.parse(we)}catch{let Wt=we.replace(ed,"");Je=JSON.parse(Wt)}let Gt=up(Je);if(Gt.extends){let Wt=Yh(Gt.extends)?Gt.extends:yi(Or(M),Gt.extends),Ht=Wt.endsWith(".json")?Wt:`${Wt}.json`;if(gi(Ht)){let Ft=fp(Ht,ee);if(Ft)Gt.compilerOptions={...Ft.compilerOptions,...Gt.compilerOptions,paths:{...Ft.compilerOptions?.paths,...Gt.compilerOptions?.paths}}}}return ee.set(M,Gt),Gt}catch{return ee.set(M,null),null}}function rd(M){let ee=hp.get(M);if(!ee){let we=M.split("*").map((Je)=>Je.replace(td,"\\$&")).join("(.*)");ee=new RegExp(`^${we}$`),hp.set(M,ee)}return ee}class Mr{configs=new Map;lookup(M,ee){if(M.startsWith(".")||M.startsWith("/"))return{resolved:M,unresolved:!1,searched:""};let we=id(ee),Je=we?fp(we,this.configs)?.compilerOptions:void 0,Gt=Je?.paths;if(!we||!Je||!Gt)return{resolved:M,unresolved:!0,searched:"no tsconfig/jsconfig paths found"};let Wt=yi(Or(we),Je.baseUrl??"."),Ht=Object.entries(Gt).sort(([Ft],[Kt])=>dp(Kt)-dp(Ft));for(let[Ft,Kt]of Ht){let zt=M.match(rd(Ft));if(!zt)continue;let Xt;for(let Zt of Kt){let Qt=Zt;for(let tn=1;tn<zt.length;tn++)Qt=Qt.replace("*",zt[tn]);let en=yi(Wt,Qt);if(Xt??=en,sd(en))return{resolved:en,unresolved:!1,searched:we}}return{resolved:Xt??M,unresolved:!1,searched:we}}return{resolved:M,unresolved:!0,searched:`tsconfig paths (${we})`}}absolute(M,ee){return this.lookup(M,ee).resolved}relative(M,ee){let we=this.absolute(M,ee);if(we===M)return M;let Je=n(Zh(ee,we));return Je.startsWith(".")?Je:`./${Je}`}}var ud=/\.[mc]?jsx?$/,hd={".js":[".ts",".tsx",".d.ts"],".jsx":[".tsx",".d.ts"],".mjs":[".mts",".d.mts"],".cjs":[".cts",".d.cts"]};function dd(M){return M==="."||M===".."||M.startsWith("./")||M.startsWith("../")||pd(M)}class zn{aliases=new Mr;listings=new Rr;modules=new Map;programs=new Map;listDirectory(M){return this.listings.entries(M)}exists(M){return this.listings.has(xi(M),Fr(M))}resolve(M,ee,we=ms){let Je=this.aliases.absolute(M,ee);if(Je===M&&!dd(M))return null;let Gt=ld(ee,Je),Wt=xi(Gt),Ht=Fr(Gt),Ft=this.listings.has(Wt,Ht),Kt;if(Ft){let zt=this.listings.entry(Wt,Ht);if(Kt=zt&&!zt.isSymbolicLink()?zt:ad(Gt,{throwIfNoEntry:!1}),Kt?.isFile())return Gt}for(let zt of we)if(this.listings.has(Wt,Ht+zt))return Gt+zt;if(!Ft)return this.typeScriptCounterpart(Gt)??null;if(Kt?.isDirectory()){for(let zt of we)if(this.listings.has(Gt,`index${zt}`))return cd(Gt,`index${zt}`)}return null}parse(M){let ee=this.modules.get(M);if(ee===void 0)ee=fd(M),this.modules.set(M,ee);return ee}parseJavaScript(M,ee){let we=this.programs.get(M);if(we?.source===ee)return we.ast;let Je;try{Je=ye(ee)}catch(Gt){throw Error(be(Gt))}return this.programs.set(M,{source:ee,ast:Je}),Je}invalidate(...M){this.listings.clear();for(let ee of M)this.modules.delete(ee),this.programs.delete(ee)}typeScriptCounterpart(M){let ee=ud.exec(M)?.[0];if(ee===void 0)return;let we=M.slice(0,-ee.length),Je=xi(we),Gt=Fr(we);for(let Wt of hd[ee]??[])if(this.listings.has(Je,Gt+Wt))return we+Wt;return}}function fd(M){let ee;try{ee=od(M,"utf-8")}catch{return null}try{let we=M.endsWith(".svelte")?Nn().parseSvelteScripts(ee).module?.content.body??[]:Nn().parseModule(ee,{typescript:!0}).body;return{source:{text:ee,filePath:M,dir:xi(M)},body:we}}catch(we){return cp(`Warning: sveld couldn't parse ${M} to read its exports (${be(we)}); skipping it.`),null}}function yp(M){return M.type==="Identifier"?M.name:M.value}function gd(M,ee,we,Je){let Gt=M.resolve(ee,we);if(!Gt)return null;let Wt=jr(Gt);if(Je.has(Gt))return{dir:Wt,exports:{}};Je.add(Gt);try{return{dir:Wt,exports:Br(M,xp(Gt,"utf-8"),Wt,Je,Gt)}}catch{return{dir:Wt,exports:{}}}finally{Je.delete(Gt)}}function vp(M,ee,we=new zn,Je=new Set){return Br(we,M,ee,Je,ee)}function Br(M,ee,we,Je,Gt){let Wt=M.parseJavaScript(Gt,ee),Ht={};for(let Ft of Wt.body)if(Ft.type==="ExportDefaultDeclaration"){if(Ft.declaration.type!=="Identifier")continue;let Kt=Ft.declaration.name;if(Kt in Ht)Ht[Kt].default=!0;else Ht[Kt]={source:Hn(""),default:!0}}else if(Ft.type==="ExportAllDeclaration"){let Kt=Ft.source.value,zt=M.resolve(Kt,we);if(!zt){let Qt=M.aliases.lookup(Kt,we);throw new U(Kt,Gt,Qt.unresolved?Qt.searched:"no matching file or index found")}if(Je.has(zt))continue;Je.add(zt);let Xt=xp(zt,"utf-8"),Zt=Br(M,Xt,jr(zt),Je,zt);Je.delete(zt);for(let[Qt,en]of Object.entries(Zt)){let tn=Hn(n(en.source.startsWith(".")?`./${mp(we,gp(jr(zt),en.source))}`:`./${md(Kt,en.source)}`));Ht[Qt]={...en,source:tn}}}else if(Ft.type==="ExportNamedDeclaration"){let Kt=Ft.source?.value,zt=Kt!==void 0&&In.test(Kt);if(zt){let Qt=M.aliases.lookup(Kt,we);if(Qt.unresolved)throw new U(Kt,Gt,Qt.searched)}let Zt=Kt!==void 0&&!zt?gd(M,Kt,we,Je):void 0;if(Zt===null){console.warn(`sveld: could not resolve re-exported module "${Kt}" from barrel "${we||"."}"; skipping.`);continue}for(let Qt of Ft.specifiers){let en=yp(Qt.exported),tn=yp(Qt.local),sn=en||tn,nn=Zt?.exports[tn],an=nn?Hn(n(`./${mp(we,gp(Zt.dir,nn.source))}`)):Hn(M.aliases.relative(Kt??"",we)),un=nn?nn.default:tn==="default";if(sn in Ht){if(Ht[sn].mixed=!0,!Ht[sn].source)Ht[sn].source=an}else Ht[sn]={source:an,default:un}}}else if(Ft.type==="ImportDeclaration"){let Kt=Ft.specifiers[0];if(!Kt)continue;let zt=Kt.local.name,Xt=Hn(M.aliases.relative(Ft.source.value,we));if(zt in Ht){if(!Ht[zt].source)Ht[zt].source=Xt}else Ht[zt]={source:Xt,default:zt==="default"}}return Ht}var wd=/-/g,kd=/[^A-Za-z0-9_$]/g,Td=/^[0-9]/;function Pd(M,ee){let we=M.replace(kd,""),Je=Td.test(we)?`_${we}`:we;if(Je!==M&&!ee?.has(M))ee?.add(M),console.warn(`Warning: "${M}" is not a valid identifier; using "${Je}" instead.`);return Je}function bp(M,ee){return Pd(Cd(M).name.replace(wd,""),ee)}function Sp(M,ee,we=[],Je=new Set,Gt){let Wt;try{Wt=Gt??vd(ee)}catch{return we}if(Je.has(Wt))return we;Je.add(Wt);let Ht=M.listDirectory(ee);if(Ht===null)return we;for(let Ft of Ht){if(Ft.name.startsWith("."))continue;let Kt=Ep(ee,Ft.name),zt=Ft.isSymbolicLink(),Xt=zt?Ed(Kt,{throwIfNoEntry:!1}):Ft;if(!Xt)continue;if(Xt.isDirectory())Sp(M,Kt,we,Je,zt?void 0:Ep(Wt,Ft.name));else if(Xt.isFile()&&Ft.name.endsWith(".svelte"))we.push(Kt)}return we}function $d(M,ee){return Sp(M,ee).map((we)=>({moduleName:bp(we),source:Hn(n(`./${Vr(ee,we)}`))})).sort((we,Je)=>l(we.source,Je.source))}function Ad(M){return!gs(M)}function Dd(M,ee){let we=M.endsWith("/")?M:`${M}/`;return ee.startsWith(we)}function Ei(M,ee){return{seenPaths:new Set(M.map(([,we])=>ee(we.source))),seenModuleNamePaths:new Map(M.map(([we,Je])=>[we,ee(Je.source)])),warnedModuleNames:new Set}}function Gr(M,ee,we,Je,Gt,Wt){for(let{moduleName:Ht,source:Ft}of $d(M,ee)){let Kt=Gt(Ft),zt=we[Ht];if(zt&&Ad(zt.source)&&Dd(zt.source,Ft)){Wt.seenPaths.delete(Gt(zt.source)),zt.source=Ft,Wt.seenPaths.add(Kt),Wt.seenModuleNamePaths.set(Ht,Kt);continue}if(Wt.seenPaths.has(Kt))continue;Wt.seenPaths.add(Kt);let Xt=Wt.seenModuleNamePaths.get(Ht);if(Xt===void 0)Wt.seenModuleNamePaths.set(Ht,Kt);else if(Xt!==Kt&&!Wt.warnedModuleNames.has(Ht))Wt.warnedModuleNames.add(Ht),console.warn(`Warning: multiple components named "${Ht}" found (${n(Vr(ee,Xt))} and ${n(Vr(ee,Kt))}). Both are included in TypeScript definitions, but only one can be the named export.`);Je.push([Ht,{source:Ft,default:!1}])}}function Wr(M,ee,we,Je){let Gt=yd(M).isFile(),Wt=Gt?bd(M):M,Ht=vi(Wt),Ft=new Map,Kt=(Zt)=>{let Qt=Ft.get(Zt);if(Qt===void 0)Qt=Sd(Zt)?vi(Zt):vi(Ht,Zt),Ft.set(Zt,Qt);return Qt},zt={};if(Gt){let Zt=xd(M,"utf-8");try{zt=vp(Zt,Ht,Je,new Set([vi(M)]))}catch(Qt){if(!we)throw Qt;let en=Qt instanceof Error?Qt.message:String(Qt);console.warn(`Warning: Failed to parse component exports from ${M}: ${en}`)}}let Xt=Object.entries(zt);if(ee){let Zt=Ei(Xt,Kt);if(Gr(Je,Ht,zt,Xt,Kt,Zt),!Gt)zt=Object.fromEntries(Xt.map(([Qt,en])=>[Qt,{...en,default:!0}]))}return{exports:zt,allComponentEntries:Xt,rootDir:Ht,resolveComponentFilePath:Kt}}function Ur(M,ee,we,Je){if(we!==1||M!=="default")return M;return bp(ee,Je)}import{resolve as Nd}from"node:path";var _d=/\r?\n/,Rd=/^\s*\*+/;function bi(M){return{graph:M,cache:new Map,computing:new Set}}function En(M){return M?.type==="Identifier"?M.name:void 0}function Id(M){let ee=M.trimEnd();for(;;){let we=ee.lastIndexOf(`
|
|
181
|
+
`)+1;if(ee.slice(we).trimStart().startsWith("//")){ee=ee.slice(0,we).trimEnd();continue}let Je=ee.endsWith("*/")?ee.lastIndexOf("/*",ee.length-3):-1;if(Je!==-1&&ee[Je+2]!=="*"){ee=ee.slice(0,Je).trimEnd();continue}return ee}}function Ld(M,ee){let we=Id(M.slice(0,ee));if(!we.endsWith("*/"))return;let Je=we.length-2,Gt=we.lastIndexOf("/**",Je);if(Gt===-1)return;return we.slice(Gt,Je+2)}function Od(M){let ee=[];for(let we of M.slice(3,-2).split(_d)){let Je=we.replace(Rd,"").trim();if(Je.startsWith("@"))break;if(Je)ee.push(Je)}return ee.join(" ")||void 0}function ss(M,ee){if(!ee)return;return M.text.slice(ee.start,ee.end)}function Md(M,ee){return"typeAnnotation"in ee?ss(M,ee.typeAnnotation?.typeAnnotation):void 0}function Kr(M,ee){return ss(M,ee.returnType?.typeAnnotation)}function Hr(M,ee){let we=ee.params.map((Gt)=>ss(M,Gt)??"").join(", "),Je=Kr(M,ee);return`(${we})${Je?` => ${Je}`:""}`}function kp(M){if(M.type==="Literal"){let ee=M.value;if(typeof ee==="string")return"string";if(typeof ee==="number")return"number";if(typeof ee==="boolean")return"boolean"}if(M.type==="TemplateLiteral")return"string";return}function Fd(M,ee){let we=ss(M,ee);if(we===void 0)return;if(ee.type==="Literal"){let Gt=ee.value;if(typeof Gt==="string"||typeof Gt==="number"||typeof Gt==="boolean")return{raw:we,value:Gt,type:typeof Gt};return}if(ee.type==="UnaryExpression"&&ee.operator==="-"){let Gt=ee.argument;if(Gt.type==="Literal"&&typeof Gt.value==="number")return{raw:we,value:-Gt.value,type:"number"};return}let Je=ee.type==="TemplateLiteral"?v(ee):null;return Je===null?void 0:{raw:we,value:Je,type:"string"}}function jd(M,ee){if(M.type!=="CallExpression"&&M.type!=="NewExpression")return;let we=M.callee;if(!(En(we)==="Symbol"||we.type==="MemberExpression"&&!we.computed&&En(we.object)==="Symbol"&&En(we.property)==="for"))return;return v(M.arguments[0])||ee}var Bd=new Set(["any","bigint","boolean","false","never","null","number","object","readonly","string","symbol","true","undefined","unknown","void"]),Vd=/"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'/g,Gd=/(?<![\w$.])[A-Za-z_$][\w$]*(?![\w$]|\s*\??:)/g;function Wd(M,ee){let we=ee?Nn().getCommentTags(E(ee)).type?.type.trim():void 0,Je=M?{type:M,source:"typescript"}:we?{type:we,source:"jsdoc"}:void 0;if(!Je||Je.type.includes("`"))return;return(Je.type.replace(Vd,'""').match(Gd)??[]).every((Wt)=>Bd.has(Wt))?Je:void 0}function Cp(M){if(M.async||M.generator||M.type==="TSDeclareFunction")return;let ee=M.body,we=ee.type==="BlockStatement"?le(ee):[ee];if(we.length===0)return;let Je;for(let Gt of we){if(!Gt)return;let Wt=kp(Gt);if(!Wt)return;if(Je===void 0)Je=Wt;else if(Je!==Wt)return}return Je}function Ud(M){let ee=M.initializer;if(!ee)return;if(ee.type==="Literal"){let we=ee.value;return typeof we==="string"||typeof we==="number"?we:void 0}if(ee.type==="UnaryExpression"&&ee.operator==="-"){let we=ee.argument;if(we.type==="Literal"&&typeof we.value==="number")return-we.value}return}function Kd(M){let ee=M.members;if(ee.length===0)return;let we=[],Je=0;for(let Gt of ee){if(!Gt.initializer){we.push(String(Je)),Je+=1;continue}let Wt=Ud(Gt);if(Wt===void 0)return;we.push(typeof Wt==="string"?JSON.stringify(Wt):String(Wt)),Je=typeof Wt==="number"?Wt+1:Je}return we.join(" | ")}function qr(M,ee,we,Je){let Gt=Ld(M.text,we),Wt=Gt?Od(Gt):void 0,Ht=Gt?Nn().extractJsDocReturnType(Gt):void 0,{deprecated:Ft,tags:Kt,internal:zt}=Gt?Nn().extractJsDocDeprecatedAndTags(Gt):{deprecated:void 0,tags:void 0,internal:!1},Xt={description:Wt,deprecated:Ft,tags:Kt,...zt?{internal:!0}:{},declFile:M.filePath};if(ee.type==="VariableDeclaration"){let Zt=ee.kind==="let"||ee.kind==="var"?ee.kind:"const",Qt=[];for(let en of ee.declarations){let tn=en.id,sn=En(tn);if(!sn)continue;let nn=Md(M,tn),an=nn,un,dn,fn,vn,Jn,Ss,wn=en.init;if(wn)if(wn.type==="ArrowFunctionExpression"||wn.type==="FunctionExpression"){if(Ss=wn,!an)an=Hr(M,wn);dn=Kr(M,wn)??Ht??ie(an)??Cp(wn)}else{if(un=ss(M,wn),!an)an=kp(wn);let as=w(wn);if(fn=v(as)??jd(as,sn),Zt==="const")vn=Fd(M,as),Jn=Wd(nn,Gt)}Qt.push({name:sn,kind:Zt,type:an,value:un,returnType:dn,literalValue:fn,primitiveLiteral:vn,declaredType:Jn,functionNode:Ss,...Xt,isTypeOnly:!1})}return Qt}if(ee.type==="FunctionDeclaration"||ee.type==="TSDeclareFunction"){let Zt=En(ee.id)??Je;if(!Zt)return[];return[{name:Zt,kind:"function",type:Hr(M,ee),returnType:Kr(M,ee)??Ht??Cp(ee),...ee.type==="FunctionDeclaration"?{functionNode:ee}:{},...Xt,isTypeOnly:!1}]}if(ee.type==="ClassDeclaration"){let Zt=En(ee.id),Qt=Zt??Je;if(!Qt)return[];return[{name:Qt,kind:"class",...Zt?{type:Zt}:{},...Xt,isTypeOnly:!1}]}if(ee.type==="TSTypeAliasDeclaration"){let Zt=En(ee.id);if(!Zt)return[];return[{name:Zt,kind:"type",type:ss(M,ee.typeAnnotation),...Xt,isTypeOnly:!0}]}if(ee.type==="TSInterfaceDeclaration"){let Zt=En(ee.id);if(!Zt)return[];return[{name:Zt,kind:"interface",type:ss(M,ee.body),...Xt,isTypeOnly:!0}]}if(ee.type==="TSEnumDeclaration"){let Zt=En(ee.id);if(!Zt)return[];return[{name:Zt,kind:"enum",type:Kd(ee)??Zt,...Xt,isTypeOnly:!1}]}return[]}function Hd(M,ee,we){let Je=ee.declaration;if(Je.type==="FunctionDeclaration"||Je.type==="TSDeclareFunction"||Je.type==="ClassDeclaration"){let[Ht]=qr(M,Je,ee.start,"default");return Ht?{...Ht,name:"default"}:void 0}if(Je.type==="FunctionExpression"||Je.type==="ArrowFunctionExpression")return{name:"default",kind:"function",type:Hr(M,Je),functionNode:Je,declFile:M.filePath,isTypeOnly:!1};let Gt=En(Je),Wt=Gt?we(Gt):null;return Wt?{...Wt,name:"default"}:void 0}function qd(M,ee){for(let we of M){if(we.type!=="ImportDeclaration")continue;let Je=we.source.value;for(let Gt of we.specifiers){if(Gt.local.name!==ee)continue;let Wt=we.importKind==="type"||Gt.type==="ImportSpecifier"&&Gt.importKind==="type";if(Gt.type==="ImportDefaultSpecifier")return{specifier:Je,importedName:"default",isTypeOnly:Wt};if(Gt.type==="ImportNamespaceSpecifier")return{specifier:Je,importedName:"*",isTypeOnly:Wt};if(Gt.type==="ImportSpecifier"){let Ht=En(Gt.imported)??ee;return{specifier:Je,importedName:Ht,isTypeOnly:Wt}}}}return null}function wp(M,ee,we){return{name:M,kind:"const",declFile:ee,namespaceFile:ee,isTypeOnly:we}}function Si(M,ee){let we=ee.cache.get(M);if(we)return we;if(ee.computing.has(M))return[];ee.computing.add(M);let Je=ee.graph.parse(M);if(!Je)return ee.computing.delete(M),ee.cache.set(M,[]),[];let{source:Gt,body:Wt}=Je,Ht=[],Ft=new Map;for(let Qt of Wt){let en=Qt.type==="ExportNamedDeclaration"?Qt.declaration:Qt;if(!en)continue;for(let tn of qr(Gt,en,en.start))Ft.set(tn.name,tn)}let Kt=(Qt,en)=>({name:Qt,kind:"const",declFile:Nd(Gt.dir,en),isTypeOnly:!1}),zt=(Qt)=>{let en=Ft.get(Qt);if(en)return en;let tn=qd(Wt,Qt);if(!tn)return null;if(tn.specifier.endsWith(".svelte"))return Kt(Qt,tn.specifier);let sn=ee.graph.resolve(tn.specifier,Gt.dir);if(!sn)return null;if(tn.importedName==="*")return wp(Qt,sn,tn.isTypeOnly);return is(sn,tn.importedName,ee)??null},Xt=new Map;for(let Qt of Wt){if(Qt.type==="ExportAllDeclaration"){let nn=Qt.source.value;if(nn.endsWith(".svelte"))continue;let an=ee.graph.resolve(nn,Gt.dir);if(!an)continue;let un=Qt.exportKind==="type",dn=En(Qt.exported);if(dn){Ht.push(wp(dn,an,un));continue}for(let fn of Si(an,ee)){let vn=Xt.get(fn.name)??[];vn.push(un?{...fn,isTypeOnly:!0}:fn),Xt.set(fn.name,vn)}continue}if(Qt.type==="ExportDefaultDeclaration"){let nn=Hd(Gt,Qt,zt);if(nn)Ht.push(nn);continue}if(Qt.type!=="ExportNamedDeclaration")continue;let en=Qt.declaration;if(en){Ht.push(...qr(Gt,en,Qt.start));continue}let tn=Qt.source?.value;if(tn?.endsWith(".svelte")){for(let nn of Qt.specifiers){let an=En(nn.exported);if(an)Ht.push(Kt(an,tn))}continue}let sn=Qt.exportKind==="type";for(let nn of Qt.specifiers){let an=En(nn.exported),un=En(nn.local);if(!an||!un)continue;let dn=sn||nn.exportKind==="type",fn=null;if(tn){let vn=ee.graph.resolve(tn,Gt.dir);if(vn)fn=is(vn,un,ee)??null}else fn=zt(un);if(fn)Ht.push({...fn,name:an,isTypeOnly:fn.isTypeOnly||dn});else if(un!=="default")Ht.push({name:an,kind:dn?"type":"const",declFile:M,isTypeOnly:dn})}}let Zt=new Set(Ht.map((Qt)=>Qt.name));for(let[Qt,en]of Xt){if(Zt.has(Qt)||Qt==="default")continue;if(en.every((tn)=>tn.declFile===en[0].declFile))Ht.push(...en);else ee.onAmbiguousStarExport?.(M,Qt,en)}return ee.computing.delete(M),ee.cache.set(M,Ht),Ht}function is(M,ee,we){return Si(M,we).findLast((Je)=>Je.name===ee)}function Es(M,{importedName:ee,members:we=[]},Je){let Gt=is(M,ee,Je);for(let Wt of we){if(Gt?.namespaceFile===void 0)return;Gt=is(Gt.namespaceFile,Wt,Je)}return Gt}import{dirname as zd}from"node:path";function Xn(M,ee,we){if(M[ee]===void 0)delete M[ee];M[ee]=we}function Ci(M,ee){return(ee.location==="props"?M.props:M.moduleExports).find((Je)=>Je.name===ee.propName)}function wi(M,ee){if(ee.location!=="props")return;M.diagnostics=(M.diagnostics??[]).filter((we)=>!(we.kind==="prop-unknown-type"&&we.name===ee.propName))}var Xd=/\.[^./\\]+$/;function Jd(M,ee){if(M.endsWith(".d.ts"))return null;let we=M.replace(Xd,".d.ts");return ee.exists(we)?we:null}function Yd(M,ee,we){let Je=zd(M);return ee.map((Gt)=>{if(!Gt.importSource||!Gt.importedName)return{candidate:Gt};let Wt=we.graph.resolve(Gt.importSource,Je);if(!Wt)return{candidate:Gt,failureReason:"module-not-found"};let Ht=is(Wt,Gt.importedName,we);if(!Ht)return{candidate:Gt,failureReason:"export-not-found"};if(Ht.returnType)return{candidate:Gt,type:Ht.returnType};let Ft=Jd(Wt,we.graph);if(Ft){let Kt=is(Ft,Gt.importedName,we);if(Kt?.returnType)return{candidate:Gt,type:Kt.returnType}}return{candidate:Gt,failureReason:"return-type-unresolved"}})}function Qd(M,ee){switch(ee){case"module-not-found":return`Prop "${M.propName}" default calls "${M.calleeName}()", but "${M.importSource}" could not be resolved; falling back to "any".`;case"export-not-found":return`Prop "${M.propName}" default calls "${M.calleeName}()", but "${M.importedName}" is not exported from "${M.importSource}"; falling back to "any".`;case"return-type-unresolved":return`Prop "${M.propName}" default calls "${M.calleeName}()" imported from "${M.importSource}", but its return type could not be resolved; falling back to "any".`}}function Zd(M,ee){for(let{candidate:we,type:Je,failureReason:Gt}of ee){let Wt=Ci(M,we);if(Wt?.typeSource!=="unknown")continue;if(Je){Xn(Wt,"type",Je),Xn(Wt,"typeSource","typescript"),wi(M,we);continue}if(we.location==="props"&&Gt){let Ht=M.diagnostics?.find((Ft)=>Ft.kind==="prop-unknown-type"&&Ft.name===we.propName);if(Ht)Ht.message=Qd(we,Gt)}}}var Tp={collect:(M)=>M.pendingCallDefaultCandidates?.filter((ee)=>ee.importSource!==void 0)??[],resolve:Yd,apply:Zd};import{dirname as ef}from"node:path";function tf(M,ee,we){let Je=ef(M);return ee.map((Gt)=>{let Wt=we.graph.resolve(Gt.importSource,Je);if(!Wt)return{candidate:Gt};let Ht=Es(Wt,Gt,we);if(!Ht?.primitiveLiteral)return{candidate:Gt};return{candidate:Gt,literal:Ht.primitiveLiteral,declaredType:Ht.declaredType}})}function nf(M,ee){for(let{candidate:we,literal:Je,declaredType:Gt}of ee){if(!Je)continue;let Wt=Ci(M,we);if(!Wt)continue;if(Xn(Wt,"value",Je.raw),Xn(Wt,"defaultValue",{raw:Je.raw,kind:"literal",value:Je.value}),Wt.typeSource!=="unknown")continue;Xn(Wt,"type",Gt?.type??Je.type),Xn(Wt,"typeSource",Gt?.source??"default"),wi(M,we)}}var Pp={collect:(M)=>M.pendingConstDefaultCandidates??[],resolve:tf,apply:nf};import{dirname as sf}from"node:path";function rf(M,ee,we){let Je=sf(M);return ee.map((Gt)=>{let Wt=we.graph.resolve(Gt.importSource,Je);if(!Wt)return{candidate:Gt};let Ht=Es(Wt,Gt,we);if(Ht?.kind!=="const"||Ht.literalValue===void 0)return{candidate:Gt};return{candidate:Gt,key:Ht.literalValue}})}function of(M,ee){for(let{candidate:we,key:Je}of ee){if(!Je){let Ft=ce(we);M.diagnostics=[...M.diagnostics??[],o({component:M.filePath,kind:"context-key-unresolved",name:Ft,message:`setContext key \`${Ft}\` from "${we.importSource}" isn't an \`export const\` string or Symbol() sveld can read; the context is skipped.`,...we.source?{source:we.source}:{}})];continue}let Gt=[...M.contexts??[]],Wt=Gt.findIndex((Ft)=>Ft.key===Je);if(Wt!==-1){let Ft=Gt[Wt],Kt=$p(Ft.source,we.source),zt=Kt?Ft.source:we.source;if(M.diagnostics=[...M.diagnostics??[],o({component:M.filePath,kind:"context-duplicate-key",name:Je,message:`setContext("${Je}", ...) was called more than once; only the first call's shape is used.`,...zt?{source:zt}:{}})],!Kt)continue;Gt.splice(Wt,1)}let Ht=Gt.findIndex((Ft)=>$p(Ft.source,we.source));Gt.splice(Ht===-1?Gt.length:Ht,0,{key:Je,typeName:O(Je),...we.type===void 0?{}:{type:we.type},description:we.description,properties:we.properties,...we.hasUnresolvedSpread?{hasUnresolvedSpread:!0}:{},...we.internal?{internal:!0}:{},source:we.source}),M.contexts=Gt}}function $p(M,ee){if(!M||!ee)return!1;let{line:we,column:Je}=M.start;return we>ee.start.line||we===ee.start.line&&Je>ee.start.column}var Ap={collect:(M)=>M.pendingContextKeyCandidates??[],resolve:rf,apply:of};import{dirname as af}from"node:path";function pf(M,ee,we){let Je=af(M);return ee.map((Gt)=>{let Wt=we.graph.resolve(Gt.importSource,Je);if(!Wt)return{candidate:Gt,failureReason:"module-not-found"};let Ht=Es(Wt,Gt,we)?.functionNode;if(!Ht)return{candidate:Gt,failureReason:"not-a-function"};let Ft=cf(Ht,Gt);if(!Ft)return{candidate:Gt,failureReason:"parameter-not-found"};return hf(Ht,Ft,Gt)})}function Dp(M){return M?.type==="AssignmentPattern"?M.left:M}function cf(M,ee){let we=Dp(M.params[ee.argumentIndex]);if(ee.property===void 0)return we?.type==="Identifier"?{name:we.name}:void 0;if(!ee.property)return;if(we?.type==="Identifier")return{object:we.name,property:ee.property};if(we?.type!=="ObjectPattern")return;for(let Je of we.properties){if(Je.type!=="Property"||Je.computed)continue;if(Je.key.type!=="Identifier"||Je.key.name!==ee.property)continue;let Gt=Dp(Je.value);return Gt?.type==="Identifier"?{name:Gt.name}:void 0}return}function zr(M){if(!M)return null;if(M.type==="ConditionalExpression"){let we=zr(M.consequent),Je=zr(M.alternate);return we&&Je?[...we,...Je]:null}let ee=v(M);return ee?[ee]:null}var lf={variableType:()=>{return}};function uf(M){if(!M)return"null";let{deriveLiteralDetailType:ee,literalDetailToTypeText:we}=Nn();if(M.type==="Literal")return we(M.value);return ee(lf,M)??"any"}function Np(M,ee){if("name"in ee)return M.type==="Identifier"&&M.name===ee.name;if(M.type!=="MemberExpression"||M.computed)return!1;return M.object.type==="Identifier"&&M.object.name===ee.object&&M.property.type==="Identifier"&&M.property.name===ee.property}function hf(M,ee,we){let Je=new Map,Gt="name"in ee?ee.name:ee.object,Wt;if(a(M.body,{enter(Ft,Kt,zt){if(Ft.type==="CallExpression"){if(!Np(Ft.callee,ee))return;let Zt=Ft.arguments,Qt=zr(Zt[0]);if(!Qt)return Wt="dynamic-event-name",T;for(let en of Qt){let tn=Je.get(en)??new Set;tn.add(uf(Zt[1])),Je.set(en,tn)}return}let Xt=Kt?.type==="CallExpression"&&zt==="callee";if(Ft.type==="MemberExpression"&&Np(Ft,ee)&&!Xt)return Wt="passed-on",T;if(Ft.type!=="Identifier"||Ft.name!==Gt)return;if(Xt)return;if(!("name"in ee)&&Kt?.type==="MemberExpression"&&zt==="object")return;if(!W(Ft,Kt))return;return Wt="passed-on",T}}),Wt)return{candidate:we,failureReason:Wt};let Ht=Array.from(Je,([Ft,Kt])=>{let zt=Array.from(Kt);return{name:Ft,detail:zt.includes("any")?"any":zt.join(" | ")}});return{candidate:we,events:Ht}}function df(M,ee){let we=M.members?`"${M.calleeText}"`:M.importedName==="default"?"the default export":`"${M.importedName}"`;switch(ee){case"module-not-found":return`"${M.importSource}" isn't a local module sveld can read`;case"not-a-function":return`${we} isn't a function declared in "${M.importSource}"`;case"parameter-not-found":return`no parameter of ${we} receives it`;case"dynamic-event-name":return"an event name isn't a string literal";case"passed-on":return`${we} passes it on`}}function ff(M,ee,{deferredEventNoSourceDiagnostics:we=[],untypedJsDocEventNames:Je=[]}){let Gt=new Map,Wt=[...M.diagnostics??[]],Ht=!0;for(let{candidate:en,events:tn,failureReason:sn}of ee){if(sn){Ht=!1,Wt.push(o({component:M.filePath,kind:"dispatch-escapes",name:en.dispatcherName,message:`\`${en.dispatcherName}\` is passed to \`${en.calleeText}\`, but sveld couldn't read the events it dispatches: ${df(en,sn)}. Document them with @event tags.`,...en.source?{source:en.source}:{},...en.ignored?{ignored:!0}:{}}));continue}for(let nn of tn??[]){if(Gt.has(nn.name))continue;Gt.set(nn.name,{type:"dispatched",name:nn.name,detail:nn.detail,...en.source?{source:en.source}:{}})}}if(Ht){for(let en of we)if(!Gt.has(en.name))Wt.push(en)}if(M.diagnostics=Wt,Gt.size===0)return;let Ft=new Map,Kt=new Set;for(let en of M.events)if(en.type==="dispatched")Kt.add(en.name);else if(!Ft.has(en.name))Ft.set(en.name,en);let zt=new Set(Je),Xt=new Map,Zt=[];for(let en of Gt.values()){if(Kt.has(en.name)){if(zt.has(en.name)&&en.detail!==void 0)Xt.set(en.name,en.detail);continue}let tn=Ft.get(en.name);if(!tn){Zt.push(en);continue}let sn=en.source??tn.source;Zt.push({type:"dispatched",name:en.name,detail:tn.detail??en.detail,...tn.description?{description:tn.description}:{},...tn.deprecated===void 0?{}:{deprecated:tn.deprecated},...tn.tags?{tags:tn.tags}:{},...tn.internal?{internal:!0}:{},...sn?{source:sn}:{}})}if(Zt.length===0&&Xt.size===0)return;let Qt=new Set(Zt.map((en)=>en.name));M.events=[...M.events.filter((en)=>en.type==="dispatched"||!Qt.has(en.name)).map((en)=>{let tn=en.type==="dispatched"?Xt.get(en.name):void 0;return tn===void 0?en:{...en,detail:tn}}),...Zt].sort(xe)}var _p={collect:(M)=>M.pendingDispatchEscapeCandidates??[],resolve:pf,apply:ff};function ki(M){return(ee)=>{let we=M.collect(ee);if(we.length===0)return;return(Je,Gt,Wt)=>M.apply(Je,M.resolve(Gt,we,Wt),ee)}}var mf=[ki(Tp),ki(Pp),ki(Ap),ki(_p)];async function Rp(M,ee,we,Je){let Gt=[];for(let Ht of M){let Ft=we(Ht);if(Ft===void 0)continue;let Kt=mf.flatMap((zt)=>zt(Ft)??[]);if(Kt.length>0)Gt.push({component:Ht,passes:Kt})}let Wt=new Map;if(Gt.length===0)return Wt;await qn();for(let{component:Ht,passes:Ft}of Gt){let Kt=bi(Je),zt=ee(Ht.filePath);for(let Xt of Ft)Xt(Ht,zt,Kt);Wt.set(Ht.filePath,Array.from(Kt.cache.keys()))}return Wt}var gf=/^```([\w-]*)\r?\n([\s\S]*?)\r?\n?```$/,yf=new Set(["","js","jsx","ts","tsx","javascript","typescript"]),xf=new Set(["svelte","html"]);function vf(M){let ee=M.trim();if(ee==="")return null;let we=ee.match(gf);if(we){let Je=we[1].toLowerCase(),Gt=we[2].trim();if(Gt==="")return null;if(yf.has(Je))return{kind:"compile",code:Gt};if(xf.has(Je))return{kind:"syntax",code:Gt};return null}if(ee.startsWith("<"))return null;return{kind:"compile",code:ee}}function Ip(M){if(!M.isFunction)return"any";return`(${(M.params??[]).map((we)=>`${we.name}${we.optional?"?":""}: any`).join(", ")}) => any`}function Ti(M,ee,we,Je,Gt){let Wt=(M??[]).filter((Ft)=>Ft.name==="example"),Ht=Wt.length>1;return Wt.flatMap((Ft,Kt)=>{let zt=vf(Ft.body);if(zt===null)return[];return[{id:Ht?`${ee}#${Kt}`:ee,name:Ht?`${we} (example ${Kt+1})`:we,type:Je,code:zt.code,kind:zt.kind,...Gt?{source:Gt}:{}}]})}function Ef(M){let ee=[];for(let we of M.props)ee.push(...Ti(we.tags,`prop:${we.name}`,we.name,Ip(we),we.source));for(let we of M.moduleExports)ee.push(...Ti(we.tags,`export:${we.name}`,we.name,Ip(we),we.source));for(let we of M.slots){let Je=we.name??"default";ee.push(...Ti(we.tags,`slot:${Je}`,Je,"any",we.source))}for(let we of M.events)ee.push(...Ti(we.tags,`event:${we.name}`,we.name,"any",we.source));return ee}function Lp(M,ee){return M.flatMap(({component:we,sources:Je})=>{let Gt=Je.filter((Wt)=>Wt.kind===ee);return Gt.length===0?[]:[{component:we,sources:Gt}]})}async function bf(M){let{formatParseError:ee,parseSvelte:we}=await qn(),Je=new Map;for(let{component:Gt,sources:Wt}of M){let Ht=[];for(let Ft of Wt)try{we(Ft.code)}catch(Kt){Ht.push(o({component:Gt.filePath,kind:"example-syntax-error",name:Ft.name,message:ee(Kt),...Ft.source?{source:Ft.source}:{}}))}Je.set(Gt,Ht)}return Je}async function Sf(M,ee,we){let Je=await ee.checkExamples(M.map(({component:Wt,sources:Ht})=>({moduleName:Wt.moduleName,filePath:we(Wt.filePath),sources:Ht}))),Gt=new Map;for(let{component:Wt,sources:Ht}of M){let Ft=Je.get(we(Wt.filePath));if(!Ft||Ft.length===0)continue;let Kt=new Map(Ht.map((zt)=>[zt.id,zt.source]));Gt.set(Wt,Ft.map((zt)=>{let Xt=Kt.get(zt.id);return o({component:Wt.filePath,kind:"example-compile-error",name:zt.name,message:zt.message,...Xt?{source:Xt}:{}})}))}return Gt}async function Op(M,ee,we,Je){let Gt=Array.from(M,(zt)=>({component:zt,sources:Ef(zt)})),Wt=ee===!0?Lp(Gt,"compile"):[],Ht=Lp(Gt,"syntax"),Ft=new Map,Kt=(zt)=>{for(let[Xt,Zt]of zt)Ft.set(Xt,[...Ft.get(Xt)??[],...Zt])};if(Ht.length>0)Kt(await bf(Ht));if(Wt.length>0){let{TypeResolver:zt}=await import("./chunk-q19n9qm3.js"),Xt=await zt.create(we);if(!Xt.ok)throw Error(`sveld: \`checkExamples\` ${Xt.message}.`);let Zt=Xt.resolver;try{Kt(await Sf(Wt,Zt,Je))}finally{await Zt.dispose()}}return Ft}import{hash as Cf}from"node:crypto";import{existsSync as wf,mkdirSync as kf,readFileSync as Tf,renameSync as Pf,writeFileSync as Mp}from"node:fs";import{dirname as Xr,isAbsolute as $f,join as Fp,resolve as Pi}from"node:path";var jp=10,Af=Fp("node_modules",".cache","sveld","parse-cache.json"),Df="147683fe157a01e6";function Bp(){return`${ri}+${Df}+svelte@${Is}`}function Nf(M){for(let ee=Pi(M);;ee=Xr(ee)){if(wf(Fp(ee,"package.json")))return ee;if(Xr(ee)===ee)return Pi(M)}}function Vp(M,ee){let we=Nf(M);if(typeof ee==="string")return $f(ee)?ee:Pi(we,ee);return Pi(we,Af)}function $i(M){return Cf("sha256",M,"hex")}function Jr(){return{formatVersion:jp,toolchainVersion:Bp(),entries:{}}}function _f(M){try{let ee=JSON.parse(Tf(M,"utf-8"));if(ee.formatVersion!==jp||ee.toolchainVersion!==Bp())return Jr();return ee}catch{return Jr()}}class Yr{cacheFilePath;file;next=new Map;dirty=!1;savedEntryCount;constructor(M){this.cacheFilePath=M,this.file=_f(M),this.savedEntryCount=Object.keys(this.file.entries).length}has(M,ee){return this.lookup(M,ee)!==void 0}lookup(M,ee){let we=this.next.get(M);if(we?.hash===ee)return we;let Je=this.file.entries[M];return Je?.hash===ee?Je:void 0}get(M,ee){let we=this.lookup(M,ee);if(we===void 0)return null;this.next.set(M,we);let{component:Je,typeScriptMetadata:Gt,pending:Wt}=structuredClone({component:we.component,typeScriptMetadata:we.typeScriptMetadata,pending:we.pending});if(Gt!==void 0)Je[x]=Gt;return Wt===void 0?{component:Je}:{component:Je,pending:Wt}}set(M,ee,{component:we,pending:Je}){this.dirty=!0,this.next.set(M,{hash:ee,...structuredClone({component:we,typeScriptMetadata:we[x],pending:Je})})}getGeneratedText(M,ee){let we=this.next.get(M);if(we?.generatedText===void 0||we.generatedText.key!==ee)return;return we.generatedText.text}setGeneratedText(M,ee,we){let Je=this.next.get(M);if(Je===void 0)return;if(Je.generatedText?.key===ee&&Je.generatedText.text===we)return;Je.generatedText={key:ee,text:we},this.dirty=!0}save(){if(!this.dirty&&this.next.size===this.savedEntryCount)return;this.dirty=!1,this.savedEntryCount=this.next.size,kf(Xr(this.cacheFilePath),{recursive:!0});let M={...Jr(),entries:Object.fromEntries(this.next)},ee=JSON.stringify(M),we=`${this.cacheFilePath}.${process.pid}.tmp`;try{Mp(we,ee),Pf(we,this.cacheFilePath)}catch{try{Mp(this.cacheFilePath,ee)}catch{}}}}import{dirname as Rf,relative as If,resolve as Lf}from"node:path";async function Gp(M,ee={}){await qn();let we=Lf(M),Je=Rf(we),Gt=(Ft)=>n(`./${If(Je,Ft)}`),Wt=Si(we,{...bi(ee.graph??new zn),onAmbiguousStarExport:(Ft,Kt,zt)=>{if(Ft!==we||!ee.diagnostics)return;if(zt.every((en)=>en.declFile.endsWith(".svelte")))return;let Xt=Array.from(new Set(zt.map((en)=>Gt(en.declFile)))),Zt=Xt.map((en)=>`"${en}"`),Qt=`${Zt.slice(0,-1).join(", ")} and ${Zt[Zt.length-1]}`;ee.diagnostics.push(o({component:Gt(we),kind:"export-ambiguous",name:Kt,message:`"${Kt}" 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 { ${Kt} } from "${Xt[0]}"\`).`}))}}),Ht=new Map;for(let Ft of Wt){if(Ft.name==="default"||Ft.declFile.endsWith(".svelte"))continue;let{declFile:Kt,returnType:zt,literalValue:Xt,primitiveLiteral:Zt,declaredType:Qt,functionNode:en,namespaceFile:tn,...sn}=Ft,nn=Gt(Kt);if(tn!==void 0)sn.type=`typeof import(${JSON.stringify(Gt(tn))})`;Ht.set(Ft.name,{...sn,source:nn})}return Array.from(Ht.values()).sort((Ft,Kt)=>l(Ft.name,Kt.name))}async function Ff(M){let ee=await Promise.all(Array.from(M,async(we)=>{try{return[we,await Mf(we,"utf-8")]}catch(Je){return console.warn(`Warning: Failed to read file ${we}:`,Je),[we,null]}}));return new Map(ee)}function Up(M){if(M.length===0)return;console.error(`sveld: failed to parse ${M.length} component(s):`);for(let{filePath:ee,message:we}of M)console.error(` - ${ee}: ${we}`)}class js{input;glob;options;graph=new zn;collected;entryFile=null;globMergeState;cache;entryExports=[];entryDiagnostics=[];records=new Map;parseErrors=new Map;canonicalEntries=new Map;warnedModuleNames=new Set;constructor(M,ee,we={}){this.input=M,this.glob=ee,this.options=we}get documentExports(){return this.options.documentExports===!0}async build(){return this.graph=new zn,this.collected=Wr(this.input,this.glob,this.documentExports,this.graph),this.globMergeState=Ei(this.collected.allComponentEntries,this.collected.resolveComponentFilePath),this.entryFile=Of(this.input).isFile()?Wp(this.input):null,this.cache=this.options.cache===!1?void 0:new Yr(Vp(this.collected.rootDir,this.options.cache??!0)),await this.readEntryExports(),this.records.clear(),this.parseErrors.clear(),this.indexEntries(),await this.process(this.componentPaths()),Up(Array.from(this.parseErrors.values())),this.assemble()}async update(M){let ee=M.map((zt)=>Wp(zt));if(this.graph.invalidate(...ee),ee.length===0)return{result:this.assemble(),reparsed:[]};let we=this.entryFile!==null&&ee.includes(this.entryFile)?await this.recollect():[];if(this.glob){let{rootDir:zt,exports:Xt,allComponentEntries:Zt,resolveComponentFilePath:Qt}=this.collected;Gr(this.graph,zt,Xt,Zt,Qt,this.globMergeState)}this.indexEntries();let Je=this.componentPaths();for(let zt of this.records.keys())if(!Je.has(zt))this.records.delete(zt);for(let zt of this.parseErrors.keys())if(!Je.has(zt))this.parseErrors.delete(zt);let Gt=Array.from(this.records).flatMap(([zt,{crossFileReads:Xt}])=>Xt?.some((Zt)=>ee.includes(Zt))?[zt]:[]),Wt=new Set([...ee.filter((zt)=>In.test(zt)),...we,...Gt]),Ht=new Set(Array.from(Je).filter((zt)=>Wt.has(zt))),Ft=await this.process(Ht),Kt=this.assemble();return Up(Kt.errors),{result:Kt,reparsed:Ft}}async recollect(){let M=this.collected,ee=Wr(this.input,this.glob,this.documentExports,this.graph),we=[];for(let[Je,Gt]of Object.entries(ee.exports)){let Wt=ee.resolveComponentFilePath(Gt.source),Ht=Object.hasOwn(M.exports,Je)?M.exports[Je]:void 0;if(Ht===void 0||M.resolveComponentFilePath(Ht.source)!==Wt)we.push(Wt)}return this.collected=ee,this.globMergeState=Ei(ee.allComponentEntries,ee.resolveComponentFilePath),await this.readEntryExports(),we}async readEntryExports(){this.entryDiagnostics=[],this.entryExports=this.documentExports&&this.entryFile!==null?await Gp(this.entryFile,{diagnostics:this.entryDiagnostics,graph:this.graph}):[]}componentPaths(){let{exports:M,allComponentEntries:ee,resolveComponentFilePath:we}=this.collected,Je=new Set;for(let[,Gt]of[...Object.entries(M),...ee])if(gs(Gt.source))Je.add(we(Gt.source));return Je}indexEntries(){let{exports:M,allComponentEntries:ee,resolveComponentFilePath:we}=this.collected;this.canonicalEntries=new Map;for(let Je of[Object.entries(M),ee])for(let[Gt,Wt]of Je){if(!gs(Wt.source))continue;this.canonicalEntries.set(we(Wt.source),{moduleName:Ur(Gt,Wt.source,Je.length,this.warnedModuleNames),filePath:n(Wt.source)})}}canonicalEntry(M){let ee=this.canonicalEntries.get(M);if(ee===void 0)throw Error(`sveld: no entry lists ${M}.`);return ee}async process(M){let ee=new Map,we=await this.parse(M,ee);this.cache?.save();let Je=await this.settle(we);for(let Gt of M)this.records.delete(Gt),this.parseErrors.delete(Gt);for(let[Gt,Wt]of Je)this.records.set(Gt,Wt);for(let[Gt,Wt]of ee)this.parseErrors.set(Gt,Wt);return Array.from(Je.keys())}async parse(M,ee){let we=await Ff(M),Je=this.cache,Gt=new Map,Wt=new Set;if(Je)for(let[Ft,Kt]of we){if(Kt===null)continue;let zt=$i(Kt);if(Gt.set(Ft,zt),!Je.has(Ft,zt))Wt.add(Ft)}if(M.size>0&&(!Je||Wt.size>0))await qn();let Ht=new Map;for(let Ft of M){let Kt=we.get(Ft);if(Kt===null||Kt===void 0)continue;let zt=this.parseOne(Ft,Kt,Gt.get(Ft),ee);if(zt)Ht.set(Ft,zt)}return Ht}parseOne(M,ee,we,Je){let Gt=we===void 0?null:this.cache?.get(M,we);if(Gt)return Gt;let{moduleName:Wt,filePath:Ht}=this.canonicalEntry(M),Ft;try{Ft=new(Nn()).ComponentParser().parse(ee,{moduleName:Wt,filePath:Ht})}catch(Kt){if(this.options.failFast)throw Kt;Je.set(M,{filePath:Ht,moduleName:Wt,message:Kt instanceof Error?Kt.message:String(Kt),stack:Kt instanceof Error?Kt.stack:void 0});return}if(we!==void 0)this.cache?.set(M,we,Ft);return Ft}async settle(M){let{rootDir:ee,resolveComponentFilePath:we}=this.collected,Je=new Map,Gt=new Map;for(let[Kt,{component:zt,pending:Xt}]of M){let Zt={...this.canonicalEntry(Kt),...zt};Je.set(Kt,Zt),Gt.set(Zt,Xt)}let{checkExamples:Wt}=this.options;if(Wt){let Kt=await Op(Je.values(),Wt,ee,we);for(let[zt,Xt]of Kt)Bi(zt,Xt)}let Ht=await Rp(Je.values(),we,(Kt)=>Gt.get(Kt),this.graph),Ft=new Map;for(let[Kt,zt]of Je){let{moduleName:Xt,filePath:Zt,...Qt}=zt,en=Ht.get(Zt);Ft.set(Kt,en===void 0?{component:Qt}:{component:Qt,crossFileReads:en})}return Ft}assemble(){let{exports:M,allComponentEntries:ee,resolveComponentFilePath:we}=this.collected,Je=this.cache,Gt=(Zt,[Qt,en])=>{if(!gs(en.source))return;let tn=this.records.get(we(en.source));if(tn===void 0)return;return{component:{moduleName:Ur(Qt,en.source,Zt.length,this.warnedModuleNames),filePath:n(en.source),...tn.component},record:tn}},Wt=new Map,Ht=Je?new Map:void 0,Ft=Je?new Map:void 0;for(let Zt of ee){let Qt=Gt(ee,Zt);if(Qt===void 0)continue;let{filePath:en}=Qt.component;Wt.set(en,Qt.component),(Qt.record.crossFileReads===void 0?Ht:Ft)?.set(en,we(Zt[1].source))}let Kt=ap(Wt,we,this.graph);for(let Zt of Wt.values())Bi(Zt,[...Kt(Zt),...op(Zt)]);let zt=new Map,Xt=Object.entries(M);for(let Zt of Xt){let Qt=Gt(Xt,Zt);if(Qt===void 0)continue;let en=Wt.get(Qt.component.filePath);if(en)Qt.component.diagnostics=en.diagnostics;zt.set(Qt.component.moduleName,Qt.component)}return{exports:M,entryExports:this.entryExports,components:zt,allComponentsForTypes:Wt,errors:Array.from(this.parseErrors.values()),diagnostics:No(Io([...Array.from(Wt.values()).flatMap((Zt)=>Zt.diagnostics??[]),...this.entryDiagnostics]),this.options.diagnostics?.ignore),cache:Je,resolvedPathByFilePath:Ht,crossFileResolvedPathByFilePath:Ft}}}function D(M){return{failFast:M?.failFast,documentExports:M?.documentExports===!0,cache:M?.cache,checkExamples:M?.checkExamples==="syntax"?"syntax":M?.checkExamples===!0,diagnostics:M?.diagnostics}}async function R(M,ee,we={}){return new js(M,ee,we).build()}import{existsSync as Qr,readFileSync as jf}from"node:fs";import{isAbsolute as Bf,join as Hp}from"node:path";var Bs='sveld: could not resolve a Svelte entry point. Set package.json#svelte, or pass the "entry" option.';function Kp(M){return Bf(M)?M:Hp(process.cwd(),M)}function Be(M){if(M){let Gt=Kp(M);if(Qr(Gt))return{entry:K(M)};return{entry:null,configured:!0,message:`Invalid entry point: ${Gt}. Pass a valid --entry (or "entry" option), or unset it and set the "svelte" field in your package.json instead.`}}let ee=Hp(process.cwd(),"package.json");if(!Qr(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 we;try{we=lp(JSON.parse(jf(ee,"utf-8")))}catch(Gt){throw console.error("Error reading package.json:",Gt),Gt}let Je=we.svelte?.trim();if(!Je)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(!Qr(Kp(Je)))return{entry:null,configured:!0,message:`The "svelte" field in package.json points to "${Je}", which does not exist.`};return{entry:K(Je)}}function Ai(M){let ee=Be(M);if(ee.entry===null)console.error(ee.message);return ee.entry}async function qp(M,ee,we={}){let Je=new js(M,ee,{...we,failFast:!1}),Gt=await Je.build();return{get result(){return Promise.resolve(Gt)},async update(Wt){let Ht=await Je.update(Wt);return Gt=Ht.result,Ht}}}import eo from"node:path";function zp(M){let ee=new Map;for(let[Je,Gt]of Object.entries(M)){let Wt=ee.get(Gt.source)??[];Wt.push({id:Je,exportee:Gt}),ee.set(Gt.source,Wt)}let we=[];for(let[Je,Gt]of ee){let Wt=In.test(Je),Ht=Gt.some(({id:Qt,exportee:en})=>Qt!=="default"&&en.default),Ft=Gt.some(({exportee:Qt})=>!Qt.default),Kt=Wt&&Ht&&Ft,zt=[],Xt=[],Zt=[];for(let{id:Qt,exportee:en}of Gt){if(Qt==="default"){Xt.push(`export { default } from "${Je}";`);continue}if(en.default)if(en.mixed)Xt.push(`export { default as ${Qt} } from "${Je}";`),Xt.push(`export { default } from "${Je}";`);else Zt.push(`default as ${Qt}`);else if(Wt&&!Kt)Zt.push(`default as ${Qt}`);else zt.push(Qt)}if(Zt.length>0&&zt.length>0)we.push(`export { ${[...Zt,...zt].join(", ")} } from "${Je}";`);else{if(zt.length>0)we.push(`export { ${zt.join(", ")} } from "${Je}";`);if(Zt.length>0)we.push(`export { ${Zt.join(", ")} } from "${Je}";`)}we.push(...Xt)}return we.join(`
|
|
182
|
+
`)}function Xp(M){return M.filter((ee)=>ee.names.length>0).map((ee)=>`export type { ${ee.names.join(", ")} } from "${ee.source}";`).join(`
|
|
183
|
+
`)}function Jp(M){return M.replace(In,"")}function Zr(M){return M.replace(In,".svelte.d.ts")}import{mkdir as Vf,readFile as Gf,writeFile as Wf}from"node:fs/promises";import{parse as Uf}from"node:path";class Fn{ensuredDirs=new Set;async write(M,ee){try{if(await Gf(M,"utf-8")===ee)return!1}catch{}let we=Uf(M).dir;if(!this.ensuredDirs.has(we))await Vf(we,{recursive:!0}),this.ensuredDirs.add(we);return await Wf(M,ee),!0}}function Kf(M){return typeof M==="object"&&M!==null&&!Array.isArray(M)&&"start"in M&&"end"in M}function Di(M){if(Array.isArray(M))return M.map((ee)=>Di(ee));if(M!==null&&typeof M==="object"){let ee={};for(let[we,Je]of Object.entries(M)){if((we==="source"||we==="componentCommentSource")&&Kf(Je))continue;ee[we]=Di(Je)}return ee}return M}function Yp(M,ee){return M.map((we)=>({...we,filePath:wa(we.filePath,ee)}))}function Hf(M,ee,we){if(!ee)return`${M.moduleName}.api.json`;if(!we.has(M.moduleName))we.add(M.moduleName),console.warn(`Warning: multiple components named "${M.moduleName}" found. Their JSON files are keyed by source path instead of name to avoid overwriting each other.`);return`${Jp(M.filePath)}.api.json`}async function qf(M,ee,we){let Je=m(M),Gt=Yp(Je.components,ee.inputDir);if(ee.source===!1)Gt=Di(Gt);let Wt=new Map;for(let Kt of Gt)Wt.set(Kt.moduleName,(Wt.get(Kt.moduleName)??0)+1);let Ht=new Set,Ft=new Fn;await Promise.all(Gt.map(async(Kt)=>{let zt=(Wt.get(Kt.moduleName)??0)>1,Xt=Hf(Kt,zt,Ht),Zt=eo.resolve(eo.join(we,Xt)),Qt=await Ft.write(Zt,Rs(Kt));Vn(`${Qt?"created":"unchanged"} "${Zt}".`)}))}function to(M,ee){let we=m(M,{entryExports:ee.entryExports}),Je={...we,components:Yp(we.components,ee.inputDir)};return ee.source===!1?Di(Je):Je}function no(M,ee){return Rs(to(M,ee))}async function so(M,ee){if(ee.outDir){await qf(M,ee,ee.outDir);return}let we=await new Fn().write(eo.resolve(ee.outFile),no(M,ee));Vn(`${we?"created":"unchanged"} "${ee.outFile}".`)}import{join as gc,resolve as go}from"node:path";var Qp=/`/g,Zp=/\s+/g,_n="--",ec=`| Prop name | Required | Kind | Reactive | Binding | Type | Default value | Description |
|
|
184
|
+
| :- | :- | :- | :- | :- | :- | :- | :- |
|
|
185
|
+
`,tc=`| Slot name | Default | Props | Fallback | Description |
|
|
186
|
+
| :- | :- | :- | :- | :- |
|
|
187
|
+
`,nc=`| Event name | Type | Detail | Description |
|
|
188
|
+
| :- | :- | :- | :- |
|
|
189
|
+
`,oo=`| Name | Kind | Type | Description |
|
|
190
|
+
| :- | :- | :- | :- |
|
|
191
|
+
`,zf=`| Member | Signature | Description |
|
|
192
|
+
| :- | :- | :- |
|
|
193
|
+
`,sc=`| Part name | Description |
|
|
194
|
+
| :- | :- |
|
|
195
|
+
`,ic=`| Property name | Type | Default value | Description |
|
|
196
|
+
| :- | :- | :- | :- |
|
|
197
|
+
`,ao=/\|/g,Xf=/</g,Jf=/>/g,rs=/\n/g,Yf=/^[A-Za-z_$][\w$]*$/,Qf=/\s*\n\s*/g,Zf=/&(?=#?\w+;)|<(?=[A-Za-z/!?])|[|`*]|\\(?=[!-/:-@[-`{-~])|(?<![A-Za-z0-9])_|_(?![A-Za-z0-9])/g,em=/[&<|`*\\_]/;function po(M){if(!em.test(M))return M;return M.replace(Zf,(ee)=>ee==="&"?"&":ee==="<"?"<":ee==="_"?"_":`&#${ee.charCodeAt(0)};`)}function rc(M){return`<code>${po(M.includes(`
|
|
198
|
+
`)?M.replace(Qf," "):M)}</code>`}var tm=/\{@link\s+([^{}\s|]+)(?:\|([^{}]+))?\}/g;function nm(M){if(!M.includes("{@link"))return M;return M.replace(tm,(ee,we,Je)=>`[${Je===void 0?we:Je.trim()}](${we})`)}function io(M){return M.includes("```")||M.includes("~~~")}function ro(M){return cc(nm(M))}var sm=/^([ \t]*)(`{3,}|~{3,})(.*)$/,im=/^\n/,rm=/\n$/;function oc(M){let ee=(Wt)=>({kind:"prose",text:ro(Wt.join(`
|
|
199
|
+
`))});if(!io(M))return[ee([M])];let we=M.split(`
|
|
200
|
+
`),Je=[],Gt=[];for(let Wt=0;Wt<we.length;Wt++){let Ht=sm.exec(we[Wt]),[,Ft="",Kt="",zt=""]=Ht??[];if(!Ht||Kt[0]==="`"&&zt.includes("`")){Gt.push(we[Wt]);continue}if(Gt.push(""),Gt.length>1)Je.push(ee(Gt));let Xt=[],Zt=new RegExp(`^[ \\t]*${Kt[0]}{${Kt.length},}[ \\t]*$`);for(Wt++;Wt<we.length&&!Zt.test(we[Wt]);Wt++){let Qt=we[Wt],en=0;while(en<Ft.length&&(Qt[en]===" "||Qt[en]==="\t"))en++;Xt.push(Qt.slice(en))}Je.push({kind:"code",code:Xt.join(`
|
|
201
|
+
`)}),Gt=[""]}if(Gt.length>1||Je.length===0)Je.push(ee(Gt));return Je}function ac(M){let ee="";for(let we=0;we<M.length;we++){let Je=M[we];if(Je.kind==="code"){ee+=`<pre><code>${po(Je.code).replace(rs,"<br />")}</code></pre>`;continue}let Gt=Je.text;if(M[we-1]?.kind==="code")Gt=Gt.replace(im,"");if(M[we+1]?.kind==="code")Gt=Gt.replace(rm,"");ee+=Gt.replace(ao,"|").replace(rs,"<br />")}return ee}function An(M){if(M===void 0)return _n;return rc(M)}function pc(M){if(!M.reExport)return An(M.type);let{from:ee,imported:we}=M.reExport,Je=we==="*"?"":Yf.test(we)?`.${we}`:`[${JSON.stringify(we)}]`;return An(`typeof import(${JSON.stringify(ee)})${Je}`)}function cc(M){if(!M.includes("<")&&!M.includes(">"))return M;return M.replace(Xf,"<").replace(Jf,">")}function co(M){if(M===void 0)return _n;return rc(M)}function os(M,ee){if(ee===void 0)return M;let we=typeof ee==="string"&&ee.trim().length>0?`: ${cc(ee).replace(rs," ").replace(ao,"|")}`:"";return`<s>${M}</s><br />**Deprecated**${we}`}function Ni(M){if(M===void 0||M.trim().length===0)return _n;return ac(oc(M))}function lc(M){if(M===void 0||M==="{}")return _n;return An(fi(M).replace(rs," "))}function uc(M){if(M===void 0)return _n;return`<code>${po(M).replace(rs,"<br />")}</code>`}function bs(M,ee){let we=M!==void 0&&M.trim().length>0;if(!(we&&io(M))&&!ee?.some(({body:Ht})=>Ht&&io(Ht))){let Ht=we?[ro(M)]:[];for(let{name:Ft,body:Kt}of ee??[]){let zt=Kt?.trim();Ht.push(zt?`@${Ft} ${ro(zt)}`:`@${Ft}`)}if(Ht.length===0)return _n;return Ht.join(`
|
|
202
|
+
`).replace(ao,"|").replace(rs,"<br />")}let Je=[],Gt=(Ht)=>{let Ft=Je.at(-1);if(Ft?.kind==="prose")Ft.text+=Ht;else Je.push({kind:"prose",text:Ht})},Wt=(Ht,Ft)=>{if(Je.length>0)Gt(`
|
|
203
|
+
`);if(Ht)Gt(Ht);for(let Kt of oc(Ft))if(Kt.kind==="prose")Gt(Kt.text);else Je.push(Kt)};if(we)Wt("",M);for(let{name:Ht,body:Ft}of ee??[]){let Kt=Ft?.trim();Wt(Kt?`@${Ht} `:`@${Ht}`,Kt??"")}if(Je.length===0)return _n;return ac(Je)}function hc(M){if(M===void 0)return _n;return An(M.replace(rs," "))}function om(M){let ee=[M.extends?`Extends ${An(M.extends)}.`:"",M.implements?.length?`Implements ${M.implements.map((we)=>An(we)).join(", ")}.`:""].filter(Boolean);return ee.length>0?ee.join(" "):void 0}function dc(M,ee){let we=new Set;for(let Je of ee){if(Je.kind!=="class")continue;let Gt=om(Je);if(!Je.members?.length&&!Gt)continue;let Wt=Je.localName??Je.name;if(we.has(Wt))continue;if(we.add(Wt),M.append("h4",`\`${Wt}\` members`),Gt)M.append("raw",`${Gt}
|
|
204
|
+
|
|
205
|
+
`);if(!Je.members?.length)continue;M.append("raw",zf);for(let Ht of Je.members)M.append("raw",`| ${os(Ht.name,Ht.deprecated)} | ${An(Dr(Ht))} | ${bs(Ht.description,Ht.tags)} |
|
|
206
|
+
`);M.append("raw",`
|
|
207
|
+
`)}}function uo(M,ee,we){if(M.append("h1","Component Index"),M.append("h2","Components").tableOfContents(),M.append("divider"),we&&we.length>0)mc(M,we);for(let Je of m(ee).components)ho(M,Je)}function fc(M,ee,we){M.append("h1","Component Index"),M.append("h2","Components");for(let Je of ee)M.append("raw",`- [${Je.moduleName}](./${Je.moduleName}.md)
|
|
208
|
+
`);if(M.append("raw",`
|
|
209
|
+
`),M.append("divider"),we&&we.length>0)mc(M,we)}function mc(M,ee){M.append("h2","Exports"),M.append("raw",oo);for(let we of ee){let Je=(we.type??we.value)?.replace(Zp," ").trim();M.append("raw",`| ${os(we.name,we.deprecated)} | <code>${we.kind}</code> | ${An(Je)} | ${Ni(we.description)} |
|
|
210
|
+
`)}M.append("raw",`
|
|
211
|
+
`),M.append("divider")}function am(M){return M.kind==="const"||M.isFunctionDeclaration}function pm(M,ee){M.append("h3","Module exports"),M.append("raw",oo);for(let we of ee)M.append("raw",`| ${os(we.name,we.deprecated)} | <code>${we.kind}</code> | ${pc(we)} | ${bs(we.description,we.tags)} |
|
|
212
|
+
`);M.append("raw",`
|
|
213
|
+
`),dc(M,ee)}function lo(M,ee,we){if(ee.length>0)we(),M.append("raw",`
|
|
214
|
+
`);else M.append("p","None.")}function ho(M,ee){if(M.append("h2",`\`${ee.moduleName}\``),ee.generics)M.append("p",`**Type parameters:** ${An(`<${ee.generics[1]}>`)}`);if(ee.typedefs.length>0)M.append("h3","Types").append("raw",`\`\`\`ts
|
|
215
|
+
${mi({typedefs:ee.typedefs})}
|
|
216
|
+
\`\`\`
|
|
217
|
+
|
|
218
|
+
`);if(M.append("h3","Props"),lo(M,ee.props,()=>{M.append("raw",ec);let we=(Gt)=>Gt.reactive?0:Gt.constant?2:1,Je=ee.props.map((Gt,Wt)=>({prop:Gt,index:Wt})).sort((Gt,Wt)=>we(Gt.prop)-we(Wt.prop)||Gt.index-Wt.index).map(({prop:Gt})=>Gt);for(let Gt of Je){let Wt=am(Gt)?"accessor":Gt.kind;M.append("raw",`| ${os(Gt.name,Gt.deprecated)} | ${Gt.isRequired?"Yes":"No"} | <code>${Wt}</code> | ${Gt.reactive?"Yes":"No"} | ${Gt.binding??"--"} | ${An(Gt.type)} | ${co(Gt.value)} | ${bs(Gt.description,Gt.tags)} |
|
|
219
|
+
`)}}),ee.moduleExports.length>0)pm(M,ee.moduleExports);if(M.append("h3","Slots"),lo(M,ee.slots,()=>{M.append("raw",tc);for(let we of ee.slots)M.append("raw",`| ${os(we.default?_n:we.name??_n,we.deprecated)} | ${we.default?"Yes":"No"} | ${lc(we.slot_props)} | ${uc(we.fallback)} | ${bs(we.description,we.tags)} |
|
|
220
|
+
`)}),M.append("h3","Events"),lo(M,ee.events,()=>{M.append("raw",nc);for(let we of ee.events)M.append("raw",`| ${os(we.name,we.deprecated)} | ${we.type} | ${hc(we.detail)} | ${bs(we.description,we.tags)} |
|
|
221
|
+
`)}),ee.cssParts&&ee.cssParts.length>0){M.append("h3","CSS Parts"),M.append("raw",sc);for(let we of ee.cssParts)M.append("raw",`| ${we.name} | ${Ni(we.description)} |
|
|
222
|
+
`);M.append("raw",`
|
|
223
|
+
`)}if(ee.cssProperties&&ee.cssProperties.length>0){M.append("h3","CSS Custom Properties"),M.append("raw",ic);for(let we of ee.cssProperties)M.append("raw",`| ${we.name} | ${An(we.type)} | ${co(we.default)} | ${Ni(we.description)} |
|
|
224
|
+
`);M.append("raw",`
|
|
225
|
+
`)}}var cm=/[^\w\- ]+/g,lm=/\s+/g,fo="<!-- __TOC__ -->";function um(M,ee){let we=M.toLowerCase().replace(Qp,"").replace(cm,"").replace(lm,"-"),Je=ee.get(we)??0;return ee.set(we,Je+1),Je===0?we:`${we}-${Je}`}class mo{sourceParts=[];hasToC=!1;toc=[];onAppend;constructor(M={}){this.onAppend=M.onAppend}get source(){return this.sourceParts.join("")}appendLineBreaks(){return this.sourceParts.push(`
|
|
226
|
+
|
|
227
|
+
`),this}append(M,ee){switch(M){case"h1":case"h2":case"h3":case"h4":case"h5":case"h6":{if(this.sourceParts.push(`${"#".repeat(Number(M.slice(-1)))} ${ee}`),this.hasToC&&M==="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(M!=="raw")this.appendLineBreaks();return this.onAppend?.call(this,M,this),this}tableOfContents(){return this.sourceParts.push(fo),this.hasToC=!0,this.appendLineBreaks(),this}end(){let M=this.sourceParts.join("");if(!this.hasToC)return M;let ee=M.indexOf(fo);if(ee===-1)return M;let we=new Map,Je=this.toc.map(({indent:Gt,raw:Wt})=>`${" ".repeat(Gt)}- [${Wt}](#${um(Wt,we)})`).join(`
|
|
228
|
+
`);return M.slice(0,ee)+Je+M.slice(ee+fo.length)}}function _i(M,ee){return new mo({onAppend:(we,Je)=>{ee?.onAppend?.call(null,we,Je,M)}})}async function hm(M,ee,we){let Je=m(M,{entryExports:ee.entryExports}),Gt=new Fn,Wt=_i(M,ee);fc(Wt,Je.components,ee.entryExports);let Ht=go(gc(we,"README.md")),Ft=await Gt.write(Ht,Wt.end());Vn(`${Ft?"created":"unchanged"} "${Ht}".`),await Promise.all(Je.components.map(async(Kt)=>{let zt=_i(M,ee);ho(zt,Kt);let Xt=go(gc(we,`${Kt.moduleName}.md`)),Zt=await Gt.write(Xt,zt.end());Vn(`${Zt?"created":"unchanged"} "${Xt}".`)}))}function yo(M,ee){let we=_i(M,ee);return uo(we,M,ee.entryExports),we.end()}async function xo(M,ee){if(ee.outDir){await hm(M,ee,ee.outDir);return}let we=go(ee.outFile),Je=await new Fn().write(we,yo(M,ee));Vn(`${Je?"created":"unchanged"} "${ee.outFile}".`)}import{join as dm,resolve as fm}from"node:path";function mm(M,ee){if(!ee.indexTypes)return[];let we=ee.format==="component",Je=new Set,Gt=[];for(let Wt of Object.values(ee.exports)){if(!Wt.default||!In.test(Wt.source))continue;let Ht=n(Wt.source);if(Je.has(Ht))continue;Je.add(Ht);let Ft=M.components.find((zt)=>zt.filePath===Ht);if(!Ft)continue;let Kt=[vs(Ft.moduleName)];if(we)Kt.push(Ms(Ft.moduleName));Gt.push({source:Wt.source,names:Kt})}return Gt}async function yc(M,ee,we){if(!M)return ee;try{let Je=await M(ee,we);if(typeof Je!=="string")throw TypeError(`must return a string, got ${typeof Je}`);return Je}catch(Je){let Gt=Je instanceof Error?Je.message:String(Je);throw Error(`sveld: typesOptions.transform failed for "${we.filePath}": ${Gt}`,{cause:Je})}}function gm(M,ee){return`${M}
|
|
229
|
+
${rp(ee)}`}async function vo(M,ee){let we=fm(ee.outDir,"index.d.ts"),Je=new Fn,Gt=m(M),Wt=Xp(mm(Gt,ee)),Ht=ee.preamble+[zp(ee.exports),Wt].filter((en)=>en!=="").join(`
|
|
230
|
+
|
|
231
|
+
`),Ft=Nr(ee),Kt=Gt.components.map(async(en)=>{let tn=Zr(dm(ee.outDir,en.filePath)),sn=n(Zr(en.filePath)),nn=ee.resolvedPathByFilePath?.get(en.filePath),an=nn?void 0:ee.crossFileResolvedPathByFilePath?.get(en.filePath),un=nn??an,dn=gm(en.moduleName,Ft),fn=an?`${dn}
|
|
232
|
+
${$i(JSON.stringify(en))}`:dn,vn=un?ee.cache?.getGeneratedText(un,fn):void 0;if(vn===void 0){if(vn=_r(en,Ft),un)ee.cache?.setGeneratedText(un,fn,vn)}let Jn=await yc(ee.transform,vn,{kind:"component",component:en,filePath:sn});return Je.write(tn,Jn)}),zt=(async()=>{let en=await yc(ee.transform,Ht,{kind:"index",filePath:"index.d.ts"});return Je.write(we,`${en}
|
|
233
|
+
`)})(),Xt=(await Promise.all([...Kt,zt])).filter(Boolean).length,Zt=Kt.length+1,Qt=Xt===0?`unchanged ${Zt}`:`created ${Xt} of ${Zt}`;Vn(`${Qt} TypeScript definitions in "${ee.outDir}".`)}var vm=["reportDiagnostics","strict","check","checkLevel","stdout","format"],Em=50;function bm(M){let ee=Promise.resolve();return()=>{ee=ee.then(M,M)}}function Jt(M){let ee=M?.watch===!0,we,Je,Gt=M??{},Wt,Ht=null,Ft,Kt=new Set,Xt=bm(async()=>{if(Ht==null||Je==null||Kt.size===0)return;let Qt=Array.from(Kt);Kt.clear();try{let{result:en}=await Ht.update(Qt);await L(en,Gt,Je),en.cache?.save()}catch(en){console.error("sveld: failed to regenerate types in watch mode:",en)}}),Zt=(Qt)=>{if(!ee||Ht==null||!Ca.test(Qt))return;Kt.add(Qt),clearTimeout(Ft),Ft=setTimeout(Xt,Em)};return{name:"vite-plugin-sveld",apply:ee?void 0:"build",enforce:"post",configResolved(Qt){Wt=Qt.root},async buildStart(){if(M?.config){let en=Wt??process.cwd(),tn=typeof M.config==="string"?await Z(ym(M.config)?M.config:xm(en,M.config)):await q(en);Gt=I(tn,M)}F(Gt);let Qt=vm.filter((en)=>(en in Gt));if(Qt.length>0)console.warn(`sveld: the Vite plugin ignores ${Qt.map((en)=>`"${en}"`).join(", ")}; run the sveld CLI or sveld() for them.`);if(V(Gt.quiet===!0),Je=Ai(Gt.entry),ee&&Je!=null)try{Ht=await qp(Je,Gt.glob===!0,D(Gt));let en=await Ht.result;await L(en,Gt,Je),en.cache?.save()}catch(en){console.error("sveld: failed to generate initial types in watch mode:",en)}},async generateBundle(){if(ee)return;if(Je==null)this.error(Bs);we=await R(Je,Gt.glob===!0,D(Gt))},async writeBundle(){if(ee)return;if(Je==null)this.error(Bs);await L(we,Gt,Je),we.cache?.save()},handleHotUpdate(Qt){Zt(Qt.file)},watchChange(Qt){Zt(Qt)}}}async function L(M,ee,we){let Je=xc(we);if(ee.types!==!1)await vo(M.allComponentsForTypes,{outDir:"types",preamble:"",...ee.typesOptions,exports:M.exports,inputDir:Je,cache:M.cache,resolvedPathByFilePath:M.resolvedPathByFilePath,crossFileResolvedPathByFilePath:M.crossFileResolvedPathByFilePath});if(ee.json)await so(M.components,{outFile:"COMPONENT_API.json",...ee.jsonOptions,inputDir:Je,entryExports:M.entryExports});if(ee.markdown)await xo(M.components,{outFile:"COMPONENT_INDEX.md",...ee.markdownOptions,entryExports:M.entryExports})}async function qt(M,ee,we){if(ee.json){let Je=no(M.components,{...ee.jsonOptions,inputDir:xc(we),entryExports:M.entryExports});process.stdout.write(Je);return}if(ee.markdown){let Je=yo(M.components,{...ee.markdownOptions,entryExports:M.entryExports});process.stdout.write(Je)}}import{dirname as Sm}from"node:path";function je(M){if(M.check&&!M.check.snapshotExists&&!M.writesSnapshot)return 1;if(M.check?.changes.some((ee)=>ee.kind==="schema"))return 1;if(M.errors.length>0)return 2;if(M.check&&Da(M.check.bump,M.checkLevel??"major"))return 3;if(Do(M.diagnostics,M.strict).length>0)return 4;return 0}async function Ut(M){if(M&&"input"in M)throw Error("sveld: the `input` option was renamed to `entry`.");let{entry:ee,...we}=M??{},Je=await q(),Gt=Ai(ee??Je.entry);if(Gt===null)throw Error(Bs);let Wt=I(Je,we,{entry:Gt});F(Wt),V(Wt.quiet===!0);let Ht=await R(Gt,Wt.glob===!0,D(Wt)),Ft=Wt.check?await J(Ht.components,Te(Wt),{entryExports:Ht.entryExports}):void 0;await L(Ht,Wt,Gt),Ht.cache?.save();let Kt=Wt.reportDiagnostics||Wt.strict,zt=se(Ht.diagnostics,Kt);if(Kt&&zt.length>0)if(Wt.format==="json")process.stderr.write(ae(zt));else console.error(oe(zt));let Xt=je({errors:Ht.errors,check:Ft,writesSnapshot:Ft?Ee(Wt,Ft.snapshotFile):!1,checkLevel:Wt.checkLevel,diagnostics:zt,strict:Wt.strict}),Zt=to(Ht.components,{inputDir:Sm(Gt),entryExports:Ht.entryExports,source:Wt.jsonOptions?.source});return{diagnostics:zt,check:Ft,errors:Ht.errors,document:Zt,exitCode:Xt}}
|
|
234
|
+
export{x,te,g,P,ve,G,ne,Ce,W,T,u,a,i,qe,A,t,b,p,f,w,Fe,De,v,c,s,re,_,ie,o,se,H,oe,Ve,ae,z,X,E,Q,S,y,l,O,Y,ce,Pe,Ae,pe,Ue,_e,ue,le,h,k,r,fe,de,e,Ge,We,He,ze,Xe,Qe,Ye,Ze,Ke,et,Ne,tt,nt,Ie,rt,it,st,ot,Re,Le,at,Me,ct,pt,C,ut,lt,ft,dt,mt,ht,gt,yt,xt,Oe,Tt,Et,St,kt,bt,wt,me,vt,Ct,Dt,$e,Pt,At,_t,Nt,d,It,Rt,Lt,he,ge,B,Mt,Ot,j,ye,xe,N,n,$t,m,Bt,Te,Ee,J,Se,jt,ke,Vt,Z,q,I,F,K,V,be,U,D,R,Be,Jt,L,qt,je,Ut};
|