sveld 0.38.6 → 0.38.7
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 +15 -9
- package/browser.js +136 -170
- package/chunk-60yq13dk.js +1 -0
- package/chunk-gg5d8z19.js +40 -0
- package/chunk-nfwzp0b2.js +189 -0
- package/chunk-qqhje1j7.js +5 -0
- package/cli-entry.js +2 -2
- package/index.d.ts +26 -12
- package/index.js +1 -1
- package/package.json +1 -1
- package/schema/component-api.schema.json +1 -1
- package/chunk-deb45vqa.js +0 -5
- package/chunk-m4pg0axh.js +0 -234
- package/chunk-qfbb8a3r.js +0 -1
- package/chunk-v61086ex.js +0 -29
package/chunk-m4pg0axh.js
DELETED
|
@@ -1,234 +0,0 @@
|
|
|
1
|
-
var x=Symbol("sveld.parsedComponentTypeScriptMetadata");function To(O){return O[x]}var Li=Array(2048).fill(void 0);function Tc(){Li.fill(void 0)}function ko(O,te,ve,Je){let Gt=Je&2047,Wt=Li[Gt];if(Wt!==void 0&&Wt.length===ve-te&&O.startsWith(Wt,te))return Wt;let Ht=O.slice(te,ve);return Li[Gt]=Ht,Ht}var ls="",In=[0],Un=0,cs=0,Wn;function ne(O){Tc(),ls=O,In=[0],Un=0,cs=0,Wn=void 0}function Oi(O){while(Un<=O){let te=ls.indexOf(`
|
|
2
|
-
`,Un);if(te===-1){Un=Number.POSITIVE_INFINITY;return}Un=te+1,In.push(Un)}}function kc(O){let te=[0],ve=O.indexOf(`
|
|
3
|
-
`);while(ve!==-1)te.push(ve+1),ve=O.indexOf(`
|
|
4
|
-
`,ve+1);return te}function Mi(O,te,ve){let Je=0,Gt=O.length-1;if(te>=O[ve])Je=ve;else Gt=ve-1;if(Je<Gt&&te<O[Je+1])Gt=Je;while(Je<Gt){let Wt=Je+Gt+1>>>1;if(O[Wt]<=te)Je=Wt;else Gt=Wt-1}return Je}function g(O){return Oi(O),cs=Mi(In,O,cs),{line:cs+1,column:O-In[cs],character:O}}var Ii=/\r\n?|\n|\u2028|\u2029/g,Pc=/[\r\u2028\u2029]/;function Po(O){if(Wn===void 0){Wn=Pc.test(ls)?[]:null,Ii.lastIndex=0;while(Wn!==null&&Ii.exec(ls)!==null)Wn.push(Ii.lastIndex)}if(Wn===null)return Oi(O),Mi(In,O,cs);let te=0,ve=Wn.length;while(te<ve){let Je=te+ve>>>1;if(Wn[Je]<=O)te=Je+1;else ve=Je}return te}function P(O){let{line:te,column:ve}=g(O);return{line:te,column:ve}}function $o(O){while(In.length<=O+1&&Un!==Number.POSITIVE_INFINITY)Oi(Un);if(O>=In.length)return;let te=O+1<In.length?In[O+1]-1:ls.length;return ls.slice(In[O],te)}function Ce(O){let te,ve=0;return(Je)=>(te??=kc(O),ve=Mi(te,Je,ve),{line:ve+1,column:Je-te[ve]})}function Bn(O){return typeof O==="object"&&O!==null&&typeof Qn(O).type==="string"}function Qn(O){return O}function G(O,te){let ve=Qn(O);for(let Je in ve){let Gt=ve[Je];if(Array.isArray(Gt)){for(let Wt=0;Wt<Gt.length;Wt++)if(Bn(Gt[Wt]))Gt[Wt]=te(Gt[Wt])}else if(Bn(Gt))ve[Je]=te(Gt)}}function re(O,...te){if(!te.some((ve)=>ve===O.type))throw Error(`expected ${te.join(" or ")}, got ${O.type}`)}function De(O){let te=[];return Zn(O,te),te}function Zn(O,te){switch(O.type){case"Identifier":te.push(O);return;case"ObjectPattern":for(let ve of O.properties)Zn(ve.type==="RestElement"?ve.argument:ve.value,te);return;case"ArrayPattern":for(let ve of O.elements)if(ve!==null)Zn(ve,te);return;case"RestElement":Zn(O.argument,te);return;case"AssignmentPattern":Zn(O.left,te);return;case"TSParameterProperty":Zn(O.parameter,te);return;case"TSAsExpression":case"TSNonNullExpression":case"TSSatisfiesExpression":case"TSTypeAssertion":Zn(O.expression,te)}}function W(O,te){if(O.type!=="Identifier")return!1;if(te===null)return!0;switch(te.type){case"MemberExpression":return te.computed||O===te.object;case"MethodDefinition":return te.computed;case"Property":case"PropertyDefinition":return te.computed||O===te.value;case"ExportSpecifier":case"ImportSpecifier":return O===te.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 O===te.expression;case"TSEnumMember":return O===te.initializer;case"TSParameterProperty":case"TSEnumDeclaration":case"TSImportEqualsDeclaration":return!0;default:return!te.type.startsWith("TS")}}var us={Root:["module","instance","fragment","css"],Script:["attributes","content"],Fragment:["nodes"],Text:[],Comment:[],ExpressionTag:["expression"],HtmlTag:["expression"],ConstTag:["declaration"],DeclarationTag:["declaration"],DebugTag:["identifiers"],RenderTag:["expression"],AttachTag:["expression"],Attribute:["value"],SpreadAttribute:["expression"],AnimateDirective:["expression"],BindDirective:["expression"],ClassDirective:["expression"],LetDirective:["expression"],OnDirective:["expression"],StyleDirective:["value"],TransitionDirective:["expression"],UseDirective:["expression"],Component:["attributes","fragment"],TitleElement:["attributes","fragment"],SlotElement:["attributes","fragment"],RegularElement:["attributes","fragment"],SvelteBody:["attributes","fragment"],SvelteBoundary:["attributes","fragment"],SvelteComponent:["expression","attributes","fragment"],SvelteDocument:["attributes","fragment"],SvelteElement:["tag","attributes","fragment"],SvelteFragment:["attributes","fragment"],SvelteHead:["attributes","fragment"],SvelteOptions:["attributes","fragment"],SvelteSelf:["attributes","fragment"],SvelteWindow:["attributes","fragment"],IfBlock:["test","consequent","alternate"],EachBlock:["expression","context","key","body","fallback"],AwaitBlock:["expression","pending","value","then","error","catch"],KeyBlock:["expression","fragment"],SnippetBlock:["expression","parameters","body"],StyleSheet:["attributes","children"],Rule:["prelude","block"],Atrule:["block"],SelectorList:["children"],ComplexSelector:["children"],RelativeSelector:["combinator","selectors"],Combinator:[],TypeSelector:[],IdSelector:[],ClassSelector:[],AttributeSelector:[],PseudoElementSelector:["args"],PseudoClassSelector:["args"],Percentage:[],Nth:[],NestingSelector:[],Block:["children"],Declaration:[],Program:["body"],ExpressionStatement:["expression"],BlockStatement:["body"],StaticBlock:["body"],EmptyStatement:[],DebuggerStatement:[],WithStatement:["object","body"],ReturnStatement:["argument"],LabeledStatement:["label","body"],BreakStatement:["label"],ContinueStatement:["label"],IfStatement:["test","consequent","alternate"],SwitchStatement:["discriminant","cases"],SwitchCase:["test","consequent"],ThrowStatement:["argument"],TryStatement:["block","handler","finalizer"],CatchClause:["param","body"],WhileStatement:["test","body"],DoWhileStatement:["body","test"],ForStatement:["init","test","update","body"],ForInStatement:["left","right","body"],ForOfStatement:["left","right","body"],FunctionDeclaration:["id","typeParameters","params","returnType","body"],FunctionExpression:["id","typeParameters","params","returnType","body"],ArrowFunctionExpression:["typeParameters","params","returnType","body"],VariableDeclaration:["declarations"],VariableDeclarator:["id","init"],ClassDeclaration:["decorators","id","typeParameters","superClass","superTypeParameters","implements","body"],ClassExpression:["decorators","id","typeParameters","superClass","superTypeParameters","implements","body"],ClassBody:["body"],MethodDefinition:["decorators","key","typeParameters","value"],PropertyDefinition:["decorators","key","typeAnnotation","value"],Property:["decorators","key","value"],ThisExpression:[],Super:[],Literal:[],Identifier:["decorators","typeAnnotation"],PrivateIdentifier:[],ArrayExpression:["elements"],ObjectExpression:["properties"],UnaryExpression:["argument"],UpdateExpression:["argument"],BinaryExpression:["left","right"],LogicalExpression:["left","right"],AssignmentExpression:["left","right"],MemberExpression:["object","property"],ConditionalExpression:["test","consequent","alternate"],CallExpression:["callee","typeArguments","arguments"],NewExpression:["callee","typeArguments","arguments"],SequenceExpression:["expressions"],TemplateLiteral:["quasis","expressions"],TaggedTemplateExpression:["tag","typeArguments","quasi"],TemplateElement:[],SpreadElement:["argument"],RestElement:["decorators","argument","typeAnnotation"],YieldExpression:["argument"],AwaitExpression:["argument"],ImportExpression:["source","options","arguments"],ChainExpression:["expression"],MetaProperty:["meta","property"],ObjectPattern:["decorators","properties","typeAnnotation"],ArrayPattern:["decorators","elements","typeAnnotation"],AssignmentPattern:["decorators","left","right"],ImportDeclaration:["specifiers","source","attributes"],ImportSpecifier:["imported","local"],ImportDefaultSpecifier:["local"],ImportNamespaceSpecifier:["local"],ImportAttribute:["key","value"],ExportNamedDeclaration:["declaration","specifiers","source","attributes"],ExportSpecifier:["local","exported"],ExportDefaultDeclaration:["declaration"],ExportAllDeclaration:["exported","source","attributes"],Decorator:["expression"],TSTypeAnnotation:["typeAnnotation"],TSTypeParameterDeclaration:["params"],TSTypeParameterInstantiation:["params"],TSTypeParameter:["constraint","default"],TSAnyKeyword:[],TSBigIntKeyword:[],TSBooleanKeyword:[],TSNeverKeyword:[],TSNullKeyword:[],TSNumberKeyword:[],TSObjectKeyword:[],TSStringKeyword:[],TSSymbolKeyword:[],TSUndefinedKeyword:[],TSUnknownKeyword:[],TSVoidKeyword:[],TSThisType:[],TSArrayType:["elementType"],TSTupleType:["elementTypes"],TSNamedTupleMember:["label","elementType"],TSOptionalType:["typeAnnotation"],TSRestType:["typeAnnotation"],TSUnionType:["types"],TSIntersectionType:["types"],TSConditionalType:["checkType","extendsType","trueType","falseType"],TSInferType:["typeParameter"],TSParenthesizedType:["typeAnnotation"],TSTypeOperator:["typeAnnotation"],TSIndexedAccessType:["objectType","indexType"],TSMappedType:["typeParameter","nameType","typeAnnotation"],TSLiteralType:["literal"],TSTypeReference:["typeName","typeArguments"],TSQualifiedName:["left","right"],TSTypeQuery:["exprName","typeArguments"],TSImportType:["argument","qualifier","typeArguments"],TSTypeLiteral:["members"],TSPropertySignature:["key","typeAnnotation"],TSMethodSignature:["key","typeParameters","parameters","typeAnnotation"],TSCallSignatureDeclaration:["typeParameters","parameters","typeAnnotation"],TSConstructSignatureDeclaration:["typeParameters","parameters","typeAnnotation"],TSFunctionType:["typeParameters","parameters","typeAnnotation"],TSConstructorType:["typeParameters","parameters","typeAnnotation"],TSIndexSignature:["decorators","parameters","typeAnnotation"],TSTypePredicate:["parameterName","typeAnnotation"],TSInterfaceDeclaration:["id","typeParameters","extends","body"],TSInterfaceBody:["body"],TSExpressionWithTypeArguments:["expression","typeParameters"],TSTypeAliasDeclaration:["id","typeParameters","typeAnnotation"],TSEnumDeclaration:["id","members"],TSEnumMember:["id","initializer"],TSModuleDeclaration:["id","body"],TSModuleBlock:["body"],TSImportEqualsDeclaration:["id","moduleReference"],TSExternalModuleReference:["expression"],TSExportAssignment:["expression"],TSNamespaceExportDeclaration:["id"],TSDeclareFunction:["id","typeParameters","params","returnType"],TSDeclareMethod:["typeParameters","params","returnType"],TSParameterProperty:["parameter"],TSAsExpression:["expression","typeAnnotation"],TSSatisfiesExpression:["expression","typeAnnotation"],TSTypeAssertion:["typeAnnotation","expression"],TSNonNullExpression:["expression"],TSInstantiationExpression:["expression","typeArguments"]};var $c=Object.assign(Object.create(null),us),Ac=[],T=Symbol("sveast.walk.stop"),u=Symbol("sveast.walk.skip");function a(O,te,ve){Vs(O,null,null,null,te,ve===void 0||ve===us?Dc:(Je)=>Object.hasOwn(ve,Je.type)?ve[Je.type]:void 0)}function Vs(O,te,ve,Je,Gt,Wt){let Ht=Wt(O);if(Ht===void 0)throw Error(`unknown node type: ${O.type}`);let Ft=Gt.enter?.(O,te,ve,Je);if(Ft===T)return!0;if(Ft!==u){if(Ft!==O&&Bn(Ft))return Nc(Ft,te,ve,Je,Gt,Wt);let Kt=Qn(O);for(let zt=0;zt<Ht.length;zt++){let Xt=Ht[zt],Zt=Kt[Xt];if(Array.isArray(Zt))for(let Qt=0;Qt<Zt.length;Qt++){let en=Zt[Qt];if(Bn(en)&&Vs(en,O,Xt,Qt,Gt,Wt))return!0}else if(Bn(Zt)&&Vs(Zt,O,Xt,null,Gt,Wt))return!0}}return Gt.leave?.(O,te,ve,Je)===T}function Dc(O){let te=O.type;if(te==="Identifier")return O.typeAnnotation===void 0&&O.decorators===void 0?Ac:us.Identifier;if(te==="Literal")return us.Literal;if(te==="Text")return us.Text;return $c[te]}function Nc(O,te,ve,Je,Gt,Wt){if(te===null||ve===null)throw Error("walk can't replace the node it was called with");let Ht=Qn(te),Ft=Ht[ve];if(Je===null)Ht[ve]=O;else if(Array.isArray(Ft))Ft[Je]=O;return Vs(O,te,ve,Je,Gt,Wt)}function i(O){return typeof O==="object"&&O!==null}function qe(O){return i(O)&&O.type==="VariableDeclaration"&&Array.isArray(O.declarations)}function A(O){return i(O)&&O.type==="Literal"}function t(O){return i(O)&&O.type==="Identifier"&&typeof O.name==="string"}function b(O){return i(O)&&O.type==="MemberExpression"}function p(O){return i(O)&&O.type==="ObjectExpression"&&Array.isArray(O.properties)}function _c(O){return i(O)&&O.type==="CallExpression"}function f(O,te){return _c(O)&&t(O.callee)&&O.callee.name===te}function w(O){return O?.type==="TSAsExpression"||O?.type==="TSSatisfiesExpression"?w(O.expression):O}function Fe(O){return O?.type==="TSAsExpression"||O?.type==="TSSatisfiesExpression"?O.typeAnnotation:void 0}function Rc(O){return i(O)&&O.type==="NewExpression"}function Pe(O,te){return Rc(O)&&t(O.callee)&&O.callee.name===te}function v(O){if(!i(O)||typeof O.type!=="string")return null;if(O.type==="Literal"){let te=O.value;if(typeof te==="string")return te;return te==null?null:String(te)}if(O.type==="TemplateLiteral"){let te=O.quasis;if(te?.length===1)return te[0]?.value?.cooked??null}return null}function c(O){if(t(O))return O.name;if(A(O))return O.value==null?void 0:String(O.value);return}function hs(O,te,ve=0,Je=O.length,Gt=0){let Wt=Gt;for(let Ht=ve;Ht<Je;Ht++){let Ft=O.charCodeAt(Ht);if(Ft===34||Ft===39||Ft===96){Ht=Ic(O,Ht,Je);continue}if(Ft===123||Ft===40||Ft===91||Ft===60)Wt++;else if(Ft===125||Ft===41||Ft===93||Ft===62&&O.charCodeAt(Ht-1)!==61){if(Wt>0)Wt--}if(te?.(Ht,Wt)===!0)break}return Wt}function Ic(O,te,ve){let Je=O.charCodeAt(te);for(let Gt=te+1;Gt<ve;Gt++){let Wt=O.charCodeAt(Gt);if(Wt===92)Gt++;else if(Wt===Je)return Gt}return ve-1}function s(O,te){let ve=[],Je=0;return hs(O,(Gt,Wt)=>{if(Wt===0&&te.includes(O[Gt]))ve.push(O.slice(Je,Gt)),Je=Gt+1;return!1}),ve.push(O.slice(Je)),ve}function ie(O,te){let ve=-1;return hs(O,(Je,Gt)=>{if(Gt===0&&te.includes(O[Je]))ve=Je;return ve!==-1}),ve}function Fi(O){let te=-1;return hs(O,(ve,Je)=>{if(Je===0&&O[ve]==="="&&O[ve+1]===">")te=ve;return te!==-1}),te}function _(O,te){let ve=-1;return hs(O,(Je,Gt)=>{if(Gt===0)ve=Je;return ve!==-1},te),ve}function ji(O){let te=O.trim();return te.startsWith("[")&&_(te,0)===te.length-1}function se(O){if(!O)return;let te=Fi(O);if(te===-1)return;return O.slice(te+2).trim()||void 0}function Lc(O){let te="";for(let ve=0;ve<O.length;ve++){let Je=O[ve];if(Je==="*"&&O[ve+1]==="*"){if(te+=".*",ve++,O[ve+1]==="/")ve++;continue}if(Je==="*"){te+="[^/]*";continue}if(Je==="?"){te+="[^/]";continue}te+=".+^$()[]{}|\\".includes(Je)?`\\${Je}`:Je}return te}function Ao(O,te){return new RegExp(`^${Lc(O)}$`).test(te)}var Oc={"prop-unknown-type":"warning","context-any-type":"warning","slot-missing-type":"warning","slot-not-rendered":"warning","event-no-source":"warning","dispatch-escapes":"warning","example-compile-error":"error","example-syntax-error":"error","syntax-skipped":"error","type-syntax-error":"error","rest-props-unresolved":"warning","context-duplicate-key":"warning","context-key-unresolved":"warning","context-value-unresolved":"warning","spread-unresolved":"warning","export-unresolved":"warning","module-export-conflict":"warning","extend-props-target-missing":"error","extend-props-duplicate":"warning","extend-props-override":"warning","jsdoc-unknown-tag":"warning","typedef-duplicate":"warning","property-duplicate":"warning","generics-conflict":"warning","event-description-ambiguous":"warning","jsdoc-tag-dropped":"warning","internal-typedef-referenced":"error","cross-file-unresolved":"warning","export-ambiguous":"warning"};function o(O){return{...O,code:H[O.kind],severity:Oc[O.kind]}}function oe(O,te){if(te)return O;return O.filter((ve)=>ve.kind!=="jsdoc-unknown-tag")}function Do(O,te){if(!te)return[];return O.filter((ve)=>!ve.ignored&&(te!=="errors"||ve.severity==="error"))}function Mc(O,te){if(te.code!==void 0&&te.code!==O.code)return!1;if(te.name!==void 0&&te.name!==O.name)return!1;if(te.component!==void 0&&!Ao(te.component,O.component))return!1;return!0}function No(O,te){if(!te||te.length===0)return O;return O.map((ve)=>ve.ignored||te.some((Je)=>Mc(ve,Je))?{...ve,ignored:!0}:ve)}var _o={"prop-unknown-type":"Props without inferred types","context-any-type":"Context values typed as `any`","slot-missing-type":"@slot/@snippet tags missing a {Type} annotation","slot-not-rendered":"@slot/@snippet tags for slots the component doesn't render","event-no-source":"@event tags with no dispatch or callback","dispatch-escapes":"Dispatchers passed to functions sveld can't follow","example-compile-error":"@example blocks that failed to compile","example-syntax-error":"@example blocks that failed to parse","syntax-skipped":"Component syntax sveld skipped","type-syntax-error":"JSDoc types that aren't valid TypeScript","rest-props-unresolved":"$$restProps spread only onto components","context-duplicate-key":"Duplicate setContext keys","context-key-unresolved":"setContext keys sveld couldn't resolve","context-value-unresolved":"setContext values sveld couldn't describe","spread-unresolved":"Unresolved spreads widened to Record<string, any>","export-unresolved":"Unresolved named export specifiers","module-export-conflict":"Module-script exports colliding with generated names","extend-props-target-missing":"@extends/@extendProps targets that couldn't be verified","extend-props-duplicate":"Duplicate @extends/@extendProps tags","extend-props-override":"Own props overriding an @extends target's prop","jsdoc-unknown-tag":"Unknown JSDoc tags","typedef-duplicate":"Duplicate @typedef/@callback names","property-duplicate":"Duplicate @property names","generics-conflict":"Duplicate @generics/@template names","event-description-ambiguous":"Text after an @event read as the next tag's description","jsdoc-tag-dropped":"Passthrough JSDoc tags that couldn't attach","internal-typedef-referenced":"Public types referencing an @internal typedef","cross-file-unresolved":"Imports a standalone parse couldn't read","export-ambiguous":"Ambiguous `export *` names left out of the entry exports"},Ro=Object.keys(_o),H=Object.fromEntries(Ro.map((O)=>[O,`sveld/${O}`]));function Io(O){let te=new Set,ve=[];for(let Je of O){let Gt=`${Je.component}:${Je.kind}:${Je.name}`;if(te.has(Gt))continue;te.add(Gt),ve.push(Je)}return ve}function ae(O){let te=O.filter((Kt)=>!Kt.ignored),ve=O.length-te.length,Je=ve>0?` (${ve} ignored)`:"";if(te.length===0)return`sveld: no diagnostics${Je}.`;let Gt=[],Wt=(Kt,zt)=>`${Kt} ${zt}${Kt===1?"":"s"}`,Ht=te.filter((Kt)=>Kt.severity==="error").length,Ft=`${Wt(Ht,"error")}, ${Wt(te.length-Ht,"warning")}`;Gt.push(`sveld: ${Wt(te.length,"diagnostic")} (${Ft})${Je}.`);for(let Kt of Ro){let zt=te.filter((Zt)=>Zt.kind===Kt);if(zt.length===0)continue;Gt.push(""),Gt.push(`${_o[Kt]} (${zt.length}):`);let Xt=new Map;for(let Zt of zt){let Qt=Xt.get(Zt.component)??[];Qt.push(Zt),Xt.set(Zt.component,Qt)}for(let[Zt,Qt]of Xt){Gt.push(` ${Zt}`);for(let en of Qt){let tn=en.source?` (${Zt}:${en.source.start.line}:${en.source.start.column})`:"";Gt.push(` - ${en.message}${tn} [${en.code}]`)}}}return Gt.join(`
|
|
5
|
-
`)}var Ve=1;function ce(O){return`${JSON.stringify({kind:"diagnostics",schemaVersion:Ve,diagnostics:O},null,2)}
|
|
6
|
-
`}function Bi(O,te){if(te.length===0)return;O.diagnostics=[...O.diagnostics??[],...te]}var Vi="/**",Lo="*",Gs="*/",Fc="```",Gi=/^\s+/,Oo=/\s/,jc=/^@[^\s/]+(?=\s|$)/,Bc=/^@(\S+)\s*/,Vc=new Set(["extends","extendProps","generics","template","typedef"]);function z(O){let te=0;while(te<O.length){let ve=O.charCodeAt(te);if(ve!==32&&ve!==9&&ve!==13&&ve!==10&&!Oo.test(O[te]))break;te++}return te}function Gc(O,te){let ve=O.slice(z(O)),Je=!1;if(te)ve=ve.slice(Vi.length),Je=!0;else if(ve.startsWith(Lo)&&!ve.startsWith(Gs))ve=ve.slice(Lo.length),Je=!0;let Gt=ve.slice(0,z(ve));ve=ve.slice(Gt.length);let Wt=ve.trimEnd(),Ht=Wt.endsWith(Gs)?Wt.slice(0,-Gs.length).trimEnd():ve;return{indent:Je?Gt.slice(1):Gt,content:Ht}}function Wc(O,te,ve){let Je=ve>te&&O.charCodeAt(ve-1)===13?ve-1:ve;return O.slice(te,Je)}function Uc(O){let te=[],ve=0;while(!0){let Je=O.indexOf(Vi,ve);if(Je===-1)break;let Gt=O.lastIndexOf(`
|
|
7
|
-
`,Je-1)+1;if(O.charCodeAt(Je+Vi.length)===42||O.slice(Gt,Je).trim()!==""){ve=Je+1;continue}let Wt=[],Ht=Gt,Ft=!1,Kt=0;while(Ht<=O.length){let zt=O.indexOf(`
|
|
8
|
-
`,Ht),Xt=zt===-1?O.length:zt,Zt=Wc(O,Ht,Xt),{indent:Qt,content:en}=Gc(Zt,Wt.length===0);Wt.push({raw:Zt,start:Ht,number:Wt.length,indent:Qt,content:en});let tn=Zt.trimEnd();if(tn.endsWith(Gs)){Ft=!0,Kt=Ht+tn.length,ve=Xt;break}if(zt===-1)break;Ht=zt+1}if(!Ft)break;te.push({start:Je,end:Kt,lines:Wt})}return te}function Kc(O){let te=O;if(te.length>0&&te[0].content==="")te=te.slice(1);if(te.length>0&&te[te.length-1].content==="")te=te.slice(0,-1);return te}function Hc(O){let te=[[]],ve=!1;for(let Je of O){if(jc.test(Je.content)&&!ve)te.push([Je]);else te[te.length-1].push(Je);if(X(Je.content))ve=!ve}return te}function X(O){return qc(O,Fc)%2===1}function qc(O,te){let ve=0,Je=O.indexOf(te);while(Je!==-1)ve++,Je=O.indexOf(te,Je+te.length);return ve}function Mo(O){return O.map((te)=>te.indent+te.content).join(`
|
|
9
|
-
`)}function zc(O){let te=0;while(te<O.length-1&&O[te].content.trim()==="")te++;if(O[te].content[0]!=="{")return null;let ve=O.slice(te).map((Kt)=>Kt.content).join(`
|
|
10
|
-
`),Je=_(ve,0);if(Je===-1)return null;let Gt=[],Wt=Je+1;for(let Kt=te;Wt>0;Kt++){let zt=O[Kt].content.length;Gt.push(Math.min(Wt,zt)),Wt-=zt+1}let Ht=te+Gt.length-1;return{type:Gt.map((Kt,zt)=>{let Xt=te+zt,Zt=O[Xt].content.slice(0,Kt);if(O[Xt].content=O[Xt].content.slice(Kt).replace(Gi,""),Xt>0)O[Xt].continuesType=!0;return zt===0?Zt:O[Xt].indent+Zt}).join(`
|
|
11
|
-
`).slice(1,-1),endIndex:Ht}}function Xc(O){let te=O.content.match(Gi)?.[0]??"",ve=O.content.slice(te.length),Je=0,Gt=0;for(let zt of ve){if(Je===0&&Oo.test(zt))break;if(zt==="[")Je++;if(zt==="]")Je--;Gt++}let Wt=Je===0?ve.slice(0,Gt):"";if(!Wt)return null;let Ht=Wt,Ft=!1,Kt;if(Wt.startsWith("[")&&Wt.endsWith("]")){Ft=!0;let Xt=Wt.slice(1,-1).split("=");if(Ht=Xt[0].trim(),Xt.length>1)Kt=Xt.slice(1).join("=").trim();if(!Ht)return null}if(Ht.length>1&&(Ht[0]==='"'||Ht[0]==="'")&&Ht[Ht.length-1]===Ht[0])Ht=Ht.slice(1,-1);return O.content=ve.slice(Gt).replace(Gi,""),{name:Ht,optional:Ft,default:Kt}}function Jc(O){let te=O[0],ve=te.content.match(Bc),Je=ve?ve[1]:"",Gt=ve?te.content.slice(ve[0].length):te.content,Wt=Gt.trimEnd(),Ht=O.slice(1).map((en)=>en.indent+en.content),Ft=(Wt?[Wt,...Ht]:Ht).join(`
|
|
12
|
-
`);te.content=Gt,te.tag=Je;let Kt=zc(O),zt=Kt?.type??"",Xt=Kt?.endIndex??0;if(Vc.has(Je))while(Xt<O.length-1&&O[Xt].content.trim()==="")Xt++;let Zt=Xc(O[Xt]),Qt=Mo(O.slice(Xt));return{tag:Je,name:Zt?.name??"",type:zt,optional:Zt?.optional??!1,default:Zt?.default,description:Qt,text:Ft,lines:O}}function Yc(O,te,ve){let Je=Kc(O);Je.forEach((Ht,Ft)=>{Ht.number=Ft});let Gt=Hc(Je),Wt=Gt.slice(1).map(Jc);return{description:Mo(Gt[0]),tags:Wt,start:te,end:ve,lines:Je}}function E(O){return Uc(O).map(({start:te,end:ve,lines:Je})=>Yc(Je,te,ve))}var Qc=/\*\//g,Zc=/[.*+?^${}()|[\]\\]/g;function Q(O){return O.replace(Zc,"\\$&")}function S(O){return O.replace(Qc,"*\\/")}function y(O){return O.map((te)=>`${te.name}${te.optional?"?":""}: ${te.type}`).join(", ")}var el=new Intl.Collator("en");function l(O,te){return el.compare(O,te)}var tl=/(?:_|[^\p{ID_Continue}$])+/u,nl=/^[\p{ID_Start}$]/u;function N(O){let Je=`${O.split(tl).map((Gt)=>Gt.charAt(0).toUpperCase()+Gt.slice(1)).join("")}Context`;return nl.test(Je)?Je:`_${Je}`}function Y(O,te){let ve=te.source.value;if(typeof ve!=="string"||te.importKind==="type")return;for(let Je of te.specifiers){if(Je.type!=="ImportSpecifier"||Je.importKind==="type")continue;let Gt=Je.local.name,{imported:Wt}=Je,Ht=Wt.type==="Identifier"?Wt.name:typeof Wt.value==="string"?Wt.value:Gt;O.valueImportBindingsByLocalName.set(Gt,{localName:Gt,importedName:Ht,source:ve})}}function pe(O){return[O.importedName,...O.members??[]].join(".")}function Ae(O,te){let ve=[],Je=te;while(b(Je)){if(Je.computed||!t(Je.property))return;ve.unshift(Je.property.name),Je=Je.object}if(!t(Je))return;return Z(O,Je.name,ve)}function Z(O,te,ve=[]){let Je=(Wt,Ht,Ft)=>Ft.length>0?{source:Wt,importedName:Ht,members:Ft}:{source:Wt,importedName:Ht},Gt=O.valueImportBindingsByLocalName.get(te);if(Gt)return Je(Gt.source,Gt.importedName,ve);for(let Wt of[O.parsed?.instance,O.parsed?.module])for(let Ht of Wt?.content.body??[]){if(Ht.type!=="ImportDeclaration")continue;let Ft=Ht.source.value;if(Ht.importKind==="type"||typeof Ft!=="string")continue;let Kt=Ht.specifiers.find((zt)=>zt.local.name===te);if(Kt?.type==="ImportDefaultSpecifier")return Je(Ft,"default",ve);if(Kt?.type==="ImportNamespaceSpecifier"&&ve.length>0)return Je(Ft,ve[0],ve.slice(1))}return}function ue(O,te){if(!b(te))return;return Ae(O,te)}function Ue(O){let te=new Map;for(let ve of O.content.body){if(ve.type!=="ImportDeclaration"||ve.importKind==="type")continue;let Je=ve.source.value;if(typeof Je!=="string")continue;for(let Gt of ve.specifiers){if(Gt.type==="ImportSpecifier"&&Gt.importKind==="type")continue;let Wt=Gt.local.name,Ht;if(Gt.type==="ImportDefaultSpecifier")Ht="default";else if(Gt.type==="ImportNamespaceSpecifier")Ht="*";else if(Gt.imported.type==="Identifier")Ht=Gt.imported.name;else Ht=String(Gt.imported.value??Wt);te.set(Wt,{from:Je,imported:Ht})}}return te}function _e(O,te){for(let ve of te?.content.body??[]){if(ve.type==="ImportDeclaration"){Y(O,ve);continue}let Je=ve.type==="ExportNamedDeclaration"&&ve.declaration?ve.declaration:ve;if(Je.type==="FunctionDeclaration"&&Je.id?.name)O.funcDecls.set(Je.id.name,Je)}}function le(O){return O==="TSTypeAnnotation"||O==="TSTypeAliasDeclaration"||O==="TSInterfaceDeclaration"||O==="TSTypeParameterDeclaration"||O==="TSTypeParameterInstantiation"}function fe(O){let te=[];return a(O,{enter(ve){if(ve.type==="FunctionDeclaration"||ve.type==="FunctionExpression"||ve.type==="ArrowFunctionExpression")return u;if(ve.type==="ReturnStatement")te.push(ve.argument??null)}}),te}var Wi={3:"abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile",5:"class enum extends super const export import",6:"enum",strict:"implements interface let package private protected public static yield",strictBind:"eval arguments"},Ui="break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this",sl={5:Ui,"5module":Ui+" export import",6:Ui+" const class extends export import super"},Go=/^in(stanceof)?$/,il=/\p{ID_Start}/u,rl=/[\p{ID_Continue}\u200c\u200d]/u;function h(O,te){if(O<65)return O===36;if(O<91)return!0;if(O<97)return O===95;if(O<123)return!0;if(O>65535&&te===!1)return!1;return O>=170&&il.test(String.fromCodePoint(O))}function k(O,te){if(O<48)return O===36;if(O<58)return!0;if(O<65)return!1;if(O<91)return!0;if(O<97)return O===95;if(O<123)return!0;if(O>65535&&te===!1)return!1;return O>=170&&rl.test(String.fromCodePoint(O))}var ln=function(O,te){if(te===void 0)te={};this.label=O,this.keyword=te.keyword,this.beforeExpr=!!te.beforeExpr,this.startsExpr=!!te.startsExpr,this.isLoop=!!te.isLoop,this.isAssign=!!te.isAssign,this.prefix=!!te.prefix,this.postfix=!!te.postfix,this.binop=te.binop||null,this.updateContext=null};function Tn(O,te){return new ln(O,{beforeExpr:!0,binop:te})}var kn={beforeExpr:!0},bn={startsExpr:!0},zi={};function cn(O,te){if(te===void 0)te={};return te.keyword=O,zi[O]=new ln(O,te)}var Yt={num:new ln("num",bn),regexp:new ln("regexp",bn),string:new ln("string",bn),name:new ln("name",bn),privateId:new ln("privateId",bn),eof:new ln("eof"),bracketL:new ln("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new ln("]"),braceL:new ln("{",{beforeExpr:!0,startsExpr:!0}),braceR:new ln("}"),parenL:new ln("(",{beforeExpr:!0,startsExpr:!0}),parenR:new ln(")"),comma:new ln(",",kn),semi:new ln(";",kn),colon:new ln(":",kn),dot:new ln("."),question:new ln("?",kn),questionDot:new ln("?."),arrow:new ln("=>",kn),template:new ln("template"),invalidTemplate:new ln("invalidTemplate"),ellipsis:new ln("...",kn),backQuote:new ln("`",bn),dollarBraceL:new ln("${",{beforeExpr:!0,startsExpr:!0}),eq:new ln("=",{beforeExpr:!0,isAssign:!0}),assign:new ln("_=",{beforeExpr:!0,isAssign:!0}),incDec:new ln("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new ln("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:Tn("||",1),logicalAND:Tn("&&",2),bitwiseOR:Tn("|",3),bitwiseXOR:Tn("^",4),bitwiseAND:Tn("&",5),equality:Tn("==/!=/===/!==",6),relational:Tn("</>/<=/>=",7),bitShift:Tn("<</>>/>>>",8),plusMin:new ln("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:Tn("%",10),star:Tn("*",10),slash:Tn("/",10),starstar:new ln("**",{beforeExpr:!0}),coalesce:Tn("??",1),_break:cn("break"),_case:cn("case",kn),_catch:cn("catch"),_continue:cn("continue"),_debugger:cn("debugger"),_default:cn("default",kn),_do:cn("do",{isLoop:!0,beforeExpr:!0}),_else:cn("else",kn),_finally:cn("finally"),_for:cn("for",{isLoop:!0}),_function:cn("function",bn),_if:cn("if"),_return:cn("return",kn),_switch:cn("switch"),_throw:cn("throw",kn),_try:cn("try"),_var:cn("var"),_const:cn("const"),_while:cn("while",{isLoop:!0}),_with:cn("with"),_new:cn("new",{beforeExpr:!0,startsExpr:!0}),_this:cn("this",bn),_super:cn("super",bn),_class:cn("class",bn),_extends:cn("extends",kn),_export:cn("export"),_import:cn("import",bn),_null:cn("null",bn),_true:cn("true",bn),_false:cn("false",bn),_in:cn("in",{beforeExpr:!0,binop:7}),_instanceof:cn("instanceof",{beforeExpr:!0,binop:7}),_typeof:cn("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:cn("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:cn("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},Cn=/\r\n?|\n|\u2028|\u2029/,ol=new RegExp(Cn.source,"g");function ds(O){return O===10||O===13||O===8232||O===8233}function Wo(O,te,ve){if(ve===void 0)ve=O.length;for(var Je=te;Je<ve;Je++){var Gt=O.charCodeAt(Je);if(ds(Gt))return Je<ve-1&&Gt===13&&O.charCodeAt(Je+1)===10?Je+2:Je+1}return-1}var Uo=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,mn=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,al=Object.prototype,{hasOwnProperty:pl,toString:cl}=al,Ts=Object.hasOwn||function(O,te){return pl.call(O,te)},Fo=Array.isArray||function(O){return cl.call(O)==="[object Array]"},jo=Object.create(null);function Ws(O){return jo[O]||(jo[O]=new RegExp("^(?:"+O.replace(/ /g,"|")+")$"))}function qs(O){if(O<=65535)return String.fromCharCode(O);return O-=65536,String.fromCharCode((O>>10)+55296,(O&1023)+56320)}var ll=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,ws=function(O,te){this.line=O,this.column=te};ws.prototype.offset=function(O){return new ws(this.line,this.column+O)};var zs=function(O,te,ve){if(this.start=te,this.end=ve,O.sourceFile!==null)this.source=O.sourceFile};function Ko(O,te){for(var ve=1,Je=0;;){var Gt=Wo(O,Je,te);if(Gt<0)return new ws(ve,te-Je);++ve,Je=Gt}}var Ki={ecmaVersion:null,sourceType:"script",strict:!1,onInsertedSemicolon:null,onTrailingComma:null,allowReserved:null,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowAwaitOutsideFunction:null,allowSuperOutsideMethod:null,allowHashBang:!1,checkPrivateFields:!0,locations:!1,startLocation:null,onToken:null,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null,preserveParens:!1},Bo=!1;function ul(O){var te={};for(var ve in Ki)te[ve]=O&&Ts(O,ve)?O[ve]:Ki[ve];if(te.ecmaVersion==="latest")te.ecmaVersion=1e8;else if(te.ecmaVersion==null){if(!Bo&&typeof console==="object"&&console.warn)Bo=!0,console.warn(`Since Acorn 8.0.0, options.ecmaVersion is required.
|
|
13
|
-
Defaulting to 2020, but this will stop working in the future.`);te.ecmaVersion=11}else if(te.ecmaVersion>=2015)te.ecmaVersion-=2009;if(te.allowReserved==null)te.allowReserved=te.ecmaVersion<5;if(!O||O.allowHashBang==null)te.allowHashBang=te.ecmaVersion>=14;if(Fo(te.onToken)){var Je=te.onToken;te.onToken=function(Gt){return Je.push(Gt)}}if(Fo(te.onComment))te.onComment=hl(te,te.onComment);if(te.sourceType==="commonjs"&&te.allowAwaitOutsideFunction)throw Error("Cannot use allowAwaitOutsideFunction with sourceType: commonjs");return te}function hl(O,te){return function(ve,Je,Gt,Wt,Ht,Ft){var Kt={type:ve?"Block":"Line",value:Je,start:Gt,end:Wt};if(O.locations)Kt.loc=new zs(this,Ht,Ft);if(O.ranges)Kt.range=[Gt,Wt];te.push(Kt)}}var es=1,ts=2,Xi=4,Ho=8,Ji=16,qo=32,Xs=64,zo=128,ns=256,ks=512,Xo=1024,Js=es|ts|ns;function Yi(O,te){return ts|(O?Xi:0)|(te?Ho:0)}var Us=0,Qi=1,Vn=2,Jo=3,Yo=4,Qo=5,r=function(O,te,ve){this.options=O=ul(O),this.sourceFile=O.sourceFile,this.keywords=Ws(sl[O.ecmaVersion>=6?6:O.sourceType==="module"?"5module":5]);var Je="";if(O.allowReserved!==!0){if(Je=Wi[O.ecmaVersion>=6?6:O.ecmaVersion===5?5:3],O.sourceType==="module")Je+=" await"}this.reservedWords=Ws(Je);var Gt=(Je?Je+" ":"")+Wi.strict;if(this.reservedWordsStrict=Ws(Gt),this.reservedWordsStrictBind=Ws(Gt+" "+Wi.strictBind),this.input=String(te),this.containsEsc=!1,this.pos=ve||0,this.curLine=1,O.startLocation)this.lineStart=this.pos-O.startLocation.column,this.curLine=O.startLocation.line;else if(ve){if(this.lineStart=this.input.lastIndexOf(`
|
|
14
|
-
`,ve-1)+1,this.options.locations)this.curLine=this.input.slice(0,this.lineStart).split(Cn).length}else this.lineStart=0;if(this.type=Yt.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=this.initialContext(),this.exprAllowed=!0,this.inModule=O.sourceType==="module",this.strict=this.inModule||O.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&&O.allowHashBang&&this.input.slice(0,2)==="#!")this.skipLineComment(2);this.scopeStack=[],this.enterScope(this.options.sourceType==="commonjs"?ts:es),this.regexpState=null,this.privateNameStack=[]},Pn={inFunction:{configurable:!0},inGenerator:{configurable:!0},inAsync:{configurable:!0},canAwait:{configurable:!0},allowReturn:{configurable:!0},allowSuper:{configurable:!0},allowDirectSuper:{configurable:!0},treatFunctionsAsVar:{configurable:!0},allowNewDotTarget:{configurable:!0},allowUsing:{configurable:!0},inClassStaticBlock:{configurable:!0}};r.prototype.parse=function(){var O=this,te=this.options.program||this.startNode();return this.nextToken(),this.catchStackOverflow(function(){return O.parseTopLevel(te)})};Pn.inFunction.get=function(){return(this.currentVarScope().flags&ts)>0};Pn.inGenerator.get=function(){return(this.currentVarScope().flags&Ho)>0};Pn.inAsync.get=function(){return(this.currentVarScope().flags&Xi)>0};Pn.canAwait.get=function(){for(var O=this.scopeStack.length-1;O>=0;O--){var te=this.scopeStack[O],ve=te.flags;if(ve&(ns|ks))return!1;if(ve&ts)return(ve&Xi)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction};Pn.allowReturn.get=function(){if(this.inFunction)return!0;if(this.options.allowReturnOutsideFunction&&this.currentVarScope().flags&es)return!0;return!1};Pn.allowSuper.get=function(){var O=this.currentThisScope(),te=O.flags;return(te&Xs)>0||this.options.allowSuperOutsideMethod};Pn.allowDirectSuper.get=function(){return(this.currentThisScope().flags&zo)>0};Pn.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())};Pn.allowNewDotTarget.get=function(){for(var O=this.scopeStack.length-1;O>=0;O--){var te=this.scopeStack[O],ve=te.flags;if(ve&(ns|ks)||ve&ts&&!(ve&Ji))return!0}return!1};Pn.allowUsing.get=function(){var O=this.currentScope(),te=O.flags;if(te&Xo)return!1;if(!this.inModule&&te&es)return!1;return!0};Pn.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&ns)>0};r.extend=function(){var O=[],te=arguments.length;while(te--)O[te]=arguments[te];var ve=this;for(var Je=0;Je<O.length;Je++)ve=O[Je](ve);return ve};r.parse=function(O,te){return new this(te,O).parse()};r.parseExpressionAt=function(O,te,ve){var Je=new this(ve,O,te);return Je.nextToken(),Je.parseExpression()};r.tokenizer=function(O,te){return new this(te,O)};Object.defineProperties(r.prototype,Pn);var vn=r.prototype,dl=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;vn.strictDirective=function(O){if(this.options.ecmaVersion<5)return!1;for(;;){mn.lastIndex=O,O+=mn.exec(this.input)[0].length;var te=dl.exec(this.input.slice(O));if(!te)return!1;if((te[1]||te[2])==="use strict"){mn.lastIndex=O+te[0].length;var ve=mn.exec(this.input),Je=ve.index+ve[0].length,Gt=this.input.charAt(Je);return Gt===";"||Gt==="}"||Cn.test(ve[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(Gt)||Gt==="!"&&this.input.charAt(Je+1)==="=")}if(O+=te[0].length,mn.lastIndex=O,O+=mn.exec(this.input)[0].length,this.input[O]===";")O++}};vn.eat=function(O){if(this.type===O)return this.next(),!0;else return!1};vn.isContextual=function(O){return this.type===Yt.name&&this.value===O&&!this.containsEsc};vn.eatContextual=function(O){if(!this.isContextual(O))return!1;return this.next(),!0};vn.catchStackOverflow=function(O){try{return O()}catch(te){if(te instanceof Error&&(/\bstack\b.*\b(exceeded|overflow)\b/i.test(te.message)||/\btoo much recursion\b/i.test(te.message)))this.raise(this.start,"Not enough stack space to parse input");else throw te}};vn.expectContextual=function(O){if(!this.eatContextual(O))this.unexpected()};vn.canInsertSemicolon=function(){return this.type===Yt.eof||this.type===Yt.braceR||Cn.test(this.input.slice(this.lastTokEnd,this.start))};vn.insertSemicolon=function(){if(this.canInsertSemicolon()){if(this.options.onInsertedSemicolon)this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc);return!0}};vn.semicolon=function(){if(!this.eat(Yt.semi)&&!this.insertSemicolon())this.unexpected()};vn.afterTrailingComma=function(O,te){if(this.type===O){if(this.options.onTrailingComma)this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc);if(!te)this.next();return!0}};vn.expect=function(O){this.eat(O)||this.unexpected()};vn.unexpected=function(O){this.raise(O!=null?O:this.start,"Unexpected token")};var Ys=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};vn.checkPatternErrors=function(O,te){if(!O)return;if(O.trailingComma>-1)this.raiseRecoverable(O.trailingComma,"Comma is not permitted after the rest element");var ve=te?O.parenthesizedAssign:O.parenthesizedBind;if(ve>-1)this.raiseRecoverable(ve,te?"Assigning to rvalue":"Parenthesized pattern")};vn.checkExpressionErrors=function(O,te){if(!O)return!1;var{shorthandAssign:ve,doubleProto:Je}=O;if(!te)return ve>=0||Je>=0;if(ve>=0)this.raise(ve,"Shorthand property assignments are valid only in destructuring patterns");if(Je>=0)this.raiseRecoverable(Je,"Redefinition of __proto__ property")};vn.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")};vn.isSimpleAssignTarget=function(O){if(O.type==="ParenthesizedExpression")return this.isSimpleAssignTarget(O.expression);return O.type==="Identifier"||O.type==="MemberExpression"};var rn=r.prototype;rn.parseTopLevel=function(O){var te=Object.create(null);if(!O.body)O.body=[];while(this.type!==Yt.eof){var ve=this.parseStatement(null,!0,te);O.body.push(ve)}if(this.inModule)for(var Je=0,Gt=Object.keys(this.undefinedExports);Je<Gt.length;Je+=1){var Wt=Gt[Je];this.raiseRecoverable(this.undefinedExports[Wt].start,"Export '"+Wt+"' is not defined")}return this.adaptDirectivePrologue(O.body),this.next(),O.sourceType=this.options.sourceType==="commonjs"?"script":this.options.sourceType,this.finishNode(O,"Program")};var Zi={kind:"loop"},fl={kind:"switch"};rn.isLet=function(O){if(this.options.ecmaVersion<6||!this.isContextual("let"))return!1;mn.lastIndex=this.pos;var te=mn.exec(this.input),ve=this.pos+te[0].length,Je=this.fullCharCodeAt(ve);if(Je===91||Je===92)return!0;if(O)return!1;if(Je===123)return!0;if(h(Je)){var Gt=ve;do ve+=Je<=65535?1:2;while(k(Je=this.fullCharCodeAt(ve)));if(Je===92)return!0;var Wt=this.input.slice(Gt,ve);if(!Go.test(Wt))return!0}return!1};rn.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;mn.lastIndex=this.pos;var O=mn.exec(this.input),te=this.pos+O[0].length,ve;return!Cn.test(this.input.slice(this.pos,te))&&this.input.slice(te,te+8)==="function"&&(te+8===this.input.length||!(k(ve=this.fullCharCodeAt(te+8))||ve===92))};rn.isUsingKeyword=function(O,te){if(this.options.ecmaVersion<17||!this.isContextual(O?"await":"using"))return!1;mn.lastIndex=this.pos;var ve=mn.exec(this.input),Je=this.pos+ve[0].length;if(Cn.test(this.input.slice(this.pos,Je)))return!1;if(O){var Gt=Je+5,Wt;if(this.input.slice(Je,Gt)!=="using"||Gt===this.input.length||k(Wt=this.fullCharCodeAt(Gt))||Wt===92)return!1;mn.lastIndex=Gt;var Ht=mn.exec(this.input);if(Je=Gt+Ht[0].length,Ht&&Cn.test(this.input.slice(Gt,Je)))return!1}var Ft=this.fullCharCodeAt(Je);if(!h(Ft)&&Ft!==92)return!1;var Kt=Je;do Je+=Ft<=65535?1:2;while(k(Ft=this.fullCharCodeAt(Je)));if(Ft===92)return!0;var zt=this.input.slice(Kt,Je);if(Go.test(zt))return!1;if(te&&!O&&zt==="of"){mn.lastIndex=Je;var Xt=mn.exec(this.input);if(Je=Je+Xt[0].length,this.input.charCodeAt(Je)!==61||(Ft=this.input.charCodeAt(Je+1))===61||Ft===62)return!1}return!0};rn.isAwaitUsing=function(O){return this.isUsingKeyword(!0,O)};rn.isUsing=function(O){return this.isUsingKeyword(!1,O)};rn.parseStatement=function(O,te,ve){var Je=this.type,Gt=this.startNode(),Wt;if(this.isLet(O))Je=Yt._var,Wt="let";switch(Je){case Yt._break:case Yt._continue:return this.parseBreakContinueStatement(Gt,Je.keyword);case Yt._debugger:return this.parseDebuggerStatement(Gt);case Yt._do:return this.parseDoStatement(Gt);case Yt._for:return this.parseForStatement(Gt);case Yt._function:if(O&&(this.strict||O!=="if"&&O!=="label")&&this.options.ecmaVersion>=6)this.unexpected();return this.parseFunctionStatement(Gt,!1,!O);case Yt._class:if(O)this.unexpected();return this.parseClass(Gt,!0);case Yt._if:return this.parseIfStatement(Gt);case Yt._return:return this.parseReturnStatement(Gt);case Yt._switch:return this.parseSwitchStatement(Gt);case Yt._throw:return this.parseThrowStatement(Gt);case Yt._try:return this.parseTryStatement(Gt);case Yt._const:case Yt._var:if(Wt=Wt||this.value,O&&Wt!=="var")this.unexpected();return this.parseVarStatement(Gt,Wt);case Yt._while:return this.parseWhileStatement(Gt);case Yt._with:return this.parseWithStatement(Gt);case Yt.braceL:return this.parseBlock(!0,Gt);case Yt.semi:return this.parseEmptyStatement(Gt);case Yt._export:case Yt._import:if(this.options.ecmaVersion>10&&Je===Yt._import){mn.lastIndex=this.pos;var Ht=mn.exec(this.input),Ft=this.pos+Ht[0].length,Kt=this.input.charCodeAt(Ft);if(Kt===40||Kt===46)return this.parseExpressionStatement(Gt,this.parseExpression())}if(!this.options.allowImportExportEverywhere){if(!te)this.raise(this.start,"'import' and 'export' may only appear at the top level");if(!this.inModule)this.raise(this.start,"'import' and 'export' may appear only with 'sourceType: module'")}return Je===Yt._import?this.parseImport(Gt):this.parseExport(Gt,ve);default:if(this.isAsyncFunction()){if(O)this.unexpected();return this.next(),this.parseFunctionStatement(Gt,!0,!O)}var zt=this.isAwaitUsing(!1)?"await using":this.isUsing(!1)?"using":null;if(zt){if(!this.allowUsing)this.raise(this.start,"Using declaration cannot appear in the top level when source type is `script` or in the bare case statement");if(O)this.raise(this.start,"Using declaration is not allowed in single-statement positions");if(zt==="await using"){if(!this.canAwait)this.raise(this.start,"Await using cannot appear outside of async function");this.next()}return this.next(),this.parseVar(Gt,!1,zt),this.semicolon(),this.finishNode(Gt,"VariableDeclaration")}var Xt=this.value,Zt=this.parseExpression();if(Je===Yt.name&&Zt.type==="Identifier"&&this.eat(Yt.colon))return this.parseLabeledStatement(Gt,Xt,Zt,O);else return this.parseExpressionStatement(Gt,Zt)}};rn.parseBreakContinueStatement=function(O,te){var ve=te==="break";if(this.next(),this.eat(Yt.semi)||this.insertSemicolon())O.label=null;else if(this.type!==Yt.name)this.unexpected();else O.label=this.parseIdent(),this.semicolon();var Je=0;for(;Je<this.labels.length;++Je){var Gt=this.labels[Je];if(O.label==null||Gt.name===O.label.name){if(Gt.kind!=null&&(ve||Gt.kind==="loop"))break;if(O.label&&ve)break}}if(Je===this.labels.length)this.raise(O.start,"Unsyntactic "+te);return this.finishNode(O,ve?"BreakStatement":"ContinueStatement")};rn.parseDebuggerStatement=function(O){return this.next(),this.semicolon(),this.finishNode(O,"DebuggerStatement")};rn.parseDoStatement=function(O){if(this.next(),this.labels.push(Zi),O.body=this.parseStatement("do"),this.labels.pop(),this.expect(Yt._while),O.test=this.parseParenExpression(),this.options.ecmaVersion>=6)this.eat(Yt.semi);else this.semicolon();return this.finishNode(O,"DoWhileStatement")};rn.parseForStatement=function(O){this.next();var te=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(Zi),this.enterScope(0),this.expect(Yt.parenL),this.type===Yt.semi){if(te>-1)this.unexpected(te);return this.parseFor(O,null)}var ve=this.isLet();if(this.type===Yt._var||this.type===Yt._const||ve){var Je=this.startNode(),Gt=ve?"let":this.value;return this.next(),this.parseVar(Je,!0,Gt),this.finishNode(Je,"VariableDeclaration"),this.parseForAfterInit(O,Je,te)}var Wt=this.isContextual("let"),Ht=!1,Ft=this.isUsing(!0)?"using":this.isAwaitUsing(!0)?"await using":null;if(Ft){var Kt=this.startNode();if(this.next(),Ft==="await using"){if(!this.canAwait)this.raise(this.start,"Await using cannot appear outside of async function");this.next()}return this.parseVar(Kt,!0,Ft),this.finishNode(Kt,"VariableDeclaration"),this.parseForAfterInit(O,Kt,te)}var zt=this.containsEsc,Xt=new Ys,Zt=this.start,Qt=te>-1?this.parseExprSubscripts(Xt,"await"):this.parseExpression(!0,Xt);if(this.type===Yt._in||(Ht=this.options.ecmaVersion>=6&&this.isContextual("of"))){if(te>-1){if(this.type===Yt._in)this.unexpected(te);O.await=!0}else if(Ht&&this.options.ecmaVersion>=8){if(Qt.start===Zt&&!zt&&Qt.type==="Identifier"&&Qt.name==="async")this.unexpected();else if(this.options.ecmaVersion>=9)O.await=!1}if(Wt&&Ht)this.raise(Qt.start,"The left-hand side of a for-of loop may not start with 'let'.");return this.toAssignable(Qt,!1,Xt),this.checkLValPattern(Qt),this.parseForIn(O,Qt)}else this.checkExpressionErrors(Xt,!0);if(te>-1)this.unexpected(te);return this.parseFor(O,Qt)};rn.parseForAfterInit=function(O,te,ve){if((this.type===Yt._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&te.declarations.length===1){if(this.type===Yt._in){if((te.kind==="using"||te.kind==="await using")&&!te.declarations[0].init)this.raise(this.start,"Using declaration is not allowed in for-in loops");if(this.options.ecmaVersion>=9&&ve>-1)this.unexpected(ve)}else if(this.options.ecmaVersion>=9)O.await=ve>-1;return this.parseForIn(O,te)}if(ve>-1)this.unexpected(ve);return this.parseFor(O,te)};rn.parseFunctionStatement=function(O,te,ve){return this.next(),this.parseFunction(O,Cs|(ve?0:Hi),!1,te)};rn.parseIfStatement=function(O){return this.next(),O.test=this.parseParenExpression(),O.consequent=this.parseStatement("if"),O.alternate=this.eat(Yt._else)?this.parseStatement("if"):null,this.finishNode(O,"IfStatement")};rn.parseReturnStatement=function(O){if(!this.allowReturn)this.raise(this.start,"'return' outside of function");if(this.next(),this.eat(Yt.semi)||this.insertSemicolon())O.argument=null;else O.argument=this.parseExpression(),this.semicolon();return this.finishNode(O,"ReturnStatement")};rn.parseSwitchStatement=function(O){this.next(),O.discriminant=this.parseParenExpression(),O.cases=[],this.expect(Yt.braceL),this.labels.push(fl),this.enterScope(Xo);var te;for(var ve=!1;this.type!==Yt.braceR;)if(this.type===Yt._case||this.type===Yt._default){var Je=this.type===Yt._case;if(te)this.finishNode(te,"SwitchCase");if(O.cases.push(te=this.startNode()),te.consequent=[],this.next(),Je)te.test=this.parseExpression();else{if(ve)this.raiseRecoverable(this.lastTokStart,"Multiple default clauses");ve=!0,te.test=null}this.expect(Yt.colon)}else{if(!te)this.unexpected();te.consequent.push(this.parseStatement(null))}if(this.exitScope(),te)this.finishNode(te,"SwitchCase");return this.next(),this.labels.pop(),this.finishNode(O,"SwitchStatement")};rn.parseThrowStatement=function(O){if(this.next(),Cn.test(this.input.slice(this.lastTokEnd,this.start)))this.raise(this.lastTokEnd,"Illegal newline after throw");return O.argument=this.parseExpression(),this.semicolon(),this.finishNode(O,"ThrowStatement")};var ml=[];rn.parseCatchClauseParam=function(){var O=this.parseBindingAtom(),te=O.type==="Identifier";return this.enterScope(te?qo:0),this.checkLValPattern(O,te?Yo:Vn),this.expect(Yt.parenR),O};rn.parseTryStatement=function(O){if(this.next(),O.block=this.parseBlock(),O.handler=null,this.type===Yt._catch){var te=this.startNode();if(this.next(),this.eat(Yt.parenL))te.param=this.parseCatchClauseParam();else{if(this.options.ecmaVersion<10)this.unexpected();te.param=null,this.enterScope(0)}te.body=this.parseBlock(!1),this.exitScope(),O.handler=this.finishNode(te,"CatchClause")}if(O.finalizer=this.eat(Yt._finally)?this.parseBlock():null,!O.handler&&!O.finalizer)this.raise(O.start,"Missing catch or finally clause");return this.finishNode(O,"TryStatement")};rn.parseVarStatement=function(O,te,ve){return this.next(),this.parseVar(O,!1,te,ve),this.semicolon(),this.finishNode(O,"VariableDeclaration")};rn.parseWhileStatement=function(O){return this.next(),O.test=this.parseParenExpression(),this.labels.push(Zi),O.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(O,"WhileStatement")};rn.parseWithStatement=function(O){if(this.strict)this.raise(this.start,"'with' in strict mode");return this.next(),O.object=this.parseParenExpression(),O.body=this.parseStatement("with"),this.finishNode(O,"WithStatement")};rn.parseEmptyStatement=function(O){return this.next(),this.finishNode(O,"EmptyStatement")};rn.parseLabeledStatement=function(O,te,ve,Je){for(var Gt=0,Wt=this.labels;Gt<Wt.length;Gt+=1){var Ht=Wt[Gt];if(Ht.name===te)this.raise(ve.start,"Label '"+te+"' is already declared")}var Ft=this.type.isLoop?"loop":this.type===Yt._switch?"switch":null;for(var Kt=this.labels.length-1;Kt>=0;Kt--){var zt=this.labels[Kt];if(zt.statementStart===O.start)zt.statementStart=this.start,zt.kind=Ft;else break}return this.labels.push({name:te,kind:Ft,statementStart:this.start}),O.body=this.parseStatement(Je?Je.indexOf("label")===-1?Je+"label":Je:"label"),this.labels.pop(),O.label=ve,this.finishNode(O,"LabeledStatement")};rn.parseExpressionStatement=function(O,te){return O.expression=te,this.semicolon(),this.finishNode(O,"ExpressionStatement")};rn.parseBlock=function(O,te,ve){if(O===void 0)O=!0;if(te===void 0)te=this.startNode();if(te.body=[],this.expect(Yt.braceL),O)this.enterScope(0);while(this.type!==Yt.braceR){var Je=this.parseStatement(null);te.body.push(Je)}if(ve)this.strict=!1;if(this.next(),O)this.exitScope();return this.finishNode(te,"BlockStatement")};rn.parseFor=function(O,te){return O.init=te,this.expect(Yt.semi),O.test=this.type===Yt.semi?null:this.parseExpression(),this.expect(Yt.semi),O.update=this.type===Yt.parenR?null:this.parseExpression(),this.expect(Yt.parenR),O.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(O,"ForStatement")};rn.parseForIn=function(O,te){var ve=this.type===Yt._in;if(this.next(),te.type==="VariableDeclaration"&&te.declarations[0].init!=null&&(!ve||this.options.ecmaVersion<8||this.strict||te.kind!=="var"||te.declarations[0].id.type!=="Identifier"))this.raise(te.start,(ve?"for-in":"for-of")+" loop variable declaration may not have an initializer");return O.left=te,O.right=ve?this.parseExpression():this.parseMaybeAssign(),this.expect(Yt.parenR),O.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(O,ve?"ForInStatement":"ForOfStatement")};rn.parseVar=function(O,te,ve,Je){O.declarations=[],O.kind=ve;for(;;){var Gt=this.startNode();if(this.parseVarId(Gt,ve),this.eat(Yt.eq))Gt.init=this.parseMaybeAssign(te);else if(!Je&&ve==="const"&&!(this.type===Yt._in||this.options.ecmaVersion>=6&&this.isContextual("of")))this.unexpected();else if(!Je&&(ve==="using"||ve==="await using")&&this.options.ecmaVersion>=17&&this.type!==Yt._in&&!this.isContextual("of"))this.raise(this.lastTokEnd,"Missing initializer in "+ve+" declaration");else if(!Je&&Gt.id.type!=="Identifier"&&!(te&&(this.type===Yt._in||this.isContextual("of"))))this.raise(this.lastTokEnd,"Complex binding patterns require an initialization value");else Gt.init=null;if(O.declarations.push(this.finishNode(Gt,"VariableDeclarator")),!this.eat(Yt.comma))break}return O};rn.parseVarId=function(O,te){O.id=te==="using"||te==="await using"?this.parseIdent():this.parseBindingAtom(),this.checkLValPattern(O.id,te==="var"?Qi:Vn,!1)};var Cs=1,Hi=2,Zo=4;rn.parseFunction=function(O,te,ve,Je,Gt){if(this.initFunction(O),this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!Je){if(this.type===Yt.star&&te&Hi)this.unexpected();O.generator=this.eat(Yt.star)}if(this.options.ecmaVersion>=8)O.async=!!Je;if(te&Cs){if(O.id=te&Zo&&this.type!==Yt.name?null:this.parseIdent(),O.id&&!(te&Hi))this.checkLValSimple(O.id,this.strict||O.generator||O.async?this.treatFunctionsAsVar?Qi:Vn:Jo)}var Wt=this.yieldPos,Ht=this.awaitPos,Ft=this.awaitIdentPos;if(this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(Yi(O.async,O.generator)),!(te&Cs))O.id=this.type===Yt.name?this.parseIdent():null;return this.parseFunctionParams(O),this.parseFunctionBody(O,ve,!1,Gt),this.yieldPos=Wt,this.awaitPos=Ht,this.awaitIdentPos=Ft,this.finishNode(O,te&Cs?"FunctionDeclaration":"FunctionExpression")};rn.parseFunctionParams=function(O){this.expect(Yt.parenL),O.params=this.parseBindingList(Yt.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()};rn.parseClass=function(O,te){this.next();var ve=this.strict;this.strict=!0,this.parseClassId(O,te),this.parseClassSuper(O);var Je=this.enterClassBody(),Gt=this.startNode(),Wt=!1;Gt.body=[],this.expect(Yt.braceL);while(this.type!==Yt.braceR){var Ht=this.parseClassElement(O.superClass!==null);if(Ht){if(Gt.body.push(Ht),Ht.type==="MethodDefinition"&&Ht.kind==="constructor"){if(Wt)this.raiseRecoverable(Ht.start,"Duplicate constructor in the same class");Wt=!0}else if(Ht.key&&Ht.key.type==="PrivateIdentifier"&&gl(Je,Ht))this.raiseRecoverable(Ht.key.start,"Identifier '#"+Ht.key.name+"' has already been declared")}}return this.strict=ve,this.next(),O.body=this.finishNode(Gt,"ClassBody"),this.exitClassBody(),this.finishNode(O,te?"ClassDeclaration":"ClassExpression")};rn.parseClassElement=function(O){if(this.eat(Yt.semi))return null;var te=this.options.ecmaVersion,ve=this.startNode(),Je="",Gt=!1,Wt=!1,Ht="method",Ft=!1;if(this.eatContextual("static")){if(te>=13&&this.eat(Yt.braceL))return this.parseClassStaticBlock(ve),ve;if(this.isClassElementNameStart()||this.type===Yt.star)Ft=!0;else Je="static"}if(ve.static=Ft,!Je&&te>=8&&this.eatContextual("async"))if((this.isClassElementNameStart()||this.type===Yt.star)&&!this.canInsertSemicolon())Wt=!0;else Je="async";if(!Je&&(te>=9||!Wt)&&this.eat(Yt.star))Gt=!0;if(!Je&&!Wt&&!Gt){var Kt=this.value;if(this.eatContextual("get")||this.eatContextual("set"))if(this.isClassElementNameStart())Ht=Kt;else Je=Kt}if(Je)ve.computed=!1,ve.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),ve.key.name=Je,this.finishNode(ve.key,"Identifier");else this.parseClassElementName(ve);if(te<13||this.type===Yt.parenL||Ht!=="method"||Gt||Wt){var zt=!ve.static&&Ks(ve,"constructor"),Xt=zt&&O;if(zt&&Ht!=="method")this.raise(ve.key.start,"Constructor can't have get/set modifier");ve.kind=zt?"constructor":Ht,this.parseClassMethod(ve,Gt,Wt,Xt)}else this.parseClassField(ve);return ve};rn.isClassElementNameStart=function(){return this.type===Yt.name||this.type===Yt.privateId||this.type===Yt.num||this.type===Yt.string||this.type===Yt.bracketL||this.type.keyword};rn.parseClassElementName=function(O){if(this.type===Yt.privateId){if(this.value==="constructor")this.raise(this.start,"Classes can't have an element named '#constructor'");O.computed=!1,O.key=this.parsePrivateIdent()}else this.parsePropertyName(O)};rn.parseClassMethod=function(O,te,ve,Je){var Gt=O.key;if(O.kind==="constructor"){if(te)this.raise(Gt.start,"Constructor can't be a generator");if(ve)this.raise(Gt.start,"Constructor can't be an async method")}else if(O.static&&Ks(O,"prototype"))this.raise(Gt.start,"Classes may not have a static property named prototype");var Wt=O.value=this.parseMethod(te,ve,Je);if(O.kind==="get"&&Wt.params.length!==0)this.raiseRecoverable(Wt.start,"getter should have no params");if(O.kind==="set"&&Wt.params.length!==1)this.raiseRecoverable(Wt.start,"setter should have exactly one param");if(O.kind==="set"&&Wt.params[0].type==="RestElement")this.raiseRecoverable(Wt.params[0].start,"Setter cannot use rest params");return this.finishNode(O,"MethodDefinition")};rn.parseClassField=function(O){if(Ks(O,"constructor"))this.raise(O.key.start,"Classes can't have a field named 'constructor'");else if(O.static&&Ks(O,"prototype"))this.raise(O.key.start,"Classes can't have a static field named 'prototype'");if(this.eat(Yt.eq))this.enterScope(ks|Xs),O.value=this.parseMaybeAssign(),this.exitScope();else O.value=null;return this.semicolon(),this.finishNode(O,"PropertyDefinition")};rn.parseClassStaticBlock=function(O){O.body=[];var te=this.labels;this.labels=[],this.enterScope(ns|Xs);while(this.type!==Yt.braceR){var ve=this.parseStatement(null);O.body.push(ve)}return this.next(),this.exitScope(),this.labels=te,this.finishNode(O,"StaticBlock")};rn.parseClassId=function(O,te){if(this.type===Yt.name){if(O.id=this.parseIdent(),te)this.checkLValSimple(O.id,Vn,!1)}else{if(te===!0)this.unexpected();O.id=null}};rn.parseClassSuper=function(O){O.superClass=this.eat(Yt._extends)?this.parseExprSubscripts(null,!1):null};rn.enterClassBody=function(){var O={declared:Object.create(null),used:[]};return this.privateNameStack.push(O),O.declared};rn.exitClassBody=function(){var O=this.privateNameStack.pop(),{declared:te,used:ve}=O;if(!this.options.checkPrivateFields)return;var Je=this.privateNameStack.length,Gt=Je===0?null:this.privateNameStack[Je-1];for(var Wt=0;Wt<ve.length;++Wt){var Ht=ve[Wt];if(!Ts(te,Ht.name))if(Gt)Gt.used.push(Ht);else this.raiseRecoverable(Ht.start,"Private field '#"+Ht.name+"' must be declared in an enclosing class")}};function gl(O,te){var ve=te.key.name,Je=O[ve],Gt="true";if(te.type==="MethodDefinition"&&(te.kind==="get"||te.kind==="set"))Gt=(te.static?"s":"i")+te.kind;if(Je==="iget"&&Gt==="iset"||Je==="iset"&&Gt==="iget"||Je==="sget"&&Gt==="sset"||Je==="sset"&&Gt==="sget")return O[ve]="true",!1;else if(!Je)return O[ve]=Gt,!1;else return!0}function Ks(O,te){var{computed:ve,key:Je}=O;return!ve&&(Je.type==="Identifier"&&Je.name===te||Je.type==="Literal"&&Je.value===te)}rn.parseExportAllDeclaration=function(O,te){if(this.options.ecmaVersion>=11)if(this.eatContextual("as"))O.exported=this.parseModuleExportName(),this.checkExport(te,O.exported,this.lastTokStart);else O.exported=null;if(this.expectContextual("from"),this.type!==Yt.string)this.unexpected();if(O.source=this.parseExprAtom(),this.options.ecmaVersion>=16)O.attributes=this.parseWithClause();return this.semicolon(),this.finishNode(O,"ExportAllDeclaration")};rn.parseExport=function(O,te){if(this.next(),this.eat(Yt.star))return this.parseExportAllDeclaration(O,te);if(this.eat(Yt._default))return this.checkExport(te,"default",this.lastTokStart),O.declaration=this.parseExportDefaultDeclaration(),this.finishNode(O,"ExportDefaultDeclaration");if(this.shouldParseExportStatement()){if(O.declaration=this.parseExportDeclaration(O),O.declaration.type==="VariableDeclaration")this.checkVariableExport(te,O.declaration.declarations);else this.checkExport(te,O.declaration.id,O.declaration.id.start);if(O.specifiers=[],O.source=null,this.options.ecmaVersion>=16)O.attributes=[]}else{if(O.declaration=null,O.specifiers=this.parseExportSpecifiers(te),this.eatContextual("from")){if(this.type!==Yt.string)this.unexpected();if(O.source=this.parseExprAtom(),this.options.ecmaVersion>=16)O.attributes=this.parseWithClause()}else{for(var ve=0,Je=O.specifiers;ve<Je.length;ve+=1){var Gt=Je[ve];if(this.checkUnreserved(Gt.local),this.checkLocalExport(Gt.local),Gt.local.type==="Literal")this.raise(Gt.local.start,"A string literal cannot be used as an exported binding without `from`.")}if(O.source=null,this.options.ecmaVersion>=16)O.attributes=[]}this.semicolon()}return this.finishNode(O,"ExportNamedDeclaration")};rn.parseExportDeclaration=function(O){return this.parseStatement(null)};rn.parseExportDefaultDeclaration=function(){var O;if(this.type===Yt._function||(O=this.isAsyncFunction())){var te=this.startNode();if(this.next(),O)this.next();return this.parseFunction(te,Cs|Zo,!1,O)}else if(this.type===Yt._class){var ve=this.startNode();return this.parseClass(ve,"nullableID")}else{var Je=this.parseMaybeAssign();return this.semicolon(),Je}};rn.checkExport=function(O,te,ve){if(!O)return;if(typeof te!=="string")te=te.type==="Identifier"?te.name:te.value;if(Ts(O,te))this.raiseRecoverable(ve,"Duplicate export '"+te+"'");O[te]=!0};rn.checkPatternExport=function(O,te){var ve=te.type;if(ve==="Identifier")this.checkExport(O,te,te.start);else if(ve==="ObjectPattern")for(var Je=0,Gt=te.properties;Je<Gt.length;Je+=1){var Wt=Gt[Je];this.checkPatternExport(O,Wt)}else if(ve==="ArrayPattern")for(var Ht=0,Ft=te.elements;Ht<Ft.length;Ht+=1){var Kt=Ft[Ht];if(Kt)this.checkPatternExport(O,Kt)}else if(ve==="Property")this.checkPatternExport(O,te.value);else if(ve==="AssignmentPattern")this.checkPatternExport(O,te.left);else if(ve==="RestElement")this.checkPatternExport(O,te.argument)};rn.checkVariableExport=function(O,te){if(!O)return;for(var ve=0,Je=te;ve<Je.length;ve+=1){var Gt=Je[ve];this.checkPatternExport(O,Gt.id)}};rn.shouldParseExportStatement=function(){return this.type.keyword==="var"||this.type.keyword==="const"||this.type.keyword==="class"||this.type.keyword==="function"||this.isLet()||this.isAsyncFunction()};rn.parseExportSpecifier=function(O){var te=this.startNode();return te.local=this.parseModuleExportName(),te.exported=this.eatContextual("as")?this.parseModuleExportName():te.local,this.checkExport(O,te.exported,te.exported.start),this.finishNode(te,"ExportSpecifier")};rn.parseExportSpecifiers=function(O){var te=[],ve=!0;this.expect(Yt.braceL);while(!this.eat(Yt.braceR)){if(!ve){if(this.expect(Yt.comma),this.afterTrailingComma(Yt.braceR))break}else ve=!1;te.push(this.parseExportSpecifier(O))}return te};rn.parseImport=function(O){if(this.next(),this.type===Yt.string)O.specifiers=ml,O.source=this.parseExprAtom();else O.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),O.source=this.type===Yt.string?this.parseExprAtom():this.unexpected();if(this.options.ecmaVersion>=16)O.attributes=this.parseWithClause();return this.semicolon(),this.finishNode(O,"ImportDeclaration")};rn.parseImportSpecifier=function(){var O=this.startNode();if(O.imported=this.parseModuleExportName(),this.eatContextual("as"))O.local=this.parseIdent();else this.checkUnreserved(O.imported),O.local=O.imported;return this.checkLValSimple(O.local,Vn),this.finishNode(O,"ImportSpecifier")};rn.parseImportDefaultSpecifier=function(){var O=this.startNode();return O.local=this.parseIdent(),this.checkLValSimple(O.local,Vn),this.finishNode(O,"ImportDefaultSpecifier")};rn.parseImportNamespaceSpecifier=function(){var O=this.startNode();return this.next(),this.expectContextual("as"),O.local=this.parseIdent(),this.checkLValSimple(O.local,Vn),this.finishNode(O,"ImportNamespaceSpecifier")};rn.parseImportSpecifiers=function(){var O=[],te=!0;if(this.type===Yt.name){if(O.push(this.parseImportDefaultSpecifier()),!this.eat(Yt.comma))return O}if(this.type===Yt.star)return O.push(this.parseImportNamespaceSpecifier()),O;this.expect(Yt.braceL);while(!this.eat(Yt.braceR)){if(!te){if(this.expect(Yt.comma),this.afterTrailingComma(Yt.braceR))break}else te=!1;O.push(this.parseImportSpecifier())}return O};rn.parseWithClause=function(){var O=[];if(!this.eat(Yt._with))return O;this.expect(Yt.braceL);var te={},ve=!0;while(!this.eat(Yt.braceR)){if(!ve){if(this.expect(Yt.comma),this.afterTrailingComma(Yt.braceR))break}else ve=!1;var Je=this.parseImportAttribute(),Gt=Je.key.type==="Identifier"?Je.key.name:Je.key.value;if(Ts(te,Gt))this.raiseRecoverable(Je.key.start,"Duplicate attribute key '"+Gt+"'");te[Gt]=!0,O.push(Je)}return O};rn.parseImportAttribute=function(){var O=this.startNode();if(O.key=this.type===Yt.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never"),this.expect(Yt.colon),this.type!==Yt.string)this.unexpected();return O.value=this.parseExprAtom(),this.finishNode(O,"ImportAttribute")};rn.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===Yt.string){var O=this.parseLiteral(this.value);if(ll.test(O.value))this.raise(O.start,"An export name cannot include a lone surrogate.");return O}return this.parseIdent(!0)};rn.adaptDirectivePrologue=function(O){for(var te=0;te<O.length&&this.isDirectiveCandidate(O[te]);++te)O[te].directive=O[te].expression.raw.slice(1,-1)};rn.isDirectiveCandidate=function(O){return this.options.ecmaVersion>=5&&O.type==="ExpressionStatement"&&O.expression.type==="Literal"&&typeof O.expression.value==="string"&&(this.input[O.start]==='"'||this.input[O.start]==="'")};var $n=r.prototype;$n.toAssignable=function(O,te,ve){if(this.options.ecmaVersion>=6&&O)switch(O.type){case"Identifier":if(this.inAsync&&O.name==="await")this.raise(O.start,"Cannot use 'await' as identifier inside an async function");break;case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":break;case"ObjectExpression":if(O.type="ObjectPattern",ve)this.checkPatternErrors(ve,!0);for(var Je=0,Gt=O.properties;Je<Gt.length;Je+=1){var Wt=Gt[Je];if(this.toAssignable(Wt,te),Wt.type==="RestElement"&&(Wt.argument.type==="ArrayPattern"||Wt.argument.type==="ObjectPattern"))this.raise(Wt.argument.start,"Unexpected token")}break;case"Property":if(O.kind!=="init")this.raise(O.key.start,"Object pattern can't contain getter or setter");this.toAssignable(O.value,te);break;case"ArrayExpression":if(O.type="ArrayPattern",ve)this.checkPatternErrors(ve,!0);this.toAssignableList(O.elements,te);break;case"SpreadElement":if(O.type="RestElement",this.toAssignable(O.argument,te),O.argument.type==="AssignmentPattern")this.raise(O.argument.start,"Rest elements cannot have a default value");break;case"AssignmentExpression":if(O.operator!=="=")this.raise(O.left.end,"Only '=' operator can be used for specifying default value.");O.type="AssignmentPattern",delete O.operator,this.toAssignable(O.left,te);break;case"ParenthesizedExpression":this.toAssignable(O.expression,te,ve);break;case"ChainExpression":this.raiseRecoverable(O.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":if(!te)break;default:this.raise(O.start,"Assigning to rvalue")}else if(ve)this.checkPatternErrors(ve,!0);return O};$n.toAssignableList=function(O,te){var ve=O.length;for(var Je=0;Je<ve;Je++){var Gt=O[Je];if(Gt)this.toAssignable(Gt,te)}if(ve){var Wt=O[ve-1];if(this.options.ecmaVersion===6&&te&&Wt&&Wt.type==="RestElement"&&Wt.argument.type!=="Identifier")this.unexpected(Wt.argument.start)}return O};$n.parseSpread=function(O){var te=this.startNode();return this.next(),te.argument=this.parseMaybeAssign(!1,O),this.finishNode(te,"SpreadElement")};$n.parseRestBinding=function(){var O=this.startNode();if(this.next(),this.options.ecmaVersion===6&&this.type!==Yt.name)this.unexpected();return O.argument=this.parseBindingAtom(),this.finishNode(O,"RestElement")};$n.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case Yt.bracketL:var O=this.startNode();return this.next(),O.elements=this.parseBindingList(Yt.bracketR,!0,!0),this.finishNode(O,"ArrayPattern");case Yt.braceL:return this.parseObj(!0)}return this.parseIdent()};$n.parseBindingList=function(O,te,ve,Je){var Gt=[],Wt=!0;while(!this.eat(O)){if(Wt)Wt=!1;else this.expect(Yt.comma);if(te&&this.type===Yt.comma)Gt.push(null);else if(ve&&this.afterTrailingComma(O))break;else if(this.type===Yt.ellipsis){var Ht=this.parseRestBinding();if(this.parseBindingListItem(Ht),Gt.push(Ht),this.type===Yt.comma)this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");this.expect(O);break}else Gt.push(this.parseAssignableListItem(Je))}return Gt};$n.parseAssignableListItem=function(O){var te=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(te),te};$n.parseBindingListItem=function(O){return O};$n.parseMaybeDefault=function(O,te,ve){if(ve=ve||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(Yt.eq))return ve;var Je=this.startNodeAt(O,te);return Je.left=ve,Je.right=this.parseMaybeAssign(),this.finishNode(Je,"AssignmentPattern")};$n.checkLValSimple=function(O,te,ve){if(te===void 0)te=Us;var Je=te!==Us;switch(O.type){case"Identifier":if(this.strict&&this.reservedWordsStrictBind.test(O.name))this.raiseRecoverable(O.start,(Je?"Binding ":"Assigning to ")+O.name+" in strict mode");if(Je){if(te===Vn&&O.name==="let")this.raiseRecoverable(O.start,"let is disallowed as a lexically bound name");if(ve){if(Ts(ve,O.name))this.raiseRecoverable(O.start,"Argument name clash");ve[O.name]=!0}if(te!==Qo)this.declareName(O.name,te,O.start)}break;case"ChainExpression":this.raiseRecoverable(O.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":if(Je)this.raiseRecoverable(O.start,"Binding member expression");break;case"ParenthesizedExpression":if(Je)this.raiseRecoverable(O.start,"Binding parenthesized expression");return this.checkLValSimple(O.expression,te,ve);default:this.raise(O.start,(Je?"Binding":"Assigning to")+" rvalue")}};$n.checkLValPattern=function(O,te,ve){if(te===void 0)te=Us;switch(O.type){case"ObjectPattern":for(var Je=0,Gt=O.properties;Je<Gt.length;Je+=1){var Wt=Gt[Je];this.checkLValInnerPattern(Wt,te,ve)}break;case"ArrayPattern":for(var Ht=0,Ft=O.elements;Ht<Ft.length;Ht+=1){var Kt=Ft[Ht];if(Kt)this.checkLValInnerPattern(Kt,te,ve)}break;default:this.checkLValSimple(O,te,ve)}};$n.checkLValInnerPattern=function(O,te,ve){if(te===void 0)te=Us;switch(O.type){case"Property":this.checkLValInnerPattern(O.value,te,ve);break;case"AssignmentPattern":this.checkLValPattern(O.left,te,ve);break;case"RestElement":this.checkLValPattern(O.argument,te,ve);break;default:this.checkLValPattern(O,te,ve)}};var Dn=function(O,te,ve,Je,Gt){this.token=O,this.isExpr=!!te,this.preserveSpace=!!ve,this.override=Je,this.generator=!!Gt},hn={b_stat:new Dn("{",!1),b_expr:new Dn("{",!0),b_tmpl:new Dn("${",!1),p_stat:new Dn("(",!1),p_expr:new Dn("(",!0),q_tmpl:new Dn("`",!0,!0,function(O){return O.tryReadTemplateToken()}),f_stat:new Dn("function",!1),f_expr:new Dn("function",!0),f_expr_gen:new Dn("function",!0,!1,null,!0),f_gen:new Dn("function",!1,!1,null,!0)},fs=r.prototype;fs.initialContext=function(){return[hn.b_stat]};fs.curContext=function(){return this.context[this.context.length-1]};fs.braceIsBlock=function(O){var te=this.curContext();if(te===hn.f_expr||te===hn.f_stat)return!0;if(O===Yt.colon&&(te===hn.b_stat||te===hn.b_expr))return!te.isExpr;if(O===Yt._return||O===Yt.name&&this.exprAllowed)return Cn.test(this.input.slice(this.lastTokEnd,this.start));if(O===Yt._else||O===Yt.semi||O===Yt.eof||O===Yt.parenR||O===Yt.arrow)return!0;if(O===Yt.braceL)return te===hn.b_stat;if(O===Yt._var||O===Yt._const||O===Yt.name)return!1;return!this.exprAllowed};fs.inGeneratorContext=function(){for(var O=this.context.length-1;O>=1;O--){var te=this.context[O];if(te.token==="function")return te.generator}return!1};fs.updateContext=function(O){var te,ve=this.type;if(ve.keyword&&O===Yt.dot)this.exprAllowed=!1;else if(te=ve.updateContext)te.call(this,O);else this.exprAllowed=ve.beforeExpr};fs.overrideContext=function(O){if(this.curContext()!==O)this.context[this.context.length-1]=O};Yt.parenR.updateContext=Yt.braceR.updateContext=function(){if(this.context.length===1){this.exprAllowed=!0;return}var O=this.context.pop();if(O===hn.b_stat&&this.curContext().token==="function")O=this.context.pop();this.exprAllowed=!O.isExpr};Yt.braceL.updateContext=function(O){this.context.push(this.braceIsBlock(O)?hn.b_stat:hn.b_expr),this.exprAllowed=!0};Yt.dollarBraceL.updateContext=function(){this.context.push(hn.b_tmpl),this.exprAllowed=!0};Yt.parenL.updateContext=function(O){var te=O===Yt._if||O===Yt._for||O===Yt._with||O===Yt._while;this.context.push(te?hn.p_stat:hn.p_expr),this.exprAllowed=!0};Yt.incDec.updateContext=function(){};Yt._function.updateContext=Yt._class.updateContext=function(O){if(O.beforeExpr&&O!==Yt._else&&!(O===Yt.semi&&this.curContext()!==hn.p_stat)&&!(O===Yt._return&&Cn.test(this.input.slice(this.lastTokEnd,this.start)))&&!((O===Yt.colon||O===Yt.braceL)&&this.curContext()===hn.b_stat))this.context.push(hn.f_expr);else this.context.push(hn.f_stat);this.exprAllowed=!1};Yt.colon.updateContext=function(){if(this.curContext().token==="function")this.context.pop();this.exprAllowed=!0};Yt.backQuote.updateContext=function(){if(this.curContext()===hn.q_tmpl)this.context.pop();else this.context.push(hn.q_tmpl);this.exprAllowed=!1};Yt.star.updateContext=function(O){if(O===Yt._function){var te=this.context.length-1;if(this.context[te]===hn.f_expr)this.context[te]=hn.f_expr_gen;else this.context[te]=hn.f_gen}this.exprAllowed=!0};Yt.name.updateContext=function(O){var te=!1;if(this.options.ecmaVersion>=6&&O!==Yt.dot){if(this.value==="of"&&!this.exprAllowed||this.value==="yield"&&this.inGeneratorContext())te=!0}this.exprAllowed=te};var on=r.prototype;on.checkPropClash=function(O,te,ve){if(this.options.ecmaVersion>=9&&O.type==="SpreadElement")return;if(this.options.ecmaVersion>=6&&(O.computed||O.method||O.shorthand))return;var Je=O.key,Gt;switch(Je.type){case"Identifier":Gt=Je.name;break;case"Literal":Gt=String(Je.value);break;default:return}var Wt=O.kind;if(this.options.ecmaVersion>=6){if(Gt==="__proto__"&&Wt==="init"){if(te.proto)if(ve){if(ve.doubleProto<0)ve.doubleProto=Je.start}else this.raiseRecoverable(Je.start,"Redefinition of __proto__ property");te.proto=!0}return}Gt="$"+Gt;var Ht=te[Gt];if(Ht){var Ft;if(Wt==="init")Ft=this.strict&&Ht.init||Ht.get||Ht.set;else Ft=Ht.init||Ht[Wt];if(Ft)this.raiseRecoverable(Je.start,"Redefinition of property")}else Ht=te[Gt]={init:!1,get:!1,set:!1};Ht[Wt]=!0};on.parseExpression=function(O,te){var ve=this;return this.catchStackOverflow(function(){var{start:Je,startLoc:Gt}=ve,Wt=ve.parseMaybeAssign(O,te);if(ve.type===Yt.comma){var Ht=ve.startNodeAt(Je,Gt);Ht.expressions=[Wt];while(ve.eat(Yt.comma))Ht.expressions.push(ve.parseMaybeAssign(O,te));return ve.finishNode(Ht,"SequenceExpression")}return Wt})};on.parseMaybeAssign=function(O,te,ve){if(this.isContextual("yield"))if(this.inGenerator)return this.parseYield(O);else this.exprAllowed=!1;var Je=!1,Gt=-1,Wt=-1,Ht=-1;if(te)Gt=te.parenthesizedAssign,Wt=te.trailingComma,Ht=te.doubleProto,te.parenthesizedAssign=te.trailingComma=-1;else te=new Ys,Je=!0;var Ft=this.start,Kt=this.startLoc;if(this.type===Yt.parenL||this.type===Yt.name)this.potentialArrowAt=this.start,this.potentialArrowInForAwait=O==="await";var zt=this.parseMaybeConditional(O,te);if(ve)zt=ve.call(this,zt,Ft,Kt);if(this.type.isAssign){var Xt=this.startNodeAt(Ft,Kt);if(Xt.operator=this.value,this.type===Yt.eq)zt=this.toAssignable(zt,!1,te);if(!Je)te.parenthesizedAssign=te.trailingComma=te.doubleProto=-1;if(te.shorthandAssign>=zt.start)te.shorthandAssign=-1;if(this.type===Yt.eq)this.checkLValPattern(zt);else this.checkLValSimple(zt);if(Xt.left=zt,this.next(),Xt.right=this.parseMaybeAssign(O),Ht>-1)te.doubleProto=Ht;return this.finishNode(Xt,"AssignmentExpression")}else if(Je)this.checkExpressionErrors(te,!0);if(Gt>-1)te.parenthesizedAssign=Gt;if(Wt>-1)te.trailingComma=Wt;return zt};on.parseMaybeConditional=function(O,te){var ve=this.start,Je=this.startLoc,Gt=this.parseExprOps(O,te);if(this.checkExpressionErrors(te))return Gt;if(!(Gt.type==="ArrowFunctionExpression"&&Gt.start===ve)&&this.eat(Yt.question)){var Wt=this.startNodeAt(ve,Je);return Wt.test=Gt,Wt.consequent=this.parseMaybeAssign(),this.expect(Yt.colon),Wt.alternate=this.parseMaybeAssign(O),this.finishNode(Wt,"ConditionalExpression")}return Gt};on.parseExprOps=function(O,te){var ve=this.start,Je=this.startLoc,Gt=this.parseMaybeUnary(te,!1,!1,O);if(this.checkExpressionErrors(te))return Gt;return Gt.start===ve&&Gt.type==="ArrowFunctionExpression"?Gt:this.parseExprOp(Gt,ve,Je,-1,O)};on.parseExprOp=function(O,te,ve,Je,Gt){var Wt=this.type.binop;if(Wt!=null&&(!Gt||this.type!==Yt._in)){if(Wt>Je){var Ht=this.type===Yt.logicalOR||this.type===Yt.logicalAND,Ft=this.type===Yt.coalesce;if(Ft)Wt=Yt.logicalAND.binop;var Kt=this.value;this.next();var zt=this.start,Xt=this.startLoc,Zt=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,Gt),zt,Xt,Wt,Gt),Qt=this.buildBinary(te,ve,O,Zt,Kt,Ht||Ft);if(Ht&&this.type===Yt.coalesce||Ft&&(this.type===Yt.logicalOR||this.type===Yt.logicalAND))this.raiseRecoverable(this.start,"Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses");return this.parseExprOp(Qt,te,ve,Je,Gt)}}return O};on.buildBinary=function(O,te,ve,Je,Gt,Wt){if(Je.type==="PrivateIdentifier")this.raise(Je.start,"Private identifier can only be left side of binary expression");var Ht=this.startNodeAt(O,te);return Ht.left=ve,Ht.operator=Gt,Ht.right=Je,this.finishNode(Ht,Wt?"LogicalExpression":"BinaryExpression")};on.parseMaybeUnary=function(O,te,ve,Je){var Gt=this.start,Wt=this.startLoc,Ht;if(this.isContextual("await")&&this.canAwait)Ht=this.parseAwait(Je),te=!0;else if(this.type.prefix){var Ft=this.startNode(),Kt=this.type===Yt.incDec;if(Ft.operator=this.value,Ft.prefix=!0,this.next(),Ft.argument=this.parseMaybeUnary(null,!0,Kt,Je),this.checkExpressionErrors(O,!0),Kt)this.checkLValSimple(Ft.argument);else if(this.strict&&Ft.operator==="delete"&&ea(Ft.argument))this.raiseRecoverable(Ft.start,"Deleting local variable in strict mode");else if(Ft.operator==="delete"&&qi(Ft.argument))this.raiseRecoverable(Ft.start,"Private fields can not be deleted");else te=!0;Ht=this.finishNode(Ft,Kt?"UpdateExpression":"UnaryExpression")}else if(!te&&this.type===Yt.privateId){if((Je||this.privateNameStack.length===0)&&this.options.checkPrivateFields)this.unexpected();if(Ht=this.parsePrivateIdent(),this.type!==Yt._in)this.unexpected()}else{if(Ht=this.parseExprSubscripts(O,Je),this.checkExpressionErrors(O))return Ht;while(this.type.postfix&&!this.canInsertSemicolon()){var zt=this.startNodeAt(Gt,Wt);zt.operator=this.value,zt.prefix=!1,zt.argument=Ht,this.checkLValSimple(Ht),this.next(),Ht=this.finishNode(zt,"UpdateExpression")}}if(!ve&&!(Ht.type==="ArrowFunctionExpression"&&Ht.start===Gt)&&this.eat(Yt.starstar))if(te)this.unexpected(this.lastTokStart);else return this.buildBinary(Gt,Wt,Ht,this.parseMaybeUnary(null,!1,!1,Je),"**",!1);else return Ht};function ea(O){return O.type==="Identifier"||O.type==="ParenthesizedExpression"&&ea(O.expression)}function qi(O){return O.type==="MemberExpression"&&O.property.type==="PrivateIdentifier"||O.type==="ChainExpression"&&qi(O.expression)||O.type==="ParenthesizedExpression"&&qi(O.expression)}on.parseExprSubscripts=function(O,te){var ve=this.start,Je=this.startLoc,Gt=this.parseExprAtom(O,te);if(Gt.type==="ArrowFunctionExpression"&&this.input.slice(this.lastTokStart,this.lastTokEnd)!==")")return Gt;var Wt=this.parseSubscripts(Gt,ve,Je,!1,te);if(O&&Wt.type==="MemberExpression"){if(O.parenthesizedAssign>=Wt.start)O.parenthesizedAssign=-1;if(O.parenthesizedBind>=Wt.start)O.parenthesizedBind=-1;if(O.trailingComma>=Wt.start)O.trailingComma=-1}return Wt};on.parseSubscripts=function(O,te,ve,Je,Gt){var Wt=this.options.ecmaVersion>=8&&O.type==="Identifier"&&O.name==="async"&&this.lastTokEnd===O.end&&!this.canInsertSemicolon()&&O.end-O.start===5&&this.potentialArrowAt===O.start,Ht=!1;while(!0){var Ft=this.parseSubscript(O,te,ve,Je,Wt,Ht,Gt);if(Ft.optional)Ht=!0;if(Ft===O||Ft.type==="ArrowFunctionExpression"){if(Ht){var Kt=this.startNodeAt(te,ve);Kt.expression=Ft,Ft=this.finishNode(Kt,"ChainExpression")}return Ft}O=Ft}};on.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(Yt.arrow)};on.parseSubscriptAsyncArrow=function(O,te,ve,Je){return this.parseArrowExpression(this.startNodeAt(O,te),ve,!0,Je)};on.parseSubscript=function(O,te,ve,Je,Gt,Wt,Ht){var Ft=this.options.ecmaVersion>=11,Kt=Ft&&this.eat(Yt.questionDot);if(Je&&Kt)this.raise(this.lastTokStart,"Optional chaining cannot appear in the callee of new expressions");var zt=this.eat(Yt.bracketL);if(zt||Kt&&this.type!==Yt.parenL&&this.type!==Yt.backQuote||this.eat(Yt.dot)){var Xt=this.startNodeAt(te,ve);if(Xt.object=O,zt)Xt.property=this.parseExpression(),this.expect(Yt.bracketR);else if(this.type===Yt.privateId&&O.type!=="Super")Xt.property=this.parsePrivateIdent();else Xt.property=this.parseIdent(this.options.allowReserved!=="never");if(Xt.computed=!!zt,Ft)Xt.optional=Kt;O=this.finishNode(Xt,"MemberExpression")}else if(!Je&&this.eat(Yt.parenL)){var Zt=new Ys,Qt=this.yieldPos,en=this.awaitPos,tn=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var sn=this.parseExprList(Yt.parenR,this.options.ecmaVersion>=8,!1,Zt);if(Gt&&!Kt&&this.shouldParseAsyncArrow()){if(this.checkPatternErrors(Zt,!1),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0)this.raise(this.awaitIdentPos,"Cannot use 'await' as identifier inside an async function");return this.yieldPos=Qt,this.awaitPos=en,this.awaitIdentPos=tn,this.parseSubscriptAsyncArrow(te,ve,sn,Ht)}this.checkExpressionErrors(Zt,!0),this.yieldPos=Qt||this.yieldPos,this.awaitPos=en||this.awaitPos,this.awaitIdentPos=tn||this.awaitIdentPos;var nn=this.startNodeAt(te,ve);if(nn.callee=O,nn.arguments=sn,Ft)nn.optional=Kt;O=this.finishNode(nn,"CallExpression")}else if(this.type===Yt.backQuote){if(Kt||Wt)this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions");var an=this.startNodeAt(te,ve);an.tag=O,an.quasi=this.parseTemplate({isTagged:!0}),O=this.finishNode(an,"TaggedTemplateExpression")}return O};on.parseExprAtom=function(O,te,ve){if(this.type===Yt.slash)this.readRegexp();var Je,Gt=this.potentialArrowAt===this.start;switch(this.type){case Yt._super:if(!this.allowSuper)this.raise(this.start,"'super' keyword outside a method");if(Je=this.startNode(),this.next(),this.type===Yt.parenL&&!this.allowDirectSuper)this.raise(Je.start,"super() call outside constructor of a subclass");if(this.type!==Yt.dot&&this.type!==Yt.bracketL&&this.type!==Yt.parenL)this.unexpected();return this.finishNode(Je,"Super");case Yt._this:return Je=this.startNode(),this.next(),this.finishNode(Je,"ThisExpression");case Yt.name:var Wt=this.start,Ht=this.startLoc,Ft=this.containsEsc,Kt=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!Ft&&Kt.name==="async"&&!this.canInsertSemicolon()&&this.eat(Yt._function))return this.overrideContext(hn.f_expr),this.parseFunction(this.startNodeAt(Wt,Ht),0,!1,!0,te);if(Gt&&!this.canInsertSemicolon()){if(this.eat(Yt.arrow))return this.parseArrowExpression(this.startNodeAt(Wt,Ht),[Kt],!1,te);if(this.options.ecmaVersion>=8&&Kt.name==="async"&&this.type===Yt.name&&!Ft&&(!this.potentialArrowInForAwait||this.value!=="of"||this.containsEsc)){if(Kt=this.parseIdent(!1),this.canInsertSemicolon()||!this.eat(Yt.arrow))this.unexpected();return this.parseArrowExpression(this.startNodeAt(Wt,Ht),[Kt],!0,te)}}return Kt;case Yt.regexp:var zt=this.value;return Je=this.parseLiteral(zt.value),Je.regex={pattern:zt.pattern,flags:zt.flags},Je;case Yt.num:case Yt.string:return this.parseLiteral(this.value);case Yt._null:case Yt._true:case Yt._false:return Je=this.startNode(),Je.value=this.type===Yt._null?null:this.type===Yt._true,Je.raw=this.type.keyword,this.next(),this.finishNode(Je,"Literal");case Yt.parenL:var Xt=this.start,Zt=this.parseParenAndDistinguishExpression(Gt,te);if(O){if(O.parenthesizedAssign<0&&!this.isSimpleAssignTarget(Zt))O.parenthesizedAssign=Xt;if(O.parenthesizedBind<0)O.parenthesizedBind=Xt}return Zt;case Yt.bracketL:return Je=this.startNode(),this.next(),Je.elements=this.parseExprList(Yt.bracketR,!0,!0,O),this.finishNode(Je,"ArrayExpression");case Yt.braceL:return this.overrideContext(hn.b_expr),this.parseObj(!1,O);case Yt._function:return Je=this.startNode(),this.next(),this.parseFunction(Je,0);case Yt._class:return this.parseClass(this.startNode(),!1);case Yt._new:return this.parseNew();case Yt.backQuote:return this.parseTemplate();case Yt._import:if(this.options.ecmaVersion>=11)return this.parseExprImport(ve);else return this.unexpected();default:return this.parseExprAtomDefault()}};on.parseExprAtomDefault=function(){this.unexpected()};on.parseExprImport=function(O){var te=this.startNode();if(this.containsEsc)this.raiseRecoverable(this.start,"Escape sequence in keyword import");if(this.next(),this.type===Yt.parenL&&!O)return this.parseDynamicImport(te);else if(this.type===Yt.dot){var ve=this.startNodeAt(te.start,te.loc&&te.loc.start);return ve.name="import",te.meta=this.finishNode(ve,"Identifier"),this.parseImportMeta(te)}else this.unexpected()};on.parseDynamicImport=function(O){if(this.next(),O.source=this.parseMaybeAssign(),this.options.ecmaVersion>=16)if(!this.eat(Yt.parenR))if(this.expect(Yt.comma),!this.afterTrailingComma(Yt.parenR)){if(O.options=this.parseMaybeAssign(),!this.eat(Yt.parenR)){if(this.expect(Yt.comma),!this.afterTrailingComma(Yt.parenR))this.unexpected()}}else O.options=null;else O.options=null;else if(!this.eat(Yt.parenR)){var te=this.start;if(this.eat(Yt.comma)&&this.eat(Yt.parenR))this.raiseRecoverable(te,"Trailing comma is not allowed in import()");else this.unexpected(te)}return this.finishNode(O,"ImportExpression")};on.parseImportMeta=function(O){this.next();var te=this.containsEsc;if(O.property=this.parseIdent(!0),O.property.name!=="meta")this.raiseRecoverable(O.property.start,"The only valid meta property for import is 'import.meta'");if(te)this.raiseRecoverable(O.start,"'import.meta' must not contain escaped characters");if(this.options.sourceType!=="module"&&!this.options.allowImportExportEverywhere)this.raiseRecoverable(O.start,"Cannot use 'import.meta' outside a module");return this.finishNode(O,"MetaProperty")};on.parseLiteral=function(O){var te=this.startNode();if(te.value=O,te.raw=this.input.slice(this.start,this.end),te.raw.charCodeAt(te.raw.length-1)===110)te.bigint=te.value!=null?te.value.toString():te.raw.slice(0,-1).replace(/_/g,"");return this.next(),this.finishNode(te,"Literal")};on.parseParenExpression=function(){this.expect(Yt.parenL);var O=this.parseExpression();return this.expect(Yt.parenR),O};on.shouldParseArrow=function(O){return!this.canInsertSemicolon()};on.parseParenAndDistinguishExpression=function(O,te){var ve=this.start,Je=this.startLoc,Gt,Wt=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var Ht=this.start,Ft=this.startLoc,Kt=[],zt=!0,Xt=!1,Zt=new Ys,Qt=this.yieldPos,en=this.awaitPos,tn;this.yieldPos=0,this.awaitPos=0;while(this.type!==Yt.parenR)if(zt?zt=!1:this.expect(Yt.comma),Wt&&this.afterTrailingComma(Yt.parenR,!0)){Xt=!0;break}else if(this.type===Yt.ellipsis){if(tn=this.start,Kt.push(this.parseParenItem(this.parseRestBinding())),this.type===Yt.comma)this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");break}else Kt.push(this.parseMaybeAssign(!1,Zt,this.parseParenItem));var sn=this.lastTokEnd,nn=this.lastTokEndLoc;if(this.expect(Yt.parenR),O&&this.shouldParseArrow(Kt)&&this.eat(Yt.arrow))return this.checkPatternErrors(Zt,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=Qt,this.awaitPos=en,this.parseParenArrowList(ve,Je,Kt,te);if(!Kt.length||Xt)this.unexpected(this.lastTokStart);if(tn)this.unexpected(tn);if(this.checkExpressionErrors(Zt,!0),this.yieldPos=Qt||this.yieldPos,this.awaitPos=en||this.awaitPos,Kt.length>1)Gt=this.startNodeAt(Ht,Ft),Gt.expressions=Kt,this.finishNodeAt(Gt,"SequenceExpression",sn,nn);else Gt=Kt[0]}else Gt=this.parseParenExpression();if(this.options.preserveParens){var an=this.startNodeAt(ve,Je);return an.expression=Gt,this.finishNode(an,"ParenthesizedExpression")}else return Gt};on.parseParenItem=function(O){return O};on.parseParenArrowList=function(O,te,ve,Je){return this.parseArrowExpression(this.startNodeAt(O,te),ve,!1,Je)};var yl=[];on.parseNew=function(){if(this.containsEsc)this.raiseRecoverable(this.start,"Escape sequence in keyword new");var O=this.startNode();if(this.next(),this.options.ecmaVersion>=6&&this.type===Yt.dot){var te=this.startNodeAt(O.start,O.loc&&O.loc.start);te.name="new",O.meta=this.finishNode(te,"Identifier"),this.next();var ve=this.containsEsc;if(O.property=this.parseIdent(!0),O.property.name!=="target")this.raiseRecoverable(O.property.start,"The only valid meta property for new is 'new.target'");if(ve)this.raiseRecoverable(O.start,"'new.target' must not contain escaped characters");if(!this.allowNewDotTarget)this.raiseRecoverable(O.start,"'new.target' can only be used in functions and class static block");return this.finishNode(O,"MetaProperty")}var Je=this.start,Gt=this.startLoc;if(O.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),Je,Gt,!0,!1),O.callee.type==="Super")this.raiseRecoverable(Je,"Invalid use of 'super'");if(this.eat(Yt.parenL))O.arguments=this.parseExprList(Yt.parenR,this.options.ecmaVersion>=8,!1);else O.arguments=yl;return this.finishNode(O,"NewExpression")};on.parseTemplateElement=function(O){var te=O.isTagged,ve=this.startNode();if(this.type===Yt.invalidTemplate){if(!te)this.raiseRecoverable(this.start,"Bad escape sequence in untagged template literal");ve.value={raw:this.value.replace(/\r\n?/g,`
|
|
15
|
-
`),cooked:null}}else ve.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,`
|
|
16
|
-
`),cooked:this.value};return this.next(),ve.tail=this.type===Yt.backQuote,this.finishNode(ve,"TemplateElement")};on.parseTemplate=function(O){if(O===void 0)O={};var te=O.isTagged;if(te===void 0)te=!1;var ve=this.startNode();this.next(),ve.expressions=[];var Je=this.parseTemplateElement({isTagged:te});ve.quasis=[Je];while(!Je.tail){if(this.type===Yt.eof)this.raise(this.pos,"Unterminated template literal");this.expect(Yt.dollarBraceL),ve.expressions.push(this.parseExpression()),this.expect(Yt.braceR),ve.quasis.push(Je=this.parseTemplateElement({isTagged:te}))}return this.next(),this.finishNode(ve,"TemplateLiteral")};on.isAsyncProp=function(O){return!O.computed&&O.key.type==="Identifier"&&O.key.name==="async"&&(this.type===Yt.name||this.type===Yt.num||this.type===Yt.string||this.type===Yt.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===Yt.star)&&!Cn.test(this.input.slice(this.lastTokEnd,this.start))};on.parseObj=function(O,te){var ve=this.startNode(),Je=!0,Gt={};ve.properties=[],this.next();while(!this.eat(Yt.braceR)){if(!Je){if(this.expect(Yt.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(Yt.braceR))break}else Je=!1;var Wt=this.parseProperty(O,te);if(!O)this.checkPropClash(Wt,Gt,te);ve.properties.push(Wt)}return this.finishNode(ve,O?"ObjectPattern":"ObjectExpression")};on.parseProperty=function(O,te){var ve=this.startNode(),Je,Gt,Wt,Ht;if(this.options.ecmaVersion>=9&&this.eat(Yt.ellipsis)){if(O){if(ve.argument=this.parseIdent(!1),this.type===Yt.comma)this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");return this.finishNode(ve,"RestElement")}if(ve.argument=this.parseMaybeAssign(!1,te),this.type===Yt.comma&&te&&te.trailingComma<0)te.trailingComma=this.start;return this.finishNode(ve,"SpreadElement")}if(this.options.ecmaVersion>=6){if(ve.method=!1,ve.shorthand=!1,O||te)Wt=this.start,Ht=this.startLoc;if(!O)Je=this.eat(Yt.star)}var Ft=this.containsEsc;if(this.parsePropertyName(ve),!O&&!Ft&&this.options.ecmaVersion>=8&&!Je&&this.isAsyncProp(ve))Gt=!0,Je=this.options.ecmaVersion>=9&&this.eat(Yt.star),this.parsePropertyName(ve);else Gt=!1;return this.parsePropertyValue(ve,O,Je,Gt,Wt,Ht,te,Ft),this.finishNode(ve,"Property")};on.parseGetterSetter=function(O){var te=O.key.name;this.parsePropertyName(O),O.value=this.parseMethod(!1),O.kind=te;var ve=O.kind==="get"?0:1;if(O.value.params.length!==ve){var Je=O.value.start;if(O.kind==="get")this.raiseRecoverable(Je,"getter should have no params");else this.raiseRecoverable(Je,"setter should have exactly one param")}else if(O.kind==="set"&&O.value.params[0].type==="RestElement")this.raiseRecoverable(O.value.params[0].start,"Setter cannot use rest params")};on.parsePropertyValue=function(O,te,ve,Je,Gt,Wt,Ht,Ft){if((ve||Je)&&this.type===Yt.colon)this.unexpected();if(this.eat(Yt.colon))O.value=te?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,Ht),O.kind="init";else if(this.options.ecmaVersion>=6&&this.type===Yt.parenL){if(te)this.unexpected();O.method=!0,O.value=this.parseMethod(ve,Je),O.kind="init"}else if(!te&&!Ft&&this.options.ecmaVersion>=5&&!O.computed&&O.key.type==="Identifier"&&(O.key.name==="get"||O.key.name==="set")&&(this.type!==Yt.comma&&this.type!==Yt.braceR&&this.type!==Yt.eq)){if(ve||Je)this.unexpected();this.parseGetterSetter(O)}else if(this.options.ecmaVersion>=6&&!O.computed&&O.key.type==="Identifier"){if(ve||Je)this.unexpected();if(this.checkUnreserved(O.key),O.key.name==="await"&&!this.awaitIdentPos)this.awaitIdentPos=Gt;if(te)O.value=this.parseMaybeDefault(Gt,Wt,this.copyNode(O.key));else if(this.type===Yt.eq&&Ht){if(Ht.shorthandAssign<0)Ht.shorthandAssign=this.start;O.value=this.parseMaybeDefault(Gt,Wt,this.copyNode(O.key))}else O.value=this.copyNode(O.key);O.kind="init",O.shorthand=!0}else this.unexpected()};on.parsePropertyName=function(O){if(this.options.ecmaVersion>=6)if(this.eat(Yt.bracketL))return O.computed=!0,O.key=this.parseMaybeAssign(),this.expect(Yt.bracketR),O.key;else O.computed=!1;return O.key=this.type===Yt.num||this.type===Yt.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never")};on.initFunction=function(O){if(O.id=null,this.options.ecmaVersion>=6)O.generator=O.expression=!1;if(this.options.ecmaVersion>=8)O.async=!1};on.parseMethod=function(O,te,ve){var Je=this.startNode(),Gt=this.yieldPos,Wt=this.awaitPos,Ht=this.awaitIdentPos;if(this.initFunction(Je),this.options.ecmaVersion>=6)Je.generator=O;if(this.options.ecmaVersion>=8)Je.async=!!te;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(Yi(te,Je.generator)|Xs|(ve?zo:0)),this.expect(Yt.parenL),Je.params=this.parseBindingList(Yt.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(Je,!1,!0,!1),this.yieldPos=Gt,this.awaitPos=Wt,this.awaitIdentPos=Ht,this.finishNode(Je,"FunctionExpression")};on.parseArrowExpression=function(O,te,ve,Je){var Gt=this.yieldPos,Wt=this.awaitPos,Ht=this.awaitIdentPos;if(this.enterScope(Yi(ve,!1)|Ji),this.initFunction(O),this.options.ecmaVersion>=8)O.async=!!ve;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,O.params=this.toAssignableList(te,!0),this.parseFunctionBody(O,!0,!1,Je),this.yieldPos=Gt,this.awaitPos=Wt,this.awaitIdentPos=Ht,this.finishNode(O,"ArrowFunctionExpression")};on.parseFunctionBody=function(O,te,ve,Je){var Gt=te&&this.type!==Yt.braceL,Wt=this.strict,Ht=!1;if(Gt)O.body=this.parseMaybeAssign(Je),O.expression=!0,this.checkParams(O,!1);else{var Ft=this.options.ecmaVersion>=7&&!this.isSimpleParamList(O.params);if(!Wt||Ft){if(Ht=this.strictDirective(this.end),Ht&&Ft)this.raiseRecoverable(O.start,"Illegal 'use strict' directive in function with non-simple parameter list")}var Kt=this.labels;if(this.labels=[],Ht)this.strict=!0;if(this.checkParams(O,!Wt&&!Ht&&!te&&!ve&&this.isSimpleParamList(O.params)),this.strict&&O.id)this.checkLValSimple(O.id,Qo);O.body=this.parseBlock(!1,void 0,Ht&&!Wt),O.expression=!1,this.adaptDirectivePrologue(O.body.body),this.labels=Kt}this.exitScope()};on.isSimpleParamList=function(O){for(var te=0,ve=O;te<ve.length;te+=1){var Je=ve[te];if(Je.type!=="Identifier")return!1}return!0};on.checkParams=function(O,te){var ve=Object.create(null);for(var Je=0,Gt=O.params;Je<Gt.length;Je+=1){var Wt=Gt[Je];this.checkLValInnerPattern(Wt,Qi,te?null:ve)}};on.parseExprList=function(O,te,ve,Je){var Gt=[],Wt=!0;while(!this.eat(O)){if(!Wt){if(this.expect(Yt.comma),te&&this.afterTrailingComma(O))break}else Wt=!1;var Ht=void 0;if(ve&&this.type===Yt.comma)Ht=null;else if(this.type===Yt.ellipsis){if(Ht=this.parseSpread(Je),Je&&this.type===Yt.comma&&Je.trailingComma<0)Je.trailingComma=this.start}else Ht=this.parseMaybeAssign(!1,Je);Gt.push(Ht)}return Gt};on.checkUnreserved=function(O){var{start:te,end:ve,name:Je}=O;if(this.inGenerator&&Je==="yield")this.raiseRecoverable(te,"Cannot use 'yield' as identifier inside a generator");if(this.inAsync&&Je==="await")this.raiseRecoverable(te,"Cannot use 'await' as identifier inside an async function");if(!(this.currentThisScope().flags&Js)&&Je==="arguments")this.raiseRecoverable(te,"Cannot use 'arguments' in class field initializer");if(this.inClassStaticBlock&&(Je==="arguments"||Je==="await"))this.raise(te,"Cannot use "+Je+" in class static initialization block");if(this.keywords.test(Je))this.raise(te,"Unexpected keyword '"+Je+"'");if(this.options.ecmaVersion<6&&this.input.slice(te,ve).indexOf("\\")!==-1)return;var Gt=this.strict?this.reservedWordsStrict:this.reservedWords;if(Gt.test(Je)){if(!this.inAsync&&Je==="await")this.raiseRecoverable(te,"Cannot use keyword 'await' outside an async function");this.raiseRecoverable(te,"The keyword '"+Je+"' is reserved")}};on.parseIdent=function(O){var te=this.parseIdentNode();if(this.next(!!O),this.finishNode(te,"Identifier"),!O){if(this.checkUnreserved(te),te.name==="await"&&!this.awaitIdentPos)this.awaitIdentPos=te.start}return te};on.parseIdentNode=function(){var O=this.startNode();if(this.type===Yt.name)O.name=this.value;else if(this.type.keyword){if(O.name=this.type.keyword,(O.name==="class"||O.name==="function")&&(this.lastTokEnd!==this.lastTokStart+1||this.input.charCodeAt(this.lastTokStart)!==46))this.context.pop();this.type=Yt.name}else this.unexpected();return O};on.parsePrivateIdent=function(){var O=this.startNode();if(this.type===Yt.privateId)O.name=this.value;else this.unexpected();if(this.next(),this.finishNode(O,"PrivateIdentifier"),this.options.checkPrivateFields)if(this.privateNameStack.length===0)this.raise(O.start,"Private field '#"+O.name+"' must be declared in an enclosing class");else this.privateNameStack[this.privateNameStack.length-1].used.push(O);return O};on.parseYield=function(O){if(!this.yieldPos)this.yieldPos=this.start;var te=this.startNode();if(this.next(),this.type===Yt.semi||this.canInsertSemicolon()||this.type!==Yt.star&&!this.type.startsExpr)te.delegate=!1,te.argument=null;else te.delegate=this.eat(Yt.star),te.argument=this.parseMaybeAssign(O);return this.finishNode(te,"YieldExpression")};on.parseAwait=function(O){if(!this.awaitPos)this.awaitPos=this.start;var te=this.startNode();return this.next(),te.argument=this.parseMaybeUnary(null,!0,!1,O),this.finishNode(te,"AwaitExpression")};var Hs=r.prototype;Hs.raise=function(O,te){var ve=Ko(this.input,O);if(te+=" ("+ve.line+":"+ve.column+")",this.sourceFile)te+=" in "+this.sourceFile;var Je=SyntaxError(te);throw Je.pos=O,Je.loc=ve,Je.raisedAt=this.pos,Je};Hs.raiseRecoverable=Hs.raise;Hs.curPosition=function(){if(this.options.locations)return new ws(this.curLine,this.pos-this.lineStart)};var Kn=r.prototype,xl=function(O){this.flags=O,this.var=[],this.lexical=[],this.functions=[]};Kn.enterScope=function(O){this.scopeStack.push(new xl(O))};Kn.exitScope=function(){this.scopeStack.pop()};Kn.treatFunctionsAsVarInScope=function(O){return O.flags&ts||!this.inModule&&O.flags&es};Kn.declareName=function(O,te,ve){var Je=!1;if(te===Vn){var Gt=this.currentScope();if(Je=Gt.lexical.indexOf(O)>-1||Gt.functions.indexOf(O)>-1||Gt.var.indexOf(O)>-1,Gt.lexical.push(O),this.inModule&&Gt.flags&es)delete this.undefinedExports[O]}else if(te===Yo){var Wt=this.currentScope();Wt.lexical.push(O)}else if(te===Jo){var Ht=this.currentScope();if(this.treatFunctionsAsVar)Je=Ht.lexical.indexOf(O)>-1;else Je=Ht.lexical.indexOf(O)>-1||Ht.var.indexOf(O)>-1;Ht.functions.push(O)}else for(var Ft=this.scopeStack.length-1;Ft>=0;--Ft){var Kt=this.scopeStack[Ft];if(Kt.lexical.indexOf(O)>-1&&!(Kt.flags&qo&&Kt.lexical[0]===O)||!this.treatFunctionsAsVarInScope(Kt)&&Kt.functions.indexOf(O)>-1){Je=!0;break}if(Kt.var.push(O),this.inModule&&Kt.flags&es)delete this.undefinedExports[O];if(Kt.flags&Js)break}if(Je)this.raiseRecoverable(ve,"Identifier '"+O+"' has already been declared")};Kn.checkLocalExport=function(O){if(this.scopeStack[0].lexical.indexOf(O.name)===-1&&this.scopeStack[0].var.indexOf(O.name)===-1)this.undefinedExports[O.name]=O};Kn.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]};Kn.currentVarScope=function(){for(var O=this.scopeStack.length-1;;O--){var te=this.scopeStack[O];if(te.flags&(Js|ks|ns))return te}};Kn.currentThisScope=function(){for(var O=this.scopeStack.length-1;;O--){var te=this.scopeStack[O];if(te.flags&(Js|ks|ns)&&!(te.flags&Ji))return te}};var Qs=function(O,te,ve){if(this.type="",this.start=te,this.end=0,O.options.locations)this.loc=new zs(O,ve);if(O.options.directSourceFile)this.sourceFile=O.options.directSourceFile;if(O.options.ranges)this.range=[te,0]},Ps=r.prototype;Ps.startNode=function(){return new Qs(this,this.start,this.startLoc)};Ps.startNodeAt=function(O,te){return new Qs(this,O,te)};function ta(O,te,ve,Je){if(O.type=te,O.end=ve,this.options.locations)O.loc.end=Je;if(this.options.ranges)O.range[1]=ve;return O}Ps.finishNode=function(O,te){return ta.call(this,O,te,this.lastTokEnd,this.lastTokEndLoc)};Ps.finishNodeAt=function(O,te,ve,Je){return ta.call(this,O,te,ve,Je)};Ps.copyNode=function(O){var te=new Qs(this,O.start,this.startLoc);for(var ve in O)te[ve]=O[ve];return te};var na=function(){};na.prototype.reset=function(){};r.prototype.validateRegExpFlags=function(){};r.prototype.validateRegExpPattern=function(){};var er=function(O){if(this.type=O.type,this.value=O.value,this.start=O.start,this.end=O.end,O.options.locations)this.loc=new zs(O,O.startLoc,O.endLoc);if(O.options.ranges)this.range=[O.start,O.end]},pn=r.prototype;pn.next=function(O){if(!O&&this.type.keyword&&this.containsEsc)this.raiseRecoverable(this.start,"Escape sequence in keyword "+this.type.keyword);if(this.options.onToken)this.options.onToken(new er(this));this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()};pn.getToken=function(){return this.next(),new er(this)};if(typeof Symbol<"u")pn[Symbol.iterator]=function(){var O=this;return{next:function(){var te=O.getToken();return{done:te.type===Yt.eof,value:te}}}};pn.nextToken=function(){var O=this.curContext();if(!O||!O.preserveSpace)this.skipSpace();if(this.start=this.pos,this.options.locations)this.startLoc=this.curPosition();if(this.pos>=this.input.length)return this.finishToken(Yt.eof);if(O.override)return O.override(this);else this.readToken(this.fullCharCodeAtPos())};pn.readToken=function(O){if(h(O,this.options.ecmaVersion>=6)||O===92)return this.readWord();return this.getTokenFromCode(O)};pn.fullCharCodeAt=function(O){var te=this.input.charCodeAt(O);if(te<=55295||te>=56320)return te;var ve=this.input.charCodeAt(O+1);return ve<=56319||ve>=57344?te:(te<<10)+ve-56613888};pn.fullCharCodeAtPos=function(){return this.fullCharCodeAt(this.pos)};pn.skipBlockComment=function(){var O=this.options.onComment&&this.curPosition(),te=this.pos,ve=this.input.indexOf("*/",this.pos+=2);if(ve===-1)this.raise(this.pos-2,"Unterminated comment");if(this.pos=ve+2,this.options.locations)for(var Je=void 0,Gt=te;(Je=Wo(this.input,Gt,this.pos))>-1;)++this.curLine,Gt=this.lineStart=Je;if(this.options.onComment)this.options.onComment(!0,this.input.slice(te+2,ve),te,this.pos,O,this.curPosition())};pn.skipLineComment=function(O){var te=this.pos,ve=this.options.onComment&&this.curPosition(),Je=this.input.charCodeAt(this.pos+=O);while(this.pos<this.input.length&&!ds(Je))Je=this.input.charCodeAt(++this.pos);if(this.options.onComment)this.options.onComment(!1,this.input.slice(te+O,this.pos),te,this.pos,ve,this.curPosition())};pn.skipSpace=function(){e:while(this.pos<this.input.length){var O=this.input.charCodeAt(this.pos);switch(O){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(O>8&&O<14||O>=5760&&Uo.test(String.fromCharCode(O)))++this.pos;else break e}}};pn.finishToken=function(O,te){if(this.end=this.pos,this.options.locations)this.endLoc=this.curPosition();var ve=this.type;this.type=O,this.value=te,this.updateContext(ve)};pn.readToken_dot=function(){var O=this.input.charCodeAt(this.pos+1);if(O>=48&&O<=57)return this.readNumber(!0);var te=this.input.charCodeAt(this.pos+2);if(this.options.ecmaVersion>=6&&O===46&&te===46)return this.pos+=3,this.finishToken(Yt.ellipsis);else return++this.pos,this.finishToken(Yt.dot)};pn.readToken_slash=function(){var O=this.input.charCodeAt(this.pos+1);if(this.exprAllowed)return++this.pos,this.readRegexp();if(O===61)return this.finishOp(Yt.assign,2);return this.finishOp(Yt.slash,1)};pn.readToken_mult_modulo_exp=function(O){var te=this.input.charCodeAt(this.pos+1),ve=1,Je=O===42?Yt.star:Yt.modulo;if(this.options.ecmaVersion>=7&&O===42&&te===42)++ve,Je=Yt.starstar,te=this.input.charCodeAt(this.pos+2);if(te===61)return this.finishOp(Yt.assign,ve+1);return this.finishOp(Je,ve)};pn.readToken_pipe_amp=function(O){var te=this.input.charCodeAt(this.pos+1);if(te===O){if(this.options.ecmaVersion>=12){var ve=this.input.charCodeAt(this.pos+2);if(ve===61)return this.finishOp(Yt.assign,3)}return this.finishOp(O===124?Yt.logicalOR:Yt.logicalAND,2)}if(te===61)return this.finishOp(Yt.assign,2);return this.finishOp(O===124?Yt.bitwiseOR:Yt.bitwiseAND,1)};pn.readToken_caret=function(){var O=this.input.charCodeAt(this.pos+1);if(O===61)return this.finishOp(Yt.assign,2);return this.finishOp(Yt.bitwiseXOR,1)};pn.readToken_plus_min=function(O){var te=this.input.charCodeAt(this.pos+1);if(te===O){if(te===45&&!this.inModule&&this.input.charCodeAt(this.pos+2)===62&&(this.lastTokEnd===0||Cn.test(this.input.slice(this.lastTokEnd,this.pos))))return this.skipLineComment(3),this.skipSpace(),this.nextToken();return this.finishOp(Yt.incDec,2)}if(te===61)return this.finishOp(Yt.assign,2);return this.finishOp(Yt.plusMin,1)};pn.readToken_lt_gt=function(O){var te=this.input.charCodeAt(this.pos+1),ve=1;if(te===O){if(ve=O===62&&this.input.charCodeAt(this.pos+2)===62?3:2,this.input.charCodeAt(this.pos+ve)===61)return this.finishOp(Yt.assign,ve+1);return this.finishOp(Yt.bitShift,ve)}if(te===33&&O===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(te===61)ve=2;return this.finishOp(Yt.relational,ve)};pn.readToken_eq_excl=function(O){var te=this.input.charCodeAt(this.pos+1);if(te===61)return this.finishOp(Yt.equality,this.input.charCodeAt(this.pos+2)===61?3:2);if(O===61&&te===62&&this.options.ecmaVersion>=6)return this.pos+=2,this.finishToken(Yt.arrow);return this.finishOp(O===61?Yt.eq:Yt.prefix,1)};pn.readToken_question=function(){var O=this.options.ecmaVersion;if(O>=11){var te=this.input.charCodeAt(this.pos+1);if(te===46){var ve=this.input.charCodeAt(this.pos+2);if(ve<48||ve>57)return this.finishOp(Yt.questionDot,2)}if(te===63){if(O>=12){var Je=this.input.charCodeAt(this.pos+2);if(Je===61)return this.finishOp(Yt.assign,3)}return this.finishOp(Yt.coalesce,2)}}return this.finishOp(Yt.question,1)};pn.readToken_numberSign=function(){var O=this.options.ecmaVersion,te=35;if(O>=13){if(++this.pos,te=this.fullCharCodeAtPos(),h(te,!0)||te===92)return this.finishToken(Yt.privateId,this.readWord1())}this.raise(this.pos,"Unexpected character '"+qs(te)+"'")};pn.getTokenFromCode=function(O){switch(O){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(Yt.parenL);case 41:return++this.pos,this.finishToken(Yt.parenR);case 59:return++this.pos,this.finishToken(Yt.semi);case 44:return++this.pos,this.finishToken(Yt.comma);case 91:return++this.pos,this.finishToken(Yt.bracketL);case 93:return++this.pos,this.finishToken(Yt.bracketR);case 123:return++this.pos,this.finishToken(Yt.braceL);case 125:return++this.pos,this.finishToken(Yt.braceR);case 58:return++this.pos,this.finishToken(Yt.colon);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(Yt.backQuote);case 48:var te=this.input.charCodeAt(this.pos+1);if(te===120||te===88)return this.readRadixNumber(16);if(this.options.ecmaVersion>=6){if(te===111||te===79)return this.readRadixNumber(8);if(te===98||te===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(O);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo_exp(O);case 124:case 38:return this.readToken_pipe_amp(O);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(O);case 60:case 62:return this.readToken_lt_gt(O);case 61:case 33:return this.readToken_eq_excl(O);case 63:return this.readToken_question();case 126:return this.finishOp(Yt.prefix,1);case 35:return this.readToken_numberSign()}this.raise(this.pos,"Unexpected character '"+qs(O)+"'")};pn.finishOp=function(O,te){var ve=this.input.slice(this.pos,this.pos+te);return this.pos+=te,this.finishToken(O,ve)};pn.readRegexp=function(){var O,te,ve=this.pos;for(;;){if(this.pos>=this.input.length)this.raise(ve,"Unterminated regular expression");var Je=this.input.charAt(this.pos);if(Cn.test(Je))this.raise(ve,"Unterminated regular expression");if(!O){if(Je==="[")te=!0;else if(Je==="]"&&te)te=!1;else if(Je==="/"&&!te)break;O=Je==="\\"}else O=!1;++this.pos}var Gt=this.input.slice(ve,this.pos);++this.pos;var Wt=this.pos,Ht=this.readWord1();if(this.containsEsc)this.unexpected(Wt);var Ft=this.regexpState||(this.regexpState=new na(this));Ft.reset(ve,Gt,Ht),this.validateRegExpFlags(Ft),this.validateRegExpPattern(Ft);var Kt=null;try{Kt=new RegExp(Gt,Ht)}catch(zt){}return this.finishToken(Yt.regexp,{pattern:Gt,flags:Ht,value:Kt})};pn.readInt=function(O,te,ve){var Je=this.options.ecmaVersion>=12&&te===void 0,Gt=ve&&this.input.charCodeAt(this.pos)===48,Wt=this.pos,Ht=0,Ft=0;for(var Kt=0,zt=te==null?1/0:te;Kt<zt;++Kt,++this.pos){var Xt=this.input.charCodeAt(this.pos),Zt=void 0;if(Je&&Xt===95){if(Gt)this.raiseRecoverable(this.pos,"Numeric separator is not allowed in legacy octal numeric literals");if(Ft===95)this.raiseRecoverable(this.pos,"Numeric separator must be exactly one underscore");if(Kt===0)this.raiseRecoverable(this.pos,"Numeric separator is not allowed at the first of digits");Ft=Xt;continue}if(Xt>=97)Zt=Xt-97+10;else if(Xt>=65)Zt=Xt-65+10;else if(Xt>=48&&Xt<=57)Zt=Xt-48;else Zt=1/0;if(Zt>=O)break;Ft=Xt,Ht=Ht*O+Zt}if(Je&&Ft===95)this.raiseRecoverable(this.pos-1,"Numeric separator is not allowed at the last of digits");if(this.pos===Wt||te!=null&&this.pos-Wt!==te)return null;return Ht};function vl(O,te){if(te)return parseInt(O,8);return parseFloat(O.replace(/_/g,""))}function sa(O){if(typeof BigInt!=="function")return null;return BigInt(O.replace(/_/g,""))}pn.readRadixNumber=function(O){var te=this.pos;this.pos+=2;var ve=this.readInt(O);if(ve==null)this.raise(this.start+2,"Expected number in radix "+O);if(this.options.ecmaVersion>=11&&this.input.charCodeAt(this.pos)===110)ve=sa(this.input.slice(te,this.pos)),++this.pos;else if(h(this.fullCharCodeAtPos()))this.raise(this.pos,"Identifier directly after number");return this.finishToken(Yt.num,ve)};pn.readNumber=function(O){var te=this.pos;if(!O&&this.readInt(10,void 0,!0)===null)this.raise(te,"Invalid number");var ve=this.pos-te>=2&&this.input.charCodeAt(te)===48;if(ve&&this.strict)this.raise(te,"Invalid number");var Je=this.input.charCodeAt(this.pos);if(!ve&&!O&&this.options.ecmaVersion>=11&&Je===110){var Gt=sa(this.input.slice(te,this.pos));if(++this.pos,h(this.fullCharCodeAtPos()))this.raise(this.pos,"Identifier directly after number");return this.finishToken(Yt.num,Gt)}if(ve&&/[89]/.test(this.input.slice(te,this.pos)))ve=!1;if(Je===46&&!ve)++this.pos,this.readInt(10),Je=this.input.charCodeAt(this.pos);if((Je===69||Je===101)&&!ve){if(Je=this.input.charCodeAt(++this.pos),Je===43||Je===45)++this.pos;if(this.readInt(10)===null)this.raise(te,"Invalid number")}if(h(this.fullCharCodeAtPos()))this.raise(this.pos,"Identifier directly after number");var Wt=vl(this.input.slice(te,this.pos),ve);return this.finishToken(Yt.num,Wt)};pn.readCodePoint=function(){var O=this.input.charCodeAt(this.pos),te;if(O===123){if(this.options.ecmaVersion<6)this.unexpected();var ve=++this.pos;if(te=this.readHexChar(this.input.indexOf("}",this.pos)-this.pos),++this.pos,te>1114111)this.invalidStringToken(ve,"Code point out of bounds")}else te=this.readHexChar(4);return te};pn.readString=function(O){var te="",ve=++this.pos;for(;;){if(this.pos>=this.input.length)this.raise(this.start,"Unterminated string constant");var Je=this.input.charCodeAt(this.pos);if(Je===O)break;if(Je===92)te+=this.input.slice(ve,this.pos),te+=this.readEscapedChar(!1),ve=this.pos;else if(Je===8232||Je===8233){if(this.options.ecmaVersion<10)this.raise(this.start,"Unterminated string constant");if(++this.pos,this.options.locations)this.curLine++,this.lineStart=this.pos}else{if(ds(Je))this.raise(this.start,"Unterminated string constant");++this.pos}}return te+=this.input.slice(ve,this.pos++),this.finishToken(Yt.string,te)};var ia={};pn.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(O){if(O===ia)this.readInvalidTemplateToken();else throw O}this.inTemplateElement=!1};pn.invalidStringToken=function(O,te){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw ia;else this.raise(O,te)};pn.readTmplToken=function(){var O="",te=this.pos;for(;;){if(this.pos>=this.input.length)this.raise(this.start,"Unterminated template");var ve=this.input.charCodeAt(this.pos);if(ve===96||ve===36&&this.input.charCodeAt(this.pos+1)===123){if(this.pos===this.start&&(this.type===Yt.template||this.type===Yt.invalidTemplate))if(ve===36)return this.pos+=2,this.finishToken(Yt.dollarBraceL);else return++this.pos,this.finishToken(Yt.backQuote);return O+=this.input.slice(te,this.pos),this.finishToken(Yt.template,O)}if(ve===92)O+=this.input.slice(te,this.pos),O+=this.readEscapedChar(!0),te=this.pos;else if(ds(ve)){switch(O+=this.input.slice(te,this.pos),++this.pos,ve){case 13:if(this.input.charCodeAt(this.pos)===10)++this.pos;case 10:O+=`
|
|
17
|
-
`;break;default:O+=String.fromCharCode(ve);break}if(this.options.locations)++this.curLine,this.lineStart=this.pos;te=this.pos}else++this.pos}};pn.readInvalidTemplateToken=function(){for(;this.pos<this.input.length;this.pos++)switch(this.input[this.pos]){case"\\":++this.pos;break;case"$":if(this.input[this.pos+1]!=="{")break;case"`":return this.finishToken(Yt.invalidTemplate,this.input.slice(this.start,this.pos));case"\r":if(this.input[this.pos+1]===`
|
|
18
|
-
`)++this.pos;case`
|
|
19
|
-
`:case"\u2028":case"\u2029":++this.curLine,this.lineStart=this.pos+1;break}this.raise(this.start,"Unterminated template")};pn.readEscapedChar=function(O){var te=this.input.charCodeAt(++this.pos);switch(++this.pos,te){case 110:return`
|
|
20
|
-
`;case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return qs(this.readCodePoint());case 116:return"\t";case 98:return"\b";case 118:return"\v";case 102:return"\f";case 13:if(this.input.charCodeAt(this.pos)===10)++this.pos;case 10:if(this.options.locations)this.lineStart=this.pos,++this.curLine;return"";case 56:case 57:if(this.strict)this.invalidStringToken(this.pos-1,"Invalid escape sequence");if(O){var ve=this.pos-1;this.invalidStringToken(ve,"Invalid escape sequence in template string")}default:if(te>=48&&te<=55){var Je=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],Gt=parseInt(Je,8);if(Gt>255)Je=Je.slice(0,-1),Gt=parseInt(Je,8);if(this.pos+=Je.length-1,te=this.input.charCodeAt(this.pos),(Je!=="0"||te===56||te===57)&&(this.strict||O))this.invalidStringToken(this.pos-1-Je.length,O?"Octal literal in template string":"Octal literal in strict mode");return String.fromCharCode(Gt)}if(ds(te)){if(this.options.locations)this.lineStart=this.pos,++this.curLine;return""}return String.fromCharCode(te)}};pn.readHexChar=function(O){var te=this.pos,ve=this.readInt(16,O);if(ve===null)this.invalidStringToken(te,"Bad character escape sequence");return ve};pn.readWord1=function(){this.containsEsc=!1;var O="",te=!0,ve=this.pos,Je=this.options.ecmaVersion>=6;while(this.pos<this.input.length){var Gt=this.fullCharCodeAtPos();if(k(Gt,Je))this.pos+=Gt<=65535?1:2;else if(Gt===92){this.containsEsc=!0,O+=this.input.slice(ve,this.pos);var Wt=this.pos;if(this.input.charCodeAt(++this.pos)!==117)this.invalidStringToken(this.pos,"Expecting Unicode escape sequence \\uXXXX");++this.pos;var Ht=this.readCodePoint();if(!(te?h:k)(Ht,Je))this.invalidStringToken(Wt,"Invalid Unicode escape");O+=qs(Ht),ve=this.pos}else break;te=!1}return O+this.input.slice(ve,this.pos)};pn.readWord=function(){var O=this.readWord1(),te=Yt.name;if(this.keywords.test(O))te=zi[O];return this.finishToken(te,O)};var El="8.18.0";r.acorn={Parser:r,version:El,defaultOptions:Ki,Position:ws,SourceLocation:zs,getLineInfo:Ko,Node:Qs,TokenType:ln,tokTypes:Yt,keywordTypes:zi,TokContext:Dn,tokContexts:hn,isIdentifierChar:k,isIdentifierStart:h,Token:er,isNewLine:ds,lineBreak:Cn,lineBreakG:ol,nonASCIIwhitespace:Uo};function $s(O){return(te)=>O(te)}function Zs(...O){return r.extend(...O)}function As(O,te,ve){for(let Je=te;Je<ve;Je++){let Gt=O.charCodeAt(Je);if(Gt===10||Gt===13||Gt===8232||Gt===8233)return!0}return!1}var Vo=new WeakMap;function wn(O,te){if(O===void 0)return!1;if(O.length<16)return O.includes(te);let ve=Vo.get(O);if(ve===void 0||ve.length>O.length)ve={names:new Set,length:0},Vo.set(O,ve);while(ve.length<O.length)ve.names.add(O[ve.length++]);return ve.names.has(te)}var tr=/(?:\s|\/\/.*|\/\*[\s\S]*?\*\/)*/g,Sl=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"]]),bl=new Set("public private protected readonly declare abstract override static accessor".split(" ")),Cl=new Set("public private protected readonly override".split(" ")),wl=new Set("var let const function class abstract enum interface type namespace module global".split(" ")),Tl=new Set("var let const function class interface enum".split(" ")),ra=new Set(["TSAsExpression","TSSatisfiesExpression","TSNonNullExpression","TSTypeAssertion"]),oa=1,kl=32,Pl=256,$l=0,Al=1,Ds=2,Dl=3,Nl=4,nr=6,aa=7,da=256,or=1024,_l=8|or,Rl=Ds|da,pa=1,Il=2,ca=40,Ll=41,Ol=44,la=46,ua=58,ei=61,ha=60,ti=123,Ml=91,sr=42,Fl=35,ir=34,rr=39,jl=SyntaxError("speculative parse failed"),de=$s((O)=>{let{tokTypes:te,keywordTypes:ve,isIdentifierChar:Je,isIdentifierStart:Gt}=O.acorn,Wt=new O.acorn.TokenType("@");class Ht extends O{inType=!1;$4=!1;$5=!1;$7=null;$k=null;$l=!1;$m=!1;$f=null;$9=[[]];$n=0;$t=0;$o=-1;constructor(Ft,Kt,zt){super(Ft,Kt,zt);let Xt=this.options.onComment;if(typeof Xt==="function")this.options.onComment=(Zt,Qt,en,tn,sn,nn)=>{if(en<this.$t)return;this.$t=tn,Xt.call(this,Zt,Qt,en,tn,sn,nn)}}reset(){this.inType=!1,this.$4=!1,this.$5=!1,this.$7=null,this.$k=null,this.$l=!1,this.$m=!1,this.$f=null,this.$9=[[]],this.$n=0,this.$t=0,this.$o=-1}getTokenFromCode(Ft){if(Ft===64)return++this.pos,this.finishToken(Wt);return super.getTokenFromCode(Ft)}readToken_lt_gt(Ft){if(this.inType)return this.finishOp(te.relational,1);return super.readToken_lt_gt(Ft)}$a(Ft){let Kt=this.inType;this.inType=!0;let zt=Ft();if(this.inType=Kt,!Kt&&this.type===te.relational)this.pos=this.start,this.nextToken();return zt}$1(){return this.type===te.relational&&this.value==="<"}$p(){if(this.type===te.bitShift&&this.value==="<<")this.pos=this.start+1,this.finishToken(te.relational,"<");return this.$1()}$c(){return this.type===te.relational&&this.value===">"}$u(){return this.type===te.prefix&&this.value==="!"}hasPrecedingLineBreak(){return As(this.input,this.lastTokEnd,this.start)}$d(Ft=this.pos){return tr.lastIndex=Ft,tr.exec(this.input),tr.lastIndex}$2(){return this.input.charCodeAt(this.$d())}$3(){let Ft=this.$d(),Kt=Ft;while(Kt<this.input.length&&Je(this.input.charCodeAt(Kt)))Kt++;return this.input.slice(Ft,Kt)}$b(){return!As(this.input,this.pos,this.$d())}$14(){return this.$b()&&Gt(this.$2())&&!Object.hasOwn(ve,this.$3())}$15(){return{pos:this.pos,type:this.type,value:this.value,start:this.start,end:this.end,startLoc:this.startLoc,endLoc:this.endLoc,lastTokStart:this.lastTokStart,lastTokEnd:this.lastTokEnd,lastTokStartLoc:this.lastTokStartLoc,lastTokEndLoc:this.lastTokEndLoc,curLine:this.curLine,lineStart:this.lineStart,context:this.context.slice(),exprAllowed:this.exprAllowed,containsEsc:this.containsEsc,inType:this.inType,$4:this.$4,$5:this.$5,$7:this.$7,scopes:this.scopeStack.length,privateNames:this.privateNameStack.length,labels:this.labels,labelCount:this.labels.length,strict:this.strict,yieldPos:this.yieldPos,awaitPos:this.awaitPos,awaitIdentPos:this.awaitIdentPos,potentialArrowAt:this.potentialArrowAt,potentialArrowInForAwait:this.potentialArrowInForAwait}}$16(Ft){this.pos=Ft.pos,this.type=Ft.type,this.value=Ft.value,this.start=Ft.start,this.end=Ft.end,this.startLoc=Ft.startLoc,this.endLoc=Ft.endLoc,this.lastTokStart=Ft.lastTokStart,this.lastTokEnd=Ft.lastTokEnd,this.lastTokStartLoc=Ft.lastTokStartLoc,this.lastTokEndLoc=Ft.lastTokEndLoc,this.curLine=Ft.curLine,this.lineStart=Ft.lineStart,this.context=Ft.context,this.exprAllowed=Ft.exprAllowed,this.containsEsc=Ft.containsEsc,this.inType=Ft.inType,this.$4=Ft.$4,this.$5=Ft.$5,this.$7=Ft.$7,this.scopeStack.length=Ft.scopes,this.privateNameStack.length=Ft.privateNames,this.labels=Ft.labels,this.labels.length=Ft.labelCount,this.strict=Ft.strict,this.yieldPos=Ft.yieldPos,this.awaitPos=Ft.awaitPos,this.awaitIdentPos=Ft.awaitIdentPos,this.potentialArrowAt=Ft.potentialArrowAt,this.potentialArrowInForAwait=Ft.potentialArrowInForAwait}raise(Ft,Kt){if(this.$n>0)throw jl;return super.raise(Ft,Kt)}$1y(Ft,Kt){try{super.raise(Ft,Kt)}catch(zt){if(zt instanceof SyntaxError)zt.$1z=!0;throw zt}throw Error("unreachable")}$g(Ft,Kt=!1){let zt=this.$15();this.$n++;try{let Xt=Ft();if(Kt||Xt===void 0)this.$16(zt);return Xt}catch(Xt){if(!(Xt instanceof SyntaxError)||!Kt&&Xt.$1z)throw Xt;this.$16(zt);return}finally{this.$n--}}$v(Ft){return this.$g(Ft,!0)===!0}$17(Ft){if(Ft.end=this.lastTokEnd,this.options.locations)Ft.loc.end=this.lastTokEndLoc}$q(Ft,Kt){if(Ft.start=Kt.start,this.options.locations)Ft.loc.start=Kt.loc.start}$6(Ft=!1){let Kt=this.startNode();return Kt.typeAnnotation=this.$a(()=>(this.next(),Ft?this.$20():this.$0())),this.finishNode(Kt,"TSTypeAnnotation")}$h(Ft,Kt){if(Kt&&this.eat(te.question))Ft.optional=!0,this.$17(Ft);if(this.type===te.colon)Ft.typeAnnotation=this.$6(),this.$17(Ft);return Ft}$20(){if(this.type!==te.name&&this.type!==te._this)return this.$0();if(this.isContextual("asserts")&&this.$b()&&Gt(this.$2())){let Ft=this.startNode();if(this.next(),Ft.parameterName=this.type===te._this?this.$w():this.parseIdent(),this.isContextual("is")&&!this.hasPrecedingLineBreak())return this.$x(Ft,!0);return Ft.asserts=!0,Ft.typeAnnotation=null,this.finishNode(Ft,"TSTypePredicate")}if(this.$3()==="is"&&this.$b()){let Ft=this.startNode();return Ft.parameterName=this.type===te._this?this.$w():this.parseIdent(!0),this.$x(Ft,!1)}return this.$0()}$x(Ft,Kt){this.next();let zt=this.startNode();return zt.typeAnnotation=this.$0(),Ft.typeAnnotation=this.finishNode(zt,"TSTypeAnnotation"),Ft.asserts=Kt,this.finishNode(Ft,"TSTypePredicate")}$w(){let Ft=this.startNode();return this.next(),this.finishNode(Ft,"TSThisType")}parseWholeType(){this.inType=!0,this.nextToken();let Ft=this.$0();if(this.type!==te.eof)this.unexpected();return Ft}$0(){let Ft=this.$18();if(this.$4||this.type!==te._extends||this.hasPrecedingLineBreak())return Ft;let Kt=this.startNodeAt(Ft.start,Ft.loc?.start);return this.next(),Kt.checkType=Ft,Kt.extendsType=this.$i(!0,()=>this.$18()),this.expect(te.question),Kt.trueType=this.$i(!1,()=>this.$0()),this.expect(te.colon),Kt.falseType=this.$i(!1,()=>this.$0()),this.finishNode(Kt,"TSConditionalType")}$i(Ft,Kt){let zt=this.$4;this.$4=Ft;let Xt=Kt();return this.$4=zt,Xt}$18(){if(this.$21())return this.$19("TSFunctionType");if(this.type===te._new||this.isContextual("abstract")&&this.$3()==="new")return this.$19("TSConstructorType");return this.$1a("TSUnionType",te.bitwiseOR,()=>this.$1a("TSIntersectionType",te.bitwiseAND,()=>this.$1b()))}$19(Ft){let Kt=this.startNode();if(Ft==="TSConstructorType"){if(Kt.abstract=this.isContextual("abstract"),Kt.abstract)this.next();this.next()}return this.$i(!1,()=>this.$r(Kt,te.arrow)),this.finishNode(Kt,Ft)}$r(Ft,Kt){if(this.$1())Ft.typeParameters=this.$8();if(this.expect(te.parenL),Ft.parameters=this.parseBindingList(te.parenR,!1,!0),this.type===Kt)Ft.typeAnnotation=this.$6(!0);else if(Kt===te.arrow)this.unexpected()}$21(){if(this.$1())return!0;if(this.type!==te.parenL)return!1;return this.$v(()=>{if(this.next(),this.type===te.parenR||this.type===te.ellipsis)return!0;if(this.type===te.name||this.type===te._this)this.next();else if(this.type===te.braceL||this.type===te.bracketL)this.parseBindingAtom();else return!1;let Ft=this.type;if(Ft===te.colon||Ft===te.comma||Ft===te.question||Ft===te.eq)return!0;if(Ft!==te.parenR)return!1;return this.next(),this.type===te.arrow})}$1a(Ft,Kt,zt){let Xt=this.startNode(),Zt=this.eat(Kt),Qt=[];do Qt.push(zt());while(this.eat(Kt));if(Qt.length===1&&!Zt)return Qt[0];return Xt.types=Qt,this.finishNode(Xt,Ft)}$1b(){if(this.type===te.name&&!this.containsEsc){let Ft=this.value;if(Ft==="keyof"||Ft==="unique"||Ft==="readonly"){let Kt=this.startNode();return this.next(),Kt.operator=Ft,Kt.typeAnnotation=this.$1b(),this.finishNode(Kt,"TSTypeOperator")}if(Ft==="infer"){let Kt=this.startNode();this.next();let zt=this.startNode();zt.name=this.$y();let Xt=this.$g(()=>this.$22());if(Xt)zt.constraint=Xt;return Kt.typeParameter=this.finishNode(zt,"TSTypeParameter"),this.finishNode(Kt,"TSInferType")}}return this.$i(!1,()=>this.$23())}$22(){if(!this.eat(te._extends))return;let Ft=this.$i(!0,()=>this.$0());return this.$4||this.type!==te.question?Ft:void 0}$y(){if(this.type!==te.name&&!this.type.keyword)this.unexpected();let Ft=this.type===te.name?this.value:this.type.keyword;return this.next(),Ft}$23(){let Ft=this.$24();while(!this.hasPrecedingLineBreak()&&this.eat(te.bracketL)){let Kt=this.startNodeAt(Ft.start,Ft.loc?.start);if(this.eat(te.bracketR))Kt.elementType=Ft,Ft=this.finishNode(Kt,"TSArrayType");else Kt.objectType=Ft,Kt.indexType=this.$0(),this.expect(te.bracketR),Ft=this.finishNode(Kt,"TSIndexedAccessType")}return Ft}$24(){switch(this.type){case te.name:case te._void:case te._null:{let Ft=Sl.get(this.value);if(Ft&&(this.type!==te.name||!this.containsEsc&&this.$2()!==la)){let Kt=this.startNode();return this.next(),this.finishNode(Kt,Ft)}return this.$1c()}case te.string:case te.num:case te._true:case te._false:{let Ft=this.startNode();return Ft.literal=this.parseExprAtom(),this.finishNode(Ft,"TSLiteralType")}case te.plusMin:{if(this.value!=="-")break;let Ft=this.startNode(),Kt=this.startNode();if(this.next(),this.type!==te.num)this.unexpected();return Kt.operator="-",Kt.prefix=!0,Kt.argument=this.parseExprAtom(),Ft.literal=this.finishNode(Kt,"UnaryExpression"),this.finishNode(Ft,"TSLiteralType")}case te.backQuote:return this.$25();case te._this:{let Ft=this.$w();if(this.isContextual("is")&&!this.hasPrecedingLineBreak()){let Kt=this.startNodeAt(Ft.start,Ft.loc?.start);return Kt.parameterName=Ft,this.$x(Kt,!1)}return Ft}case te._typeof:return this.$26();case te._import:return this.$1d();case te.braceL:return this.$27()?this.$28():this.$29();case te.bracketL:return this.$2a();case te.parenL:{let Ft=this.startNode();return this.next(),Ft.typeAnnotation=this.$0(),this.expect(te.parenR),this.finishNode(Ft,"TSParenthesizedType")}default:if(this.type.keyword)return this.$1c()}return this.unexpected()}$1c(){let Ft=this.startNode();if(Ft.typeName=this.$j(),!this.hasPrecedingLineBreak()&&this.$1())Ft.typeArguments=this.$e();return this.finishNode(Ft,"TSTypeReference")}$j(){let Ft=this.parseIdent(!0);while(this.eat(te.dot)){let Kt=this.startNodeAt(Ft.start,Ft.loc?.start);Kt.left=Ft,Kt.right=this.parseIdent(!0),Ft=this.finishNode(Kt,"TSQualifiedName")}return Ft}$26(){let Ft=this.startNode();if(this.next(),Ft.exprName=this.type===te._import?this.$1d():this.$j(),!this.hasPrecedingLineBreak()&&this.$1())Ft.typeArguments=this.$e();return this.finishNode(Ft,"TSTypeQuery")}$1d(){let Ft=this.startNode();if(this.next(),Ft.argument=this.$1e(),this.eat(te.dot))Ft.qualifier=this.$j();if(this.$1())Ft.typeArguments=this.$e();return this.finishNode(Ft,"TSImportType")}$z(){if(this.type!==te.string)this.unexpected();return this.parseExprAtom()}$1e(){this.expect(te.parenL);let Ft=this.$z();return this.expect(te.parenR),Ft}$25(){let Ft=this.startNode(),Kt=this.startNode();this.next(),Kt.expressions=[];let zt=this.parseTemplateElement({isTagged:!1});Kt.quasis=[zt];while(!zt.tail){if(this.type===te.eof)this.raise(this.pos,"Unterminated template literal");this.expect(te.dollarBraceL),Kt.expressions.push(this.$0()),this.expect(te.braceR),zt=this.parseTemplateElement({isTagged:!1}),Kt.quasis.push(zt)}return this.next(),Ft.literal=this.finishNode(Kt,"TemplateLiteral"),this.finishNode(Ft,"TSLiteralType")}$27(){return this.$v(()=>{if(this.next(),this.type===te.plusMin)return this.next(),this.isContextual("readonly");if(this.isContextual("readonly"))this.next();if(this.type!==te.bracketL)return!1;if(this.next(),this.type!==te.name)return!1;return this.next(),this.type===te._in})}$28(){let Ft=this.startNode();if(this.expect(te.braceL),this.type===te.plusMin)Ft.readonly=this.value,this.next(),this.expectContextual("readonly");else if(this.eatContextual("readonly"))Ft.readonly=!0;this.expect(te.bracketL);let Kt=this.startNode();if(Kt.name=this.$y(),this.expect(te._in),Kt.constraint=this.$0(),Ft.typeParameter=this.finishNode(Kt,"TSTypeParameter"),Ft.nameType=this.eatContextual("as")?this.$0():null,this.expect(te.bracketR),this.type===te.plusMin)Ft.optional=this.value,this.next(),this.expect(te.question);else if(this.eat(te.question))Ft.optional=!0;if(this.eat(te.colon))Ft.typeAnnotation=this.$0();return this.semicolon(),this.expect(te.braceR),this.finishNode(Ft,"TSMappedType")}$29(){let Ft=this.startNode();return Ft.members=this.$1f(),this.finishNode(Ft,"TSTypeLiteral")}$1f(){this.expect(te.braceL);let Ft=[];while(!this.eat(te.braceR))Ft.push(this.$2b());return Ft}$2b(){let Ft=this.startNode(),Kt="TSPropertySignature",zt=this.type===te._new?this.$2():-1;if(this.type===te.parenL||this.$1())Kt="TSCallSignatureDeclaration",this.$r(Ft,te.colon);else if(zt===ca||zt===ha)Kt="TSConstructSignatureDeclaration",this.next(),this.$r(Ft,te.colon);else{let Xt=this.type===te._new?this.parseIdent(!0):null;if(this.isContextual("readonly")&&this.$s(!0))this.next(),Ft.readonly=!0;if(this.type===te.bracketL&&this.$1g())return this.$1h(Ft);let Zt="method";if(Xt)Ft.key=Xt;else{if((this.isContextual("get")||this.isContextual("set"))&&this.$s(!1))Zt=this.value,this.next();this.parsePropertyName(Ft)}if(this.eat(te.question))Ft.optional=!0;if(this.type===te.parenL||this.$1()){if(Kt="TSMethodSignature",Zt!=="method")Ft.kind=Zt;this.$r(Ft,te.colon),Ft.kind=Zt}else if(this.type===te.colon)Ft.typeAnnotation=this.$6()}return this.$1i(),this.finishNode(Ft,Kt)}$1i(){if(!this.eat(te.comma))this.semicolon()}$1g(){return this.$v(()=>{if(this.next(),this.type!==te.name)return!1;return this.next(),this.type===te.colon})}$1h(Ft){if(this.expect(te.bracketL),Ft.parameters=[this.$h(this.parseIdent(),!1)],this.expect(te.bracketR),this.type===te.colon)Ft.typeAnnotation=this.$6();return this.$1i(),this.finishNode(Ft,"TSIndexSignature")}$2a(){let Ft=this.startNode();this.expect(te.bracketL),Ft.elementTypes=[];while(!this.eat(te.bracketR))if(Ft.elementTypes.push(this.$2c()),this.type!==te.bracketR)this.expect(te.comma);return this.finishNode(Ft,"TSTupleType")}$2c(){let Ft=this.start,Kt=this.startLoc,zt=this.eat(te.ellipsis),Xt;if((this.type===te.name||this.type.keyword)&&this.$2d()){let Zt=this.startNode();Zt.label=this.parseIdent(!0),Zt.optional=this.eat(te.question),this.expect(te.colon),Zt.elementType=this.$0(),Xt=this.finishNode(Zt,"TSNamedTupleMember")}else if(Xt=this.$0(),this.eat(te.question)){let Zt=this.startNodeAt(Xt.start,Xt.loc?.start);Zt.typeAnnotation=Xt,Xt=this.finishNode(Zt,"TSOptionalType")}if(zt){let Zt=this.startNodeAt(Ft,Kt);Zt.typeAnnotation=Xt,Xt=this.finishNode(Zt,"TSRestType")}return Xt}$2d(){let Ft=this.$d();if(this.input.charCodeAt(Ft)===63)Ft=this.$d(Ft+1);return this.input.charCodeAt(Ft)===ua}$8(){return this.$a(()=>{let Ft=this.startNode();this.next(),Ft.params=[];while(!this.$c()){let Kt=this.startNode();while((this.type===te._const||this.type===te._in||this.isContextual("out"))&&Gt(this.$2()))Kt[this.value]=!0,this.next();if(Kt.name=this.$y(),this.eat(te._extends))Kt.constraint=this.$0();if(this.eat(te.eq))Kt.default=this.$0();if(Ft.params.push(this.finishNode(Kt,"TSTypeParameter")),!this.$c()){if(this.expect(te.comma),this.$c())Ft.extra={trailingComma:this.lastTokStart}}}if(this.next(),Ft.params.length===0)this.$1y(this.start,"Type parameter list cannot be empty.");return this.finishNode(Ft,"TSTypeParameterDeclaration")})}$e(){return this.$a(()=>{let Ft=this.startNode();this.next(),Ft.params=[];while(!this.$c())if(Ft.params.push(this.$0()),!this.$c())this.expect(te.comma);if(Ft.params.length===0)this.unexpected();return this.next(),this.finishNode(Ft,"TSTypeParameterInstantiation")})}$1j(){let Ft=[];do{let Kt=this.startNode();if(Kt.expression=this.$j(),this.$1())Kt.typeParameters=this.$e();Ft.push(this.finishNode(Kt,"TSExpressionWithTypeArguments"))}while(this.eat(te.comma));return Ft}$1k(Ft=!1){if(this.type!==te.name||this.containsEsc){if(this.type===te._const&&this.$3()==="enum")return this.$10(this.startNode());return}if(!this.$2e(this.value))return;if(this.value==="declare")return this.$2f(Ft);return this.$1l(this.startNode(),this.value)}$2e(Ft){switch(Ft){case"interface":case"type":case"namespace":return this.$14();case"enum":return Gt(this.$2());case"abstract":return this.$b()&&this.$3()==="class";case"module":{let Kt=this.$2();return this.$b()&&(Kt===ir||Kt===rr||Gt(Kt))}case"declare":return this.$b()&&wl.has(this.$3());case"global":return this.$b()&&this.$2()===ti}return!1}$1l(Ft,Kt){switch(Kt){case"interface":return this.$1m(Ft);case"type":return this.$2g(Ft);case"enum":return this.$10(Ft);case"abstract":return this.$1n(Ft,!0);case"global":return Ft.global=!0,Ft.id=this.parseIdent(),Ft.body=this.$11(),this.finishNode(Ft,"TSModuleDeclaration")}return this.$2h(Ft)}$2f(Ft){let Kt=this.$5;this.$5=!0;let zt=this.startNode();this.next();let Xt=this.value;if(Xt==="const"&&this.$3()==="enum")zt.const=!0;if(!Ft&&Tl.has(Xt))zt.declare=!0;let Zt;if(zt.const)Zt=this.$10(zt);else if(Xt==="var"||Xt==="let"||Xt==="const")Zt=this.parseVarStatement(zt,Xt,!0);else if(Xt==="function")this.next(),Zt=this.parseFunction(zt,pa,!1,!1);else if(Xt==="class")Zt=this.parseClass(zt,!0);else Zt=this.$1l(zt,Xt);return Zt.declare=!0,this.$5=Kt,Zt}$1n(Ft,Kt){return this.next(),Ft.abstract=!0,this.parseClass(Ft,Kt)}$1m(Ft){if(this.next(),Ft.id=this.parseIdent(),this.checkLValSimple(Ft.id,aa),this.$1())Ft.typeParameters=this.$8();return this.$a(()=>{if(this.eat(te._extends))Ft.extends=this.$1j();let Kt=this.startNode();Kt.body=this.$1f(),Ft.body=this.finishNode(Kt,"TSInterfaceBody")}),this.finishNode(Ft,"TSInterfaceDeclaration")}$2g(Ft){if(this.next(),Ft.id=this.parseIdent(),this.checkLValSimple(Ft.id,nr),this.$1())Ft.typeParameters=this.$8();return Ft.typeAnnotation=this.$a(()=>(this.expect(te.eq),this.$0())),this.semicolon(),this.finishNode(Ft,"TSTypeAliasDeclaration")}$10(Ft){if(this.type===te._const)Ft.const=!0,this.next();this.next(),Ft.id=this.parseIdent(),this.checkLValSimple(Ft.id,Rl),this.expect(te.braceL),Ft.members=[];while(!this.eat(te.braceR)){let Kt=this.startNode();if(Kt.id=this.type===te.string?this.parseExprAtom():this.parseIdent(!0),this.eat(te.eq))Kt.initializer=this.parseMaybeAssign();if(Ft.members.push(this.finishNode(Kt,"TSEnumMember")),this.type!==te.braceR)this.expect(te.comma)}return this.finishNode(Ft,"TSEnumDeclaration")}$2h(Ft){if(this.next(),this.type===te.string){if(Ft.id=this.parseExprAtom(),this.type===te.braceL)Ft.body=this.$11();else this.semicolon();return this.finishNode(Ft,"TSModuleDeclaration")}return Ft.id=this.parseIdent(),this.checkLValSimple(Ft.id,_l),this.$1o(Ft)}$1o(Ft){if(this.eat(te.dot)){let Kt=this.startNode();Kt.id=this.parseIdent(),Ft.body=this.$1o(Kt)}else Ft.body=this.$11();return this.finishNode(Ft,"TSModuleDeclaration")}$11(){this.enterScope(Pl);let Ft=this.startNode();this.enterScope(0),this.expect(te.braceL),Ft.body=[];while(!this.eat(te.braceR))Ft.body.push(this.parseStatement(null,!0));return this.exitScope(),this.exitScope(),this.finishNode(Ft,"TSModuleBlock")}$1p(Ft,Kt){if(Ft.isExport=Kt,Ft.id=this.parseIdent(),this.checkLValSimple(Ft.id,Ds),this.expect(te.eq),this.isContextual("require")&&this.$2()===ca){let zt=this.startNode();this.next(),zt.expression=this.$1e(),Ft.moduleReference=this.finishNode(zt,"TSExternalModuleReference")}else Ft.moduleReference=this.$j();return this.semicolon(),this.finishNode(Ft,"TSImportEqualsDeclaration")}$2i(){let Ft=this.$d();if(this.input.charCodeAt(Ft)!==ei)return!1;let Kt=this.input.charCodeAt(Ft+1);return Kt!==ei&&Kt!==62}parseStatement(Ft,Kt,zt){if(this.type===Wt)this.$1q(!0);let Xt=this.$1k();if(Xt)return Xt;return super.parseStatement(Ft,Kt,zt)}parseVarStatement(Ft,Kt,zt){return super.parseVarStatement(Ft,Kt,zt||this.$5)}parseVarId(Ft,Kt){if(super.parseVarId(Ft,Kt),Ft.id.type==="Identifier"&&this.$u()&&!this.hasPrecedingLineBreak())this.next(),Ft.definite=!0;this.$h(Ft.id,!1)}parseCatchClauseParam(){let Ft=this.$h(this.parseBindingAtom(),!1),Kt=Ft.type==="Identifier";return this.enterScope(Kt?kl:0),this.checkLValPattern(Ft,Kt?Nl:Ds),this.expect(te.parenR),Ft}parseImport(Ft){if(this.next(),Ft.importKind="value",this.type===te.string)Ft.specifiers=[],Ft.source=this.parseExprAtom();else{if(this.isContextual("type")){let Kt=this.$2();if(Kt===ti||Kt===sr||Gt(Kt)&&this.$3()!=="from")Ft.importKind="type",this.next()}if(this.type===te.name&&this.$2i())return this.$1p(Ft,!1);Ft.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),Ft.source=this.$z()}return this.$1r(Ft),this.semicolon(),this.finishNode(Ft,"ImportDeclaration")}parseWithClause(){if(this.isContextual("assert")&&!this.hasPrecedingLineBreak())this.type=te._with;return this.type===te._with?super.parseWithClause():void 0}$1r(Ft){let Kt=this.parseWithClause();if(Kt)Ft.attributes=Kt}parseImportSpecifier(){return this.$1s("importKind",()=>super.parseImportSpecifier())}parseExportSpecifier(Ft){return this.$1s("exportKind",()=>super.parseExportSpecifier(Ft))}$1s(Ft,Kt){let zt=this.isContextual("type")?this.$2():-1;if(zt===ir||zt===rr||Gt(zt)&&this.$3()!=="as"){let Zt=this.startNode();this.next();let Qt=Kt();return this.$q(Qt,Zt),Qt[Ft]="type",Qt}let Xt=Kt();return Xt[Ft]="value",Xt}parseExport(Ft,Kt){if(this.next(),this.eat(te._import)){if(Ft.importKind="value",this.isContextual("type")&&Gt(this.$2())&&this.$3()!=="from")Ft.importKind="type",this.next();return this.$1p(Ft,!0)}if(this.eat(te.eq))return Ft.expression=this.parseExpression(),this.semicolon(),this.finishNode(Ft,"TSExportAssignment");if(this.eatContextual("as"))return this.expectContextual("namespace"),Ft.id=this.parseIdent(),this.semicolon(),this.finishNode(Ft,"TSNamespaceExportDeclaration");if(Ft.exportKind="value",this.isContextual("type")){let Zt=this.$2();if(Zt===ti||Zt===sr)Ft.exportKind="type",this.next()}if(this.eat(te.star))return this.parseExportAllDeclaration(Ft,Kt);if(this.eat(te._default)){if(this.isContextual("interface")&&this.$14())Ft.declaration=this.$1m(this.startNode());else if(this.isContextual("abstract")&&this.$3()==="class")Ft.declaration=this.$1n(this.startNode(),"nullableID");else Ft.declaration=this.parseExportDefaultDeclaration();return this.finishNode(Ft,"ExportDefaultDeclaration")}let zt=this.isContextual("declare"),Xt=this.$1k(!0);if(Xt||this.shouldParseExportStatement()){if(Ft.declaration=Xt??this.parseStatement(null),zt||Ft.declaration.type==="TSInterfaceDeclaration"||Ft.declaration.type==="TSTypeAliasDeclaration")Ft.exportKind="type";return Ft.specifiers=[],Ft.source=null,this.finishNode(Ft,"ExportNamedDeclaration")}if(Ft.declaration=null,Ft.specifiers=this.parseExportSpecifiers(Kt),this.eatContextual("from"))Ft.source=this.$z(),this.$1r(Ft);else{for(let Zt of Ft.specifiers)if(this.checkUnreserved(Zt.local),this.checkLocalExport(Zt.local),Zt.local.type==="Literal")this.raise(Zt.local.start,"A string literal cannot be used as an exported binding without `from`.");Ft.source=null}return this.semicolon(),this.finishNode(Ft,"ExportNamedDeclaration")}parseFunction(Ft,Kt,zt,Xt,Zt){let Qt=Kt&pa;if(Qt)this.$f=Ft,this.$o=Ft.start;super.parseFunction(Ft,Kt,zt,Xt,Zt),this.$f=null;let en=!Ft.body;if(en)Ft.type="TSDeclareFunction";if(Qt&&Ft.id){if(en){if(this.$5&&this.currentScope().flags&oa)this.declareName(Ft.id.name,or,Ft.id.start);this.checkLValSimple(Ft.id,$l)}else if(!(Kt&Il)){let tn=Dl;if(this.strict||Ft.generator||Ft.async)tn=this.treatFunctionsAsVar?Al:Ds;this.checkLValSimple(Ft.id,tn)}}return Ft}parseFunctionParams(Ft){if(this.$1())Ft.typeParameters=this.$8();if(super.parseFunctionParams(Ft),this.type===te.colon)Ft.returnType=this.$6(!0)}parseFunctionBody(Ft,Kt,zt,Xt){if(zt&&this.type===te.colon)Ft.returnType=this.$6(!0);if(Kt||this.type===te.braceL||Ft.start!==this.$o){super.parseFunctionBody(Ft,Kt,zt,Xt);return}this.semicolon(),this.exitScope()}parseMethod(Ft,Kt,zt){let Xt=this.$k;this.$k=null;let Zt=super.parseMethod(Ft,Kt,zt);if(!Zt.body)Zt.type="TSDeclareMethod";if(Xt)Zt.typeParameters=Xt;return Zt}parseBindingList(Ft,Kt,zt,Xt){let Zt=Xt===!0||this.$l;return this.$l=!1,super.parseBindingList(Ft,Kt,zt,Zt)}$s(Ft){if(!Ft&&!this.$b())return!1;let Kt=this.$2();return Kt===Ml||Kt===ti||Kt===sr||Kt===la||Kt===Fl||Kt===ir||Kt===rr||Kt>=48&&Kt<=57||Gt(Kt)}parseAssignableListItem(Ft){let Kt=this.$12(),zt=this.start,Xt=this.startLoc,Zt,Qt=!1,en=!1;if(Ft)while(this.type===te.name&&Cl.has(this.value)&&!this.containsEsc&&this.$s(!1)){if(this.value==="readonly")Qt=!0;else if(this.value==="override")en=!0;else Zt=this.value;this.next()}let tn;if(this.type===te._this)tn=this.startNode(),tn.name="this",this.next(),this.finishNode(tn,"Identifier");else tn=this.parseBindingAtom();let sn=this.type===te.eq?this.parseMaybeDefault(zt,Xt,tn):this.parseMaybeDefault(tn.start,tn.loc?.start,this.$h(tn,!0));if(Kt.length>0)sn.decorators=Kt;if(!Zt&&!Qt&&!en)return sn;let nn=this.startNodeAt(zt,Xt);if(Zt)nn.accessibility=Zt;if(Qt)nn.readonly=!0;if(en)nn.override=!0;return nn.parameter=sn,this.finishNode(nn,"TSParameterProperty")}parseBindingListItem(Ft){if(Ft.type==="RestElement")this.$h(Ft,!0);return Ft}checkLValSimple(Ft,Kt,zt){if(this.$f&&Ft===this.$f.id){this.$f=null;return}if(!Kt&&ra.has(Ft.type)){this.checkLValSimple(Ft.expression,Kt,zt);return}switch(Ft.type){case"TSParameterProperty":this.checkLValInnerPattern(Ft.parameter,Kt,zt);return;case"Identifier":if(Ft.name==="this")return}super.checkLValSimple(Ft,Kt,zt)}toAssignable(Ft,Kt,zt){if(Ft&&!Kt&&ra.has(Ft.type))return Ft;return super.toAssignable(Ft,Kt,zt)}declareName(Ft,Kt,zt){let Xt=this.currentScope();if(Kt&or){this.$1t(Xt,Ft),Xt.$1u??=[],Xt.$1u.push(Ft);return}if(Kt===nr||Kt===aa){if(Xt.$13??=[],Kt===nr&&wn(Xt.$13,Ft))this.raise(zt,`type '${Ft}' has already been declared.`);Xt.$13.push(Ft),this.$1t(Xt,Ft);return}if(Kt&da){if(Xt.$1v??=[],wn(Xt.$1v,Ft))return;super.declareName(Ft,Ds,zt),Xt.$1v.push(Ft);return}super.declareName(Ft,Kt,zt)}$1t(Ft,Kt){if(this.inModule&&Ft.flags&oa)delete this.undefinedExports[Kt]}checkLocalExport(Ft){for(let Kt=this.scopeStack.length-1;Kt>=0;Kt--){let zt=this.scopeStack[Kt];if(wn(zt.$13,Ft.name)||wn(zt.$1u,Ft.name))return}super.checkLocalExport(Ft)}checkExport(){}raiseRecoverable(Ft,Kt){if(Kt==="Duplicate constructor in the same class")return;super.raiseRecoverable(Ft,Kt)}$12(){let Ft=[];while(this.type===Wt)Ft.push(this.$1w());return Ft}$1q(Ft){let Kt=this.$9[this.$9.length-1];while(this.type===Wt)Kt.push(this.$1w());if(this.type===te._export){if(!Ft)this.unexpected()}else if(this.type!==te._class&&!((this.isContextual("abstract")||this.isContextual("declare"))&&this.$3()==="class"))this.raise(this.start,"Leading decorators must be attached to a class declaration.")}$1w(){let Ft=this.startNode();this.next(),this.$9.push([]);let Kt=this.start,zt=this.startLoc,Xt;if(this.type===te.parenL){if(this.next(),Xt=this.parseExpression(),this.expect(te.parenR),this.options.preserveParens){let Qt=this.startNodeAt(Kt,zt);Qt.expression=Xt,Xt=this.finishNode(Qt,"ParenthesizedExpression")}}else{Xt=this.parseIdent(!1);while(this.eat(te.dot)){let Qt=this.startNodeAt(Kt,zt);Qt.object=Xt,Qt.property=this.parseIdent(!0),Qt.computed=!1,Xt=this.finishNode(Qt,"MemberExpression")}}let Zt=this.$p()?this.$e():void 0;if(this.eat(te.parenL)){let Qt=this.startNodeAt(Xt.start,Xt.loc?.start);if(Qt.callee=Xt,Qt.arguments=this.parseExprList(te.parenR,!1,!1),Zt)Qt.typeArguments=Zt;Xt=this.finishNode(Qt,"CallExpression")}else if(Zt){let Qt=this.startNodeAt(Xt.start,Xt.loc?.start);Qt.expression=Xt,Qt.typeArguments=Zt,Xt=this.finishNode(Qt,"TSInstantiationExpression")}return Ft.expression=Xt,this.$9.pop(),this.finishNode(Ft,"Decorator")}shouldParseExportStatement(){return this.type===Wt||super.shouldParseExportStatement()}parseExprAtom(Ft,Kt,zt){if(this.type===Wt)this.$1q(!1);return super.parseExprAtom(Ft,Kt,zt)}parseProperty(Ft,Kt){if(Ft||this.type!==Wt)return super.parseProperty(Ft,Kt);let zt=this.$12(),Xt=super.parseProperty(Ft,Kt);if(Xt.type==="SpreadElement")this.raise(Xt.start,"Decorators can't be used with SpreadElement");return Xt.decorators=zt,Xt}parseClassId(Ft,Kt){let zt=this.$9.length-1,Xt=this.$9[zt];if(Xt.length>0)Ft.decorators=Xt,this.$q(Ft,Xt[0]),this.$9[zt]=[];if(!this.isContextual("implements")||Kt===!0)super.parseClassId(Ft,Kt);if(this.$1())Ft.typeParameters=this.$8()}parseClassSuper(Ft){if(super.parseClassSuper(Ft),Ft.superClass&&this.$1())Ft.superTypeParameters=this.$e();if(this.eatContextual("implements"))Ft.implements=this.$a(()=>this.$1j())}parseClassElement(Ft){if(this.type===Wt){let en=this.$12();if(this.type===te.braceR)this.raise(this.start,"Decorators must be attached to a class element.");let tn=this.parseClassElement(Ft);return tn.decorators=en,this.$q(tn,en[0]),tn}if(this.eat(te.semi))return null;let Kt=this.startNode();while(this.type===te.name&&bl.has(this.value)&&!this.containsEsc&&this.$s(this.value==="static")){let en=this.value;if(this.next(),en==="static"&&this.type===te.braceL)return this.next(),this.parseClassStaticBlock(Kt),Kt;if(en==="public"||en==="private"||en==="protected")Kt.accessibility=en;else Kt[en]=!0}if(this.type===te.bracketL&&this.$1g())return this.$1h(Kt);Kt.static??=!1;let zt="",Xt=!1,Zt=!1,Qt="method";if(this.eatContextual("async"))if((this.isClassElementNameStart()||this.type===te.star)&&!this.canInsertSemicolon())Zt=!0;else zt="async";if(!zt&&this.eat(te.star))Xt=!0;if(!zt&&!Zt&&!Xt){let en=this.value;if(this.eatContextual("get")||this.eatContextual("set"))if(this.isClassElementNameStart())Qt=en;else zt=en}if(zt)Kt.computed=!1,Kt.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),Kt.key.name=zt,this.finishNode(Kt.key,"Identifier");else this.parseClassElementName(Kt);if(this.eat(te.question))Kt.optional=!0;if(this.type===te.parenL||this.$1()||Qt!=="method"||Xt||Zt){let en=Kt.key,tn=!Kt.static&&!Kt.computed&&(en.type==="Identifier"&&en.name==="constructor"||en.type==="Literal"&&en.value==="constructor");if(Kt.kind=tn?"constructor":Qt,this.$1())Kt.typeParameters=this.$8();this.$l=tn,this.$o=this.start,this.parseClassMethod(Kt,Xt,Zt,tn&&Ft)}else{if(!Kt.optional&&this.$u())this.next(),Kt.definite=!0;if(this.type===te.colon)Kt.typeAnnotation=this.$6();this.parseClassField(Kt)}return Kt}parseMaybeAssign(Ft,Kt,zt){if(this.$p()){let Xt=this.$g(()=>{let Zt=this.$8(),Qt=super.parseMaybeAssign(Ft,Kt,zt);if(Qt.type!=="ArrowFunctionExpression")return;return Qt.typeParameters=Zt,this.$q(Qt,Zt),Qt});if(Xt)return Xt}return super.parseMaybeAssign(Ft,Kt,zt)}parseMaybeUnary(Ft,Kt,zt,Xt){if(this.$p()){let Zt=this.startNode();return Zt.typeAnnotation=this.$a(()=>{this.next();let Qt=this.$0();if(!this.$c())this.unexpected();return this.next(),Qt}),Zt.expression=this.parseMaybeUnary(null,!1,!1,Xt),this.finishNode(Zt,"TSTypeAssertion")}return super.parseMaybeUnary(Ft,Kt,zt,Xt)}parseMaybeConditional(Ft,Kt){let zt=this.start,Xt=this.startLoc,Zt=this.parseExprOps(Ft,Kt);if(this.checkExpressionErrors(Kt))return Zt;if(this.type===te.question&&!(Zt.type==="ArrowFunctionExpression"&&Zt.start===zt)&&!this.$2j()){this.next();let Qt=this.startNodeAt(zt,Xt);return Qt.test=Zt,Qt.consequent=this.parseMaybeAssign(),this.expect(te.colon),Qt.alternate=this.parseMaybeAssign(Ft),this.finishNode(Qt,"ConditionalExpression")}return Zt}$2j(){let Ft=this.$d(),Kt=this.input.charCodeAt(Ft);if(Kt===ua||Kt===Ol||Kt===Ll)return!0;return Kt===ei&&this.input.charCodeAt(Ft+1)!==ei}parseParenItem(Ft){return this.$h(Ft,!0)}$1x(){if(this.type!==te.colon)return!0;let Ft=this.$g(()=>{let Kt=this.$6(!0);return this.type===te.arrow&&!this.canInsertSemicolon()?Kt:void 0});if(!Ft)return!1;return this.$7=Ft,!0}shouldParseArrow(Ft){return this.$1x()&&super.shouldParseArrow(Ft)}shouldParseAsyncArrow(){return this.$1x()&&super.shouldParseAsyncArrow()}parseArrowExpression(Ft,Kt,zt,Xt){if(this.$7)Ft.returnType=this.$7,this.$7=null;return super.parseArrowExpression(Ft,Kt,zt,Xt)}parseExprList(Ft,Kt,zt,Xt){if(!this.$m)return super.parseExprList(Ft,Kt,zt,Xt);this.$m=!1;let Zt=[],Qt=!0;while(!this.eat(Ft)){if(Qt)Qt=!1;else if(this.expect(te.comma),Kt&&this.afterTrailingComma(Ft))break;if(this.type===te.ellipsis){let en=this.parseSpread(Xt);if(this.eat(te.question))en.optional=!0;if(this.type===te.colon)en.typeAnnotation=this.$6();Zt.push(en)}else Zt.push(this.parseMaybeAssign(!1,Xt,this.parseParenItem))}return Zt}parseSubscript(Ft,Kt,zt,Xt,Zt,Qt,en){if(this.$u()&&!this.hasPrecedingLineBreak()){let sn=this.startNodeAt(Kt,zt);return this.exprAllowed=!1,this.next(),sn.expression=Ft,this.finishNode(sn,"TSNonNullExpression")}if(Zt&&this.$1()){let sn=this.$g(()=>this.$2k(Kt,zt,en));if(sn)return sn}let tn=this.type===te.questionDot&&this.$2()===ha;if(this.$1()||tn||this.type===te.bitShift&&this.value==="<<"){let sn=this.$g(()=>{if(tn)this.next();this.$p();let nn=this.$e();if(this.type===te.parenL&&!Xt)return nn;if(this.type===te.backQuote)return tn?void 0:nn;if(tn)return;if(this.$c()||this.type===te.bitShift||this.type.startsExpr&&this.type!==te.parenL&&!this.hasPrecedingLineBreak())return;return nn});if(sn){let nn=this.startNodeAt(Kt,zt);if(this.type===te.parenL&&!Xt){if(this.next(),nn.callee=Ft,nn.arguments=this.parseExprList(te.parenR,!0,!1),nn.typeArguments=sn,tn)Ft.optional=!0;if(tn||Qt)nn.optional=tn;return this.finishNode(nn,"CallExpression")}if(this.type===te.backQuote)return nn.tag=Ft,nn.quasi=this.parseTemplate({isTagged:!0}),nn.typeArguments=sn,this.finishNode(nn,"TaggedTemplateExpression");return nn.expression=Ft,nn.typeArguments=sn,this.finishNode(nn,"TSInstantiationExpression")}}if(Zt&&this.type===te.parenL)this.$m=!0;return super.parseSubscript(Ft,Kt,zt,Xt,Zt,Qt,en)}$2k(Ft,Kt,zt){let Xt=this.startNodeAt(Ft,Kt);if(Xt.typeParameters=this.$8(),this.expect(te.parenL),Xt.params=this.parseBindingList(te.parenR,!1,!0),this.type===te.colon)Xt.returnType=this.$6(!0);if(this.type!==te.arrow||this.canInsertSemicolon())return;return this.next(),this.parseArrowExpression(Xt,Xt.params,!0,zt)}parseDynamicImport(Ft){if(this.next(),Ft.source=this.parseMaybeAssign(),this.eat(te.comma)&&this.type!==te.parenR)Ft.arguments=[this.parseExpression()];return this.expect(te.parenR),this.finishNode(Ft,"ImportExpression")}parseNew(){let Ft=super.parseNew();if(Ft.callee?.type!=="TSInstantiationExpression")return Ft;let Kt=this.startNodeAt(Ft.start,Ft.loc?.start);return Kt.callee=Ft.callee.expression,Kt.typeArguments=Ft.callee.typeArguments,Kt.arguments=Ft.arguments,this.finishNodeAt(Kt,"NewExpression",Ft.end,Ft.loc?.end)}parseExprOp(Ft,Kt,zt,Xt,Zt){if(te._in.binop>Xt&&this.type===te.name&&(this.value==="as"||this.value==="satisfies")&&!this.containsEsc&&!this.hasPrecedingLineBreak()){let Qt=this.value==="satisfies",en=this.startNodeAt(Kt,zt);return en.expression=Ft,en.typeAnnotation=this.$a(()=>{if(this.next(),!Qt&&this.type===te._const){let tn=this.startNode();return tn.typeName=this.parseIdent(!0),this.finishNode(tn,"TSTypeReference")}return this.$0()}),this.finishNode(en,Qt?"TSSatisfiesExpression":"TSAsExpression"),this.parseExprOp(en,Kt,zt,Xt,Zt)}return super.parseExprOp(Ft,Kt,zt,Xt,Zt)}parseGetterSetter(Ft){Ft.kind=Ft.key.name,super.parseGetterSetter(Ft)}parsePropertyValue(Ft,Kt,zt,Xt,Zt,Qt,en,tn){if(!Kt&&this.$1()){if(this.$k=this.$8(),this.type!==te.parenL)this.unexpected();Ft.kind="init"}return super.parsePropertyValue(Ft,Kt,zt,Xt,Zt,Qt,en,tn)}}return Ht});function me(){throw Error('sveast: parsing TypeScript needs `typescript` from "sveast/typescript": createParser({ typescript }) or createModuleParser({ typescript })')}var Bl=/^\t+/;class e extends Error{name="ParseError";code;reason;position;start;end;frame;constructor(O,te,ve){super(`${ve}
|
|
21
|
-
https://svelte.dev/e/${te}`);this.code=te,this.reason=ve;let Je=typeof O==="number"?O:O?.start,Gt=typeof O==="number"?O:O?.end;if(Je!==void 0)this.position=[Je,Gt??Je],this.start=g(this.position[0]),this.end=g(this.position[1]),this.frame=Vl(this.start.line-1,this.end.column)}}var fa=(O)=>O.replace(Bl,(te)=>" ".repeat(te.length));function Vl(O,te){let ve=Math.max(0,O-2),Je=[];for(let Wt=ve;Wt<O+3;Wt++){let Ht=$o(Wt);if(Ht===void 0)break;Je.push(Ht)}let Gt=String(ve+Je.length+1).length;return Je.map((Wt,Ht)=>{let Ft=`${String(ve+Ht+1).padStart(Gt," ")}: ${fa(Wt)}`;if(ve+Ht!==O)return Ft;return`${Ft}
|
|
22
|
-
${" ".repeat(Gt+2+fa(Wt.slice(0,te)).length)}^`}).join(`
|
|
23
|
-
`)}function Ge(O){throw new e(O,"attribute_duplicate","Attributes need to be unique")}function We(O){throw new e(O,"attribute_empty_shorthand","Attribute shorthand cannot be empty")}function He(O,te){throw new e(O,"block_duplicate_clause",`${te} cannot appear more than once within a block`)}function ze(O){throw new e(O,"block_invalid_continuation_placement","{:...} block is invalid at this position (did you forget to close the preceding element or block?)")}function Xe(O){throw new e(O,"block_invalid_elseif","'elseif' should be 'else if'")}function Qe(O,te,ve){throw new e(O,"block_invalid_placement",`{#${te} ...} block cannot be ${ve}`)}function Ye(O){throw new e(O,"block_unclosed","Block was left open")}function Ze(O){throw new e(O,"block_unexpected_close","Unexpected block closing tag")}function Ke(O){throw new e(O,"const_tag_invalid_expression","{@const ...} must consist of a single variable declaration")}function et(O){throw new e(O,"css_empty_declaration","Declaration cannot be empty")}function Ne(O){throw new e(O,"css_expected_identifier","Expected a valid CSS identifier")}function tt(O){throw new e(O,"css_selector_invalid","Invalid selector")}function nt(O){throw new e(O,"debug_tag_invalid_arguments","{@debug ...} arguments must be identifiers, not arbitrary expressions")}function Ie(O){throw new e(O,"declaration_tag_invalid_type","Declaration tags must be `let` or `const` declarations")}function rt(O){throw new e(O,"directive_invalid_value","Directive value must be a JavaScript expression enclosed in curly braces")}function it(O,te){throw new e(O,"directive_missing_name",`\`${te}\` name cannot be empty`)}function st(O,te){throw new e(O,"element_invalid_closing_tag",`\`</${te}>\` attempted to close an element that was not open`)}function ot(O,te,ve){throw new e(O,"element_invalid_closing_tag_autoclosed",`\`</${te}>\` attempted to close element that was already automatically closed by \`<${ve}>\` (cannot nest \`<${ve}>\` inside \`<${te}>\`)`)}function Re(O,te){throw new e(O,"element_unclosed",`\`<${te}>\` was left open`)}function Le(O){throw new e(O,"expected_attribute_value","Expected attribute value")}function at(O){throw new e(O,"expected_block_type","Expected 'if', 'each', 'await', 'key' or 'snippet'")}function Me(O){throw new e(O,"expected_identifier","Expected an identifier")}function ct(O){throw new e(O,"expected_pattern","Expected identifier or destructure pattern")}function pt(O){throw new e(O,"expected_tag","Expected 'html', 'render', 'attach', 'const', or 'debug'")}function C(O,te){throw new e(O,"expected_token",`Expected token ${te}`)}function ut(O){throw new e(O,"expected_whitespace","Expected whitespace")}function Gl(O,te){throw new e(O,"js_parse_error",`${te}`)}function lt(O){throw new e(O,"render_tag_invalid_expression","`{@render ...}` tags can only contain call expressions")}function ft(O){throw new e(O,"script_duplicate","A component can have a single top-level `<script>` element and/or a single top-level `<script module>` element")}function dt(O,te){throw new e(O,"script_invalid_attribute_value",`If the \`${te}\` attribute is supplied, it must be a boolean attribute`)}function mt(O){throw new e(O,"script_invalid_context",'If the context attribute is supplied, its value must be "module"')}function ht(O,te){throw new e(O,"script_reserved_attribute",`The \`${te}\` attribute is reserved and cannot be used`)}function gt(O){throw new e(O,"style_duplicate","A component can have a single top-level `<style>` element")}function yt(O){throw new e(O,"svelte_component_invalid_this","Invalid component definition — must be an `{expression}`")}function xt(O){throw new e(O,"svelte_component_missing_this","`<svelte:component>` must have a 'this' attribute")}function Oe(O){throw new e(O,"svelte_element_missing_this","`<svelte:element>` must have a 'this' attribute with a value")}function Tt(O,te){throw new e(O,"svelte_meta_duplicate",`A component can only have one \`<${te}>\` element`)}function Et(O,te){throw new e(O,"svelte_meta_invalid_content",`<${te}> cannot have children`)}function St(O,te){throw new e(O,"svelte_meta_invalid_placement",`\`<${te}>\` tags cannot be inside elements or blocks`)}function kt(O,te){throw new e(O,"svelte_meta_invalid_tag",`Valid \`<svelte:...>\` tag names are ${te}`)}function bt(O){throw new e(O,"svelte_options_deprecated_tag",'"tag" option is deprecated — use "customElement" instead')}function wt(O){throw new e(O,"svelte_options_invalid_attribute","`<svelte:options>` can only receive static attributes")}function he(O,te){throw new e(O,"svelte_options_invalid_attribute_value",`Value must be ${te}, if specified`)}function vt(O){throw new e(O,"svelte_options_invalid_customelement",'"customElement" must be a string literal defining a valid custom element name or an object of the form { tag?: string; shadow?: "open" | "none" | `ShadowRootInit`; props?: { [key: string]: { attribute?: string; reflect?: boolean; type: .. } } }')}function Ct(O){throw new e(O,"svelte_options_invalid_customelement_props",'"props" must be a statically analyzable object literal of the form "{ [key: string]: { attribute?: string; reflect?: boolean; type?: "String" | "Boolean" | "Number" | "Array" | "Object" }"')}function Dt(O){throw new e(O,"svelte_options_invalid_customelement_shadow",'"shadow" must be either "open", "none" or `ShadowRootInit` object.')}function $e(O){throw new e(O,"svelte_options_invalid_tagname","Tag name must be lowercase and hyphenated")}function Pt(O){throw new e(O,"svelte_options_reserved_tagname","Tag name is reserved")}function At(O,te){throw new e(O,"svelte_options_unknown_attribute",`\`<svelte:options>\` unknown attribute '${te}'`)}function _t(O){throw new e(O,"tag_invalid_name","Expected a valid element or component name. Components must have a valid variable name or dot notation expression")}function Nt(O,te,ve){throw new e(O,"tag_invalid_placement",`{@${te} ...} tag cannot be ${ve}`)}function d(O){throw new e(O,"unexpected_eof","Unexpected end of input")}function It(O,te){throw new e(O,"unexpected_reserved_word",`'${te}' is a reserved word in JavaScript and cannot be used here`)}function Rt(O){throw new e(O,"unterminated_string_constant","Unterminated string constant")}function Lt(O){throw new e(O,"void_element_invalid_content","Void elements cannot have children or closing tags")}var ms="",ya=[],si=0,gn=[],yn=0;function Wl(O,te){ms=O,ya=te,si=0}function Ul(){return si}function Kl(O,te,ve,Je){si=Je}function Hl(O,te,ve,Je,Gt,Wt){si=Je;let Ht=te;if(O&&Ht.includes(`
|
|
24
|
-
`)){let Kt=ms.lastIndexOf(`
|
|
25
|
-
`,ve-1)+1,zt=Kt,Xt=ms.charCodeAt(zt);while(Xt===32||Xt===9)Xt=ms.charCodeAt(++zt);if(zt>Kt)Ht=ql(Ht,ms.slice(Kt,zt))}let Ft={type:O?"Block":"Line",value:Ht,start:ve,end:Je};if(Gt&&Wt)Ft.loc={start:Gt,end:Wt};ya.push(Ft)}function ql(O,te){let ve=O.startsWith(te)?te.length:0,Je="",Gt=O.indexOf(`
|
|
26
|
-
`,ve);while(Gt!==-1){if(Je+=O.slice(ve,Gt+1),ve=Gt+1,O.startsWith(te,ve))ve+=te.length;Gt=O.indexOf(`
|
|
27
|
-
`,ve)}return Je+O.slice(ve)}function zl(O,te,ve){let Je=0,Gt=te.length;while(Je<Gt){let Wt=Je+Gt>>>1;if(te[Wt].start<ve)Je=Wt+1;else Gt=Wt}if(Je>=te.length)return;if(gn=te.slice(Je).map(({type:Wt,value:Ht,start:Ft,end:Kt})=>({type:Wt,value:Ht,start:Ft,end:Kt})),yn=0,pr(O,void 0,!1),yn<gn.length&&(gn[yn].start>=O.end||O.type==="Program")){O.trailingComments??=[];while(yn<gn.length)O.trailingComments.push(gn[yn++])}}var Xl=new Map([["BlockStatement","body"],["Program","body"],["ArrayExpression","elements"],["ObjectExpression","properties"]]);function ma(O,te){for(let ve=O;ve<te;ve++){let Je=ms.charCodeAt(ve);if(Je!==44&&Je!==41&&Je!==32&&Je!==9)return!0}return!1}function pr(O,te,ve){while(yn<gn.length&&gn[yn].start<O.start)O.leadingComments??=[],O.leadingComments.push(gn[yn++]);if(yn>=gn.length)return;let Je=gn[yn].start;if(Je<O.end||!ma(O.end,Je)){let Gt=Qn(O),Wt=Xl.get(O.type),Ht=Wt===void 0?void 0:Gt[Wt],Ft=Array.isArray(Ht)&&Ht.length===0;for(let Kt in Gt){if(yn>=gn.length)return;if(Kt==="type")continue;let zt=Gt[Kt];if(Array.isArray(zt)){let Xt=Kt===Wt;for(let Zt=0;Zt<zt.length;Zt++){let Qt=zt[Zt];if(Bn(Qt))pr(Qt,O,Xt?Zt===zt.length-1:Ft)}}else if(Bn(zt))pr(zt,O,Ft)}if(yn>=gn.length)return}if(te!==void 0&&O.end===te.end)return;if(ve)while(yn<gn.length){if(te&&gn[yn].start>=te.end)break;O.trailingComments??=[],O.trailingComments.push(gn[yn++])}else if(O.end<=gn[yn].start&&!ma(O.end,gn[yn].start))O.trailingComments=[gn[yn++]]}var ge=new Set("arguments await break case catch class const continue debugger default delete do else enum eval export extends false finally for function if implements import in instanceof interface let new null package private protected public return static super switch this throw true try typeof var void while with yield".split(" ")),ii=!1,Ns=1,Jl=2,Yl=32,Ql=256,Zl=Ns|Jl|Ql,eu=2,tu=3,nu=4,su=/\r\n?|\n|\u2028|\u2029/,ga=new Map;function ni(O){if(!(O instanceof RegExp))return O;let te=ga.get(O);if(!te){let ve=new Set(O.source.slice(4,-2).split("|"));te={test:(Je)=>ve.has(Je)},ga.set(O,te)}return te}var cr=$s((O)=>class extends O{declareName(te,ve,Je){let Gt=!1;if(ve===eu){let Wt=this.currentScope();if(Gt=wn(Wt.lexical,te)||wn(Wt.functions,te)||wn(Wt.var,te),Wt.lexical.push(te),this.inModule&&Wt.flags&Ns)delete this.undefinedExports[te]}else if(ve===nu)this.currentScope().lexical.push(te);else if(ve===tu){let Wt=this.currentScope();Gt=this.treatFunctionsAsVar?wn(Wt.lexical,te):wn(Wt.lexical,te)||wn(Wt.var,te),Wt.functions.push(te)}else for(let Wt=this.scopeStack.length-1;Wt>=0;--Wt){let Ht=this.scopeStack[Wt];if(wn(Ht.lexical,te)&&!(Ht.flags&Yl&&Ht.lexical[0]===te)||!this.treatFunctionsAsVarInScope(Ht)&&wn(Ht.functions,te)){Gt=!0;break}if(Ht.var.push(te),this.inModule&&Ht.flags&Ns)delete this.undefinedExports[te];if(Ht.flags&Zl)break}if(Gt)this.raiseRecoverable(Je,`Identifier '${te}' has already been declared`)}}),lr=$s((O)=>{let{keywordTypes:te,tokTypes:ve}=O.acorn,Je=new Map("break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this const class extends export import super".split(" ").map((Wt)=>[Wt,te[Wt]])),Gt;return class extends O{constructor(Wt,Ht,Ft){super(Wt,Ht,Ft);this.keywords=ni(this.keywords),this.reservedWords=ni(this.reservedWords),this.reservedWordsStrict=ni(this.reservedWordsStrict),this.reservedWordsStrictBind=ni(this.reservedWordsStrictBind),Gt??=this.context[0]}reset(Wt,Ht,Ft){if(super.reset?.(Wt,Ht,Ft),this.input=Wt,this.containsEsc=!1,this.pos=Ht,Ft)this.lineStart=Ht-Ft.column,this.curLine=Ft.line;else this.lineStart=Wt.lastIndexOf(`
|
|
28
|
-
`,Ht-1)+1,this.curLine=this.options.locations?Wt.slice(0,this.lineStart).split(su).length:1;this.type=ve.eof,this.value=null,this.start=this.end=Ht,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=Ht;let Kt=this.context;if(Kt.length!==1||Kt[0]!==Gt)this.context=this.initialContext();if(this.exprAllowed=!0,this.strict=!0,this.potentialArrowAt=-1,this.potentialArrowInForAwait=!1,this.yieldPos=this.awaitPos=this.awaitIdentPos=0,this.labels.length>0)this.labels=[];for(let Zt in this.undefinedExports){this.undefinedExports=Object.create(null);break}let zt=this.scopeStack,Xt=zt[0];if(zt.length!==1||Xt.flags!==Ns||Xt.var.length>0||Xt.lexical.length>0||Xt.functions.length>0||Xt.tsTypes!==void 0||Xt.tsExportOnly!==void 0||Xt.tsEnums!==void 0)this.scopeStack=[],this.enterScope(Ns);if(this.regexpState=null,this.privateNameStack.length>0)this.privateNameStack=[];this.inTemplateElement=!1}parseParenAndDistinguishExpression(Wt,Ht){let Ft=super.parseParenAndDistinguishExpression(Wt,Ht);if(Ft.type==="ParenthesizedExpression")ii=!0;return Ft}checkUnreserved(Wt){if(ge.has(Wt.name))super.checkUnreserved(Wt)}canInsertSemicolon(){let Wt=this.type;return Wt===ve.eof||Wt===ve.braceR||As(this.input,this.lastTokEnd,this.start)}checkLocalExport(){}skipSpace(){let Wt=this.input,Ht=this.options.locations,Ft=this.pos,Kt=Wt.charCodeAt(Ft);for(;;)if(Kt===32||Kt===9)Kt=Wt.charCodeAt(++Ft);else if(Kt===10){if(Kt=Wt.charCodeAt(++Ft),Ht)this.curLine++,this.lineStart=Ft}else break;if(this.pos=Ft,Kt===47||Kt<33||Kt>=128)super.skipSpace()}readWord1(){let Wt=this.input,Ht=this.pos,Ft=Ht,Kt=Wt.charCodeAt(Ft),zt=0;while(Kt>=97&&Kt<=122||Kt>=65&&Kt<=90||Kt>=48&&Kt<=57||Kt===95||Kt===36)zt=Math.imul(zt,31)+Kt|0,Kt=Wt.charCodeAt(++Ft);if(Kt>=128||Kt===92)return super.readWord1();return this.containsEsc=!1,this.pos=Ft,ko(Wt,Ht,Ft,zt)}readWord(){let Wt=this.readWord1();return this.finishToken(Je.get(Wt)??ve.name,Wt)}}}),xa=Zs(cr,lr),iu=/ \(\d+:\d+\)$/;function _s(O){return O}function va(O){return O instanceof SyntaxError&&"pos"in O&&typeof O.pos==="number"}function ur(O,te,ve,Je,Gt,Wt=O.root.comments.length){let Ht=O.root.comments;Wl(te,Ht);let Ft={onComment:O.comments?Hl:Kl,sourceType:"module",ecmaVersion:16,locations:O.loc,preserveParens:Je};if(O.lfOnly)Ft.startLocation=g(ve);let Kt=O.isTypeScript?O.typescript:xa;if(!Kt)me();let zt;try{zt=Gt(Kt,Ft)}catch(Xt){if(!va(Xt))throw Xt;Gl(Xt.pos,Xt.message.replace(iu,""))}if(Ht.length>Wt)zl(_s(zt),Ht,ve);return zt}function ye(O,te,ve=0){return _s(ur(O,te,0,!1,(Je,Gt)=>{if(ve>0&&Gt.locations)Gt.startLocation=g(ve);let Wt=new Je(Gt,te,ve).parse();return Wt.start=0,Wt},0))}function ru(O,te){if(!te)return{line:1,column:0};let{column:ve}=g(O);return{line:Po(O-ve)+1,column:ve}}var ou={count:0},ar,au=(O)=>O.parseExpression();function pu(O,te,ve,Je,Gt){let Wt=ar;if(ar=void 0,Wt?.ParserClass===O&&Wt.onComment===te.onComment&&Wt.locations===te.locations&&Wt.parser.reset)Wt.parser.reset(ve,Je,te.startLocation);else Wt={ParserClass:O,onComment:te.onComment,locations:te.locations,parser:new O(te,ve,Je)};let Ht=Wt.parser;Ht.nextToken();let Ft=Gt(Ht);return Ht.input="",ar=Wt,Ft}function Ea(O,te,ve,Je){return ou.count+=1,ii=!1,ur(O,te,ve,!0,(Gt,Wt)=>(Wt.startLocation??=ru(ve,Wt.locations),pu(Gt,Wt,te,ve,Je)))}function B(O,te,ve,Je=!1){let Gt=_s(Ea(O,te,ve,au)),Wt=Math.max(Gt.end,Ul());return{node:ii&&!Je?hr(Gt):Gt,end:Wt}}function Mt(O,te,ve){let Je=O.root.comments.length,Gt=!0,Wt=Ea(O,te,ve,(Ft)=>{let Kt={shorthandAssign:-1,trailingComma:-1,parenthesizedAssign:-1,parenthesizedBind:-1,doubleProto:-1},zt=Ft.parseMaybeConditional(void 0,Kt);if(Ft.type!==xa.acorn.tokTypes.eof)return Gt=!1,zt;let Xt=Ft.toAssignable(zt,!1,Kt);return Ft.checkLValPattern(Xt),Xt});if(!Gt){O.root.comments.length=Je;return}let Ht=_s(Wt);return ii?hr(Ht):Ht}function Ot(O,te,ve){return _s(ur(O,te,ve,!1,(Je,Gt)=>{let Wt=new Je(Gt,te,ve);try{return Wt.nextToken(),Wt.parseStatement(null,!0,Object.create(null))}catch(Ht){if(va(Ht)&&Ht.pos===te.length)d(te.length);throw Ht}}))}function hr(O){let te=O;while(te.type==="ParenthesizedExpression")te=te.expression;return G(te,hr),te}var j=Zs(cr,de,lr);function Sa(O,te,ve){return ne(O),ye({isTypeScript:te.typescript??!1,typescript:ve,loc:te.loc??!1,comments:te.comments??!0,root:{comments:[]}},O)}function xe(O,te={}){return Sa(O,te,j)}function Te(O,te){let ve=l(O.name,te.name);if(ve!==0)return ve;let Je=l(O.type,te.type);if(Je!==0)return Je;if(O.type==="forwarded"&&te.type==="forwarded"){let Gt=l(O.element,te.element);if(Gt!==0)return Gt}return l(O.detail??"",te.detail??"")}function cu(O,te){let ve=O.length+1,Je=te.length+1,Gt=Array.from({length:ve},()=>Array(Je).fill(0));for(let Wt=0;Wt<ve;Wt++)Gt[Wt][0]=Wt;for(let Wt=0;Wt<Je;Wt++)Gt[0][Wt]=Wt;for(let Wt=1;Wt<ve;Wt++)for(let Ht=1;Ht<Je;Ht++){let Ft=O[Wt-1]===te[Ht-1]?0:1;if(Gt[Wt][Ht]=Math.min(Gt[Wt-1][Ht]+1,Gt[Wt][Ht-1]+1,Gt[Wt-1][Ht-1]+Ft),Wt>1&&Ht>1&&O[Wt-1]===te[Ht-2]&&O[Wt-2]===te[Ht-1])Gt[Wt][Ht]=Math.min(Gt[Wt][Ht],Gt[Wt-2][Ht-2]+1)}return Gt[ve-1][Je-1]}function I(O,te,ve=3){let Je,Gt=Number.POSITIVE_INFINITY;for(let Wt of te){let Ht=cu(O,Wt);if(Ht<Gt)Je=Wt,Gt=Ht}return Gt<=ve?Je:void 0}import{readFile as hu}from"node:fs/promises";import mr from"node:path";import ba,{sep as dr}from"node:path";var Ln=/\.svelte$/,gs=[".ts",".mts",".cts",".tsx",".js",".mjs",".cjs",".jsx",".d.ts"],Ca=/\.(?:svelte|[mc]?ts|[mc]?js|tsx|jsx)$/;function ys(O){if(!O.endsWith(".svelte"))return!1;let te=O.length-7;if(te===0)return!1;let ve=O.charCodeAt(te-1);return ve!==47&&(dr==="/"||ve!==92)}function n(O){return dr==="/"?O:O.split(dr).join("/")}function wa(O,te){return n(ba.join(te,ba.normalize(O)))}function Rs(O){return`${JSON.stringify(O,null,2)}
|
|
29
|
-
`}var Ta="sveld",ri="0.38.6";var $t={name:Ta,version:ri,license:"Apache-2.0",description:"Generate TypeScript definitions and component documentation for your Svelte components.",type:"module",main:"./dist/index.js",types:"./dist/index.d.ts",exports:{".":{types:"./dist/index.d.ts",import:"./dist/index.js",default:"./dist/index.js"},"./browser":{types:"./dist/browser.d.ts",import:"./dist/browser.js",default:"./dist/browser.js"},"./schema/component-api.schema.json":"./schema/component-api.schema.json"},scripts:{test:"bun test --parallel","test:update":"SVELD_UPDATE_FIXTURES=1 bun test tests/fixtures.test.ts","test:fixtures-types":"bun check --project tsconfig.fixtures.json","test:types-matrix":"bun scripts/typecheck-option-matrix.ts","test:svelte-versions":"bun scripts/typecheck-svelte-versions.ts","test:e2e":"bun tests/test-e2e.ts","test:inferred-types":"bun scripts/check-inferred-types.ts",format:"biome format --write .",lint:"biome check --error-on-warnings .","lint:fix":"biome check --write --unsafe .","lint:fix:changed":"biome check --write --unsafe --changed --no-errors-on-unmatched",build:"bun scripts/build.ts",bench:"bun scripts/bench.ts","bench:cache":"bun scripts/bench.ts --cache","bench:ostia":"ostia bench scripts/bench-ostia.ts",typecheck:"bun check && bun check --project tsconfig.excluded.json"},devDependencies:{"@biomejs/biome":"2.5.14","@types/bun":"^1.4.2","@types/jest":"^30.0.0","@typescript/typescript6":"^6.0.2",ajv:"^8.20.0",ostia:"^0.2.7",sveast:"^0.9.3",svelte:"^5.57.1",typescript:"^7.0.2"},bin:{sveld:"dist/cli.js"},repository:{type:"git",url:"git+https://github.com/carbon-design-system/sveld.git"},homepage:"https://github.com/carbon-design-system/sveld",bugs:"https://github.com/carbon-design-system/sveld/issues",keywords:["svelte","svelte component","documentation","docgen","typescript","definitions","JSDocs","vite","vite-plugin"],maintainers:["Eric Liu (https://github.com/metonym)"]};var Is="5.57.1";var oi=1;function Hn(O){return O.some((te)=>te.internal)?O.filter((te)=>!te.internal):O}function uu(O){return{...O,props:Hn(O.props),moduleExports:Hn(O.moduleExports),slots:Hn(O.slots),events:Hn(O.events),typedefs:Hn(O.typedefs),...O.contexts?{contexts:Hn(O.contexts).map((te)=>({...te,properties:Hn(te.properties)}))}:{}}}function m(O,te={}){let ve=Array.from(O.values(),(Wt)=>{let{diagnostics:Ht,...Ft}=Wt;return uu(Ft)}).sort((Wt,Ht)=>l(Wt.moduleName,Ht.moduleName)),Je={schemaVersion:oi,generator:{name:Ta,version:ri,svelteVersion:Is},total:ve.length,components:ve},Gt=te.entryExports?Hn(te.entryExports):void 0;if(Gt&&Gt.length>0)Je.totalExports=Gt.length,Je.exports=Gt;return Je}var du=/[:=]/,gr="COMPONENT_API.json",ai={none:0,patch:1,minor:2,major:3};function fu(O,te){return ai[te]>ai[O]?te:O}function mu(O){return O.reduce((te,ve)=>fu(te,ve.bump),"none")}function Da(O,te){return ai[O]>=ai[te]}function ka(O){return new Set(s(O,"|").map((te)=>te.trim()).filter((te)=>te.length>0))}function Pa(O){let te=Fi(O);if(te===-1)return;let ve=O.slice(0,te).trim(),Je=O.slice(te+2).trim();if(!ve.startsWith("(")||!ve.endsWith(")"))return;let Gt=ve.slice(1,-1).trim();return{params:Gt.length===0?[]:s(Gt,",").map((Ht)=>Ht.trim()),returnType:Je}}function gu(O){return(O.split(du,1)[0]??"").trimEnd().endsWith("?")}function yu(O,te){if(O.returnType!==te.returnType)return"major";if(te.params.length<O.params.length)return"major";for(let Je=0;Je<O.params.length;Je++)if(O.params[Je]!==te.params[Je])return"major";if(te.params.length===O.params.length)return"none";return te.params.slice(O.params.length).every(gu)?"minor":"major"}function yr(O,te){if(O===te)return"none";if(O===void 0||te===void 0)return"major";let ve=Pa(O),Je=Pa(te);if(ve&&Je)return yu(ve,Je);let Gt=ka(O),Wt=ka(te),Ht=[...Wt].some((Kt)=>!Gt.has(Kt));if(![...Gt].some((Kt)=>!Wt.has(Kt)))return Ht?"minor":"none";return"major"}function $a(O){return O.bindable===!0||O.binding==="writable"}function ci(O,te,ve){let Je=new Map(O.map((Kt)=>[ve(Kt),Kt])),Gt=new Map(te.map((Kt)=>[ve(Kt),Kt])),Wt=[...Gt].filter(([Kt])=>!Je.has(Kt)),Ht=[...Je.keys()].filter((Kt)=>!Gt.has(Kt)),Ft=[];for(let[Kt,zt]of Je){let Xt=Gt.get(Kt);if(Xt)Ft.push([Kt,zt,Xt])}return{added:Wt,removed:Ht,common:Ft}}function Aa(O,te,ve,Je){let Gt=te==="prop"?"prop":"export",Wt=[],Ht=(Xt,Zt,Qt)=>Wt.push({component:O,kind:te,name:Xt,bump:Zt,message:`${Gt} "${Xt}" ${Qt}`}),{added:Ft,removed:Kt,common:zt}=ci(ve,Je,(Xt)=>Xt.name);for(let[Xt,Zt]of Ft)Ht(Xt,Zt.isRequired?"major":"minor",`added${Zt.isRequired?" (required)":""}`);for(let Xt of Kt)Ht(Xt,"major","removed");for(let[Xt,Zt,Qt]of zt){if(Zt.isRequired!==Qt.isRequired)Ht(Xt,Qt.isRequired?"major":"minor",`became ${Qt.isRequired?"required":"optional"}`);let en=yr(Zt.type,Qt.type);if(en!=="none")Ht(Xt,en,`type changed from \`${Zt.type??"unknown"}\` to \`${Qt.type??"unknown"}\``);let tn=$a(Qt);if($a(Zt)!==tn)Ht(Xt,tn?"minor":"major",tn?"gained a writable binding":"lost its writable binding");if(Zt.value!==Qt.value&&en==="none")Ht(Xt,"patch",`default changed from \`${Zt.value??"none"}\` to \`${Qt.value??"none"}\``);let sn=Qt.deprecated!==void 0;if(Zt.deprecated!==void 0!==sn)Ht(Xt,sn?"minor":"patch",sn?"marked as deprecated":"no longer deprecated");if(Zt.constant!==Qt.constant)Ht(Xt,"minor",Qt.constant?"became constant":"became mutable");if(Zt.reactive!==Qt.reactive)Ht(Xt,"minor",Qt.reactive?"became reactive":"stopped being reactive")}return Wt}function xu(O,te,ve){let Je=[],{added:Gt,removed:Wt,common:Ht}=ci(te,ve,(Ft)=>Ft.name);for(let[Ft]of Gt)Je.push({component:O,kind:"event",name:Ft,bump:"minor",message:`event "${Ft}" added`});for(let Ft of Wt)Je.push({component:O,kind:"event",name:Ft,bump:"major",message:`event "${Ft}" removed`});for(let[Ft,Kt,zt]of Ht){if(Kt.type!==zt.type){Je.push({component:O,kind:"event",name:Ft,bump:"major",message:`event "${Ft}" changed from ${Kt.type} to ${zt.type}`});continue}let Xt=Kt.type==="dispatched"?Kt.detail:void 0,Zt=zt.type==="dispatched"?zt.detail:void 0,Qt=yr(Xt,Zt);if(Qt!=="none")Je.push({component:O,kind:"event",name:Ft,bump:Qt,message:`event "${Ft}" detail changed from \`${Xt??"unknown"}\` to \`${Zt??"unknown"}\``})}return Je}function vu(O,te,ve){let Je=[],{added:Gt,removed:Wt,common:Ht}=ci(te,ve,(Ft)=>Ft.name??"default");for(let[Ft]of Gt)Je.push({component:O,kind:"slot",name:Ft,bump:"minor",message:`slot "${Ft}" added`});for(let Ft of Wt)Je.push({component:O,kind:"slot",name:Ft,bump:"major",message:`slot "${Ft}" removed`});for(let[Ft,Kt,zt]of Ht){let Xt=yr(Kt.slot_props,zt.slot_props);if(Xt!=="none")Je.push({component:O,kind:"slot",name:Ft,bump:Xt,message:`slot "${Ft}" props changed from \`${Kt.slot_props??"none"}\` to \`${zt.slot_props??"none"}\``})}return Je}var Eu=new Set(["description","source","componentCommentSource","tags"]);function pi(O){if(Array.isArray(O))return O.map(pi);if(O!==null&&typeof O==="object"){let te={};for(let[ve,Je]of Object.entries(O)){if(Eu.has(ve))continue;te[ve]=pi(Je)}return te}return O}var Su=["generics","rest_props","extends","contexts","typedefs"];function bu(O,te,ve){let Je=[];for(let Gt of Su){let Wt=JSON.stringify(pi(te[Gt])),Ht=JSON.stringify(pi(ve[Gt]));if(Wt!==Ht)Je.push({component:O,kind:"shape",name:Gt,bump:"major",message:`"${Gt}" changed (breaking)`})}return Je}function Cu(O,te){let ve=te.moduleName;return[...Aa(ve,"prop",O.props,te.props),...Aa(ve,"moduleExport",O.moduleExports,te.moduleExports),...xu(ve,O.events,te.events),...vu(ve,O.slots,te.slots),...bu(ve,O,te)]}function Bt(O,te){let ve=[],{added:Je,removed:Gt,common:Wt}=ci(O.components,te.components,(Ht)=>Ht.moduleName);for(let[Ht]of Je)ve.push({component:Ht,kind:"component",bump:"minor",message:`component "${Ht}" added`});for(let Ht of Gt)ve.push({component:Ht,kind:"component",bump:"major",message:`component "${Ht}" removed`});for(let[,Ht,Ft]of Wt)ve.push(...Cu(Ht,Ft));return ve}async function wu(O){let te;try{te=await hu(mr.resolve(O),"utf-8")}catch(ve){if(ve.code==="ENOENT")return null;throw ve}try{return JSON.parse(te)}catch{throw Error(`sveld: could not parse "${O}" as JSON. Is it a sveld COMPONENT_API.json snapshot?`)}}function Ee(O){if(typeof O.check==="string")return O.check;return O.jsonOptions?.outFile??gr}function Se(O,te){if(!O.json||O.stdout||O.jsonOptions?.outDir)return!1;return mr.resolve(O.jsonOptions?.outFile??gr)===mr.resolve(te)}async function J(O,te,ve={}){let Je=await wu(te);if(Je===null)return{snapshotExists:!1,snapshotFile:te,changes:[],bump:"none"};if(Je.schemaVersion!==oi)return{snapshotExists:!0,snapshotFile:te,changes:[{component:"*",kind:"schema",bump:"none",message:`snapshot schemaVersion ${Je.schemaVersion} differs from ${oi}; regenerate the snapshot`}],bump:"none"};let Gt=m(O,{entryExports:ve.entryExports}),Wt=Bt(Je,Gt);return{snapshotExists:!0,snapshotFile:te,changes:Wt,bump:mu(Wt)}}var Tu={major:"BREAKING",minor:"additive",patch:"patch",none:"no change"};function ke(O){if(!O.snapshotExists){let Gt=O.snapshotFile===gr?"`sveld --json`":`\`sveld --json\` with \`jsonOptions.outFile: "${O.snapshotFile}"\``;return`sveld --check: no snapshot found at "${O.snapshotFile}". Generate it with ${Gt} and commit it.`}if(O.changes.length===0)return`sveld --check: no API changes detected against "${O.snapshotFile}".`;let te=O.changes.length,ve=[`sveld --check: ${te} API change${te===1?"":"s"} detected against "${O.snapshotFile}".`,`Suggested semver bump: ${O.bump}.`],Je=new Map;for(let Gt of O.changes){let Wt=Je.get(Gt.component)??[];Wt.push(Gt),Je.set(Gt.component,Wt)}for(let[Gt,Wt]of Je){ve.push("",` ${Gt}`);for(let Ht of Wt){let Ft=Ht.kind==="schema"?"schema":Tu[Ht.bump];ve.push(` [${Ft}] ${Ht.message}`)}}return ve.join(`
|
|
30
|
-
`)}var jt=1;function be(O){let te={kind:"check-report",schemaVersion:jt,...O};return Rs(te)}import{existsSync as ku}from"node:fs";import{join as Pu}from"node:path";import{pathToFileURL as $u}from"node:url";var Au=["sveld.config.js","sveld.config.mjs","sveld.config.ts"];function Vt(O){return O}function Du(O=process.cwd()){for(let te of Au){let ve=Pu(O,te);if(ku(ve))return ve}return null}async function K(O){let te;try{te=await import(`${$u(O).href}?t=${Date.now()}`)}catch(Je){let Gt=Je instanceof Error?Je.message:String(Je);throw Error(`sveld: failed to load config file "${O}".
|
|
31
|
-
${Gt}`)}let ve=te.default;if(!i(ve)||Array.isArray(ve))throw Error(`sveld: config file "${O}" must export a configuration object as its default export. Did you forget \`export default defineConfig({ ... })\`?`);return ve}async function q(O=process.cwd()){let te=Du(O);return te===null?{}:K(te)}function R(...O){let te={};for(let ve of O){if(!ve)continue;for(let[Je,Gt]of Object.entries(ve)){let Wt=te[Je];te[Je]=i(Wt)&&!Array.isArray(Wt)&&i(Gt)&&!Array.isArray(Gt)?{...Wt,...Gt}:Gt}}return te}var Na=["entry","glob","quiet","documentExports","types","typesOptions","json","jsonOptions","markdown","markdownOptions","failFast","watch","config","cache","checkExamples","reportDiagnostics","strict","check","checkLevel","stdout","format","diagnostics"],Nu={typesOptions:["outDir","preamble","format","transform","indexTypes"],jsonOptions:["outFile","outDir","source"],markdownOptions:["outFile","outDir","onAppend"],diagnostics:["ignore"]};function _a(O,te,ve){let Je=O===null?te:`${O}.${te}`,Gt=I(te,ve),Wt=Gt===void 0?void 0:O===null?Gt:`${O}.${Gt}`;console.warn(`sveld: unknown option "${Je}".${Wt?` Did you mean "${Wt}"?`:""}`)}function F(O){for(let te of Object.keys(O))if(!Na.includes(te))_a(null,te,Na);for(let[te,ve]of Object.entries(Nu)){let Je=O[te];if(!i(Je))continue;for(let Gt of Object.keys(Je))if(!ve.includes(Gt))_a(te,Gt,ve)}}import{dirname as xc,isAbsolute as ym,resolve as xm}from"node:path";import{lstatSync as Of}from"node:fs";import{readFile as Mf}from"node:fs/promises";import{resolve as Wp}from"node:path";import{dirname as Uh}from"node:path";var _u=" ",Ru=120,Iu=/\binterface\s+[A-Za-z_$][\w$]*(\s*<[^{};]*>)?\s*$/,Lu=200,Oa=/\s/,Ou=/\s{2}|[^\S ]/,Mu=/["'`{}/]/g,Fu=/["'`{};/]/g,Ma=9,xr=10,ju=13,Ls=32,ui=34,Bu=38,hi=39,Vu=40,Gu=41,li=42,Ra=46,Er=47,Fa=59,Wu=62,Uu=91,Sr=92,Ku=93,di=96,br=123,Hu=124,Cr=125;function qu(O){return Iu.test(Xu(O,Lu))}var Ia=[""];function zu(O){let te=Ia[O];if(te===void 0)te=_u.repeat(O),Ia[O]=te;return te}function Xu(O,te){let ve="";for(let Je=O.length-1;Je>=0&&ve.length<te;Je--)ve=O[Je]+ve;return ve.length>te?ve.slice(-te):ve}function Ju(O){if(O.length===0)return!1;let te=O[O.length-1];return te.charCodeAt(te.length-1)===xr}function Yu(O){while(O.length>0){let te=O[O.length-1],ve=te.length;while(ve>0){let Je=te.charCodeAt(ve-1);if(Je!==Ls&&Je!==Ma)break;ve--}if(ve===te.length)return;if(ve===0){O.pop();continue}O[O.length-1]=te.slice(0,ve);return}}function Qu(O){while(O.length>0){let te=O[O.length-1];if(!Oa.test(te[te.length-1]))return;let ve=te.trimEnd();if(ve.length===te.length)return;if(ve.length===0){O.pop();continue}O[O.length-1]=ve;return}}function Zu(O){if(O.includes("{"))return!1;let te=0,ve=0;for(let Je=0;Je<O.length;Je++){let Gt=O.charCodeAt(Je);if(te!==0){if(Gt===te&&O.charCodeAt(Je-1)!==Sr)te=0;continue}if(Gt===ui||Gt===hi||Gt===di){te=Gt;continue}if(Gt===Fa&&++ve>=2)return!0}return!1}function eh(O){if(!Ou.test(O))return O.trimEnd();let te="",ve=null,Je=!1;for(let Gt=0;Gt<O.length;Gt++){let Wt=O[Gt],Ht=O[Gt-1];if(ve){if(te+=Wt,ve==="double"&&Wt==='"'&&Ht!=="\\"||ve==="single"&&Wt==="'"&&Ht!=="\\"||ve==="template"&&Wt==="`"&&Ht!=="\\")ve=null;Je=!1;continue}if(Wt==='"'||Wt==="'"||Wt==="`"){ve=Wt==='"'?"double":Wt==="'"?"single":"template",te+=Wt,Je=!1;continue}if(Oa.test(Wt)){if(!Je&&te.length>0)te+=" ",Je=!0;continue}te+=Wt,Je=!1}return te.trimEnd()}function ja(O,te){let ve=O[te],Je=O.indexOf(ve,te+1);while(Je!==-1&&O.charCodeAt(Je-1)===Sr)Je=O.indexOf(ve,Je+1);return Je}function Ba(O,te){let ve=O.indexOf("*/",te+1);return ve===-1?-1:ve+1}function th(O){let te=new Map,ve=[],Je=Mu,Gt=0;while(Gt<O.length){if(Je.lastIndex=Gt,!Je.test(O))break;Gt=Je.lastIndex-1;let Wt=O.charCodeAt(Gt);if(Wt===Er){if(O.charCodeAt(Gt+1)===li){let Ht=Ba(O,Gt);if(Ht===-1)break;Gt=Ht}}else if(Wt===ui||Wt===hi||Wt===di){let Ht=ja(O,Gt);if(Ht===-1)break;Gt=Ht}else if(Wt===br)ve.push(Gt);else if(Wt===Cr&&ve.length>0)te.set(ve.pop(),Gt);Gt++}return te}function nh(O,te,ve){for(let Je=te;Je<ve;Je++)if(!vr(O.charCodeAt(Je)))return!1;return!0}function vr(O){if(O<=Ls)return O===Ls||O>=Ma&&O<=ju;if(O<160)return!1;return O===160||O===5760||O>=8192&&O<=8202||O===8232||O===8233||O===8239||O===8287||O===12288||O===65279}function Va(O,te,ve,Je){let Gt=[],Wt=Fu,Ht=te,Ft=te;while(Ft<ve){if(Wt.lastIndex=Ft,!Wt.test(O))break;if(Ft=Wt.lastIndex-1,Ft>=ve)break;let Kt=O.charCodeAt(Ft);if(Kt===Er){if(O.charCodeAt(Ft+1)===li){let zt=Ba(O,Ft);if(zt===-1)break;Ft=zt}Ft++;continue}if(Kt===ui||Kt===hi||Kt===di){let zt=ja(O,Ft);if(zt===-1)break;Ft=zt+1;continue}if(Kt===br){let zt=Je.get(Ft);if(zt===void 0||zt>=ve){Ft++;continue}if(Ht<Ft)Gt.push(O.slice(Ht,Ft));let Xt=Ft+1;if(nh(O,Xt,zt)){Gt.push("{}"),Ft=zt+1,Ht=Ft;continue}let Zt=O.slice(Xt,zt),Qt=O.charCodeAt(Xt)===xr;if(!Qt&&!Zt.includes("/*")&&!Zu(Zt)&&!qu(Gt)){let en=Va(O,Xt,zt,Je),tn=en.trim();if(!tn.includes(`
|
|
32
|
-
`)){let sn=tn.endsWith(";")?tn.slice(0,-1):tn,nn=`{ ${eh(sn)} }`;if(nn.length<=Ru){Gt.push(nn),Ft=zt+1,Ht=Ft;continue}}if(Gt.push("{"),en.charCodeAt(0)!==Fa)Gt.push(`
|
|
33
|
-
`);if(en.length>0)Gt.push(en);Ft=zt,Ht=zt;continue}if(Gt.push("{"),!Qt)Gt.push(`
|
|
34
|
-
`);Ft=Xt,Ht=Xt;continue}if(Kt===Cr){if(Ht<Ft)Gt.push(O.slice(Ht,Ft));if(Yu(Gt),!Ju(Gt))Gt.push(`
|
|
35
|
-
`);Gt.push("}"),Ft++,Ht=Ft;continue}if(Ht<Ft)Gt.push(O.slice(Ht,Ft));if(Qu(Gt),Gt.push(";"),O.charCodeAt(Ft+1)!==xr)Gt.push(`
|
|
36
|
-
`);Ft++,Ht=Ft}if(Ht<ve)Gt.push(O.slice(Ht,ve));return Gt.join("")}function sh(O){if(!O.includes(" "))return O;let te="",ve=0;for(let Je=0;Je<O.length;Je++){let Gt=O.charCodeAt(Je);if(ve!==0){if(te+=O[Je],Gt===ve&&O.charCodeAt(Je-1)!==Sr)ve=0;continue}if(Gt===ui||Gt===hi||Gt===di){ve=Gt,te+=O[Je];continue}if(Gt===Ls&&te.charCodeAt(te.length-1)===Ls)continue;te+=O[Je]}return te}function ih(O){return O===Cr||O===Ku||O===Gu||O===Wu}function rh(O,te,ve){return ve-te>=3&&O.charCodeAt(te)===Er&&O.charCodeAt(te+1)===li&&O.charCodeAt(te+2)===li}function La(O,te,ve){let Je=O.indexOf("*/",te);return Je!==-1&&Je+2<=ve}function oh(O,te,ve){let Je=O.charCodeAt(te);if(Je===Hu||Je===Bu)return!0;return Je===Ra&&te+1<ve&&O.charCodeAt(te+1)!==Ra}function ah(O){let te=[],ve=[],Je=O.length,Gt=0,Wt=!1,Ht=0,Ft=0;while(Ft<=Je){let Xt=O.indexOf(`
|
|
37
|
-
`,Ft);if(Xt===-1)Xt=Je;let Zt=Xt+1,Qt=Ft,en=Xt;while(Qt<en&&vr(O.charCodeAt(Qt)))Qt++;while(en>Qt&&vr(O.charCodeAt(en-1)))en--;if(Qt===en){let un=ve.length>0?ve[ve.length-1]:void 0;if(un!==void 0&&un!==""){let fn=un.charCodeAt(un.length-1);if(fn!==br&&fn!==Vu&&fn!==Uu)te.push(0),ve.push("")}Ft=Zt;continue}if(Wt){if(te.push(Ht),ve.push(` ${O.slice(Qt,en)}`),La(O,Qt,en))Wt=!1;Ft=Zt;continue}let tn=rh(O,Qt,en),sn=tn&&La(O,Qt,en);if(tn&&!sn){te.push(Gt),ve.push(O.slice(Qt,en)),Wt=!0,Ht=Gt,Ft=Zt;continue}let nn=ih(O.charCodeAt(Qt)),an=Math.max(0,Gt-(nn?1:0))+(oh(O,Qt,en)?1:0);if(nn&&an===0&&ve.length>0&&ve[ve.length-1]==="")te.pop(),ve.pop();if(te.push(an),ve.push(sh(O.slice(Qt,en))),Ft=Zt,sn)continue;Gt=hs(O,void 0,Qt,en,Gt)}let Kt=ve.length;while(Kt>0&&ve[Kt-1]==="")Kt--;let zt=[];for(let Xt=0;Xt<Kt;Xt++){if(Xt>0)zt.push(`
|
|
38
|
-
`);let Zt=te[Xt];if(Zt>0)zt.push(zu(Zt));zt.push(ve[Xt])}return zt.join("")}function Ga(O){return`${ah(Va(O,0,O.length,th(O)))}
|
|
39
|
-
`}var On="any",Mn="",ph="Record<string, any>",Os="Record<string, never>",za=/^[A-Za-z_$][A-Za-z0-9_$]*$/,ch=/CustomEvent/,lh=/^[A-Z]/,uh=/\n/,Xa=/=>/,hh=/(?:^|\n)@default\b/,Tr=/\n/g,dh=/^([ \t]*\*) +$/gm,fh=/\s+/g,xs=/(^|[^.\w])Snippet(?:\s*<|\b)/,mh=/import\s+type\s+[^;]*\bSnippet\b[^;]*from\s+"svelte";/,gh=/^const\s+/,yh=/^export /,xh=/[^\w$]/g;function Ja(O){return O.replace(gh,"")}function vh(O){if(!O)return;return O.replace(Tr,`
|
|
40
|
-
* `)}function kr(O){if(!O)return"";return`/** ${S(O)} */`}function Pr(O){if(!O)return"";return`/**
|
|
41
|
-
* ${S(O).replace(Tr,`
|
|
42
|
-
* `)}
|
|
43
|
-
*/`}function Ya(O){return O?.includes(`
|
|
44
|
-
`)?Pr(O):kr(O)}function Qa(O){if(O===void 0)return;return O===!0?"@deprecated":`@deprecated ${O}`}function Eh(O){let te=Qa(O);if(te===void 0)return;return`* ${te.replace(Tr,`
|
|
45
|
-
* `)}
|
|
46
|
-
`}function Sh(O,te){if(!te)return[`@${O}`];if(!te.includes(`
|
|
47
|
-
`))return[`@${O} ${te}`];return[`@${O}`,...te.split(`
|
|
48
|
-
`)]}function $r(O){let te=[];for(let{name:ve,body:Je}of O??[])te.push(...Sh(ve,Je));return te}function Ar(O,te,ve){let Je=Qa(ve),Gt=$r(te);if(!(Gt.length>0)&&!Je)return Ya(O);let Ht=[];if(O)Ht.push(...O.split(`
|
|
49
|
-
`));if(Ht.push(...Gt),Je)Ht.push(...Je.split(`
|
|
50
|
-
`));return`/**
|
|
51
|
-
* ${S(Ht.join(`
|
|
52
|
-
* `))}
|
|
53
|
-
*/`}function bh(O){let te=$r(O);if(te.length===0)return"";return te.map((ve)=>`* ${ve}
|
|
54
|
-
`).join("")}function fi(O){if(O===void 0)return On;return`${O}
|
|
55
|
-
`}function mi(O){if(O.typedefs.length===0)return Mn;return O.typedefs.map((te)=>{let ve,Je=$r(te.tags);if(Je.length===0)ve=te.description?`${Pr(te.description)}
|
|
56
|
-
`:"";else{let Gt=te.description?[...te.description.split(`
|
|
57
|
-
`),...Je]:Je;ve=`/**
|
|
58
|
-
* ${S(Gt.join(`
|
|
59
|
-
* `))}
|
|
60
|
-
*/
|
|
61
|
-
`}return`${ve}export ${te.ts}`.replace(dh,"$1")}).join(`
|
|
62
|
-
|
|
63
|
-
`)}var Wa=new Map;function Ch(O,te){let ve=Wa.get(te);if(ve===void 0)ve=new RegExp(`\\b${Q(te)}\\b`),Wa.set(te,ve);return ve.test(O)}var Ua,Ka=[];function Za(O){if(O!==Ua)Ua=O,Ka=s(O,",");return Ka}function wh(O){if(O===null)return[];return O[0].split(",").map((te,ve)=>({name:te.trim(),constraint:(Za(O[1]??"")[ve]??te).trim()}))}function ep(O,te){let ve=wh(O).filter(({name:Je})=>Ch(te,Je));if(ve.length===0)return{declSuffix:Mn,refSuffix:Mn};return{declSuffix:`<${ve.map(({constraint:Je})=>Ja(Je)).join(", ")}>`,refSuffix:`<${ve.map(({name:Je})=>Je).join(", ")}>`}}function tp(O){if(!O.contexts||O.contexts.length===0)return Mn;return O.contexts.map((te)=>{let ve=te.properties.map((Ht)=>{let Ft=Ht.description?`${kr(Ht.description)}
|
|
64
|
-
`:"",Kt=Ht.optional?"?":"";return`${Ft}${Ht.name}${Kt}: ${Ht.type};`}).join(`
|
|
65
|
-
`),Je=te.description?`${Pr(te.description)}
|
|
66
|
-
`:"",{declSuffix:Gt}=ep(O.generics,[te.type??"",...te.properties.map((Ht)=>Ht.type)].join(`
|
|
67
|
-
`));if(te.type!==void 0)return`${Je}export type ${te.typeName}${Gt} = ${te.type};`;if(te.properties.length===0)return`${Je}export type ${te.typeName} = ${te.hasUnresolvedSpread?"Record<string, any>":Os};`;let Wt=te.hasUnresolvedSpread?" & Record<string, any>":"";return`${Je}export type ${te.typeName}${Gt} = {
|
|
68
|
-
${ve}
|
|
69
|
-
}${Wt};`}).join(`
|
|
70
|
-
|
|
71
|
-
`)}function Fn(O){return za.test(O)?O:JSON.stringify(O)}function np(O,te){if(!O)return;return`* ${te||O}
|
|
72
|
-
`}function vs(O,te,ve){return[np(vh(O)),Eh(te),bh(ve)].filter(Boolean).join("")}function ss(O){return O.length>0?`/**
|
|
73
|
-
${S(O)}*/`:Mn}function Ha(O,te){let ve=Ar(te.description,te.tags,te.deprecated),Je=ve?`${ve}
|
|
74
|
-
`:"",Gt=!te.slot_props||te.slot_props===Os?"[]":kh(te.slot_props),Wt=Gt==="[]"?"(this: void) => void":`(this: void, ...args: ${Gt}) => void`;return`
|
|
75
|
-
${Je}${O}?: ${Wt};`}function Th(O){let te=O.props.filter((Qt)=>!Qt.isFunctionDeclaration&&Qt.kind!=="const"),ve=new Set([...te.map((Qt)=>Qt.name),...Array.from(O.canonicalPropNames??[])]),Gt=(O.canonicalPropsType?te.filter((Qt)=>!O.canonicalPropNames?.has(Qt.name)):te).map((Qt)=>{let en=typeof Qt.value==="string"?Qt.value.replace(fh," "):Qt.value,tn=hh.test(Qt.description??"")||Qt.value===void 0||Qt.value==="undefined",sn=[vs(Qt.description,Qt.deprecated,Qt.tags),np(Qt.constant,"@constant"),tn?null:`* @default ${en}
|
|
76
|
-
`].filter(Boolean).join(""),nn=Qt.constant&&!Qt.isFunction?Qt.value:Qt.type||On;return`
|
|
77
|
-
${ss(sn)}
|
|
78
|
-
${Fn(Qt.name)}${Qt.isRequired?"":"?"}: ${nn};`});for(let Qt of O.slots)if(!Qt.default&&Qt.name!=null&&!ve.has(Qt.name))Gt.push(Ha(Fn(Qt.name),Qt));let Wt=O.slots.find((Qt)=>Qt.default||Qt.name===null);if(Wt&&!ve.has("children"))Gt.push(Ha("children",Wt));let Ht=Gt.join(`
|
|
79
|
-
`),Ft=Es(O.moduleName),Kt=O.generics?`<${Za(O.generics[1]).map((Qt)=>Ja(Qt.trim())).join(", ")}>`:"",zt=O.generics?`<${O.generics[0]}>`:"",Xt=O.extends===void 0?"":`Omit<${O.extends.interface}, keyof $Props${zt}> & `;if(O.rest_props?.type==="Element"){let{name:Qt,thisValue:en,thisType:tn,description:sn}=O.rest_props,nn;if(Qt!=="svelte:element")nn=Qt.split("|").map((En)=>`SvelteHTMLElements["${En.trim()}"]`).join(" & ");else if(en)nn=`SvelteHTMLElements["${en}"]`;else if(tn)nn=`NoInfer<SvelteHTMLElements[${tn}]>`;else nn="HTMLAttributes<HTMLElement>";let an="[key: `data-${string}`]: unknown;",un=sn?`${Ya(sn)}
|
|
80
|
-
`:"",fn=O.canonicalPropsType?`type $Props${Kt} = (${O.canonicalPropsType}) & {${Ht}
|
|
81
|
-
|
|
82
|
-
${an}
|
|
83
|
-
};`:`type $Props${Kt} = {
|
|
84
|
-
${Ht}
|
|
85
|
-
|
|
86
|
-
${an}
|
|
87
|
-
};`,dn=tn?{name:Kt,ref:zt}:{name:"",ref:""},xn=O.extends===void 0?`keyof $Props${zt}`:`keyof ($Props${zt} & ${O.extends.interface})`,Rn=`Omit<$RestProps${dn.ref}, ${xn}>`,Yn=tn?`(${tn} extends any ? ${Rn} : never)`:Rn;return{props_name:Ft,prop_def:`
|
|
88
|
-
${un}type $RestProps${dn.name} = ${nn};
|
|
89
|
-
|
|
90
|
-
${fn}
|
|
91
|
-
|
|
92
|
-
export type ${Ft}${Kt} = ${Yn} & ${Xt}$Props${zt};
|
|
93
|
-
`}}let Zt;if(O.canonicalPropsType)Zt=`
|
|
94
|
-
${`
|
|
95
|
-
type $Props${Kt} = ${O.canonicalPropsType}${Ht.trim()===""?"":` & {${Ht}
|
|
96
|
-
}`};
|
|
97
|
-
`}
|
|
98
|
-
export type ${Ft}${Kt} = ${Xt}$Props${zt};
|
|
99
|
-
`;else if(O.extends===void 0)Zt=Ht.trim()===""?`
|
|
100
|
-
export type ${Ft}${Kt} = ${Os};
|
|
101
|
-
`:`
|
|
102
|
-
export type ${Ft}${Kt} = {
|
|
103
|
-
${Ht}
|
|
104
|
-
};
|
|
105
|
-
`;else Zt=`
|
|
106
|
-
type $Props${Kt} = {
|
|
107
|
-
${Ht}
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
export type ${Ft}${Kt} = ${Xt}$Props${zt};
|
|
111
|
-
`;return{props_name:Ft,prop_def:Zt}}function kh(O){return ji(O)?O:`[${O}]`}function Ph(O){let te=O.slots.filter((Je)=>!ji(Je.slot_props??""));if(te.length===0)return Os;let ve=te.map(({name:Je,slot_props:Gt,...Wt})=>{let Ht=Wt.default||Je===null?"default":Fn(Je??""),Ft=Ar(Wt.description,Wt.tags,Wt.deprecated);return`${Ft?`${Ft}
|
|
112
|
-
`:""}${Ht}: ${fi(Gt)};`}).join(`
|
|
113
|
-
`);return te.length===1?`{${ve}}`:`{
|
|
114
|
-
${ve}
|
|
115
|
-
}`}var $h=new Set(["click","dblclick","mousedown","mouseup","mousemove","mouseover","mouseout","mouseenter","mouseleave","contextmenu","wheel","keydown","keyup","keypress","submit","change","input","focus","blur","focusin","focusout","reset","select","touchstart","touchend","touchmove","touchcancel","drag","dragstart","dragend","dragover","dragenter","dragleave","drop","pointerdown","pointerup","pointermove","pointerover","pointerout","pointerenter","pointerleave","pointercancel","gotpointercapture","lostpointercapture","play","pause","ended","volumechange","timeupdate","loadeddata","loadedmetadata","canplay","canplaythrough","seeking","seeked","playing","waiting","stalled","suspend","abort","error","emptied","ratechange","durationchange","loadstart","progress","loadend","animationstart","animationend","animationiteration","animationcancel","transitionstart","transitionend","transitionrun","transitioncancel","scroll","resize","load","unload","beforeunload","cut","copy","paste","compositionstart","compositionupdate","compositionend"]);function wr(O=On){if(ch.test(O))return O;return`CustomEvent<${O}>`}function Ah(O){switch(O.type){case"dispatched":return wr(O.detail);case"forwarded":{let te=O.element,Je=!(te&&lh.test(te))||$h.has(O.name),Gt=O.detail!==void 0&&O.detail!=="undefined"&&!(O.detail==="null"&&Je),Wt=O.detail==="null"&&!Je;if(Gt||Wt)return wr(O.detail);return Je?`WindowEventMap["${O.name}"]`:wr()}default:return O}}function qa(O){if(O.events.length===0)return ph;let te=O.events.map((ve)=>{let Je=Ar(ve.description,ve.tags,ve.deprecated);return`${Je?`${Je}
|
|
116
|
-
`:""}${Fn(ve.name)}: ${Ah(ve)};
|
|
117
|
-
`}).join("");return O.events.length===1?`{${te}}`:`{
|
|
118
|
-
${te}}`}function Dh(O){let te=O.type==="() => any";if(O.type&&Xa.test(O.type)&&!te)return O.type;if(O.params&&O.params.length>0)return`(${y(O.params)}) => ${O.returnType||On}`;if(O.returnType)return`() => ${O.returnType}`;return O.type||On}function sp(O){return O.props.filter((te)=>te.isFunctionDeclaration||te.kind==="const").map((te)=>{let ve=vs(te.description,te.deprecated,te.tags);return`
|
|
119
|
-
${ss(ve)}
|
|
120
|
-
${Fn(te.name)}: ${Dh(te)};`}).join(`
|
|
121
|
-
`)}function Nh(O){let te=Ms(O.moduleName),ve=sp({props:O.props});if(ve.trim()==="")return{exports_name:te,exports_ref:te,exports_def:`export type ${te} = ${Os};`};let{declSuffix:Je,refSuffix:Gt}=ep(O.generics,ve);return{exports_name:te,exports_ref:`${te}${Gt}`,exports_def:`export type ${te}${Je} = {${ve}
|
|
122
|
-
};`}}function _h(O){return O.props.filter((te)=>te.bindable===!0||te.binding==="writable").map((te)=>JSON.stringify(te.name)).join(" | ")}function ip(O){return O==="default"?"$$Component":O}function Rh(O){let te=ip(O.moduleName),ve=O.bindings===Mn?'""':O.bindings;return`declare const ${te}: Component<
|
|
123
|
-
${O.propsRef},
|
|
124
|
-
${O.exportsRef},
|
|
125
|
-
${ve}
|
|
126
|
-
>;
|
|
127
|
-
export default ${te};`}function Ih(O){let te=ip(O.moduleName),ve=`${te}Component`,Je=O.bindings===Mn?'""':O.bindings,Gt=O.eventsRef?`$on?<K extends keyof ${O.eventsRef} & string>(type: K, callback: (e: ${O.eventsRef}[K]) => void): () => void;`:"$on?(type: string, callback: (e: any) => void): () => void;";return`interface ${ve} {
|
|
128
|
-
new ${O.generic}(
|
|
129
|
-
options: ComponentConstructorOptions<${O.propsRef}>
|
|
130
|
-
): SvelteComponent<${O.propsRef}${O.eventsRef?`, ${O.eventsRef}`:""}> & ${O.exportsRef};
|
|
131
|
-
${O.generic}(
|
|
132
|
-
this: void,
|
|
133
|
-
internals: ComponentInternals,
|
|
134
|
-
props: ${O.propsRef}
|
|
135
|
-
): {
|
|
136
|
-
${Gt}
|
|
137
|
-
$set?(props: Partial<${O.propsRef}>): void;
|
|
138
|
-
} & ${O.exportsRef};
|
|
139
|
-
element?: typeof HTMLElement;
|
|
140
|
-
z_$$bindings?: ${Je};
|
|
141
|
-
}
|
|
142
|
-
declare const ${te}: ${ve};
|
|
143
|
-
export default ${te};`}function Lh(O){if(O.extends===void 0)return"";return`import type { ${O.extends.interface} } from ${O.extends.import};`}function Oh(O){if(!O.componentComment)return"";if(!uh.test(O.componentComment))return kr(O.componentComment.trim());return`/*${S(O.componentComment).split(`
|
|
144
|
-
`).map((te)=>`* ${te}`).join(`
|
|
145
|
-
`)}
|
|
146
|
-
*/`}function Mh(O){let te=[],ve=new Map;for(let Je of O.moduleExports){if(Je.kind!=="re-export"||!Je.reExport)continue;let{from:Gt,imported:Wt}=Je.reExport,Ht=vs(Je.description,Je.deprecated,Je.tags),Ft=Fn(Je.name);if(Wt==="*"){let Xt=Je.name==="*"?"*":`* as ${Ft}`;te.push(`${ss(Ht)}
|
|
147
|
-
export ${Xt} from ${JSON.stringify(Gt)};`);continue}let Kt=`${Gt}\x00${Ht}`,zt=ve.get(Kt);if(!zt)zt={comments:Ht,from:Gt,specifiers:[]},ve.set(Kt,zt),te.push(Kt);zt.specifiers.push(Wt===Je.name?Ft:`${Fn(Wt)} as ${Ft}`)}return te.map((Je)=>{let Gt=ve.get(Je);if(!Gt)return Je;return`${ss(Gt.comments)}
|
|
148
|
-
export { ${Gt.specifiers.join(", ")} } from ${JSON.stringify(Gt.from)};`}).join(`
|
|
149
|
-
|
|
150
|
-
`)}function Dr(O){let te=[O.static?"static ":"",O.abstract?"abstract ":"",O.readonly?"readonly ":""].join(""),ve=O.optional?"?":"";if(O.kind==="property")return`${te}${Fn(O.name)}${ve}: ${O.type??On}`;let Je=y(O.params??[]);if(O.kind==="constructor")return`constructor(${Je})`;let Gt=O.typeParameters?`<${O.typeParameters}>`:"";return`${te}${Fn(O.name)}${ve}${Gt}(${Je}): ${O.returnType??On}`}function Fh(O,te){let ve=O.localName??O.name,Je=ve!==O.name,Gt=`export { ${ve}${Je?` as ${Fn(O.name)}`:""} };`;if(te.has(ve))return Gt;te.add(ve);let Wt=O.typeParameters?`<${O.typeParameters}>`:"",Ht=(O.members??[]).map((Xt)=>[ss(vs(Xt.description,Xt.deprecated,Xt.tags)),`${Dr(Xt)};`].filter(Boolean).join(`
|
|
151
|
-
`)).join(`
|
|
152
|
-
|
|
153
|
-
`),Ft=`${O.extends?` extends ${O.extends}`:""}${O.implements?.length?` implements ${O.implements.join(", ")}`:""}`,Kt=`${Je?"":"export "}declare ${O.abstract?"abstract ":""}class ${ve}${Wt}${Ft}`;return`
|
|
154
|
-
${[ss(vs(O.description,O.deprecated,O.tags)),Ht?`${Kt} {
|
|
155
|
-
${Ht}
|
|
156
|
-
}`:`${Kt} {}`,Je?Gt:""].filter(Boolean).join(`
|
|
157
|
-
`)}`}function jh(O){let te=Mh(O),ve=new Set,Je=O.moduleExports.filter((Gt)=>Gt.kind!=="re-export").map((Gt)=>{if(Gt.kind==="class")return Fh(Gt,ve);let Wt=!za.test(Gt.name),Ht=Wt?{...Gt,name:Bh(Gt.name)}:Gt,Ft=vs(Ht.description,Ht.deprecated,Ht.tags),Kt,zt=Ht.type!==void 0&&Xa.test(Ht.type),Xt=Ht.typeParameters?`<${Ht.typeParameters}>`:"";if(Ht.kind==="const"&&!zt)Kt=`export declare const ${Ht.name}: ${Ht.type||On};
|
|
158
|
-
`;else if(Ht.params&&Ht.params.length>0)Kt=`export declare function ${Ht.name}${Xt}(${y(Ht.params)}): ${Ht.returnType||On};`;else if(Ht.returnType)Kt=`export declare function ${Ht.name}${Xt}(): ${Ht.returnType};`;else if(zt&&Ht.type){let[Zt,Qt,...en]=Ht.type.split("=>"),tn=en.map((sn)=>` => ${sn.trim()}`).join("");Kt=`export declare function ${Ht.name}${Zt.trimEnd()}: ${Qt.trim()}${tn};`}else Kt=`export declare let ${Ht.name}: ${Ht.type||On};`;if(Wt)Kt=`${Kt.replace(yh,"").trimEnd()}
|
|
159
|
-
export { ${Ht.name} as ${JSON.stringify(Gt.name)} };`;return`
|
|
160
|
-
${ss(Ft)}
|
|
161
|
-
${Kt}`}).join(`
|
|
162
|
-
`);return[te,Je].filter(Boolean).join(`
|
|
163
|
-
|
|
164
|
-
`)}function Bh(O){return`__export_${O.replace(xh,"_")}`}var Vh=120;function Gh(O){let ve=`export default class ${O.moduleName==="default"?"":O.moduleName}${O.generic} extends SvelteComponentTyped<`,Je=[O.genericProps,O.events,O.slots];if(O.accessors.trim()===""&&Je.every((Gt)=>!Gt.includes(`
|
|
165
|
-
`))){let Gt=`${ve}${Je.join(", ")}> {}`;if(Gt.length<=Vh)return Gt}return`${ve}
|
|
166
|
-
${O.genericProps},
|
|
167
|
-
${O.events},
|
|
168
|
-
${O.slots}
|
|
169
|
-
> {
|
|
170
|
-
${O.accessors}
|
|
171
|
-
}`}function Es(O){return`${O}Props`}function Ms(O){return`${O}Exports`}function Nr(O){return{format:O.format}}var Wh={format:"class"};function rp(O){let te=Nr(O??{}),ve={};for(let[Je,Gt]of Object.entries(te))ve[Je]=Gt??Wh[Je];return JSON.stringify(ve)}function _r(O,te){let ve=To(O),{moduleName:Je,typedefs:Gt,generics:Wt,props:Ht,moduleExports:Ft,slots:Kt,events:zt,rest_props:Xt,extends:Zt,componentComment:Qt,contexts:en}=O,tn=te?.format==="component",sn=Wt!==null,{props_name:nn,prop_def:an}=Th({moduleName:Je,props:Ht,rest_props:Xt,extends:Zt,generics:Wt,slots:Kt,canonicalPropNames:new Set(ve?.canonicalPropNames??[]),canonicalPropsType:ve?.canonicalPropsType}),un=Wt?`<${Wt[1]}>`:"",fn=Wt?`${nn}<${Wt[0]}>`:nn,dn=tn&&zt.length>0?`type $Events${un} = ${qa({events:zt})};`:"",xn=Wt?`$Events<${Wt[0]}>`:"$Events",Rn=tn&&(sn||dn!==""),Yn=jh({moduleExports:Ft}),En=mi({typedefs:Gt}),ps=tp({contexts:en,generics:Wt}),Eo=(ve?.typeImportStatements??[]).join(`
|
|
172
|
-
`),So=[...ve?.localTypeDeclarations??[],...ve?.moduleTypeDeclarations??[]].join(`
|
|
173
|
-
|
|
174
|
-
`),{exports_ref:bo,exports_def:Co}=tn?Nh({props:Ht,moduleName:Je,generics:Wt}):{exports_ref:Mn,exports_def:Mn},wo=tn?_h({props:Ht}):Mn,Ri=!mh.test(Eo)&&(xs.test(an)||xs.test(Yn)||xs.test(En)||xs.test(ps)||xs.test(So)||xs.test(Co)),vc=Xt?.type==="Element"&&(Xt.name!=="svelte:element"||Xt.thisValue||Xt.thisType),Ec=Xt?.type==="Element"&&Xt.name==="svelte:element"&&!Xt.thisValue&&!Xt.thisType,Sc=[tn?Rn?`import type { SvelteComponent, ComponentConstructorOptions, ComponentInternals${Ri?", Snippet":""} } from "svelte";`:`import type { Component${Ri?", Snippet":""} } from "svelte";`:`import { SvelteComponentTyped${Ri?", type Snippet":""} } from "svelte";`,vc?'import type { SvelteHTMLElements } from "svelte/elements";':"",Ec?'import type { HTMLAttributes } from "svelte/elements";':"",Eo,Lh({extends:Zt})].filter(Boolean).join(`
|
|
175
|
-
`),bc=tn?Rn?Ih({moduleName:Je,generic:un,propsRef:fn,exportsRef:bo,bindings:wo,...dn?{eventsRef:xn}:{}}):Rh({moduleName:Je,propsRef:fn,exportsRef:bo,bindings:wo}):Gh({moduleName:Je,generic:un,genericProps:fn,events:qa({events:zt}),slots:Ph({slots:Kt}),accessors:sp({props:Ht})}),Cc=[Yn,En,So,ps,an,Co,dn,[Oh({componentComment:Qt}),bc].filter(Boolean).join(`
|
|
176
|
-
`)].map((wc)=>wc.trim()).filter(Boolean).join(`
|
|
177
|
-
|
|
178
|
-
`);return Ga([Sc,Cc].filter(Boolean).join(`
|
|
179
|
-
|
|
180
|
-
`))}var Kh=[...gs,".svelte"];function Hh(O){let te=O.trim();if(te.length<2)return;let ve=te[0],Je=te[te.length-1];if((ve==='"'||ve==="'"||ve==="`")&&ve===Je)return te.slice(1,-1);return}function op(O){let te=[],ve=O.moduleExports.filter((Gt)=>Gt.kind==="re-export");if(ve.length===0)return te;let Je=new Set([Es(O.moduleName),Ms(O.moduleName)]);for(let Gt of ve){if(!Je.has(Gt.name))continue;te.push(o({component:O.filePath,kind:"module-export-conflict",name:Gt.name,message:`Re-export "${Gt.name}" has the same name as the generated "${Gt.name}" type; the .d.ts won't type-check if "${Gt.reExport?.from}" exports a type by that name.`,source:Gt.source}))}return te}function ap(O,te,ve){let Je=new Map(Array.from(O.values()).map((Gt)=>[te(Gt.filePath),Gt]));return(Gt)=>{let Wt=Gt.extends;if(!Wt)return[];let Ht=Hh(Wt.import);if(Ht===void 0||!Ht.startsWith(".")&&!Ht.startsWith("/"))return[];let Ft=te(Gt.filePath),Kt=ve.resolve(Ht,Uh(Ft),Kh);if(Kt===null)return[o({component:Gt.filePath,kind:"extend-props-target-missing",name:Wt.interface,message:`@extends/@extendProps target "${Ht}" was not found on disk.`})];let zt=Je.get(Kt);if(!zt)return[];let Xt=Es(zt.moduleName);if(Wt.interface!==Xt)return[o({component:Gt.filePath,kind:"extend-props-target-missing",name:Wt.interface,message:`@extends/@extendProps names "${Wt.interface}", but "${Ht}" generates "${Xt}".`})];let Zt=[];for(let Qt of Gt.props){let en=zt.props.find((tn)=>tn.name===Qt.name);if(en&&en.type!==Qt.type)Zt.push(o({component:Gt.filePath,kind:"extend-props-override",name:Qt.name,message:`Own prop "${Qt.name}" (${Qt.type}) overrides "${Xt}"'s "${Qt.name}" (${en.type}).`}))}return Zt}}import{lstatSync as yd,readFileSync as xd,realpathSync as vd,statSync as Ed}from"node:fs";import{dirname as Sd,isAbsolute as bd,join as Ep,parse as Cd,relative as Vr,resolve as vi}from"node:path";function ee(O){return O}function qn(O){if(O==="")return O;return O.startsWith(".")?O:`./${O}`}import{readFileSync as xp}from"node:fs";import{dirname as jr,join as md,relative as mp,resolve as gp}from"node:path";import{readFileSync as od,statSync as ad}from"node:fs";import{basename as Fr,dirname as xi,isAbsolute as pd,join as cd,resolve as ld}from"node:path";import{existsSync as qh,readdirSync as zh}from"node:fs";import{join as Xh}from"node:path";function pp(O){return O.normalize("NFC").toLowerCase()}class Rr{listings=new Map;clear(){this.listings.clear()}entries(O){return this.read(O)?.entries??null}entry(O,te){let ve=this.read(O);if(ve===null)return;if(ve.byName===void 0){ve.byName=new Map;for(let Je of ve.entries)ve.byName.set(Je.name,Je)}return ve.byName.get(te)}has(O,te){let ve=this.read(O);if(ve===null)return!1;if(ve.names.has(te))return!0;if(ve.folded===void 0){ve.folded=new Map;for(let Gt of ve.names)ve.folded.set(pp(Gt),Gt)}let Je=ve.folded.get(pp(te));return Je!==void 0&&Je!==te&&qh(Xh(O,te))}read(O){let te=this.listings.get(O);if(te!==void 0)return te;try{let ve=zh(O,{withFileTypes:!0}),Je=new Set;for(let Gt of ve)Je.add(Gt.name);te={entries:ve,names:Je}}catch{te=null}return this.listings.set(O,te),te}}var Ir=!1;function V(O){Ir=O}function Gn(O){if(!Ir)console.error(O)}function cp(O){if(!Ir)console.error(O)}function we(O){if(O instanceof e)return O.start?`${O.reason} (${O.start.line}:${O.start.column})`:O.reason;return O instanceof Error?O.message:String(O)}var Fs=null,Lr=null;function zn(){if(Fs)return Promise.resolve(Fs);if(!Lr)Lr=import("./chunk-qfbb8a3r.js").then((O)=>(Fs=O,O));return Lr}function Nn(){if(!Fs)throw Error("sveld: internal error, parser stack read before loadParserStack() resolved.");return Fs}import{existsSync as gi,readFileSync as Jh}from"node:fs";import{dirname as Or,isAbsolute as Yh,join as Qh,relative as Zh,resolve as yi}from"node:path";function lp(O){if(!i(O))return{};let te={};if(typeof O.svelte==="string")te.svelte=O.svelte;if(typeof O.name==="string")te.name=O.name;if(typeof O.description==="string")te.description=O.description;return te}function up(O){if(!i(O))return{};let te={};if(typeof O.extends==="string")te.extends=O.extends;if(i(O.compilerOptions)){let ve={};if(typeof O.compilerOptions.baseUrl==="string")ve.baseUrl=O.compilerOptions.baseUrl;if(i(O.compilerOptions.paths)){let Je={};for(let[Gt,Wt]of Object.entries(O.compilerOptions.paths))if(Array.isArray(Wt)&&Wt.every((Ht)=>typeof Ht==="string"))Je[Gt]=Wt;if(Object.keys(Je).length>0)ve.paths=Je}if(Object.keys(ve).length>0)te.compilerOptions=ve}return te}var hp=new Map,ed=/\/\*[\s\S]*?\*\/|\/\/.*/g,td=/[.+?^${}()|[\]\\]/g,nd=[".svelte",...gs];class U extends Error{specifier;fromFile;searched;constructor(O,te,ve){super(`cannot resolve "${O}" from ${te||"."} (${ve})`);this.name="UnresolvedModuleError",this.specifier=O,this.fromFile=te,this.searched=ve}}function sd(O){if(gi(O))return!0;return nd.some((te)=>gi(O+te))}function dp(O){let te=O.indexOf("*");return te===-1?O.length:te}function id(O){let te=O,ve=yi(te,"/");while(te!==ve){for(let Je of["tsconfig.json","jsconfig.json"]){let Gt=Qh(te,Je);if(gi(Gt))return Gt}te=Or(te)}return null}function fp(O,te){if(te.has(O))return te.get(O)??null;try{let ve=Jh(O,"utf-8"),Je;try{Je=JSON.parse(ve)}catch{let Wt=ve.replace(ed,"");Je=JSON.parse(Wt)}let Gt=up(Je);if(Gt.extends){let Wt=Yh(Gt.extends)?Gt.extends:yi(Or(O),Gt.extends),Ht=Wt.endsWith(".json")?Wt:`${Wt}.json`;if(gi(Ht)){let Ft=fp(Ht,te);if(Ft)Gt.compilerOptions={...Ft.compilerOptions,...Gt.compilerOptions,paths:{...Ft.compilerOptions?.paths,...Gt.compilerOptions?.paths}}}}return te.set(O,Gt),Gt}catch{return te.set(O,null),null}}function rd(O){let te=hp.get(O);if(!te){let ve=O.split("*").map((Je)=>Je.replace(td,"\\$&")).join("(.*)");te=new RegExp(`^${ve}$`),hp.set(O,te)}return te}class Mr{configs=new Map;lookup(O,te){if(O.startsWith(".")||O.startsWith("/"))return{resolved:O,unresolved:!1,searched:""};let ve=id(te),Je=ve?fp(ve,this.configs)?.compilerOptions:void 0,Gt=Je?.paths;if(!ve||!Je||!Gt)return{resolved:O,unresolved:!0,searched:"no tsconfig/jsconfig paths found"};let Wt=yi(Or(ve),Je.baseUrl??"."),Ht=Object.entries(Gt).sort(([Ft],[Kt])=>dp(Kt)-dp(Ft));for(let[Ft,Kt]of Ht){let zt=O.match(rd(Ft));if(!zt)continue;let Xt;for(let Zt of Kt){let Qt=Zt;for(let tn=1;tn<zt.length;tn++)Qt=Qt.replace("*",zt[tn]);let en=yi(Wt,Qt);if(Xt??=en,sd(en))return{resolved:en,unresolved:!1,searched:ve}}return{resolved:Xt??O,unresolved:!1,searched:ve}}return{resolved:O,unresolved:!0,searched:`tsconfig paths (${ve})`}}absolute(O,te){return this.lookup(O,te).resolved}relative(O,te){let ve=this.absolute(O,te);if(ve===O)return O;let Je=n(Zh(te,ve));return Je.startsWith(".")?Je:`./${Je}`}}var ud=/\.[mc]?jsx?$/,hd={".js":[".ts",".tsx",".d.ts"],".jsx":[".tsx",".d.ts"],".mjs":[".mts",".d.mts"],".cjs":[".cts",".d.cts"]};function dd(O){return O==="."||O===".."||O.startsWith("./")||O.startsWith("../")||pd(O)}class Xn{aliases=new Mr;listings=new Rr;modules=new Map;programs=new Map;listDirectory(O){return this.listings.entries(O)}exists(O){return this.listings.has(xi(O),Fr(O))}resolve(O,te,ve=gs){let Je=this.aliases.absolute(O,te);if(Je===O&&!dd(O))return null;let Gt=ld(te,Je),Wt=xi(Gt),Ht=Fr(Gt),Ft=this.listings.has(Wt,Ht),Kt;if(Ft){let zt=this.listings.entry(Wt,Ht);if(Kt=zt&&!zt.isSymbolicLink()?zt:ad(Gt,{throwIfNoEntry:!1}),Kt?.isFile())return Gt}for(let zt of ve)if(this.listings.has(Wt,Ht+zt))return Gt+zt;if(!Ft)return this.typeScriptCounterpart(Gt)??null;if(Kt?.isDirectory()){for(let zt of ve)if(this.listings.has(Gt,`index${zt}`))return cd(Gt,`index${zt}`)}return null}parse(O){let te=this.modules.get(O);if(te===void 0)te=fd(O),this.modules.set(O,te);return te}parseJavaScript(O,te){let ve=this.programs.get(O);if(ve?.source===te)return ve.ast;let Je;try{Je=xe(te)}catch(Gt){throw Error(we(Gt))}return this.programs.set(O,{source:te,ast:Je}),Je}invalidate(...O){this.listings.clear();for(let te of O)this.modules.delete(te),this.programs.delete(te)}typeScriptCounterpart(O){let te=ud.exec(O)?.[0];if(te===void 0)return;let ve=O.slice(0,-te.length),Je=xi(ve),Gt=Fr(ve);for(let Wt of hd[te]??[])if(this.listings.has(Je,Gt+Wt))return ve+Wt;return}}function fd(O){let te;try{te=od(O,"utf-8")}catch{return null}try{let ve=O.endsWith(".svelte")?Nn().parseSvelteScripts(te).module?.content.body??[]:Nn().parseModule(te,{typescript:!0}).body;return{source:{text:te,filePath:O,dir:xi(O)},body:ve}}catch(ve){return cp(`Warning: sveld couldn't parse ${O} to read its exports (${we(ve)}); skipping it.`),null}}function yp(O){return O.type==="Identifier"?O.name:O.value}function gd(O,te,ve,Je){let Gt=O.resolve(te,ve);if(!Gt)return null;let Wt=jr(Gt);if(Je.has(Gt))return{dir:Wt,exports:{}};Je.add(Gt);try{return{dir:Wt,exports:Br(O,xp(Gt,"utf-8"),Wt,Je,Gt)}}catch{return{dir:Wt,exports:{}}}finally{Je.delete(Gt)}}function vp(O,te,ve=new Xn,Je=new Set){return Br(ve,O,te,Je,te)}function Br(O,te,ve,Je,Gt){let Wt=O.parseJavaScript(Gt,te),Ht={};for(let Ft of Wt.body)if(Ft.type==="ExportDefaultDeclaration"){if(Ft.declaration.type!=="Identifier")continue;let Kt=Ft.declaration.name;if(Kt in Ht)Ht[Kt].default=!0;else Ht[Kt]={source:qn(""),default:!0}}else if(Ft.type==="ExportAllDeclaration"){let Kt=Ft.source.value,zt=O.resolve(Kt,ve);if(!zt){let Qt=O.aliases.lookup(Kt,ve);throw new U(Kt,Gt,Qt.unresolved?Qt.searched:"no matching file or index found")}if(Je.has(zt))continue;Je.add(zt);let Xt=xp(zt,"utf-8"),Zt=Br(O,Xt,jr(zt),Je,zt);Je.delete(zt);for(let[Qt,en]of Object.entries(Zt)){let tn=qn(n(en.source.startsWith(".")?`./${mp(ve,gp(jr(zt),en.source))}`:`./${md(Kt,en.source)}`));Ht[Qt]={...en,source:tn}}}else if(Ft.type==="ExportNamedDeclaration"){let Kt=Ft.source?.value,zt=Kt!==void 0&&Ln.test(Kt);if(zt){let Qt=O.aliases.lookup(Kt,ve);if(Qt.unresolved)throw new U(Kt,Gt,Qt.searched)}let Zt=Kt!==void 0&&!zt?gd(O,Kt,ve,Je):void 0;if(Zt===null){console.warn(`sveld: could not resolve re-exported module "${Kt}" from barrel "${ve||"."}"; skipping.`);continue}for(let Qt of Ft.specifiers){let en=yp(Qt.exported),tn=yp(Qt.local),sn=en||tn,nn=Zt?.exports[tn],an=nn?qn(n(`./${mp(ve,gp(Zt.dir,nn.source))}`)):qn(O.aliases.relative(Kt??"",ve)),un=nn?nn.default:tn==="default";if(sn in Ht){if(Ht[sn].mixed=!0,!Ht[sn].source)Ht[sn].source=an}else Ht[sn]={source:an,default:un}}}else if(Ft.type==="ImportDeclaration"){let Kt=Ft.specifiers[0];if(!Kt)continue;let zt=Kt.local.name,Xt=qn(O.aliases.relative(Ft.source.value,ve));if(zt in Ht){if(!Ht[zt].source)Ht[zt].source=Xt}else Ht[zt]={source:Xt,default:zt==="default"}}return Ht}var wd=/-/g,Td=/[^A-Za-z0-9_$]/g,kd=/^[0-9]/;function Pd(O,te){let ve=O.replace(Td,""),Je=kd.test(ve)?`_${ve}`:ve;if(Je!==O&&!te?.has(O))te?.add(O),console.warn(`Warning: "${O}" is not a valid identifier; using "${Je}" instead.`);return Je}function Sp(O,te){return Pd(Cd(O).name.replace(wd,""),te)}function bp(O,te,ve=[],Je=new Set,Gt){let Wt;try{Wt=Gt??vd(te)}catch{return ve}if(Je.has(Wt))return ve;Je.add(Wt);let Ht=O.listDirectory(te);if(Ht===null)return ve;for(let Ft of Ht){if(Ft.name.startsWith("."))continue;let Kt=Ep(te,Ft.name),zt=Ft.isSymbolicLink(),Xt=zt?Ed(Kt,{throwIfNoEntry:!1}):Ft;if(!Xt)continue;if(Xt.isDirectory())bp(O,Kt,ve,Je,zt?void 0:Ep(Wt,Ft.name));else if(Xt.isFile()&&Ft.name.endsWith(".svelte"))ve.push(Kt)}return ve}function $d(O,te){return bp(O,te).map((ve)=>({moduleName:Sp(ve),source:qn(n(`./${Vr(te,ve)}`))})).sort((ve,Je)=>l(ve.source,Je.source))}function Ad(O){return!ys(O)}function Dd(O,te){let ve=O.endsWith("/")?O:`${O}/`;return te.startsWith(ve)}function Ei(O,te){return{seenPaths:new Set(O.map(([,ve])=>te(ve.source))),seenModuleNamePaths:new Map(O.map(([ve,Je])=>[ve,te(Je.source)])),warnedModuleNames:new Set}}function Gr(O,te,ve,Je,Gt,Wt){for(let{moduleName:Ht,source:Ft}of $d(O,te)){let Kt=Gt(Ft),zt=ve[Ht];if(zt&&Ad(zt.source)&&Dd(zt.source,Ft)){Wt.seenPaths.delete(Gt(zt.source)),zt.source=Ft,Wt.seenPaths.add(Kt),Wt.seenModuleNamePaths.set(Ht,Kt);continue}if(Wt.seenPaths.has(Kt))continue;Wt.seenPaths.add(Kt);let Xt=Wt.seenModuleNamePaths.get(Ht);if(Xt===void 0)Wt.seenModuleNamePaths.set(Ht,Kt);else if(Xt!==Kt&&!Wt.warnedModuleNames.has(Ht))Wt.warnedModuleNames.add(Ht),console.warn(`Warning: multiple components named "${Ht}" found (${n(Vr(te,Xt))} and ${n(Vr(te,Kt))}). Both are included in TypeScript definitions, but only one can be the named export.`);Je.push([Ht,{source:Ft,default:!1}])}}function Wr(O,te,ve,Je){let Gt=yd(O).isFile(),Wt=Gt?Sd(O):O,Ht=vi(Wt),Ft=new Map,Kt=(Zt)=>{let Qt=Ft.get(Zt);if(Qt===void 0)Qt=bd(Zt)?vi(Zt):vi(Ht,Zt),Ft.set(Zt,Qt);return Qt},zt={};if(Gt){let Zt=xd(O,"utf-8");try{zt=vp(Zt,Ht,Je,new Set([vi(O)]))}catch(Qt){if(!ve)throw Qt;let en=Qt instanceof Error?Qt.message:String(Qt);console.warn(`Warning: Failed to parse component exports from ${O}: ${en}`)}}let Xt=Object.entries(zt);if(te){let Zt=Ei(Xt,Kt);if(Gr(Je,Ht,zt,Xt,Kt,Zt),!Gt)zt=Object.fromEntries(Xt.map(([Qt,en])=>[Qt,{...en,default:!0}]))}return{exports:zt,allComponentEntries:Xt,rootDir:Ht,resolveComponentFilePath:Kt}}function Ur(O,te,ve,Je){if(ve!==1||O!=="default")return O;return Sp(te,Je)}import{resolve as Nd}from"node:path";var _d=/\r?\n/,Rd=/^\s*\*+/;function Si(O){return{graph:O,cache:new Map,computing:new Set}}function Sn(O){return O?.type==="Identifier"?O.name:void 0}function Id(O){let te=O.trimEnd();for(;;){let ve=te.lastIndexOf(`
|
|
181
|
-
`)+1;if(te.slice(ve).trimStart().startsWith("//")){te=te.slice(0,ve).trimEnd();continue}let Je=te.endsWith("*/")?te.lastIndexOf("/*",te.length-3):-1;if(Je!==-1&&te[Je+2]!=="*"){te=te.slice(0,Je).trimEnd();continue}return te}}function Ld(O,te){let ve=Id(O.slice(0,te));if(!ve.endsWith("*/"))return;let Je=ve.length-2,Gt=ve.lastIndexOf("/**",Je);if(Gt===-1)return;return ve.slice(Gt,Je+2)}function Od(O){let te=[];for(let ve of O.slice(3,-2).split(_d)){let Je=ve.replace(Rd,"").trim();if(Je.startsWith("@"))break;if(Je)te.push(Je)}return te.join(" ")||void 0}function is(O,te){if(!te)return;return O.text.slice(te.start,te.end)}function Md(O,te){return"typeAnnotation"in te?is(O,te.typeAnnotation?.typeAnnotation):void 0}function Kr(O,te){return is(O,te.returnType?.typeAnnotation)}function Hr(O,te){let ve=te.params.map((Gt)=>is(O,Gt)??"").join(", "),Je=Kr(O,te);return`(${ve})${Je?` => ${Je}`:""}`}function Tp(O){if(O.type==="Literal"){let te=O.value;if(typeof te==="string")return"string";if(typeof te==="number")return"number";if(typeof te==="boolean")return"boolean"}if(O.type==="TemplateLiteral")return"string";return}function Fd(O,te){let ve=is(O,te);if(ve===void 0)return;if(te.type==="Literal"){let Gt=te.value;if(typeof Gt==="string"||typeof Gt==="number"||typeof Gt==="boolean")return{raw:ve,value:Gt,type:typeof Gt};return}if(te.type==="UnaryExpression"&&te.operator==="-"){let Gt=te.argument;if(Gt.type==="Literal"&&typeof Gt.value==="number")return{raw:ve,value:-Gt.value,type:"number"};return}let Je=te.type==="TemplateLiteral"?v(te):null;return Je===null?void 0:{raw:ve,value:Je,type:"string"}}function jd(O,te){if(O.type!=="CallExpression"&&O.type!=="NewExpression")return;let ve=O.callee;if(!(Sn(ve)==="Symbol"||ve.type==="MemberExpression"&&!ve.computed&&Sn(ve.object)==="Symbol"&&Sn(ve.property)==="for"))return;return v(O.arguments[0])||te}var Bd=new Set(["any","bigint","boolean","false","never","null","number","object","readonly","string","symbol","true","undefined","unknown","void"]),Vd=/"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'/g,Gd=/(?<![\w$.])[A-Za-z_$][\w$]*(?![\w$]|\s*\??:)/g;function Wd(O,te){let ve=te?Nn().getCommentTags(E(te)).type?.type.trim():void 0,Je=O?{type:O,source:"typescript"}:ve?{type:ve,source:"jsdoc"}:void 0;if(!Je||Je.type.includes("`"))return;return(Je.type.replace(Vd,'""').match(Gd)??[]).every((Wt)=>Bd.has(Wt))?Je:void 0}function Cp(O){if(O.async||O.generator||O.type==="TSDeclareFunction")return;let te=O.body,ve=te.type==="BlockStatement"?fe(te):[te];if(ve.length===0)return;let Je;for(let Gt of ve){if(!Gt)return;let Wt=Tp(Gt);if(!Wt)return;if(Je===void 0)Je=Wt;else if(Je!==Wt)return}return Je}function Ud(O){let te=O.initializer;if(!te)return;if(te.type==="Literal"){let ve=te.value;return typeof ve==="string"||typeof ve==="number"?ve:void 0}if(te.type==="UnaryExpression"&&te.operator==="-"){let ve=te.argument;if(ve.type==="Literal"&&typeof ve.value==="number")return-ve.value}return}function Kd(O){let te=O.members;if(te.length===0)return;let ve=[],Je=0;for(let Gt of te){if(!Gt.initializer){ve.push(String(Je)),Je+=1;continue}let Wt=Ud(Gt);if(Wt===void 0)return;ve.push(typeof Wt==="string"?JSON.stringify(Wt):String(Wt)),Je=typeof Wt==="number"?Wt+1:Je}return ve.join(" | ")}function qr(O,te,ve,Je){let Gt=Ld(O.text,ve),Wt=Gt?Od(Gt):void 0,Ht=Gt?Nn().extractJsDocReturnType(Gt):void 0,{deprecated:Ft,tags:Kt,internal:zt}=Gt?Nn().extractJsDocDeprecatedAndTags(Gt):{deprecated:void 0,tags:void 0,internal:!1},Xt={description:Wt,deprecated:Ft,tags:Kt,...zt?{internal:!0}:{},declFile:O.filePath};if(te.type==="VariableDeclaration"){let Zt=te.kind==="let"||te.kind==="var"?te.kind:"const",Qt=[];for(let en of te.declarations){let tn=en.id,sn=Sn(tn);if(!sn)continue;let nn=Md(O,tn),an=nn,un,fn,dn,xn,Rn,Yn,En=en.init;if(En)if(En.type==="ArrowFunctionExpression"||En.type==="FunctionExpression"){if(Yn=En,!an)an=Hr(O,En);fn=Kr(O,En)??Ht??se(an)??Cp(En)}else{if(un=is(O,En),!an)an=Tp(En);let ps=w(En);if(dn=v(ps)??jd(ps,sn),Zt==="const")xn=Fd(O,ps),Rn=Wd(nn,Gt)}Qt.push({name:sn,kind:Zt,type:an,value:un,returnType:fn,literalValue:dn,primitiveLiteral:xn,declaredType:Rn,functionNode:Yn,...Xt,isTypeOnly:!1})}return Qt}if(te.type==="FunctionDeclaration"||te.type==="TSDeclareFunction"){let Zt=Sn(te.id)??Je;if(!Zt)return[];return[{name:Zt,kind:"function",type:Hr(O,te),returnType:Kr(O,te)??Ht??Cp(te),...te.type==="FunctionDeclaration"?{functionNode:te}:{},...Xt,isTypeOnly:!1}]}if(te.type==="ClassDeclaration"){let Zt=Sn(te.id),Qt=Zt??Je;if(!Qt)return[];return[{name:Qt,kind:"class",...Zt?{type:Zt}:{},...Xt,isTypeOnly:!1}]}if(te.type==="TSTypeAliasDeclaration"){let Zt=Sn(te.id);if(!Zt)return[];return[{name:Zt,kind:"type",type:is(O,te.typeAnnotation),...Xt,isTypeOnly:!0}]}if(te.type==="TSInterfaceDeclaration"){let Zt=Sn(te.id);if(!Zt)return[];return[{name:Zt,kind:"interface",type:is(O,te.body),...Xt,isTypeOnly:!0}]}if(te.type==="TSEnumDeclaration"){let Zt=Sn(te.id);if(!Zt)return[];return[{name:Zt,kind:"enum",type:Kd(te)??Zt,...Xt,isTypeOnly:!1}]}return[]}function Hd(O,te,ve){let Je=te.declaration;if(Je.type==="FunctionDeclaration"||Je.type==="TSDeclareFunction"||Je.type==="ClassDeclaration"){let[Ht]=qr(O,Je,te.start,"default");return Ht?{...Ht,name:"default"}:void 0}if(Je.type==="FunctionExpression"||Je.type==="ArrowFunctionExpression")return{name:"default",kind:"function",type:Hr(O,Je),functionNode:Je,declFile:O.filePath,isTypeOnly:!1};let Gt=Sn(Je),Wt=Gt?ve(Gt):null;return Wt?{...Wt,name:"default"}:void 0}function qd(O,te){for(let ve of O){if(ve.type!=="ImportDeclaration")continue;let Je=ve.source.value;for(let Gt of ve.specifiers){if(Gt.local.name!==te)continue;let Wt=ve.importKind==="type"||Gt.type==="ImportSpecifier"&&Gt.importKind==="type";if(Gt.type==="ImportDefaultSpecifier")return{specifier:Je,importedName:"default",isTypeOnly:Wt};if(Gt.type==="ImportNamespaceSpecifier")return{specifier:Je,importedName:"*",isTypeOnly:Wt};if(Gt.type==="ImportSpecifier"){let Ht=Sn(Gt.imported)??te;return{specifier:Je,importedName:Ht,isTypeOnly:Wt}}}}return null}function wp(O,te,ve){return{name:O,kind:"const",declFile:te,namespaceFile:te,isTypeOnly:ve}}function bi(O,te){let ve=te.cache.get(O);if(ve)return ve;if(te.computing.has(O))return[];te.computing.add(O);let Je=te.graph.parse(O);if(!Je)return te.computing.delete(O),te.cache.set(O,[]),[];let{source:Gt,body:Wt}=Je,Ht=[],Ft=new Map;for(let Qt of Wt){let en=Qt.type==="ExportNamedDeclaration"?Qt.declaration:Qt;if(!en)continue;for(let tn of qr(Gt,en,en.start))Ft.set(tn.name,tn)}let Kt=(Qt,en)=>({name:Qt,kind:"const",declFile:Nd(Gt.dir,en),isTypeOnly:!1}),zt=(Qt)=>{let en=Ft.get(Qt);if(en)return en;let tn=qd(Wt,Qt);if(!tn)return null;if(tn.specifier.endsWith(".svelte"))return Kt(Qt,tn.specifier);let sn=te.graph.resolve(tn.specifier,Gt.dir);if(!sn)return null;if(tn.importedName==="*")return wp(Qt,sn,tn.isTypeOnly);return rs(sn,tn.importedName,te)??null},Xt=new Map;for(let Qt of Wt){if(Qt.type==="ExportAllDeclaration"){let nn=Qt.source.value;if(nn.endsWith(".svelte"))continue;let an=te.graph.resolve(nn,Gt.dir);if(!an)continue;let un=Qt.exportKind==="type",fn=Sn(Qt.exported);if(fn){Ht.push(wp(fn,an,un));continue}for(let dn of bi(an,te)){let xn=Xt.get(dn.name)??[];xn.push(un?{...dn,isTypeOnly:!0}:dn),Xt.set(dn.name,xn)}continue}if(Qt.type==="ExportDefaultDeclaration"){let nn=Hd(Gt,Qt,zt);if(nn)Ht.push(nn);continue}if(Qt.type!=="ExportNamedDeclaration")continue;let en=Qt.declaration;if(en){Ht.push(...qr(Gt,en,Qt.start));continue}let tn=Qt.source?.value;if(tn?.endsWith(".svelte")){for(let nn of Qt.specifiers){let an=Sn(nn.exported);if(an)Ht.push(Kt(an,tn))}continue}let sn=Qt.exportKind==="type";for(let nn of Qt.specifiers){let an=Sn(nn.exported),un=Sn(nn.local);if(!an||!un)continue;let fn=sn||nn.exportKind==="type",dn=null;if(tn){let xn=te.graph.resolve(tn,Gt.dir);if(xn)dn=rs(xn,un,te)??null}else dn=zt(un);if(dn)Ht.push({...dn,name:an,isTypeOnly:dn.isTypeOnly||fn});else if(un!=="default")Ht.push({name:an,kind:fn?"type":"const",declFile:O,isTypeOnly:fn})}}let Zt=new Set(Ht.map((Qt)=>Qt.name));for(let[Qt,en]of Xt){if(Zt.has(Qt)||Qt==="default")continue;if(en.every((tn)=>tn.declFile===en[0].declFile))Ht.push(...en);else te.onAmbiguousStarExport?.(O,Qt,en)}return te.computing.delete(O),te.cache.set(O,Ht),Ht}function rs(O,te,ve){return bi(O,ve).findLast((Je)=>Je.name===te)}function Ss(O,{importedName:te,members:ve=[]},Je){let Gt=rs(O,te,Je);for(let Wt of ve){if(Gt?.namespaceFile===void 0)return;Gt=rs(Gt.namespaceFile,Wt,Je)}return Gt}import{dirname as zd}from"node:path";function Jn(O,te,ve){if(O[te]===void 0)delete O[te];O[te]=ve}function Ci(O,te){return(te.location==="props"?O.props:O.moduleExports).find((Je)=>Je.name===te.propName)}function wi(O,te){if(te.location!=="props")return;O.diagnostics=(O.diagnostics??[]).filter((ve)=>!(ve.kind==="prop-unknown-type"&&ve.name===te.propName))}var Xd=/\.[^./\\]+$/;function Jd(O,te){if(O.endsWith(".d.ts"))return null;let ve=O.replace(Xd,".d.ts");return te.exists(ve)?ve:null}function Yd(O,te,ve){let Je=zd(O);return te.map((Gt)=>{if(!Gt.importSource||!Gt.importedName)return{candidate:Gt};let Wt=ve.graph.resolve(Gt.importSource,Je);if(!Wt)return{candidate:Gt,failureReason:"module-not-found"};let Ht=rs(Wt,Gt.importedName,ve);if(!Ht)return{candidate:Gt,failureReason:"export-not-found"};if(Ht.returnType)return{candidate:Gt,type:Ht.returnType};let Ft=Jd(Wt,ve.graph);if(Ft){let Kt=rs(Ft,Gt.importedName,ve);if(Kt?.returnType)return{candidate:Gt,type:Kt.returnType}}return{candidate:Gt,failureReason:"return-type-unresolved"}})}function Qd(O,te){switch(te){case"module-not-found":return`Prop "${O.propName}" default calls "${O.calleeName}()", but "${O.importSource}" could not be resolved; falling back to "any".`;case"export-not-found":return`Prop "${O.propName}" default calls "${O.calleeName}()", but "${O.importedName}" is not exported from "${O.importSource}"; falling back to "any".`;case"return-type-unresolved":return`Prop "${O.propName}" default calls "${O.calleeName}()" imported from "${O.importSource}", but its return type could not be resolved; falling back to "any".`}}function Zd(O,te){for(let{candidate:ve,type:Je,failureReason:Gt}of te){let Wt=Ci(O,ve);if(Wt?.typeSource!=="unknown")continue;if(Je){Jn(Wt,"type",Je),Jn(Wt,"typeSource","typescript"),wi(O,ve);continue}if(ve.location==="props"&&Gt){let Ht=O.diagnostics?.find((Ft)=>Ft.kind==="prop-unknown-type"&&Ft.name===ve.propName);if(Ht)Ht.message=Qd(ve,Gt)}}}var kp={collect:(O)=>O.pendingCallDefaultCandidates?.filter((te)=>te.importSource!==void 0)??[],resolve:Yd,apply:Zd};import{dirname as ef}from"node:path";function tf(O,te,ve){let Je=ef(O);return te.map((Gt)=>{let Wt=ve.graph.resolve(Gt.importSource,Je);if(!Wt)return{candidate:Gt};let Ht=Ss(Wt,Gt,ve);if(!Ht?.primitiveLiteral)return{candidate:Gt};return{candidate:Gt,literal:Ht.primitiveLiteral,declaredType:Ht.declaredType}})}function nf(O,te){for(let{candidate:ve,literal:Je,declaredType:Gt}of te){if(!Je)continue;let Wt=Ci(O,ve);if(!Wt)continue;if(Jn(Wt,"value",Je.raw),Jn(Wt,"defaultValue",{raw:Je.raw,kind:"literal",value:Je.value}),Wt.typeSource!=="unknown")continue;Jn(Wt,"type",Gt?.type??Je.type),Jn(Wt,"typeSource",Gt?.source??"default"),wi(O,ve)}}var Pp={collect:(O)=>O.pendingConstDefaultCandidates??[],resolve:tf,apply:nf};import{dirname as sf}from"node:path";function rf(O,te,ve){let Je=sf(O);return te.map((Gt)=>{let Wt=ve.graph.resolve(Gt.importSource,Je);if(!Wt)return{candidate:Gt};let Ht=Ss(Wt,Gt,ve);if(Ht?.kind!=="const"||Ht.literalValue===void 0)return{candidate:Gt};return{candidate:Gt,key:Ht.literalValue}})}function of(O,te){for(let{candidate:ve,key:Je}of te){if(!Je){let Ft=pe(ve);O.diagnostics=[...O.diagnostics??[],o({component:O.filePath,kind:"context-key-unresolved",name:Ft,message:`setContext key \`${Ft}\` from "${ve.importSource}" isn't an \`export const\` string or Symbol() sveld can read; the context is skipped.`,...ve.source?{source:ve.source}:{}})];continue}let Gt=[...O.contexts??[]],Wt=Gt.findIndex((Ft)=>Ft.key===Je);if(Wt!==-1){let Ft=Gt[Wt],Kt=$p(Ft.source,ve.source),zt=Kt?Ft.source:ve.source;if(O.diagnostics=[...O.diagnostics??[],o({component:O.filePath,kind:"context-duplicate-key",name:Je,message:`setContext("${Je}", ...) was called more than once; only the first call's shape is used.`,...zt?{source:zt}:{}})],!Kt)continue;Gt.splice(Wt,1)}let Ht=Gt.findIndex((Ft)=>$p(Ft.source,ve.source));Gt.splice(Ht===-1?Gt.length:Ht,0,{key:Je,typeName:N(Je),...ve.type===void 0?{}:{type:ve.type},description:ve.description,properties:ve.properties,...ve.hasUnresolvedSpread?{hasUnresolvedSpread:!0}:{},...ve.internal?{internal:!0}:{},source:ve.source}),O.contexts=Gt}}function $p(O,te){if(!O||!te)return!1;let{line:ve,column:Je}=O.start;return ve>te.start.line||ve===te.start.line&&Je>te.start.column}var Ap={collect:(O)=>O.pendingContextKeyCandidates??[],resolve:rf,apply:of};import{dirname as af}from"node:path";function pf(O,te,ve){let Je=af(O);return te.map((Gt)=>{let Wt=ve.graph.resolve(Gt.importSource,Je);if(!Wt)return{candidate:Gt,failureReason:"module-not-found"};let Ht=Ss(Wt,Gt,ve)?.functionNode;if(!Ht)return{candidate:Gt,failureReason:"not-a-function"};let Ft=cf(Ht,Gt);if(!Ft)return{candidate:Gt,failureReason:"parameter-not-found"};return hf(Ht,Ft,Gt)})}function Dp(O){return O?.type==="AssignmentPattern"?O.left:O}function cf(O,te){let ve=Dp(O.params[te.argumentIndex]);if(te.property===void 0)return ve?.type==="Identifier"?{name:ve.name}:void 0;if(!te.property)return;if(ve?.type==="Identifier")return{object:ve.name,property:te.property};if(ve?.type!=="ObjectPattern")return;for(let Je of ve.properties){if(Je.type!=="Property"||Je.computed)continue;if(Je.key.type!=="Identifier"||Je.key.name!==te.property)continue;let Gt=Dp(Je.value);return Gt?.type==="Identifier"?{name:Gt.name}:void 0}return}function zr(O){if(!O)return null;if(O.type==="ConditionalExpression"){let ve=zr(O.consequent),Je=zr(O.alternate);return ve&&Je?[...ve,...Je]:null}let te=v(O);return te?[te]:null}var lf={variableType:()=>{return}};function uf(O){if(!O)return"null";let{deriveLiteralDetailType:te,literalDetailToTypeText:ve}=Nn();if(O.type==="Literal")return ve(O.value);return te(lf,O)??"any"}function Np(O,te){if("name"in te)return O.type==="Identifier"&&O.name===te.name;if(O.type!=="MemberExpression"||O.computed)return!1;return O.object.type==="Identifier"&&O.object.name===te.object&&O.property.type==="Identifier"&&O.property.name===te.property}function hf(O,te,ve){let Je=new Map,Gt="name"in te?te.name:te.object,Wt;if(a(O.body,{enter(Ft,Kt,zt){if(Ft.type==="CallExpression"){if(!Np(Ft.callee,te))return;let Zt=Ft.arguments,Qt=zr(Zt[0]);if(!Qt)return Wt="dynamic-event-name",T;for(let en of Qt){let tn=Je.get(en)??new Set;tn.add(uf(Zt[1])),Je.set(en,tn)}return}let Xt=Kt?.type==="CallExpression"&&zt==="callee";if(Ft.type==="MemberExpression"&&Np(Ft,te)&&!Xt)return Wt="passed-on",T;if(Ft.type!=="Identifier"||Ft.name!==Gt)return;if(Xt)return;if(!("name"in te)&&Kt?.type==="MemberExpression"&&zt==="object")return;if(!W(Ft,Kt))return;return Wt="passed-on",T}}),Wt)return{candidate:ve,failureReason:Wt};let Ht=Array.from(Je,([Ft,Kt])=>{let zt=Array.from(Kt);return{name:Ft,detail:zt.includes("any")?"any":zt.join(" | ")}});return{candidate:ve,events:Ht}}function df(O,te){let ve=O.members?`"${O.calleeText}"`:O.importedName==="default"?"the default export":`"${O.importedName}"`;switch(te){case"module-not-found":return`"${O.importSource}" isn't a local module sveld can read`;case"not-a-function":return`${ve} isn't a function declared in "${O.importSource}"`;case"parameter-not-found":return`no parameter of ${ve} receives it`;case"dynamic-event-name":return"an event name isn't a string literal";case"passed-on":return`${ve} passes it on`}}function ff(O,te,{deferredEventNoSourceDiagnostics:ve=[],untypedJsDocEventNames:Je=[]}){let Gt=new Map,Wt=[...O.diagnostics??[]],Ht=!0;for(let{candidate:en,events:tn,failureReason:sn}of te){if(sn){Ht=!1,Wt.push(o({component:O.filePath,kind:"dispatch-escapes",name:en.dispatcherName,message:`\`${en.dispatcherName}\` is passed to \`${en.calleeText}\`, but sveld couldn't read the events it dispatches: ${df(en,sn)}. Document them with @event tags.`,...en.source?{source:en.source}:{},...en.ignored?{ignored:!0}:{}}));continue}for(let nn of tn??[]){if(Gt.has(nn.name))continue;Gt.set(nn.name,{type:"dispatched",name:nn.name,detail:nn.detail,...en.source?{source:en.source}:{}})}}if(Ht){for(let en of ve)if(!Gt.has(en.name))Wt.push(en)}if(O.diagnostics=Wt,Gt.size===0)return;let Ft=new Map,Kt=new Set;for(let en of O.events)if(en.type==="dispatched")Kt.add(en.name);else if(!Ft.has(en.name))Ft.set(en.name,en);let zt=new Set(Je),Xt=new Map,Zt=[];for(let en of Gt.values()){if(Kt.has(en.name)){if(zt.has(en.name)&&en.detail!==void 0)Xt.set(en.name,en.detail);continue}let tn=Ft.get(en.name);if(!tn){Zt.push(en);continue}let sn=en.source??tn.source;Zt.push({type:"dispatched",name:en.name,detail:tn.detail??en.detail,...tn.description?{description:tn.description}:{},...tn.deprecated===void 0?{}:{deprecated:tn.deprecated},...tn.tags?{tags:tn.tags}:{},...tn.internal?{internal:!0}:{},...sn?{source:sn}:{}})}if(Zt.length===0&&Xt.size===0)return;let Qt=new Set(Zt.map((en)=>en.name));O.events=[...O.events.filter((en)=>en.type==="dispatched"||!Qt.has(en.name)).map((en)=>{let tn=en.type==="dispatched"?Xt.get(en.name):void 0;return tn===void 0?en:{...en,detail:tn}}),...Zt].sort(Te)}var _p={collect:(O)=>O.pendingDispatchEscapeCandidates??[],resolve:pf,apply:ff};function Ti(O){return(te)=>{let ve=O.collect(te);if(ve.length===0)return;return(Je,Gt,Wt)=>O.apply(Je,O.resolve(Gt,ve,Wt),te)}}var mf=[Ti(kp),Ti(Pp),Ti(Ap),Ti(_p)];async function Rp(O,te,ve,Je){let Gt=[];for(let Ht of O){let Ft=ve(Ht);if(Ft===void 0)continue;let Kt=mf.flatMap((zt)=>zt(Ft)??[]);if(Kt.length>0)Gt.push({component:Ht,passes:Kt})}let Wt=new Map;if(Gt.length===0)return Wt;await zn();for(let{component:Ht,passes:Ft}of Gt){let Kt=Si(Je),zt=te(Ht.filePath);for(let Xt of Ft)Xt(Ht,zt,Kt);Wt.set(Ht.filePath,Array.from(Kt.cache.keys()))}return Wt}var gf=/^```([\w-]*)\r?\n([\s\S]*?)\r?\n?```$/,yf=new Set(["","js","jsx","ts","tsx","javascript","typescript"]),xf=new Set(["svelte","html"]);function vf(O){let te=O.trim();if(te==="")return null;let ve=te.match(gf);if(ve){let Je=ve[1].toLowerCase(),Gt=ve[2].trim();if(Gt==="")return null;if(yf.has(Je))return{kind:"compile",code:Gt};if(xf.has(Je))return{kind:"syntax",code:Gt};return null}if(te.startsWith("<"))return null;return{kind:"compile",code:te}}function Ip(O){if(!O.isFunction)return"any";return`(${(O.params??[]).map((ve)=>`${ve.name}${ve.optional?"?":""}: any`).join(", ")}) => any`}function ki(O,te,ve,Je,Gt){let Wt=(O??[]).filter((Ft)=>Ft.name==="example"),Ht=Wt.length>1;return Wt.flatMap((Ft,Kt)=>{let zt=vf(Ft.body);if(zt===null)return[];return[{id:Ht?`${te}#${Kt}`:te,name:Ht?`${ve} (example ${Kt+1})`:ve,type:Je,code:zt.code,kind:zt.kind,...Gt?{source:Gt}:{}}]})}function Ef(O){let te=[];for(let ve of O.props)te.push(...ki(ve.tags,`prop:${ve.name}`,ve.name,Ip(ve),ve.source));for(let ve of O.moduleExports)te.push(...ki(ve.tags,`export:${ve.name}`,ve.name,Ip(ve),ve.source));for(let ve of O.slots){let Je=ve.name??"default";te.push(...ki(ve.tags,`slot:${Je}`,Je,"any",ve.source))}for(let ve of O.events)te.push(...ki(ve.tags,`event:${ve.name}`,ve.name,"any",ve.source));return te}function Lp(O,te){return O.flatMap(({component:ve,sources:Je})=>{let Gt=Je.filter((Wt)=>Wt.kind===te);return Gt.length===0?[]:[{component:ve,sources:Gt}]})}async function Sf(O){let{formatParseError:te,parseSvelte:ve}=await zn(),Je=new Map;for(let{component:Gt,sources:Wt}of O){let Ht=[];for(let Ft of Wt)try{ve(Ft.code)}catch(Kt){Ht.push(o({component:Gt.filePath,kind:"example-syntax-error",name:Ft.name,message:te(Kt),...Ft.source?{source:Ft.source}:{}}))}Je.set(Gt,Ht)}return Je}async function bf(O,te,ve){let Je=await te.checkExamples(O.map(({component:Wt,sources:Ht})=>({moduleName:Wt.moduleName,filePath:ve(Wt.filePath),sources:Ht}))),Gt=new Map;for(let{component:Wt,sources:Ht}of O){let Ft=Je.get(ve(Wt.filePath));if(!Ft||Ft.length===0)continue;let Kt=new Map(Ht.map((zt)=>[zt.id,zt.source]));Gt.set(Wt,Ft.map((zt)=>{let Xt=Kt.get(zt.id);return o({component:Wt.filePath,kind:"example-compile-error",name:zt.name,message:zt.message,...Xt?{source:Xt}:{}})}))}return Gt}async function Op(O,te,ve,Je){let Gt=Array.from(O,(zt)=>({component:zt,sources:Ef(zt)})),Wt=te===!0?Lp(Gt,"compile"):[],Ht=Lp(Gt,"syntax"),Ft=new Map,Kt=(zt)=>{for(let[Xt,Zt]of zt)Ft.set(Xt,[...Ft.get(Xt)??[],...Zt])};if(Ht.length>0)Kt(await Sf(Ht));if(Wt.length>0){let{TypeResolver:zt}=await import("./chunk-deb45vqa.js"),Xt=await zt.create(ve);if(!Xt.ok)throw Error(`sveld: \`checkExamples\` ${Xt.message}.`);let Zt=Xt.resolver;try{Kt(await bf(Wt,Zt,Je))}finally{await Zt.dispose()}}return Ft}import{hash as Cf}from"node:crypto";import{existsSync as wf,mkdirSync as Tf,readFileSync as kf,renameSync as Pf,writeFileSync as Mp}from"node:fs";import{dirname as Xr,isAbsolute as $f,join as Fp,resolve as Pi}from"node:path";var jp=10,Af=Fp("node_modules",".cache","sveld","parse-cache.json"),Df="0ff31f8edb47d137";function Bp(){return`${ri}+${Df}+svelte@${Is}`}function Nf(O){for(let te=Pi(O);;te=Xr(te)){if(wf(Fp(te,"package.json")))return te;if(Xr(te)===te)return Pi(O)}}function Vp(O,te){let ve=Nf(O);if(typeof te==="string")return $f(te)?te:Pi(ve,te);return Pi(ve,Af)}function $i(O){return Cf("sha256",O,"hex")}function Jr(){return{formatVersion:jp,toolchainVersion:Bp(),entries:{}}}function _f(O){try{let te=JSON.parse(kf(O,"utf-8"));if(te.formatVersion!==jp||te.toolchainVersion!==Bp())return Jr();return te}catch{return Jr()}}class Yr{cacheFilePath;file;next=new Map;dirty=!1;savedEntryCount;constructor(O){this.cacheFilePath=O,this.file=_f(O),this.savedEntryCount=Object.keys(this.file.entries).length}has(O,te){return this.lookup(O,te)!==void 0}lookup(O,te){let ve=this.next.get(O);if(ve?.hash===te)return ve;let Je=this.file.entries[O];return Je?.hash===te?Je:void 0}get(O,te){let ve=this.lookup(O,te);if(ve===void 0)return null;this.next.set(O,ve);let{component:Je,typeScriptMetadata:Gt,pending:Wt}=structuredClone({component:ve.component,typeScriptMetadata:ve.typeScriptMetadata,pending:ve.pending});if(Gt!==void 0)Je[x]=Gt;return Wt===void 0?{component:Je}:{component:Je,pending:Wt}}set(O,te,{component:ve,pending:Je}){this.dirty=!0,this.next.set(O,{hash:te,...structuredClone({component:ve,typeScriptMetadata:ve[x],pending:Je})})}getGeneratedText(O,te){let ve=this.next.get(O);if(ve?.generatedText===void 0||ve.generatedText.key!==te)return;return ve.generatedText.text}setGeneratedText(O,te,ve){let Je=this.next.get(O);if(Je===void 0)return;if(Je.generatedText?.key===te&&Je.generatedText.text===ve)return;Je.generatedText={key:te,text:ve},this.dirty=!0}save(){if(!this.dirty&&this.next.size===this.savedEntryCount)return;this.dirty=!1,this.savedEntryCount=this.next.size,Tf(Xr(this.cacheFilePath),{recursive:!0});let O={...Jr(),entries:Object.fromEntries(this.next)},te=JSON.stringify(O),ve=`${this.cacheFilePath}.${process.pid}.tmp`;try{Mp(ve,te),Pf(ve,this.cacheFilePath)}catch{try{Mp(this.cacheFilePath,te)}catch{}}}}import{dirname as Rf,relative as If,resolve as Lf}from"node:path";async function Gp(O,te={}){await zn();let ve=Lf(O),Je=Rf(ve),Gt=(Ft)=>n(`./${If(Je,Ft)}`),Wt=bi(ve,{...Si(te.graph??new Xn),onAmbiguousStarExport:(Ft,Kt,zt)=>{if(Ft!==ve||!te.diagnostics)return;if(zt.every((en)=>en.declFile.endsWith(".svelte")))return;let Xt=Array.from(new Set(zt.map((en)=>Gt(en.declFile)))),Zt=Xt.map((en)=>`"${en}"`),Qt=`${Zt.slice(0,-1).join(", ")} and ${Zt[Zt.length-1]}`;te.diagnostics.push(o({component:Gt(ve),kind:"export-ambiguous",name:Kt,message:`"${Kt}" is exported by ${Qt} through \`export *\`, so the barrel doesn't export it and the docs leave it out; export it explicitly from the barrel (e.g. \`export { ${Kt} } from "${Xt[0]}"\`).`}))}}),Ht=new Map;for(let Ft of Wt){if(Ft.name==="default"||Ft.declFile.endsWith(".svelte"))continue;let{declFile:Kt,returnType:zt,literalValue:Xt,primitiveLiteral:Zt,declaredType:Qt,functionNode:en,namespaceFile:tn,...sn}=Ft,nn=Gt(Kt);if(tn!==void 0)sn.type=`typeof import(${JSON.stringify(Gt(tn))})`;Ht.set(Ft.name,{...sn,source:nn})}return Array.from(Ht.values()).sort((Ft,Kt)=>l(Ft.name,Kt.name))}async function Ff(O){let te=await Promise.all(Array.from(O,async(ve)=>{try{return[ve,await Mf(ve,"utf-8")]}catch(Je){return console.warn(`Warning: Failed to read file ${ve}:`,Je),[ve,null]}}));return new Map(te)}function Up(O){if(O.length===0)return;console.error(`sveld: failed to parse ${O.length} component(s):`);for(let{filePath:te,message:ve}of O)console.error(` - ${te}: ${ve}`)}class js{input;glob;options;graph=new Xn;collected;entryFile=null;globMergeState;cache;entryExports=[];entryDiagnostics=[];records=new Map;parseErrors=new Map;canonicalEntries=new Map;warnedModuleNames=new Set;constructor(O,te,ve={}){this.input=O,this.glob=te,this.options=ve}get documentExports(){return this.options.documentExports===!0}async build(){return this.graph=new Xn,this.collected=Wr(this.input,this.glob,this.documentExports,this.graph),this.globMergeState=Ei(this.collected.allComponentEntries,this.collected.resolveComponentFilePath),this.entryFile=Of(this.input).isFile()?Wp(this.input):null,this.cache=this.options.cache===!1?void 0:new Yr(Vp(this.collected.rootDir,this.options.cache??!0)),await this.readEntryExports(),this.records.clear(),this.parseErrors.clear(),this.indexEntries(),await this.process(this.componentPaths()),Up(Array.from(this.parseErrors.values())),this.assemble()}async update(O){let te=O.map((zt)=>Wp(zt));if(this.graph.invalidate(...te),te.length===0)return{result:this.assemble(),reparsed:[]};let ve=this.entryFile!==null&&te.includes(this.entryFile)?await this.recollect():[];if(this.glob){let{rootDir:zt,exports:Xt,allComponentEntries:Zt,resolveComponentFilePath:Qt}=this.collected;Gr(this.graph,zt,Xt,Zt,Qt,this.globMergeState)}this.indexEntries();let Je=this.componentPaths();for(let zt of this.records.keys())if(!Je.has(zt))this.records.delete(zt);for(let zt of this.parseErrors.keys())if(!Je.has(zt))this.parseErrors.delete(zt);let Gt=Array.from(this.records).flatMap(([zt,{crossFileReads:Xt}])=>Xt?.some((Zt)=>te.includes(Zt))?[zt]:[]),Wt=new Set([...te.filter((zt)=>Ln.test(zt)),...ve,...Gt]),Ht=new Set(Array.from(Je).filter((zt)=>Wt.has(zt))),Ft=await this.process(Ht),Kt=this.assemble();return Up(Kt.errors),{result:Kt,reparsed:Ft}}async recollect(){let O=this.collected,te=Wr(this.input,this.glob,this.documentExports,this.graph),ve=[];for(let[Je,Gt]of Object.entries(te.exports)){let Wt=te.resolveComponentFilePath(Gt.source),Ht=Object.hasOwn(O.exports,Je)?O.exports[Je]:void 0;if(Ht===void 0||O.resolveComponentFilePath(Ht.source)!==Wt)ve.push(Wt)}return this.collected=te,this.globMergeState=Ei(te.allComponentEntries,te.resolveComponentFilePath),await this.readEntryExports(),ve}async readEntryExports(){this.entryDiagnostics=[],this.entryExports=this.documentExports&&this.entryFile!==null?await Gp(this.entryFile,{diagnostics:this.entryDiagnostics,graph:this.graph}):[]}componentPaths(){let{exports:O,allComponentEntries:te,resolveComponentFilePath:ve}=this.collected,Je=new Set;for(let[,Gt]of[...Object.entries(O),...te])if(ys(Gt.source))Je.add(ve(Gt.source));return Je}indexEntries(){let{exports:O,allComponentEntries:te,resolveComponentFilePath:ve}=this.collected;this.canonicalEntries=new Map;for(let Je of[Object.entries(O),te])for(let[Gt,Wt]of Je){if(!ys(Wt.source))continue;this.canonicalEntries.set(ve(Wt.source),{moduleName:Ur(Gt,Wt.source,Je.length,this.warnedModuleNames),filePath:n(Wt.source)})}}canonicalEntry(O){let te=this.canonicalEntries.get(O);if(te===void 0)throw Error(`sveld: no entry lists ${O}.`);return te}async process(O){let te=new Map,ve=await this.parse(O,te);this.cache?.save();let Je=await this.settle(ve);for(let Gt of O)this.records.delete(Gt),this.parseErrors.delete(Gt);for(let[Gt,Wt]of Je)this.records.set(Gt,Wt);for(let[Gt,Wt]of te)this.parseErrors.set(Gt,Wt);return Array.from(Je.keys())}async parse(O,te){let ve=await Ff(O),Je=this.cache,Gt=new Map,Wt=new Set;if(Je)for(let[Ft,Kt]of ve){if(Kt===null)continue;let zt=$i(Kt);if(Gt.set(Ft,zt),!Je.has(Ft,zt))Wt.add(Ft)}if(O.size>0&&(!Je||Wt.size>0))await zn();let Ht=new Map;for(let Ft of O){let Kt=ve.get(Ft);if(Kt===null||Kt===void 0)continue;let zt=this.parseOne(Ft,Kt,Gt.get(Ft),te);if(zt)Ht.set(Ft,zt)}return Ht}parseOne(O,te,ve,Je){let Gt=ve===void 0?null:this.cache?.get(O,ve);if(Gt)return Gt;let{moduleName:Wt,filePath:Ht}=this.canonicalEntry(O),Ft;try{Ft=new(Nn()).ComponentParser().parse(te,{moduleName:Wt,filePath:Ht})}catch(Kt){if(this.options.failFast)throw Kt;Je.set(O,{filePath:Ht,moduleName:Wt,message:Kt instanceof Error?Kt.message:String(Kt),stack:Kt instanceof Error?Kt.stack:void 0});return}if(ve!==void 0)this.cache?.set(O,ve,Ft);return Ft}async settle(O){let{rootDir:te,resolveComponentFilePath:ve}=this.collected,Je=new Map,Gt=new Map;for(let[Kt,{component:zt,pending:Xt}]of O){let Zt={...this.canonicalEntry(Kt),...zt};Je.set(Kt,Zt),Gt.set(Zt,Xt)}let{checkExamples:Wt}=this.options;if(Wt){let Kt=await Op(Je.values(),Wt,te,ve);for(let[zt,Xt]of Kt)Bi(zt,Xt)}let Ht=await Rp(Je.values(),ve,(Kt)=>Gt.get(Kt),this.graph),Ft=new Map;for(let[Kt,zt]of Je){let{moduleName:Xt,filePath:Zt,...Qt}=zt,en=Ht.get(Zt);Ft.set(Kt,en===void 0?{component:Qt}:{component:Qt,crossFileReads:en})}return Ft}assemble(){let{exports:O,allComponentEntries:te,resolveComponentFilePath:ve}=this.collected,Je=this.cache,Gt=(Zt,[Qt,en])=>{if(!ys(en.source))return;let tn=this.records.get(ve(en.source));if(tn===void 0)return;return{component:{moduleName:Ur(Qt,en.source,Zt.length,this.warnedModuleNames),filePath:n(en.source),...tn.component},record:tn}},Wt=new Map,Ht=Je?new Map:void 0,Ft=Je?new Map:void 0;for(let Zt of te){let Qt=Gt(te,Zt);if(Qt===void 0)continue;let{filePath:en}=Qt.component;Wt.set(en,Qt.component),(Qt.record.crossFileReads===void 0?Ht:Ft)?.set(en,ve(Zt[1].source))}let Kt=ap(Wt,ve,this.graph);for(let Zt of Wt.values())Bi(Zt,[...Kt(Zt),...op(Zt)]);let zt=new Map,Xt=Object.entries(O);for(let Zt of Xt){let Qt=Gt(Xt,Zt);if(Qt===void 0)continue;let en=Wt.get(Qt.component.filePath);if(en)Qt.component.diagnostics=en.diagnostics;zt.set(Qt.component.moduleName,Qt.component)}return{exports:O,entryExports:this.entryExports,components:zt,allComponentsForTypes:Wt,errors:Array.from(this.parseErrors.values()),diagnostics:No(Io([...Array.from(Wt.values()).flatMap((Zt)=>Zt.diagnostics??[]),...this.entryDiagnostics]),this.options.diagnostics?.ignore),cache:Je,resolvedPathByFilePath:Ht,crossFileResolvedPathByFilePath:Ft}}}function D(O){return{failFast:O?.failFast,documentExports:O?.documentExports===!0,cache:O?.cache,checkExamples:O?.checkExamples==="syntax"?"syntax":O?.checkExamples===!0,diagnostics:O?.diagnostics}}async function L(O,te,ve={}){return new js(O,te,ve).build()}import{existsSync as Qr,readFileSync as jf}from"node:fs";import{isAbsolute as Bf,join as Hp}from"node:path";var Bs='sveld: could not resolve a Svelte entry point. Set package.json#svelte, or pass the "entry" option.';function Kp(O){return Bf(O)?O:Hp(process.cwd(),O)}function Be(O){if(O){let Gt=Kp(O);if(Qr(Gt))return{entry:ee(O)};return{entry:null,configured:!0,message:`Invalid entry point: ${Gt}. Pass a valid --entry (or "entry" option), or unset it and set the "svelte" field in your package.json instead.`}}let te=Hp(process.cwd(),"package.json");if(!Qr(te))return{entry:null,configured:!1,message:'Could not locate a package.json file. Specify an entry point with --entry (or the "entry" option).'};let ve;try{ve=lp(JSON.parse(jf(te,"utf-8")))}catch(Gt){throw console.error("Error reading package.json:",Gt),Gt}let Je=ve.svelte?.trim();if(!Je)return{entry:null,configured:!1,message:'Could not determine an entry point. Set the "svelte" field in your package.json, or pass --entry (or the "entry" option).'};if(!Qr(Kp(Je)))return{entry:null,configured:!0,message:`The "svelte" field in package.json points to "${Je}", which does not exist.`};return{entry:ee(Je)}}function Ai(O){let te=Be(O);if(te.entry===null)console.error(te.message);return te.entry}async function qp(O,te,ve={}){let Je=new js(O,te,{...ve,failFast:!1}),Gt=await Je.build();return{get result(){return Promise.resolve(Gt)},async update(Wt){let Ht=await Je.update(Wt);return Gt=Ht.result,Ht}}}import eo from"node:path";function zp(O){let te=new Map;for(let[Je,Gt]of Object.entries(O)){let Wt=te.get(Gt.source)??[];Wt.push({id:Je,exportee:Gt}),te.set(Gt.source,Wt)}let ve=[];for(let[Je,Gt]of te){let Wt=Ln.test(Je),Ht=Gt.some(({id:Qt,exportee:en})=>Qt!=="default"&&en.default),Ft=Gt.some(({exportee:Qt})=>!Qt.default),Kt=Wt&&Ht&&Ft,zt=[],Xt=[],Zt=[];for(let{id:Qt,exportee:en}of Gt){if(Qt==="default"){Xt.push(`export { default } from "${Je}";`);continue}if(en.default)if(en.mixed)Xt.push(`export { default as ${Qt} } from "${Je}";`),Xt.push(`export { default } from "${Je}";`);else Zt.push(`default as ${Qt}`);else if(Wt&&!Kt)Zt.push(`default as ${Qt}`);else zt.push(Qt)}if(Zt.length>0&&zt.length>0)ve.push(`export { ${[...Zt,...zt].join(", ")} } from "${Je}";`);else{if(zt.length>0)ve.push(`export { ${zt.join(", ")} } from "${Je}";`);if(Zt.length>0)ve.push(`export { ${Zt.join(", ")} } from "${Je}";`)}ve.push(...Xt)}return ve.join(`
|
|
182
|
-
`)}function Xp(O){return O.filter((te)=>te.names.length>0).map((te)=>`export type { ${te.names.join(", ")} } from "${te.source}";`).join(`
|
|
183
|
-
`)}function Jp(O){return O.replace(Ln,"")}function Zr(O){return O.replace(Ln,".svelte.d.ts")}import{mkdir as Vf,readFile as Gf,writeFile as Wf}from"node:fs/promises";import{parse as Uf}from"node:path";class jn{ensuredDirs=new Set;async write(O,te){try{if(await Gf(O,"utf-8")===te)return!1}catch{}let ve=Uf(O).dir;if(!this.ensuredDirs.has(ve))await Vf(ve,{recursive:!0}),this.ensuredDirs.add(ve);return await Wf(O,te),!0}}function Kf(O){return typeof O==="object"&&O!==null&&!Array.isArray(O)&&"start"in O&&"end"in O}function Di(O){if(Array.isArray(O))return O.map((te)=>Di(te));if(O!==null&&typeof O==="object"){let te={};for(let[ve,Je]of Object.entries(O)){if((ve==="source"||ve==="componentCommentSource")&&Kf(Je))continue;te[ve]=Di(Je)}return te}return O}function Yp(O,te){return O.map((ve)=>({...ve,filePath:wa(ve.filePath,te)}))}function Hf(O,te,ve){if(!te)return`${O.moduleName}.api.json`;if(!ve.has(O.moduleName))ve.add(O.moduleName),console.warn(`Warning: multiple components named "${O.moduleName}" found. Their JSON files are keyed by source path instead of name to avoid overwriting each other.`);return`${Jp(O.filePath)}.api.json`}async function qf(O,te,ve){let Je=m(O),Gt=Yp(Je.components,te.inputDir);if(te.source===!1)Gt=Di(Gt);let Wt=new Map;for(let Kt of Gt)Wt.set(Kt.moduleName,(Wt.get(Kt.moduleName)??0)+1);let Ht=new Set,Ft=new jn;await Promise.all(Gt.map(async(Kt)=>{let zt=(Wt.get(Kt.moduleName)??0)>1,Xt=Hf(Kt,zt,Ht),Zt=eo.resolve(eo.join(ve,Xt)),Qt=await Ft.write(Zt,Rs(Kt));Gn(`${Qt?"created":"unchanged"} "${Zt}".`)}))}function to(O,te){let ve=m(O,{entryExports:te.entryExports}),Je={...ve,components:Yp(ve.components,te.inputDir)};return te.source===!1?Di(Je):Je}function no(O,te){return Rs(to(O,te))}async function so(O,te){if(te.outDir){await qf(O,te,te.outDir);return}let ve=await new jn().write(eo.resolve(te.outFile),no(O,te));Gn(`${ve?"created":"unchanged"} "${te.outFile}".`)}import{join as gc,resolve as go}from"node:path";var Qp=/`/g,Zp=/\s+/g,_n="--",ec=`| Prop name | Required | Kind | Reactive | Binding | Type | Default value | Description |
|
|
184
|
-
| :- | :- | :- | :- | :- | :- | :- | :- |
|
|
185
|
-
`,tc=`| Slot name | Default | Props | Fallback | Description |
|
|
186
|
-
| :- | :- | :- | :- | :- |
|
|
187
|
-
`,nc=`| Event name | Type | Detail | Description |
|
|
188
|
-
| :- | :- | :- | :- |
|
|
189
|
-
`,oo=`| Name | Kind | Type | Description |
|
|
190
|
-
| :- | :- | :- | :- |
|
|
191
|
-
`,zf=`| Member | Signature | Description |
|
|
192
|
-
| :- | :- | :- |
|
|
193
|
-
`,sc=`| Part name | Description |
|
|
194
|
-
| :- | :- |
|
|
195
|
-
`,ic=`| Property name | Type | Default value | Description |
|
|
196
|
-
| :- | :- | :- | :- |
|
|
197
|
-
`,ao=/\|/g,Xf=/</g,Jf=/>/g,os=/\n/g,Yf=/^[A-Za-z_$][\w$]*$/,Qf=/\s*\n\s*/g,Zf=/&(?=#?\w+;)|<(?=[A-Za-z/!?])|[|`*]|\\(?=[!-/:-@[-`{-~])|(?<![A-Za-z0-9])_|_(?![A-Za-z0-9])/g,em=/[&<|`*\\_]/;function po(O){if(!em.test(O))return O;return O.replace(Zf,(te)=>te==="&"?"&":te==="<"?"<":te==="_"?"_":`&#${te.charCodeAt(0)};`)}function rc(O){return`<code>${po(O.includes(`
|
|
198
|
-
`)?O.replace(Qf," "):O)}</code>`}var tm=/\{@link\s+([^{}\s|]+)(?:\|([^{}]+))?\}/g;function nm(O){if(!O.includes("{@link"))return O;return O.replace(tm,(te,ve,Je)=>`[${Je===void 0?ve:Je.trim()}](${ve})`)}function io(O){return O.includes("```")||O.includes("~~~")}function ro(O){return cc(nm(O))}var sm=/^([ \t]*)(`{3,}|~{3,})(.*)$/,im=/^\n/,rm=/\n$/;function oc(O){let te=(Wt)=>({kind:"prose",text:ro(Wt.join(`
|
|
199
|
-
`))});if(!io(O))return[te([O])];let ve=O.split(`
|
|
200
|
-
`),Je=[],Gt=[];for(let Wt=0;Wt<ve.length;Wt++){let Ht=sm.exec(ve[Wt]),[,Ft="",Kt="",zt=""]=Ht??[];if(!Ht||Kt[0]==="`"&&zt.includes("`")){Gt.push(ve[Wt]);continue}if(Gt.push(""),Gt.length>1)Je.push(te(Gt));let Xt=[],Zt=new RegExp(`^[ \\t]*${Kt[0]}{${Kt.length},}[ \\t]*$`);for(Wt++;Wt<ve.length&&!Zt.test(ve[Wt]);Wt++){let Qt=ve[Wt],en=0;while(en<Ft.length&&(Qt[en]===" "||Qt[en]==="\t"))en++;Xt.push(Qt.slice(en))}Je.push({kind:"code",code:Xt.join(`
|
|
201
|
-
`)}),Gt=[""]}if(Gt.length>1||Je.length===0)Je.push(te(Gt));return Je}function ac(O){let te="";for(let ve=0;ve<O.length;ve++){let Je=O[ve];if(Je.kind==="code"){te+=`<pre><code>${po(Je.code).replace(os,"<br />")}</code></pre>`;continue}let Gt=Je.text;if(O[ve-1]?.kind==="code")Gt=Gt.replace(im,"");if(O[ve+1]?.kind==="code")Gt=Gt.replace(rm,"");te+=Gt.replace(ao,"|").replace(os,"<br />")}return te}function An(O){if(O===void 0)return _n;return rc(O)}function pc(O){if(!O.reExport)return An(O.type);let{from:te,imported:ve}=O.reExport,Je=ve==="*"?"":Yf.test(ve)?`.${ve}`:`[${JSON.stringify(ve)}]`;return An(`typeof import(${JSON.stringify(te)})${Je}`)}function cc(O){if(!O.includes("<")&&!O.includes(">"))return O;return O.replace(Xf,"<").replace(Jf,">")}function co(O){if(O===void 0)return _n;return rc(O)}function as(O,te){if(te===void 0)return O;let ve=typeof te==="string"&&te.trim().length>0?`: ${cc(te).replace(os," ").replace(ao,"|")}`:"";return`<s>${O}</s><br />**Deprecated**${ve}`}function Ni(O){if(O===void 0||O.trim().length===0)return _n;return ac(oc(O))}function lc(O){if(O===void 0||O==="{}")return _n;return An(fi(O).replace(os," "))}function uc(O){if(O===void 0)return _n;return`<code>${po(O).replace(os,"<br />")}</code>`}function bs(O,te){let ve=O!==void 0&&O.trim().length>0;if(!(ve&&io(O))&&!te?.some(({body:Ht})=>Ht&&io(Ht))){let Ht=ve?[ro(O)]:[];for(let{name:Ft,body:Kt}of te??[]){let zt=Kt?.trim();Ht.push(zt?`@${Ft} ${ro(zt)}`:`@${Ft}`)}if(Ht.length===0)return _n;return Ht.join(`
|
|
202
|
-
`).replace(ao,"|").replace(os,"<br />")}let Je=[],Gt=(Ht)=>{let Ft=Je.at(-1);if(Ft?.kind==="prose")Ft.text+=Ht;else Je.push({kind:"prose",text:Ht})},Wt=(Ht,Ft)=>{if(Je.length>0)Gt(`
|
|
203
|
-
`);if(Ht)Gt(Ht);for(let Kt of oc(Ft))if(Kt.kind==="prose")Gt(Kt.text);else Je.push(Kt)};if(ve)Wt("",O);for(let{name:Ht,body:Ft}of te??[]){let Kt=Ft?.trim();Wt(Kt?`@${Ht} `:`@${Ht}`,Kt??"")}if(Je.length===0)return _n;return ac(Je)}function hc(O){if(O===void 0)return _n;return An(O.replace(os," "))}function om(O){let te=[O.extends?`Extends ${An(O.extends)}.`:"",O.implements?.length?`Implements ${O.implements.map((ve)=>An(ve)).join(", ")}.`:""].filter(Boolean);return te.length>0?te.join(" "):void 0}function dc(O,te){let ve=new Set;for(let Je of te){if(Je.kind!=="class")continue;let Gt=om(Je);if(!Je.members?.length&&!Gt)continue;let Wt=Je.localName??Je.name;if(ve.has(Wt))continue;if(ve.add(Wt),O.append("h4",`\`${Wt}\` members`),Gt)O.append("raw",`${Gt}
|
|
204
|
-
|
|
205
|
-
`);if(!Je.members?.length)continue;O.append("raw",zf);for(let Ht of Je.members)O.append("raw",`| ${as(Ht.name,Ht.deprecated)} | ${An(Dr(Ht))} | ${bs(Ht.description,Ht.tags)} |
|
|
206
|
-
`);O.append("raw",`
|
|
207
|
-
`)}}function uo(O,te,ve){if(O.append("h1","Component Index"),O.append("h2","Components").tableOfContents(),O.append("divider"),ve&&ve.length>0)mc(O,ve);for(let Je of m(te).components)ho(O,Je)}function fc(O,te,ve){O.append("h1","Component Index"),O.append("h2","Components");for(let Je of te)O.append("raw",`- [${Je.moduleName}](./${Je.moduleName}.md)
|
|
208
|
-
`);if(O.append("raw",`
|
|
209
|
-
`),O.append("divider"),ve&&ve.length>0)mc(O,ve)}function mc(O,te){O.append("h2","Exports"),O.append("raw",oo);for(let ve of te){let Je=(ve.type??ve.value)?.replace(Zp," ").trim();O.append("raw",`| ${as(ve.name,ve.deprecated)} | <code>${ve.kind}</code> | ${An(Je)} | ${Ni(ve.description)} |
|
|
210
|
-
`)}O.append("raw",`
|
|
211
|
-
`),O.append("divider")}function am(O){return O.kind==="const"||O.isFunctionDeclaration}function pm(O,te){O.append("h3","Module exports"),O.append("raw",oo);for(let ve of te)O.append("raw",`| ${as(ve.name,ve.deprecated)} | <code>${ve.kind}</code> | ${pc(ve)} | ${bs(ve.description,ve.tags)} |
|
|
212
|
-
`);O.append("raw",`
|
|
213
|
-
`),dc(O,te)}function lo(O,te,ve){if(te.length>0)ve(),O.append("raw",`
|
|
214
|
-
`);else O.append("p","None.")}function ho(O,te){if(O.append("h2",`\`${te.moduleName}\``),te.generics)O.append("p",`**Type parameters:** ${An(`<${te.generics[1]}>`)}`);if(te.typedefs.length>0)O.append("h3","Types").append("raw",`\`\`\`ts
|
|
215
|
-
${mi({typedefs:te.typedefs})}
|
|
216
|
-
\`\`\`
|
|
217
|
-
|
|
218
|
-
`);if(O.append("h3","Props"),lo(O,te.props,()=>{O.append("raw",ec);let ve=(Gt)=>Gt.reactive?0:Gt.constant?2:1,Je=te.props.map((Gt,Wt)=>({prop:Gt,index:Wt})).sort((Gt,Wt)=>ve(Gt.prop)-ve(Wt.prop)||Gt.index-Wt.index).map(({prop:Gt})=>Gt);for(let Gt of Je){let Wt=am(Gt)?"accessor":Gt.kind;O.append("raw",`| ${as(Gt.name,Gt.deprecated)} | ${Gt.isRequired?"Yes":"No"} | <code>${Wt}</code> | ${Gt.reactive?"Yes":"No"} | ${Gt.binding??"--"} | ${An(Gt.type)} | ${co(Gt.value)} | ${bs(Gt.description,Gt.tags)} |
|
|
219
|
-
`)}}),te.moduleExports.length>0)pm(O,te.moduleExports);if(O.append("h3","Slots"),lo(O,te.slots,()=>{O.append("raw",tc);for(let ve of te.slots)O.append("raw",`| ${as(ve.default?_n:ve.name??_n,ve.deprecated)} | ${ve.default?"Yes":"No"} | ${lc(ve.slot_props)} | ${uc(ve.fallback)} | ${bs(ve.description,ve.tags)} |
|
|
220
|
-
`)}),O.append("h3","Events"),lo(O,te.events,()=>{O.append("raw",nc);for(let ve of te.events)O.append("raw",`| ${as(ve.name,ve.deprecated)} | ${ve.type} | ${hc(ve.detail)} | ${bs(ve.description,ve.tags)} |
|
|
221
|
-
`)}),te.cssParts&&te.cssParts.length>0){O.append("h3","CSS Parts"),O.append("raw",sc);for(let ve of te.cssParts)O.append("raw",`| ${ve.name} | ${Ni(ve.description)} |
|
|
222
|
-
`);O.append("raw",`
|
|
223
|
-
`)}if(te.cssProperties&&te.cssProperties.length>0){O.append("h3","CSS Custom Properties"),O.append("raw",ic);for(let ve of te.cssProperties)O.append("raw",`| ${ve.name} | ${An(ve.type)} | ${co(ve.default)} | ${Ni(ve.description)} |
|
|
224
|
-
`);O.append("raw",`
|
|
225
|
-
`)}}var cm=/[^\w\- ]+/g,lm=/\s+/g,fo="<!-- __TOC__ -->";function um(O,te){let ve=O.toLowerCase().replace(Qp,"").replace(cm,"").replace(lm,"-"),Je=te.get(ve)??0;return te.set(ve,Je+1),Je===0?ve:`${ve}-${Je}`}class mo{sourceParts=[];hasToC=!1;toc=[];onAppend;constructor(O={}){this.onAppend=O.onAppend}get source(){return this.sourceParts.join("")}appendLineBreaks(){return this.sourceParts.push(`
|
|
226
|
-
|
|
227
|
-
`),this}append(O,te){switch(O){case"h1":case"h2":case"h3":case"h4":case"h5":case"h6":{if(this.sourceParts.push(`${"#".repeat(Number(O.slice(-1)))} ${te}`),this.hasToC&&O==="h2")this.toc.push({indent:0,raw:te??""});break}case"quote":this.sourceParts.push(`> ${te}`);break;case"p":this.sourceParts.push(te??"");break;case"divider":this.sourceParts.push("---");break;case"raw":this.sourceParts.push(te??"");break}if(O!=="raw")this.appendLineBreaks();return this.onAppend?.call(this,O,this),this}tableOfContents(){return this.sourceParts.push(fo),this.hasToC=!0,this.appendLineBreaks(),this}end(){let O=this.sourceParts.join("");if(!this.hasToC)return O;let te=O.indexOf(fo);if(te===-1)return O;let ve=new Map,Je=this.toc.map(({indent:Gt,raw:Wt})=>`${" ".repeat(Gt)}- [${Wt}](#${um(Wt,ve)})`).join(`
|
|
228
|
-
`);return O.slice(0,te)+Je+O.slice(te+fo.length)}}function _i(O,te){return new mo({onAppend:(ve,Je)=>{te?.onAppend?.call(null,ve,Je,O)}})}async function hm(O,te,ve){let Je=m(O,{entryExports:te.entryExports}),Gt=new jn,Wt=_i(O,te);fc(Wt,Je.components,te.entryExports);let Ht=go(gc(ve,"README.md")),Ft=await Gt.write(Ht,Wt.end());Gn(`${Ft?"created":"unchanged"} "${Ht}".`),await Promise.all(Je.components.map(async(Kt)=>{let zt=_i(O,te);ho(zt,Kt);let Xt=go(gc(ve,`${Kt.moduleName}.md`)),Zt=await Gt.write(Xt,zt.end());Gn(`${Zt?"created":"unchanged"} "${Xt}".`)}))}function yo(O,te){let ve=_i(O,te);return uo(ve,O,te.entryExports),ve.end()}async function xo(O,te){if(te.outDir){await hm(O,te,te.outDir);return}let ve=go(te.outFile),Je=await new jn().write(ve,yo(O,te));Gn(`${Je?"created":"unchanged"} "${te.outFile}".`)}import{join as dm,resolve as fm}from"node:path";function mm(O,te){if(!te.indexTypes)return[];let ve=te.format==="component",Je=new Set,Gt=[];for(let Wt of Object.values(te.exports)){if(!Wt.default||!Ln.test(Wt.source))continue;let Ht=n(Wt.source);if(Je.has(Ht))continue;Je.add(Ht);let Ft=O.components.find((zt)=>zt.filePath===Ht);if(!Ft)continue;let Kt=[Es(Ft.moduleName)];if(ve)Kt.push(Ms(Ft.moduleName));Gt.push({source:Wt.source,names:Kt})}return Gt}async function yc(O,te,ve){if(!O)return te;try{let Je=await O(te,ve);if(typeof Je!=="string")throw TypeError(`must return a string, got ${typeof Je}`);return Je}catch(Je){let Gt=Je instanceof Error?Je.message:String(Je);throw Error(`sveld: typesOptions.transform failed for "${ve.filePath}": ${Gt}`,{cause:Je})}}function gm(O,te){return`${O}
|
|
229
|
-
${rp(te)}`}async function vo(O,te){let ve=fm(te.outDir,"index.d.ts"),Je=new jn,Gt=m(O),Wt=Xp(mm(Gt,te)),Ht=te.preamble+[zp(te.exports),Wt].filter((en)=>en!=="").join(`
|
|
230
|
-
|
|
231
|
-
`),Ft=Nr(te),Kt=Gt.components.map(async(en)=>{let tn=Zr(dm(te.outDir,en.filePath)),sn=n(Zr(en.filePath)),nn=te.resolvedPathByFilePath?.get(en.filePath),an=nn?void 0:te.crossFileResolvedPathByFilePath?.get(en.filePath),un=nn??an,fn=gm(en.moduleName,Ft),dn=an?`${fn}
|
|
232
|
-
${$i(JSON.stringify(en))}`:fn,xn=un?te.cache?.getGeneratedText(un,dn):void 0;if(xn===void 0){if(xn=_r(en,Ft),un)te.cache?.setGeneratedText(un,dn,xn)}let Rn=await yc(te.transform,xn,{kind:"component",component:en,filePath:sn});return Je.write(tn,Rn)}),zt=(async()=>{let en=await yc(te.transform,Ht,{kind:"index",filePath:"index.d.ts"});return Je.write(ve,`${en}
|
|
233
|
-
`)})(),Xt=(await Promise.all([...Kt,zt])).filter(Boolean).length,Zt=Kt.length+1,Qt=Xt===0?`unchanged ${Zt}`:`created ${Xt} of ${Zt}`;Gn(`${Qt} TypeScript definitions in "${te.outDir}".`)}var vm=["reportDiagnostics","strict","check","checkLevel","stdout","format"],Em=50;function Sm(O){let te=Promise.resolve();return()=>{te=te.then(O,O)}}function Jt(O){let te=O?.watch===!0,ve,Je,Gt=O??{},Wt,Ht=null,Ft,Kt=new Set,Xt=Sm(async()=>{if(Ht==null||Je==null||Kt.size===0)return;let Qt=Array.from(Kt);Kt.clear();try{let{result:en}=await Ht.update(Qt);await M(en,Gt,Je),en.cache?.save()}catch(en){console.error("sveld: failed to regenerate types in watch mode:",en)}}),Zt=(Qt)=>{if(!te||Ht==null||!Ca.test(Qt))return;Kt.add(Qt),clearTimeout(Ft),Ft=setTimeout(Xt,Em)};return{name:"vite-plugin-sveld",apply:te?void 0:"build",enforce:"post",configResolved(Qt){Wt=Qt.root},async buildStart(){if(O?.config){let en=Wt??process.cwd(),tn=typeof O.config==="string"?await K(ym(O.config)?O.config:xm(en,O.config)):await q(en);Gt=R(tn,O)}F(Gt);let Qt=vm.filter((en)=>(en in Gt));if(Qt.length>0)console.warn(`sveld: the Vite plugin ignores ${Qt.map((en)=>`"${en}"`).join(", ")}; run the sveld CLI or sveld() for them.`);if(V(Gt.quiet===!0),Je=Ai(Gt.entry),te&&Je!=null)try{Ht=await qp(Je,Gt.glob===!0,D(Gt));let en=await Ht.result;await M(en,Gt,Je),en.cache?.save()}catch(en){console.error("sveld: failed to generate initial types in watch mode:",en)}},async generateBundle(){if(te)return;if(Je==null)this.error(Bs);ve=await L(Je,Gt.glob===!0,D(Gt))},async writeBundle(){if(te)return;if(Je==null)this.error(Bs);await M(ve,Gt,Je),ve.cache?.save()},handleHotUpdate(Qt){Zt(Qt.file)},watchChange(Qt){Zt(Qt)}}}async function M(O,te,ve){let Je=xc(ve);if(te.types!==!1)await vo(O.allComponentsForTypes,{outDir:"types",preamble:"",...te.typesOptions,exports:O.exports,inputDir:Je,cache:O.cache,resolvedPathByFilePath:O.resolvedPathByFilePath,crossFileResolvedPathByFilePath:O.crossFileResolvedPathByFilePath});if(te.json)await so(O.components,{outFile:"COMPONENT_API.json",...te.jsonOptions,inputDir:Je,entryExports:O.entryExports});if(te.markdown)await xo(O.components,{outFile:"COMPONENT_INDEX.md",...te.markdownOptions,entryExports:O.entryExports})}async function qt(O,te,ve){if(te.json){let Je=no(O.components,{...te.jsonOptions,inputDir:xc(ve),entryExports:O.entryExports});process.stdout.write(Je);return}if(te.markdown){let Je=yo(O.components,{...te.markdownOptions,entryExports:O.entryExports});process.stdout.write(Je)}}import{dirname as bm}from"node:path";function je(O){if(O.check&&!O.check.snapshotExists&&!O.writesSnapshot)return 1;if(O.check?.changes.some((te)=>te.kind==="schema"))return 1;if(O.errors.length>0)return 2;if(O.check&&Da(O.check.bump,O.checkLevel??"major"))return 3;if(Do(O.diagnostics,O.strict).length>0)return 4;return 0}async function Ut(O){if(O&&"input"in O)throw Error("sveld: the `input` option was renamed to `entry`.");let{entry:te,...ve}=O??{},Je=await q(),Gt=Ai(te??Je.entry);if(Gt===null)throw Error(Bs);let Wt=R(Je,ve,{entry:Gt});F(Wt),V(Wt.quiet===!0);let Ht=await L(Gt,Wt.glob===!0,D(Wt)),Ft=Wt.check?await J(Ht.components,Ee(Wt),{entryExports:Ht.entryExports}):void 0;await M(Ht,Wt,Gt),Ht.cache?.save();let Kt=Wt.reportDiagnostics||Wt.strict,zt=oe(Ht.diagnostics,Kt);if(Kt&&zt.length>0)if(Wt.format==="json")process.stderr.write(ce(zt));else console.error(ae(zt));let Xt=je({errors:Ht.errors,check:Ft,writesSnapshot:Ft?Se(Wt,Ft.snapshotFile):!1,checkLevel:Wt.checkLevel,diagnostics:zt,strict:Wt.strict}),Zt=to(Ht.components,{inputDir:bm(Gt),entryExports:Ht.entryExports,source:Wt.jsonOptions?.source});return{diagnostics:zt,check:Ft,errors:Ht.errors,document:Zt,exitCode:Xt}}
|
|
234
|
-
export{x,ne,g,P,Ce,G,re,De,W,T,u,a,i,qe,A,t,b,p,f,w,Fe,Pe,v,c,s,ie,_,se,o,oe,H,ae,Ve,ce,z,X,E,Q,S,y,l,N,Y,pe,Ae,Z,ue,Ue,_e,le,fe,h,k,r,de,me,e,Ge,We,He,ze,Xe,Qe,Ye,Ze,Ke,et,Ne,tt,nt,Ie,rt,it,st,ot,Re,Le,at,Me,ct,pt,C,ut,lt,ft,dt,mt,ht,gt,yt,xt,Oe,Tt,Et,St,kt,bt,wt,he,vt,Ct,Dt,$e,Pt,At,_t,Nt,d,It,Rt,Lt,ge,ye,B,Mt,Ot,j,xe,Te,I,n,$t,m,Bt,Ee,Se,J,ke,jt,be,Vt,K,q,R,F,ee,V,we,U,D,L,Be,Jt,M,qt,je,Ut};
|