sveld 0.40.5 → 0.40.6
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.d.ts +166 -52
- package/browser.js +121 -121
- package/chunk-0e70e5s3.js +40 -0
- package/chunk-9fmhgf46.js +193 -0
- package/chunk-a5y3ysxx.js +1 -0
- package/chunk-jw5zhqjv.js +5 -0
- package/cli-entry.js +2 -2
- package/index.d.ts +213 -79
- package/index.js +1 -1
- package/package.json +1 -1
- package/chunk-ep5n8z9k.js +0 -193
- package/chunk-j58p3sv3.js +0 -1
- package/chunk-x82fq7xs.js +0 -5
- package/chunk-xv4tka7y.js +0 -40
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
var v=Symbol("sveld.parsedComponentTypeScriptMetadata"),O=Symbol("sveld.parsedComponentPropIgnores");function Oo(ne){return ne[O]}function Lo(ne){return ne[v]}var rr=Array(2048).fill(void 0);function rl(){rr.fill(void 0)}function Mo(ne,re,Be,Wt){let Kt=Wt&2047,qt=rr[Kt];if(qt!==void 0&&qt.length===Be-re&&ne.startsWith(qt,re))return qt;let Xt=ne.slice(re,Be);return rr[Kt]=Xt,Xt}var Ei="",Gn=[0],Qn=0,vi=0,Yn;function M(ne){rl(),Ei=ne,Gn=[0],Qn=0,vi=0,Yn=void 0}function or(ne){while(Qn<=ne){let re=Ei.indexOf(`
|
|
2
|
+
`,Qn);if(re===-1){Qn=Number.POSITIVE_INFINITY;return}Qn=re+1,Gn.push(Qn)}}function Fo(ne){let re=[0],Be=ne.indexOf(`
|
|
3
|
+
`);while(Be!==-1)re.push(Be+1),Be=ne.indexOf(`
|
|
4
|
+
`,Be+1);return re}function cs(ne,re,Be){let Wt=0,Kt=ne.length-1;if(re>=ne[Be])Wt=Be;else Kt=Be-1;if(Wt<Kt&&re<ne[Wt+1])Kt=Wt;while(Wt<Kt){let qt=Wt+Kt+1>>>1;if(ne[qt]<=re)Wt=qt;else Kt=qt-1}return Wt}function x(ne){return or(ne),vi=cs(Gn,ne,vi),{line:vi+1,column:ne-Gn[vi],character:ne}}var sr=/\r\n?|\n|\u2028|\u2029/g,ol=/[\r\u2028\u2029]/;function Bo(ne){if(Yn===void 0){Yn=ol.test(Ei)?[]:null,sr.lastIndex=0;while(Yn!==null&&sr.exec(Ei)!==null)Yn.push(sr.lastIndex)}if(Yn===null)return or(ne),cs(Gn,ne,vi);let re=0,Be=Yn.length;while(re<Be){let Wt=re+Be>>>1;if(Yn[Wt]<=ne)re=Wt+1;else Be=Wt}return re}function N(ne){let{line:re,column:Be}=x(ne);return{line:re,column:Be}}function jo(ne){while(Gn.length<=ne+1&&Qn!==Number.POSITIVE_INFINITY)or(Qn);if(ne>=Gn.length)return;let re=ne+1<Gn.length?Gn[ne+1]-1:Ei.length;return Ei.slice(Gn[ne],re)}function Te(ne){let re,Be=0;return(Wt)=>(re??=Fo(ne),Be=cs(re,Wt,Be),{line:Be+1,column:Wt-re[Be]})}function Hn(ne){return typeof ne==="object"&&ne!==null&&typeof ci(ne).type==="string"}function ci(ne){return ne}function q(ne,re){let Be=ci(ne);for(let Wt in Be){let Kt=Be[Wt];if(Array.isArray(Kt)){for(let qt=0;qt<Kt.length;qt++)if(Hn(Kt[qt]))Kt[qt]=re(Kt[qt])}else if(Hn(Kt))Be[Wt]=re(Kt)}}function Ce(ne,...re){if(!re.some((Be)=>Be===ne.type))throw Error(`expected ${re.join(" or ")}, got ${ne.type}`)}function be(ne){let re=[];return li(ne,re),re}function li(ne,re){switch(ne.type){case"Identifier":re.push(ne);return;case"ObjectPattern":for(let Be of ne.properties)li(Be.type==="RestElement"?Be.argument:Be.value,re);return;case"ArrayPattern":for(let Be of ne.elements)if(Be!==null)li(Be,re);return;case"RestElement":li(ne.argument,re);return;case"AssignmentPattern":li(ne.left,re);return;case"TSParameterProperty":li(ne.parameter,re);return;case"TSAsExpression":case"TSNonNullExpression":case"TSSatisfiesExpression":case"TSTypeAssertion":li(ne.expression,re)}}function z(ne,re){if(ne.type!=="Identifier")return!1;if(re===null)return!0;switch(re.type){case"MemberExpression":return re.computed||ne===re.object;case"MethodDefinition":return re.computed;case"Property":case"PropertyDefinition":return re.computed||ne===re.value;case"ExportSpecifier":case"ImportSpecifier":return ne===re.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 ne===re.expression;case"TSEnumMember":return ne===re.initializer;case"TSParameterProperty":case"TSEnumDeclaration":case"TSImportEqualsDeclaration":return!0;default:return!re.type.startsWith("TS")}}var ui={Root:["module","instance","fragment","css"],Script:["attributes","content"],Fragment:["nodes"],Text:[],Comment:[],ExpressionTag:["expression"],HtmlTag:["expression"],ConstTag:["declaration"],DeclarationTag:["declaration"],DebugTag:["identifiers"],RenderTag:["expression"],AttachTag:["expression"],Attribute:["value"],SpreadAttribute:["expression"],AnimateDirective:["expression"],BindDirective:["expression"],ClassDirective:["expression"],LetDirective:["expression"],OnDirective:["expression"],StyleDirective:["value"],TransitionDirective:["expression"],UseDirective:["expression"],Component:["attributes","fragment"],TitleElement:["attributes","fragment"],SlotElement:["attributes","fragment"],RegularElement:["attributes","fragment"],SvelteBody:["attributes","fragment"],SvelteBoundary:["attributes","fragment"],SvelteComponent:["expression","attributes","fragment"],SvelteDocument:["attributes","fragment"],SvelteElement:["tag","attributes","fragment"],SvelteFragment:["attributes","fragment"],SvelteHead:["attributes","fragment"],SvelteOptions:["attributes","fragment"],SvelteSelf:["attributes","fragment"],SvelteWindow:["attributes","fragment"],IfBlock:["test","consequent","alternate"],EachBlock:["expression","context","key","body","fallback"],AwaitBlock:["expression","pending","value","then","error","catch"],KeyBlock:["expression","fragment"],SnippetBlock:["expression","parameters","body"],StyleSheet:["attributes","children"],Rule:["prelude","block"],Atrule:["block"],SelectorList:["children"],ComplexSelector:["children"],RelativeSelector:["combinator","selectors"],Combinator:[],TypeSelector:[],IdSelector:[],ClassSelector:[],AttributeSelector:[],PseudoElementSelector:["args"],PseudoClassSelector:["args"],Percentage:[],Nth:[],NestingSelector:[],Block:["children"],Declaration:[],Program:["body"],ExpressionStatement:["expression"],BlockStatement:["body"],StaticBlock:["body"],EmptyStatement:[],DebuggerStatement:[],WithStatement:["object","body"],ReturnStatement:["argument"],LabeledStatement:["label","body"],BreakStatement:["label"],ContinueStatement:["label"],IfStatement:["test","consequent","alternate"],SwitchStatement:["discriminant","cases"],SwitchCase:["test","consequent"],ThrowStatement:["argument"],TryStatement:["block","handler","finalizer"],CatchClause:["param","body"],WhileStatement:["test","body"],DoWhileStatement:["body","test"],ForStatement:["init","test","update","body"],ForInStatement:["left","right","body"],ForOfStatement:["left","right","body"],FunctionDeclaration:["id","typeParameters","params","returnType","body"],FunctionExpression:["id","typeParameters","params","returnType","body"],ArrowFunctionExpression:["typeParameters","params","returnType","body"],VariableDeclaration:["declarations"],VariableDeclarator:["id","init"],ClassDeclaration:["decorators","id","typeParameters","superClass","superTypeParameters","implements","body"],ClassExpression:["decorators","id","typeParameters","superClass","superTypeParameters","implements","body"],ClassBody:["body"],MethodDefinition:["decorators","key","typeParameters","value"],PropertyDefinition:["decorators","key","typeAnnotation","value"],Property:["decorators","key","value"],ThisExpression:[],Super:[],Literal:[],Identifier:["decorators","typeAnnotation"],PrivateIdentifier:[],ArrayExpression:["elements"],ObjectExpression:["properties"],UnaryExpression:["argument"],UpdateExpression:["argument"],BinaryExpression:["left","right"],LogicalExpression:["left","right"],AssignmentExpression:["left","right"],MemberExpression:["object","property"],ConditionalExpression:["test","consequent","alternate"],CallExpression:["callee","typeArguments","arguments"],NewExpression:["callee","typeArguments","arguments"],SequenceExpression:["expressions"],TemplateLiteral:["quasis","expressions"],TaggedTemplateExpression:["tag","typeArguments","quasi"],TemplateElement:[],SpreadElement:["argument"],RestElement:["decorators","argument","typeAnnotation"],YieldExpression:["argument"],AwaitExpression:["argument"],ImportExpression:["source","options","arguments"],ChainExpression:["expression"],ParenthesizedExpression:["expression"],MetaProperty:["meta","property"],ObjectPattern:["decorators","properties","typeAnnotation"],ArrayPattern:["decorators","elements","typeAnnotation"],AssignmentPattern:["decorators","left","right"],ImportDeclaration:["specifiers","source","attributes"],ImportSpecifier:["imported","local"],ImportDefaultSpecifier:["local"],ImportNamespaceSpecifier:["local"],ImportAttribute:["key","value"],ExportNamedDeclaration:["declaration","specifiers","source","attributes"],ExportSpecifier:["local","exported"],ExportDefaultDeclaration:["declaration"],ExportAllDeclaration:["exported","source","attributes"],Decorator:["expression"],TSTypeAnnotation:["typeAnnotation"],TSTypeParameterDeclaration:["params"],TSTypeParameterInstantiation:["params"],TSTypeParameter:["constraint","default"],TSAnyKeyword:[],TSBigIntKeyword:[],TSBooleanKeyword:[],TSNeverKeyword:[],TSNullKeyword:[],TSNumberKeyword:[],TSObjectKeyword:[],TSStringKeyword:[],TSSymbolKeyword:[],TSUndefinedKeyword:[],TSUnknownKeyword:[],TSVoidKeyword:[],TSThisType:[],TSArrayType:["elementType"],TSTupleType:["elementTypes"],TSNamedTupleMember:["label","elementType"],TSOptionalType:["typeAnnotation"],TSRestType:["typeAnnotation"],TSUnionType:["types"],TSIntersectionType:["types"],TSConditionalType:["checkType","extendsType","trueType","falseType"],TSInferType:["typeParameter"],TSParenthesizedType:["typeAnnotation"],TSTypeOperator:["typeAnnotation"],TSIndexedAccessType:["objectType","indexType"],TSMappedType:["typeParameter","nameType","typeAnnotation"],TSLiteralType:["literal"],TSTypeReference:["typeName","typeArguments"],TSQualifiedName:["left","right"],TSTypeQuery:["exprName","typeArguments"],TSImportType:["argument","qualifier","typeArguments"],TSTypeLiteral:["members"],TSPropertySignature:["key","typeAnnotation"],TSMethodSignature:["key","typeParameters","parameters","typeAnnotation"],TSCallSignatureDeclaration:["typeParameters","parameters","typeAnnotation"],TSConstructSignatureDeclaration:["typeParameters","parameters","typeAnnotation"],TSFunctionType:["typeParameters","parameters","typeAnnotation"],TSConstructorType:["typeParameters","parameters","typeAnnotation"],TSIndexSignature:["decorators","parameters","typeAnnotation"],TSTypePredicate:["parameterName","typeAnnotation"],TSInterfaceDeclaration:["id","typeParameters","extends","body"],TSInterfaceBody:["body"],TSExpressionWithTypeArguments:["expression","typeParameters"],TSTypeAliasDeclaration:["id","typeParameters","typeAnnotation"],TSEnumDeclaration:["id","members"],TSEnumMember:["id","initializer"],TSModuleDeclaration:["id","body"],TSModuleBlock:["body"],TSImportEqualsDeclaration:["id","moduleReference"],TSExternalModuleReference:["expression"],TSExportAssignment:["expression"],TSNamespaceExportDeclaration:["id"],TSDeclareFunction:["id","typeParameters","params","returnType"],TSDeclareMethod:["typeParameters","params","returnType"],TSParameterProperty:["parameter"],TSAsExpression:["expression","typeAnnotation"],TSSatisfiesExpression:["expression","typeAnnotation"],TSTypeAssertion:["typeAnnotation","expression"],TSNonNullExpression:["expression"],TSInstantiationExpression:["expression","typeArguments"]};var dn=[],Si={...ui,FunctionDeclaration:["id","params","body"],FunctionExpression:["id","params","body"],ArrowFunctionExpression:["params","body"],ClassDeclaration:["decorators","id","superClass","body"],ClassExpression:["decorators","id","superClass","body"],MethodDefinition:["decorators","key","value"],PropertyDefinition:["decorators","key","value"],Identifier:["decorators"],CallExpression:["callee","arguments"],NewExpression:["callee","arguments"],TaggedTemplateExpression:["tag","quasi"],RestElement:["decorators","argument"],ObjectPattern:["decorators","properties"],ArrayPattern:["decorators","elements"],TSTypeAnnotation:dn,TSTypeParameterDeclaration:dn,TSTypeParameterInstantiation:dn,TSTypeParameter:dn,TSArrayType:dn,TSTupleType:dn,TSNamedTupleMember:dn,TSOptionalType:dn,TSRestType:dn,TSUnionType:dn,TSIntersectionType:dn,TSConditionalType:dn,TSInferType:dn,TSParenthesizedType:dn,TSTypeOperator:dn,TSIndexedAccessType:dn,TSMappedType:dn,TSLiteralType:dn,TSTypeReference:dn,TSTypeQuery:dn,TSImportType:dn,TSTypeLiteral:dn,TSPropertySignature:dn,TSMethodSignature:dn,TSCallSignatureDeclaration:dn,TSConstructSignatureDeclaration:dn,TSFunctionType:dn,TSConstructorType:dn,TSIndexSignature:dn,TSTypePredicate:dn,TSInterfaceDeclaration:dn,TSInterfaceBody:dn,TSExpressionWithTypeArguments:dn,TSTypeAliasDeclaration:dn,TSNamespaceExportDeclaration:dn,TSDeclareFunction:["id"],TSDeclareMethod:dn,TSAsExpression:["expression"],TSSatisfiesExpression:["expression"],TSTypeAssertion:["expression"],TSInstantiationExpression:["expression"]},al=Object.assign(Object.create(null),ui),pl=Object.assign(Object.create(null),Si),Vo=[],T=Symbol("svelte-ast.walk.stop"),l=Symbol("svelte-ast.walk.skip");function o(ne,re,Be){ls(ne,null,null,null,re,cl(Be))}function cl(ne){if(ne===void 0||ne===ui)return ul;if(ne===Si)return hl;return(re)=>ll(ne,re.type)}function ll(ne,re){return Object.hasOwn(ne,re)?ne[re]:void 0}var yg=Object.freeze([]);function ls(ne,re,Be,Wt,Kt,qt){let Xt=qt(ne);if(Xt===void 0)throw Error(`unknown node type: ${ne.type}`);let Ht=Kt.enter?.(ne,re,Be,Wt);if(Ht===T)return!0;if(Ht!==l){if(Ht!==ne&&Hn(Ht))return dl(Ht,re,Be,Wt,Kt,qt);let zt=ci(ne);for(let Yt=0;Yt<Xt.length;Yt++){let Qt=Xt[Yt],en=zt[Qt];if(Array.isArray(en))for(let tn=0;tn<en.length;tn++){let nn=en[tn];if(Hn(nn)&&ls(nn,ne,Qt,tn,Kt,qt))return!0}else if(Hn(en)&&ls(en,ne,Qt,null,Kt,qt))return!0}}return Kt.leave?.(ne,re,Be,Wt)===T}function ul(ne){let re=ne.type;if(re==="Identifier")return ne.typeAnnotation===void 0&&ne.decorators===void 0?Vo:ui.Identifier;if(re==="Literal")return ui.Literal;if(re==="Text")return ui.Text;return al[re]}function hl(ne){let re=ne.type;if(re==="Identifier")return ne.decorators===void 0?Vo:Si.Identifier;if(re==="Literal")return Si.Literal;if(re==="Text")return Si.Text;return pl[re]}function dl(ne,re,Be,Wt,Kt,qt){if(re===null||Be===null)throw Error("walk can't replace the node it was called with");let Xt=ci(re),Ht=Xt[Be];if(Wt===null)Xt[Be]=ne;else if(Array.isArray(Ht))Ht[Wt]=ne;return ls(ne,re,Be,Wt,Kt,qt)}function n(ne){return typeof ne==="object"&&ne!==null}function C(ne){return n(ne)&&ne.type==="Literal"}function t(ne){return n(ne)&&ne.type==="Identifier"&&typeof ne.name==="string"}function A(ne){return n(ne)&&ne.type==="MemberExpression"}function c(ne){return n(ne)&&ne.type==="ObjectExpression"&&Array.isArray(ne.properties)}function fl(ne){return n(ne)&&ne.type==="CallExpression"}function m(ne,re){return fl(ne)&&t(ne.callee)&&ne.callee.name===re}function w(ne){return ne?.type==="TSAsExpression"||ne?.type==="TSSatisfiesExpression"?w(ne.expression):ne}function je(ne){return ne?.type==="TSAsExpression"||ne?.type==="TSSatisfiesExpression"?ne.typeAnnotation:void 0}function ml(ne){return n(ne)&&ne.type==="NewExpression"}function Pe(ne,re){return ml(ne)&&t(ne.callee)&&ne.callee.name===re}function k(ne){if(C(ne))return ne.value==null?null:String(ne.value);if(!n(ne)||ne.type!=="TemplateLiteral"||!Array.isArray(ne.quasis))return null;if(ne.quasis.length!==1)return null;let re=ne.quasis[0];if(!n(re)||!n(re.value))return null;return typeof re.value.cooked==="string"?re.value.cooked:null}function p(ne){if(t(ne))return ne.name;if(C(ne))return ne.value==null?void 0:String(ne.value);return}var gl=new Set(["Component","SvelteComponent","SvelteSelf"]),yl=new Set(["RegularElement","SvelteElement"]);function F(ne){return gl.has(ne)}function _(ne){return yl.has(ne)}var xl=/\s/;function us(ne,re,Be=0,Wt=ne.length,Kt=0){let qt=Kt;for(let Xt=Be;Xt<Wt;Xt++){let Ht=ne.charCodeAt(Xt);if(Ht===34||Ht===39||Ht===96){Xt=Go(ne,Xt,Wt);continue}if(Ht===123||Ht===40||Ht===91||Ht===60)qt++;else if(Ht===125||Ht===41||Ht===93||Ht===62&&ne.charCodeAt(Xt-1)!==61){if(qt>0)qt--}if(re?.(Xt,qt)===!0)break}return qt}function Go(ne,re,Be){let Wt=ne.charCodeAt(re);for(let Kt=re+1;Kt<Be;Kt++){let qt=ne.charCodeAt(Kt);if(qt===92)Kt++;else if(qt===Wt)return Kt}return Be-1}function i(ne,re){let Be=[],Wt=0;return us(ne,(Kt,qt)=>{if(qt===0&&re.includes(ne[Kt]))Be.push(ne.slice(Wt,Kt)),Wt=Kt+1;return!1}),Be.push(ne.slice(Wt)),Be}function ar(ne,re,Be=0){let Wt=-1;return us(ne,(Kt,qt)=>{if(re(Kt,qt))Wt=Kt;return Wt!==-1},Be),Wt}function b(ne,re){return ar(ne,(Be,Wt)=>Wt===0&&re.includes(ne[Be]))}function P(ne){return ar(ne,(re,Be)=>Be===0&&ne[re]==="="&&ne[re+1]===">")}function E(ne,re){return ar(ne,(Be,Wt)=>Wt===0,re)}function Ii(ne){let re=ne.trim();return re.startsWith("[")&&E(re,0)===re.length-1}function ie(ne){if(!ne)return;let re=P(ne);if(re===-1)return;return ne.slice(re+2).trim()||void 0}var vl=new Set(["null","undefined"]);function se(ne){if(!ne)return!1;let re=i(ne,"|").map((Wt)=>Wt.trim()).filter((Wt)=>Wt&&!vl.has(Wt));if(re.length!==1)return!1;let Be=bi(re[0]);return(Be.startsWith("(")||Be.startsWith("<"))&&P(Be)!==-1}function Ln(ne){let re="",Be=!1,Wt=(qt)=>{if(Be&&re!=="")re+=" ";Be=!1,re+=qt},Kt=0;while(Kt<ne.length){let qt=ne.charCodeAt(Kt);if(qt===34||qt===39||qt===96){let Xt=Go(ne,Kt,ne.length);Wt(ne.slice(Kt,Xt+1)),Kt=Xt+1}else if(ne.startsWith("/*",Kt)){let Xt=ne.indexOf("*/",Kt+2);Kt=Xt===-1?ne.length:Xt+2,Be=!0}else if(ne.startsWith("//",Kt)){let Xt=ne.indexOf(`
|
|
5
|
+
`,Kt+2);Kt=Xt===-1?ne.length:Xt+1,Be=!0}else if(xl.test(ne[Kt]))Be=!0,Kt++;else Wt(ne[Kt]),Kt++}return re}function bi(ne){let re=ne.trim();while(re.startsWith("(")&&E(re,0)===re.length-1)re=re.slice(1,-1).trim();return re}function El(ne){let re="";for(let Be=0;Be<ne.length;Be++){let Wt=ne[Be];if(Wt==="*"&&ne[Be+1]==="*"){if(Be++,ne[Be+1]==="/")re+="(?:.*/)?",Be++;else re+=".*";continue}if(Wt==="*"){re+="[^/]*";continue}if(Wt==="?"){re+="[^/]";continue}re+=".+^$()[]{}|\\".includes(Wt)?`\\${Wt}`:Wt}return re}function Wo(ne,re){return new RegExp(`^${El(ne)}$`).test(re)}var hs={"prop-unknown-type":{severity:"warning",label:"Props without inferred types"},"context-any-type":{severity:"warning",label:"Context values typed as `any`"},"bind-this-type-mismatch":{severity:"warning",label:"bind:this props declared with an element type they're never bound to"},"slot-missing-type":{severity:"warning",label:"@slot/@snippet tags missing a {Type} annotation"},"slot-not-rendered":{severity:"warning",label:"@slot/@snippet tags for slots the component doesn't render"},"event-no-source":{severity:"warning",label:"@event tags with no dispatch or callback"},"dispatch-escapes":{severity:"warning",label:"Dispatchers passed to functions sveld can't follow"},"example-compile-error":{severity:"error",label:"@example blocks that failed to compile"},"example-syntax-error":{severity:"error",label:"@example blocks that failed to parse"},"syntax-skipped":{severity:"error",label:"Component syntax sveld skipped"},"type-syntax-error":{severity:"error",label:"JSDoc types that aren't valid TypeScript"},"rest-props-unresolved":{severity:"warning",label:"$$restProps spread only onto components"},"context-duplicate-key":{severity:"warning",label:"Duplicate setContext keys"},"context-key-unresolved":{severity:"warning",label:"setContext keys sveld couldn't resolve"},"context-value-unresolved":{severity:"warning",label:"setContext values sveld couldn't describe"},"spread-unresolved":{severity:"warning",label:"Unresolved spreads widened to Record<string, any>"},"export-unresolved":{severity:"warning",label:"Unresolved named export specifiers"},"module-export-conflict":{severity:"warning",label:"Module-script exports colliding with generated names"},"extend-props-target-missing":{severity:"error",label:"@extends/@extendProps targets that couldn't be verified"},"extend-props-duplicate":{severity:"warning",label:"Duplicate @extends/@extendProps tags"},"extend-props-override":{severity:"warning",label:"Own props overriding an @extends target's prop"},"jsdoc-unknown-tag":{severity:"warning",label:"Unknown JSDoc tags"},"typedef-duplicate":{severity:"warning",label:"Duplicate @typedef/@callback names"},"property-duplicate":{severity:"warning",label:"Duplicate @property names"},"generics-conflict":{severity:"warning",label:"Duplicate @generics/@template names"},"event-description-ambiguous":{severity:"warning",label:"Text after an @event read as the next tag's description"},"jsdoc-tag-dropped":{severity:"warning",label:"Passthrough JSDoc tags that couldn't attach"},"internal-typedef-referenced":{severity:"error",label:"Public types referencing an @internal typedef"},"cross-file-unresolved":{severity:"warning",label:"Imports a standalone parse couldn't read"},"export-ambiguous":{severity:"warning",label:"Ambiguous `export *` names left out of the entry exports"}};function a(ne){return{...ne,code:X[ne.kind],severity:hs[ne.kind].severity}}function Uo(ne,re){if(re)return ne;return ne.filter((Be)=>Be.kind!=="jsdoc-unknown-tag")}function Ko(ne,re){if(!re)return[];return ne.filter((Be)=>!Be.ignored&&(re!=="errors"||Be.severity==="error"))}function Sl(ne,re){if(re.code!==void 0&&re.code!==ne.code)return!1;if(re.name!==void 0&&re.name!==ne.name)return!1;if(re.component!==void 0&&!Wo(re.component,ne.component))return!1;return!0}function Ho(ne,re){if(!re||re.length===0)return ne;return ne.map((Be)=>Be.ignored||re.some((Wt)=>Sl(Be,Wt))?{...Be,ignored:!0}:Be)}function bl(ne){return Object.hasOwn(hs,ne)}var pr=Object.keys(hs).filter(bl),qo=Object.fromEntries(pr.map((ne)=>[ne,`sveld/${ne}`]));function Cl(ne){for(let re of pr)if(!Object.hasOwn(ne,re))throw Error(`sveld: no diagnostic code for "${re}"`)}Cl(qo);var X=qo;function zo(ne){let re=new Set,Be=[];for(let Wt of ne){let Kt=`${Wt.component}:${Wt.kind}:${Wt.name}`;if(re.has(Kt))continue;re.add(Kt),Be.push(Wt)}return Be}function Xo(ne){let re=ne.filter((zt)=>!zt.ignored),Be=ne.length-re.length,Wt=Be>0?` (${Be} ignored)`:"";if(re.length===0)return`sveld: no diagnostics${Wt}.`;let Kt=[],qt=(zt,Yt)=>`${zt} ${Yt}${zt===1?"":"s"}`,Xt=re.filter((zt)=>zt.severity==="error").length,Ht=`${qt(Xt,"error")}, ${qt(re.length-Xt,"warning")}`;Kt.push(`sveld: ${qt(re.length,"diagnostic")} (${Ht})${Wt}.`);for(let zt of pr){let Yt=re.filter((en)=>en.kind===zt);if(Yt.length===0)continue;Kt.push(""),Kt.push(`${hs[zt].label} (${Yt.length}):`);let Qt=new Map;for(let en of Yt){let tn=Qt.get(en.component)??[];tn.push(en),Qt.set(en.component,tn)}for(let[en,tn]of Qt){Kt.push(` ${en}`);for(let nn of tn){let sn=nn.source?` (${en}:${nn.source.start.line}:${nn.source.start.column})`:"";Kt.push(` - ${nn.message}${sn} [${nn.code}]`)}}}return Kt.join(`
|
|
6
|
+
`)}function Jo(ne){return ne.replaceAll("%","%25").replaceAll("\r","%0D").replaceAll(`
|
|
7
|
+
`,"%0A")}function wl(ne){return Jo(ne).replaceAll(":","%3A").replaceAll(",","%2C")}function Tl(ne){let Be=[["file",ne.file],["line",ne.line],["col",ne.column],["endLine",ne.endLine],["endColumn",ne.endColumn],["title",ne.title]].filter((Wt)=>Wt[1]!==void 0).map(([Wt,Kt])=>`${Wt}=${wl(String(Kt))}`).join(",");return`::${ne.severity} ${Be}::${Jo(ne.message)}`}function Yo(ne,re){let Be=ne.filter((Kt)=>!Kt.ignored);return[...Be.filter((Kt)=>Kt.severity==="error"),...Be.filter((Kt)=>Kt.severity!=="error")].map(({source:Kt,...qt})=>{let Xt=Kt!==void 0&&Kt.start.line===Kt.end.line;return Tl({severity:qt.severity,title:qt.code,message:qt.message,file:re(qt.component),line:Kt?.start.line,column:Xt?Kt.start.column+1:void 0,endLine:Kt?.end.line,endColumn:Xt?Kt.end.column+1:void 0})}).join(`
|
|
8
|
+
`)}var Ve=1;function Qo(ne){return`${JSON.stringify({kind:"diagnostics",schemaVersion:Ve,diagnostics:ne},null,2)}
|
|
9
|
+
`}function Ci(ne,re){if(re.length===0)return;ne.diagnostics=[...ne.diagnostics??[],...re]}var kl=/\*\//g,Al=/[.*+?^${}()|[\]\\]/g;function B(ne){return ne.replace(Al,"\\$&")}function j(ne){return ne.replace(kl,"*\\/")}function h(ne){return ne.map((re)=>`${re.name}${re.optional?"?":""}: ${re.type}`).join(", ")}var Zo;function u(ne,re){return Zo??=new Intl.Collator("en"),Zo.compare(ne,re)}function Oi(ne){return ne>=48&&ne<=57||ne>=65&&ne<=90||ne>=97&&ne<=122||ne===95}function Ge(ne,re){if(re===""){for(let Kt=0;Kt<ne.length;Kt++)if(Oi(ne.charCodeAt(Kt)))return!0;return!1}let Be=Oi(re.charCodeAt(0)),Wt=Oi(re.charCodeAt(re.length-1));for(let Kt=ne.indexOf(re);Kt!==-1;Kt=ne.indexOf(re,Kt+1)){let qt=Kt>0&&Oi(ne.charCodeAt(Kt-1)),Xt=Kt+re.length<ne.length&&Oi(ne.charCodeAt(Kt+re.length));if(qt!==Be&&Xt!==Wt)return!0}return!1}function oe(ne){return ne==="TSTypeAnnotation"||ne==="TSTypeAliasDeclaration"||ne==="TSInterfaceDeclaration"||ne==="TSTypeParameterDeclaration"||ne==="TSTypeParameterInstantiation"}function V(ne){let re=new Set(ne);return(Be)=>re.has(Be.type)}function Y(ne){let re=[];return o(ne,{enter(Be){if(Be.type==="FunctionDeclaration"||Be.type==="FunctionExpression"||Be.type==="ArrowFunctionExpression")return l;if(Be.type==="ReturnStatement")re.push(Be.argument??null)}}),re}var Pl=/(?:_|[^\p{ID_Continue}$])+/u,_l=/^[\p{ID_Start}$]/u;function Q(ne){let Wt=`${ne.split(Pl).map((Kt)=>Kt.charAt(0).toUpperCase()+Kt.slice(1)).join("")}Context`;return _l.test(Wt)?Wt:`_${Wt}`}var $l=/^\{([\s\S]*)\}$/,Nl=/^[A-Za-z_$][\w$]*$/,Dl=/^readonly\s+/,Rl=/^\[[\w$]+\s*:[^\]]+\]$/;function d(ne,{skipIndexSignatures:re=!1,withReadonly:Be=!1}={}){let Wt=ne.trim(),Kt=$l.exec(Wt);if(!Kt)return null;let qt=Kt[1].trim();if(qt==="")return[];let Xt=[];for(let Ht of i(qt,";,")){let zt=Ht.trim();if(!zt)continue;let Yt=b(zt,":");if(Yt===-1)return null;let Qt=zt.slice(0,Yt).trim(),en=Qt.replace(Dl,""),tn=zt.slice(Yt+1).trim();if(!tn)return null;if(re&&Rl.test(en))continue;let nn=!1;if(en.endsWith("?"))nn=!0,en=en.slice(0,-1).trim();if(!Nl.test(en))return null;Xt.push(Be?{name:en,type:tn,optional:nn,readonly:Qt!==en}:{name:en,type:tn,optional:nn})}return Xt}function ae({imported:ne}){return ne.type==="Identifier"?ne.name:ne.value}function Z(ne,re){let Be=re.source.value;if(typeof Be!=="string"||re.importKind==="type")return;for(let Wt of re.specifiers){if(Wt.type!=="ImportSpecifier"||Wt.importKind==="type")continue;let Kt=Wt.local.name,qt=ae(Wt);ne.valueImportBindingsByLocalName.set(Kt,{localName:Kt,importedName:qt,source:Be})}}function pe(ne){return[ne.importedName,...ne.members??[]].join(".")}function Ae(ne,re){let Be=[],Wt=re;while(A(Wt)){if(Wt.computed||!t(Wt.property))return;Be.unshift(Wt.property.name),Wt=Wt.object}if(!t(Wt))return;return ee(ne,Wt.name,Be)}function ee(ne,re,Be=[]){let Wt=(qt,Xt,Ht)=>Ht.length>0?{source:qt,importedName:Xt,members:Ht}:{source:qt,importedName:Xt},Kt=ne.valueImportBindingsByLocalName.get(re);if(Kt)return Wt(Kt.source,Kt.importedName,Be);for(let qt of[ne.parsed?.instance,ne.parsed?.module])for(let Xt of qt?.content.body??[]){if(Xt.type!=="ImportDeclaration")continue;let Ht=Xt.source.value;if(Xt.importKind==="type"||typeof Ht!=="string")continue;let zt=Xt.specifiers.find((Yt)=>Yt.local.name===re);if(zt?.type==="ImportDefaultSpecifier")return Wt(Ht,"default",Be);if(zt?.type==="ImportNamespaceSpecifier"&&Be.length>0)return Wt(Ht,Be[0],Be.slice(1))}return}function le(ne,re){if(!A(re))return;return Ae(ne,re)}function We(ne){let re=new Map;for(let Be of ne.content.body){if(Be.type!=="ImportDeclaration"||Be.importKind==="type")continue;let Wt=Be.source.value;if(typeof Wt!=="string")continue;for(let Kt of Be.specifiers){if(Kt.type==="ImportSpecifier"&&Kt.importKind==="type")continue;let qt=Kt.local.name,Xt;if(Kt.type==="ImportDefaultSpecifier")Xt="default";else if(Kt.type==="ImportNamespaceSpecifier")Xt="*";else Xt=ae(Kt);re.set(qt,{from:Wt,imported:Xt})}}return re}function we(ne,re){for(let Be of re?.content.body??[]){if(Be.type==="ImportDeclaration"){Z(ne,Be);continue}let Wt=Be.type==="ExportNamedDeclaration"&&Be.declaration?Be.declaration:Be;if(Wt.type==="FunctionDeclaration"&&Wt.id?.name)ne.funcDecls.set(Wt.id.name,Wt)}}var cr={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"},lr="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",Il={5:lr,"5module":lr+" export import",6:lr+" const class extends export import super"},sa=/^in(stanceof)?$/,Ol=/\p{ID_Start}/u,Ll=/[\p{ID_Continue}\u200c\u200d]/u;function g(ne,re){if(ne<65)return ne===36;if(ne<91)return!0;if(ne<97)return ne===95;if(ne<123)return!0;if(ne>65535&&re===!1)return!1;return ne>=170&&Ol.test(String.fromCodePoint(ne))}function S(ne,re){if(ne<48)return ne===36;if(ne<58)return!0;if(ne<65)return!1;if(ne<91)return!0;if(ne<97)return ne===95;if(ne<123)return!0;if(ne>65535&&re===!1)return!1;return ne>=170&&Ll.test(String.fromCodePoint(ne))}var mn=function(ne,re){if(re===void 0)re={};this.label=ne,this.keyword=re.keyword,this.beforeExpr=!!re.beforeExpr,this.startsExpr=!!re.startsExpr,this.isLoop=!!re.isLoop,this.isAssign=!!re.isAssign,this.prefix=!!re.prefix,this.postfix=!!re.postfix,this.binop=re.binop||null,this.updateContext=null};function $n(ne,re){return new mn(ne,{beforeExpr:!0,binop:re})}var Nn={beforeExpr:!0},kn={startsExpr:!0},fr={};function fn(ne,re){if(re===void 0)re={};return re.keyword=ne,fr[ne]=new mn(ne,re)}var Zt={num:new mn("num",kn),regexp:new mn("regexp",kn),string:new mn("string",kn),name:new mn("name",kn),privateId:new mn("privateId",kn),eof:new mn("eof"),bracketL:new mn("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new mn("]"),braceL:new mn("{",{beforeExpr:!0,startsExpr:!0}),braceR:new mn("}"),parenL:new mn("(",{beforeExpr:!0,startsExpr:!0}),parenR:new mn(")"),comma:new mn(",",Nn),semi:new mn(";",Nn),colon:new mn(":",Nn),dot:new mn("."),question:new mn("?",Nn),questionDot:new mn("?."),arrow:new mn("=>",Nn),template:new mn("template"),invalidTemplate:new mn("invalidTemplate"),ellipsis:new mn("...",Nn),backQuote:new mn("`",kn),dollarBraceL:new mn("${",{beforeExpr:!0,startsExpr:!0}),eq:new mn("=",{beforeExpr:!0,isAssign:!0}),assign:new mn("_=",{beforeExpr:!0,isAssign:!0}),incDec:new mn("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new mn("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:$n("||",1),logicalAND:$n("&&",2),bitwiseOR:$n("|",3),bitwiseXOR:$n("^",4),bitwiseAND:$n("&",5),equality:$n("==/!=/===/!==",6),relational:$n("</>/<=/>=",7),bitShift:$n("<</>>/>>>",8),plusMin:new mn("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:$n("%",10),star:$n("*",10),slash:$n("/",10),starstar:new mn("**",{beforeExpr:!0}),coalesce:$n("??",1),_break:fn("break"),_case:fn("case",Nn),_catch:fn("catch"),_continue:fn("continue"),_debugger:fn("debugger"),_default:fn("default",Nn),_do:fn("do",{isLoop:!0,beforeExpr:!0}),_else:fn("else",Nn),_finally:fn("finally"),_for:fn("for",{isLoop:!0}),_function:fn("function",kn),_if:fn("if"),_return:fn("return",Nn),_switch:fn("switch"),_throw:fn("throw",Nn),_try:fn("try"),_var:fn("var"),_const:fn("const"),_while:fn("while",{isLoop:!0}),_with:fn("with"),_new:fn("new",{beforeExpr:!0,startsExpr:!0}),_this:fn("this",kn),_super:fn("super",kn),_class:fn("class",kn),_extends:fn("extends",Nn),_export:fn("export"),_import:fn("import",kn),_null:fn("null",kn),_true:fn("true",kn),_false:fn("false",kn),_in:fn("in",{beforeExpr:!0,binop:7}),_instanceof:fn("instanceof",{beforeExpr:!0,binop:7}),_typeof:fn("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:fn("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:fn("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},An=/\r\n?|\n|\u2028|\u2029/,Ml=new RegExp(An.source,"g");function wi(ne){return ne===10||ne===13||ne===8232||ne===8233}function ra(ne,re,Be){if(Be===void 0)Be=ne.length;for(var Wt=re;Wt<Be;Wt++){var Kt=ne.charCodeAt(Wt);if(wi(Kt))return Wt<Be-1&&Kt===13&&ne.charCodeAt(Wt+1)===10?Wt+2:Wt+1}return-1}var oa=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,En=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,Fl=Object.prototype,{hasOwnProperty:Bl,toString:jl}=Fl,Fi=Object.hasOwn||function(ne,re){return Bl.call(ne,re)},ea=Array.isArray||function(ne){return jl.call(ne)==="[object Array]"},ta=Object.create(null);function ds(ne){return ta[ne]||(ta[ne]=new RegExp("^(?:"+ne.replace(/ /g,"|")+")$"))}function ys(ne){if(ne<=65535)return String.fromCharCode(ne);return ne-=65536,String.fromCharCode((ne>>10)+55296,(ne&1023)+56320)}var Vl=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,Mi=function(ne,re){this.line=ne,this.column=re};Mi.prototype.offset=function(ne){return new Mi(this.line,this.column+ne)};var xs=function(ne,re,Be){if(this.start=re,this.end=Be,ne.sourceFile!==null)this.source=ne.sourceFile};function aa(ne,re){for(var Be=1,Wt=0;;){var Kt=ra(ne,Wt,re);if(Kt<0)return new Mi(Be,re-Wt);++Be,Wt=Kt}}var ur={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},na=!1;function Gl(ne){var re={};for(var Be in ur)re[Be]=ne&&Fi(ne,Be)?ne[Be]:ur[Be];if(re.ecmaVersion==="latest")re.ecmaVersion=1e8;else if(re.ecmaVersion==null){if(!na&&typeof console==="object"&&console.warn)na=!0,console.warn(`Since Acorn 8.0.0, options.ecmaVersion is required.
|
|
10
|
+
Defaulting to 2020, but this will stop working in the future.`);re.ecmaVersion=11}else if(re.ecmaVersion>=2015)re.ecmaVersion-=2009;if(re.allowReserved==null)re.allowReserved=re.ecmaVersion<5;if(!ne||ne.allowHashBang==null)re.allowHashBang=re.ecmaVersion>=14;if(ea(re.onToken)){var Wt=re.onToken;re.onToken=function(Kt){return Wt.push(Kt)}}if(ea(re.onComment))re.onComment=Wl(re,re.onComment);if(re.sourceType==="commonjs"&&re.allowAwaitOutsideFunction)throw Error("Cannot use allowAwaitOutsideFunction with sourceType: commonjs");return re}function Wl(ne,re){return function(Be,Wt,Kt,qt,Xt,Ht){var zt={type:Be?"Block":"Line",value:Wt,start:Kt,end:qt};if(ne.locations)zt.loc=new xs(this,Xt,Ht);if(ne.ranges)zt.range=[Kt,qt];re.push(zt)}}var hi=1,di=2,mr=4,pa=8,gr=16,ca=32,vs=64,la=128,fi=256,Bi=512,ua=1024,Es=hi|di|fi;function yr(ne,re){return di|(ne?mr:0)|(re?pa:0)}var fs=0,xr=1,qn=2,ha=3,da=4,fa=5,s=function(ne,re,Be){this.options=ne=Gl(ne),this.sourceFile=ne.sourceFile,this.keywords=ds(Il[ne.ecmaVersion>=6?6:ne.sourceType==="module"?"5module":5]);var Wt="";if(ne.allowReserved!==!0){if(Wt=cr[ne.ecmaVersion>=6?6:ne.ecmaVersion===5?5:3],ne.sourceType==="module")Wt+=" await"}this.reservedWords=ds(Wt);var Kt=(Wt?Wt+" ":"")+cr.strict;if(this.reservedWordsStrict=ds(Kt),this.reservedWordsStrictBind=ds(Kt+" "+cr.strictBind),this.input=String(re),this.containsEsc=!1,this.pos=Be||0,this.curLine=1,ne.startLocation)this.lineStart=this.pos-ne.startLocation.column,this.curLine=ne.startLocation.line;else if(Be){if(this.lineStart=this.input.lastIndexOf(`
|
|
11
|
+
`,Be-1)+1,this.options.locations)this.curLine=this.input.slice(0,this.lineStart).split(An).length}else this.lineStart=0;if(this.type=Zt.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=ne.sourceType==="module",this.strict=this.inModule||ne.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&&ne.allowHashBang&&this.input.slice(0,2)==="#!")this.skipLineComment(2);this.scopeStack=[],this.enterScope(this.options.sourceType==="commonjs"?di:hi),this.regexpState=null,this.privateNameStack=[]},Dn={inFunction:{configurable:!0},inGenerator:{configurable:!0},inAsync:{configurable:!0},canAwait:{configurable:!0},allowReturn:{configurable:!0},allowSuper:{configurable:!0},allowDirectSuper:{configurable:!0},treatFunctionsAsVar:{configurable:!0},allowNewDotTarget:{configurable:!0},allowUsing:{configurable:!0},inClassStaticBlock:{configurable:!0}};s.prototype.parse=function(){var ne=this,re=this.options.program||this.startNode();return this.nextToken(),this.catchStackOverflow(function(){return ne.parseTopLevel(re)})};Dn.inFunction.get=function(){return(this.currentVarScope().flags&di)>0};Dn.inGenerator.get=function(){return(this.currentVarScope().flags&pa)>0};Dn.inAsync.get=function(){return(this.currentVarScope().flags&mr)>0};Dn.canAwait.get=function(){for(var ne=this.scopeStack.length-1;ne>=0;ne--){var re=this.scopeStack[ne],Be=re.flags;if(Be&(fi|Bi))return!1;if(Be&di)return(Be&mr)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction};Dn.allowReturn.get=function(){if(this.inFunction)return!0;if(this.options.allowReturnOutsideFunction&&this.currentVarScope().flags&hi)return!0;return!1};Dn.allowSuper.get=function(){var ne=this.currentThisScope(),re=ne.flags;return(re&vs)>0||this.options.allowSuperOutsideMethod};Dn.allowDirectSuper.get=function(){return(this.currentThisScope().flags&la)>0};Dn.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())};Dn.allowNewDotTarget.get=function(){for(var ne=this.scopeStack.length-1;ne>=0;ne--){var re=this.scopeStack[ne],Be=re.flags;if(Be&(fi|Bi)||Be&di&&!(Be&gr))return!0}return!1};Dn.allowUsing.get=function(){var ne=this.currentScope(),re=ne.flags;if(re&ua)return!1;if(!this.inModule&&re&hi)return!1;return!0};Dn.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&fi)>0};s.extend=function(){var ne=[],re=arguments.length;while(re--)ne[re]=arguments[re];var Be=this;for(var Wt=0;Wt<ne.length;Wt++)Be=ne[Wt](Be);return Be};s.parse=function(ne,re){return new this(re,ne).parse()};s.parseExpressionAt=function(ne,re,Be){var Wt=new this(Be,ne,re);return Wt.nextToken(),Wt.parseExpression()};s.tokenizer=function(ne,re){return new this(re,ne)};Object.defineProperties(s.prototype,Dn);var wn=s.prototype,Ul=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;wn.strictDirective=function(ne){if(this.options.ecmaVersion<5)return!1;for(;;){En.lastIndex=ne,ne+=En.exec(this.input)[0].length;var re=Ul.exec(this.input.slice(ne));if(!re)return!1;if((re[1]||re[2])==="use strict"){En.lastIndex=ne+re[0].length;var Be=En.exec(this.input),Wt=Be.index+Be[0].length,Kt=this.input.charAt(Wt);return Kt===";"||Kt==="}"||An.test(Be[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(Kt)||Kt==="!"&&this.input.charAt(Wt+1)==="="||Kt==="i"&&Kl(this,Wt))}if(ne+=re[0].length,En.lastIndex=ne,ne+=En.exec(this.input)[0].length,this.input[ne]===";")ne++}};function Kl(ne,re){var Be=re+1,Wt=Math.min(ne.input.length,re+11);while(Be<Wt){var Kt=ne.fullCharCodeAt(Be);if(!S(Kt,!0))break;Be+=Kt<=65535?1:2}return Be===re+2&&ne.input.slice(re,Be)==="in"||Be===re+10&&ne.input.slice(re,Be)==="instanceof"}wn.eat=function(ne){if(this.type===ne)return this.next(),!0;else return!1};wn.isContextual=function(ne){return this.type===Zt.name&&this.value===ne&&!this.containsEsc};wn.eatContextual=function(ne){if(!this.isContextual(ne))return!1;return this.next(),!0};wn.catchStackOverflow=function(ne){try{return ne()}catch(re){if(re instanceof Error&&(/\bstack\b.*\b(exceeded|overflow)\b/i.test(re.message)||/\btoo much recursion\b/i.test(re.message)))this.raise(this.start,"Not enough stack space to parse input");else throw re}};wn.expectContextual=function(ne){if(!this.eatContextual(ne))this.unexpected()};wn.canInsertSemicolon=function(){return this.type===Zt.eof||this.type===Zt.braceR||An.test(this.input.slice(this.lastTokEnd,this.start))};wn.insertSemicolon=function(){if(this.canInsertSemicolon()){if(this.options.onInsertedSemicolon)this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc);return!0}};wn.semicolon=function(){if(!this.eat(Zt.semi)&&!this.insertSemicolon())this.unexpected()};wn.afterTrailingComma=function(ne,re){if(this.type===ne){if(this.options.onTrailingComma)this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc);if(!re)this.next();return!0}};wn.expect=function(ne){this.eat(ne)||this.unexpected()};wn.unexpected=function(ne){this.raise(ne!=null?ne:this.start,"Unexpected token")};var Ss=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};wn.checkPatternErrors=function(ne,re){if(!ne)return;if(ne.trailingComma>-1)this.raiseRecoverable(ne.trailingComma,"Comma is not permitted after the rest element");var Be=re?ne.parenthesizedAssign:ne.parenthesizedBind;if(Be>-1)this.raiseRecoverable(Be,re?"Assigning to rvalue":"Parenthesized pattern")};wn.checkExpressionErrors=function(ne,re){if(!ne)return!1;var{shorthandAssign:Be,doubleProto:Wt}=ne;if(!re)return Be>=0||Wt>=0;if(Be>=0)this.raise(Be,"Shorthand property assignments are valid only in destructuring patterns");if(Wt>=0)this.raiseRecoverable(Wt,"Redefinition of __proto__ property")};wn.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")};wn.isSimpleAssignTarget=function(ne){if(ne.type==="ParenthesizedExpression")return this.isSimpleAssignTarget(ne.expression);return ne.type==="Identifier"||ne.type==="MemberExpression"};var an=s.prototype;an.parseTopLevel=function(ne){var re=Object.create(null);if(!ne.body)ne.body=[];while(this.type!==Zt.eof){var Be=this.parseStatement(null,!0,re);ne.body.push(Be)}if(this.inModule)for(var Wt=0,Kt=Object.keys(this.undefinedExports);Wt<Kt.length;Wt+=1){var qt=Kt[Wt];this.raiseRecoverable(this.undefinedExports[qt].start,"Export '"+qt+"' is not defined")}return this.adaptDirectivePrologue(ne.body),this.next(),ne.sourceType=this.options.sourceType==="commonjs"?"script":this.options.sourceType,this.finishNode(ne,"Program")};var vr={kind:"loop"},Hl={kind:"switch"};an.isLet=function(ne){if(this.options.ecmaVersion<6||!this.isContextual("let"))return!1;En.lastIndex=this.pos;var re=En.exec(this.input),Be=this.pos+re[0].length,Wt=this.fullCharCodeAt(Be);if(Wt===91||Wt===92)return!0;if(ne)return!1;if(Wt===123)return!0;if(g(Wt)){var Kt=Be;do Be+=Wt<=65535?1:2;while(S(Wt=this.fullCharCodeAt(Be)));if(Wt===92)return!0;var qt=this.input.slice(Kt,Be);if(!sa.test(qt))return!0}return!1};an.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;En.lastIndex=this.pos;var ne=En.exec(this.input),re=this.pos+ne[0].length,Be;return!An.test(this.input.slice(this.pos,re))&&this.input.slice(re,re+8)==="function"&&(re+8===this.input.length||!(S(Be=this.fullCharCodeAt(re+8))||Be===92))};an.isUsingKeyword=function(ne,re){if(this.options.ecmaVersion<17||!this.isContextual(ne?"await":"using"))return!1;En.lastIndex=this.pos;var Be=En.exec(this.input),Wt=this.pos+Be[0].length;if(An.test(this.input.slice(this.pos,Wt)))return!1;if(ne){var Kt=Wt+5,qt;if(this.input.slice(Wt,Kt)!=="using"||Kt===this.input.length||S(qt=this.fullCharCodeAt(Kt))||qt===92)return!1;En.lastIndex=Kt;var Xt=En.exec(this.input);if(Wt=Kt+Xt[0].length,Xt&&An.test(this.input.slice(Kt,Wt)))return!1}var Ht=this.fullCharCodeAt(Wt);if(!g(Ht)&&Ht!==92)return!1;var zt=Wt;do Wt+=Ht<=65535?1:2;while(S(Ht=this.fullCharCodeAt(Wt)));if(Ht===92)return!0;var Yt=this.input.slice(zt,Wt);if(sa.test(Yt))return!1;if(re&&!ne&&Yt==="of"){En.lastIndex=Wt;var Qt=En.exec(this.input);if(Wt=Wt+Qt[0].length,this.input.charCodeAt(Wt)!==61||(Ht=this.input.charCodeAt(Wt+1))===61||Ht===62)return!1}return!0};an.isAwaitUsing=function(ne){return this.isUsingKeyword(!0,ne)};an.isUsing=function(ne){return this.isUsingKeyword(!1,ne)};an.parseStatement=function(ne,re,Be){var Wt=this.type,Kt=this.startNode(),qt;if(this.isLet(ne))Wt=Zt._var,qt="let";switch(Wt){case Zt._break:case Zt._continue:return this.parseBreakContinueStatement(Kt,Wt.keyword);case Zt._debugger:return this.parseDebuggerStatement(Kt);case Zt._do:return this.parseDoStatement(Kt);case Zt._for:return this.parseForStatement(Kt);case Zt._function:if(ne&&(this.strict||ne!=="if"&&ne!=="label")&&this.options.ecmaVersion>=6)this.unexpected();return this.parseFunctionStatement(Kt,!1,!ne);case Zt._class:if(ne)this.unexpected();return this.parseClass(Kt,!0);case Zt._if:return this.parseIfStatement(Kt);case Zt._return:return this.parseReturnStatement(Kt);case Zt._switch:return this.parseSwitchStatement(Kt);case Zt._throw:return this.parseThrowStatement(Kt);case Zt._try:return this.parseTryStatement(Kt);case Zt._const:case Zt._var:if(qt=qt||this.value,ne&&qt!=="var")this.unexpected();return this.parseVarStatement(Kt,qt);case Zt._while:return this.parseWhileStatement(Kt);case Zt._with:return this.parseWithStatement(Kt);case Zt.braceL:return this.parseBlock(!0,Kt);case Zt.semi:return this.parseEmptyStatement(Kt);case Zt._export:case Zt._import:if(this.options.ecmaVersion>10&&Wt===Zt._import){En.lastIndex=this.pos;var Xt=En.exec(this.input),Ht=this.pos+Xt[0].length,zt=this.input.charCodeAt(Ht);if(zt===40||zt===46)return this.parseExpressionStatement(Kt,this.parseExpression())}if(!this.options.allowImportExportEverywhere){if(!re)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 Wt===Zt._import?this.parseImport(Kt):this.parseExport(Kt,Be);default:if(this.isAsyncFunction()){if(ne)this.unexpected();return this.next(),this.parseFunctionStatement(Kt,!0,!ne)}var Yt=this.isAwaitUsing(!1)?"await using":this.isUsing(!1)?"using":null;if(Yt){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(ne)this.raise(this.start,"Using declaration is not allowed in single-statement positions");if(Yt==="await using"){if(!this.canAwait)this.raise(this.start,"Await using cannot appear outside of async function");this.next()}return this.next(),this.parseVar(Kt,!1,Yt),this.semicolon(),this.finishNode(Kt,"VariableDeclaration")}var Qt=this.value,en=this.parseExpression();if(Wt===Zt.name&&en.type==="Identifier"&&this.eat(Zt.colon))return this.parseLabeledStatement(Kt,Qt,en,ne);else return this.parseExpressionStatement(Kt,en)}};an.parseBreakContinueStatement=function(ne,re){var Be=re==="break";if(this.next(),this.eat(Zt.semi)||this.insertSemicolon())ne.label=null;else if(this.type!==Zt.name)this.unexpected();else ne.label=this.parseIdent(),this.semicolon();var Wt=0;for(;Wt<this.labels.length;++Wt){var Kt=this.labels[Wt];if(ne.label==null||Kt.name===ne.label.name){if(Kt.kind!=null&&(Be||Kt.kind==="loop"))break;if(ne.label&&Be)break}}if(Wt===this.labels.length)this.raise(ne.start,"Unsyntactic "+re);return this.finishNode(ne,Be?"BreakStatement":"ContinueStatement")};an.parseDebuggerStatement=function(ne){return this.next(),this.semicolon(),this.finishNode(ne,"DebuggerStatement")};an.parseDoStatement=function(ne){if(this.next(),this.labels.push(vr),ne.body=this.parseStatement("do"),this.labels.pop(),this.expect(Zt._while),ne.test=this.parseParenExpression(),this.options.ecmaVersion>=6)this.eat(Zt.semi);else this.semicolon();return this.finishNode(ne,"DoWhileStatement")};an.parseForStatement=function(ne){this.next();var re=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(vr),this.enterScope(0),this.expect(Zt.parenL),this.type===Zt.semi){if(re>-1)this.unexpected(re);return this.parseFor(ne,null)}var Be=this.isLet();if(this.type===Zt._var||this.type===Zt._const||Be){var Wt=this.startNode(),Kt=Be?"let":this.value;return this.next(),this.parseVar(Wt,!0,Kt),this.finishNode(Wt,"VariableDeclaration"),this.parseForAfterInit(ne,Wt,re)}var qt=this.isContextual("let"),Xt=!1,Ht=this.isUsing(!0)?"using":this.isAwaitUsing(!0)?"await using":null;if(Ht){var zt=this.startNode();if(this.next(),Ht==="await using"){if(!this.canAwait)this.raise(this.start,"Await using cannot appear outside of async function");this.next()}return this.parseVar(zt,!0,Ht),this.finishNode(zt,"VariableDeclaration"),this.parseForAfterInit(ne,zt,re)}var Yt=this.containsEsc,Qt=new Ss,en=this.start,tn=re>-1?this.parseExprSubscripts(Qt,"await"):this.parseExpression(!0,Qt);if(this.type===Zt._in||(Xt=this.options.ecmaVersion>=6&&this.isContextual("of"))){if(re>-1){if(this.type===Zt._in)this.unexpected(re);ne.await=!0}else if(Xt&&this.options.ecmaVersion>=8){if(tn.start===en&&!Yt&&tn.type==="Identifier"&&tn.name==="async")this.unexpected();else if(this.options.ecmaVersion>=9)ne.await=!1}if(qt&&Xt)this.raise(tn.start,"The left-hand side of a for-of loop may not start with 'let'.");return this.toAssignable(tn,!1,Qt),this.checkLValPattern(tn),this.parseForIn(ne,tn)}else this.checkExpressionErrors(Qt,!0);if(re>-1)this.unexpected(re);return this.parseFor(ne,tn)};an.parseForAfterInit=function(ne,re,Be){if((this.type===Zt._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&re.declarations.length===1){if(this.type===Zt._in){if((re.kind==="using"||re.kind==="await using")&&!re.declarations[0].init)this.raise(this.start,"Using declaration is not allowed in for-in loops");if(this.options.ecmaVersion>=9&&Be>-1)this.unexpected(Be)}else if(this.options.ecmaVersion>=9)ne.await=Be>-1;return this.parseForIn(ne,re)}if(Be>-1)this.unexpected(Be);return this.parseFor(ne,re)};an.parseFunctionStatement=function(ne,re,Be){return this.next(),this.parseFunction(ne,Li|(Be?0:hr),!1,re)};an.parseIfStatement=function(ne){return this.next(),ne.test=this.parseParenExpression(),ne.consequent=this.parseStatement("if"),ne.alternate=this.eat(Zt._else)?this.parseStatement("if"):null,this.finishNode(ne,"IfStatement")};an.parseReturnStatement=function(ne){if(!this.allowReturn)this.raise(this.start,"'return' outside of function");if(this.next(),this.eat(Zt.semi)||this.insertSemicolon())ne.argument=null;else ne.argument=this.parseExpression(),this.semicolon();return this.finishNode(ne,"ReturnStatement")};an.parseSwitchStatement=function(ne){this.next(),ne.discriminant=this.parseParenExpression(),ne.cases=[],this.expect(Zt.braceL),this.labels.push(Hl),this.enterScope(ua);var re;for(var Be=!1;this.type!==Zt.braceR;)if(this.type===Zt._case||this.type===Zt._default){var Wt=this.type===Zt._case;if(re)this.finishNode(re,"SwitchCase");if(ne.cases.push(re=this.startNode()),re.consequent=[],this.next(),Wt)re.test=this.parseExpression();else{if(Be)this.raiseRecoverable(this.lastTokStart,"Multiple default clauses");Be=!0,re.test=null}this.expect(Zt.colon)}else{if(!re)this.unexpected();re.consequent.push(this.parseStatement(null))}if(this.exitScope(),re)this.finishNode(re,"SwitchCase");return this.next(),this.labels.pop(),this.finishNode(ne,"SwitchStatement")};an.parseThrowStatement=function(ne){if(this.next(),An.test(this.input.slice(this.lastTokEnd,this.start)))this.raise(this.lastTokEnd,"Illegal newline after throw");return ne.argument=this.parseExpression(),this.semicolon(),this.finishNode(ne,"ThrowStatement")};var ql=[];an.parseCatchClauseParam=function(){var ne=this.parseBindingAtom(),re=ne.type==="Identifier";return this.enterScope(re?ca:0),this.checkLValPattern(ne,re?da:qn),this.expect(Zt.parenR),ne};an.parseTryStatement=function(ne){if(this.next(),ne.block=this.parseBlock(),ne.handler=null,this.type===Zt._catch){var re=this.startNode();if(this.next(),this.eat(Zt.parenL))re.param=this.parseCatchClauseParam();else{if(this.options.ecmaVersion<10)this.unexpected();re.param=null,this.enterScope(0)}re.body=this.parseBlock(!1),this.exitScope(),ne.handler=this.finishNode(re,"CatchClause")}if(ne.finalizer=this.eat(Zt._finally)?this.parseBlock():null,!ne.handler&&!ne.finalizer)this.raise(ne.start,"Missing catch or finally clause");return this.finishNode(ne,"TryStatement")};an.parseVarStatement=function(ne,re,Be){return this.next(),this.parseVar(ne,!1,re,Be),this.semicolon(),this.finishNode(ne,"VariableDeclaration")};an.parseWhileStatement=function(ne){return this.next(),ne.test=this.parseParenExpression(),this.labels.push(vr),ne.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(ne,"WhileStatement")};an.parseWithStatement=function(ne){if(this.strict)this.raise(this.start,"'with' in strict mode");return this.next(),ne.object=this.parseParenExpression(),ne.body=this.parseStatement("with"),this.finishNode(ne,"WithStatement")};an.parseEmptyStatement=function(ne){return this.next(),this.finishNode(ne,"EmptyStatement")};an.parseLabeledStatement=function(ne,re,Be,Wt){for(var Kt=0,qt=this.labels;Kt<qt.length;Kt+=1){var Xt=qt[Kt];if(Xt.name===re)this.raise(Be.start,"Label '"+re+"' is already declared")}var Ht=this.type.isLoop?"loop":this.type===Zt._switch?"switch":null;for(var zt=this.labels.length-1;zt>=0;zt--){var Yt=this.labels[zt];if(Yt.statementStart===ne.start)Yt.statementStart=this.start,Yt.kind=Ht;else break}return this.labels.push({name:re,kind:Ht,statementStart:this.start}),ne.body=this.parseStatement(Wt?Wt.indexOf("label")===-1?Wt+"label":Wt:"label"),this.labels.pop(),ne.label=Be,this.finishNode(ne,"LabeledStatement")};an.parseExpressionStatement=function(ne,re){return ne.expression=re,this.semicolon(),this.finishNode(ne,"ExpressionStatement")};an.parseBlock=function(ne,re,Be){if(ne===void 0)ne=!0;if(re===void 0)re=this.startNode();if(re.body=[],this.expect(Zt.braceL),ne)this.enterScope(0);while(this.type!==Zt.braceR){var Wt=this.parseStatement(null);re.body.push(Wt)}if(Be)this.strict=!1;if(this.next(),ne)this.exitScope();return this.finishNode(re,"BlockStatement")};an.parseFor=function(ne,re){return ne.init=re,this.expect(Zt.semi),ne.test=this.type===Zt.semi?null:this.parseExpression(),this.expect(Zt.semi),ne.update=this.type===Zt.parenR?null:this.parseExpression(),this.expect(Zt.parenR),ne.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(ne,"ForStatement")};an.parseForIn=function(ne,re){var Be=this.type===Zt._in;if(this.next(),re.type==="VariableDeclaration"&&re.declarations[0].init!=null&&(!Be||this.options.ecmaVersion<8||this.strict||re.kind!=="var"||re.declarations[0].id.type!=="Identifier"))this.raise(re.start,(Be?"for-in":"for-of")+" loop variable declaration may not have an initializer");return ne.left=re,ne.right=Be?this.parseExpression():this.parseMaybeAssign(),this.expect(Zt.parenR),ne.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(ne,Be?"ForInStatement":"ForOfStatement")};an.parseVar=function(ne,re,Be,Wt){ne.declarations=[],ne.kind=Be;for(;;){var Kt=this.startNode();if(this.parseVarId(Kt,Be),this.eat(Zt.eq))Kt.init=this.parseMaybeAssign(re);else if(!Wt&&Be==="const"&&!(this.type===Zt._in||this.options.ecmaVersion>=6&&this.isContextual("of")))this.unexpected();else if(!Wt&&(Be==="using"||Be==="await using")&&this.options.ecmaVersion>=17&&this.type!==Zt._in&&!this.isContextual("of"))this.raise(this.lastTokEnd,"Missing initializer in "+Be+" declaration");else if(!Wt&&Kt.id.type!=="Identifier"&&!(re&&(this.type===Zt._in||this.isContextual("of"))))this.raise(this.lastTokEnd,"Complex binding patterns require an initialization value");else Kt.init=null;if(ne.declarations.push(this.finishNode(Kt,"VariableDeclarator")),!this.eat(Zt.comma))break}return ne};an.parseVarId=function(ne,re){ne.id=re==="using"||re==="await using"?this.parseIdent():this.parseBindingAtom(),this.checkLValPattern(ne.id,re==="var"?xr:qn,!1)};var Li=1,hr=2,ma=4;an.parseFunction=function(ne,re,Be,Wt,Kt){if(this.initFunction(ne),this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!Wt){if(this.type===Zt.star&&re&hr)this.unexpected();ne.generator=this.eat(Zt.star)}if(this.options.ecmaVersion>=8)ne.async=!!Wt;if(re&Li){if(ne.id=re&ma&&this.type!==Zt.name?null:this.parseIdent(),ne.id&&!(re&hr))this.checkLValSimple(ne.id,this.strict||ne.generator||ne.async?this.treatFunctionsAsVar?xr:qn:ha)}var qt=this.yieldPos,Xt=this.awaitPos,Ht=this.awaitIdentPos;if(this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(yr(ne.async,ne.generator)),!(re&Li))ne.id=this.type===Zt.name?this.parseIdent():null;return this.parseFunctionParams(ne),this.parseFunctionBody(ne,Be,!1,Kt),this.yieldPos=qt,this.awaitPos=Xt,this.awaitIdentPos=Ht,this.finishNode(ne,re&Li?"FunctionDeclaration":"FunctionExpression")};an.parseFunctionParams=function(ne){this.expect(Zt.parenL),ne.params=this.parseBindingList(Zt.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()};an.parseClass=function(ne,re){this.next();var Be=this.strict;this.strict=!0,this.parseClassId(ne,re),this.parseClassSuper(ne);var Wt=this.enterClassBody(),Kt=this.startNode(),qt=!1;Kt.body=[],this.expect(Zt.braceL);while(this.type!==Zt.braceR){var Xt=this.parseClassElement(ne.superClass!==null);if(Xt){if(Kt.body.push(Xt),Xt.type==="MethodDefinition"&&Xt.kind==="constructor"){if(qt)this.raiseRecoverable(Xt.start,"Duplicate constructor in the same class");qt=!0}else if(Xt.key&&Xt.key.type==="PrivateIdentifier"&&zl(Wt,Xt))this.raiseRecoverable(Xt.key.start,"Identifier '#"+Xt.key.name+"' has already been declared")}}return this.strict=Be,this.next(),ne.body=this.finishNode(Kt,"ClassBody"),this.exitClassBody(),this.finishNode(ne,re?"ClassDeclaration":"ClassExpression")};an.parseClassElement=function(ne){if(this.eat(Zt.semi))return null;var re=this.options.ecmaVersion,Be=this.startNode(),Wt="",Kt=!1,qt=!1,Xt="method",Ht=!1;if(this.eatContextual("static")){if(re>=13&&this.eat(Zt.braceL))return this.parseClassStaticBlock(Be),Be;if(this.isClassElementNameStart()||this.type===Zt.star)Ht=!0;else Wt="static"}if(Be.static=Ht,!Wt&&re>=8&&this.eatContextual("async"))if((this.isClassElementNameStart()||this.type===Zt.star)&&!this.canInsertSemicolon())qt=!0;else Wt="async";if(!Wt&&(re>=9||!qt)&&this.eat(Zt.star))Kt=!0;if(!Wt&&!qt&&!Kt){var zt=this.value;if(this.eatContextual("get")||this.eatContextual("set"))if(this.isClassElementNameStart())Xt=zt;else Wt=zt}if(Wt)Be.computed=!1,Be.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),Be.key.name=Wt,this.finishNode(Be.key,"Identifier");else this.parseClassElementName(Be);if(re<13||this.type===Zt.parenL||Xt!=="method"||Kt||qt){var Yt=!Be.static&&ms(Be,"constructor"),Qt=Yt&≠if(Yt&&Xt!=="method")this.raise(Be.key.start,"Constructor can't have get/set modifier");Be.kind=Yt?"constructor":Xt,this.parseClassMethod(Be,Kt,qt,Qt)}else this.parseClassField(Be);return Be};an.isClassElementNameStart=function(){return this.type===Zt.name||this.type===Zt.privateId||this.type===Zt.num||this.type===Zt.string||this.type===Zt.bracketL||this.type.keyword};an.parseClassElementName=function(ne){if(this.type===Zt.privateId){if(this.value==="constructor")this.raise(this.start,"Classes can't have an element named '#constructor'");ne.computed=!1,ne.key=this.parsePrivateIdent()}else this.parsePropertyName(ne)};an.parseClassMethod=function(ne,re,Be,Wt){var Kt=ne.key;if(ne.kind==="constructor"){if(re)this.raise(Kt.start,"Constructor can't be a generator");if(Be)this.raise(Kt.start,"Constructor can't be an async method")}else if(ne.static&&ms(ne,"prototype"))this.raise(Kt.start,"Classes may not have a static property named prototype");var qt=ne.value=this.parseMethod(re,Be,Wt);if(ne.kind==="get"&&qt.params.length!==0)this.raiseRecoverable(qt.start,"getter should have no params");if(ne.kind==="set"&&qt.params.length!==1)this.raiseRecoverable(qt.start,"setter should have exactly one param");if(ne.kind==="set"&&qt.params[0].type==="RestElement")this.raiseRecoverable(qt.params[0].start,"Setter cannot use rest params");return this.finishNode(ne,"MethodDefinition")};an.parseClassField=function(ne){if(ms(ne,"constructor"))this.raise(ne.key.start,"Classes can't have a field named 'constructor'");else if(ne.static&&ms(ne,"prototype"))this.raise(ne.key.start,"Classes can't have a static field named 'prototype'");if(this.eat(Zt.eq))this.enterScope(Bi|vs),ne.value=this.parseMaybeAssign(),this.exitScope();else ne.value=null;return this.semicolon(),this.finishNode(ne,"PropertyDefinition")};an.parseClassStaticBlock=function(ne){ne.body=[];var re=this.labels;this.labels=[],this.enterScope(fi|vs);while(this.type!==Zt.braceR){var Be=this.parseStatement(null);ne.body.push(Be)}return this.next(),this.exitScope(),this.labels=re,this.finishNode(ne,"StaticBlock")};an.parseClassId=function(ne,re){if(this.type===Zt.name){if(ne.id=this.parseIdent(),re)this.checkLValSimple(ne.id,qn,!1)}else{if(re===!0)this.unexpected();ne.id=null}};an.parseClassSuper=function(ne){ne.superClass=this.eat(Zt._extends)?this.parseExprSubscripts(null,!1):null};an.enterClassBody=function(){var ne={declared:Object.create(null),used:[]};return this.privateNameStack.push(ne),ne.declared};an.exitClassBody=function(){var ne=this.privateNameStack.pop(),{declared:re,used:Be}=ne;if(!this.options.checkPrivateFields)return;var Wt=this.privateNameStack.length,Kt=Wt===0?null:this.privateNameStack[Wt-1];for(var qt=0;qt<Be.length;++qt){var Xt=Be[qt];if(!Fi(re,Xt.name))if(Kt)Kt.used.push(Xt);else this.raiseRecoverable(Xt.start,"Private field '#"+Xt.name+"' must be declared in an enclosing class")}};function zl(ne,re){var Be=re.key.name,Wt=ne[Be],Kt="true";if(re.type==="MethodDefinition"&&(re.kind==="get"||re.kind==="set"))Kt=(re.static?"s":"i")+re.kind;if(Wt==="iget"&&Kt==="iset"||Wt==="iset"&&Kt==="iget"||Wt==="sget"&&Kt==="sset"||Wt==="sset"&&Kt==="sget")return ne[Be]="true",!1;else if(!Wt)return ne[Be]=Kt,!1;else return!0}function ms(ne,re){var{computed:Be,key:Wt}=ne;return!Be&&(Wt.type==="Identifier"&&Wt.name===re||Wt.type==="Literal"&&Wt.value===re)}an.parseExportAllDeclaration=function(ne,re){if(this.options.ecmaVersion>=11)if(this.eatContextual("as"))ne.exported=this.parseModuleExportName(),this.checkExport(re,ne.exported,this.lastTokStart);else ne.exported=null;if(this.expectContextual("from"),this.type!==Zt.string)this.unexpected();if(ne.source=this.parseExprAtom(),this.options.ecmaVersion>=16)ne.attributes=this.parseWithClause();return this.semicolon(),this.finishNode(ne,"ExportAllDeclaration")};an.parseExport=function(ne,re){if(this.next(),this.eat(Zt.star))return this.parseExportAllDeclaration(ne,re);if(this.eat(Zt._default))return this.checkExport(re,"default",this.lastTokStart),ne.declaration=this.parseExportDefaultDeclaration(),this.finishNode(ne,"ExportDefaultDeclaration");if(this.shouldParseExportStatement()){if(ne.declaration=this.parseExportDeclaration(ne),ne.declaration.type==="VariableDeclaration")this.checkVariableExport(re,ne.declaration.declarations);else this.checkExport(re,ne.declaration.id,ne.declaration.id.start);if(ne.specifiers=[],ne.source=null,this.options.ecmaVersion>=16)ne.attributes=[]}else{if(ne.declaration=null,ne.specifiers=this.parseExportSpecifiers(re),this.eatContextual("from")){if(this.type!==Zt.string)this.unexpected();if(ne.source=this.parseExprAtom(),this.options.ecmaVersion>=16)ne.attributes=this.parseWithClause()}else{for(var Be=0,Wt=ne.specifiers;Be<Wt.length;Be+=1){var Kt=Wt[Be];if(this.checkUnreserved(Kt.local),this.checkLocalExport(Kt.local),Kt.local.type==="Literal")this.raise(Kt.local.start,"A string literal cannot be used as an exported binding without `from`.")}if(ne.source=null,this.options.ecmaVersion>=16)ne.attributes=[]}this.semicolon()}return this.finishNode(ne,"ExportNamedDeclaration")};an.parseExportDeclaration=function(ne){return this.parseStatement(null)};an.parseExportDefaultDeclaration=function(){var ne;if(this.type===Zt._function||(ne=this.isAsyncFunction())){var re=this.startNode();if(this.next(),ne)this.next();return this.parseFunction(re,Li|ma,!1,ne)}else if(this.type===Zt._class){var Be=this.startNode();return this.parseClass(Be,"nullableID")}else{var Wt=this.parseMaybeAssign();return this.semicolon(),Wt}};an.checkExport=function(ne,re,Be){if(!ne)return;if(typeof re!=="string")re=re.type==="Identifier"?re.name:re.value;if(Fi(ne,re))this.raiseRecoverable(Be,"Duplicate export '"+re+"'");ne[re]=!0};an.checkPatternExport=function(ne,re){var Be=re.type;if(Be==="Identifier")this.checkExport(ne,re,re.start);else if(Be==="ObjectPattern")for(var Wt=0,Kt=re.properties;Wt<Kt.length;Wt+=1){var qt=Kt[Wt];this.checkPatternExport(ne,qt)}else if(Be==="ArrayPattern")for(var Xt=0,Ht=re.elements;Xt<Ht.length;Xt+=1){var zt=Ht[Xt];if(zt)this.checkPatternExport(ne,zt)}else if(Be==="Property")this.checkPatternExport(ne,re.value);else if(Be==="AssignmentPattern")this.checkPatternExport(ne,re.left);else if(Be==="RestElement")this.checkPatternExport(ne,re.argument)};an.checkVariableExport=function(ne,re){if(!ne)return;for(var Be=0,Wt=re;Be<Wt.length;Be+=1){var Kt=Wt[Be];this.checkPatternExport(ne,Kt.id)}};an.shouldParseExportStatement=function(){return this.type.keyword==="var"||this.type.keyword==="const"||this.type.keyword==="class"||this.type.keyword==="function"||this.isLet()||this.isAsyncFunction()};an.parseExportSpecifier=function(ne){var re=this.startNode();return re.local=this.parseModuleExportName(),re.exported=this.eatContextual("as")?this.parseModuleExportName():re.local,this.checkExport(ne,re.exported,re.exported.start),this.finishNode(re,"ExportSpecifier")};an.parseExportSpecifiers=function(ne){var re=[],Be=!0;this.expect(Zt.braceL);while(!this.eat(Zt.braceR)){if(!Be){if(this.expect(Zt.comma),this.afterTrailingComma(Zt.braceR))break}else Be=!1;re.push(this.parseExportSpecifier(ne))}return re};an.parseImport=function(ne){if(this.next(),this.type===Zt.string)ne.specifiers=ql,ne.source=this.parseExprAtom();else ne.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),ne.source=this.type===Zt.string?this.parseExprAtom():this.unexpected();if(this.options.ecmaVersion>=16)ne.attributes=this.parseWithClause();return this.semicolon(),this.finishNode(ne,"ImportDeclaration")};an.parseImportSpecifier=function(){var ne=this.startNode();if(ne.imported=this.parseModuleExportName(),this.eatContextual("as"))ne.local=this.parseIdent();else this.checkUnreserved(ne.imported),ne.local=ne.imported;return this.checkLValSimple(ne.local,qn),this.finishNode(ne,"ImportSpecifier")};an.parseImportDefaultSpecifier=function(){var ne=this.startNode();return ne.local=this.parseIdent(),this.checkLValSimple(ne.local,qn),this.finishNode(ne,"ImportDefaultSpecifier")};an.parseImportNamespaceSpecifier=function(){var ne=this.startNode();return this.next(),this.expectContextual("as"),ne.local=this.parseIdent(),this.checkLValSimple(ne.local,qn),this.finishNode(ne,"ImportNamespaceSpecifier")};an.parseImportSpecifiers=function(){var ne=[],re=!0;if(this.type===Zt.name){if(ne.push(this.parseImportDefaultSpecifier()),!this.eat(Zt.comma))return ne}if(this.type===Zt.star)return ne.push(this.parseImportNamespaceSpecifier()),ne;this.expect(Zt.braceL);while(!this.eat(Zt.braceR)){if(!re){if(this.expect(Zt.comma),this.afterTrailingComma(Zt.braceR))break}else re=!1;ne.push(this.parseImportSpecifier())}return ne};an.parseWithClause=function(){var ne=[];if(!this.eat(Zt._with))return ne;this.expect(Zt.braceL);var re={},Be=!0;while(!this.eat(Zt.braceR)){if(!Be){if(this.expect(Zt.comma),this.afterTrailingComma(Zt.braceR))break}else Be=!1;var Wt=this.parseImportAttribute(),Kt=Wt.key.type==="Identifier"?Wt.key.name:Wt.key.value;if(Fi(re,Kt))this.raiseRecoverable(Wt.key.start,"Duplicate attribute key '"+Kt+"'");re[Kt]=!0,ne.push(Wt)}return ne};an.parseImportAttribute=function(){var ne=this.startNode();if(ne.key=this.type===Zt.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never"),this.expect(Zt.colon),this.type!==Zt.string)this.unexpected();return ne.value=this.parseExprAtom(),this.finishNode(ne,"ImportAttribute")};an.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===Zt.string){var ne=this.parseLiteral(this.value);if(Vl.test(ne.value))this.raise(ne.start,"An export name cannot include a lone surrogate.");return ne}return this.parseIdent(!0)};an.adaptDirectivePrologue=function(ne){for(var re=0;re<ne.length&&this.isDirectiveCandidate(ne[re]);++re)ne[re].directive=ne[re].expression.raw.slice(1,-1)};an.isDirectiveCandidate=function(ne){return this.options.ecmaVersion>=5&&ne.type==="ExpressionStatement"&&ne.expression.type==="Literal"&&typeof ne.expression.value==="string"&&(this.input[ne.start]==='"'||this.input[ne.start]==="'")};var Rn=s.prototype;Rn.toAssignable=function(ne,re,Be){if(this.options.ecmaVersion>=6&&ne)switch(ne.type){case"Identifier":if(this.inAsync&&ne.name==="await")this.raise(ne.start,"Cannot use 'await' as identifier inside an async function");break;case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":break;case"ObjectExpression":if(ne.type="ObjectPattern",Be)this.checkPatternErrors(Be,!0);for(var Wt=0,Kt=ne.properties;Wt<Kt.length;Wt+=1){var qt=Kt[Wt];if(this.toAssignable(qt,re),qt.type==="RestElement"&&(qt.argument.type==="ArrayPattern"||qt.argument.type==="ObjectPattern"))this.raise(qt.argument.start,"Unexpected token")}break;case"Property":if(ne.kind!=="init")this.raise(ne.key.start,"Object pattern can't contain getter or setter");this.toAssignable(ne.value,re);break;case"ArrayExpression":if(ne.type="ArrayPattern",Be)this.checkPatternErrors(Be,!0);this.toAssignableList(ne.elements,re);break;case"SpreadElement":if(ne.type="RestElement",this.toAssignable(ne.argument,re),ne.argument.type==="AssignmentPattern")this.raise(ne.argument.start,"Rest elements cannot have a default value");break;case"AssignmentExpression":if(ne.operator!=="=")this.raise(ne.left.end,"Only '=' operator can be used for specifying default value.");ne.type="AssignmentPattern",delete ne.operator,this.toAssignable(ne.left,re);break;case"ParenthesizedExpression":this.toAssignable(ne.expression,re,Be);break;case"ChainExpression":this.raiseRecoverable(ne.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":if(!re)break;default:this.raise(ne.start,"Assigning to rvalue")}else if(Be)this.checkPatternErrors(Be,!0);return ne};Rn.toAssignableList=function(ne,re){var Be=ne.length;for(var Wt=0;Wt<Be;Wt++){var Kt=ne[Wt];if(Kt)this.toAssignable(Kt,re)}if(Be){var qt=ne[Be-1];if(this.options.ecmaVersion===6&&re&&qt&&qt.type==="RestElement"&&qt.argument.type!=="Identifier")this.unexpected(qt.argument.start)}return ne};Rn.parseSpread=function(ne){var re=this.startNode();return this.next(),re.argument=this.parseMaybeAssign(!1,ne),this.finishNode(re,"SpreadElement")};Rn.parseRestBinding=function(){var ne=this.startNode();if(this.next(),this.options.ecmaVersion===6&&this.type!==Zt.name)this.unexpected();return ne.argument=this.parseBindingAtom(),this.finishNode(ne,"RestElement")};Rn.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case Zt.bracketL:var ne=this.startNode();return this.next(),ne.elements=this.parseBindingList(Zt.bracketR,!0,!0),this.finishNode(ne,"ArrayPattern");case Zt.braceL:return this.parseObj(!0)}return this.parseIdent()};Rn.parseBindingList=function(ne,re,Be,Wt){var Kt=[],qt=!0;while(!this.eat(ne)){if(qt)qt=!1;else this.expect(Zt.comma);if(re&&this.type===Zt.comma)Kt.push(null);else if(Be&&this.afterTrailingComma(ne))break;else if(this.type===Zt.ellipsis){var Xt=this.parseRestBinding();if(this.parseBindingListItem(Xt),Kt.push(Xt),this.type===Zt.comma)this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");this.expect(ne);break}else Kt.push(this.parseAssignableListItem(Wt))}return Kt};Rn.parseAssignableListItem=function(ne){var re=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(re),re};Rn.parseBindingListItem=function(ne){return ne};Rn.parseMaybeDefault=function(ne,re,Be){if(Be=Be||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(Zt.eq))return Be;var Wt=this.startNodeAt(ne,re);return Wt.left=Be,Wt.right=this.parseMaybeAssign(),this.finishNode(Wt,"AssignmentPattern")};Rn.checkLValSimple=function(ne,re,Be){if(re===void 0)re=fs;var Wt=re!==fs;switch(ne.type){case"Identifier":if(this.strict&&this.reservedWordsStrictBind.test(ne.name))this.raiseRecoverable(ne.start,(Wt?"Binding ":"Assigning to ")+ne.name+" in strict mode");if(Wt){if(re===qn&&ne.name==="let")this.raiseRecoverable(ne.start,"let is disallowed as a lexically bound name");if(Be){if(Fi(Be,ne.name))this.raiseRecoverable(ne.start,"Argument name clash");Be[ne.name]=!0}if(re!==fa)this.declareName(ne.name,re,ne.start)}break;case"ChainExpression":this.raiseRecoverable(ne.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":if(Wt)this.raiseRecoverable(ne.start,"Binding member expression");break;case"ParenthesizedExpression":if(Wt)this.raiseRecoverable(ne.start,"Binding parenthesized expression");return this.checkLValSimple(ne.expression,re,Be);default:this.raise(ne.start,(Wt?"Binding":"Assigning to")+" rvalue")}};Rn.checkLValPattern=function(ne,re,Be){if(re===void 0)re=fs;switch(ne.type){case"ObjectPattern":for(var Wt=0,Kt=ne.properties;Wt<Kt.length;Wt+=1){var qt=Kt[Wt];this.checkLValInnerPattern(qt,re,Be)}break;case"ArrayPattern":for(var Xt=0,Ht=ne.elements;Xt<Ht.length;Xt+=1){var zt=Ht[Xt];if(zt)this.checkLValInnerPattern(zt,re,Be)}break;default:this.checkLValSimple(ne,re,Be)}};Rn.checkLValInnerPattern=function(ne,re,Be){if(re===void 0)re=fs;switch(ne.type){case"Property":this.checkLValInnerPattern(ne.value,re,Be);break;case"AssignmentPattern":this.checkLValPattern(ne.left,re,Be);break;case"RestElement":this.checkLValPattern(ne.argument,re,Be);break;default:this.checkLValPattern(ne,re,Be)}};var Mn=function(ne,re,Be,Wt,Kt){this.token=ne,this.isExpr=!!re,this.preserveSpace=!!Be,this.override=Wt,this.generator=!!Kt},yn={b_stat:new Mn("{",!1),b_expr:new Mn("{",!0),b_tmpl:new Mn("${",!1),p_stat:new Mn("(",!1),p_expr:new Mn("(",!0),q_tmpl:new Mn("`",!0,!0,function(ne){return ne.tryReadTemplateToken()}),f_stat:new Mn("function",!1),f_expr:new Mn("function",!0),f_expr_gen:new Mn("function",!0,!1,null,!0),f_gen:new Mn("function",!1,!1,null,!0)},Ti=s.prototype;Ti.initialContext=function(){return[yn.b_stat]};Ti.curContext=function(){return this.context[this.context.length-1]};Ti.braceIsBlock=function(ne){var re=this.curContext();if(re===yn.f_expr||re===yn.f_stat)return!0;if(ne===Zt.colon&&(re===yn.b_stat||re===yn.b_expr))return!re.isExpr;if(ne===Zt._return||ne===Zt.name&&this.exprAllowed)return An.test(this.input.slice(this.lastTokEnd,this.start));if(ne===Zt._else||ne===Zt.semi||ne===Zt.eof||ne===Zt.parenR||ne===Zt.arrow)return!0;if(ne===Zt.braceL)return re===yn.b_stat;if(ne===Zt._var||ne===Zt._const||ne===Zt.name)return!1;return!this.exprAllowed};Ti.inGeneratorContext=function(){for(var ne=this.context.length-1;ne>=1;ne--){var re=this.context[ne];if(re.token==="function")return re.generator}return!1};Ti.updateContext=function(ne){var re,Be=this.type;if(Be.keyword&&ne===Zt.dot)this.exprAllowed=!1;else if(re=Be.updateContext)re.call(this,ne);else this.exprAllowed=Be.beforeExpr};Ti.overrideContext=function(ne){if(this.curContext()!==ne)this.context[this.context.length-1]=ne};Zt.parenR.updateContext=Zt.braceR.updateContext=function(){if(this.context.length===1){this.exprAllowed=!0;return}var ne=this.context.pop();if(ne===yn.b_stat&&this.curContext().token==="function")ne=this.context.pop();this.exprAllowed=!ne.isExpr};Zt.braceL.updateContext=function(ne){this.context.push(this.braceIsBlock(ne)?yn.b_stat:yn.b_expr),this.exprAllowed=!0};Zt.dollarBraceL.updateContext=function(){this.context.push(yn.b_tmpl),this.exprAllowed=!0};Zt.parenL.updateContext=function(ne){var re=ne===Zt._if||ne===Zt._for||ne===Zt._with||ne===Zt._while;this.context.push(re?yn.p_stat:yn.p_expr),this.exprAllowed=!0};Zt.incDec.updateContext=function(){};Zt._function.updateContext=Zt._class.updateContext=function(ne){if(ne.beforeExpr&&ne!==Zt._else&&!(ne===Zt.semi&&this.curContext()!==yn.p_stat)&&!(ne===Zt._return&&An.test(this.input.slice(this.lastTokEnd,this.start)))&&!((ne===Zt.colon||ne===Zt.braceL)&&this.curContext()===yn.b_stat))this.context.push(yn.f_expr);else this.context.push(yn.f_stat);this.exprAllowed=!1};Zt.colon.updateContext=function(){if(this.curContext().token==="function")this.context.pop();this.exprAllowed=!0};Zt.backQuote.updateContext=function(){if(this.curContext()===yn.q_tmpl)this.context.pop();else this.context.push(yn.q_tmpl);this.exprAllowed=!1};Zt.star.updateContext=function(ne){if(ne===Zt._function){var re=this.context.length-1;if(this.context[re]===yn.f_expr)this.context[re]=yn.f_expr_gen;else this.context[re]=yn.f_gen}this.exprAllowed=!0};Zt.name.updateContext=function(ne){var re=!1;if(this.options.ecmaVersion>=6&&ne!==Zt.dot){if(this.value==="of"&&!this.exprAllowed||this.value==="yield"&&this.inGeneratorContext())re=!0}this.exprAllowed=re};var cn=s.prototype;cn.checkPropClash=function(ne,re,Be){if(this.options.ecmaVersion>=9&&ne.type==="SpreadElement")return;if(this.options.ecmaVersion>=6&&(ne.computed||ne.method||ne.shorthand))return;var Wt=ne.key,Kt;switch(Wt.type){case"Identifier":Kt=Wt.name;break;case"Literal":Kt=String(Wt.value);break;default:return}var qt=ne.kind;if(this.options.ecmaVersion>=6){if(Kt==="__proto__"&&qt==="init"){if(re.proto)if(Be){if(Be.doubleProto<0)Be.doubleProto=Wt.start}else this.raiseRecoverable(Wt.start,"Redefinition of __proto__ property");re.proto=!0}return}Kt="$"+Kt;var Xt=re[Kt];if(Xt){var Ht;if(qt==="init")Ht=this.strict&&Xt.init||Xt.get||Xt.set;else Ht=Xt.init||Xt[qt];if(Ht)this.raiseRecoverable(Wt.start,"Redefinition of property")}else Xt=re[Kt]={init:!1,get:!1,set:!1};Xt[qt]=!0};cn.parseExpression=function(ne,re){var Be=this;return this.catchStackOverflow(function(){var{start:Wt,startLoc:Kt}=Be,qt=Be.parseMaybeAssign(ne,re);if(Be.type===Zt.comma){var Xt=Be.startNodeAt(Wt,Kt);Xt.expressions=[qt];while(Be.eat(Zt.comma))Xt.expressions.push(Be.parseMaybeAssign(ne,re));return Be.finishNode(Xt,"SequenceExpression")}return qt})};cn.parseMaybeAssign=function(ne,re,Be){if(this.isContextual("yield"))if(this.inGenerator)return this.parseYield(ne);else this.exprAllowed=!1;var Wt=!1,Kt=-1,qt=-1,Xt=-1;if(re)Kt=re.parenthesizedAssign,qt=re.trailingComma,Xt=re.doubleProto,re.parenthesizedAssign=re.trailingComma=-1;else re=new Ss,Wt=!0;var Ht=this.start,zt=this.startLoc;if(this.type===Zt.parenL||this.type===Zt.name)this.potentialArrowAt=this.start,this.potentialArrowInForAwait=ne==="await";var Yt=this.parseMaybeConditional(ne,re);if(Be)Yt=Be.call(this,Yt,Ht,zt);if(this.type.isAssign){var Qt=this.startNodeAt(Ht,zt);if(Qt.operator=this.value,this.type===Zt.eq)Yt=this.toAssignable(Yt,!1,re);if(!Wt){if(re.parenthesizedAssign=re.trailingComma=-1,re.shorthandAssign>=Yt.start)re.shorthandAssign=-1;if(re.doubleProto>=Yt.start)re.doubleProto=-1}if(this.type===Zt.eq)this.checkLValPattern(Yt);else this.checkLValSimple(Yt);if(Qt.left=Yt,this.next(),Qt.right=this.parseMaybeAssign(ne),Xt>-1)re.doubleProto=Xt;return this.finishNode(Qt,"AssignmentExpression")}else if(Wt)this.checkExpressionErrors(re,!0);if(Kt>-1)re.parenthesizedAssign=Kt;if(qt>-1)re.trailingComma=qt;return Yt};cn.parseMaybeConditional=function(ne,re){var Be=this.start,Wt=this.startLoc,Kt=this.parseExprOps(ne,re);if(this.checkExpressionErrors(re))return Kt;if(!(Kt.type==="ArrowFunctionExpression"&&Kt.start===Be)&&this.eat(Zt.question)){var qt=this.startNodeAt(Be,Wt);return qt.test=Kt,qt.consequent=this.parseMaybeAssign(),this.expect(Zt.colon),qt.alternate=this.parseMaybeAssign(ne),this.finishNode(qt,"ConditionalExpression")}return Kt};cn.parseExprOps=function(ne,re){var Be=this.start,Wt=this.startLoc,Kt=this.parseMaybeUnary(re,!1,!1,ne);if(this.checkExpressionErrors(re))return Kt;return Kt.start===Be&&Kt.type==="ArrowFunctionExpression"?Kt:this.parseExprOp(Kt,Be,Wt,-1,ne)};cn.parseExprOp=function(ne,re,Be,Wt,Kt){var qt=this.type.binop;if(qt!=null&&(!Kt||this.type!==Zt._in)){if(qt>Wt){var Xt=this.type===Zt.logicalOR||this.type===Zt.logicalAND,Ht=this.type===Zt.coalesce;if(Ht)qt=Zt.logicalAND.binop;var zt=this.value;this.next();var Yt=this.start,Qt=this.startLoc,en=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,Kt),Yt,Qt,qt,Kt),tn=this.buildBinary(re,Be,ne,en,zt,Xt||Ht);if(Xt&&this.type===Zt.coalesce||Ht&&(this.type===Zt.logicalOR||this.type===Zt.logicalAND))this.raiseRecoverable(this.start,"Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses");return this.parseExprOp(tn,re,Be,Wt,Kt)}}return ne};cn.buildBinary=function(ne,re,Be,Wt,Kt,qt){if(Wt.type==="PrivateIdentifier")this.raise(Wt.start,"Private identifier can only be left side of binary expression");var Xt=this.startNodeAt(ne,re);return Xt.left=Be,Xt.operator=Kt,Xt.right=Wt,this.finishNode(Xt,qt?"LogicalExpression":"BinaryExpression")};cn.parseMaybeUnary=function(ne,re,Be,Wt){var Kt=this.start,qt=this.startLoc,Xt;if(this.isContextual("await")&&this.canAwait)Xt=this.parseAwait(Wt),re=!0;else if(this.type.prefix){var Ht=this.startNode(),zt=this.type===Zt.incDec;if(Ht.operator=this.value,Ht.prefix=!0,this.next(),Ht.argument=this.parseMaybeUnary(null,!0,zt,Wt),this.checkExpressionErrors(ne,!0),zt)this.checkLValSimple(Ht.argument);else if(this.strict&&Ht.operator==="delete"&&ga(Ht.argument))this.raiseRecoverable(Ht.start,"Deleting local variable in strict mode");else if(Ht.operator==="delete"&&dr(Ht.argument))this.raiseRecoverable(Ht.start,"Private fields can not be deleted");else re=!0;Xt=this.finishNode(Ht,zt?"UpdateExpression":"UnaryExpression")}else if(!re&&this.type===Zt.privateId){if((Wt||this.privateNameStack.length===0)&&this.options.checkPrivateFields)this.unexpected();if(Xt=this.parsePrivateIdent(),this.type!==Zt._in)this.unexpected()}else{if(Xt=this.parseExprSubscripts(ne,Wt),this.checkExpressionErrors(ne))return Xt;while(this.type.postfix&&!this.canInsertSemicolon()){var Yt=this.startNodeAt(Kt,qt);Yt.operator=this.value,Yt.prefix=!1,Yt.argument=Xt,this.checkLValSimple(Xt),this.next(),Xt=this.finishNode(Yt,"UpdateExpression")}}if(!Be&&!(Xt.type==="ArrowFunctionExpression"&&Xt.start===Kt)&&this.eat(Zt.starstar))if(re)this.unexpected(this.lastTokStart);else return this.buildBinary(Kt,qt,Xt,this.parseMaybeUnary(null,!1,!1,Wt),"**",!1);else return Xt};function ga(ne){return ne.type==="Identifier"||ne.type==="ParenthesizedExpression"&&ga(ne.expression)}function dr(ne){return ne.type==="MemberExpression"&&ne.property.type==="PrivateIdentifier"||ne.type==="ChainExpression"&&dr(ne.expression)||ne.type==="ParenthesizedExpression"&&dr(ne.expression)}cn.parseExprSubscripts=function(ne,re){var Be=this.start,Wt=this.startLoc,Kt=-1,qt=-1;if(ne)Kt=ne.doubleProto,qt=ne.shorthandAssign,ne.doubleProto=ne.shorthandAssign=-1;var Xt=this.parseExprAtom(ne,re);if(Xt.type==="ArrowFunctionExpression"&&this.input.slice(this.lastTokStart,this.lastTokEnd)!==")")return Xt;var Ht=this.parseSubscripts(Xt,Be,Wt,!1,re);if(ne){if(Ht.end>Xt.end){if(this.checkExpressionErrors(ne,!0),ne.parenthesizedAssign>=Ht.start)ne.parenthesizedAssign=-1;if(ne.parenthesizedBind>=Ht.start)ne.parenthesizedBind=-1;if(ne.trailingComma>=Ht.start)ne.trailingComma=-1}if(Kt>-1)ne.doubleProto=Kt;if(qt>-1)ne.shorthandAssign=qt}return Ht};cn.parseSubscripts=function(ne,re,Be,Wt,Kt){var qt=this.options.ecmaVersion>=8&&ne.type==="Identifier"&&ne.name==="async"&&this.lastTokEnd===ne.end&&!this.canInsertSemicolon()&&ne.end-ne.start===5&&this.potentialArrowAt===ne.start,Xt=!1;while(!0){var Ht=this.parseSubscript(ne,re,Be,Wt,qt,Xt,Kt);if(Ht.optional)Xt=!0;if(Ht.end===ne.end||Ht.type==="ArrowFunctionExpression"){if(Xt){var zt=this.startNodeAt(re,Be);zt.expression=Ht,Ht=this.finishNode(zt,"ChainExpression")}return Ht}ne=Ht,qt=!1}};cn.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(Zt.arrow)};cn.parseSubscriptAsyncArrow=function(ne,re,Be,Wt){return this.parseArrowExpression(this.startNodeAt(ne,re),Be,!0,Wt)};cn.parseSubscript=function(ne,re,Be,Wt,Kt,qt,Xt){var Ht=this.options.ecmaVersion>=11,zt=Ht&&this.eat(Zt.questionDot);if(Wt&&zt)this.raise(this.lastTokStart,"Optional chaining cannot appear in the callee of new expressions");var Yt=this.eat(Zt.bracketL);if(Yt||zt&&this.type!==Zt.parenL&&this.type!==Zt.backQuote||this.eat(Zt.dot)){var Qt=this.startNodeAt(re,Be);if(Qt.object=ne,Yt)Qt.property=this.parseExpression(),this.expect(Zt.bracketR);else if(this.type===Zt.privateId&&ne.type!=="Super")Qt.property=this.parsePrivateIdent();else Qt.property=this.parseIdent(this.options.allowReserved!=="never");if(Qt.computed=!!Yt,Ht)Qt.optional=zt;ne=this.finishNode(Qt,"MemberExpression")}else if(!Wt&&this.eat(Zt.parenL)){var en=new Ss,tn=this.yieldPos,nn=this.awaitPos,sn=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var on=this.parseExprList(Zt.parenR,this.options.ecmaVersion>=8,!1,en);if(Kt&&!zt&&this.shouldParseAsyncArrow()){if(this.checkPatternErrors(en,!1),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0)this.raise(this.awaitIdentPos,"Cannot use 'await' as identifier inside an async function");return this.yieldPos=tn,this.awaitPos=nn,this.awaitIdentPos=sn,this.parseSubscriptAsyncArrow(re,Be,on,Xt)}this.checkExpressionErrors(en,!0),this.yieldPos=tn||this.yieldPos,this.awaitPos=nn||this.awaitPos,this.awaitIdentPos=sn||this.awaitIdentPos;var rn=this.startNodeAt(re,Be);if(rn.callee=ne,rn.arguments=on,Ht)rn.optional=zt;ne=this.finishNode(rn,"CallExpression")}else if(this.type===Zt.backQuote){if(zt||qt)this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions");var ln=this.startNodeAt(re,Be);ln.tag=ne,ln.quasi=this.parseTemplate({isTagged:!0}),ne=this.finishNode(ln,"TaggedTemplateExpression")}return ne};cn.parseExprAtom=function(ne,re,Be){if(this.type===Zt.slash)this.readRegexp();var Wt,Kt=this.potentialArrowAt===this.start;switch(this.type){case Zt._super:if(!this.allowSuper)this.raise(this.start,"'super' keyword outside a method");if(Wt=this.startNode(),this.next(),this.type===Zt.parenL&&!this.allowDirectSuper)this.raise(Wt.start,"super() call outside constructor of a subclass");if(this.type!==Zt.dot&&this.type!==Zt.bracketL&&this.type!==Zt.parenL)this.unexpected();return this.finishNode(Wt,"Super");case Zt._this:return Wt=this.startNode(),this.next(),this.finishNode(Wt,"ThisExpression");case Zt.name:var qt=this.start,Xt=this.startLoc,Ht=this.containsEsc,zt=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!Ht&&zt.name==="async"&&!this.canInsertSemicolon()&&this.eat(Zt._function))return this.overrideContext(yn.f_expr),this.parseFunction(this.startNodeAt(qt,Xt),0,!1,!0,re);if(Kt&&!this.canInsertSemicolon()){if(this.eat(Zt.arrow))return this.parseArrowExpression(this.startNodeAt(qt,Xt),[zt],!1,re);if(this.options.ecmaVersion>=8&&zt.name==="async"&&this.type===Zt.name&&!Ht&&(!this.potentialArrowInForAwait||this.value!=="of"||this.containsEsc)){if(zt=this.parseIdent(!1),this.canInsertSemicolon()||!this.eat(Zt.arrow))this.unexpected();return this.parseArrowExpression(this.startNodeAt(qt,Xt),[zt],!0,re)}}return zt;case Zt.regexp:var Yt=this.value;return Wt=this.parseLiteral(Yt.value),Wt.regex={pattern:Yt.pattern,flags:Yt.flags},Wt;case Zt.num:case Zt.string:return this.parseLiteral(this.value);case Zt._null:case Zt._true:case Zt._false:return Wt=this.startNode(),Wt.value=this.type===Zt._null?null:this.type===Zt._true,Wt.raw=this.type.keyword,this.next(),this.finishNode(Wt,"Literal");case Zt.parenL:var Qt=this.start,en=this.parseParenAndDistinguishExpression(Kt,re);if(ne){if(ne.parenthesizedAssign<0&&!this.isSimpleAssignTarget(en))ne.parenthesizedAssign=Qt;if(ne.parenthesizedBind<0)ne.parenthesizedBind=Qt}return en;case Zt.bracketL:return Wt=this.startNode(),this.next(),Wt.elements=this.parseExprList(Zt.bracketR,!0,!0,ne),this.finishNode(Wt,"ArrayExpression");case Zt.braceL:return this.overrideContext(yn.b_expr),this.parseObj(!1,ne);case Zt._function:return Wt=this.startNode(),this.next(),this.parseFunction(Wt,0);case Zt._class:return this.parseClass(this.startNode(),!1);case Zt._new:return this.parseNew();case Zt.backQuote:return this.parseTemplate();case Zt._import:if(this.options.ecmaVersion>=11)return this.parseExprImport(Be);else return this.unexpected();default:return this.parseExprAtomDefault()}};cn.parseExprAtomDefault=function(){this.unexpected()};cn.parseExprImport=function(ne){var re=this.startNode();if(this.containsEsc)this.raiseRecoverable(this.start,"Escape sequence in keyword import");if(this.next(),this.type===Zt.parenL&&!ne)return this.parseDynamicImport(re);else if(this.type===Zt.dot){var Be=this.startNodeAt(re.start,re.loc&&re.loc.start);return Be.name="import",re.meta=this.finishNode(Be,"Identifier"),this.parseImportMeta(re)}else this.unexpected()};cn.parseDynamicImport=function(ne){if(this.next(),ne.source=this.parseMaybeAssign(),this.options.ecmaVersion>=16)if(!this.eat(Zt.parenR))if(this.expect(Zt.comma),!this.afterTrailingComma(Zt.parenR)){if(ne.options=this.parseMaybeAssign(),!this.eat(Zt.parenR)){if(this.expect(Zt.comma),!this.afterTrailingComma(Zt.parenR))this.unexpected()}}else ne.options=null;else ne.options=null;else if(!this.eat(Zt.parenR)){var re=this.start;if(this.eat(Zt.comma)&&this.eat(Zt.parenR))this.raiseRecoverable(re,"Trailing comma is not allowed in import()");else this.unexpected(re)}return this.finishNode(ne,"ImportExpression")};cn.parseImportMeta=function(ne){this.next();var re=this.containsEsc;if(ne.property=this.parseIdent(!0),ne.property.name!=="meta")this.raiseRecoverable(ne.property.start,"The only valid meta property for import is 'import.meta'");if(re)this.raiseRecoverable(ne.start,"'import.meta' must not contain escaped characters");if(this.options.sourceType!=="module"&&!this.options.allowImportExportEverywhere)this.raiseRecoverable(ne.start,"Cannot use 'import.meta' outside a module");return this.finishNode(ne,"MetaProperty")};cn.parseLiteral=function(ne){var re=this.startNode();if(re.value=ne,re.raw=this.input.slice(this.start,this.end),re.raw.charCodeAt(re.raw.length-1)===110)re.bigint=re.value!=null?re.value.toString():re.raw.slice(0,-1).replace(/_/g,"");return this.next(),this.finishNode(re,"Literal")};cn.parseParenExpression=function(){this.expect(Zt.parenL);var ne=this.parseExpression();return this.expect(Zt.parenR),ne};cn.shouldParseArrow=function(ne){return!this.canInsertSemicolon()};cn.parseParenAndDistinguishExpression=function(ne,re){var Be=this.start,Wt=this.startLoc,Kt,qt=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var Xt=this.start,Ht=this.startLoc,zt=[],Yt=!0,Qt=!1,en=new Ss,tn=this.yieldPos,nn=this.awaitPos,sn;this.yieldPos=0,this.awaitPos=0;while(this.type!==Zt.parenR)if(Yt?Yt=!1:this.expect(Zt.comma),qt&&this.afterTrailingComma(Zt.parenR,!0)){Qt=!0;break}else if(this.type===Zt.ellipsis){if(sn=this.start,zt.push(this.parseParenItem(this.parseRestBinding())),this.type===Zt.comma)this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");break}else zt.push(this.parseMaybeAssign(!1,en,this.parseParenItem));var on=this.lastTokEnd,rn=this.lastTokEndLoc;if(this.expect(Zt.parenR),ne&&this.shouldParseArrow(zt)&&this.eat(Zt.arrow))return this.checkPatternErrors(en,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=tn,this.awaitPos=nn,this.parseParenArrowList(Be,Wt,zt,re);if(!zt.length||Qt)this.unexpected(this.lastTokStart);if(sn)this.unexpected(sn);if(this.checkExpressionErrors(en,!0),this.yieldPos=tn||this.yieldPos,this.awaitPos=nn||this.awaitPos,zt.length>1)Kt=this.startNodeAt(Xt,Ht),Kt.expressions=zt,this.finishNodeAt(Kt,"SequenceExpression",on,rn);else Kt=zt[0]}else Kt=this.parseParenExpression();if(this.options.preserveParens){var ln=this.startNodeAt(Be,Wt);return ln.expression=Kt,this.finishNode(ln,"ParenthesizedExpression")}else return Kt};cn.parseParenItem=function(ne){return ne};cn.parseParenArrowList=function(ne,re,Be,Wt){return this.parseArrowExpression(this.startNodeAt(ne,re),Be,!1,Wt)};var Xl=[];cn.parseNew=function(){if(this.containsEsc)this.raiseRecoverable(this.start,"Escape sequence in keyword new");var ne=this.startNode();if(this.next(),this.options.ecmaVersion>=6&&this.type===Zt.dot){var re=this.startNodeAt(ne.start,ne.loc&&ne.loc.start);re.name="new",ne.meta=this.finishNode(re,"Identifier"),this.next();var Be=this.containsEsc;if(ne.property=this.parseIdent(!0),ne.property.name!=="target")this.raiseRecoverable(ne.property.start,"The only valid meta property for new is 'new.target'");if(Be)this.raiseRecoverable(ne.start,"'new.target' must not contain escaped characters");if(!this.allowNewDotTarget)this.raiseRecoverable(ne.start,"'new.target' can only be used in functions and class static block");return this.finishNode(ne,"MetaProperty")}var Wt=this.start,Kt=this.startLoc;if(ne.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),Wt,Kt,!0,!1),ne.callee.type==="Super")this.raiseRecoverable(Wt,"Invalid use of 'super'");if(this.eat(Zt.parenL))ne.arguments=this.parseExprList(Zt.parenR,this.options.ecmaVersion>=8,!1);else ne.arguments=Xl;return this.finishNode(ne,"NewExpression")};cn.parseTemplateElement=function(ne){var re=ne.isTagged,Be=this.startNode();if(this.type===Zt.invalidTemplate){if(!re)this.raiseRecoverable(this.start,"Bad escape sequence in untagged template literal");Be.value={raw:this.value.replace(/\r\n?/g,`
|
|
12
|
+
`),cooked:null}}else Be.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,`
|
|
13
|
+
`),cooked:this.value};return this.next(),Be.tail=this.type===Zt.backQuote,this.finishNode(Be,"TemplateElement")};cn.parseTemplate=function(ne){if(ne===void 0)ne={};var re=ne.isTagged;if(re===void 0)re=!1;var Be=this.startNode();this.next(),Be.expressions=[];var Wt=this.parseTemplateElement({isTagged:re});Be.quasis=[Wt];while(!Wt.tail){if(this.type===Zt.eof)this.raise(this.pos,"Unterminated template literal");this.expect(Zt.dollarBraceL),Be.expressions.push(this.parseExpression()),this.expect(Zt.braceR),Be.quasis.push(Wt=this.parseTemplateElement({isTagged:re}))}return this.next(),this.finishNode(Be,"TemplateLiteral")};cn.isAsyncProp=function(ne){return!ne.computed&&ne.key.type==="Identifier"&&ne.key.name==="async"&&(this.type===Zt.name||this.type===Zt.num||this.type===Zt.string||this.type===Zt.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===Zt.star)&&!An.test(this.input.slice(this.lastTokEnd,this.start))};cn.parseObj=function(ne,re){var Be=this.startNode(),Wt=!0,Kt={};Be.properties=[],this.next();while(!this.eat(Zt.braceR)){if(!Wt){if(this.expect(Zt.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(Zt.braceR))break}else Wt=!1;var qt=this.parseProperty(ne,re);if(!ne)this.checkPropClash(qt,Kt,re);Be.properties.push(qt)}return this.finishNode(Be,ne?"ObjectPattern":"ObjectExpression")};cn.parseProperty=function(ne,re){var Be=this.startNode(),Wt,Kt,qt,Xt;if(this.options.ecmaVersion>=9&&this.eat(Zt.ellipsis)){if(ne){if(Be.argument=this.parseIdent(!1),this.type===Zt.comma)this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");return this.finishNode(Be,"RestElement")}if(Be.argument=this.parseMaybeAssign(!1,re),this.type===Zt.comma&&re&&re.trailingComma<0)re.trailingComma=this.start;return this.finishNode(Be,"SpreadElement")}if(this.options.ecmaVersion>=6){if(Be.method=!1,Be.shorthand=!1,ne||re)qt=this.start,Xt=this.startLoc;if(!ne)Wt=this.eat(Zt.star)}var Ht=this.containsEsc;if(this.parsePropertyName(Be),!ne&&!Ht&&this.options.ecmaVersion>=8&&!Wt&&this.isAsyncProp(Be))Kt=!0,Wt=this.options.ecmaVersion>=9&&this.eat(Zt.star),this.parsePropertyName(Be);else Kt=!1;return this.parsePropertyValue(Be,ne,Wt,Kt,qt,Xt,re,Ht),this.finishNode(Be,"Property")};cn.parseGetterSetter=function(ne){var re=ne.key.name;this.parsePropertyName(ne),ne.value=this.parseMethod(!1),ne.kind=re;var Be=ne.kind==="get"?0:1;if(ne.value.params.length!==Be){var Wt=ne.value.start;if(ne.kind==="get")this.raiseRecoverable(Wt,"getter should have no params");else this.raiseRecoverable(Wt,"setter should have exactly one param")}else if(ne.kind==="set"&&ne.value.params[0].type==="RestElement")this.raiseRecoverable(ne.value.params[0].start,"Setter cannot use rest params")};cn.parsePropertyValue=function(ne,re,Be,Wt,Kt,qt,Xt,Ht){if((Be||Wt)&&this.type===Zt.colon)this.unexpected();if(this.eat(Zt.colon))ne.value=re?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,Xt),ne.kind="init";else if(this.options.ecmaVersion>=6&&this.type===Zt.parenL){if(re)this.unexpected();ne.method=!0,ne.value=this.parseMethod(Be,Wt),ne.kind="init"}else if(!re&&!Ht&&this.options.ecmaVersion>=5&&!ne.computed&&ne.key.type==="Identifier"&&(ne.key.name==="get"||ne.key.name==="set")&&(this.type!==Zt.comma&&this.type!==Zt.braceR&&this.type!==Zt.eq)){if(Be||Wt)this.unexpected();this.parseGetterSetter(ne)}else if(this.options.ecmaVersion>=6&&!ne.computed&&ne.key.type==="Identifier"){if(Be||Wt)this.unexpected();if(this.checkUnreserved(ne.key),ne.key.name==="await"&&!this.awaitIdentPos)this.awaitIdentPos=Kt;if(re)ne.value=this.parseMaybeDefault(Kt,qt,this.copyNode(ne.key));else if(this.type===Zt.eq&&Xt){if(Xt.shorthandAssign<0)Xt.shorthandAssign=this.start;ne.value=this.parseMaybeDefault(Kt,qt,this.copyNode(ne.key))}else ne.value=this.copyNode(ne.key);ne.kind="init",ne.shorthand=!0}else this.unexpected()};cn.parsePropertyName=function(ne){if(this.options.ecmaVersion>=6)if(this.eat(Zt.bracketL))return ne.computed=!0,ne.key=this.parseMaybeAssign(),this.expect(Zt.bracketR),ne.key;else ne.computed=!1;return ne.key=this.type===Zt.num||this.type===Zt.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never")};cn.initFunction=function(ne){if(ne.id=null,this.options.ecmaVersion>=6)ne.generator=ne.expression=!1;if(this.options.ecmaVersion>=8)ne.async=!1};cn.parseMethod=function(ne,re,Be){var Wt=this.startNode(),Kt=this.yieldPos,qt=this.awaitPos,Xt=this.awaitIdentPos;if(this.initFunction(Wt),this.options.ecmaVersion>=6)Wt.generator=ne;if(this.options.ecmaVersion>=8)Wt.async=!!re;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(yr(re,Wt.generator)|vs|(Be?la:0)),this.expect(Zt.parenL),Wt.params=this.parseBindingList(Zt.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(Wt,!1,!0,!1),this.yieldPos=Kt,this.awaitPos=qt,this.awaitIdentPos=Xt,this.finishNode(Wt,"FunctionExpression")};cn.parseArrowExpression=function(ne,re,Be,Wt){var Kt=this.yieldPos,qt=this.awaitPos,Xt=this.awaitIdentPos;if(this.enterScope(yr(Be,!1)|gr),this.initFunction(ne),this.options.ecmaVersion>=8)ne.async=!!Be;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,ne.params=this.toAssignableList(re,!0),this.parseFunctionBody(ne,!0,!1,Wt),this.yieldPos=Kt,this.awaitPos=qt,this.awaitIdentPos=Xt,this.finishNode(ne,"ArrowFunctionExpression")};cn.parseFunctionBody=function(ne,re,Be,Wt){var Kt=re&&this.type!==Zt.braceL,qt=this.strict,Xt=!1;if(Kt)ne.body=this.parseMaybeAssign(Wt),ne.expression=!0,this.checkParams(ne,!1);else{var Ht=this.options.ecmaVersion>=7&&!this.isSimpleParamList(ne.params);if(!qt||Ht){if(Xt=this.strictDirective(this.end),Xt&&Ht)this.raiseRecoverable(ne.start,"Illegal 'use strict' directive in function with non-simple parameter list")}var zt=this.labels;if(this.labels=[],Xt)this.strict=!0;if(this.checkParams(ne,!qt&&!Xt&&!re&&!Be&&this.isSimpleParamList(ne.params)),this.strict&&ne.id)this.checkLValSimple(ne.id,fa);ne.body=this.parseBlock(!1,void 0,Xt&&!qt),ne.expression=!1,this.adaptDirectivePrologue(ne.body.body),this.labels=zt}this.exitScope()};cn.isSimpleParamList=function(ne){for(var re=0,Be=ne;re<Be.length;re+=1){var Wt=Be[re];if(Wt.type!=="Identifier")return!1}return!0};cn.checkParams=function(ne,re){var Be=Object.create(null);for(var Wt=0,Kt=ne.params;Wt<Kt.length;Wt+=1){var qt=Kt[Wt];this.checkLValInnerPattern(qt,xr,re?null:Be)}};cn.parseExprList=function(ne,re,Be,Wt){var Kt=[],qt=!0;while(!this.eat(ne)){if(!qt){if(this.expect(Zt.comma),re&&this.afterTrailingComma(ne))break}else qt=!1;var Xt=void 0;if(Be&&this.type===Zt.comma)Xt=null;else if(this.type===Zt.ellipsis){if(Xt=this.parseSpread(Wt),Wt&&this.type===Zt.comma&&Wt.trailingComma<0)Wt.trailingComma=this.start}else Xt=this.parseMaybeAssign(!1,Wt);Kt.push(Xt)}return Kt};cn.checkUnreserved=function(ne){var{start:re,end:Be,name:Wt}=ne;if(this.inGenerator&&Wt==="yield")this.raiseRecoverable(re,"Cannot use 'yield' as identifier inside a generator");if(this.inAsync&&Wt==="await")this.raiseRecoverable(re,"Cannot use 'await' as identifier inside an async function");if(!(this.currentThisScope().flags&Es)&&Wt==="arguments")this.raiseRecoverable(re,"Cannot use 'arguments' in class field initializer");if(this.inClassStaticBlock&&(Wt==="arguments"||Wt==="await"))this.raise(re,"Cannot use "+Wt+" in class static initialization block");if(this.keywords.test(Wt))this.raise(re,"Unexpected keyword '"+Wt+"'");if(this.options.ecmaVersion<6&&this.input.slice(re,Be).indexOf("\\")!==-1)return;var Kt=this.strict?this.reservedWordsStrict:this.reservedWords;if(Kt.test(Wt)){if(!this.inAsync&&Wt==="await")this.raiseRecoverable(re,"Cannot use keyword 'await' outside an async function");this.raiseRecoverable(re,"The keyword '"+Wt+"' is reserved")}};cn.parseIdent=function(ne){var re=this.parseIdentNode();if(this.next(!!ne),this.finishNode(re,"Identifier"),!ne){if(this.checkUnreserved(re),re.name==="await"&&!this.awaitIdentPos)this.awaitIdentPos=re.start}return re};cn.parseIdentNode=function(){var ne=this.startNode();if(this.type===Zt.name)ne.name=this.value;else if(this.type.keyword){if(ne.name=this.type.keyword,(ne.name==="class"||ne.name==="function")&&(this.lastTokEnd!==this.lastTokStart+1||this.input.charCodeAt(this.lastTokStart)!==46))this.context.pop();this.type=Zt.name}else this.unexpected();return ne};cn.parsePrivateIdent=function(){var ne=this.startNode();if(this.type===Zt.privateId)ne.name=this.value;else this.unexpected();if(this.next(),this.finishNode(ne,"PrivateIdentifier"),this.options.checkPrivateFields)if(this.privateNameStack.length===0)this.raise(ne.start,"Private field '#"+ne.name+"' must be declared in an enclosing class");else this.privateNameStack[this.privateNameStack.length-1].used.push(ne);return ne};cn.parseYield=function(ne){if(!this.yieldPos)this.yieldPos=this.start;var re=this.startNode();if(this.next(),this.type===Zt.semi||this.canInsertSemicolon()||this.type!==Zt.star&&!this.type.startsExpr)re.delegate=!1,re.argument=null;else re.delegate=this.eat(Zt.star),re.argument=this.parseMaybeAssign(ne);return this.finishNode(re,"YieldExpression")};cn.parseAwait=function(ne){if(!this.awaitPos)this.awaitPos=this.start;var re=this.startNode();return this.next(),re.argument=this.parseMaybeUnary(null,!0,!1,ne),this.finishNode(re,"AwaitExpression")};var gs=s.prototype;gs.raise=function(ne,re){var Be=aa(this.input,ne);if(re+=" ("+Be.line+":"+Be.column+")",this.sourceFile)re+=" in "+this.sourceFile;var Wt=SyntaxError(re);throw Wt.pos=ne,Wt.loc=Be,Wt.raisedAt=this.pos,Wt};gs.raiseRecoverable=gs.raise;gs.curPosition=function(){if(this.options.locations)return new Mi(this.curLine,this.pos-this.lineStart)};var Zn=s.prototype,Jl=function(ne){this.flags=ne,this.var=[],this.lexical=[],this.functions=[]};Zn.enterScope=function(ne){this.scopeStack.push(new Jl(ne))};Zn.exitScope=function(){this.scopeStack.pop()};Zn.treatFunctionsAsVarInScope=function(ne){return ne.flags&di||!this.inModule&&ne.flags&hi};Zn.declareName=function(ne,re,Be){var Wt=!1;if(re===qn){var Kt=this.currentScope();if(Wt=Kt.lexical.indexOf(ne)>-1||Kt.functions.indexOf(ne)>-1||Kt.var.indexOf(ne)>-1,Kt.lexical.push(ne),this.inModule&&Kt.flags&hi)delete this.undefinedExports[ne]}else if(re===da){var qt=this.currentScope();qt.lexical.push(ne)}else if(re===ha){var Xt=this.currentScope();if(this.treatFunctionsAsVar)Wt=Xt.lexical.indexOf(ne)>-1;else Wt=Xt.lexical.indexOf(ne)>-1||Xt.var.indexOf(ne)>-1;Xt.functions.push(ne)}else for(var Ht=this.scopeStack.length-1;Ht>=0;--Ht){var zt=this.scopeStack[Ht];if(zt.lexical.indexOf(ne)>-1&&!(zt.flags&ca&&zt.lexical[0]===ne)||!this.treatFunctionsAsVarInScope(zt)&&zt.functions.indexOf(ne)>-1){Wt=!0;break}if(zt.var.push(ne),this.inModule&&zt.flags&hi)delete this.undefinedExports[ne];if(zt.flags&Es)break}if(Wt)this.raiseRecoverable(Be,"Identifier '"+ne+"' has already been declared")};Zn.checkLocalExport=function(ne){if(this.scopeStack[0].lexical.indexOf(ne.name)===-1&&this.scopeStack[0].var.indexOf(ne.name)===-1)this.undefinedExports[ne.name]=ne};Zn.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]};Zn.currentVarScope=function(){for(var ne=this.scopeStack.length-1;;ne--){var re=this.scopeStack[ne];if(re.flags&(Es|Bi|fi))return re}};Zn.currentThisScope=function(){for(var ne=this.scopeStack.length-1;;ne--){var re=this.scopeStack[ne];if(re.flags&(Es|Bi|fi)&&!(re.flags&gr))return re}};var bs=function(ne,re,Be){if(this.type="",this.start=re,this.end=0,ne.options.locations)this.loc=new xs(ne,Be);if(ne.options.directSourceFile)this.sourceFile=ne.options.directSourceFile;if(ne.options.ranges)this.range=[re,0]},ji=s.prototype;ji.startNode=function(){return new bs(this,this.start,this.startLoc)};ji.startNodeAt=function(ne,re){return new bs(this,ne,re)};function ya(ne,re,Be,Wt){if(ne.type=re,ne.end=Be,this.options.locations)ne.loc.end=Wt;if(this.options.ranges)ne.range[1]=Be;return ne}ji.finishNode=function(ne,re){return ya.call(this,ne,re,this.lastTokEnd,this.lastTokEndLoc)};ji.finishNodeAt=function(ne,re,Be,Wt){return ya.call(this,ne,re,Be,Wt)};ji.copyNode=function(ne){var re=new bs(this,ne.start,this.startLoc);for(var Be in ne)re[Be]=ne[Be];return re};var xa=function(){};xa.prototype.reset=function(){};s.prototype.validateRegExpFlags=function(){};s.prototype.validateRegExpPattern=function(){};var Er=function(ne){if(this.type=ne.type,this.value=ne.value,this.start=ne.start,this.end=ne.end,ne.options.locations)this.loc=new xs(ne,ne.startLoc,ne.endLoc);if(ne.options.ranges)this.range=[ne.start,ne.end]},hn=s.prototype;hn.next=function(ne){if(!ne&&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()};hn.getToken=function(){return this.next(),new Er(this)};if(typeof Symbol<"u")hn[Symbol.iterator]=function(){var ne=this;return{next:function(){var re=ne.getToken();return{done:re.type===Zt.eof,value:re}}}};hn.nextToken=function(){var ne=this.curContext();if(!ne||!ne.preserveSpace)this.skipSpace();if(this.start=this.pos,this.options.locations)this.startLoc=this.curPosition();if(this.pos>=this.input.length)return this.finishToken(Zt.eof);if(ne.override)return ne.override(this);else this.readToken(this.fullCharCodeAtPos())};hn.readToken=function(ne){if(g(ne,this.options.ecmaVersion>=6)||ne===92)return this.readWord();return this.getTokenFromCode(ne)};hn.fullCharCodeAt=function(ne){var re=this.input.charCodeAt(ne);if(re<=55295||re>=56320)return re;var Be=this.input.charCodeAt(ne+1);return Be<=56319||Be>=57344?re:(re<<10)+Be-56613888};hn.fullCharCodeAtPos=function(){return this.fullCharCodeAt(this.pos)};hn.skipBlockComment=function(){var ne=this.options.onComment&&this.curPosition(),re=this.pos,Be=this.input.indexOf("*/",this.pos+=2);if(Be===-1)this.raise(this.pos-2,"Unterminated comment");if(this.pos=Be+2,this.options.locations)for(var Wt=void 0,Kt=re;(Wt=ra(this.input,Kt,this.pos))>-1;)++this.curLine,Kt=this.lineStart=Wt;if(this.options.onComment)this.options.onComment(!0,this.input.slice(re+2,Be),re,this.pos,ne,this.curPosition())};hn.skipLineComment=function(ne){var re=this.pos,Be=this.options.onComment&&this.curPosition(),Wt=this.input.charCodeAt(this.pos+=ne);while(this.pos<this.input.length&&!wi(Wt))Wt=this.input.charCodeAt(++this.pos);if(this.options.onComment)this.options.onComment(!1,this.input.slice(re+ne,this.pos),re,this.pos,Be,this.curPosition())};hn.skipSpace=function(){e:while(this.pos<this.input.length){var ne=this.input.charCodeAt(this.pos);switch(ne){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(ne>8&&ne<14||ne>=5760&&oa.test(String.fromCharCode(ne)))++this.pos;else break e}}};hn.finishToken=function(ne,re){if(this.end=this.pos,this.options.locations)this.endLoc=this.curPosition();var Be=this.type;this.type=ne,this.value=re,this.updateContext(Be)};hn.readToken_dot=function(){var ne=this.input.charCodeAt(this.pos+1);if(ne>=48&&ne<=57)return this.readNumber(!0);var re=this.input.charCodeAt(this.pos+2);if(this.options.ecmaVersion>=6&&ne===46&&re===46)return this.pos+=3,this.finishToken(Zt.ellipsis);else return++this.pos,this.finishToken(Zt.dot)};hn.readToken_slash=function(){var ne=this.input.charCodeAt(this.pos+1);if(this.exprAllowed)return++this.pos,this.readRegexp();if(ne===61)return this.finishOp(Zt.assign,2);return this.finishOp(Zt.slash,1)};hn.readToken_mult_modulo_exp=function(ne){var re=this.input.charCodeAt(this.pos+1),Be=1,Wt=ne===42?Zt.star:Zt.modulo;if(this.options.ecmaVersion>=7&&ne===42&&re===42)++Be,Wt=Zt.starstar,re=this.input.charCodeAt(this.pos+2);if(re===61)return this.finishOp(Zt.assign,Be+1);return this.finishOp(Wt,Be)};hn.readToken_pipe_amp=function(ne){var re=this.input.charCodeAt(this.pos+1);if(re===ne){if(this.options.ecmaVersion>=12){var Be=this.input.charCodeAt(this.pos+2);if(Be===61)return this.finishOp(Zt.assign,3)}return this.finishOp(ne===124?Zt.logicalOR:Zt.logicalAND,2)}if(re===61)return this.finishOp(Zt.assign,2);return this.finishOp(ne===124?Zt.bitwiseOR:Zt.bitwiseAND,1)};hn.readToken_caret=function(){var ne=this.input.charCodeAt(this.pos+1);if(ne===61)return this.finishOp(Zt.assign,2);return this.finishOp(Zt.bitwiseXOR,1)};hn.readToken_plus_min=function(ne){var re=this.input.charCodeAt(this.pos+1);if(re===ne){if(re===45&&!this.inModule&&this.input.charCodeAt(this.pos+2)===62&&(this.lastTokEnd===0||An.test(this.input.slice(this.lastTokEnd,this.pos))))return this.skipLineComment(3),this.skipSpace(),this.nextToken();return this.finishOp(Zt.incDec,2)}if(re===61)return this.finishOp(Zt.assign,2);return this.finishOp(Zt.plusMin,1)};hn.readToken_lt_gt=function(ne){var re=this.input.charCodeAt(this.pos+1),Be=1;if(re===ne){if(Be=ne===62&&this.input.charCodeAt(this.pos+2)===62?3:2,this.input.charCodeAt(this.pos+Be)===61)return this.finishOp(Zt.assign,Be+1);return this.finishOp(Zt.bitShift,Be)}if(re===33&&ne===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(re===61)Be=2;return this.finishOp(Zt.relational,Be)};hn.readToken_eq_excl=function(ne){var re=this.input.charCodeAt(this.pos+1);if(re===61)return this.finishOp(Zt.equality,this.input.charCodeAt(this.pos+2)===61?3:2);if(ne===61&&re===62&&this.options.ecmaVersion>=6)return this.pos+=2,this.finishToken(Zt.arrow);return this.finishOp(ne===61?Zt.eq:Zt.prefix,1)};hn.readToken_question=function(){var ne=this.options.ecmaVersion;if(ne>=11){var re=this.input.charCodeAt(this.pos+1);if(re===46){var Be=this.input.charCodeAt(this.pos+2);if(Be<48||Be>57)return this.finishOp(Zt.questionDot,2)}if(re===63){if(ne>=12){var Wt=this.input.charCodeAt(this.pos+2);if(Wt===61)return this.finishOp(Zt.assign,3)}return this.finishOp(Zt.coalesce,2)}}return this.finishOp(Zt.question,1)};hn.readToken_numberSign=function(){var ne=this.options.ecmaVersion,re=35;if(ne>=13){if(++this.pos,re=this.fullCharCodeAtPos(),g(re,!0)||re===92)return this.finishToken(Zt.privateId,this.readWord1())}this.raise(this.pos,"Unexpected character '"+ys(re)+"'")};hn.getTokenFromCode=function(ne){switch(ne){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(Zt.parenL);case 41:return++this.pos,this.finishToken(Zt.parenR);case 59:return++this.pos,this.finishToken(Zt.semi);case 44:return++this.pos,this.finishToken(Zt.comma);case 91:return++this.pos,this.finishToken(Zt.bracketL);case 93:return++this.pos,this.finishToken(Zt.bracketR);case 123:return++this.pos,this.finishToken(Zt.braceL);case 125:return++this.pos,this.finishToken(Zt.braceR);case 58:return++this.pos,this.finishToken(Zt.colon);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(Zt.backQuote);case 48:var re=this.input.charCodeAt(this.pos+1);if(re===120||re===88)return this.readRadixNumber(16);if(this.options.ecmaVersion>=6){if(re===111||re===79)return this.readRadixNumber(8);if(re===98||re===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(ne);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo_exp(ne);case 124:case 38:return this.readToken_pipe_amp(ne);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(ne);case 60:case 62:return this.readToken_lt_gt(ne);case 61:case 33:return this.readToken_eq_excl(ne);case 63:return this.readToken_question();case 126:return this.finishOp(Zt.prefix,1);case 35:return this.readToken_numberSign()}this.raise(this.pos,"Unexpected character '"+ys(ne)+"'")};hn.finishOp=function(ne,re){var Be=this.input.slice(this.pos,this.pos+re);return this.pos+=re,this.finishToken(ne,Be)};hn.readRegexp=function(){var ne,re,Be=this.pos;for(;;){if(this.pos>=this.input.length)this.raise(Be,"Unterminated regular expression");var Wt=this.input.charAt(this.pos);if(An.test(Wt))this.raise(Be,"Unterminated regular expression");if(!ne){if(Wt==="[")re=!0;else if(Wt==="]"&&re)re=!1;else if(Wt==="/"&&!re)break;ne=Wt==="\\"}else ne=!1;++this.pos}var Kt=this.input.slice(Be,this.pos);++this.pos;var qt=this.pos,Xt=this.readWord1();if(this.containsEsc)this.unexpected(qt);var Ht=this.regexpState||(this.regexpState=new xa(this));Ht.reset(Be,Kt,Xt),this.validateRegExpFlags(Ht),this.validateRegExpPattern(Ht);var zt=null;try{zt=new RegExp(Kt,Xt)}catch(Yt){}return this.finishToken(Zt.regexp,{pattern:Kt,flags:Xt,value:zt})};hn.readInt=function(ne,re,Be){var Wt=this.options.ecmaVersion>=12&&re===void 0,Kt=Be&&this.input.charCodeAt(this.pos)===48,qt=this.pos,Xt=0,Ht=0;for(var zt=0,Yt=re==null?1/0:re;zt<Yt;++zt,++this.pos){var Qt=this.input.charCodeAt(this.pos),en=void 0;if(Wt&&Qt===95){if(Kt)this.raiseRecoverable(this.pos,"Numeric separator is not allowed in legacy octal numeric literals");if(Ht===95)this.raiseRecoverable(this.pos,"Numeric separator must be exactly one underscore");if(zt===0)this.raiseRecoverable(this.pos,"Numeric separator is not allowed at the first of digits");Ht=Qt;continue}if(Qt>=97)en=Qt-97+10;else if(Qt>=65)en=Qt-65+10;else if(Qt>=48&&Qt<=57)en=Qt-48;else en=1/0;if(en>=ne)break;Ht=Qt,Xt=Xt*ne+en}if(Wt&&Ht===95)this.raiseRecoverable(this.pos-1,"Numeric separator is not allowed at the last of digits");if(this.pos===qt||re!=null&&this.pos-qt!==re)return null;return Xt};function Yl(ne,re){if(re)return parseInt(ne,8);return parseFloat(ne.replace(/_/g,""))}function va(ne){if(typeof BigInt!=="function")return null;return BigInt(ne.replace(/_/g,""))}hn.readRadixNumber=function(ne){var re=this.pos;this.pos+=2;var Be=this.readInt(ne);if(Be==null)this.raise(this.start+2,"Expected number in radix "+ne);if(this.options.ecmaVersion>=11&&this.input.charCodeAt(this.pos)===110)Be=va(this.input.slice(re,this.pos)),++this.pos;else if(g(this.fullCharCodeAtPos()))this.raise(this.pos,"Identifier directly after number");return this.finishToken(Zt.num,Be)};hn.readNumber=function(ne){var re=this.pos;if(!ne&&this.readInt(10,void 0,!0)===null)this.raise(re,"Invalid number");var Be=this.pos-re>=2&&this.input.charCodeAt(re)===48;if(Be&&this.strict)this.raise(re,"Invalid number");var Wt=this.input.charCodeAt(this.pos);if(!Be&&!ne&&this.options.ecmaVersion>=11&&Wt===110){var Kt=va(this.input.slice(re,this.pos));if(++this.pos,g(this.fullCharCodeAtPos()))this.raise(this.pos,"Identifier directly after number");return this.finishToken(Zt.num,Kt)}if(Be&&/[89]/.test(this.input.slice(re,this.pos)))Be=!1;if(Wt===46&&!Be)++this.pos,this.readInt(10),Wt=this.input.charCodeAt(this.pos);if((Wt===69||Wt===101)&&!Be){if(Wt=this.input.charCodeAt(++this.pos),Wt===43||Wt===45)++this.pos;if(this.readInt(10)===null)this.raise(re,"Invalid number")}if(g(this.fullCharCodeAtPos()))this.raise(this.pos,"Identifier directly after number");var qt=Yl(this.input.slice(re,this.pos),Be);return this.finishToken(Zt.num,qt)};hn.readCodePoint=function(){var ne=this.input.charCodeAt(this.pos),re;if(ne===123){if(this.options.ecmaVersion<6)this.unexpected();var Be=++this.pos;if(re=this.readHexChar(this.input.indexOf("}",this.pos)-this.pos),++this.pos,re>1114111)this.invalidStringToken(Be,"Code point out of bounds")}else re=this.readHexChar(4);return re};hn.readString=function(ne){var re="",Be=++this.pos;for(;;){if(this.pos>=this.input.length)this.raise(this.start,"Unterminated string constant");var Wt=this.input.charCodeAt(this.pos);if(Wt===ne)break;if(Wt===92)re+=this.input.slice(Be,this.pos),re+=this.readEscapedChar(!1),Be=this.pos;else if(Wt===8232||Wt===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(wi(Wt))this.raise(this.start,"Unterminated string constant");++this.pos}}return re+=this.input.slice(Be,this.pos++),this.finishToken(Zt.string,re)};var Ea={};hn.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(ne){if(ne===Ea)this.readInvalidTemplateToken();else throw ne}this.inTemplateElement=!1};hn.invalidStringToken=function(ne,re){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw Ea;else this.raise(ne,re)};hn.readTmplToken=function(){var ne="",re=this.pos;for(;;){if(this.pos>=this.input.length)this.raise(this.start,"Unterminated template");var Be=this.input.charCodeAt(this.pos);if(Be===96||Be===36&&this.input.charCodeAt(this.pos+1)===123){if(this.pos===this.start&&(this.type===Zt.template||this.type===Zt.invalidTemplate))if(Be===36)return this.pos+=2,this.finishToken(Zt.dollarBraceL);else return++this.pos,this.finishToken(Zt.backQuote);return ne+=this.input.slice(re,this.pos),this.finishToken(Zt.template,ne)}if(Be===92)ne+=this.input.slice(re,this.pos),ne+=this.readEscapedChar(!0),re=this.pos;else if(wi(Be)){switch(ne+=this.input.slice(re,this.pos),++this.pos,Be){case 13:if(this.input.charCodeAt(this.pos)===10)++this.pos;case 10:ne+=`
|
|
14
|
+
`;break;default:ne+=String.fromCharCode(Be);break}if(this.options.locations)++this.curLine,this.lineStart=this.pos;re=this.pos}else++this.pos}};hn.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(Zt.invalidTemplate,this.input.slice(this.start,this.pos));case"\r":if(this.input[this.pos+1]===`
|
|
15
|
+
`)++this.pos;case`
|
|
16
|
+
`:case"\u2028":case"\u2029":++this.curLine,this.lineStart=this.pos+1;break}this.raise(this.start,"Unterminated template")};hn.readEscapedChar=function(ne){var re=this.input.charCodeAt(++this.pos);switch(++this.pos,re){case 110:return`
|
|
17
|
+
`;case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return ys(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(ne){var Be=this.pos-1;this.invalidStringToken(Be,"Invalid escape sequence in template string")}default:if(re>=48&&re<=55){var Wt=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],Kt=parseInt(Wt,8);if(Kt>255)Wt=Wt.slice(0,-1),Kt=parseInt(Wt,8);if(this.pos+=Wt.length-1,re=this.input.charCodeAt(this.pos),(Wt!=="0"||re===56||re===57)&&(this.strict||ne))this.invalidStringToken(this.pos-1-Wt.length,ne?"Octal literal in template string":"Octal literal in strict mode");return String.fromCharCode(Kt)}if(wi(re)){if(this.options.locations)this.lineStart=this.pos,++this.curLine;return""}return String.fromCharCode(re)}};hn.readHexChar=function(ne){var re=this.pos,Be=this.readInt(16,ne);if(Be===null)this.invalidStringToken(re,"Bad character escape sequence");return Be};hn.readWord1=function(){this.containsEsc=!1;var ne="",re=!0,Be=this.pos,Wt=this.options.ecmaVersion>=6;while(this.pos<this.input.length){var Kt=this.fullCharCodeAtPos();if(S(Kt,Wt))this.pos+=Kt<=65535?1:2;else if(Kt===92){this.containsEsc=!0,ne+=this.input.slice(Be,this.pos);var qt=this.pos;if(this.input.charCodeAt(++this.pos)!==117)this.invalidStringToken(this.pos,"Expecting Unicode escape sequence \\uXXXX");++this.pos;var Xt=this.readCodePoint();if(!(re?g:S)(Xt,Wt))this.invalidStringToken(qt,"Invalid Unicode escape");ne+=ys(Xt),Be=this.pos}else break;re=!1}return ne+this.input.slice(Be,this.pos)};hn.readWord=function(){var ne=this.readWord1(),re=Zt.name;if(this.keywords.test(ne))re=fr[ne];return this.finishToken(re,ne)};var Ql="8.19.0";s.acorn={Parser:s,version:Ql,defaultOptions:ur,Position:Mi,SourceLocation:xs,getLineInfo:aa,Node:bs,TokenType:mn,tokTypes:Zt,keywordTypes:fr,TokContext:Mn,tokContexts:yn,isIdentifierChar:S,isIdentifierStart:g,Token:Er,isNewLine:wi,lineBreak:An,lineBreakG:Ml,nonASCIIwhitespace:oa};function Vi(ne){return(re)=>ne(re)}function Cs(...ne){return s.extend(...ne)}function Gi(ne,re,Be){for(let Wt=re;Wt<Be;Wt++){let Kt=ne.charCodeAt(Wt);if(Kt===10||Kt===13||Kt===8232||Kt===8233)return!0}return!1}var ia=new WeakMap;function Pn(ne,re){if(ne===void 0)return!1;if(ne.length<16)return ne.includes(re);let Be=ia.get(ne);if(Be===void 0||Be.length>ne.length)Be={names:new Set,length:0},ia.set(ne,Be);while(Be.length<ne.length)Be.names.add(ne[Be.length++]);return Be.names.has(re)}var Sr=/(?:\s|\/\/.*|\/\*[\s\S]*?\*\/)*/g,Zl=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"]]),eu=new Set("public private protected readonly declare abstract override static accessor".split(" ")),tu=new Set("public private protected readonly override".split(" ")),nu=new Set("var let const function class abstract enum interface type namespace module global".split(" ")),iu=new Set("var let const function class interface enum".split(" ")),Sa=new Set(["TSAsExpression","TSSatisfiesExpression","TSNonNullExpression","TSTypeAssertion"]),ba=1,su=32,ru=256,ou=0,au=1,Ui=2,pu=3,cu=4,br=6,Ca=7,_a=256,kr=1024,lu=8|kr,uu=Ui|_a,wa=1,hu=2,Ta=40,du=41,fu=44,ka=46,Aa=58,Wi=61,Pa=60,mu=62,ws=123,gu=91,Cr=42,yu=35,wr=34,Tr=39,xu=SyntaxError("speculative parse failed"),ce=Vi((ne)=>{let{tokTypes:re,keywordTypes:Be,isIdentifierChar:Wt,isIdentifierStart:Kt}=ne.acorn,qt=new ne.acorn.TokenType("@");class Xt extends ne{inType=!1;$4=!1;$5=!1;$7=null;$l=null;$j=!1;$m=!1;$f=null;$9=[[]];$n=0;$t=0;$o=-1;constructor(Ht,zt,Yt){super(Ht,zt,Yt);let Qt=this.options.onComment;if(typeof Qt==="function")this.options.onComment=(en,tn,nn,sn,on,rn)=>{if(nn<this.$t)return;this.$t=sn,Qt.call(this,en,tn,nn,sn,on,rn)}}reset(){this.inType=!1,this.$4=!1,this.$5=!1,this.$7=null,this.$l=null,this.$j=!1,this.$m=!1,this.$f=null,this.$9=[[]],this.$n=0,this.$t=0,this.$o=-1}getTokenFromCode(Ht){if(Ht===64)return++this.pos,this.finishToken(qt);return super.getTokenFromCode(Ht)}readToken_lt_gt(Ht){if(this.inType)return this.finishOp(re.relational,1);return super.readToken_lt_gt(Ht)}$a(Ht){let zt=this.inType;this.inType=!0;let Yt=Ht();if(this.inType=zt,!zt&&this.type===re.relational)this.pos=this.start,this.nextToken();return Yt}$1(){return this.type===re.relational&&this.value==="<"}$p(){if(this.type===re.bitShift&&this.value==="<<")this.pos=this.start+1,this.finishToken(re.relational,"<");return this.$1()}$c(){return this.type===re.relational&&this.value===">"}$u(){return this.type===re.prefix&&this.value==="!"}hasPrecedingLineBreak(){return Gi(this.input,this.lastTokEnd,this.start)}$d(Ht=this.pos){return Sr.lastIndex=Ht,Sr.exec(this.input),Sr.lastIndex}$2(){return this.input.charCodeAt(this.$d())}$3(){let Ht=this.$d(),zt=Ht;while(zt<this.input.length&&Wt(this.input.charCodeAt(zt)))zt++;return this.input.slice(Ht,zt)}$b(){return!Gi(this.input,this.pos,this.$d())}$14(){return this.$b()&&Kt(this.$2())&&!Object.hasOwn(Be,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(Ht){this.pos=Ht.pos,this.type=Ht.type,this.value=Ht.value,this.start=Ht.start,this.end=Ht.end,this.startLoc=Ht.startLoc,this.endLoc=Ht.endLoc,this.lastTokStart=Ht.lastTokStart,this.lastTokEnd=Ht.lastTokEnd,this.lastTokStartLoc=Ht.lastTokStartLoc,this.lastTokEndLoc=Ht.lastTokEndLoc,this.curLine=Ht.curLine,this.lineStart=Ht.lineStart,this.context=Ht.context,this.exprAllowed=Ht.exprAllowed,this.containsEsc=Ht.containsEsc,this.inType=Ht.inType,this.$4=Ht.$4,this.$5=Ht.$5,this.$7=Ht.$7,this.$j=!1,this.scopeStack.length=Ht.scopes,this.privateNameStack.length=Ht.privateNames,this.labels=Ht.labels,this.labels.length=Ht.labelCount,this.strict=Ht.strict,this.yieldPos=Ht.yieldPos,this.awaitPos=Ht.awaitPos,this.awaitIdentPos=Ht.awaitIdentPos,this.potentialArrowAt=Ht.potentialArrowAt,this.potentialArrowInForAwait=Ht.potentialArrowInForAwait}raise(Ht,zt){if(this.$n>0)throw xu;return super.raise(Ht,zt)}$1y(Ht,zt){try{super.raise(Ht,zt)}catch(Yt){if(Yt instanceof SyntaxError)Yt.$1z=!0;throw Yt}throw Error("unreachable")}$g(Ht,zt=!1){let Yt=this.$15();this.$n++;try{let Qt=Ht();if(zt||Qt===void 0)this.$16(Yt);return Qt}catch(Qt){if(!(Qt instanceof SyntaxError)||!zt&&Qt.$1z)throw Qt;this.$16(Yt);return}finally{this.$n--}}$v(Ht){return this.$g(Ht,!0)===!0}$17(Ht){if(Ht.end=this.lastTokEnd,this.options.locations)Ht.loc.end=this.lastTokEndLoc}$q(Ht,zt){if(Ht.start=zt.start,this.options.locations)Ht.loc.start=zt.loc.start}$6(Ht=!1){let zt=this.startNode();return zt.typeAnnotation=this.$a(()=>(this.next(),Ht?this.$20():this.$0())),this.finishNode(zt,"TSTypeAnnotation")}$h(Ht,zt){if(zt&&this.eat(re.question))Ht.optional=!0,this.$17(Ht);if(this.type===re.colon)Ht.typeAnnotation=this.$6(),this.$17(Ht);return Ht}$20(){if(this.type!==re.name&&this.type!==re._this)return this.$0();if(this.isContextual("asserts")&&this.$b()&&Kt(this.$2())){let Ht=this.startNode();if(this.next(),Ht.parameterName=this.type===re._this?this.$w():this.parseIdent(),this.isContextual("is")&&!this.hasPrecedingLineBreak())return this.$x(Ht,!0);return Ht.asserts=!0,Ht.typeAnnotation=null,this.finishNode(Ht,"TSTypePredicate")}if(this.$3()==="is"&&this.$b()){let Ht=this.startNode();return Ht.parameterName=this.type===re._this?this.$w():this.parseIdent(!0),this.$x(Ht,!1)}return this.$0()}$x(Ht,zt){this.next();let Yt=this.startNode();return Yt.typeAnnotation=this.$0(),Ht.typeAnnotation=this.finishNode(Yt,"TSTypeAnnotation"),Ht.asserts=zt,this.finishNode(Ht,"TSTypePredicate")}$w(){let Ht=this.startNode();return this.next(),this.finishNode(Ht,"TSThisType")}parseWholeType(){this.inType=!0,this.nextToken();let Ht=this.$0();if(this.type!==re.eof)this.unexpected();return Ht}$0(){let Ht=this.$18();if(this.$4||this.type!==re._extends||this.hasPrecedingLineBreak())return Ht;let zt=this.startNodeAt(Ht.start,Ht.loc?.start);return this.next(),zt.checkType=Ht,zt.extendsType=this.$i(!0,()=>this.$18()),this.expect(re.question),zt.trueType=this.$i(!1,()=>this.$0()),this.expect(re.colon),zt.falseType=this.$i(!1,()=>this.$0()),this.finishNode(zt,"TSConditionalType")}$i(Ht,zt){let Yt=this.$4;this.$4=Ht;let Qt=zt();return this.$4=Yt,Qt}$18(){if(this.$21())return this.$19("TSFunctionType");if(this.type===re._new||this.isContextual("abstract")&&this.$3()==="new")return this.$19("TSConstructorType");return this.$1a("TSUnionType",re.bitwiseOR,()=>this.$1a("TSIntersectionType",re.bitwiseAND,()=>this.$1b()))}$19(Ht){let zt=this.startNode();if(Ht==="TSConstructorType"){if(zt.abstract=this.isContextual("abstract"),zt.abstract)this.next();this.next()}return this.$i(!1,()=>this.$r(zt,re.arrow)),this.finishNode(zt,Ht)}$r(Ht,zt){if(this.$1())Ht.typeParameters=this.$8();if(this.expect(re.parenL),Ht.parameters=this.parseBindingList(re.parenR,!1,!0),this.type===zt)Ht.typeAnnotation=this.$6(!0);else if(zt===re.arrow)this.unexpected()}$21(){if(this.$1())return!0;if(this.type!==re.parenL)return!1;return this.$v(()=>{if(this.next(),this.type===re.parenR||this.type===re.ellipsis)return!0;if(this.type===re.name||this.type===re._this)this.next();else if(this.type===re.braceL||this.type===re.bracketL)this.parseBindingAtom();else return!1;let Ht=this.type;if(Ht===re.colon||Ht===re.comma||Ht===re.question||Ht===re.eq)return!0;if(Ht!==re.parenR)return!1;return this.next(),this.type===re.arrow})}$1a(Ht,zt,Yt){let Qt=this.startNode(),en=this.eat(zt),tn=[];do tn.push(Yt());while(this.eat(zt));if(tn.length===1&&!en)return tn[0];return Qt.types=tn,this.finishNode(Qt,Ht)}$1b(){if(this.type===re.name&&!this.containsEsc){let Ht=this.value;if(Ht==="keyof"||Ht==="unique"||Ht==="readonly"){let zt=this.startNode();return this.next(),zt.operator=Ht,zt.typeAnnotation=this.$1b(),this.finishNode(zt,"TSTypeOperator")}if(Ht==="infer"){let zt=this.startNode();this.next();let Yt=this.startNode();Yt.name=this.$y();let Qt=this.$g(()=>this.$22());if(Qt)Yt.constraint=Qt;return zt.typeParameter=this.finishNode(Yt,"TSTypeParameter"),this.finishNode(zt,"TSInferType")}}return this.$i(!1,()=>this.$23())}$22(){if(!this.eat(re._extends))return;let Ht=this.$i(!0,()=>this.$0());return this.$4||this.type!==re.question?Ht:void 0}$y(){if(this.type!==re.name&&!this.type.keyword)this.unexpected();let Ht=this.type===re.name?this.value:this.type.keyword;return this.next(),Ht}$23(){let Ht=this.$24();while(!this.hasPrecedingLineBreak()&&this.eat(re.bracketL)){let zt=this.startNodeAt(Ht.start,Ht.loc?.start);if(this.eat(re.bracketR))zt.elementType=Ht,Ht=this.finishNode(zt,"TSArrayType");else zt.objectType=Ht,zt.indexType=this.$0(),this.expect(re.bracketR),Ht=this.finishNode(zt,"TSIndexedAccessType")}return Ht}$24(){switch(this.type){case re.name:case re._void:case re._null:{let Ht=Zl.get(this.value);if(Ht&&(this.type!==re.name||!this.containsEsc&&this.$2()!==ka)){let zt=this.startNode();return this.next(),this.finishNode(zt,Ht)}return this.$1c()}case re.string:case re.num:case re._true:case re._false:{let Ht=this.startNode();return Ht.literal=this.parseExprAtom(),this.finishNode(Ht,"TSLiteralType")}case re.plusMin:{if(this.value!=="-")break;let Ht=this.startNode(),zt=this.startNode();if(this.next(),this.type!==re.num)this.unexpected();return zt.operator="-",zt.prefix=!0,zt.argument=this.parseExprAtom(),Ht.literal=this.finishNode(zt,"UnaryExpression"),this.finishNode(Ht,"TSLiteralType")}case re.backQuote:return this.$25();case re._this:{let Ht=this.$w();if(this.isContextual("is")&&!this.hasPrecedingLineBreak()){let zt=this.startNodeAt(Ht.start,Ht.loc?.start);return zt.parameterName=Ht,this.$x(zt,!1)}return Ht}case re._typeof:return this.$26();case re._import:return this.$1d();case re.braceL:return this.$27()?this.$28():this.$29();case re.bracketL:return this.$2a();case re.parenL:{let Ht=this.startNode();return this.next(),Ht.typeAnnotation=this.$0(),this.expect(re.parenR),this.finishNode(Ht,"TSParenthesizedType")}default:if(this.type.keyword)return this.$1c()}return this.unexpected()}$1c(){let Ht=this.startNode();if(Ht.typeName=this.$k(),!this.hasPrecedingLineBreak()&&this.$1())Ht.typeArguments=this.$e();return this.finishNode(Ht,"TSTypeReference")}$k(){let Ht=this.parseIdent(!0);while(this.eat(re.dot)){let zt=this.startNodeAt(Ht.start,Ht.loc?.start);zt.left=Ht,zt.right=this.parseIdent(!0),Ht=this.finishNode(zt,"TSQualifiedName")}return Ht}$26(){let Ht=this.startNode();if(this.next(),Ht.exprName=this.type===re._import?this.$1d():this.$k(),!this.hasPrecedingLineBreak()&&this.$1())Ht.typeArguments=this.$e();return this.finishNode(Ht,"TSTypeQuery")}$1d(){let Ht=this.startNode();if(this.next(),Ht.argument=this.$1e(),this.eat(re.dot))Ht.qualifier=this.$k();if(this.$1())Ht.typeArguments=this.$e();return this.finishNode(Ht,"TSImportType")}$z(){if(this.type!==re.string)this.unexpected();return this.parseExprAtom()}$1e(){this.expect(re.parenL);let Ht=this.$z();return this.expect(re.parenR),Ht}$25(){let Ht=this.startNode(),zt=this.startNode();this.next(),zt.expressions=[];let Yt=this.parseTemplateElement({isTagged:!1});zt.quasis=[Yt];while(!Yt.tail){if(this.type===re.eof)this.raise(this.pos,"Unterminated template literal");this.expect(re.dollarBraceL),zt.expressions.push(this.$0()),this.expect(re.braceR),Yt=this.parseTemplateElement({isTagged:!1}),zt.quasis.push(Yt)}return this.next(),Ht.literal=this.finishNode(zt,"TemplateLiteral"),this.finishNode(Ht,"TSLiteralType")}$27(){return this.$v(()=>{if(this.next(),this.type===re.plusMin)return this.next(),this.isContextual("readonly");if(this.isContextual("readonly"))this.next();if(this.type!==re.bracketL)return!1;if(this.next(),this.type!==re.name)return!1;return this.next(),this.type===re._in})}$28(){let Ht=this.startNode();if(this.expect(re.braceL),this.type===re.plusMin)Ht.readonly=this.value,this.next(),this.expectContextual("readonly");else if(this.eatContextual("readonly"))Ht.readonly=!0;this.expect(re.bracketL);let zt=this.startNode();if(zt.name=this.$y(),this.expect(re._in),zt.constraint=this.$0(),Ht.typeParameter=this.finishNode(zt,"TSTypeParameter"),Ht.nameType=this.eatContextual("as")?this.$0():null,this.expect(re.bracketR),this.type===re.plusMin)Ht.optional=this.value,this.next(),this.expect(re.question);else if(this.eat(re.question))Ht.optional=!0;if(this.eat(re.colon))Ht.typeAnnotation=this.$0();return this.semicolon(),this.expect(re.braceR),this.finishNode(Ht,"TSMappedType")}$29(){let Ht=this.startNode();return Ht.members=this.$1f(),this.finishNode(Ht,"TSTypeLiteral")}$1f(){this.expect(re.braceL);let Ht=[];while(!this.eat(re.braceR))Ht.push(this.$2b());return Ht}$2b(){let Ht=this.startNode(),zt="TSPropertySignature",Yt=this.type===re._new?this.$2():-1;if(this.type===re.parenL||this.$1())zt="TSCallSignatureDeclaration",this.$r(Ht,re.colon);else if(Yt===Ta||Yt===Pa)zt="TSConstructSignatureDeclaration",this.next(),this.$r(Ht,re.colon);else{let Qt=this.type===re._new?this.parseIdent(!0):null;if(this.isContextual("readonly")&&this.$s(!0))this.next(),Ht.readonly=!0;if(this.type===re.bracketL&&this.$1g())return this.$1h(Ht);let en="method";if(Qt)Ht.key=Qt;else{if((this.isContextual("get")||this.isContextual("set"))&&this.$s(!1))en=this.value,this.next();this.parsePropertyName(Ht)}if(this.eat(re.question))Ht.optional=!0;if(this.type===re.parenL||this.$1()){if(zt="TSMethodSignature",en!=="method")Ht.kind=en;this.$r(Ht,re.colon),Ht.kind=en}else if(this.type===re.colon)Ht.typeAnnotation=this.$6()}return this.$1i(),this.finishNode(Ht,zt)}$1i(){if(!this.eat(re.comma))this.semicolon()}$1g(){return this.$v(()=>{if(this.next(),this.type!==re.name)return!1;return this.next(),this.type===re.colon})}$1h(Ht){if(this.expect(re.bracketL),Ht.parameters=[this.$h(this.parseIdent(),!1)],this.expect(re.bracketR),this.type===re.colon)Ht.typeAnnotation=this.$6();return this.$1i(),this.finishNode(Ht,"TSIndexSignature")}$2a(){let Ht=this.startNode();this.expect(re.bracketL),Ht.elementTypes=[];while(!this.eat(re.bracketR))if(Ht.elementTypes.push(this.$2c()),this.type!==re.bracketR)this.expect(re.comma);return this.finishNode(Ht,"TSTupleType")}$2c(){let Ht=this.start,zt=this.startLoc,Yt=this.eat(re.ellipsis),Qt;if((this.type===re.name||this.type.keyword)&&this.$2d()){let en=this.startNode();en.label=this.parseIdent(!0),en.optional=this.eat(re.question),this.expect(re.colon),en.elementType=this.$0(),Qt=this.finishNode(en,"TSNamedTupleMember")}else if(Qt=this.$0(),this.eat(re.question)){let en=this.startNodeAt(Qt.start,Qt.loc?.start);en.typeAnnotation=Qt,Qt=this.finishNode(en,"TSOptionalType")}if(Yt){let en=this.startNodeAt(Ht,zt);en.typeAnnotation=Qt,Qt=this.finishNode(en,"TSRestType")}return Qt}$2d(){let Ht=this.$d();if(this.input.charCodeAt(Ht)===63)Ht=this.$d(Ht+1);return this.input.charCodeAt(Ht)===Aa}$8(){return this.$a(()=>{let Ht=this.startNode();this.next(),Ht.params=[];while(!this.$c()){let zt=this.startNode();while((this.type===re._const||this.type===re._in||this.isContextual("out"))&&Kt(this.$2()))zt[this.value]=!0,this.next();if(zt.name=this.$y(),this.eat(re._extends))zt.constraint=this.$0();if(this.eat(re.eq))zt.default=this.$0();if(Ht.params.push(this.finishNode(zt,"TSTypeParameter")),!this.$c()){if(this.expect(re.comma),this.$c())Ht.extra={trailingComma:this.lastTokStart}}}if(this.next(),Ht.params.length===0)this.$1y(this.start,"Type parameter list cannot be empty.");return this.finishNode(Ht,"TSTypeParameterDeclaration")})}$e(Ht=!1){return this.$a(()=>{let zt=this.startNode();this.next(),zt.params=[];while(!this.$c())if(zt.params.push(this.$0()),!this.$c())this.expect(re.comma);if(zt.params.length===0)this.unexpected();if(Ht){let Yt=this.input.charCodeAt(this.start+1);if(Yt===Wi||Yt===mu)this.unexpected()}return this.next(),this.finishNode(zt,"TSTypeParameterInstantiation")})}$1j(){let Ht=[];do{let zt=this.startNode();if(zt.expression=this.$k(),this.$1())zt.typeParameters=this.$e();Ht.push(this.finishNode(zt,"TSExpressionWithTypeArguments"))}while(this.eat(re.comma));return Ht}$1k(Ht=!1){if(this.type!==re.name||this.containsEsc){if(this.type===re._const&&this.$3()==="enum")return this.$10(this.startNode());return}if(!this.$2e(this.value))return;if(this.value==="declare")return this.$2f(Ht);return this.$1l(this.startNode(),this.value)}$2e(Ht){switch(Ht){case"interface":case"type":case"namespace":return this.$14();case"enum":return Kt(this.$2());case"abstract":return this.$b()&&this.$3()==="class";case"module":{let zt=this.$2();return this.$b()&&(zt===wr||zt===Tr||Kt(zt))}case"declare":return this.$b()&&nu.has(this.$3());case"global":return this.$b()&&this.$2()===ws}return!1}$1l(Ht,zt){switch(zt){case"interface":return this.$1m(Ht);case"type":return this.$2g(Ht);case"enum":return this.$10(Ht);case"abstract":return this.$1n(Ht,!0);case"global":return Ht.global=!0,Ht.id=this.parseIdent(),Ht.body=this.$11(),this.finishNode(Ht,"TSModuleDeclaration")}return this.$2h(Ht)}$2f(Ht){let zt=this.$5;this.$5=!0;let Yt=this.startNode();this.next();let Qt=this.value;if(Qt==="const"&&this.$3()==="enum")Yt.const=!0;if(!Ht&&iu.has(Qt))Yt.declare=!0;let en;if(Yt.const)en=this.$10(Yt);else if(Qt==="var"||Qt==="let"||Qt==="const")en=this.parseVarStatement(Yt,Qt,!0);else if(Qt==="function")this.next(),en=this.parseFunction(Yt,wa,!1,!1);else if(Qt==="class")en=this.parseClass(Yt,!0);else en=this.$1l(Yt,Qt);return en.declare=!0,this.$5=zt,en}$1n(Ht,zt){return this.next(),Ht.abstract=!0,this.parseClass(Ht,zt)}$1m(Ht){if(this.next(),Ht.id=this.parseIdent(),this.checkLValSimple(Ht.id,Ca),this.$1())Ht.typeParameters=this.$8();return this.$a(()=>{if(this.eat(re._extends))Ht.extends=this.$1j();let zt=this.startNode();zt.body=this.$1f(),Ht.body=this.finishNode(zt,"TSInterfaceBody")}),this.finishNode(Ht,"TSInterfaceDeclaration")}$2g(Ht){if(this.next(),Ht.id=this.parseIdent(),this.checkLValSimple(Ht.id,br),this.$1())Ht.typeParameters=this.$8();return Ht.typeAnnotation=this.$a(()=>(this.expect(re.eq),this.$0())),this.semicolon(),this.finishNode(Ht,"TSTypeAliasDeclaration")}$10(Ht){if(this.type===re._const)Ht.const=!0,this.next();this.next(),Ht.id=this.parseIdent(),this.checkLValSimple(Ht.id,uu),this.expect(re.braceL),Ht.members=[];while(!this.eat(re.braceR)){let zt=this.startNode();if(zt.id=this.type===re.string?this.parseExprAtom():this.parseIdent(!0),this.eat(re.eq))zt.initializer=this.parseMaybeAssign();if(Ht.members.push(this.finishNode(zt,"TSEnumMember")),this.type!==re.braceR)this.expect(re.comma)}return this.finishNode(Ht,"TSEnumDeclaration")}$2h(Ht){if(this.next(),this.type===re.string){if(Ht.id=this.parseExprAtom(),this.type===re.braceL)Ht.body=this.$11();else this.semicolon();return this.finishNode(Ht,"TSModuleDeclaration")}return Ht.id=this.parseIdent(),this.checkLValSimple(Ht.id,lu),this.$1o(Ht)}$1o(Ht){if(this.eat(re.dot)){let zt=this.startNode();zt.id=this.parseIdent(),Ht.body=this.$1o(zt)}else Ht.body=this.$11();return this.finishNode(Ht,"TSModuleDeclaration")}$11(){this.enterScope(ru);let Ht=this.startNode();this.enterScope(0),this.expect(re.braceL),Ht.body=[];while(!this.eat(re.braceR))Ht.body.push(this.parseStatement(null,!0));return this.exitScope(),this.exitScope(),this.finishNode(Ht,"TSModuleBlock")}$1p(Ht,zt){if(Ht.isExport=zt,Ht.id=this.parseIdent(),this.checkLValSimple(Ht.id,Ui),this.expect(re.eq),this.isContextual("require")&&this.$2()===Ta){let Yt=this.startNode();this.next(),Yt.expression=this.$1e(),Ht.moduleReference=this.finishNode(Yt,"TSExternalModuleReference")}else Ht.moduleReference=this.$k();return this.semicolon(),this.finishNode(Ht,"TSImportEqualsDeclaration")}$2i(){let Ht=this.$d();if(this.input.charCodeAt(Ht)!==Wi)return!1;let zt=this.input.charCodeAt(Ht+1);return zt!==Wi&&zt!==62}parseStatement(Ht,zt,Yt){if(this.type===qt)this.$1q(!0);let Qt=this.$1k();if(Qt)return Qt;return super.parseStatement(Ht,zt,Yt)}parseVarStatement(Ht,zt,Yt){return super.parseVarStatement(Ht,zt,Yt||this.$5)}parseVarId(Ht,zt){if(super.parseVarId(Ht,zt),Ht.id.type==="Identifier"&&this.$u()&&!this.hasPrecedingLineBreak())this.next(),Ht.definite=!0;this.$h(Ht.id,!1)}parseCatchClauseParam(){let Ht=this.$h(this.parseBindingAtom(),!1),zt=Ht.type==="Identifier";return this.enterScope(zt?su:0),this.checkLValPattern(Ht,zt?cu:Ui),this.expect(re.parenR),Ht}parseImport(Ht){if(this.next(),Ht.importKind="value",this.type===re.string)Ht.specifiers=[],Ht.source=this.parseExprAtom();else{if(this.isContextual("type")){let zt=this.$2();if(zt===ws||zt===Cr||Kt(zt)&&this.$3()!=="from")Ht.importKind="type",this.next()}if(this.type===re.name&&this.$2i())return this.$1p(Ht,!1);Ht.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),Ht.source=this.$z()}return this.$1r(Ht),this.semicolon(),this.finishNode(Ht,"ImportDeclaration")}parseWithClause(){if(this.isContextual("assert")&&!this.hasPrecedingLineBreak())this.type=re._with;return this.type===re._with?super.parseWithClause():void 0}$1r(Ht){let zt=this.parseWithClause();if(zt)Ht.attributes=zt}parseImportSpecifier(){return this.$1s("importKind",()=>super.parseImportSpecifier())}parseExportSpecifier(Ht){return this.$1s("exportKind",()=>super.parseExportSpecifier(Ht))}$1s(Ht,zt){let Yt=this.isContextual("type")?this.$2():-1;if(Yt===wr||Yt===Tr||Kt(Yt)&&this.$3()!=="as"){let en=this.startNode();this.next();let tn=zt();return this.$q(tn,en),tn[Ht]="type",tn}let Qt=zt();return Qt[Ht]="value",Qt}parseExport(Ht,zt){if(this.next(),this.eat(re._import)){if(Ht.importKind="value",this.isContextual("type")&&Kt(this.$2())&&this.$3()!=="from")Ht.importKind="type",this.next();return this.$1p(Ht,!0)}if(this.eat(re.eq))return Ht.expression=this.parseExpression(),this.semicolon(),this.finishNode(Ht,"TSExportAssignment");if(this.eatContextual("as"))return this.expectContextual("namespace"),Ht.id=this.parseIdent(),this.semicolon(),this.finishNode(Ht,"TSNamespaceExportDeclaration");if(Ht.exportKind="value",this.isContextual("type")){let en=this.$2();if(en===ws||en===Cr)Ht.exportKind="type",this.next()}if(this.eat(re.star))return this.parseExportAllDeclaration(Ht,zt);if(this.eat(re._default)){if(this.isContextual("interface")&&this.$14())Ht.declaration=this.$1m(this.startNode());else if(this.isContextual("abstract")&&this.$3()==="class")Ht.declaration=this.$1n(this.startNode(),"nullableID");else Ht.declaration=this.parseExportDefaultDeclaration();return this.finishNode(Ht,"ExportDefaultDeclaration")}let Yt=this.isContextual("declare"),Qt=this.$1k(!0);if(Qt||this.shouldParseExportStatement()){if(Ht.declaration=Qt??this.parseStatement(null),Yt||Ht.declaration.type==="TSInterfaceDeclaration"||Ht.declaration.type==="TSTypeAliasDeclaration")Ht.exportKind="type";return Ht.specifiers=[],Ht.source=null,this.finishNode(Ht,"ExportNamedDeclaration")}if(Ht.declaration=null,Ht.specifiers=this.parseExportSpecifiers(zt),this.eatContextual("from"))Ht.source=this.$z(),this.$1r(Ht);else{for(let en of Ht.specifiers)if(this.checkUnreserved(en.local),this.checkLocalExport(en.local),en.local.type==="Literal")this.raise(en.local.start,"A string literal cannot be used as an exported binding without `from`.");Ht.source=null}return this.semicolon(),this.finishNode(Ht,"ExportNamedDeclaration")}parseFunction(Ht,zt,Yt,Qt,en){let tn=zt&wa;if(tn)this.$f=Ht,this.$o=Ht.start;super.parseFunction(Ht,zt,Yt,Qt,en),this.$f=null;let nn=!Ht.body;if(nn)Ht.type="TSDeclareFunction";if(tn&&Ht.id){if(nn){if(this.$5&&this.currentScope().flags&ba)this.declareName(Ht.id.name,kr,Ht.id.start);this.checkLValSimple(Ht.id,ou)}else if(!(zt&hu)){let sn=pu;if(this.strict||Ht.generator||Ht.async)sn=this.treatFunctionsAsVar?au:Ui;this.checkLValSimple(Ht.id,sn)}}return Ht}parseFunctionParams(Ht){if(this.$1())Ht.typeParameters=this.$8();if(super.parseFunctionParams(Ht),this.type===re.colon)Ht.returnType=this.$6(!0)}parseFunctionBody(Ht,zt,Yt,Qt){if(Yt&&this.type===re.colon)Ht.returnType=this.$6(!0);if(zt||this.type===re.braceL||Ht.start!==this.$o){super.parseFunctionBody(Ht,zt,Yt,Qt);return}this.semicolon(),this.exitScope()}parseMethod(Ht,zt,Yt){let Qt=this.$l;this.$l=null,this.$j=!0;let en=super.parseMethod(Ht,zt,Yt);if(!en.body)en.type="TSDeclareMethod";if(Qt)en.typeParameters=Qt;return en}parseBindingList(Ht,zt,Yt,Qt){let en=Qt===!0||this.$j;return this.$j=!1,super.parseBindingList(Ht,zt,Yt,en)}$s(Ht){if(!Ht&&!this.$b())return!1;let zt=this.$2();return zt===gu||zt===ws||zt===Cr||zt===ka||zt===yu||zt===wr||zt===Tr||zt>=48&&zt<=57||Kt(zt)}parseAssignableListItem(Ht){let zt=this.$12(),Yt=this.start,Qt=this.startLoc,en,tn=!1,nn=!1;if(Ht)while(this.type===re.name&&tu.has(this.value)&&!this.containsEsc&&this.$s(!1)){if(this.value==="readonly")tn=!0;else if(this.value==="override")nn=!0;else en=this.value;this.next()}let sn;if(this.type===re._this)sn=this.startNode(),sn.name="this",this.next(),this.finishNode(sn,"Identifier");else sn=this.parseBindingAtom();let on=this.type===re.eq?this.parseMaybeDefault(Yt,Qt,sn):this.parseMaybeDefault(sn.start,sn.loc?.start,this.$h(sn,!0));if(zt.length>0)on.decorators=zt;if(!en&&!tn&&!nn)return on;if(on.type!=="Identifier"&&on.type!=="AssignmentPattern")this.raise(Yt,"A parameter property may not be declared using a binding pattern.");let rn=this.startNodeAt(Yt,Qt);if(en)rn.accessibility=en;if(tn)rn.readonly=!0;if(nn)rn.override=!0;return rn.parameter=on,this.finishNode(rn,"TSParameterProperty")}parseBindingListItem(Ht){if(Ht.type==="RestElement")this.$h(Ht,!0);return Ht}checkLValSimple(Ht,zt,Yt){if(this.$f&&Ht===this.$f.id){this.$f=null;return}if(!zt&&Sa.has(Ht.type)){this.checkLValSimple(Ht.expression,zt,Yt);return}switch(Ht.type){case"TSParameterProperty":this.checkLValInnerPattern(Ht.parameter,zt,Yt);return;case"Identifier":if(Ht.name==="this")return}super.checkLValSimple(Ht,zt,Yt)}toAssignable(Ht,zt,Yt){if(Ht&&!zt&&Sa.has(Ht.type))return Ht;return super.toAssignable(Ht,zt,Yt)}declareName(Ht,zt,Yt){let Qt=this.currentScope();if(zt&kr){this.$1t(Qt,Ht),Qt.$1u??=[],Qt.$1u.push(Ht);return}if(zt===br||zt===Ca){if(Qt.$13??=[],zt===br&&Pn(Qt.$13,Ht))this.raise(Yt,`type '${Ht}' has already been declared.`);Qt.$13.push(Ht),this.$1t(Qt,Ht);return}if(zt&_a){if(Qt.$1v??=[],Pn(Qt.$1v,Ht))return;super.declareName(Ht,Ui,Yt),Qt.$1v.push(Ht);return}super.declareName(Ht,zt,Yt)}$1t(Ht,zt){if(this.inModule&&Ht.flags&ba)delete this.undefinedExports[zt]}checkLocalExport(Ht){for(let zt=this.scopeStack.length-1;zt>=0;zt--){let Yt=this.scopeStack[zt];if(Pn(Yt.$13,Ht.name)||Pn(Yt.$1u,Ht.name))return}super.checkLocalExport(Ht)}checkExport(){}raiseRecoverable(Ht,zt){if(zt==="Duplicate constructor in the same class")return;super.raiseRecoverable(Ht,zt)}$12(){let Ht=[];while(this.type===qt)Ht.push(this.$1w());return Ht}$1q(Ht){let zt=this.$9[this.$9.length-1];while(this.type===qt)zt.push(this.$1w());if(this.type===re._export){if(!Ht)this.unexpected()}else if(this.type!==re._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 Ht=this.startNode();this.next(),this.$9.push([]);let zt=this.start,Yt=this.startLoc,Qt;if(this.type===re.parenL){if(this.next(),Qt=this.parseExpression(),this.expect(re.parenR),this.options.preserveParens){let tn=this.startNodeAt(zt,Yt);tn.expression=Qt,Qt=this.finishNode(tn,"ParenthesizedExpression")}}else{Qt=this.parseIdent(!1);while(this.eat(re.dot)){let tn=this.startNodeAt(zt,Yt);tn.object=Qt,tn.property=this.parseIdent(!0),tn.computed=!1,Qt=this.finishNode(tn,"MemberExpression")}}let en=this.$p()?this.$e(!0):void 0;if(this.eat(re.parenL)){let tn=this.startNodeAt(Qt.start,Qt.loc?.start);if(tn.callee=Qt,tn.arguments=this.parseExprList(re.parenR,!1,!1),en)tn.typeArguments=en;Qt=this.finishNode(tn,"CallExpression")}else if(en){let tn=this.startNodeAt(Qt.start,Qt.loc?.start);tn.expression=Qt,tn.typeArguments=en,Qt=this.finishNode(tn,"TSInstantiationExpression")}return Ht.expression=Qt,this.$9.pop(),this.finishNode(Ht,"Decorator")}shouldParseExportStatement(){return this.type===qt||super.shouldParseExportStatement()}parseExprAtom(Ht,zt,Yt){if(this.type===qt)this.$1q(!1);return super.parseExprAtom(Ht,zt,Yt)}parseProperty(Ht,zt){if(Ht||this.type!==qt)return super.parseProperty(Ht,zt);let Yt=this.$12(),Qt=super.parseProperty(Ht,zt);if(Qt.type==="SpreadElement")this.raise(Qt.start,"Decorators can't be used with SpreadElement");return Qt.decorators=Yt,Qt}parseClassId(Ht,zt){let Yt=this.$9.length-1,Qt=this.$9[Yt];if(Qt.length>0)Ht.decorators=Qt,this.$q(Ht,Qt[0]),this.$9[Yt]=[];if(!this.isContextual("implements")||zt===!0)super.parseClassId(Ht,zt);if(this.$1())Ht.typeParameters=this.$8()}parseClassSuper(Ht){if(super.parseClassSuper(Ht),Ht.superClass&&this.$1())Ht.superTypeParameters=this.$e(!0);if(this.eatContextual("implements"))Ht.implements=this.$a(()=>this.$1j())}parseClassElement(Ht){if(this.type===qt){let nn=this.$12();if(this.type===re.braceR)this.raise(this.start,"Decorators must be attached to a class element.");let sn=this.parseClassElement(Ht);return sn.decorators=nn,this.$q(sn,nn[0]),sn}if(this.eat(re.semi))return null;let zt=this.startNode();while(this.type===re.name&&eu.has(this.value)&&!this.containsEsc&&this.$s(this.value==="static")){let nn=this.value;if(this.next(),nn==="static"&&this.type===re.braceL)return this.next(),this.parseClassStaticBlock(zt),zt;if(nn==="public"||nn==="private"||nn==="protected")zt.accessibility=nn;else zt[nn]=!0}if(this.type===re.bracketL&&this.$1g())return this.$1h(zt);zt.static??=!1;let Yt="",Qt=!1,en=!1,tn="method";if(this.eatContextual("async"))if((this.isClassElementNameStart()||this.type===re.star)&&!this.canInsertSemicolon())en=!0;else Yt="async";if(!Yt&&this.eat(re.star))Qt=!0;if(!Yt&&!en&&!Qt){let nn=this.value;if(this.eatContextual("get")||this.eatContextual("set"))if(this.isClassElementNameStart())tn=nn;else Yt=nn}if(Yt)zt.computed=!1,zt.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),zt.key.name=Yt,this.finishNode(zt.key,"Identifier");else this.parseClassElementName(zt);if(this.eat(re.question))zt.optional=!0;if(this.type===re.parenL||this.$1()||tn!=="method"||Qt||en){let nn=zt.key,sn=!zt.static&&!zt.computed&&(nn.type==="Identifier"&&nn.name==="constructor"||nn.type==="Literal"&&nn.value==="constructor");if(zt.kind=sn?"constructor":tn,this.$1())zt.typeParameters=this.$8();this.$o=this.start,this.parseClassMethod(zt,Qt,en,sn&&Ht)}else{if(!zt.optional&&this.$u())this.next(),zt.definite=!0;if(this.type===re.colon)zt.typeAnnotation=this.$6();this.parseClassField(zt)}return zt}parseMaybeAssign(Ht,zt,Yt){if(this.$p()){let Qt=this.$g(()=>{let en=this.$8(),tn=super.parseMaybeAssign(Ht,zt,Yt);if(tn.type!=="ArrowFunctionExpression")return;return tn.typeParameters=en,this.$q(tn,en),tn});if(Qt)return Qt}return super.parseMaybeAssign(Ht,zt,Yt)}parseMaybeUnary(Ht,zt,Yt,Qt){if(this.$p()){let en=this.startNode();return en.typeAnnotation=this.$a(()=>{this.next();let tn=this.$0();if(!this.$c())this.unexpected();return this.next(),tn}),en.expression=this.parseMaybeUnary(null,!1,!1,Qt),this.finishNode(en,"TSTypeAssertion")}return super.parseMaybeUnary(Ht,zt,Yt,Qt)}parseMaybeConditional(Ht,zt){let Yt=this.start,Qt=this.startLoc,en=this.parseExprOps(Ht,zt);if(this.checkExpressionErrors(zt))return en;if(this.type===re.question&&!(en.type==="ArrowFunctionExpression"&&en.start===Yt)&&!this.$2j()){this.next();let tn=this.startNodeAt(Yt,Qt);return tn.test=en,tn.consequent=this.parseMaybeAssign(),this.expect(re.colon),tn.alternate=this.parseMaybeAssign(Ht),this.finishNode(tn,"ConditionalExpression")}return en}$2j(){let Ht=this.$d(),zt=this.input.charCodeAt(Ht);if(zt===Aa||zt===fu||zt===du)return!0;return zt===Wi&&this.input.charCodeAt(Ht+1)!==Wi}parseParenItem(Ht){return this.$h(Ht,!0)}$1x(){if(this.type!==re.colon)return!0;let Ht=this.$g(()=>{let zt=this.$6(!0);return this.type===re.arrow&&!this.canInsertSemicolon()?zt:void 0});if(!Ht)return!1;return this.$7=Ht,!0}shouldParseArrow(Ht){return this.$1x()&&super.shouldParseArrow(Ht)}shouldParseAsyncArrow(){return this.$1x()&&super.shouldParseAsyncArrow()}parseArrowExpression(Ht,zt,Yt,Qt){if(this.$7)Ht.returnType=this.$7,this.$7=null;return super.parseArrowExpression(Ht,zt,Yt,Qt)}parseExprList(Ht,zt,Yt,Qt){if(!this.$m)return super.parseExprList(Ht,zt,Yt,Qt);this.$m=!1;let en=[],tn=!0;while(!this.eat(Ht)){if(tn)tn=!1;else if(this.expect(re.comma),zt&&this.afterTrailingComma(Ht))break;if(this.type===re.ellipsis){let nn=this.parseSpread(Qt);if(this.eat(re.question))nn.optional=!0;if(this.type===re.colon)nn.typeAnnotation=this.$6();en.push(nn)}else en.push(this.parseMaybeAssign(!1,Qt,this.parseParenItem))}return en}parseSubscript(Ht,zt,Yt,Qt,en,tn,nn){if(this.$u()&&!this.hasPrecedingLineBreak()){let on=this.startNodeAt(zt,Yt);return this.exprAllowed=!1,this.next(),on.expression=Ht,this.finishNode(on,"TSNonNullExpression")}if(en&&this.$1()){let on=this.$g(()=>this.$2k(zt,Yt,nn));if(on)return on}let sn=this.type===re.questionDot&&this.$2()===Pa;if(this.$1()||sn||this.type===re.bitShift&&this.value==="<<"){let on=this.$g(()=>{if(sn)this.next();this.$p();let rn=this.$e(!0);if(this.type===re.parenL&&!Qt)return rn;if(this.type===re.backQuote)return sn?void 0:rn;if(sn)return;if(this.$c()||this.type===re.bitShift||this.type.startsExpr&&this.type!==re.parenL&&!this.hasPrecedingLineBreak())return;return rn});if(on){let rn=this.startNodeAt(zt,Yt);if(this.type===re.parenL&&!Qt){if(this.next(),rn.callee=Ht,rn.arguments=this.parseExprList(re.parenR,!0,!1),rn.typeArguments=on,sn)Ht.optional=!0;if(sn||tn)rn.optional=sn;return this.finishNode(rn,"CallExpression")}if(this.type===re.backQuote)return rn.tag=Ht,rn.quasi=this.parseTemplate({isTagged:!0}),rn.typeArguments=on,this.finishNode(rn,"TaggedTemplateExpression");return rn.expression=Ht,rn.typeArguments=on,this.finishNode(rn,"TSInstantiationExpression")}}if(en&&this.type===re.parenL)this.$m=!0;return super.parseSubscript(Ht,zt,Yt,Qt,en,tn,nn)}$2k(Ht,zt,Yt){let Qt=this.startNodeAt(Ht,zt);if(Qt.typeParameters=this.$8(),this.expect(re.parenL),Qt.params=this.parseBindingList(re.parenR,!1,!0),this.type===re.colon)Qt.returnType=this.$6(!0);if(this.type!==re.arrow||this.canInsertSemicolon())return;return this.next(),this.parseArrowExpression(Qt,Qt.params,!0,Yt)}parseDynamicImport(Ht){if(this.next(),Ht.source=this.parseMaybeAssign(),this.eat(re.comma)&&this.type!==re.parenR)Ht.arguments=[this.parseExpression()];return this.expect(re.parenR),this.finishNode(Ht,"ImportExpression")}parseNew(){let Ht=super.parseNew();if(Ht.callee?.type!=="TSInstantiationExpression")return Ht;let zt=this.startNodeAt(Ht.start,Ht.loc?.start);return zt.callee=Ht.callee.expression,zt.typeArguments=Ht.callee.typeArguments,zt.arguments=Ht.arguments,this.finishNodeAt(zt,"NewExpression",Ht.end,Ht.loc?.end)}parseExprOp(Ht,zt,Yt,Qt,en){if(re._in.binop>Qt&&this.type===re.name&&(this.value==="as"||this.value==="satisfies")&&!this.containsEsc&&!this.hasPrecedingLineBreak()){let tn=this.value==="satisfies",nn=this.startNodeAt(zt,Yt);return nn.expression=Ht,nn.typeAnnotation=this.$a(()=>{if(this.next(),!tn&&this.type===re._const){let sn=this.startNode();return sn.typeName=this.parseIdent(!0),this.finishNode(sn,"TSTypeReference")}return this.$0()}),this.finishNode(nn,tn?"TSSatisfiesExpression":"TSAsExpression"),this.parseExprOp(nn,zt,Yt,Qt,en)}return super.parseExprOp(Ht,zt,Yt,Qt,en)}parseGetterSetter(Ht){Ht.kind=Ht.key.name,super.parseGetterSetter(Ht)}parsePropertyValue(Ht,zt,Yt,Qt,en,tn,nn,sn){if(!zt&&this.$1()){if(this.$l=this.$8(),this.type!==re.parenL)this.unexpected();Ht.kind="init"}return super.parsePropertyValue(Ht,zt,Yt,Qt,en,tn,nn,sn)}}return Xt});function He(ne){return{support:"typescript",parser:ne}}function Ue(ne){return ne&&"parser"in ne?ne.parser:void 0}function Je(ne){return ne&&"names"in ne?ne.names:void 0}function ue(){throw Error('svelte-ast: parsing TypeScript needs `typescript` from "svelte-ast/typescript": createParser({ typescript }) or createModuleParser({ typescript })')}var vu=/^\t+/;class e extends Error{name="ParseError";code;reason;position;start;end;frame;constructor(ne,re,Be){super(`${Be}
|
|
18
|
+
https://svelte.dev/e/${re}`);this.code=re,this.reason=Be;let Wt=typeof ne==="number"?ne:ne?.start,Kt=typeof ne==="number"?ne:ne?.end;if(Wt!==void 0)this.position=[Wt,Kt??Wt],this.start=x(this.position[0]),this.end=x(this.position[1]),this.frame=Eu(this.start.line-1,this.end.column)}}var $a=(ne)=>ne.replace(vu,(re)=>" ".repeat(re.length));function Eu(ne,re){let Be=Math.max(0,ne-2),Wt=[];for(let qt=Be;qt<ne+3;qt++){let Xt=jo(qt);if(Xt===void 0)break;Wt.push(Xt)}let Kt=String(Be+Wt.length+1).length;return Wt.map((qt,Xt)=>{let Ht=`${String(Be+Xt+1).padStart(Kt," ")}: ${$a(qt)}`;if(Be+Xt!==ne)return Ht;return`${Ht}
|
|
19
|
+
${" ".repeat(Kt+2+$a(qt.slice(0,re)).length)}^`}).join(`
|
|
20
|
+
`)}function Ke(ne){throw new e(ne,"attribute_duplicate","Attributes need to be unique")}function qe(ne){throw new e(ne,"attribute_empty_shorthand","Attribute shorthand cannot be empty")}function de(ne,re){throw new e(ne,"block_duplicate_clause",`${re} cannot appear more than once within a block`)}function ze(ne){throw new e(ne,"block_invalid_continuation_placement","{:...} block is invalid at this position (did you forget to close the preceding element or block?)")}function Xe(ne){throw new e(ne,"block_invalid_elseif","'elseif' should be 'else if'")}function Ye(ne,re,Be){throw new e(ne,"block_invalid_placement",`{#${re} ...} block cannot be ${Be}`)}function Qe(ne){throw new e(ne,"block_unclosed","Block was left open")}function Ze(ne){throw new e(ne,"block_unexpected_close","Unexpected block closing tag")}function et(ne){throw new e(ne,"const_tag_invalid_expression","{@const ...} must consist of a single variable declaration")}function tt(ne){throw new e(ne,"css_empty_declaration","Declaration cannot be empty")}function ke(ne){throw new e(ne,"css_expected_identifier","Expected a valid CSS identifier")}function nt(ne){throw new e(ne,"css_selector_invalid","Invalid selector")}function rt(ne){throw new e(ne,"debug_tag_invalid_arguments","{@debug ...} arguments must be identifiers, not arbitrary expressions")}function De(ne){throw new e(ne,"declaration_tag_invalid_type","Declaration tags must be `let` or `const` declarations")}function it(ne){throw new e(ne,"directive_invalid_value","Directive value must be a JavaScript expression enclosed in curly braces")}function st(ne,re){throw new e(ne,"directive_missing_name",`\`${re}\` name cannot be empty`)}function ot(ne,re){throw new e(ne,"element_invalid_closing_tag",`\`</${re}>\` attempted to close an element that was not open`)}function at(ne,re,Be){throw new e(ne,"element_invalid_closing_tag_autoclosed",`\`</${re}>\` attempted to close element that was already automatically closed by \`<${Be}>\` (cannot nest \`<${Be}>\` inside \`<${re}>\`)`)}function Ne(ne,re){throw new e(ne,"element_unclosed",`\`<${re}>\` was left open`)}function _e(ne){throw new e(ne,"expected_attribute_value","Expected attribute value")}function pt(ne){throw new e(ne,"expected_block_type","Expected 'if', 'each', 'await', 'key' or 'snippet'")}function $e(ne){throw new e(ne,"expected_identifier","Expected an identifier")}function lt(ne){throw new e(ne,"expected_pattern","Expected identifier or destructure pattern")}function ct(ne){throw new e(ne,"expected_tag","Expected 'html', 'render', 'attach', 'const', or 'debug'")}function D(ne,re){throw new e(ne,"expected_token",`Expected token ${re}`)}function ut(ne){throw new e(ne,"expected_whitespace","Expected whitespace")}function Su(ne,re){throw new e(ne,"js_parse_error",`${re}`)}function dt(ne){throw new e(ne,"render_tag_invalid_expression","`{@render ...}` tags can only contain call expressions")}function ft(ne){throw new e(ne,"script_duplicate","A component can have a single top-level `<script>` element and/or a single top-level `<script module>` element")}function mt(ne,re){throw new e(ne,"script_invalid_attribute_value",`If the \`${re}\` attribute is supplied, it must be a boolean attribute`)}function ht(ne){throw new e(ne,"script_invalid_context",'If the context attribute is supplied, its value must be "module"')}function gt(ne,re){throw new e(ne,"script_reserved_attribute",`The \`${re}\` attribute is reserved and cannot be used`)}function yt(ne){throw new e(ne,"style_duplicate","A component can have a single top-level `<style>` element")}function xt(ne){throw new e(ne,"svelte_component_invalid_this","Invalid component definition — must be an `{expression}`")}function Et(ne){throw new e(ne,"svelte_component_missing_this","`<svelte:component>` must have a 'this' attribute")}function Re(ne){throw new e(ne,"svelte_element_missing_this","`<svelte:element>` must have a 'this' attribute with a value")}function St(ne,re){throw new e(ne,"svelte_meta_duplicate",`A component can only have one \`<${re}>\` element`)}function vt(ne,re){throw new e(ne,"svelte_meta_invalid_content",`<${re}> cannot have children`)}function Tt(ne,re){throw new e(ne,"svelte_meta_invalid_placement",`\`<${re}>\` tags cannot be inside elements or blocks`)}function Ct(ne,re){throw new e(ne,"svelte_meta_invalid_tag",`Valid \`<svelte:...>\` tag names are ${re}`)}function bt(ne){throw new e(ne,"svelte_options_deprecated_tag",'"tag" option is deprecated — use "customElement" instead')}function Pt(ne){throw new e(ne,"svelte_options_invalid_attribute","`<svelte:options>` can only receive static attributes")}function fe(ne,re){throw new e(ne,"svelte_options_invalid_attribute_value",`Value must be ${re}, if specified`)}function At(ne){throw new e(ne,"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 wt(ne){throw new e(ne,"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 kt(ne){throw new e(ne,"svelte_options_invalid_customelement_shadow",'"shadow" must be either "open", "none" or `ShadowRootInit` object.')}function Ie(ne){throw new e(ne,"svelte_options_invalid_tagname","Tag name must be lowercase and hyphenated")}function Dt(ne){throw new e(ne,"svelte_options_reserved_tagname","Tag name is reserved")}function Nt(ne,re){throw new e(ne,"svelte_options_unknown_attribute",`\`<svelte:options>\` unknown attribute '${re}'`)}function _t(ne){throw new e(ne,"tag_invalid_name","Expected a valid element or component name. Components must have a valid variable name or dot notation expression")}function $t(ne,re,Be){throw new e(ne,"tag_invalid_placement",`{@${re} ...} tag cannot be ${Be}`)}function f(ne){throw new e(ne,"unexpected_eof","Unexpected end of input")}function Rt(ne,re){throw new e(ne,"unexpected_reserved_word",`'${re}' is a reserved word in JavaScript and cannot be used here`)}function It(ne){throw new e(ne,"unterminated_string_constant","Unterminated string constant")}function Lt(ne){throw new e(ne,"void_element_invalid_content","Void elements cannot have children or closing tags")}var ki="",Ra=[],ks=0,Sn=[],bn=0;function bu(ne,re){ki=ne,Ra=re,ks=0}function Cu(){return ks}function wu(ne,re,Be,Wt){ks=Wt}function Tu(ne,re,Be,Wt,Kt,qt){ks=Wt;let Xt=re;if(ne&&Xt.includes(`
|
|
21
|
+
`)){let zt=ki.lastIndexOf(`
|
|
22
|
+
`,Be-1)+1,Yt=zt,Qt=ki.charCodeAt(Yt);while(Qt===32||Qt===9)Qt=ki.charCodeAt(++Yt);if(Yt>zt)Xt=ku(Xt,ki.slice(zt,Yt))}let Ht={type:ne?"Block":"Line",value:Xt,start:Be,end:Wt};if(Kt&&qt)Ht.loc={start:Kt,end:qt};Ra.push(Ht)}function ku(ne,re){let Be=ne.startsWith(re)?re.length:0,Wt="",Kt=ne.indexOf(`
|
|
23
|
+
`,Be);while(Kt!==-1){if(Wt+=ne.slice(Be,Kt+1),Be=Kt+1,ne.startsWith(re,Be))Be+=re.length;Kt=ne.indexOf(`
|
|
24
|
+
`,Be)}return Wt+ne.slice(Be)}function Au(ne,re,Be){let Wt=0,Kt=re.length;while(Wt<Kt){let qt=Wt+Kt>>>1;if(re[qt].start<Be)Wt=qt+1;else Kt=qt}if(Wt>=re.length)return;if(Sn=re.slice(Wt).map(({type:qt,value:Xt,start:Ht,end:zt})=>({type:qt,value:Xt,start:Ht,end:zt})),bn=0,Pr(ne,void 0,!1),bn<Sn.length&&(Sn[bn].start>=ne.end||ne.type==="Program")){ne.trailingComments??=[];while(bn<Sn.length)ne.trailingComments.push(Sn[bn++])}}var Pu=new Map([["BlockStatement","body"],["Program","body"],["ArrayExpression","elements"],["ObjectExpression","properties"]]);function Na(ne,re){for(let Be=ne;Be<re;Be++){let Wt=ki.charCodeAt(Be);if(Wt!==44&&Wt!==41&&Wt!==32&&Wt!==9)return!0}return!1}function Pr(ne,re,Be){while(bn<Sn.length&&Sn[bn].start<ne.start)ne.leadingComments??=[],ne.leadingComments.push(Sn[bn++]);if(bn>=Sn.length)return;let Wt=Sn[bn].start;if(Wt<ne.end||!Na(ne.end,Wt)){let Kt=ci(ne),qt=Pu.get(ne.type),Xt=qt===void 0?void 0:Kt[qt],Ht=Array.isArray(Xt)&&Xt.length===0;for(let zt in Kt){if(bn>=Sn.length)return;if(zt==="type")continue;let Yt=Kt[zt];if(Array.isArray(Yt)){let Qt=zt===qt;for(let en=0;en<Yt.length;en++){let tn=Yt[en];if(Hn(tn))Pr(tn,ne,Qt?en===Yt.length-1:Ht)}}else if(Hn(Yt))Pr(Yt,ne,Ht)}if(bn>=Sn.length)return}if(re!==void 0&&ne.end===re.end)return;if(Be)while(bn<Sn.length){if(re&&Sn[bn].start>=re.end)break;ne.trailingComments??=[],ne.trailingComments.push(Sn[bn++])}else if(ne.end<=Sn[bn].start&&!Na(ne.end,Sn[bn].start))ne.trailingComments=[Sn[bn++]]}var me=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(" ")),As=!1,Ki=1,_u=2,$u=32,Nu=256,Du=Ki|_u|Nu,Ru=2,Iu=3,Ou=4,Lu=/\r\n?|\n|\u2028|\u2029/,Da=new Map;function Ts(ne){if(!(ne instanceof RegExp))return ne;let re=Da.get(ne);if(!re){let Be=new Set(ne.source.slice(4,-2).split("|"));re={test:(Wt)=>Be.has(Wt)},Da.set(ne,re)}return re}var _r=Vi((ne)=>class extends ne{declareName(re,Be,Wt){let Kt=!1;if(Be===Ru){let qt=this.currentScope();if(Kt=Pn(qt.lexical,re)||Pn(qt.functions,re)||Pn(qt.var,re),qt.lexical.push(re),this.inModule&&qt.flags&Ki)delete this.undefinedExports[re]}else if(Be===Ou)this.currentScope().lexical.push(re);else if(Be===Iu){let qt=this.currentScope();Kt=this.treatFunctionsAsVar?Pn(qt.lexical,re):Pn(qt.lexical,re)||Pn(qt.var,re),qt.functions.push(re)}else for(let qt=this.scopeStack.length-1;qt>=0;--qt){let Xt=this.scopeStack[qt];if(Pn(Xt.lexical,re)&&!(Xt.flags&$u&&Xt.lexical[0]===re)||!this.treatFunctionsAsVarInScope(Xt)&&Pn(Xt.functions,re)){Kt=!0;break}if(Xt.var.push(re),this.inModule&&Xt.flags&Ki)delete this.undefinedExports[re];if(Xt.flags&Du)break}if(Kt)this.raiseRecoverable(Wt,`Identifier '${re}' has already been declared`)}}),$r=Vi((ne)=>{let{keywordTypes:re,tokTypes:Be}=ne.acorn,Wt=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((qt)=>[qt,re[qt]])),Kt;return class extends ne{constructor(qt,Xt,Ht){super(qt,Xt,Ht);this.keywords=Ts(this.keywords),this.reservedWords=Ts(this.reservedWords),this.reservedWordsStrict=Ts(this.reservedWordsStrict),this.reservedWordsStrictBind=Ts(this.reservedWordsStrictBind),Kt??=this.context[0]}reset(qt,Xt,Ht){if(super.reset?.(qt,Xt,Ht),this.input=qt,this.containsEsc=!1,this.pos=Xt,Ht)this.lineStart=Xt-Ht.column,this.curLine=Ht.line;else this.lineStart=qt.lastIndexOf(`
|
|
25
|
+
`,Xt-1)+1,this.curLine=this.options.locations?qt.slice(0,this.lineStart).split(Lu).length:1;this.type=Be.eof,this.value=null,this.start=this.end=Xt,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=Xt;let zt=this.context;if(zt.length!==1||zt[0]!==Kt)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 en in this.undefinedExports){this.undefinedExports=Object.create(null);break}let Yt=this.scopeStack,Qt=Yt[0];if(Yt.length!==1||Qt.flags!==Ki||Qt.var.length>0||Qt.lexical.length>0||Qt.functions.length>0||Qt.tsTypes!==void 0||Qt.tsExportOnly!==void 0||Qt.tsEnums!==void 0)this.scopeStack=[],this.enterScope(Ki);if(this.regexpState=null,this.privateNameStack.length>0)this.privateNameStack=[];this.inTemplateElement=!1}parseParenAndDistinguishExpression(qt,Xt){let Ht=super.parseParenAndDistinguishExpression(qt,Xt);if(Ht.type==="ParenthesizedExpression")As=!0;return Ht}checkUnreserved(qt){if(me.has(qt.name))super.checkUnreserved(qt)}canInsertSemicolon(){let qt=this.type;return qt===Be.eof||qt===Be.braceR||Gi(this.input,this.lastTokEnd,this.start)}checkLocalExport(){}skipSpace(){let qt=this.input,Xt=this.options.locations,Ht=this.pos,zt=qt.charCodeAt(Ht);for(;;)if(zt===32||zt===9)zt=qt.charCodeAt(++Ht);else if(zt===10){if(zt=qt.charCodeAt(++Ht),Xt)this.curLine++,this.lineStart=Ht}else break;if(this.pos=Ht,zt===47||zt<33||zt>=128)super.skipSpace()}readWord1(){let qt=this.input,Xt=this.pos,Ht=Xt,zt=qt.charCodeAt(Ht),Yt=0;while(zt>=97&&zt<=122||zt>=65&&zt<=90||zt>=48&&zt<=57||zt===95||zt===36)Yt=Math.imul(Yt,31)+zt|0,zt=qt.charCodeAt(++Ht);if(zt>=128||zt===92)return super.readWord1();return this.containsEsc=!1,this.pos=Ht,Mo(qt,Xt,Ht,Yt)}readWord(){let qt=this.readWord1();return this.finishToken(Wt.get(qt)??Be.name,qt)}}}),Ia=Cs(_r,$r),Mu=/ \(\d+:\d+\)$/;function Ai(ne){return ne}function Oa(ne){return ne instanceof SyntaxError&&"pos"in ne&&typeof ne.pos==="number"}function Ps(ne,re,Be,Wt,Kt,qt=ne.root.comments.length){let Xt=ne.root.comments;bu(re,Xt);let Ht={onComment:ne.comments?Tu:wu,sourceType:"module",ecmaVersion:16,locations:ne.loc,preserveParens:Wt};if(ne.lfOnly)Ht.startLocation=x(Be);let zt=ne.isTypeScript?ne.typescript:Ia;if(!zt)ue();let Yt;try{Yt=Kt(zt,Ht)}catch(Qt){if(!Oa(Qt))throw Qt;Su(Qt.pos,Qt.message.replace(Mu,""))}if(Xt.length>qt)Au(Ai(Yt),Xt,Be);return Yt}function he(ne,re,Be=0){return Ai(Ps(ne,re,0,!1,(Wt,Kt)=>{if(Be>0&&Kt.locations)Kt.startLocation=x(Be);let qt=new Wt(Kt,re,Be).parse();return qt.start=0,qt},0))}function Fu(ne,re){if(!re)return{line:1,column:0};let{column:Be}=x(ne);return{line:Bo(ne-Be)+1,column:Be}}var Bu={count:0},Ar,ju=(ne)=>ne.parseExpression();function Vu(ne,re,Be,Wt,Kt){let qt=Ar;if(Ar=void 0,qt?.ParserClass===ne&&qt.onComment===re.onComment&&qt.locations===re.locations&&qt.parser.reset)qt.parser.reset(Be,Wt,re.startLocation);else qt={ParserClass:ne,onComment:re.onComment,locations:re.locations,parser:new ne(re,Be,Wt)};let Xt=qt.parser;Xt.nextToken();let Ht=Kt(Xt);return Xt.input="",Ar=qt,Ht}function La(ne,re,Be,Wt){return Bu.count+=1,As=!1,Ps(ne,re,Be,!0,(Kt,qt)=>(qt.startLocation??=Fu(Be,qt.locations),Vu(Kt,qt,re,Be,Wt)))}function G(ne,re,Be,Wt=!1){let Kt=Ai(La(ne,re,Be,ju)),qt=Math.max(Kt.end,Cu());return{node:As&&!Wt?Nr(Kt):Kt,end:qt}}function Ot(ne,re,Be){let Wt=ne.root.comments.length,Kt=!0,qt=La(ne,re,Be,(Ht)=>{let zt={shorthandAssign:-1,trailingComma:-1,parenthesizedAssign:-1,parenthesizedBind:-1,doubleProto:-1},Yt=Ht.parseMaybeConditional(void 0,zt);if(Ht.type!==Ia.acorn.tokTypes.eof)return Kt=!1,Yt;let Qt=Ht.toAssignable(Yt,!1,zt);return Ht.checkLValPattern(Qt),Qt});if(!Kt){ne.root.comments.length=Wt;return}let Xt=Ai(qt);return As?Nr(Xt):Xt}function Mt(ne,re,Be){return Ai(Ps(ne,re,Be,!1,(Wt,Kt)=>{let qt=new Wt(Kt,re,Be);try{return qt.nextToken(),qt.parseStatement(null,!0,Object.create(null))}catch(Xt){if(Oa(Xt)&&Xt.pos===re.length)f(re.length);throw Xt}}))}function Ft(ne,re,Be){let Wt=Ps(ne,re,0,!1,(Kt,qt)=>{let Xt=new Kt(qt,re,0),Ht=Xt.startNode(),zt=[],Yt=Object.create(null);return Be((Qt)=>{Xt.pos=Qt,Xt.context=Xt.initialContext(),Xt.exprAllowed=!0,Xt.nextToken();let en=Xt.parseStatement(null,!0,Yt);return zt.push(en),en.end}),Ht.body=zt,Xt.finishNode(Ht,"Program")});return Ai(Wt).body}function Nr(ne){let re=ne;while(re.type==="ParenthesizedExpression")re=re.expression;return q(re,Nr),re}var ge=Cs(_r,ce,$r);function ye(ne,re,Be){return M(ne),he({isTypeScript:re.typescript??!1,typescript:Be,loc:re.loc??!1,comments:re.comments??!0,root:{comments:[]}},ne)}function R(ne,re={}){return ye(ne,re,ge)}function xe(ne,re){let Be=u(ne.name,re.name);if(Be!==0)return Be;let Wt=u(ne.type,re.type);if(Wt!==0)return Wt;if(ne.type==="forwarded"&&re.type==="forwarded"){let Kt=u(ne.element,re.element);if(Kt!==0)return Kt}return u(ne.detail??"",re.detail??"")}function Gu(ne,re){let Be=ne.length+1,Wt=re.length+1,Kt=Array.from({length:Be},()=>Array(Wt).fill(0));for(let qt=0;qt<Be;qt++)Kt[qt][0]=qt;for(let qt=0;qt<Wt;qt++)Kt[0][qt]=qt;for(let qt=1;qt<Be;qt++)for(let Xt=1;Xt<Wt;Xt++){let Ht=ne[qt-1]===re[Xt-1]?0:1;if(Kt[qt][Xt]=Math.min(Kt[qt-1][Xt]+1,Kt[qt][Xt-1]+1,Kt[qt-1][Xt-1]+Ht),qt>1&&Xt>1&&ne[qt-1]===re[Xt-2]&&ne[qt-2]===re[Xt-1])Kt[qt][Xt]=Math.min(Kt[qt][Xt],Kt[qt-2][Xt-2]+1)}return Kt[Be-1][Wt-1]}function I(ne,re,Be=3){let Wt,Kt=Number.POSITIVE_INFINITY;for(let qt of re){let Xt=Gu(ne,qt);if(Xt<Kt)Wt=qt,Kt=Xt}return Kt<=Be?Wt:void 0}import{readFile as nd}from"node:fs/promises";import Xr from"node:path";import Fa,{sep as Dr}from"node:path";function _s(ne){return ne}function te(ne){return _s(ne)}function Ma(ne){return _s(ne)}function Fn(ne){if(ne==="")return _s(ne);let re=ne==="."||ne===".."||ne.startsWith("./")||ne.startsWith("../");return _s(re?ne:`./${ne}`)}var Bn=/\.svelte$/,Pi=[".ts",".mts",".cts",".tsx",".js",".mjs",".cjs",".jsx",".d.ts"],Ba=/\.(?:svelte|[mc]?ts|[mc]?js|tsx|jsx)$/;function _i(ne){if(!ne.endsWith(".svelte"))return!1;let re=ne.length-7;if(re===0)return!1;let Be=ne.charCodeAt(re-1);return Be!==47&&(Dr==="/"||Be!==92)}function r(ne){return Ma(Dr==="/"?ne:ne.split(Dr).join("/"))}function ja(ne,re){return r(Fa.join(re,Fa.normalize(ne)))}function Hi(ne){return`${JSON.stringify(ne,null,2)}
|
|
26
|
+
`}var Va="sveld",$s="0.40.6";var Bt={name:Va,version:$s,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:changed":"bivium run --suite unit","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","lint:all":"bun fmt && bun lint --fix && svelte-lint --fix","lint:changed":"bun fmt --changed && bun lint --changed --fix && svelte-lint --changed --fix","lint:svelte":"svelte-lint",knip:"knip-bun",build:"bun scripts/build.ts",bench:"bun scripts/bench.ts","bench:cache":"bun scripts/bench.ts --cache","bench:ostia":"ostia bench scripts/bench-ostia.ts",typecheck:"bun check && bun check --project tsconfig.excluded.json"},devDependencies:{"@types/bun":"^1.4.5","@typescript/typescript6":"^6.0.2",ajv:"^8.20.0",bivium:"^0.6.0",knip:"^6.47.0",ostia:"^0.2.12",svelte:"^5.59.1","svelte-ast":"^0.12.1","svelte-lint":"^0.2.0",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 qi="5.59.1";var Ns=1;function ei(ne){return ne.some((re)=>re.internal)?ne.filter((re)=>!re.internal):ne}function Uu(ne){return{...ne,props:ei(ne.props),moduleExports:ei(ne.moduleExports),slots:ei(ne.slots),events:ei(ne.events),typedefs:ei(ne.typedefs),...ne.contexts?{contexts:ei(ne.contexts).map((re)=>({...re,properties:ei(re.properties)}))}:{}}}function y(ne,re={}){let Be=Array.from(ne.values(),(qt)=>{let{diagnostics:Xt,...Ht}=qt;return Uu(Ht)}).sort((qt,Xt)=>u(qt.moduleName,Xt.moduleName)),Wt={schemaVersion:Ns,generator:{name:Va,version:$s,svelteVersion:qi},total:Be.length,components:Be},Kt=re.entryExports?ei(re.entryExports):void 0;if(Kt&&Kt.length>0)Wt.totalExports=Kt.length,Wt.exports=Kt;return Wt}var Ku=" ",Hu=120,qu=/\binterface\s+[A-Za-z_$][\w$]*(\s*<[^{};]*>)?\s*$/,zu=200,Ka=/\s/,Xu=/\s{2}|[^\S ]/,Ju=/["'`{}/]/g,Yu=/["'`{};/]/g,Ha=9,Ir=10,Qu=13,zi=32,Rs=34,Zu=38,Is=39,eh=40,th=41,Ds=42,Ga=46,Lr=47,qa=59,nh=62,ih=91,Mr=92,sh=93,Os=96,Fr=123,rh=124,Br=125;function oh(ne){return qu.test(ph(ne,zu))}var Wa=[""];function ah(ne){let re=Wa[ne];if(re===void 0)re=Ku.repeat(ne),Wa[ne]=re;return re}function ph(ne,re){let Be="";for(let Wt=ne.length-1;Wt>=0&&Be.length<re;Wt--)Be=ne[Wt]+Be;return Be.length>re?Be.slice(-re):Be}function ch(ne){if(ne.length===0)return!1;let re=ne[ne.length-1];return re.charCodeAt(re.length-1)===Ir}function lh(ne){while(ne.length>0){let re=ne[ne.length-1],Be=re.length;while(Be>0){let Wt=re.charCodeAt(Be-1);if(Wt!==zi&&Wt!==Ha)break;Be--}if(Be===re.length)return;if(Be===0){ne.pop();continue}ne[ne.length-1]=re.slice(0,Be);return}}function uh(ne){while(ne.length>0){let re=ne[ne.length-1];if(!Ka.test(re[re.length-1]))return;let Be=re.trimEnd();if(Be.length===re.length)return;if(Be.length===0){ne.pop();continue}ne[ne.length-1]=Be;return}}function hh(ne){if(ne.includes("{"))return!1;let re=0,Be=0;for(let Wt=0;Wt<ne.length;Wt++){let Kt=ne.charCodeAt(Wt);if(re!==0){if(Kt===re&&ne.charCodeAt(Wt-1)!==Mr)re=0;continue}if(Kt===Rs||Kt===Is||Kt===Os){re=Kt;continue}if(Kt===qa&&++Be>=2)return!0}return!1}function dh(ne){if(!Xu.test(ne))return ne.trimEnd();let re="",Be=null,Wt=!1;for(let Kt=0;Kt<ne.length;Kt++){let qt=ne[Kt],Xt=ne[Kt-1];if(Be){if(re+=qt,Be==="double"&&qt==='"'&&Xt!=="\\"||Be==="single"&&qt==="'"&&Xt!=="\\"||Be==="template"&&qt==="`"&&Xt!=="\\")Be=null;Wt=!1;continue}if(qt==='"'||qt==="'"||qt==="`"){Be=qt==='"'?"double":qt==="'"?"single":"template",re+=qt,Wt=!1;continue}if(Ka.test(qt)){if(!Wt&&re.length>0)re+=" ",Wt=!0;continue}re+=qt,Wt=!1}return re.trimEnd()}function za(ne,re){let Be=ne[re],Wt=ne.indexOf(Be,re+1);while(Wt!==-1&&ne.charCodeAt(Wt-1)===Mr)Wt=ne.indexOf(Be,Wt+1);return Wt}function Xa(ne,re){let Be=ne.indexOf("*/",re+1);return Be===-1?-1:Be+1}function fh(ne){let re=new Map,Be=[],Wt=Ju,Kt=0;while(Kt<ne.length){if(Wt.lastIndex=Kt,!Wt.test(ne))break;Kt=Wt.lastIndex-1;let qt=ne.charCodeAt(Kt);if(qt===Lr){if(ne.charCodeAt(Kt+1)===Ds){let Xt=Xa(ne,Kt);if(Xt===-1)break;Kt=Xt}}else if(qt===Rs||qt===Is||qt===Os){let Xt=za(ne,Kt);if(Xt===-1)break;Kt=Xt}else if(qt===Fr)Be.push(Kt);else if(qt===Br){let Xt=Be.pop();if(Xt!==void 0)re.set(Xt,Kt)}Kt++}return re}function mh(ne,re,Be){for(let Wt=re;Wt<Be;Wt++)if(!Or(ne.charCodeAt(Wt)))return!1;return!0}function Or(ne){if(ne<=zi)return ne===zi||ne>=Ha&&ne<=Qu;if(ne<160)return!1;return ne===160||ne===5760||ne>=8192&&ne<=8202||ne===8232||ne===8233||ne===8239||ne===8287||ne===12288||ne===65279}function Ja(ne,re,Be,Wt){let Kt=[],qt=Yu,Xt=re,Ht=re;while(Ht<Be){if(qt.lastIndex=Ht,!qt.test(ne))break;if(Ht=qt.lastIndex-1,Ht>=Be)break;let zt=ne.charCodeAt(Ht);if(zt===Lr){if(ne.charCodeAt(Ht+1)===Ds){let Yt=Xa(ne,Ht);if(Yt===-1)break;Ht=Yt}Ht++;continue}if(zt===Rs||zt===Is||zt===Os){let Yt=za(ne,Ht);if(Yt===-1)break;Ht=Yt+1;continue}if(zt===Fr){let Yt=Wt.get(Ht);if(Yt===void 0||Yt>=Be){Ht++;continue}if(Xt<Ht)Kt.push(ne.slice(Xt,Ht));let Qt=Ht+1;if(mh(ne,Qt,Yt)){Kt.push("{}"),Ht=Yt+1,Xt=Ht;continue}let en=ne.slice(Qt,Yt),tn=ne.charCodeAt(Qt)===Ir;if(!tn&&!en.includes("/*")&&!hh(en)&&!oh(Kt)){let nn=Ja(ne,Qt,Yt,Wt),sn=nn.trim();if(!sn.includes(`
|
|
27
|
+
`)){let on=sn.endsWith(";")?sn.slice(0,-1):sn,rn=`{ ${dh(on)} }`;if(rn.length<=Hu){Kt.push(rn),Ht=Yt+1,Xt=Ht;continue}}if(Kt.push("{"),nn.charCodeAt(0)!==qa)Kt.push(`
|
|
28
|
+
`);if(nn.length>0)Kt.push(nn);Ht=Yt,Xt=Yt;continue}if(Kt.push("{"),!tn)Kt.push(`
|
|
29
|
+
`);Ht=Qt,Xt=Qt;continue}if(zt===Br){if(Xt<Ht)Kt.push(ne.slice(Xt,Ht));if(lh(Kt),!ch(Kt))Kt.push(`
|
|
30
|
+
`);Kt.push("}"),Ht++,Xt=Ht;continue}if(Xt<Ht)Kt.push(ne.slice(Xt,Ht));if(uh(Kt),Kt.push(";"),ne.charCodeAt(Ht+1)!==Ir)Kt.push(`
|
|
31
|
+
`);Ht++,Xt=Ht}if(Xt<Be)Kt.push(ne.slice(Xt,Be));return Kt.join("")}function gh(ne){if(!ne.includes(" "))return ne;let re="",Be=0;for(let Wt=0;Wt<ne.length;Wt++){let Kt=ne.charCodeAt(Wt);if(Be!==0){if(re+=ne[Wt],Kt===Be&&ne.charCodeAt(Wt-1)!==Mr)Be=0;continue}if(Kt===Rs||Kt===Is||Kt===Os){Be=Kt,re+=ne[Wt];continue}if(Kt===zi&&re.charCodeAt(re.length-1)===zi)continue;re+=ne[Wt]}return re}function yh(ne){return ne===Br||ne===sh||ne===th||ne===nh}function xh(ne,re,Be){return Be-re>=3&&ne.charCodeAt(re)===Lr&&ne.charCodeAt(re+1)===Ds&&ne.charCodeAt(re+2)===Ds}function Ua(ne,re,Be){let Wt=ne.indexOf("*/",re);return Wt!==-1&&Wt+2<=Be}function vh(ne,re,Be){let Wt=ne.charCodeAt(re);if(Wt===rh||Wt===Zu)return!0;return Wt===Ga&&re+1<Be&&ne.charCodeAt(re+1)!==Ga}function Eh(ne){let re=[],Be=[],Wt=ne.length,Kt=0,qt=!1,Xt=0,Ht=0;while(Ht<=Wt){let Qt=ne.indexOf(`
|
|
32
|
+
`,Ht);if(Qt===-1)Qt=Wt;let en=Qt+1,tn=Ht,nn=Qt;while(tn<nn&&Or(ne.charCodeAt(tn)))tn++;while(nn>tn&&Or(ne.charCodeAt(nn-1)))nn--;if(tn===nn){let un=Be.length>0?Be[Be.length-1]:void 0;if(un!==void 0&&un!==""){let gn=un.charCodeAt(un.length-1);if(gn!==Fr&&gn!==eh&&gn!==ih)re.push(0),Be.push("")}Ht=en;continue}if(qt){if(re.push(Xt),Be.push(` ${ne.slice(tn,nn)}`),Ua(ne,tn,nn))qt=!1;Ht=en;continue}let sn=xh(ne,tn,nn),on=sn&&Ua(ne,tn,nn);if(sn&&!on){re.push(Kt),Be.push(ne.slice(tn,nn)),qt=!0,Xt=Kt,Ht=en;continue}let rn=yh(ne.charCodeAt(tn)),ln=Math.max(0,Kt-(rn?1:0))+(vh(ne,tn,nn)?1:0);if(rn&&ln===0&&Be.length>0&&Be[Be.length-1]==="")re.pop(),Be.pop();if(re.push(ln),Be.push(gh(ne.slice(tn,nn))),Ht=en,on)continue;Kt=us(ne,void 0,tn,nn,Kt)}let zt=Be.length;while(zt>0&&Be[zt-1]==="")zt--;let Yt=[];for(let Qt=0;Qt<zt;Qt++){if(Qt>0)Yt.push(`
|
|
33
|
+
`);let en=re[Qt];if(en>0)Yt.push(ah(en));Yt.push(Be[Qt])}return Yt.join("")}function Ya(ne){return`${Eh(Ja(ne,0,ne.length,fh(ne)))}
|
|
34
|
+
`}var In="any",Sh="Record<string, any>",Xi="Record<string, never>",ip=/^[A-Za-z_$][A-Za-z0-9_$]*$/,bh=/CustomEvent/,Ch=/^[A-Z]/,wh=/\n/,Th=/=>/,kh=/^\s*[(<]/,Ah=/(?:^|\n)@default\b/,Ph=/^([ \t]*\*) +$/gm,_h=/[^\S\r\n]*[\r\n]\s*/g,$h=/(^|[^.\w])Snippet(?:\s*<|\b)/,Nh=/import\s+type\s+[^;]*\bSnippet\b[^;]*from\s+"svelte";/,Dh=/^const\s+/,Rh=/^export /,Ih=/[^\w$]/g;function Vr(ne){return ne.replace(Dh,"")}function Wn(ne){if(ne.length===0)return"";return`/**
|
|
35
|
+
* ${j(ne.join(`
|
|
36
|
+
* `))}
|
|
37
|
+
*/`}function Ji(ne){return ne?ne.split(`
|
|
38
|
+
`):[]}function sp(ne){if(ne===void 0)return[];return(ne===!0?"@deprecated":`@deprecated ${ne}`).split(`
|
|
39
|
+
`)}function Gr(ne){let re=[];for(let{name:Be,body:Wt}of ne??[])if(!Wt)re.push(`@${Be}`);else if(Wt.includes(`
|
|
40
|
+
`))re.push(`@${Be}`,...Wt.split(`
|
|
41
|
+
`));else re.push(`@${Be} ${Wt}`);return re}function $i(ne,re,Be){return[...Ji(ne),...sp(re),...Gr(Be)]}function rp(ne){if(!ne)return"";return`/** ${j(ne)} */`}function Wr(ne){return ne?.includes(`
|
|
42
|
+
`)?Wn(Ji(ne)):rp(ne)}function Ur(ne,re,Be){let Wt=[...Gr(re),...sp(Be)];if(Wt.length===0)return Wr(ne);return Wn([...Ji(ne),...Wt])}function op(ne){if(ne===void 0)return In;return`${ne}
|
|
43
|
+
`}function Ms(ne){if(ne.typedefs.length===0)return"";return ne.typedefs.map((re)=>{let Be=Wn([...Ji(re.description),...Gr(re.tags)]);return`${Be?`${Be}
|
|
44
|
+
`:""}export ${re.ts}`.replace(Ph,"$1")}).join(`
|
|
45
|
+
|
|
46
|
+
`)}var Qa=new Map;function Oh(ne,re){let Be=Qa.get(re);if(Be===void 0)Be=new RegExp(`\\b${B(re)}\\b`),Qa.set(re,Be);return Be.test(ne)}var Za,ep=[];function Ls(ne){if(ne!==Za)Za=ne,ep=i(ne,",");return ep}function Lh(ne){if(ne===null)return[];return ne[0].split(",").map((re,Be)=>({name:re.trim(),constraint:(Ls(ne[1]??"")[Be]??re).trim()}))}function ap(ne,re){let Be=Lh(ne).filter(({name:Wt})=>Oh(re,Wt));if(Be.length===0)return{declSuffix:"",refSuffix:""};return{declSuffix:`<${Be.map(({constraint:Wt})=>Vr(Wt)).join(", ")}>`,refSuffix:`<${Be.map(({name:Wt})=>Wt).join(", ")}>`}}function pp(ne){if(!ne.contexts||ne.contexts.length===0)return"";return ne.contexts.map((re)=>{let Be=re.properties.map((Xt)=>{let Ht=Xt.description?`${Wr(Xt.description)}
|
|
47
|
+
`:"",zt=Xt.optional?"?":"";return`${Ht}${jn(Xt.name)}${zt}: ${Xt.type};`}).join(`
|
|
48
|
+
`),Wt=re.description?`${Wn(Ji(re.description))}
|
|
49
|
+
`:"",{declSuffix:Kt}=ap(ne.generics,[re.type??"",...re.properties.map((Xt)=>Xt.type)].join(`
|
|
50
|
+
`));if(re.type!==void 0)return`${Wt}export type ${re.typeName}${Kt} = ${re.type};`;if(re.properties.length===0)return`${Wt}export type ${re.typeName} = ${re.hasUnresolvedSpread?"Record<string, any>":Xi};`;let qt=re.hasUnresolvedSpread?" & Record<string, any>":"";return`${Wt}export type ${re.typeName}${Kt} = {
|
|
51
|
+
${Be}
|
|
52
|
+
}${qt};`}).join(`
|
|
53
|
+
|
|
54
|
+
`)}function jn(ne){return ip.test(ne)?ne:JSON.stringify(ne)}function tp(ne,re){let Be=Ur(re.description,re.tags,re.deprecated),Wt=Be?`${Be}
|
|
55
|
+
`:"",Kt=!re.slot_props||re.slot_props===Xi?"[]":Bh(re.slot_props),qt=Kt==="[]"?"(this: void) => void":`(this: void, ...args: ${Kt}) => void`;return`
|
|
56
|
+
${Wt}${ne}?: ${qt};`}function Mh(ne){let re=ne.props.filter((pn)=>!ti(pn)),Be=new Set([...re.map((pn)=>pn.name),...Array.from(ne.canonicalPropNames??[])]),Kt=(ne.canonicalPropsType?re.filter((pn)=>!ne.canonicalPropNames?.has(pn.name)):re).map((pn)=>{let xi=typeof pn.value==="string"?pn.value.replace(_h," "):pn.value,os=Ah.test(pn.description??"")||pn.value===void 0||pn.value==="undefined",as=Wn([...$i(pn.description,pn.deprecated,pn.tags),...pn.constant?["@constant"]:[],...os?[]:[`@default ${xi}`]]),ps=pn.constant&&!pn.isFunction?pn.value:pn.type||In;return`
|
|
57
|
+
${as}
|
|
58
|
+
${jn(pn.name)}${pn.isRequired?"":"?"}: ${ps};`});for(let pn of ne.slots)if(!pn.default&&pn.name!=null&&!Be.has(pn.name))Kt.push(tp(jn(pn.name),pn));let qt=ne.slots.find((pn)=>pn.default||pn.name===null);if(qt&&!Be.has("children"))Kt.push(tp("children",qt));let Xt=Kt.join(`
|
|
59
|
+
`),Ht=Ni(ne.moduleName),zt=ne.generics?`<${Ls(ne.generics[1]).map((pn)=>Vr(pn.trim())).join(", ")}>`:"",Yt=ne.generics?`<${ne.generics[0]}>`:"",en=`${ne.extends===void 0?"":`Omit<${ne.extends.interface}, keyof $Props${Yt}> & `}$Props${Yt}`,tn=(pn)=>`export type ${Ht}${zt} = ${pn};`,nn=`{${Xt}
|
|
60
|
+
}`;if(ne.rest_props?.type!=="Element"){let pn;if(ne.canonicalPropsType){let xi=Xt.trim()===""?"":` & ${nn}`;pn=[`type $Props${zt} = ${ne.canonicalPropsType}${xi};`,tn(en)]}else if(Xt.trim()==="")pn=[tn(ne.extends?.interface??Xi)];else if(ne.extends===void 0)pn=[tn(nn)];else pn=[`type $Props${zt} = ${nn};`,tn(en)];return{props_name:Ht,prop_def:pn.join(`
|
|
61
|
+
|
|
62
|
+
`),elementsImport:void 0}}let{name:sn,thisValue:on,thisType:rn,description:ln}=ne.rest_props,un;if(sn!=="svelte:element")un=sn.split("|").map((pn)=>`SvelteHTMLElements["${pn.trim()}"]`).join(" & ");else if(on)un=`SvelteHTMLElements["${on}"]`;else if(rn)un=`NoInfer<SvelteHTMLElements[${rn}]>`;else un="HTMLAttributes<HTMLElement>";let gn="[key: `data-${string}`]: unknown;",xn=ln?`${Wr(ln)}
|
|
63
|
+
`:"",vn=ne.canonicalPropsType?`(${ne.canonicalPropsType}) & `:"",Kn=rn?{name:zt,ref:Yt}:{name:"",ref:""},ai=ne.extends===void 0?`keyof $Props${Yt}`:`keyof ($Props${Yt} & ${ne.extends.interface})`,pi=`Omit<$RestProps${Kn.ref}, ${ai}>`,Cn=rn?Fh(rn,ne.generics,ne.extends?.interface):void 0,Jn=Cn?Cn.ref:pi;return{props_name:Ht,prop_def:[`${xn}type $RestProps${Kn.name} = ${un};`,...Cn?[Cn.declaration]:[],`type $Props${zt} = ${vn}{${Xt}
|
|
64
|
+
|
|
65
|
+
${gn}
|
|
66
|
+
};`,tn(`${Jn} & ${en}`)].join(`
|
|
67
|
+
|
|
68
|
+
`),elementsImport:un.startsWith("HTMLAttributes")?"HTMLAttributes":"SvelteHTMLElements"}}function Fh(ne,re,Be){if(!re)return;let Wt=Ls(re[0]).map((sn)=>sn.trim()),Kt=Ls(re[1]).map((sn)=>Vr(sn.trim())),qt=Wt.indexOf(ne),Xt=Kt[qt];if(qt===-1||!Xt?.startsWith(`${ne} extends `))return;let Ht=i(Xt.slice(`${ne} extends `.length),"=")[0]?.trim();if(!Ht)return;let zt=Wt.filter((sn,on)=>on!==qt),Yt=Kt.filter((sn,on)=>on!==qt),Qt=Yt.length>0?`<${Yt.join(", ")}>`:"",en=zt.length>0?`<${zt.join(", ")}>`:"",tn=`<${Wt.map((sn)=>sn===ne?"$Tag":sn).join(", ")}>`,nn=Be===void 0?`keyof $Props${tn}`:`keyof ($Props${tn} & ${Be})`;return{declaration:`type $Elements${Qt} = { [$Tag in ${Ht}]: Omit<$RestProps${tn}, ${nn}> };`,ref:`$Elements${en}[${ne}]`}}function Bh(ne){return Ii(ne)?ne:`[${ne}]`}function jh(ne){let re=ne.slots.filter((Wt)=>!Ii(Wt.slot_props??""));if(re.length===0)return Xi;let Be=re.map(({name:Wt,slot_props:Kt,...qt})=>{let Xt=qt.default||Wt===null?"default":jn(Wt??""),Ht=Ur(qt.description,qt.tags,qt.deprecated);return`${Ht?`${Ht}
|
|
69
|
+
`:""}${Xt}: ${op(Kt)};`}).join(`
|
|
70
|
+
`);return re.length===1?`{${Be}}`:`{
|
|
71
|
+
${Be}
|
|
72
|
+
}`}var Vh=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 jr(ne=In){if(bh.test(ne))return ne;return`CustomEvent<${ne}>`}function Fs(ne){switch(ne.type){case"dispatched":return jr(ne.detail);case"forwarded":{let re=ne.element,Be=re&&Ch.test(re),Wt=!Be||Vh.has(ne.name);if(ne.detail!==void 0&&ne.detail!=="undefined"&&!(ne.detail==="null"&&Wt&&!Be))return jr(ne.detail);if(!Wt)return jr();return`${re==="svelte:document"?"DocumentEventMap":"WindowEventMap"}["${ne.name}"]`}default:return ne}}function np(ne){if(ne.events.length===0)return Sh;let re=ne.events.map((Be)=>{let Wt=Ur(Be.description,Be.tags,Be.deprecated);return`${Wt?`${Wt}
|
|
73
|
+
`:""}${jn(Be.name)}: ${Fs(Be)};
|
|
74
|
+
`}).join("");return ne.events.length===1?`{${re}}`:`{
|
|
75
|
+
${re}}`}function Gh(ne){let re=ne.type==="() => any";if(ne.type&&Th.test(ne.type)&&!re)return ne.type;if(ne.params&&ne.params.length>0)return`(${h(ne.params)}) => ${ne.returnType||In}`;if(ne.returnType)return`() => ${ne.returnType}`;return ne.type||In}function ti(ne){return ne.isFunctionDeclaration===!0||ne.kind==="const"}function cp(ne){return ne.props.filter(ti).map((re)=>`
|
|
76
|
+
${Wn($i(re.description,re.deprecated,re.tags))}
|
|
77
|
+
${jn(re.name)}: ${Gh(re)};`).join(`
|
|
78
|
+
`)}function Wh(ne){let re=Yi(ne.moduleName),Be=cp({props:ne.props});if(Be.trim()==="")return{exports_ref:re,exports_def:`export type ${re} = ${Xi};`};let{declSuffix:Wt,refSuffix:Kt}=ap(ne.generics,Be);return{exports_ref:`${re}${Kt}`,exports_def:`export type ${re}${Wt} = {${Be}
|
|
79
|
+
};`}}function Uh(ne){let re=ne.props.filter((Be)=>Be.bindable===!0||Be.binding==="writable").map((Be)=>JSON.stringify(Be.name));return re.length>0?re.join(" | "):'""'}function lp(ne){return ne==="default"?"$$Component":ne}function Kh(ne){let re=lp(ne.moduleName);return`declare const ${re}: Component<
|
|
80
|
+
${ne.propsRef},
|
|
81
|
+
${ne.exportsRef},
|
|
82
|
+
${ne.bindings}
|
|
83
|
+
>;
|
|
84
|
+
export default ${re};`}function Hh(ne){let re=lp(ne.moduleName),Be=`${re}Component`,Wt=ne.eventsRef?`$on?<K extends keyof ${ne.eventsRef} & string>(type: K, callback: (e: ${ne.eventsRef}[K]) => void): () => void;`:"$on?(type: string, callback: (e: any) => void): () => void;";return`interface ${Be} {
|
|
85
|
+
new ${ne.generic}(
|
|
86
|
+
options: ComponentConstructorOptions<${ne.propsRef}>
|
|
87
|
+
): SvelteComponent<${ne.propsRef}${ne.eventsRef?`, ${ne.eventsRef}`:""}> & ${ne.exportsRef};
|
|
88
|
+
${ne.generic}(
|
|
89
|
+
this: void,
|
|
90
|
+
internals: ComponentInternals,
|
|
91
|
+
props: ${ne.propsRef}
|
|
92
|
+
): {
|
|
93
|
+
${Wt}
|
|
94
|
+
$set?(props: Partial<${ne.propsRef}>): void;
|
|
95
|
+
} & ${ne.exportsRef};
|
|
96
|
+
element?: typeof HTMLElement;
|
|
97
|
+
z_$$bindings?: ${ne.bindings};
|
|
98
|
+
}
|
|
99
|
+
declare const ${re}: ${Be};
|
|
100
|
+
export default ${re};`}function qh(ne){if(ne.extends===void 0)return"";return`import type { ${Kr(ne.extends.interface)} } from ${ne.extends.import};`}function Kr(ne){let re=ne.indexOf("<");return(re===-1?ne:ne.slice(0,re)).trim()}function zh(ne){if(!ne.componentComment)return"";if(!wh.test(ne.componentComment))return rp(ne.componentComment.trim());return`/*${j(ne.componentComment).split(`
|
|
101
|
+
`).map((re)=>`* ${re}`).join(`
|
|
102
|
+
`)}
|
|
103
|
+
*/`}function Xh(ne){let re=[],Be=new Map;for(let Wt of ne.moduleExports){if(Wt.kind!=="re-export"||!Wt.reExport)continue;let{from:Kt,imported:qt}=Wt.reExport,Xt=Wn($i(Wt.description,Wt.deprecated,Wt.tags)),Ht=jn(Wt.name);if(qt==="*"){let Qt=Wt.name==="*"?"*":`* as ${Ht}`;re.push(`${Xt}
|
|
104
|
+
export ${Qt} from ${JSON.stringify(Kt)};`);continue}let zt=`${Kt}\x00${Xt}`,Yt=Be.get(zt);if(!Yt)Yt={comment:Xt,from:Kt,specifiers:[]},Be.set(zt,Yt),re.push(zt);Yt.specifiers.push(qt===Wt.name?Ht:`${jn(qt)} as ${Ht}`)}return re.map((Wt)=>{let Kt=Be.get(Wt);if(!Kt)return Wt;return`${Kt.comment}
|
|
105
|
+
export { ${Kt.specifiers.join(", ")} } from ${JSON.stringify(Kt.from)};`}).join(`
|
|
106
|
+
|
|
107
|
+
`)}function Hr(ne){let re=[ne.static?"static ":"",ne.abstract?"abstract ":"",ne.readonly?"readonly ":""].join(""),Be=ne.optional?"?":"";if(ne.kind==="property")return`${re}${jn(ne.name)}${Be}: ${ne.type??In}`;if(ne.kind==="index")return`${re}${ne.name}: ${ne.type??In}`;let Wt=h(ne.params??[]);if(ne.kind==="constructor")return`constructor(${Wt})`;let Kt=ne.typeParameters?`<${ne.typeParameters}>`:"";return`${re}${jn(ne.name)}${Be}${Kt}(${Wt}): ${ne.returnType??In}`}function Jh(ne,re){let Be=ne.localName??ne.name,Wt=Be!==ne.name,Kt=`export { ${Be}${Wt?` as ${jn(ne.name)}`:""} };`;if(re.has(Be))return Kt;re.add(Be);let qt=ne.typeParameters?`<${ne.typeParameters}>`:"",Xt=(ne.members??[]).map((Qt)=>[Wn($i(Qt.description,Qt.deprecated,Qt.tags)),`${Hr(Qt)};`].filter(Boolean).join(`
|
|
108
|
+
`)).join(`
|
|
109
|
+
|
|
110
|
+
`),Ht=`${ne.extends?` extends ${ne.extends}`:""}${ne.implements?.length?` implements ${ne.implements.join(", ")}`:""}`,zt=`${Wt?"":"export "}declare ${ne.abstract?"abstract ":""}class ${Be}${qt}${Ht}`;return`
|
|
111
|
+
${[Wn($i(ne.description,ne.deprecated,ne.tags)),Xt?`${zt} {
|
|
112
|
+
${Xt}
|
|
113
|
+
}`:`${zt} {}`,Wt?Kt:""].filter(Boolean).join(`
|
|
114
|
+
`)}`}function Yh(ne){let re=Xh(ne),Be=new Set,Wt=ne.moduleExports.filter((Kt)=>Kt.kind!=="re-export").map((Kt)=>{if(Kt.kind==="class")return Jh(Kt,Be);let qt=!ip.test(Kt.name),Xt=qt?{...Kt,name:Qh(Kt.name)}:Kt,Ht,zt=Xt.type&&kh.test(Xt.type)?P(Xt.type):-1,Yt=Xt.typeParameters?`<${Xt.typeParameters}>`:"";if(Xt.kind==="const"&&zt===-1)Ht=`export declare const ${Xt.name}: ${Xt.type||In};
|
|
115
|
+
`;else if(Xt.kind==="let")Ht=`export declare let ${Xt.name}: ${Xt.type||In};`;else if(Xt.params&&Xt.params.length>0)Ht=`export declare function ${Xt.name}${Yt}(${h(Xt.params)}): ${Xt.returnType||In};`;else if(Xt.returnType)Ht=`export declare function ${Xt.name}${Yt}(): ${Xt.returnType};`;else if(Xt.type&&zt!==-1){let Qt=Xt.type.slice(0,zt).trimEnd(),en=Xt.type.slice(zt+2).trim();Ht=`export declare function ${Xt.name}${Qt}: ${en};`}else Ht=`export declare let ${Xt.name}: ${Xt.type||In};`;if(qt)Ht=`${Ht.replace(Rh,"").trimEnd()}
|
|
116
|
+
export { ${Xt.name} as ${JSON.stringify(Kt.name)} };`;return`
|
|
117
|
+
${Wn($i(Xt.description,Xt.deprecated,Xt.tags))}
|
|
118
|
+
${Ht}`}).join(`
|
|
119
|
+
`);return[re,Wt].filter(Boolean).join(`
|
|
120
|
+
|
|
121
|
+
`)}function Qh(ne){return`__export_${ne.replace(Ih,"_")}`}var Zh=120;function ed(ne){let Be=`export default class ${ne.moduleName==="default"?"":ne.moduleName}${ne.generic} extends SvelteComponentTyped<`,Wt=[ne.genericProps,ne.events,ne.slots],qt=[ne.ownConstructor?`constructor(options: ComponentConstructorOptions<${ne.genericProps}>);`:"",ne.accessors.trim()].filter(Boolean).join(`
|
|
122
|
+
`);if(qt===""&&Wt.every((Xt)=>!Xt.includes(`
|
|
123
|
+
`))){let Xt=`${Be}${Wt.join(", ")}> {}`;if(Xt.length<=Zh)return Xt}return`${Be}
|
|
124
|
+
${ne.genericProps},
|
|
125
|
+
${ne.events},
|
|
126
|
+
${ne.slots}
|
|
127
|
+
> {
|
|
128
|
+
${qt}
|
|
129
|
+
}`}function Ni(ne){return`${ne}Props`}function Yi(ne){return`${ne}Exports`}function qr(ne){return{format:ne.format}}var td={format:"class"};function up(ne){let re=qr(ne??{}),Be={};for(let[Wt,Kt]of Object.entries(re))Be[Wt]=Kt??td[Wt];return JSON.stringify(Be)}function zr(ne,re){let Be=Lo(ne),{moduleName:Wt,typedefs:Kt,generics:qt,props:Xt,moduleExports:Ht,slots:zt,events:Yt,rest_props:Qt,extends:en,componentComment:tn,contexts:nn}=ne,sn=re?.format==="component",on=qt!==null,{props_name:rn,prop_def:ln,elementsImport:un}=Mh({moduleName:Wt,props:Xt,rest_props:Qt,extends:en,generics:qt,slots:zt,canonicalPropNames:new Set(Be?.canonicalPropNames??[]),canonicalPropsType:Be?.canonicalPropsType}),gn=qt?`<${qt[1]}>`:"",xn=qt?`${rn}<${qt[0]}>`:rn,vn=sn&&Yt.length>0?`type $Events${gn} = ${np({events:Yt})};`:"",Kn=qt?`$Events<${qt[0]}>`:"$Events",ai=sn&&(on||vn!==""),pi=Yh({moduleExports:Ht}),Cn=Ms({typedefs:Kt}),Jn=pp({contexts:nn,generics:qt}),pn=(Be?.typeImportStatements??[]).join(`
|
|
130
|
+
`),xi=[...Be?.localTypeDeclarations??[],...Be?.moduleTypeDeclarations??[]].join(`
|
|
131
|
+
|
|
132
|
+
`),{exports_ref:os,exports_def:as}=sn?Wh({props:Xt,moduleName:Wt,generics:qt}):{exports_ref:"",exports_def:""},ps=sn?Uh({props:Xt}):"",Io=Qt?.type==="Element"&&Qt.thisType!==void 0,nr=!Nh.test(pn)&&[ln,pi,Cn,Jn,xi,as].some((ir)=>$h.test(ir)),nl=[sn?ai?`import type { SvelteComponent, ComponentConstructorOptions, ComponentInternals${nr?", Snippet":""} } from "svelte";`:`import type { Component${nr?", Snippet":""} } from "svelte";`:`import { SvelteComponentTyped${Io?", type ComponentConstructorOptions":""}${nr?", type Snippet":""} } from "svelte";`,un?`import type { ${un} } from "svelte/elements";`:"",pn,qh({extends:en})].filter(Boolean).join(`
|
|
133
|
+
`),il=sn?ai?Hh({moduleName:Wt,generic:gn,propsRef:xn,exportsRef:os,bindings:ps,...vn?{eventsRef:Kn}:{}}):Kh({moduleName:Wt,propsRef:xn,exportsRef:os,bindings:ps}):ed({moduleName:Wt,generic:gn,genericProps:xn,events:np({events:Yt}),slots:jh({slots:zt}),accessors:cp({props:Xt}),ownConstructor:Io}),sl=[pi,Cn,xi,Jn,ln,as,vn,[zh({componentComment:tn}),il].filter(Boolean).join(`
|
|
134
|
+
`)].map((ir)=>ir.trim()).filter(Boolean).join(`
|
|
135
|
+
|
|
136
|
+
`);return Ya([nl,sl].filter(Boolean).join(`
|
|
137
|
+
|
|
138
|
+
`))}var id=/[:=]/,hp=/^HTML\w+Element$|^HTMLElementTagNameMap\[[\w$]+\]$/,dp=/^SVG\w+Element$/,sd=/[\w$]+/g,rd=/^CustomEvent<([\s\S]*)>$/,od=/^(Readonly)?Array</,Yr="COMPONENT_API.json",Bs={none:0,patch:1,minor:2,major:3};function zn(ne,re){return Bs[re]>Bs[ne]?re:ne}function ad(ne){return ne.reduce((re,Be)=>zn(re,Be.bump),"none")}function wp(ne,re){return Bs[ne]>=Bs[re]}function fp(ne){let re=bi(Ln(ne));if(P(re)!==-1)return new Set([re]);return new Set(i(re,"|").map((Be)=>bi(Be)).filter((Be)=>Be.length>0))}function Tp(ne,re,Be){let Wt=gp(ne),Kt=gp(re);if(Wt&&Kt)return cd(Wt,Kt,Be);let qt=ld(xp(ne),xp(re),Be);if(qt!==void 0)return qt;return ud(ne,re,Be)}function pd(ne,re){if(ne===re)return!1;if(re==="HTMLElement")return hp.test(ne);if(re==="SVGElement")return dp.test(ne);if(re==="Element")return ne==="HTMLElement"||ne==="SVGElement"||ne==="MathMLElement"||hp.test(ne)||dp.test(ne);return!1}function mp(ne,re){for(let Be of re)if(pd(ne,Be))return!0;return!1}function gp(ne){let re=P(ne);if(re===-1)return;let Be=ne.slice(0,re).trim(),Wt=ne.slice(re+2).trim();if(!Be.startsWith("(")||!Be.endsWith(")"))return;let Kt=Be.slice(1,-1).trim();return{params:Kt.length===0?[]:i(Kt,",").map((Xt)=>Xt.trim()),returnType:Wt}}function kp(ne){return(ne.split(id,1)[0]??"").trimEnd().endsWith("?")}function yp(ne){if(ne.startsWith("..."))return;let re=b(ne,":");if(re===-1)return;let Be=ne.slice(re+1).trim();return kp(ne)?`(${Be}) | undefined`:Be}function cd(ne,re,Be){if(re.params.length<ne.params.length)return"major";let Wt=!Be&&re.returnType==="void"?"none":On(ne.returnType,re.returnType,{readOnly:Be});for(let qt=0;qt<ne.params.length;qt++){let Xt=yp(ne.params[qt]),Ht=yp(re.params[qt]);if(Xt===void 0||Ht===void 0){if(Ln(ne.params[qt])!==Ln(re.params[qt]))return"major";continue}Wt=zn(Wt,On(Xt,Ht,{readOnly:!Be}))}let Kt=re.params.slice(ne.params.length);if(Kt.length>0)Wt=zn(Wt,!Be||Kt.every(kp)?"minor":"major");return Wt}function xp(ne){let re=Ln(ne),Be=!1;if(re.startsWith("readonly "))Be=!0,re=re.slice(9);let Wt=od.exec(re);if(Wt){let qt=Wt[0].length-1;if(Be||E(re,qt)!==re.length-1)return;return{readonly:Wt[1]!==void 0,elements:[re.slice(qt+1,-1)],tuple:!1}}if(Ii(re)){let qt=re.slice(1,-1).trim(),Xt=qt===""?[]:i(qt,",").map((Ht)=>Ht.trim());if(Xt.some((Ht)=>Ht.startsWith("...")||b(Ht,":?")!==-1))return;return{readonly:Be,elements:Xt,tuple:!0}}if(!re.endsWith("[]"))return;let Kt=re.slice(0,-2);if(Kt===""||b(Kt," |&")!==-1)return;return{readonly:Be,elements:[Kt],tuple:!1}}function ld(ne,re,Be){if(!ne||!re||ne.tuple!==re.tuple)return;if(ne.elements.length!==re.elements.length)return"major";let Wt="none";if(ne.readonly!==re.readonly)Wt=re.readonly===Be?"major":"minor";for(let Kt=0;Kt<ne.elements.length;Kt++)Wt=zn(Wt,On(ne.elements[Kt],re.elements[Kt],{readOnly:Be}));return Wt}function ud(ne,re,Be){let Wt=d(ne,{withReadonly:!0}),Kt=d(re,{withReadonly:!0});if(!Wt||!Kt)return;let{added:qt,removed:Xt,common:Ht}=ni(Wt,Kt,(Yt)=>Yt.name);if(Xt.length>0)return"major";if(!Be&&qt.some(([,Yt])=>!Yt.optional))return"major";let zt=qt.length>0?"minor":"none";for(let[,Yt,Qt]of Ht){if(Yt.optional!==Qt.optional)zt=zn(zt,Qt.optional===Be?"major":"minor");if(Be&&Yt.readonly!==Qt.readonly)zt=zn(zt,Qt.readonly?"major":"minor");zt=zn(zt,On(Yt.type,Qt.type,{readOnly:Be}))}return zt}function On(ne,re,{readOnly:Be=!1}={}){if(ne===re)return"none";if(ne===void 0||re===void 0)return"major";if(Ln(ne)===Ln(re))return"none";let Wt=Tp(bi(ne),bi(re),Be);if(Wt!==void 0)return Wt;return hd(fp(ne),fp(re),Be)}function hd(ne,re,Be){let Wt=[...re].filter((Yt)=>!ne.has(Yt)&&!mp(Yt,ne)),Kt=[...ne].filter((Yt)=>!re.has(Yt)&&!mp(Yt,re));if(Wt.length===1&&Kt.length===1){let Yt=Tp(Kt[0],Wt[0],Be);if(Yt!==void 0)return Yt}let qt=Wt.length>0,Xt=Kt.length>0,[Ht,zt]=Be?[qt,Xt]:[Xt,qt];if(Ht)return"major";return zt?"minor":"none"}function vp(ne,re){return ne==="moduleExport"||ti(re)}function Jr(ne){return ne.bindable===!0||ne.binding==="writable"}function ni(ne,re,Be){let Wt=new Map(ne.map((zt)=>[Be(zt),zt])),Kt=new Map(re.map((zt)=>[Be(zt),zt])),qt=[...Kt].filter(([zt])=>!Wt.has(zt)),Xt=[...Wt.keys()].filter((zt)=>!Kt.has(zt)),Ht=[];for(let[zt,Yt]of Wt){let Qt=Kt.get(zt);if(Qt)Ht.push([zt,Yt,Qt])}return{added:qt,removed:Xt,common:Ht}}function Vs(ne,re,Be,Wt){return(Kt,qt,Xt)=>ne.push({component:re,kind:Be,name:Kt,bump:qt,message:`${Wt} "${Kt}" ${Xt}`})}function Ep(ne,re,Be,Wt){let Kt=[],qt=Vs(Kt,ne,re,re==="prop"?"prop":"export"),{added:Xt,removed:Ht,common:zt}=ni(Be,Wt,(Yt)=>Yt.name);for(let[Yt,Qt]of Xt)qt(Yt,Qt.isRequired?"major":"minor",`added${Qt.isRequired?" (required)":""}`);for(let Yt of Ht)qt(Yt,"major","removed");for(let[Yt,Qt,en]of zt){let tn=ti(en);if(re==="prop"&&ti(Qt)!==tn){qt(Yt,"major",tn?"became a read-only accessor":"stopped being a read-only accessor");continue}if(Qt.isRequired!==en.isRequired)qt(Yt,en.isRequired?"major":"minor",`became ${en.isRequired?"required":"optional"}`);let nn=vp(re,Qt)&&vp(re,en),sn=On(Qt.type,en.type,{readOnly:nn});if(sn!=="none")qt(Yt,sn,`type changed from \`${Qt.type??"unknown"}\` to \`${en.type??"unknown"}\``);let on=Jr(en);if(Jr(Qt)!==on)qt(Yt,on?"minor":"major",on?"gained a writable binding":"lost its writable binding");if(Qt.value!==en.value&&sn==="none")qt(Yt,"patch",`default changed from \`${Qt.value??"none"}\` to \`${en.value??"none"}\``);let rn=en.deprecated!==void 0;if(Qt.deprecated!==void 0!==rn)qt(Yt,rn?"minor":"patch",rn?"marked as deprecated":"no longer deprecated");if(re==="moduleExport"&&Qt.constant!==en.constant)qt(Yt,"minor",en.constant?"became constant":"became mutable");if(Qt.reactive!==en.reactive)qt(Yt,"minor",en.reactive?"became reactive":"stopped being reactive")}return Kt}function Sp(ne){if(i(ne,"|").length>1)return;return rd.exec(ne)?.[1]}function dd(ne,re){let Be=Sp(ne),Wt=Sp(re);if(Be===void 0||Wt===void 0)return"major";return On(Be,Wt,{readOnly:!0})}function fd(ne,re,Be){let Wt=[],Kt=Vs(Wt,ne,"event","event"),{added:qt,removed:Xt,common:Ht}=ni(re,Be,(zt)=>zt.name);for(let[zt]of qt)Kt(zt,"minor","added");for(let zt of Xt)Kt(zt,"major","removed");for(let[zt,Yt,Qt]of Ht){if(Yt.type!==Qt.type){Kt(zt,"major",`changed from ${Yt.type} to ${Qt.type}`);continue}if(Yt.type==="forwarded"&&Qt.type==="forwarded"){let sn=Fs(Yt),on=Fs(Qt),rn=sn===on?"none":dd(sn,on);if(rn!=="none")Kt(zt,rn,`type changed from \`${sn}\` to \`${on}\``);continue}let en=Yt.type==="dispatched"?Yt.detail:void 0,tn=Qt.type==="dispatched"?Qt.detail:void 0,nn=On(en,tn,{readOnly:!0});if(nn!=="none")Kt(zt,nn,`detail changed from \`${en??"unknown"}\` to \`${tn??"unknown"}\``)}return Wt}function md(ne,re,Be){let Wt=[],Kt=Vs(Wt,ne,"slot","slot"),{added:qt,removed:Xt,common:Ht}=ni(re,Be,(zt)=>zt.name??"default");for(let[zt]of qt)Kt(zt,"minor","added");for(let zt of Xt)Kt(zt,"major","removed");for(let[zt,Yt,Qt]of Ht){let en=On(Yt.slot_props,Qt.slot_props,{readOnly:!0});if(en!=="none")Kt(zt,en,`props changed from \`${Yt.slot_props??"none"}\` to \`${Qt.slot_props??"none"}\``)}return Wt}function bp(ne){return ne.type===void 0?"an object of properties":`\`${ne.type}\``}function gd(ne,re=[],Be=[]){let Wt=[],{added:Kt,removed:qt,common:Xt}=ni(re,Be,(Ht)=>Ht.key);for(let[Ht]of Kt)Wt.push({component:ne,kind:"context",name:Ht,bump:"minor",message:`context "${Ht}" added`});for(let Ht of qt)Wt.push({component:ne,kind:"context",name:Ht,bump:"major",message:`context "${Ht}" removed`});for(let[Ht,zt,Yt]of Xt){let Qt=(tn,nn,sn)=>Wt.push({component:ne,kind:"context",name:Ht,...sn===void 0?{}:{property:sn},bump:tn,message:`context "${Ht}" ${sn===void 0?"":`property "${sn}" `}${nn}`});if(zt.typeName!==Yt.typeName)Qt("major",`type name changed from \`${zt.typeName}\` to \`${Yt.typeName}\``);if(Boolean(zt.hasUnresolvedSpread)!==Boolean(Yt.hasUnresolvedSpread))Qt("major",`${Yt.hasUnresolvedSpread?"gained":"lost"} an unresolved spread`);if(zt.type!==void 0||Yt.type!==void 0){if(zt.type!==Yt.type){let tn=zt.type!==void 0&&Yt.type!==void 0?On(zt.type,Yt.type,{readOnly:!0}):"major";if(tn!=="none")Qt(tn,`type changed from ${bp(zt)} to ${bp(Yt)}`)}continue}let en=ni(zt.properties,Yt.properties,(tn)=>tn.name);for(let[tn]of en.added)Qt("minor","added",tn);for(let tn of en.removed)Qt("major","removed",tn);for(let[tn,nn,sn]of en.common){if(nn.optional!==sn.optional)Qt(sn.optional?"major":"minor",`became ${sn.optional?"optional":"required"}`,tn);let on=On(nn.type,sn.type,{readOnly:!0});if(on!=="none")Qt(on,`type changed from \`${nn.type}\` to \`${sn.type}\``,tn)}}return Wt}var yd=new Set(["description","source","componentCommentSource","tags"]);function js(ne){if(Array.isArray(ne))return ne.map(js);if(n(ne)){let re={};for(let[Be,Wt]of Object.entries(ne)){if(yd.has(Be))continue;re[Be]=js(Wt)}return re}return ne}var xd=["generics","rest_props","extends"];function vd(ne,re,Be){let Wt=[];for(let Kt of xd){let qt=JSON.stringify(js(re[Kt])),Xt=JSON.stringify(js(Be[Kt]));if(qt===Xt)continue;if(Kt==="rest_props"&&re.rest_props===void 0){Wt.push({component:ne,kind:"shape",name:Kt,bump:"minor",message:`"${Kt}" added`});continue}Wt.push({component:ne,kind:"shape",name:Kt,bump:"major",message:`"${Kt}" changed (breaking)`})}return Wt}function Qr(ne){return ne.name.split("<",1)[0].trim()}function Cp(ne){return new Set(ne?.match(sd))}function Ed(ne,re){let Be=new Map(re.map((Qt)=>[Qt,{write:!1,read:!1}])),Wt=(Qt,en)=>{for(let tn of Cp(Qt)){let nn=Be.get(tn);if(!nn)continue;nn.write||=en.write,nn.read||=en.read}},Kt={write:!0,read:!0},qt={write:!0,read:!1},Xt={write:!1,read:!0},Ht=(Qt,en)=>Wt(Qt,Qt?.includes("=>")?Kt:en);for(let Qt of ne){for(let en of Qt.props)Ht(en.type,Jr(en)?Kt:qt);for(let en of Qt.moduleExports)Wt(en.type,Kt);for(let en of Qt.events)Ht("detail"in en?en.detail:void 0,Xt);for(let en of Qt.slots)Ht(en.slot_props,Xt);for(let en of Qt.contexts??[]){Wt(en.type,Kt);for(let tn of en.properties)Wt(tn.type,Kt)}}let zt=ne.flatMap((Qt)=>Qt.typedefs.map((en)=>({name:Qr(en),callback:en.type.includes("=>"),mentioned:[...Cp(en.type)].filter((tn)=>Be.has(tn))}))),Yt=!0;while(Yt){Yt=!1;for(let{name:Qt,callback:en,mentioned:tn}of zt){let nn=Be.get(Qt);if(!nn)continue;for(let sn of tn){let on=Be.get(sn);if(!on||sn===Qt)continue;let rn=on.write||nn.write||en&&nn.read,ln=on.read||nn.read||en&&nn.write;if(rn!==on.write||ln!==on.read)on.write=rn,on.read=ln,Yt=!0}}}for(let Qt of Be.values())if(!Qt.write&&!Qt.read)Object.assign(Qt,Kt);return Be}function Sd(ne,re,Be,Wt){let Kt=[],qt=Vs(Kt,ne,"typedef","typedef"),{added:Xt,removed:Ht,common:zt}=ni(re.typedefs,Be.typedefs,Qr);for(let[Qt]of Xt)qt(Qt,"minor","added");for(let Qt of Ht)qt(Qt,"major","removed");let Yt=zt.filter(([,Qt,en])=>Qt.name!==en.name||Ln(Qt.type)!==Ln(en.type));if(Yt.length===0)return Kt;for(let[Qt,en,tn]of Yt){if(en.name!==tn.name){qt(Qt,"major",`type parameters changed from \`${en.name}\` to \`${tn.name}\``);continue}let nn=Ln(en.type),sn=Ln(tn.type),on=Wt().get(Qt)??{write:!0,read:!0},rn="none";if(on.write)rn=zn(rn,On(nn,sn));if(on.read)rn=zn(rn,On(nn,sn,{readOnly:!0}));if(rn==="none")continue;qt(Qt,rn,`type changed from \`${nn}\` to \`${sn}\``)}return Kt}function bd(ne,re,Be){let Wt=re.moduleName;return[...Ep(Wt,"prop",ne.props,re.props),...Ep(Wt,"moduleExport",ne.moduleExports,re.moduleExports),...fd(Wt,ne.events,re.events),...md(Wt,ne.slots,re.slots),...gd(Wt,ne.contexts,re.contexts),...Sd(Wt,ne,re,Be),...vd(Wt,ne,re)]}function jt(ne,re){let Be=[],{added:Wt,removed:Kt,common:qt}=ni(ne.components,re.components,(Yt)=>Yt.moduleName);for(let[Yt]of Wt)Be.push({component:Yt,kind:"component",bump:"minor",message:`component "${Yt}" added`});for(let Yt of Kt)Be.push({component:Yt,kind:"component",bump:"major",message:`component "${Yt}" removed`});let Xt=[...ne.components,...re.components],Ht,zt=()=>(Ht??=Ed(Xt,[...new Set(Xt.flatMap((Yt)=>Yt.typedefs.map(Qr)))]),Ht);for(let[,Yt,Qt]of qt)Be.push(...bd(Yt,Qt,zt));return Be}function Cd(ne){return n(ne)&&ne.schemaVersion===Ns}async function wd(ne){let re;try{re=await nd(Xr.resolve(ne),"utf-8")}catch(Be){if(n(Be)&&Be.code==="ENOENT")return null;throw Be}try{return JSON.parse(re)}catch{throw Error(`sveld: could not parse "${ne}" as JSON. Is it a sveld COMPONENT_API.json snapshot?`)}}function Ap(ne){if(typeof ne.check==="string")return ne.check;return ne.jsonOptions?.outFile??Yr}function Pp(ne,re){if(!ne.json||ne.stdout||ne.jsonOptions?.outDir)return!1;return Xr.resolve(ne.jsonOptions?.outFile??Yr)===Xr.resolve(re)}async function Le(ne,re,Be={}){let Wt=await wd(re);if(Wt===null)return{snapshotExists:!1,snapshotFile:re,changes:[],bump:"none"};if(!Cd(Wt)){let Xt=n(Wt)?Wt.schemaVersion:void 0;return{snapshotExists:!0,snapshotFile:re,changes:[{component:"*",kind:"schema",bump:"none",message:`snapshot schemaVersion ${String(Xt)} differs from ${Ns}; regenerate the snapshot`}],bump:"none"}}let Kt=y(ne,{entryExports:Be.entryExports}),qt=jt(Wt,Kt);return{snapshotExists:!0,snapshotFile:re,changes:qt,bump:ad(qt)}}var Td={major:"BREAKING",minor:"additive",patch:"patch",none:"no change"};function Ee(ne){if(!ne.snapshotExists){let Kt=ne.snapshotFile===Yr?"`sveld --json`":`\`sveld --json\` with \`jsonOptions.outFile: "${ne.snapshotFile}"\``;return`sveld --check: no snapshot found at "${ne.snapshotFile}". Generate it with ${Kt} and commit it.`}if(ne.changes.length===0)return`sveld --check: no API changes detected against "${ne.snapshotFile}".`;let re=ne.changes.length,Be=[`sveld --check: ${re} API change${re===1?"":"s"} detected against "${ne.snapshotFile}".`,`Suggested semver bump: ${ne.bump}.`],Wt=new Map;for(let Kt of ne.changes){let qt=Wt.get(Kt.component)??[];qt.push(Kt),Wt.set(Kt.component,qt)}for(let[Kt,qt]of Wt){Be.push("",` ${Kt}`);for(let Xt of qt){let Ht=Xt.kind==="schema"?"schema":Td[Xt.bump];Be.push(` [${Ht}] ${Xt.message}`)}}return Be.join(`
|
|
139
|
+
`)}var Vt=1;function Se(ne){let re={kind:"check-report",schemaVersion:Vt,...ne};return Hi(re)}import{existsSync as Np}from"node:fs";import{join as kd,resolve as Ad}from"node:path";import{pathToFileURL as Pd}from"node:url";var _d=["sveld.config.js","sveld.config.mjs","sveld.config.ts"];function Ut(ne){return ne}function $d(ne=process.cwd()){for(let re of _d){let Be=kd(ne,re);if(Np(Be))return Be}return null}async function Dp(ne){let re;try{re=await import(`${Pd(ne).href}?t=${Date.now()}`)}catch(Wt){let Kt=Wt instanceof Error?Wt.message:String(Wt);throw Error(`sveld: failed to load config file "${ne}".
|
|
140
|
+
${Kt}`,{cause:Wt})}let Be=n(re)?re.default:void 0;if(!n(Be)||Array.isArray(Be))throw Error(`sveld: config file "${ne}" must export a configuration object as its default export. Did you forget \`export default defineConfig({ ... })\`?`);return Be}async function Nd(ne=process.cwd()){let re=$d(ne);return re===null?{}:Dp(re)}async function W(ne,re,Be){if(typeof ne==="string"){let Wt=Ad(re,ne);if(!Np(Wt))throw Error(`sveld: config file "${ne}" does not exist.`);return Dp(Wt)}return ne??Be?Nd(re):{}}function L(...ne){let re={};for(let Be of ne){if(!Be)continue;let Wt={};for(let[Kt,qt]of Object.entries(Be)){let Xt=Reflect.get(re,Kt);if(n(Xt)&&!Array.isArray(Xt)&&n(qt)&&!Array.isArray(qt))Wt[Kt]={...Xt,...qt}}Object.assign(re,Be,Wt)}return re}var _p=["entry","glob","quiet","documentExports","types","typesOptions","json","jsonOptions","markdown","markdownOptions","failFast","watch","config","cache","checkExamples","reportDiagnostics","strict","check","checkLevel","stdout","format","diagnostics"],Dd={typesOptions:["outDir","preamble","format","transform","indexTypes"],jsonOptions:["outFile","outDir","source"],markdownOptions:["outFile","outDir","onAppend"],diagnostics:["ignore"]};function $p(ne,re,Be){let Wt=ne===null?re:`${ne}.${re}`,Kt=I(re,Be),qt=Kt===void 0?void 0:ne===null?Kt:`${ne}.${Kt}`;console.warn(`sveld: unknown option "${Wt}".${qt?` Did you mean "${qt}"?`:""}`)}function H(ne){for(let re of Object.keys(ne))if(!_p.includes(re))$p(null,re,_p);for(let[re,Be]of Object.entries(Dd)){let Wt=Reflect.get(ne,re);if(!n(Wt))continue;for(let Kt of Object.keys(Wt))if(!Be.includes(Kt))$p(re,Kt,Be)}}import{dirname as Qc}from"node:path";import{lstatSync as Sm}from"node:fs";import{readFile as bm}from"node:fs/promises";import{resolve as Cc}from"node:path";import{dirname as Rd}from"node:path";var Id=[...Pi,".svelte"];function Od(ne){let re=ne.trim();if(re.length<2)return;let Be=re[0],Wt=re[re.length-1];if((Be==='"'||Be==="'"||Be==="`")&&Be===Wt)return re.slice(1,-1);return}function Rp(ne){let re=[],Be=ne.moduleExports.filter((Kt)=>Kt.kind==="re-export");if(Be.length===0)return re;let Wt=new Set([Ni(ne.moduleName),Yi(ne.moduleName)]);for(let Kt of Be){if(!Wt.has(Kt.name))continue;re.push(a({component:ne.filePath,kind:"module-export-conflict",name:Kt.name,message:`Re-export "${Kt.name}" has the same name as the generated "${Kt.name}" type; the .d.ts won't type-check if "${Kt.reExport?.from}" exports a type by that name.`,source:Kt.source}))}return re}function Ip(ne,re,Be){let Wt=new Map(Array.from(ne.values()).map((Kt)=>[re(Kt.filePath),Kt]));return(Kt)=>{let qt=Kt.extends;if(!qt)return[];let Xt=Od(qt.import);if(Xt===void 0||!Xt.startsWith(".")&&!Xt.startsWith("/"))return[];let Ht=re(Kt.filePath),zt=Be.resolve(Xt,Rd(Ht),Id);if(zt===null)return[a({component:Kt.filePath,kind:"extend-props-target-missing",name:qt.interface,message:`@extends/@extendProps target "${Xt}" was not found on disk.`})];let Yt=Wt.get(zt);if(!Yt)return[];let Qt=Ni(Yt.moduleName);if(Kr(qt.interface)!==Qt)return[a({component:Kt.filePath,kind:"extend-props-target-missing",name:qt.interface,message:`@extends/@extendProps names "${qt.interface}", but "${Xt}" generates "${Qt}".`})];let en=[];for(let tn of Kt.props){let nn=Yt.props.find((sn)=>sn.name===tn.name);if(nn&&nn.type!==tn.type){let sn=a({component:Kt.filePath,kind:"extend-props-override",name:tn.name,message:`Own prop "${tn.name}" (${tn.type}) overrides "${Qt}"'s "${tn.name}" (${nn.type}).`,source:tn.source}),rn=Oo(Kt)?.[tn.name]?.some((ln)=>ln===""||ln===sn.code);en.push(rn?{...sn,ignored:!0}:sn)}}return en}}import{lstatSync as nf,readFileSync as sf,realpathSync as rf,statSync as of}from"node:fs";import{dirname as af,isAbsolute as pf,join as Yp,parse as cf,relative as co,resolve as Zi}from"node:path";import{readFileSync as Xp}from"node:fs";import{dirname as ao,join as ef,relative as qp,resolve as zp}from"node:path";import{readFileSync as Kd,statSync as Hd}from"node:fs";import{basename as ro,dirname as Gs,isAbsolute as qd,join as zd,resolve as Xd}from"node:path";import{existsSync as Mp,readdirSync as Ld}from"node:fs";import{dirname as Op,join as Fp,resolve as Md}from"node:path";function U(ne,re){for(let Be=Md(ne);;Be=Op(Be)){for(let Wt of re){let Kt=Fp(Be,Wt);if(Mp(Kt))return Kt}if(Op(Be)===Be)return null}}function Lp(ne){return ne.normalize("NFC").toLowerCase()}class Zr{listings=new Map;clear(){this.listings.clear()}entries(ne){return this.read(ne)?.entries??null}entry(ne,re){let Be=this.read(ne);if(Be===null)return;if(Be.byName===void 0){Be.byName=new Map;for(let Wt of Be.entries)Be.byName.set(Wt.name,Wt)}return Be.byName.get(re)}has(ne,re){let Be=this.read(ne);if(Be===null)return!1;if(Be.names.has(re))return!0;if(Be.folded===void 0){Be.folded=new Map;for(let Kt of Be.names)Be.folded.set(Lp(Kt),Kt)}let Wt=Be.folded.get(Lp(re));return Wt!==void 0&&Wt!==re&&Mp(Fp(ne,re))}read(ne){let re=this.listings.get(ne);if(re!==void 0)return re;try{let Be=Ld(ne,{withFileTypes:!0}),Wt=new Set;for(let Kt of Be)Wt.add(Kt.name);re={entries:Be,names:Wt}}catch{re=null}return this.listings.set(ne,re),re}}var eo=!1;function J(ne){eo=ne}function Xn(ne){if(!eo)console.error(ne)}function Bp(ne){if(!eo)console.error(ne)}function ve(ne){if(ne instanceof e)return ne.start?`${ne.reason} (${ne.start.line}:${ne.start.column})`:ne.reason;return ne instanceof Error?ne.message:String(ne)}var Qi=null,to=null;function ii(){if(Qi)return Promise.resolve(Qi);if(!to)to=import("./chunk-a5y3ysxx.js").then((ne)=>(Qi=ne,ne));return to}function Vn(){if(!Qi)throw Error("sveld: internal error, parser stack read before loadParserStack() resolved.");return Qi}import{existsSync as no,readFileSync as Fd}from"node:fs";import{dirname as Up,isAbsolute as Kp,relative as Bd,resolve as io}from"node:path";function jp(ne){if(!n(ne))return{};let re={};if(typeof ne.svelte==="string")re.svelte=ne.svelte;if(typeof ne.name==="string")re.name=ne.name;if(typeof ne.description==="string")re.description=ne.description;return re}function Vp(ne){if(!n(ne))return{};let re={};if(typeof ne.extends==="string")re.extends=ne.extends;if(n(ne.compilerOptions)){let Be={};if(typeof ne.compilerOptions.baseUrl==="string")Be.baseUrl=ne.compilerOptions.baseUrl;if(n(ne.compilerOptions.paths)){let Wt={};for(let[Kt,qt]of Object.entries(ne.compilerOptions.paths))if(Array.isArray(qt)&&qt.every((Xt)=>typeof Xt==="string"))Wt[Kt]=qt;if(Object.keys(Wt).length>0)Be.paths=Wt}if(Object.keys(Be).length>0)re.compilerOptions=Be}return re}var jd=["tsconfig.json","jsconfig.json"],Gp=new Map,Vd=/\/\*[\s\S]*?\*\/|\/\/.*/g,Gd=[".svelte",...Pi];class K extends Error{specifier;fromFile;searched;constructor(ne,re,Be){super(`cannot resolve "${ne}" from ${re||"."} (${Be})`);this.name="UnresolvedModuleError",this.specifier=ne,this.fromFile=re,this.searched=Be}}function Wd(ne){if(no(ne))return!0;return Gd.some((re)=>no(ne+re))}function Wp(ne){let re=ne.indexOf("*");return re===-1?ne.length:re}function Hp(ne,re){if(re.has(ne))return re.get(ne)??null;try{let Be=Fd(ne,"utf-8"),Wt;try{Wt=JSON.parse(Be)}catch{let qt=Be.replace(Vd,"");Wt=JSON.parse(qt)}let Kt=Vp(Wt);if(Kt.extends){let qt=Kp(Kt.extends)?Kt.extends:io(Up(ne),Kt.extends),Xt=qt.endsWith(".json")?qt:`${qt}.json`;if(no(Xt)){let Ht=Hp(Xt,re);if(Ht)Kt.compilerOptions={...Ht.compilerOptions,...Kt.compilerOptions,paths:{...Ht.compilerOptions?.paths,...Kt.compilerOptions?.paths}}}}return re.set(ne,Kt),Kt}catch{return re.set(ne,null),null}}function Ud(ne){let re=Gp.get(ne);if(!re){let Be=ne.split("*").map(B).join("(.*)");re=new RegExp(`^${Be}$`),Gp.set(ne,re)}return re}class so{configs=new Map;lookup(ne,re){if(ne.startsWith(".")||Kp(ne))return{resolved:ne,unresolved:!1,searched:""};let Be=U(re,jd),Wt=Be?Hp(Be,this.configs)?.compilerOptions:void 0,Kt=Wt?.paths;if(!Be||!Wt||!Kt)return{resolved:ne,unresolved:!0,searched:"no tsconfig/jsconfig paths found"};let qt=io(Up(Be),Wt.baseUrl??"."),Xt=Object.entries(Kt).sort(([Ht],[zt])=>Wp(zt)-Wp(Ht));for(let[Ht,zt]of Xt){let Yt=ne.match(Ud(Ht));if(!Yt)continue;let Qt;for(let en of zt){let tn=en;for(let sn=1;sn<Yt.length;sn++)tn=tn.replace("*",Yt[sn]);let nn=io(qt,tn);if(Qt??=nn,Wd(nn))return{resolved:nn,unresolved:!1,searched:Be}}return{resolved:Qt??ne,unresolved:!1,searched:Be}}return{resolved:ne,unresolved:!0,searched:`tsconfig paths (${Be})`}}absolute(ne,re){return this.lookup(ne,re).resolved}relative(ne,re){let Be=this.absolute(ne,re);if(Be===ne)return ne;return Fn(r(Bd(re,Be)))}}var Jd=/\.[mc]?jsx?$/,Yd={".js":[".ts",".tsx",".d.ts"],".jsx":[".tsx",".d.ts"],".mjs":[".mts",".d.mts"],".cjs":[".cts",".d.cts"]};function Qd(ne){return ne==="."||ne===".."||ne.startsWith("./")||ne.startsWith("../")||qd(ne)}class si{aliases=new so;listings=new Zr;modules=new Map;programs=new Map;listDirectory(ne){return this.listings.entries(ne)}exists(ne){return this.listings.has(Gs(ne),ro(ne))}resolve(ne,re,Be=Pi){let Wt=this.aliases.absolute(ne,re);if(Wt===ne&&!Qd(ne))return null;let Kt=Xd(re,Wt),qt=Gs(Kt),Xt=ro(Kt),Ht=this.listings.has(qt,Xt),zt;if(Ht){let Yt=this.listings.entry(qt,Xt);if(zt=Yt&&!Yt.isSymbolicLink()?Yt:Hd(Kt,{throwIfNoEntry:!1}),zt?.isFile())return Kt}for(let Yt of Be)if(this.listings.has(qt,Xt+Yt))return Kt+Yt;if(!Ht)return this.typeScriptCounterpart(Kt)??null;if(zt?.isDirectory()){for(let Yt of Be)if(this.listings.has(Kt,`index${Yt}`))return zd(Kt,`index${Yt}`)}return null}parse(ne){let re=this.modules.get(ne);if(re===void 0)re=Zd(ne),this.modules.set(ne,re);return re}parseJavaScript(ne,re){let Be=this.programs.get(ne);if(Be?.source===re)return Be.ast;let Wt;try{Wt=R(re)}catch(Kt){throw Error(ve(Kt),{cause:Kt})}return this.programs.set(ne,{source:re,ast:Wt}),Wt}invalidate(...ne){this.listings.clear();for(let re of ne)this.modules.delete(re),this.programs.delete(re)}typeScriptCounterpart(ne){let re=Jd.exec(ne)?.[0];if(re===void 0)return;let Be=ne.slice(0,-re.length),Wt=Gs(Be),Kt=ro(Be);for(let qt of Yd[re]??[])if(this.listings.has(Wt,Kt+qt))return Be+qt;return}}function Zd(ne){let re;try{re=Kd(ne,"utf-8")}catch{return null}try{let Be=ne.endsWith(".svelte")?Vn().parseSvelteScripts(re).module?.content.body??[]:Vn().parseModule(re,{typescript:!0}).body;return{source:{text:re,filePath:ne,dir:Gs(ne)},body:Be}}catch(Be){return Bp(`Warning: sveld couldn't parse ${ne} to read its exports (${ve(Be)}); skipping it.`),null}}function oo(ne){return ne.type==="Identifier"?ne.name:ne.value}function tf(ne,re,Be,Wt){let Kt=ne.resolve(re,Be);if(!Kt)return null;let qt=ao(Kt);if(Wt.has(Kt))return{dir:qt,exports:{}};Wt.add(Kt);try{return{dir:qt,exports:po(ne,Xp(Kt,"utf-8"),qt,Wt,Kt)}}catch{return{dir:qt,exports:{}}}finally{Wt.delete(Kt)}}function Jp(ne,re,Be=new si,Wt=new Set,Kt=re){return po(Be,ne,re,Wt,Kt)}function po(ne,re,Be,Wt,Kt){let qt=ne.parseJavaScript(Kt,re),Xt={};for(let Ht of qt.body)if(Ht.type==="ExportDefaultDeclaration"){if(Ht.declaration.type!=="Identifier")continue;let zt=Ht.declaration.name;if(zt in Xt)Xt[zt].default=!0;else Xt[zt]={source:Fn(""),default:!0}}else if(Ht.type==="ExportAllDeclaration"){let zt=Ht.source.value,Yt=ne.resolve(zt,Be);if(!Yt){let nn=ne.aliases.lookup(zt,Be);throw new K(zt,Kt,nn.unresolved?nn.searched:"no matching file or index found")}if(Wt.has(Yt))continue;Wt.add(Yt);let Qt=Xp(Yt,"utf-8"),en=po(ne,Qt,ao(Yt),Wt,Yt);Wt.delete(Yt);let tn=Object.entries(en);if(tn.length===0&&!Bn.test(zt)){let nn=Fn(r(zt));Xt[`*:${zt}`]={source:nn,default:!1,star:!0}}for(let[nn,sn]of tn){let on=Fn(r(sn.source.startsWith(".")?`./${qp(Be,zp(ao(Yt),sn.source))}`:`./${ef(zt,sn.source)}`));Xt[nn]={...sn,source:on}}}else if(Ht.type==="ExportNamedDeclaration"){let zt=Ht.source?.value,Yt=zt!==void 0&&Bn.test(zt);if(Yt){let tn=ne.aliases.lookup(zt,Be);if(tn.unresolved)throw new K(zt,Kt,tn.searched)}let en=zt!==void 0&&!Yt?tf(ne,zt,Be,Wt):void 0;if(en===null){console.warn(`sveld: could not resolve re-exported module "${zt}" from barrel "${Be||"."}"; skipping.`);continue}for(let tn of Ht.specifiers){let nn=oo(tn.exported),sn=oo(tn.local),on=nn||sn,rn=en?.exports[sn],ln=rn?Fn(r(`./${qp(Be,zp(en.dir,rn.source))}`)):Fn(ne.aliases.relative(zt??"",Be)),un=rn?rn.default:sn==="default",gn=rn?rn.imported??sn:sn;if(on in Xt){if(Xt[on].mixed=!0,!Xt[on].source)Xt[on].source=ln}else Xt[on]={source:ln,default:un,...!un&&zt!==void 0&&gn!==on?{imported:gn}:{}}}}else if(Ht.type==="ImportDeclaration"){let zt=Ht.specifiers[0];if(!zt)continue;let Yt=zt.local.name,Qt=Fn(ne.aliases.relative(Ht.source.value,Be)),en=zt.type==="ImportSpecifier"?oo(zt.imported):Yt;if(Yt in Xt){if(!Xt[Yt].source)Xt[Yt].source=Qt}else Xt[Yt]={source:Qt,default:Yt==="default",...en===Yt?{}:{imported:en}}}return Xt}var lf=/-/g,uf=/[^A-Za-z0-9_$]/g,hf=/^[0-9]/;function df(ne,re){let Be=ne.replace(uf,""),Wt=hf.test(Be)?`_${Be}`:Be;if(Wt!==ne&&!re?.has(ne))re?.add(ne),console.warn(`Warning: "${ne}" is not a valid identifier; using "${Wt}" instead.`);return Wt}function Qp(ne,re){return df(cf(ne).name.replace(lf,""),re)}function Zp(ne,re,Be=[],Wt=new Set,Kt){let qt;try{qt=Kt??rf(re)}catch{return Be}if(Wt.has(qt))return Be;Wt.add(qt);let Xt=ne.listDirectory(re);if(Xt===null)return Be;for(let Ht of Xt){if(Ht.name.startsWith("."))continue;let zt=Yp(re,Ht.name),Yt=Ht.isSymbolicLink(),Qt=Yt?of(zt,{throwIfNoEntry:!1}):Ht;if(!Qt)continue;if(Qt.isDirectory())Zp(ne,zt,Be,Wt,Yt?void 0:Yp(qt,Ht.name));else if(Qt.isFile()&&Ht.name.endsWith(".svelte"))Be.push(zt)}return Be}function ff(ne,re){return Zp(ne,re).map((Be)=>({moduleName:Qp(Be),source:Fn(r(`./${co(re,Be)}`))})).sort((Be,Wt)=>u(Be.source,Wt.source))}function mf(ne){return!_i(ne)}function gf(ne,re){let Be=ne.endsWith("/")?ne:`${ne}/`;return re.startsWith(Be)}function Ws(ne,re){return{seenPaths:new Set(ne.map(([,Be])=>re(Be.source))),seenModuleNamePaths:new Map(ne.map(([Be,Wt])=>[Be,re(Wt.source)])),warnedModuleNames:new Set}}function lo(ne,re,Be,Wt,Kt,qt){for(let{moduleName:Xt,source:Ht}of ff(ne,re)){let zt=Kt(Ht),Yt=Be[Xt];if(Yt&&mf(Yt.source)&&gf(Yt.source,Ht)){qt.seenPaths.delete(Kt(Yt.source)),Yt.source=Ht,qt.seenPaths.add(zt),qt.seenModuleNamePaths.set(Xt,zt);continue}if(qt.seenPaths.has(zt))continue;qt.seenPaths.add(zt);let Qt=qt.seenModuleNamePaths.get(Xt);if(Qt===void 0)qt.seenModuleNamePaths.set(Xt,zt);else if(Qt!==zt&&!qt.warnedModuleNames.has(Xt))qt.warnedModuleNames.add(Xt),console.warn(`Warning: multiple components named "${Xt}" found (${r(co(re,Qt))} and ${r(co(re,zt))}). Both are included in TypeScript definitions, but only one can be the named export.`);Wt.push([Xt,{source:Ht,default:!1}])}}function uo(ne,re,Be,Wt){let Kt=nf(ne).isFile(),qt=Kt?af(ne):ne,Xt=Zi(qt),Ht=new Map,zt=(en)=>{let tn=Ht.get(en);if(tn===void 0)tn=pf(en)?Zi(en):Zi(Xt,en),Ht.set(en,tn);return tn},Yt={};if(Kt){let en=sf(ne,"utf-8");try{Yt=Jp(en,Xt,Wt,new Set([Zi(ne)]),Zi(ne))}catch(tn){if(!Be)throw tn;let nn=tn instanceof Error?tn.message:String(tn);console.warn(`Warning: Failed to parse component exports from ${ne}: ${nn}`)}}let Qt=Object.entries(Yt);if(re){let en=Ws(Qt,zt);if(lo(Wt,Xt,Yt,Qt,zt,en),!Kt)Yt=Object.fromEntries(Qt.map(([tn,nn])=>[tn,{...nn,default:!0}]))}return{exports:Yt,allComponentEntries:Qt,rootDir:Xt,resolveComponentFilePath:zt}}function ec(ne,re,Be,Wt){if(Be!==1||ne!=="default")return ne;return Qp(re,Wt)}import{dirname as Qf}from"node:path";import{resolve as yf}from"node:path";var xf=/\r?\n/,vf=/^\s*\*+/;function Us(ne){return{graph:ne,cache:new Map,computing:new Set}}function Tn(ne){return ne?.type==="Identifier"?ne.name:void 0}function Ef(ne){let re=ne.trimEnd();for(;;){let Be=re.lastIndexOf(`
|
|
141
|
+
`)+1;if(re.slice(Be).trimStart().startsWith("//")){re=re.slice(0,Be).trimEnd();continue}let Wt=re.endsWith("*/")?re.lastIndexOf("/*",re.length-3):-1;if(Wt!==-1&&re[Wt+2]!=="*"){re=re.slice(0,Wt).trimEnd();continue}return re}}function Sf(ne,re){let Be=Ef(ne.slice(0,re));if(!Be.endsWith("*/"))return;let Wt=Be.length-2,Kt=Be.lastIndexOf("/**",Wt);if(Kt===-1)return;return Be.slice(Kt,Wt+2)}function bf(ne){let re=[];for(let Be of ne.slice(3,-2).split(xf)){let Wt=Be.replace(vf,"").trim();if(Wt.startsWith("@"))break;if(Wt)re.push(Wt)}return re.join(" ")||void 0}function mi(ne,re){if(!re)return;return ne.text.slice(re.start,re.end)}function Cf(ne,re){return"typeAnnotation"in re?mi(ne,re.typeAnnotation?.typeAnnotation):void 0}function nc(ne,re){return mi(ne,re.returnType?.typeAnnotation)}function ho(ne,re,Be){return`(${re.params.map((Kt)=>mi(ne,Kt)??"").join(", ")}) => ${nc(ne,re)??Be??"any"}`}function ic(ne){if(ne.type==="Literal"){let re=ne.value;if(typeof re==="string")return"string";if(typeof re==="number")return"number";if(typeof re==="boolean")return"boolean"}if(ne.type==="TemplateLiteral")return"string";if(ne.type==="UnaryExpression"&&(ne.operator==="-"||ne.operator==="+"))return ne.argument.type==="Literal"&&typeof ne.argument.value==="number"?"number":void 0;if(ne.type==="CallExpression"&&ne.callee.type==="Identifier")return wf[ne.callee.name];return}var wf={String:"string",Number:"number",Boolean:"boolean"};function sc(ne){if(ne.type==="Literal"){let re=ne.value;return typeof re==="string"||typeof re==="number"||typeof re==="boolean"?re:void 0}if(ne.type==="UnaryExpression"&&ne.operator==="-"){let re=ne.argument;return re.type==="Literal"&&typeof re.value==="number"?-re.value:void 0}return ne.type==="TemplateLiteral"?k(ne)??void 0:void 0}function Tf(ne,re){let Be=mi(ne,re),Wt=sc(re);if(Be===void 0||Wt===void 0)return;return{raw:Be,value:Wt,type:kf(Wt)}}function kf(ne){if(typeof ne==="string")return"string";return typeof ne==="number"?"number":"boolean"}function Af(ne,re){if(ne.type!=="CallExpression"&&ne.type!=="NewExpression")return;let Be=ne.callee;if(!(Tn(Be)==="Symbol"||Be.type==="MemberExpression"&&!Be.computed&&Tn(Be.object)==="Symbol"&&Tn(Be.property)==="for"))return;let[Kt]=ne.arguments;return(Kt?.type==="Literal"&&typeof Kt.value!=="string"?null:k(Kt))||re}var Pf=new Set(["any","bigint","boolean","false","never","null","number","object","readonly","string","symbol","true","undefined","unknown","void"]),_f=/"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'/g,$f=/(?<![\w$.])[A-Za-z_$][\w$]*(?![\w$]|\s*\??:)/g;function Nf(ne,re){let Be=re?Vn().extractJsDocType(re):void 0,Wt=ne?{type:ne,source:"typescript"}:Be?{type:Be,source:"jsdoc"}:void 0;if(!Wt||Wt.type.includes("`"))return;return(Wt.type.replace(_f,'""').match($f)??[]).every((qt)=>Pf.has(qt))?Wt:void 0}function rc(ne){if(ne.async||ne.generator||ne.type==="TSDeclareFunction")return;let re=ne.body,Be=re.type==="BlockStatement"?Y(re):[re];if(Be.length===0)return;let Wt;for(let Kt of Be){if(!Kt)return;let qt=ic(Kt);if(!qt)return;if(Wt===void 0)Wt=qt;else if(Wt!==qt)return}return Wt}function Df(ne){if(ne.type==="TemplateLiteral")return;let re=sc(ne);return typeof re==="boolean"?void 0:re}function Rf(ne){let re=ne.members;if(re.length===0)return;let Be=[],Wt=0;for(let Kt of re){if(!Kt.initializer){Be.push(String(Wt)),Wt+=1;continue}let qt=Df(Kt.initializer);if(qt===void 0)return;Be.push(typeof qt==="string"?JSON.stringify(qt):String(qt)),Wt=typeof qt==="number"?qt+1:Wt}return Be.join(" | ")}function fo(ne,re,Be,Wt){let Kt=Sf(ne.text,Be),qt=Kt?bf(Kt):void 0,Xt=Kt?Vn().extractJsDocReturnType(Kt):void 0,{deprecated:Ht,tags:zt,internal:Yt}=Kt?Vn().extractJsDocDeprecatedAndTags(Kt):{deprecated:void 0,tags:void 0,internal:!1},Qt={description:qt,deprecated:Ht,tags:zt,...Yt?{internal:!0}:{},declFile:ne.filePath},en=(nn,sn,on=!1)=>nn?[{name:nn,...sn,...Qt,isTypeOnly:on}]:[],tn=(nn,sn)=>nc(ne,nn)??Xt??ie(sn)??rc(nn);if(re.type==="VariableDeclaration"){let nn=re.kind==="let"||re.kind==="var"?re.kind:"const";return re.declarations.flatMap((sn)=>{let on=sn.id,rn=Tn(on);if(!rn)return[];let ln=Cf(ne,on),un=ln,gn,xn,vn,Kn,ai,pi,Cn=sn.init;if(Cn)if(Cn.type==="ArrowFunctionExpression"||Cn.type==="FunctionExpression"){if(pi=Cn,xn=tn(Cn,un),!un)un=ho(ne,Cn,xn)}else{if(gn=mi(ne,Cn),!un)un=ic(Cn);let Jn=w(Cn);if(vn=k(Jn)??Af(Jn,rn),nn==="const")Kn=Tf(ne,Jn),ai=Nf(ln,Kt)}return en(rn,{kind:nn,type:un,value:gn,returnType:xn,literalValue:vn,primitiveLiteral:Kn,declaredType:ai,functionNode:pi})})}if(re.type==="FunctionDeclaration"||re.type==="TSDeclareFunction"){let nn=tn(re);return en(Tn(re.id)??Wt,{kind:"function",type:ho(ne,re,nn),returnType:nn,...re.type==="FunctionDeclaration"?{functionNode:re}:{}})}if(re.type==="ClassDeclaration"){let nn=Tn(re.id);return en(nn??Wt,{kind:"class",...nn?{type:nn}:{}})}if(re.type==="TSTypeAliasDeclaration")return en(Tn(re.id),{kind:"type",type:mi(ne,re.typeAnnotation)},!0);if(re.type==="TSInterfaceDeclaration")return en(Tn(re.id),{kind:"interface",type:mi(ne,re.body)},!0);if(re.type==="TSEnumDeclaration"){let nn=Tn(re.id);return en(nn,{kind:"enum",type:Rf(re)??nn})}return[]}function If(ne,re,Be){let Wt=re.declaration;if(Wt.type==="FunctionDeclaration"||Wt.type==="TSDeclareFunction"||Wt.type==="ClassDeclaration"){let[Xt]=fo(ne,Wt,re.start,"default");return Xt?{...Xt,name:"default"}:void 0}if(Wt.type==="FunctionExpression"||Wt.type==="ArrowFunctionExpression")return{name:"default",kind:"function",type:ho(ne,Wt,rc(Wt)),functionNode:Wt,declFile:ne.filePath,isTypeOnly:!1};let Kt=Tn(Wt),qt=Kt?Be(Kt):null;return qt?{...qt,name:"default"}:void 0}function Of(ne,re){for(let Be of ne){if(Be.type!=="ImportDeclaration")continue;let Wt=Be.source.value;for(let Kt of Be.specifiers){if(Kt.local.name!==re)continue;let qt=Be.importKind==="type"||Kt.type==="ImportSpecifier"&&Kt.importKind==="type";if(Kt.type==="ImportDefaultSpecifier")return{specifier:Wt,importedName:"default",isTypeOnly:qt};if(Kt.type==="ImportNamespaceSpecifier")return{specifier:Wt,importedName:"*",isTypeOnly:qt};if(Kt.type==="ImportSpecifier"){let Xt=Tn(Kt.imported)??re;return{specifier:Wt,importedName:Xt,isTypeOnly:qt}}}}return null}function tc(ne,re,Be){return{name:ne,kind:"const",declFile:re,namespaceFile:re,isTypeOnly:Be}}function Ks(ne,re){let Be=re.cache.get(ne);if(Be)return Be;if(re.computing.has(ne))return[];re.computing.add(ne);let Wt=re.graph.parse(ne);if(!Wt)return re.computing.delete(ne),re.cache.set(ne,[]),[];let{source:Kt,body:qt}=Wt,Xt=[],Ht=new Map;for(let tn of qt){let nn=tn.type==="ExportNamedDeclaration"?tn.declaration:tn;if(!nn)continue;for(let sn of fo(Kt,nn,nn.start))Ht.set(sn.name,sn)}let zt=(tn,nn)=>({name:tn,kind:"const",declFile:yf(Kt.dir,nn),isTypeOnly:!1}),Yt=(tn)=>{let nn=Ht.get(tn);if(nn)return nn;let sn=Of(qt,tn);if(!sn)return null;if(sn.specifier.endsWith(".svelte"))return zt(tn,sn.specifier);let on=re.graph.resolve(sn.specifier,Kt.dir);if(!on)return null;if(sn.importedName==="*")return tc(tn,on,sn.isTypeOnly);return gi(on,sn.importedName,re)??null},Qt=new Map;for(let tn of qt){if(tn.type==="ExportAllDeclaration"){let rn=tn.source.value;if(rn.endsWith(".svelte"))continue;let ln=re.graph.resolve(rn,Kt.dir);if(!ln)continue;let un=tn.exportKind==="type",gn=Tn(tn.exported);if(gn){Xt.push(tc(gn,ln,un));continue}for(let xn of Ks(ln,re)){let vn=Qt.get(xn.name)??[];vn.push(un?{...xn,isTypeOnly:!0}:xn),Qt.set(xn.name,vn)}continue}if(tn.type==="ExportDefaultDeclaration"){let rn=If(Kt,tn,Yt);if(rn)Xt.push(rn);continue}if(tn.type!=="ExportNamedDeclaration")continue;let nn=tn.declaration;if(nn){Xt.push(...fo(Kt,nn,tn.start));continue}let sn=tn.source?.value;if(sn?.endsWith(".svelte")){for(let rn of tn.specifiers){let ln=Tn(rn.exported);if(ln)Xt.push(zt(ln,sn))}continue}let on=tn.exportKind==="type";for(let rn of tn.specifiers){let ln=Tn(rn.exported),un=Tn(rn.local);if(!ln||!un)continue;let gn=on||rn.exportKind==="type",xn=null;if(sn){let vn=re.graph.resolve(sn,Kt.dir);if(vn)xn=gi(vn,un,re)??null}else xn=Yt(un);if(xn)Xt.push({...xn,name:ln,isTypeOnly:xn.isTypeOnly||gn});else if(un!=="default")Xt.push({name:ln,kind:gn?"type":"const",declFile:ne,isTypeOnly:gn})}}let en=new Set(Xt.map((tn)=>tn.name));for(let[tn,nn]of Qt){if(en.has(tn)||tn==="default")continue;if(nn.every((sn)=>sn.declFile===nn[0].declFile))Xt.push(...nn);else re.onAmbiguousStarExport?.(ne,tn,nn)}return re.computing.delete(ne),re.cache.set(ne,Xt),Xt}function gi(ne,re,Be){return Ks(ne,Be).findLast((Wt)=>Wt.name===re)}function Di(ne,{importedName:re,members:Be=[]},Wt){let Kt=gi(ne,re,Wt);for(let qt of Be){if(Kt?.namespaceFile===void 0)return;Kt=gi(Kt.namespaceFile,qt,Wt)}return Kt}function ri(ne,re,Be){if(ne[re]===void 0)delete ne[re];ne[re]=Be}function Hs(ne,re){return(re.location==="props"?ne.props:ne.moduleExports).find((Wt)=>Wt.name===re.propName)}function qs(ne,re){if(re.location!=="props")return;ne.diagnostics=(ne.diagnostics??[]).filter((Be)=>!(Be.kind==="prop-unknown-type"&&Be.name===re.propName))}var Lf=/\.[^./\\]+$/;function Mf(ne,re){if(ne.endsWith(".d.ts"))return null;let Be=ne.replace(Lf,".d.ts");return re.exists(Be)?Be:null}function Ff(ne,re,Be){return re.map((Wt)=>{if(!Wt.importSource||!Wt.importedName)return{candidate:Wt};let Kt=Be.graph.resolve(Wt.importSource,ne);if(!Kt)return{candidate:Wt,failureReason:"module-not-found"};let qt=gi(Kt,Wt.importedName,Be);if(!qt)return{candidate:Wt,failureReason:"export-not-found"};if(qt.returnType)return{candidate:Wt,type:qt.returnType};let Xt=Mf(Kt,Be.graph);if(Xt){let Ht=gi(Xt,Wt.importedName,Be);if(Ht?.returnType)return{candidate:Wt,type:Ht.returnType}}return{candidate:Wt,failureReason:"return-type-unresolved"}})}function Bf(ne,re){switch(re){case"module-not-found":return`Prop "${ne.propName}" default calls "${ne.calleeName}()", but "${ne.importSource}" could not be resolved; falling back to "any".`;case"export-not-found":return`Prop "${ne.propName}" default calls "${ne.calleeName}()", but "${ne.importedName}" is not exported from "${ne.importSource}"; falling back to "any".`;case"return-type-unresolved":return`Prop "${ne.propName}" default calls "${ne.calleeName}()" imported from "${ne.importSource}", but its return type could not be resolved; falling back to "any".`}}function jf(ne,re){for(let{candidate:Be,type:Wt,failureReason:Kt}of re){let qt=Hs(ne,Be);if(qt?.typeSource!=="unknown")continue;if(Wt){ri(qt,"type",Wt),ri(qt,"typeSource","typescript"),qs(ne,Be);continue}if(Be.location==="props"&&Kt){let Xt=ne.diagnostics?.find((Ht)=>Ht.kind==="prop-unknown-type"&&Ht.name===Be.propName);if(Xt)Xt.message=Bf(Be,Kt)}}}var oc={collect:(ne)=>ne.pendingCallDefaultCandidates?.filter((re)=>re.importSource!==void 0)??[],resolve:Ff,apply:jf};function Vf(ne,re,Be){return re.map((Wt)=>{let Kt=Be.graph.resolve(Wt.importSource,ne);if(!Kt)return{candidate:Wt};let qt=Di(Kt,Wt,Be);if(!qt?.primitiveLiteral)return{candidate:Wt};return{candidate:Wt,literal:qt.primitiveLiteral,declaredType:qt.declaredType}})}function Gf(ne,re){for(let{candidate:Be,literal:Wt,declaredType:Kt}of re){if(!Wt)continue;let qt=Hs(ne,Be);if(!qt)continue;if(ri(qt,"value",Wt.raw),ri(qt,"defaultValue",{raw:Wt.raw,kind:"literal",value:Wt.value}),qt.typeSource!=="unknown")continue;ri(qt,"type",Kt?.type??Wt.type),ri(qt,"typeSource",Kt?.source??"default"),qs(ne,Be)}}var ac={collect:(ne)=>ne.pendingConstDefaultCandidates??[],resolve:Vf,apply:Gf};function Wf(ne,re,Be){return re.map((Wt)=>{let Kt=Be.graph.resolve(Wt.importSource,ne);if(!Kt)return{candidate:Wt};let qt=Di(Kt,Wt,Be);if(qt?.kind!=="const"||qt.literalValue===void 0)return{candidate:Wt};return{candidate:Wt,key:qt.literalValue}})}function Uf(ne,re){for(let{candidate:Be,key:Wt}of re){if(!Wt){let Ht=pe(Be);Ci(ne,[a({component:ne.filePath,kind:"context-key-unresolved",name:Ht,message:`setContext key \`${Ht}\` from "${Be.importSource}" isn't an \`export const\` string or Symbol() sveld can read; the context is skipped.`,...Be.source?{source:Be.source}:{}})]);continue}let Kt=[...ne.contexts??[]],qt=Kt.findIndex((Ht)=>Ht.key===Wt);if(qt!==-1){let Ht=Kt[qt],zt=pc(Ht.source,Be.source),Yt=zt?Ht.source:Be.source;if(Ci(ne,[a({component:ne.filePath,kind:"context-duplicate-key",name:Wt,message:`setContext("${Wt}", ...) was called more than once; only the first call's shape is used.`,...Yt?{source:Yt}:{}})]),!zt)continue;Kt.splice(qt,1)}let Xt=Kt.findIndex((Ht)=>pc(Ht.source,Be.source));Kt.splice(Xt===-1?Kt.length:Xt,0,{key:Wt,typeName:Q(Wt),...Be.type===void 0?{}:{type:Be.type},description:Be.description,properties:Be.properties,...Be.hasUnresolvedSpread?{hasUnresolvedSpread:!0}:{},...Be.internal?{internal:!0}:{},source:Be.source}),ne.contexts=Kt}}function pc(ne,re){if(!ne||!re)return!1;let{line:Be,column:Wt}=ne.start;return Be>re.start.line||Be===re.start.line&&Wt>re.start.column}var cc={collect:(ne)=>ne.pendingContextKeyCandidates??[],resolve:Wf,apply:Uf};function Kf(ne,re,Be){return re.map((Wt)=>{let Kt=Be.graph.resolve(Wt.importSource,ne);if(!Kt)return{candidate:Wt,failureReason:"module-not-found"};let qt=Di(Kt,Wt,Be)?.functionNode;if(!qt)return{candidate:Wt,failureReason:"not-a-function"};let Xt=Hf(qt,Wt);if(!Xt)return{candidate:Wt,failureReason:"parameter-not-found"};return Xf(qt,Xt,Wt)})}function lc(ne){return ne?.type==="AssignmentPattern"?ne.left:ne}function Hf(ne,re){let Be=lc(ne.params[re.argumentIndex]);if(re.property===void 0)return Be?.type==="Identifier"?{name:Be.name}:void 0;if(!re.property)return;if(Be?.type==="Identifier")return{object:Be.name,property:re.property};if(Be?.type!=="ObjectPattern")return;for(let Wt of Be.properties){if(Wt.type!=="Property"||Wt.computed)continue;if(Wt.key.type!=="Identifier"||Wt.key.name!==re.property)continue;let Kt=lc(Wt.value);return Kt?.type==="Identifier"?{name:Kt.name}:void 0}return}function mo(ne){if(!ne)return null;if(ne.type==="ConditionalExpression"){let Be=mo(ne.consequent),Wt=mo(ne.alternate);return Be&&Wt?[...Be,...Wt]:null}let re=k(ne);return re?[re]:null}var qf={variableType:()=>{return}};function zf(ne){if(!ne)return"null";let{deriveLiteralDetailType:re,literalDetailToTypeText:Be}=Vn();if(ne.type==="Literal")return Be(ne.value);return re(qf,ne)??"any"}function uc(ne,re){if("name"in re)return ne.type==="Identifier"&&ne.name===re.name;if(ne.type!=="MemberExpression"||ne.computed)return!1;return ne.object.type==="Identifier"&&ne.object.name===re.object&&ne.property.type==="Identifier"&&ne.property.name===re.property}function Xf(ne,re,Be){let Wt=new Map,Kt="name"in re?re.name:re.object,qt;if(o(ne.body,{enter(Ht,zt,Yt){if(Ht.type==="CallExpression"){if(!uc(Ht.callee,re))return;let en=Ht.arguments,tn=mo(en[0]);if(!tn)return qt="dynamic-event-name",T;for(let nn of tn){let sn=Wt.get(nn)??new Set;sn.add(zf(en[1])),Wt.set(nn,sn)}return}let Qt=zt?.type==="CallExpression"&&Yt==="callee";if(Ht.type==="MemberExpression"&&uc(Ht,re)&&!Qt)return qt="passed-on",T;if(Ht.type!=="Identifier"||Ht.name!==Kt)return;if(Qt)return;if(!("name"in re)&&zt?.type==="MemberExpression"&&Yt==="object")return;if(!z(Ht,zt))return;return qt="passed-on",T}}),qt)return{candidate:Be,failureReason:qt};let Xt=Array.from(Wt,([Ht,zt])=>{let Yt=Array.from(zt);return{name:Ht,detail:Yt.includes("any")?"any":Yt.join(" | ")}});return{candidate:Be,events:Xt}}function Jf(ne,re){let Be=ne.members?`"${ne.calleeText}"`:ne.importedName==="default"?"the default export":`"${ne.importedName}"`;switch(re){case"module-not-found":return`"${ne.importSource}" isn't a local module sveld can read`;case"not-a-function":return`${Be} isn't a function declared in "${ne.importSource}"`;case"parameter-not-found":return`no parameter of ${Be} receives it`;case"dynamic-event-name":return"an event name isn't a string literal";case"passed-on":return`${Be} passes it on`}}function Yf(ne,re,{deferredEventNoSourceDiagnostics:Be=[],untypedJsDocEventNames:Wt=[]}){let Kt=new Map,qt=[...ne.diagnostics??[]],Xt=!0;for(let{candidate:nn,events:sn,failureReason:on}of re){if(on){Xt=!1,qt.push(a({component:ne.filePath,kind:"dispatch-escapes",name:nn.dispatcherName,message:`\`${nn.dispatcherName}\` is passed to \`${nn.calleeText}\`, but sveld couldn't read the events it dispatches: ${Jf(nn,on)}. Document them with @event tags.`,...nn.source?{source:nn.source}:{},...nn.ignored?{ignored:!0}:{}}));continue}for(let rn of sn??[]){if(Kt.has(rn.name))continue;Kt.set(rn.name,{type:"dispatched",name:rn.name,detail:rn.detail,...nn.source?{source:nn.source}:{}})}}if(Xt){for(let nn of Be)if(!Kt.has(nn.name))qt.push(nn)}if(ne.diagnostics=qt,Kt.size===0)return;let Ht=new Map,zt=new Set;for(let nn of ne.events)if(nn.type==="dispatched")zt.add(nn.name);else if(!Ht.has(nn.name))Ht.set(nn.name,nn);let Yt=new Set(Wt),Qt=new Map,en=[];for(let nn of Kt.values()){if(zt.has(nn.name)){if(Yt.has(nn.name)&&nn.detail!==void 0)Qt.set(nn.name,nn.detail);continue}let sn=Ht.get(nn.name);if(!sn){en.push(nn);continue}let on=nn.source??sn.source;en.push({type:"dispatched",name:nn.name,detail:sn.detail??nn.detail,...sn.description?{description:sn.description}:{},...sn.deprecated===void 0?{}:{deprecated:sn.deprecated},...sn.tags?{tags:sn.tags}:{},...sn.internal?{internal:!0}:{},...on?{source:on}:{}})}if(en.length===0&&Qt.size===0)return;let tn=new Set(en.map((nn)=>nn.name));ne.events=[...ne.events.filter((nn)=>nn.type==="dispatched"||!tn.has(nn.name)).map((nn)=>{let sn=nn.type==="dispatched"?Qt.get(nn.name):void 0;return sn===void 0?nn:{...nn,detail:sn}}),...en].sort(xe)}var hc={collect:(ne)=>ne.pendingDispatchEscapeCandidates??[],resolve:Kf,apply:Yf};function zs(ne){return(re)=>{let Be=ne.collect(re);if(Be.length===0)return;return(Wt,Kt,qt)=>ne.apply(Wt,ne.resolve(Kt,Be,qt),re)}}var Zf=[zs(oc),zs(ac),zs(cc),zs(hc)];async function dc(ne,re,Be,Wt){let Kt=[];for(let Xt of ne){let Ht=Be(Xt);if(Ht===void 0)continue;let zt=Zf.flatMap((Yt)=>Yt(Ht)??[]);if(zt.length>0)Kt.push({component:Xt,passes:zt})}let qt=new Map;if(Kt.length===0)return qt;await ii();for(let{component:Xt,passes:Ht}of Kt){let zt=Us(Wt),Yt=Qf(re(Xt.filePath));for(let Qt of Ht)Qt(Xt,Yt,zt);qt.set(Xt.filePath,Array.from(zt.cache.keys()))}return qt}var em=/^```([\w-]*)\r?\n([\s\S]*?)\r?\n?```$/,tm=new Set(["","js","jsx","ts","tsx","javascript","typescript"]),nm=new Set(["svelte","html"]);function im(ne){let re=ne.trim();if(re==="")return null;let Be=re.match(em);if(Be){let Wt=Be[1].toLowerCase(),Kt=Be[2].trim();if(Kt==="")return null;if(tm.has(Wt))return{kind:"compile",code:Kt};if(nm.has(Wt))return{kind:"syntax",code:Kt};return null}if(re.startsWith("<"))return null;return{kind:"compile",code:re}}function fc(ne){if(!ne.isFunction)return"any";return`(${(ne.params??[]).map((Be)=>`${Be.name}${Be.optional?"?":""}: any`).join(", ")}) => any`}function Xs(ne,re,Be,Wt,Kt){let qt=(ne??[]).filter((Ht)=>Ht.name==="example"),Xt=qt.length>1;return qt.flatMap((Ht,zt)=>{let Yt=im(Ht.body);if(Yt===null)return[];return[{id:Xt?`${re}#${zt}`:re,name:Xt?`${Be} (example ${zt+1})`:Be,type:Wt,code:Yt.code,kind:Yt.kind,...Kt?{source:Kt}:{}}]})}function sm(ne){let re=[];for(let Be of ne.props)re.push(...Xs(Be.tags,`prop:${Be.name}`,Be.name,fc(Be),Be.source));for(let Be of ne.moduleExports)re.push(...Xs(Be.tags,`export:${Be.name}`,Be.name,fc(Be),Be.source));for(let Be of ne.slots){let Wt=Be.name??"default";re.push(...Xs(Be.tags,`slot:${Wt}`,Wt,"any",Be.source))}for(let Be of ne.events)re.push(...Xs(Be.tags,`event:${Be.name}`,Be.name,"any",Be.source));return re}function mc(ne,re){return ne.flatMap(({component:Be,sources:Wt})=>{let Kt=Wt.filter((qt)=>qt.kind===re);return Kt.length===0?[]:[{component:Be,sources:Kt}]})}async function rm(ne){let{formatParseError:re,parseSvelte:Be}=await ii(),Wt=new Map;for(let{component:Kt,sources:qt}of ne){let Xt=[];for(let Ht of qt)try{Be(Ht.code)}catch(zt){Xt.push(a({component:Kt.filePath,kind:"example-syntax-error",name:Ht.name,message:re(zt),...Ht.source?{source:Ht.source}:{}}))}Wt.set(Kt,Xt)}return Wt}async function om(ne,re,Be){let Wt=await re.checkExamples(ne.map(({component:qt,sources:Xt})=>({moduleName:qt.moduleName,filePath:Be(qt.filePath),sources:Xt}))),Kt=new Map;for(let{component:qt,sources:Xt}of ne){let Ht=Wt.get(Be(qt.filePath));if(!Ht||Ht.length===0)continue;let zt=new Map(Xt.map((Yt)=>[Yt.id,Yt.source]));Kt.set(qt,Ht.map((Yt)=>{let Qt=zt.get(Yt.id);return a({component:qt.filePath,kind:"example-compile-error",name:Yt.name,message:Yt.message,...Qt?{source:Qt}:{}})}))}return Kt}async function gc(ne,re,Be,Wt){let Kt=Array.from(ne,(Yt)=>({component:Yt,sources:sm(Yt)})),qt=re===!0?mc(Kt,"compile"):[],Xt=mc(Kt,"syntax"),Ht=new Map,zt=(Yt)=>{for(let[Qt,en]of Yt)Ht.set(Qt,[...Ht.get(Qt)??[],...en])};if(Xt.length>0)zt(await rm(Xt));if(qt.length>0){let{TypeResolver:Yt}=await import("./chunk-jw5zhqjv.js"),Qt=await Yt.create(Be);if(!Qt.ok)throw Error(`sveld: \`checkExamples\` ${Qt.message}.`);let en=Qt.resolver;try{zt(await om(qt,en,Wt))}finally{await en.dispose()}}return Ht}import{hash as am}from"node:crypto";import{mkdirSync as pm,readFileSync as cm,renameSync as lm,writeFileSync as yc}from"node:fs";import{dirname as xc,isAbsolute as um,join as hm,resolve as go}from"node:path";var vc=11,dm=hm("node_modules",".cache","sveld","parse-cache.json"),fm="233ce93c9f3bb415";function Ec(){return`${$s}+${fm}+svelte@${qi}`}function mm(ne){let re=U(ne,["package.json"]);return re===null?go(ne):xc(re)}function Sc(ne,re){let Be=mm(ne);if(typeof re==="string")return um(re)?re:go(Be,re);return go(Be,dm)}function Js(ne){return am("sha256",ne,"hex")}function yo(){return{formatVersion:vc,toolchainVersion:Ec(),entries:{}}}function gm(ne){return n(ne)&&ne.formatVersion===vc&&ne.toolchainVersion===Ec()&&n(ne.entries)}function ym(ne){try{let re=JSON.parse(cm(ne,"utf-8"));return gm(re)?re:yo()}catch{return yo()}}class xo{cacheFilePath;file;next=new Map;dirty=!1;savedEntryCount;constructor(ne){this.cacheFilePath=ne,this.file=ym(ne),this.savedEntryCount=Object.keys(this.file.entries).length}has(ne,re){return this.lookup(ne,re)!==void 0}lookup(ne,re){let Be=this.next.get(ne);if(Be?.hash===re)return Be;let Wt=this.file.entries[ne];return Wt?.hash===re?Wt:void 0}get(ne,re){let Be=this.lookup(ne,re);if(Be===void 0)return null;this.next.set(ne,Be);let{component:Wt,typeScriptMetadata:Kt,propIgnores:qt,pending:Xt}=structuredClone({component:Be.component,typeScriptMetadata:Be.typeScriptMetadata,propIgnores:Be.propIgnores,pending:Be.pending});if(Kt!==void 0)Wt[v]=Kt;if(qt!==void 0)Wt[O]=qt;return Xt===void 0?{component:Wt}:{component:Wt,pending:Xt}}set(ne,re,{component:Be,pending:Wt}){this.dirty=!0,this.next.set(ne,{hash:re,...structuredClone({component:Be,typeScriptMetadata:Be[v],propIgnores:Be[O],pending:Wt})})}getGeneratedText(ne,re){let Be=this.next.get(ne);if(Be?.generatedText===void 0||Be.generatedText.key!==re)return;return Be.generatedText.text}setGeneratedText(ne,re,Be){let Wt=this.next.get(ne);if(Wt===void 0)return;if(Wt.generatedText?.key===re&&Wt.generatedText.text===Be)return;Wt.generatedText={key:re,text:Be},this.dirty=!0}save(){if(!this.dirty&&this.next.size===this.savedEntryCount)return;this.dirty=!1,this.savedEntryCount=this.next.size,pm(xc(this.cacheFilePath),{recursive:!0});let ne={...yo(),entries:Object.fromEntries(this.next)},re=JSON.stringify(ne),Be=`${this.cacheFilePath}.${process.pid}.tmp`;try{yc(Be,re),lm(Be,this.cacheFilePath)}catch{try{yc(this.cacheFilePath,re)}catch{}}}}import{dirname as xm,relative as vm,resolve as Em}from"node:path";async function bc(ne,re={}){await ii();let Be=Em(ne),Wt=xm(Be),Kt=(Ht)=>r(`./${vm(Wt,Ht)}`),qt=Ks(Be,{...Us(re.graph??new si),onAmbiguousStarExport:(Ht,zt,Yt)=>{if(Ht!==Be||!re.diagnostics)return;if(Yt.every((nn)=>nn.declFile.endsWith(".svelte")))return;let Qt=Array.from(new Set(Yt.map((nn)=>Kt(nn.declFile)))),en=Qt.map((nn)=>`"${nn}"`),tn=`${en.slice(0,-1).join(", ")} and ${en[en.length-1]}`;re.diagnostics.push(a({component:Kt(Be),kind:"export-ambiguous",name:zt,message:`"${zt}" is exported by ${tn} through \`export *\`, so the barrel doesn't export it and the docs leave it out; export it explicitly from the barrel (e.g. \`export { ${zt} } from "${Qt[0]}"\`).`}))}}),Xt=new Map;for(let Ht of qt){if(Ht.name==="default"||Ht.declFile.endsWith(".svelte"))continue;let{declFile:zt,returnType:Yt,literalValue:Qt,primitiveLiteral:en,declaredType:tn,functionNode:nn,namespaceFile:sn,...on}=Ht,rn=Kt(zt);if(sn!==void 0)on.type=`typeof import(${JSON.stringify(Kt(sn))})`;Xt.set(Ht.name,{...on,source:rn})}return Array.from(Xt.values()).sort((Ht,zt)=>u(Ht.name,zt.name))}async function Cm(ne){let re=await Promise.all(Array.from(ne,async(Be)=>{try{return[Be,await bm(Be,"utf-8")]}catch(Wt){return console.warn(`Warning: Failed to read file ${Be}:`,Wt),[Be,null]}}));return new Map(re)}function wc(ne){if(ne.length===0)return;console.error(`sveld: failed to parse ${ne.length} component(s):`);for(let{filePath:re,message:Be}of ne)console.error(` - ${re}: ${Be}`)}class es{input;glob;options;graph=new si;collected;entryFile=null;globMergeState;cache;entryExports=[];entryDiagnostics=[];records=new Map;parseErrors=new Map;canonicalEntries=new Map;warnedModuleNames=new Set;constructor(ne,re,Be={}){this.input=ne,this.glob=re,this.options=Be}get documentExports(){return this.options.documentExports===!0}async build(){return this.graph=new si,this.collected=uo(this.input,this.glob,this.documentExports,this.graph),this.globMergeState=Ws(this.collected.allComponentEntries,this.collected.resolveComponentFilePath),this.entryFile=Sm(this.input).isFile()?Cc(this.input):null,this.cache=this.options.cache===!1?void 0:new xo(Sc(this.collected.rootDir,this.options.cache??!0)),await this.readEntryExports(),this.records.clear(),this.parseErrors.clear(),this.indexEntries(),await this.process(this.componentPaths()),wc(Array.from(this.parseErrors.values())),this.assemble()}async update(ne){let re=ne.map((Yt)=>Cc(Yt));if(this.graph.invalidate(...re),re.length===0)return{result:this.assemble(),reparsed:[]};let Be=this.entryFile!==null&&re.includes(this.entryFile)?await this.recollect():[];if(this.glob){let{rootDir:Yt,exports:Qt,allComponentEntries:en,resolveComponentFilePath:tn}=this.collected;lo(this.graph,Yt,Qt,en,tn,this.globMergeState)}this.indexEntries();let Wt=this.componentPaths();for(let Yt of this.records.keys())if(!Wt.has(Yt))this.records.delete(Yt);for(let Yt of this.parseErrors.keys())if(!Wt.has(Yt))this.parseErrors.delete(Yt);let Kt=Array.from(this.records).flatMap(([Yt,{crossFileReads:Qt}])=>Qt?.some((en)=>re.includes(en))?[Yt]:[]),qt=new Set([...re.filter((Yt)=>Bn.test(Yt)),...Be,...Kt]),Xt=new Set(Array.from(Wt).filter((Yt)=>qt.has(Yt))),Ht=await this.process(Xt),zt=this.assemble();return wc(zt.errors),{result:zt,reparsed:Ht}}async recollect(){let ne=this.collected,re=uo(this.input,this.glob,this.documentExports,this.graph),Be=[];for(let[Wt,Kt]of Object.entries(re.exports)){let qt=re.resolveComponentFilePath(Kt.source),Xt=Object.hasOwn(ne.exports,Wt)?ne.exports[Wt]:void 0;if(Xt===void 0||ne.resolveComponentFilePath(Xt.source)!==qt)Be.push(qt)}return this.collected=re,this.globMergeState=Ws(re.allComponentEntries,re.resolveComponentFilePath),await this.readEntryExports(),Be}async readEntryExports(){this.entryDiagnostics=[],this.entryExports=this.documentExports&&this.entryFile!==null?await bc(this.entryFile,{diagnostics:this.entryDiagnostics,graph:this.graph}):[]}componentPaths(){let{exports:ne,allComponentEntries:re,resolveComponentFilePath:Be}=this.collected,Wt=new Set;for(let[,Kt]of[...Object.entries(ne),...re])if(_i(Kt.source))Wt.add(Be(Kt.source));return Wt}indexEntries(){let{exports:ne,allComponentEntries:re,resolveComponentFilePath:Be}=this.collected;this.canonicalEntries=new Map;for(let Wt of[Object.entries(ne),re])for(let Kt of Wt){if(!_i(Kt[1].source))continue;this.canonicalEntries.set(Be(Kt[1].source),this.entryIdentity(Wt,Kt))}}entryIdentity(ne,[re,{source:Be}]){return{moduleName:ec(re,Be,ne.length,this.warnedModuleNames),filePath:r(Be)}}canonicalEntry(ne){let re=this.canonicalEntries.get(ne);if(re===void 0)throw Error(`sveld: no entry lists ${ne}.`);return re}async process(ne){let re=new Map,Be=await this.parse(ne,re);this.cache?.save();let Wt=await this.settle(Be);for(let Kt of ne)this.records.delete(Kt),this.parseErrors.delete(Kt);for(let[Kt,qt]of Wt)this.records.set(Kt,qt);for(let[Kt,qt]of re)this.parseErrors.set(Kt,qt);return Array.from(Wt.keys())}async parse(ne,re){let Be=await Cm(ne),Wt=this.cache,Kt=new Map,qt=new Set;if(Wt)for(let[Ht,zt]of Be){if(zt===null)continue;let Yt=Js(zt);if(Kt.set(Ht,Yt),!Wt.has(Ht,Yt))qt.add(Ht)}if(ne.size>0&&(!Wt||qt.size>0))await ii();let Xt=new Map;for(let Ht of ne){let zt=Be.get(Ht);if(zt===null||zt===void 0)continue;let Yt=this.parseOne(Ht,zt,Kt.get(Ht),re);if(Yt)Xt.set(Ht,Yt)}return Xt}parseOne(ne,re,Be,Wt){let Kt=Be===void 0?null:this.cache?.get(ne,Be);if(Kt)return Kt;let{moduleName:qt,filePath:Xt}=this.canonicalEntry(ne),Ht;try{Ht=new(Vn()).ComponentParser().parse(re,{moduleName:qt,filePath:Xt})}catch(zt){if(this.options.failFast)throw zt;Wt.set(ne,{filePath:Xt,moduleName:qt,message:zt instanceof Error?zt.message:String(zt),stack:zt instanceof Error?zt.stack:void 0});return}if(Be!==void 0)this.cache?.set(ne,Be,Ht);return Ht}async settle(ne){let{rootDir:re,resolveComponentFilePath:Be}=this.collected,Wt=new Map,Kt=new Map;for(let[zt,{component:Yt,pending:Qt}]of ne){let en={...this.canonicalEntry(zt),...Yt};Wt.set(zt,en),Kt.set(en,Qt)}let{checkExamples:qt}=this.options;if(qt){let zt=await gc(Wt.values(),qt,re,Be);for(let[Yt,Qt]of zt)Ci(Yt,Qt)}let Xt=await dc(Wt.values(),Be,(zt)=>Kt.get(zt),this.graph),Ht=new Map;for(let[zt,Yt]of Wt){let{moduleName:Qt,filePath:en,...tn}=Yt,nn=Xt.get(en);Ht.set(zt,nn===void 0?{component:tn}:{component:tn,crossFileReads:nn})}return Ht}assemble(){let{exports:ne,allComponentEntries:re,resolveComponentFilePath:Be}=this.collected,Wt=this.cache,Kt=(en,tn)=>{let{source:nn}=tn[1];if(!_i(nn))return;let sn=this.records.get(Be(nn));if(sn===void 0)return;return{component:{...this.entryIdentity(en,tn),...sn.component},record:sn}},qt=new Map,Xt=Wt?new Map:void 0,Ht=Wt?new Map:void 0;for(let en of re){let tn=Kt(re,en);if(tn===void 0)continue;let{filePath:nn}=tn.component;qt.set(nn,tn.component),(tn.record.crossFileReads===void 0?Xt:Ht)?.set(nn,Be(en[1].source))}let zt=Ip(qt,Be,this.graph);for(let en of qt.values())Ci(en,[...zt(en),...Rp(en)]);let Yt=new Map,Qt=Object.entries(ne);for(let en of Qt){let tn=Kt(Qt,en);if(tn===void 0)continue;let nn=qt.get(tn.component.filePath);if(nn)tn.component.diagnostics=nn.diagnostics;Yt.set(tn.component.moduleName,tn.component)}return{exports:ne,entryExports:this.entryExports,components:Yt,allComponentsForTypes:qt,errors:Array.from(this.parseErrors.values()),diagnostics:Ho(zo([...Array.from(qt.values()).flatMap((en)=>en.diagnostics??[]),...this.entryDiagnostics]),this.options.diagnostics?.ignore),cache:Wt,resolvedPathByFilePath:Xt,crossFileResolvedPathByFilePath:Ht}}}function ts(ne){return{failFast:ne?.failFast,documentExports:ne?.documentExports===!0,cache:ne?.cache,checkExamples:ne?.checkExamples==="syntax"?"syntax":ne?.checkExamples===!0,diagnostics:ne?.diagnostics}}async function ns(ne,re,Be={}){return new es(ne,re,Be).build()}import{existsSync as vo,readFileSync as wm}from"node:fs";import{isAbsolute as Tm,join as kc}from"node:path";var is='sveld: could not resolve a Svelte entry point. Set package.json#svelte, or pass the "entry" option.';function Tc(ne){return Tm(ne)?ne:kc(process.cwd(),ne)}function Oe(ne){if(ne){let Kt=Tc(ne);if(vo(Kt))return{entry:te(ne)};return{entry:null,configured:!0,message:`Invalid entry point: ${Kt}. Pass a valid --entry (or "entry" option), or unset it and set the "svelte" field in your package.json instead.`}}let re=kc(process.cwd(),"package.json");if(!vo(re))return{entry:null,configured:!1,message:'Could not locate a package.json file. Specify an entry point with --entry (or the "entry" option).'};let Be;try{Be=jp(JSON.parse(wm(re,"utf-8")))}catch(Kt){throw console.error("Error reading package.json:",Kt),Kt}let Wt=Be.svelte?.trim();if(!Wt)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(!vo(Tc(Wt)))return{entry:null,configured:!0,message:`The "svelte" field in package.json points to "${Wt}", which does not exist.`};return{entry:te(Wt)}}function Ys(ne){let re=Oe(ne);if(re.entry===null)console.error(re.message);return re.entry}async function Ac(ne,re,Be={}){let Wt=new es(ne,re,{...Be,failFast:!1}),Kt=await Wt.build();return{get result(){return Promise.resolve(Kt)},async update(qt){let Xt=await Wt.update(qt);return Kt=Xt.result,Xt}}}import So from"node:path";function Pc(ne){let re=new Map,Be=[];for(let[Wt,Kt]of Object.entries(ne)){if(Kt.star){Be.push(`export * from "${Kt.source}";`);continue}let qt=re.get(Kt.source)??[];qt.push({id:Wt,exportee:Kt}),re.set(Kt.source,qt)}for(let[Wt,Kt]of re){let qt=Bn.test(Wt),Xt=Kt.some(({id:tn,exportee:nn})=>tn!=="default"&&nn.default),Ht=Kt.some(({exportee:tn})=>!tn.default),zt=qt&&Xt&&Ht,Yt=[],Qt=[],en=[];for(let{id:tn,exportee:nn}of Kt){if(tn==="default"){Qt.push(`export { default } from "${Wt}";`);continue}if(nn.default)if(nn.mixed)Qt.push(`export { default as ${tn} } from "${Wt}";`),Qt.push(`export { default } from "${Wt}";`);else en.push(`default as ${tn}`);else if(qt&&!zt)en.push(`default as ${tn}`);else Yt.push(nn.imported===void 0?tn:`${nn.imported} as ${tn}`)}if(en.length>0&&Yt.length>0)Be.push(`export { ${[...en,...Yt].join(", ")} } from "${Wt}";`);else{if(Yt.length>0)Be.push(`export { ${Yt.join(", ")} } from "${Wt}";`);if(en.length>0)Be.push(`export { ${en.join(", ")} } from "${Wt}";`)}Be.push(...Qt)}return Be.join(`
|
|
142
|
+
`)}function _c(ne){return ne.filter((re)=>re.names.length>0).map((re)=>`export type { ${re.names.join(", ")} } from "${re.source}";`).join(`
|
|
143
|
+
`)}function $c(ne){return ne.replace(Bn,"")}function Eo(ne){return ne.replace(Bn,".svelte.d.ts")}import{mkdir as km,readFile as Am,writeFile as Pm}from"node:fs/promises";import{parse as _m}from"node:path";class Un{ensuredDirs=new Set;async write(ne,re){try{if(await Am(ne,"utf-8")===re)return!1}catch{}let Be=_m(ne).dir;if(!this.ensuredDirs.has(Be))await km(Be,{recursive:!0}),this.ensuredDirs.add(Be);return await Pm(ne,re),!0}}function $m(ne){return n(ne)&&!Array.isArray(ne)&&"start"in ne&&"end"in ne}function bo(ne){if(Array.isArray(ne))return ne.map((re)=>bo(re));if(n(ne)){let re={};for(let[Be,Wt]of Object.entries(ne)){if((Be==="source"||Be==="componentCommentSource")&&$m(Wt))continue;re[Be]=bo(Wt)}return re}return ne}function Nm(ne,re,Be){if(!re)return`${ne.moduleName}.api.json`;if(!Be.has(ne.moduleName))Be.add(ne.moduleName),console.warn(`Warning: multiple components named "${ne.moduleName}" found. Their JSON files are keyed by source path instead of name to avoid overwriting each other.`);return`${$c(ne.filePath)}.api.json`}async function Dm(ne,re,Be){let Wt=Qs(ne,{inputDir:re.inputDir,source:re.source}).components,Kt=new Map;for(let Ht of Wt)Kt.set(Ht.moduleName,(Kt.get(Ht.moduleName)??0)+1);let qt=new Set,Xt=new Un;await Promise.all(Wt.map(async(Ht)=>{let zt=(Kt.get(Ht.moduleName)??0)>1,Yt=Nm(Ht,zt,qt),Qt=So.resolve(So.join(Be,Yt)),en=await Xt.write(Qt,Hi(Ht));Xn(`${en?"created":"unchanged"} "${Qt}".`)}))}function Qs(ne,re){let Be=y(ne,{entryExports:re.entryExports}),Wt={...Be,components:Be.components.map((Kt)=>({...Kt,filePath:ja(Kt.filePath,re.inputDir)}))};if(re.source!==!1)return Wt;return bo(Wt)}function Co(ne,re){return Hi(Qs(ne,re))}async function wo(ne,re){if(re.outDir){await Dm(ne,re,re.outDir);return}let Be=await new Un().write(So.resolve(re.outFile),Co(ne,re));Xn(`${Be?"created":"unchanged"} "${re.outFile}".`)}import{join as Jc,resolve as No}from"node:path";var Nc=/`/g,Dc=/\s+/g,oi="--",Rc=`| Prop name | Required | Kind | Reactive | Binding | Type | Default value | Description |
|
|
144
|
+
| :- | :- | :- | :- | :- | :- | :- | :- |
|
|
145
|
+
`,Ic=`| Slot name | Default | Props | Fallback | Description |
|
|
146
|
+
| :- | :- | :- | :- | :- |
|
|
147
|
+
`,Oc=`| Event name | Type | Detail | Description |
|
|
148
|
+
| :- | :- | :- | :- |
|
|
149
|
+
`,To=`| Name | Kind | Type | Description |
|
|
150
|
+
| :- | :- | :- | :- |
|
|
151
|
+
`,Rm=`| Member | Signature | Description |
|
|
152
|
+
| :- | :- | :- |
|
|
153
|
+
`,Lc=`| Part name | Description |
|
|
154
|
+
| :- | :- |
|
|
155
|
+
`,Mc=`| Property name | Type | Default value | Description |
|
|
156
|
+
| :- | :- | :- | :- |
|
|
157
|
+
`,Fc=/\|/g,Im=/</g,Om=/>/g,Zs=/\n/g,Lm=/^[A-Za-z_$][\w$]*$/,Mm=/\s*\n\s*/g,Fm=/&(?=#?\w+;)|<(?=[A-Za-z/!?])|[|`*]|\\(?=[!-/:-@[-`{-~])|(?<![A-Za-z0-9])_|_(?![A-Za-z0-9])/g,Bm=/[&<|`*\\_]/;function ko(ne){if(!Bm.test(ne))return ne;return ne.replace(Fm,(re)=>re==="&"?"&":re==="<"?"<":re==="_"?"_":`&#${re.charCodeAt(0)};`)}function jm(ne){return`<code>${ko(ne.includes(`
|
|
158
|
+
`)?ne.replace(Mm," "):ne)}</code>`}var Vm=/\{@link\s+([^{}\s|]+)(?:\|([^{}]+))?\}/g;function Gm(ne){if(!ne.includes("{@link"))return ne;return ne.replace(Vm,(re,Be,Wt)=>`[${Wt===void 0?Be:Wt.trim()}](${Be})`)}function Wm(ne){return ne.includes("```")||ne.includes("~~~")}function Um(ne){return Gc(Gm(ne))}var Km=/^([ \t]*)(`{3,}|~{3,})(.*)$/,Hm=/^\n/,qm=/\n$/;function Bc(ne){let re=(qt)=>({kind:"prose",text:Um(qt.join(`
|
|
159
|
+
`))});if(!Wm(ne))return[re([ne])];let Be=ne.split(`
|
|
160
|
+
`),Wt=[],Kt=[];for(let qt=0;qt<Be.length;qt++){let Xt=Km.exec(Be[qt]),[,Ht="",zt="",Yt=""]=Xt??[];if(!Xt||zt[0]==="`"&&Yt.includes("`")){Kt.push(Be[qt]);continue}if(Kt.push(""),Kt.length>1)Wt.push(re(Kt));let Qt=[];for(qt++;qt<Be.length&&!zm(Be[qt],zt);qt++){let en=Be[qt],tn=0;while(tn<Ht.length&&(en[tn]===" "||en[tn]==="\t"))tn++;Qt.push(en.slice(tn))}Wt.push({kind:"code",code:Qt.join(`
|
|
161
|
+
`)}),Kt=[""]}if(Kt.length>1||Wt.length===0)Wt.push(re(Kt));return Wt}function zm(ne,re){let Be=re[0],Wt=0,Kt=ne.length;while(Wt<Kt&&(ne[Wt]===" "||ne[Wt]==="\t"))Wt++;while(Kt>Wt&&(ne[Kt-1]===" "||ne[Kt-1]==="\t"))Kt--;if(Be===void 0||Kt-Wt<re.length)return!1;for(let qt=Wt;qt<Kt;qt++)if(ne[qt]!==Be)return!1;return!0}function jc(ne){let re="";for(let Be=0;Be<ne.length;Be++){let Wt=ne[Be];if(Wt.kind==="code"){re+=`<pre><code>${ko(Wt.code).replace(Zs,"<br />")}</code></pre>`;continue}let Kt=Wt.text;if(ne[Be-1]?.kind==="code")Kt=Kt.replace(Hm,"");if(ne[Be+1]?.kind==="code")Kt=Kt.replace(qm,"");re+=Kt.replace(Fc,"|").replace(Zs,"<br />")}return re}function _n(ne){if(ne===void 0)return oi;return jm(ne)}function Vc(ne){if(!ne.reExport)return _n(ne.type);let{from:re,imported:Be}=ne.reExport,Wt=Be==="*"?"":Lm.test(Be)?`.${Be}`:`[${JSON.stringify(Be)}]`;return _n(`typeof import(${JSON.stringify(re)})${Wt}`)}function Gc(ne){if(!ne.includes("<")&&!ne.includes(">"))return ne;return ne.replace(Im,"<").replace(Om,">")}function yi(ne,re){if(re===void 0)return ne;let Be=typeof re==="string"&&re.trim().length>0?`: ${Gc(re).replace(Zs," ").replace(Fc,"|")}`:"";return`<s>${ne}</s><br />**Deprecated**${Be}`}function er(ne){if(ne===void 0||ne.trim().length===0)return oi;return jc(Bc(ne))}function Wc(ne){if(ne===void 0||ne==="{}"||ne==="Record<string, never>")return oi;return _n(ne.trim())}function Uc(ne){if(ne===void 0)return oi;return`<code>${ko(ne).replace(Zs,"<br />")}</code>`}function Ri(ne,re){let Be=[],Wt=(qt)=>{let Xt=Be.at(-1);if(Xt?.kind==="prose")Xt.text+=qt;else Be.push({kind:"prose",text:qt})},Kt=(qt,Xt)=>{if(Be.length>0)Wt(`
|
|
162
|
+
`);if(qt)Wt(qt);for(let Ht of Bc(Xt))if(Ht.kind==="prose")Wt(Ht.text);else Be.push(Ht)};if(ne?.trim())Kt("",ne);for(let{name:qt,body:Xt}of re??[]){let Ht=Xt?.trim();Kt(Ht?`@${qt} `:`@${qt}`,Ht??"")}if(Be.length===0)return oi;return jc(Be)}function Kc(ne){return _n(ne)}function Xm(ne){let re=[ne.extends?`Extends ${_n(ne.extends)}.`:"",ne.implements?.length?`Implements ${ne.implements.map((Be)=>_n(Be)).join(", ")}.`:""].filter(Boolean);return re.length>0?re.join(" "):void 0}function Hc(ne,re){let Be=new Set;for(let Wt of re){if(Wt.kind!=="class")continue;let Kt=Xm(Wt);if(!Wt.members?.length&&!Kt)continue;let qt=Wt.localName??Wt.name;if(Be.has(qt))continue;if(Be.add(qt),ne.append("h4",`\`${qt}\` members`),Kt)ne.append("raw",`${Kt}
|
|
163
|
+
|
|
164
|
+
`);if(!Wt.members?.length)continue;ne.append("raw",Rm);for(let Xt of Wt.members)ne.append("raw",`| ${yi(Xt.name,Xt.deprecated)} | ${_n(Hr(Xt))} | ${Ri(Xt.description,Xt.tags)} |
|
|
165
|
+
`);ne.append("raw",`
|
|
166
|
+
`)}}function qc(ne,re,Be){if(ne.append("h1","Component Index"),ne.append("h2","Components").tableOfContents(),ne.append("divider"),Be&&Be.length>0)Xc(ne,Be);for(let Wt of y(re).components)Po(ne,Wt)}function zc(ne,re,Be){ne.append("h1","Component Index"),ne.append("h2","Components");for(let Wt of re)ne.append("raw",`- [${Wt.moduleName}](./${Wt.moduleName}.md)
|
|
167
|
+
`);if(ne.append("raw",`
|
|
168
|
+
`),ne.append("divider"),Be&&Be.length>0)Xc(ne,Be)}function Xc(ne,re){ne.append("h2","Exports"),ne.append("raw",To);for(let Be of re){let Wt=(Be.type??Be.value)?.replace(Dc," ").trim();ne.append("raw",`| ${yi(Be.name,Be.deprecated)} | <code>${Be.kind}</code> | ${_n(Wt)} | ${er(Be.description)} |
|
|
169
|
+
`)}ne.append("raw",`
|
|
170
|
+
`),ne.append("divider")}function Jm(ne,re){ne.append("h3","Module exports"),ne.append("raw",To);for(let Be of re)ne.append("raw",`| ${yi(Be.name,Be.deprecated)} | <code>${Be.kind}</code> | ${Vc(Be)} | ${Ri(Be.description,Be.tags)} |
|
|
171
|
+
`);ne.append("raw",`
|
|
172
|
+
`),Hc(ne,re)}function Ao(ne,re,Be){if(re.length>0)Be(),ne.append("raw",`
|
|
173
|
+
`);else ne.append("p","None.")}function Po(ne,re){if(ne.append("h2",`\`${re.moduleName}\``),re.generics)ne.append("p",`**Type parameters:** ${_n(`<${re.generics[1]}>`)}`);if(re.typedefs.length>0)ne.append("h3","Types").append("raw",`\`\`\`ts
|
|
174
|
+
${Ms({typedefs:re.typedefs})}
|
|
175
|
+
\`\`\`
|
|
176
|
+
|
|
177
|
+
`);if(ne.append("h3","Props"),Ao(ne,re.props,()=>{ne.append("raw",Rc);let Be=(Kt)=>Kt.reactive?0:Kt.constant?2:1,Wt=re.props.map((Kt,qt)=>({prop:Kt,index:qt})).sort((Kt,qt)=>Be(Kt.prop)-Be(qt.prop)||Kt.index-qt.index).map(({prop:Kt})=>Kt);for(let Kt of Wt){let qt=ti(Kt)?"accessor":Kt.kind;ne.append("raw",`| ${yi(Kt.name,Kt.deprecated)} | ${Kt.isRequired?"Yes":"No"} | <code>${qt}</code> | ${Kt.reactive?"Yes":"No"} | ${Kt.binding??"--"} | ${_n(Kt.type)} | ${_n(Kt.value)} | ${Ri(Kt.description,Kt.tags)} |
|
|
178
|
+
`)}}),re.moduleExports.length>0)Jm(ne,re.moduleExports);if(ne.append("h3","Slots"),Ao(ne,re.slots,()=>{ne.append("raw",Ic);for(let Be of re.slots)ne.append("raw",`| ${yi(Be.default?oi:Be.name??oi,Be.deprecated)} | ${Be.default?"Yes":"No"} | ${Wc(Be.slot_props)} | ${Uc(Be.fallback)} | ${Ri(Be.description,Be.tags)} |
|
|
179
|
+
`)}),ne.append("h3","Events"),Ao(ne,re.events,()=>{ne.append("raw",Oc);for(let Be of re.events)ne.append("raw",`| ${yi(Be.name,Be.deprecated)} | ${Be.type} | ${Kc(Be.detail)} | ${Ri(Be.description,Be.tags)} |
|
|
180
|
+
`)}),re.cssParts&&re.cssParts.length>0){ne.append("h3","CSS Parts"),ne.append("raw",Lc);for(let Be of re.cssParts)ne.append("raw",`| ${Be.name} | ${er(Be.description)} |
|
|
181
|
+
`);ne.append("raw",`
|
|
182
|
+
`)}if(re.cssProperties&&re.cssProperties.length>0){ne.append("h3","CSS Custom Properties"),ne.append("raw",Mc);for(let Be of re.cssProperties)ne.append("raw",`| ${Be.name} | ${_n(Be.type)} | ${_n(Be.default)} | ${er(Be.description)} |
|
|
183
|
+
`);ne.append("raw",`
|
|
184
|
+
`)}}var Ym=/[^\w\- ]+/g,Qm=/\s+/g,_o="<!-- __TOC__ -->";function Zm(ne,re){let Be=ne.toLowerCase().replace(Nc,"").replace(Ym,"").replace(Qm,"-"),Wt=re.get(Be)??0;return re.set(Be,Wt+1),Wt===0?Be:`${Be}-${Wt}`}class $o{sourceParts=[];hasToC=!1;toc=[];onAppend;constructor(ne={}){this.onAppend=ne.onAppend}get source(){return this.sourceParts.join("")}appendLineBreaks(){return this.sourceParts.push(`
|
|
185
|
+
|
|
186
|
+
`),this}append(ne,re){switch(ne){case"h1":case"h2":case"h3":case"h4":case"h5":case"h6":{if(this.sourceParts.push(`${"#".repeat(Number(ne.slice(-1)))} ${re}`),this.hasToC&&ne==="h2")this.toc.push({indent:0,raw:re??""});break}case"quote":this.sourceParts.push(`> ${re}`);break;case"p":this.sourceParts.push(re??"");break;case"divider":this.sourceParts.push("---");break;case"raw":this.sourceParts.push(re??"");break}if(ne!=="raw")this.appendLineBreaks();return this.onAppend?.call(this,ne,this),this}tableOfContents(){return this.sourceParts.push(_o),this.hasToC=!0,this.appendLineBreaks(),this}end(){let ne=this.sourceParts.join("");if(!this.hasToC)return ne;let re=ne.indexOf(_o);if(re===-1)return ne;let Be=new Map,Wt=this.toc.map(({indent:Kt,raw:qt})=>`${" ".repeat(Kt)}- [${qt}](#${Zm(qt,Be)})`).join(`
|
|
187
|
+
`);return ne.slice(0,re)+Wt+ne.slice(re+_o.length)}}function tr(ne,re){return new $o({onAppend:(Be,Wt)=>{re?.onAppend?.call(null,Be,Wt,ne)}})}function ss(ne,re){let Be=tr(ne,re);return qc(Be,ne,re.entryExports),Be.end()}async function eg(ne,re,Be){let Wt=y(ne,{entryExports:re.entryExports}),Kt=new Un,qt=tr(ne,re);zc(qt,Wt.components,re.entryExports);let Xt=No(Jc(Be,"README.md")),Ht=await Kt.write(Xt,qt.end());Xn(`${Ht?"created":"unchanged"} "${Xt}".`),await Promise.all(Wt.components.map(async(zt)=>{let Yt=tr(ne,re);Po(Yt,zt);let Qt=No(Jc(Be,`${zt.moduleName}.md`)),en=await Kt.write(Qt,Yt.end());Xn(`${en?"created":"unchanged"} "${Qt}".`)}))}async function Do(ne,re){if(re.outDir){await eg(ne,re,re.outDir);return}let Be=No(re.outFile),Wt=await new Un().write(Be,ss(ne,re));Xn(`${Wt?"created":"unchanged"} "${re.outFile}".`)}import{join as tg,resolve as ng}from"node:path";function ig(ne,re){if(!re.indexTypes)return[];let Be=re.format==="component",Wt=new Set,Kt=[];for(let qt of Object.values(re.exports)){if(!qt.default||!Bn.test(qt.source))continue;let Xt=r(qt.source);if(Wt.has(Xt))continue;Wt.add(Xt);let Ht=ne.components.find((Yt)=>Yt.filePath===Xt);if(!Ht)continue;let zt=[Ni(Ht.moduleName)];if(Be)zt.push(Yi(Ht.moduleName));Kt.push({source:qt.source,names:zt})}return Kt}async function Yc(ne,re,Be){if(!ne)return re;try{let Wt=await ne(re,Be);if(typeof Wt!=="string")throw TypeError(`must return a string, got ${typeof Wt}`);return Wt}catch(Wt){let Kt=Wt instanceof Error?Wt.message:String(Wt);throw Error(`sveld: typesOptions.transform failed for "${Be.filePath}": ${Kt}`,{cause:Wt})}}function sg(ne,re){return`${ne}
|
|
188
|
+
${up(re)}`}async function Ro(ne,re){let Be=ng(re.outDir,"index.d.ts"),Wt=new Un,Kt=y(ne),qt=_c(ig(Kt,re)),Xt=re.preamble+[Pc(re.exports),qt].filter((nn)=>nn!=="").join(`
|
|
189
|
+
|
|
190
|
+
`),Ht=qr(re),zt=Kt.components.map(async(nn)=>{let sn=Eo(tg(re.outDir,nn.filePath)),on=r(Eo(nn.filePath)),rn=re.resolvedPathByFilePath?.get(nn.filePath),ln=rn?void 0:re.crossFileResolvedPathByFilePath?.get(nn.filePath),un=rn??ln,gn=sg(nn.moduleName,Ht),xn=ln?`${gn}
|
|
191
|
+
${Js(JSON.stringify(nn))}`:gn,vn=un?re.cache?.getGeneratedText(un,xn):void 0;if(vn===void 0){if(vn=zr(nn,Ht),un)re.cache?.setGeneratedText(un,xn,vn)}let Kn=await Yc(re.transform,vn,{kind:"component",component:nn,filePath:on});return Wt.write(sn,Kn)}),Yt=(async()=>{let nn=await Yc(re.transform,Xt,{kind:"index",filePath:"index.d.ts"});return Wt.write(Be,`${nn}
|
|
192
|
+
`)})(),Qt=(await Promise.all([...zt,Yt])).filter(Boolean).length,en=zt.length+1,tn=Qt===0?`unchanged ${en}`:`created ${Qt} of ${en}`;Xn(`${tn} TypeScript definitions in "${re.outDir}".`)}var rg=["reportDiagnostics","strict","check","checkLevel","stdout","format"],og=50;function ag(ne){let re=Promise.resolve();return()=>{re=re.then(ne,ne)}}function Gt(ne){let re=ne?.watch===!0,Be,Wt,Kt=ne??{},qt,Xt=null,Ht,zt=new Set,Qt=ag(async()=>{if(Xt==null||Wt==null||zt.size===0)return;let tn=Array.from(zt);zt.clear();try{let{result:nn}=await Xt.update(tn);await rs(nn,Kt,Wt)}catch(nn){console.error("sveld: failed to regenerate types in watch mode:",nn)}}),en=(tn)=>{if(!re||Xt==null||!Ba.test(tn))return;zt.add(tn),clearTimeout(Ht),Ht=setTimeout(Qt,og)};return{name:"vite-plugin-sveld",apply:re?void 0:"build",enforce:"post",configResolved(tn){qt=tn.root},async buildStart(){if(ne?.config){let nn=await W(ne.config,qt??process.cwd(),!1);Kt=L(nn,ne)}H(Kt);let tn=rg.filter((nn)=>(nn in Kt));if(tn.length>0)console.warn(`sveld: the Vite plugin ignores ${tn.map((nn)=>`"${nn}"`).join(", ")}; run the sveld CLI or sveld() for them.`);if(J(Kt.quiet===!0),Wt=Ys(Kt.entry),re&&Wt!=null)try{Xt=await Ac(Wt,Kt.glob===!0,ts(Kt)),await rs(await Xt.result,Kt,Wt)}catch(nn){console.error("sveld: failed to generate initial types in watch mode:",nn)}},async generateBundle(){if(re)return;if(Wt==null)this.error(is);Be=await ns(Wt,Kt.glob===!0,ts(Kt))},async writeBundle(){if(re)return;if(Wt==null)this.error(is);await rs(Be,Kt,Wt)},handleHotUpdate(tn){en(tn.file)},watchChange(tn){en(tn)}}}async function rs(ne,re,Be){let Wt=Qc(Be);if(re.types!==!1)await Ro(ne.allComponentsForTypes,{outDir:"types",preamble:"",...re.typesOptions,exports:ne.exports,inputDir:Wt,cache:ne.cache,resolvedPathByFilePath:ne.resolvedPathByFilePath,crossFileResolvedPathByFilePath:ne.crossFileResolvedPathByFilePath});if(re.json)await wo(ne.components,{outFile:"COMPONENT_API.json",...re.jsonOptions,inputDir:Wt,entryExports:ne.entryExports});if(re.markdown)await Do(ne.components,{outFile:"COMPONENT_INDEX.md",...re.markdownOptions,entryExports:ne.entryExports});ne.cache?.save()}function Zc(ne,re,Be){if(re.json){let Wt=Co(ne.components,{...re.jsonOptions,inputDir:Qc(Be),entryExports:ne.entryExports});process.stdout.write(Wt);return}if(re.markdown){let Wt=ss(ne.components,{...re.markdownOptions,entryExports:ne.entryExports});process.stdout.write(Wt)}}import{realpathSync as el,statSync as pg}from"node:fs";import{dirname as tl,relative as cg,resolve as lg}from"node:path";function ug(ne){if(ne.check&&!ne.check.snapshotExists&&!ne.writesSnapshot)return 1;if(ne.check?.changes.some((re)=>re.kind==="schema"))return 1;if(ne.errors.length>0)return 2;if(ne.check&&wp(ne.check.bump,ne.checkLevel??"major"))return 3;if(Ko(ne.diagnostics,ne.strict).length>0)return 4;return 0}async function Me(ne,re,Be=!1){let Wt=await ns(ne,re.glob===!0,ts(re)),Kt=re.check?await Le(Wt.components,Ap(re),{entryExports:Wt.entryExports}):void 0;if(Be)Zc(Wt,re,ne);else await rs(Wt,re,ne);return{result:Wt,check:Kt}}function hg(ne){let re=el(pg(ne).isFile()?tl(ne):ne),Be=el(process.env.GITHUB_WORKSPACE||process.cwd());return(Wt)=>r(cg(Be,lg(re,Wt)))}function Fe(ne,re,Be,Wt){let Kt=Be.reportDiagnostics||Be.strict,qt=Uo(ne.diagnostics,Kt);if(Kt&&qt.length>0)if(Be.format==="json")process.stderr.write(Qo(qt));else{if(Be.format==="github"){let Ht=Yo(qt,hg(Wt));if(Ht)console.error(Ht)}console.error(Xo(qt))}let Xt=ug({errors:ne.errors,check:re,writesSnapshot:re?Pp(Be,re.snapshotFile):!1,checkLevel:Be.checkLevel,diagnostics:qt,strict:Be.strict});return{diagnostics:qt,exitCode:Xt}}async function Jt(ne){if(ne&&"input"in ne)throw Error("sveld: the `input` option was renamed to `entry`.");if(typeof ne?.config==="string")throw Error("sveld: `config` takes `true` or `false`; import another config file and pass its options instead.");let{entry:Be,...Wt}=ne??{},Kt=await W(Wt.config,process.cwd(),!0),qt=Ys(Be??Kt.entry);if(qt===null)throw Error(is);let Xt=L(Kt,Wt,{entry:qt});H(Xt),J(Xt.quiet===!0);let{result:Ht,check:zt}=await Me(qt,Xt),{diagnostics:Yt,exitCode:Qt}=Fe(Ht,zt,Xt,qt),en=Qs(Ht.components,{inputDir:tl(qt),entryExports:Ht.entryExports,source:Xt.jsonOptions?.source});return{diagnostics:Yt,check:zt,errors:Ht.errors,document:en,exitCode:Qt}}
|
|
193
|
+
export{v,O,M,x,N,Te,q,Ce,be,z,T,l,o,n,C,t,A,c,m,w,je,Pe,k,p,F,_,i,b,P,E,ie,se,a,X,Ve,B,j,h,u,Ge,oe,V,Y,Q,d,ae,Z,pe,Ae,ee,le,We,we,g,S,s,ce,He,Ue,Je,ue,e,Ke,qe,de,ze,Xe,Ye,Qe,Ze,et,tt,ke,nt,rt,De,it,st,ot,at,Ne,_e,pt,$e,lt,ct,D,ut,dt,ft,mt,ht,gt,yt,xt,Et,Re,St,vt,Tt,Ct,bt,Pt,fe,At,wt,kt,Ie,Dt,Nt,_t,$t,f,Rt,It,Lt,me,he,G,Ot,Mt,Ft,ge,ye,R,xe,I,te,r,Bt,y,jt,Le,Ee,Vt,Se,Ut,W,L,H,U,J,ve,K,Oe,Gt,Me,Fe,Jt};
|