@shiplightai/mcp 0.1.49 → 0.1.50
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/dist/{agentHelpers-242MN5TR-AK52N3RJ.js → agentHelpers-ZEELTQHQ-7LTM7RPI.js} +1 -1
- package/dist/agentLogin-JJ76YIVR-ODLFUWNL.js +4 -0
- package/dist/{chunk-JT3U4KNR.js → chunk-2BZVD336.js} +1 -1
- package/dist/{chunk-HQNPMIQW.js → chunk-4DIUHKFB.js} +2 -2
- package/dist/{chunk-ORSFJVJL.js → chunk-5GG34OWS.js} +3 -3
- package/dist/chunk-HBXQFJ2K.js +4 -0
- package/dist/{chunk-GZSLCYQ7.js → chunk-KI54PAOH.js} +28 -28
- package/dist/chunk-OZ36UVHR.js +3999 -0
- package/dist/{chunk-Z3E7FIDS.js → chunk-UBUBM7F7.js} +1 -1
- package/dist/{chunk-AFEFEPKR.js → chunk-VBI4DDSS.js} +1 -1
- package/dist/{chunk-PFLXO7G4.js → chunk-X5NUVPAF.js} +1 -1
- package/dist/{chunk-KW4N7WFX.js → chunk-XWDTDVL5.js} +4 -4
- package/dist/{chunk-RSM4LZ5P.js → chunk-Y64TKFRF.js} +3203 -3203
- package/dist/dist-FVIJHOEK.js +4 -0
- package/dist/dist-T3EAKPBA.js +4 -0
- package/dist/{handler-2DVP4PMD-IFR4HH7D.js → handler-QSEXJ3YG-BK26HZ5S.js} +1 -1
- package/dist/index.js +2 -2
- package/dist/relayBrowserCache-QL6LD4JJ-RCZSXWM6.js +4 -0
- package/dist/server-SF3CTCCU.js +22 -0
- package/dist/{task-2JIXKMIY-CMX3BD6Z.js → task-5N7K2U7O-UX3BL63L.js} +1 -1
- package/package.json +1 -1
- package/dist/agentLogin-VLDCPI66-52P67BMY.js +0 -4
- package/dist/chunk-34YV5HSR.js +0 -3999
- package/dist/chunk-JKHKVGEC.js +0 -4
- package/dist/dist-VVPHZ43R.js +0 -4
- package/dist/dist-YNN5UBVC.js +0 -4
- package/dist/relayBrowserCache-QL6LD4JJ-TKU47MOI.js +0 -4
- package/dist/server-KGF6BY7H.js +0 -22
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __createRequire } from "module";
|
|
3
3
|
const require = __createRequire(import.meta.url);
|
|
4
|
-
import{a as nt,b as z,c as V,d as De,e as ue,f as j,j as K,l as X}from"./chunk-
|
|
4
|
+
import{a as nt,b as z,c as V,d as De,e as ue,f as j,j as K,l as X}from"./chunk-X5NUVPAF.js";import{d as W,f as Zt,g as es,h as at}from"./chunk-HBXQFJ2K.js";import{c as ts,d as ss}from"./chunk-ETDHHU35.js";import{createRequire as Or}from"module";import{z as Rr}from"zod";import{z as is}from"zod";import{z as rs}from"zod";import{z as as}from"zod";import{z as ot}from"zod";import{z as Fe}from"zod";import{z as Le}from"zod";import{z as os}from"zod";import na from"fs";import oa from"path";import{z as oe}from"zod";import{z as hs}from"zod";import{z as cs}from"zod";import{z as ps}from"zod";import{z as ya}from"zod";import{z as ht}from"zod";import{z as ct}from"zod";import{z as pt}from"zod";import{z as Te}from"zod";import{z as ys}from"zod";import{z as xs}from"zod";import{z as La}from"zod";import{z as Oe}from"zod";import{z as ut}from"zod";import{z as Me}from"zod";import{z as Es}from"zod";import{z as dt}from"zod";import{z as mt}from"zod";import{z as ks}from"zod";import{z as vs}from"zod";import*as Qa from"playwright/test";import{default as Za}from"playwright/test";import{z as yt}from"zod";import{z as xt}from"zod";import{z as gt}from"zod";var dn=Or(import.meta.url),Mr=ts(n=>{"use strict";Object.defineProperty(n,"__esModule",{value:!0});function l(t,e){if(t==null)return{};var s={};for(var i in t)if({}.hasOwnProperty.call(t,i)){if(e.indexOf(i)!==-1)continue;s[i]=t[i]}return s}var c=class{constructor(t,e,s){this.line=void 0,this.column=void 0,this.index=void 0,this.line=t,this.column=e,this.index=s}},u=class{constructor(t,e){this.start=void 0,this.end=void 0,this.filename=void 0,this.identifierName=void 0,this.start=t,this.end=e}};function h(t,e){let{line:s,column:i,index:r}=t;return new c(s,i+e,r+e)}var y="BABEL_PARSER_SOURCETYPE_MODULE_REQUIRED",x={ImportMetaOutsideModule:{message:`import.meta may appear only with 'sourceType: "module"'`,code:y},ImportOutsideModule:{message:`'import' and 'export' may appear only with 'sourceType: "module"'`,code:y}},w={ArrayPattern:"array destructuring pattern",AssignmentExpression:"assignment expression",AssignmentPattern:"assignment expression",ArrowFunctionExpression:"arrow function expression",ConditionalExpression:"conditional expression",CatchClause:"catch clause",ForOfStatement:"for-of statement",ForInStatement:"for-in statement",ForStatement:"for-loop",FormalParameters:"function parameter list",Identifier:"identifier",ImportSpecifier:"import specifier",ImportDefaultSpecifier:"import default specifier",ImportNamespaceSpecifier:"import namespace specifier",ObjectPattern:"object destructuring pattern",ParenthesizedExpression:"parenthesized expression",RestElement:"rest element",UpdateExpression:{true:"prefix operation",false:"postfix operation"},VariableDeclarator:"variable declaration",YieldExpression:"yield expression"},g=t=>t.type==="UpdateExpression"?w.UpdateExpression[`${t.prefix}`]:w[t.type],E={AccessorIsGenerator:({kind:t})=>`A ${t}ter cannot be a generator.`,ArgumentsInClass:"'arguments' is only allowed in functions and class methods.",AsyncFunctionInSingleStatementContext:"Async functions can only be declared at the top level or inside a block.",AwaitBindingIdentifier:"Can not use 'await' as identifier inside an async function.",AwaitBindingIdentifierInStaticBlock:"Can not use 'await' as identifier inside a static block.",AwaitExpressionFormalParameter:"'await' is not allowed in async function parameters.",AwaitUsingNotInAsyncContext:"'await using' is only allowed within async functions and at the top levels of modules.",AwaitNotInAsyncContext:"'await' is only allowed within async functions and at the top levels of modules.",BadGetterArity:"A 'get' accessor must not have any formal parameters.",BadSetterArity:"A 'set' accessor must have exactly one formal parameter.",BadSetterRestParameter:"A 'set' accessor function argument must not be a rest parameter.",ConstructorClassField:"Classes may not have a field named 'constructor'.",ConstructorClassPrivateField:"Classes may not have a private field named '#constructor'.",ConstructorIsAccessor:"Class constructor may not be an accessor.",ConstructorIsAsync:"Constructor can't be an async function.",ConstructorIsGenerator:"Constructor can't be a generator.",DeclarationMissingInitializer:({kind:t})=>`Missing initializer in ${t} declaration.`,DecoratorArgumentsOutsideParentheses:"Decorator arguments must be moved inside parentheses: use '@(decorator(args))' instead of '@(decorator)(args)'.",DecoratorBeforeExport:"Decorators must be placed *before* the 'export' keyword. Remove the 'decoratorsBeforeExport: true' option to use the 'export @decorator class {}' syntax.",DecoratorsBeforeAfterExport:"Decorators can be placed *either* before or after the 'export' keyword, but not in both locations at the same time.",DecoratorConstructor:"Decorators can't be used with a constructor. Did you mean '@dec class { ... }'?",DecoratorExportClass:"Decorators must be placed *after* the 'export' keyword. Remove the 'decoratorsBeforeExport: false' option to use the '@decorator export class {}' syntax.",DecoratorSemicolon:"Decorators must not be followed by a semicolon.",DecoratorStaticBlock:"Decorators can't be used with a static block.",DeferImportRequiresNamespace:'Only `import defer * as x from "./module"` is valid.',DeletePrivateField:"Deleting a private field is not allowed.",DestructureNamedImport:"ES2015 named imports do not destructure. Use another statement for destructuring after the import.",DuplicateConstructor:"Duplicate constructor in the same class.",DuplicateDefaultExport:"Only one default export allowed per module.",DuplicateExport:({exportName:t})=>`\`${t}\` has already been exported. Exported identifiers must be unique.`,DuplicateProto:"Redefinition of __proto__ property.",DuplicateRegExpFlags:"Duplicate regular expression flag.",ElementAfterRest:"Rest element must be last element.",EscapedCharNotAnIdentifier:"Invalid Unicode escape.",ExportBindingIsString:({localName:t,exportName:e})=>`A string literal cannot be used as an exported binding without \`from\`.
|
|
5
5
|
- Did you mean \`export { '${t}' as '${e}' } from 'some-module'\`?`,ExportDefaultFromAsIdentifier:"'from' is not allowed as an identifier after 'export default'.",ForInOfLoopInitializer:({type:t})=>`'${t==="ForInStatement"?"for-in":"for-of"}' loop variable declaration may not have an initializer.`,ForInUsing:"For-in loop may not start with 'using' declaration.",ForOfAsync:"The left-hand side of a for-of loop may not be 'async'.",ForOfLet:"The left-hand side of a for-of loop may not start with 'let'.",GeneratorInSingleStatementContext:"Generators can only be declared at the top level or inside a block.",IllegalBreakContinue:({type:t})=>`Unsyntactic ${t==="BreakStatement"?"break":"continue"}.`,IllegalLanguageModeDirective:"Illegal 'use strict' directive in function with non-simple parameter list.",IllegalReturn:"'return' outside of function.",ImportAttributesUseAssert:"The `assert` keyword in import attributes is deprecated and it has been replaced by the `with` keyword. You can enable the `deprecatedImportAssert` parser plugin to suppress this error.",ImportBindingIsString:({importName:t})=>`A string literal cannot be used as an imported binding.
|
|
6
6
|
- Did you mean \`import { "${t}" as foo }\`?`,ImportCallArity:"`import()` requires exactly one or two arguments.",ImportCallNotNewExpression:"Cannot use new with import(...).",ImportCallSpreadArgument:"`...` is not allowed in `import()`.",ImportJSONBindingNotDefault:"A JSON module can only be imported with `default`.",ImportReflectionHasAssertion:"`import module x` cannot have assertions.",ImportReflectionNotBinding:'Only `import module x from "./module"` is valid.',IncompatibleRegExpUVFlags:"The 'u' and 'v' regular expression flags cannot be enabled at the same time.",InvalidBigIntLiteral:"Invalid BigIntLiteral.",InvalidCodePoint:"Code point out of bounds.",InvalidCoverDiscardElement:"'void' must be followed by an expression when not used in a binding position.",InvalidCoverInitializedName:"Invalid shorthand property initializer.",InvalidDecimal:"Invalid decimal.",InvalidDigit:({radix:t})=>`Expected number in radix ${t}.`,InvalidEscapeSequence:"Bad character escape sequence.",InvalidEscapeSequenceTemplate:"Invalid escape sequence in template.",InvalidEscapedReservedWord:({reservedWord:t})=>`Escape sequence in keyword ${t}.`,InvalidIdentifier:({identifierName:t})=>`Invalid identifier ${t}.`,InvalidLhs:({ancestor:t})=>`Invalid left-hand side in ${g(t)}.`,InvalidLhsBinding:({ancestor:t})=>`Binding invalid left-hand side in ${g(t)}.`,InvalidLhsOptionalChaining:({ancestor:t})=>`Invalid optional chaining in the left-hand side of ${g(t)}.`,InvalidNumber:"Invalid number.",InvalidOrMissingExponent:"Floating-point numbers require a valid exponent after the 'e'.",InvalidOrUnexpectedToken:({unexpected:t})=>`Unexpected character '${t}'.`,InvalidParenthesizedAssignment:"Invalid parenthesized assignment pattern.",InvalidPrivateFieldResolution:({identifierName:t})=>`Private name #${t} is not defined.`,InvalidPropertyBindingPattern:"Binding member expression.",InvalidRecordProperty:"Only properties and spread elements are allowed in record definitions.",InvalidRestAssignmentPattern:"Invalid rest operator's argument.",LabelRedeclaration:({labelName:t})=>`Label '${t}' is already declared.`,LetInLexicalBinding:"'let' is disallowed as a lexically bound name.",LineTerminatorBeforeArrow:"No line break is allowed before '=>'.",MalformedRegExpFlags:"Invalid regular expression flag.",MissingClassName:"A class name is required.",MissingEqInAssignment:"Only '=' operator can be used for specifying default value.",MissingSemicolon:"Missing semicolon.",MissingPlugin:({missingPlugin:t})=>`This experimental syntax requires enabling the parser plugin: ${t.map(e=>JSON.stringify(e)).join(", ")}.`,MissingOneOfPlugins:({missingPlugin:t})=>`This experimental syntax requires enabling one of the following parser plugin(s): ${t.map(e=>JSON.stringify(e)).join(", ")}.`,MissingUnicodeEscape:"Expecting Unicode escape sequence \\uXXXX.",MixingCoalesceWithLogical:"Nullish coalescing operator(??) requires parens when mixing with logical operators.",ModuleAttributeDifferentFromType:"The only accepted module attribute is `type`.",ModuleAttributeInvalidValue:"Only string literals are allowed as module attribute values.",ModuleAttributesWithDuplicateKeys:({key:t})=>`Duplicate key "${t}" is not allowed in module attributes.`,ModuleExportNameHasLoneSurrogate:({surrogateCharCode:t})=>`An export name cannot include a lone surrogate, found '\\u${t.toString(16)}'.`,ModuleExportUndefined:({localName:t})=>`Export '${t}' is not defined.`,MultipleDefaultsInSwitch:"Multiple default clauses.",NewlineAfterThrow:"Illegal newline after throw.",NoCatchOrFinally:"Missing catch or finally clause.",NumberIdentifier:"Identifier directly after number.",NumericSeparatorInEscapeSequence:"Numeric separators are not allowed inside unicode escape sequences or hex escape sequences.",ObsoleteAwaitStar:"'await*' has been removed from the async functions proposal. Use Promise.all() instead.",OptionalChainingNoNew:"Constructors in/after an Optional Chain are not allowed.",OptionalChainingNoTemplate:"Tagged Template Literals are not allowed in optionalChain.",OverrideOnConstructor:"'override' modifier cannot appear on a constructor declaration.",ParamDupe:"Argument name clash.",PatternHasAccessor:"Object pattern can't contain getter or setter.",PatternHasMethod:"Object pattern can't contain methods.",PrivateInExpectedIn:({identifierName:t})=>`Private names are only allowed in property accesses (\`obj.#${t}\`) or in \`in\` expressions (\`#${t} in obj\`).`,PrivateNameRedeclaration:({identifierName:t})=>`Duplicate private name #${t}.`,RecordExpressionBarIncorrectEndSyntaxType:"Record expressions ending with '|}' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'.",RecordExpressionBarIncorrectStartSyntaxType:"Record expressions starting with '{|' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'.",RecordExpressionHashIncorrectStartSyntaxType:"Record expressions starting with '#{' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'hash'.",RecordNoProto:"'__proto__' is not allowed in Record expressions.",RestTrailingComma:"Unexpected trailing comma after rest element.",SloppyFunction:"In non-strict mode code, functions can only be declared at top level or inside a block.",SloppyFunctionAnnexB:"In non-strict mode code, functions can only be declared at top level, inside a block, or as the body of an if statement.",SourcePhaseImportRequiresDefault:'Only `import source x from "./module"` is valid.',StaticPrototype:"Classes may not have static property named prototype.",SuperNotAllowed:"`super()` is only valid inside a class constructor of a subclass. Maybe a typo in the method name ('constructor') or not extending another class?",SuperPrivateField:"Private fields can't be accessed on super.",TrailingDecorator:"Decorators must be attached to a class element.",TupleExpressionBarIncorrectEndSyntaxType:"Tuple expressions ending with '|]' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'.",TupleExpressionBarIncorrectStartSyntaxType:"Tuple expressions starting with '[|' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'.",TupleExpressionHashIncorrectStartSyntaxType:"Tuple expressions starting with '#[' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'hash'.",UnexpectedArgumentPlaceholder:"Unexpected argument placeholder.",UnexpectedAwaitAfterPipelineBody:'Unexpected "await" after pipeline body; await must have parentheses in minimal proposal.',UnexpectedDigitAfterHash:"Unexpected digit after hash token.",UnexpectedImportExport:"'import' and 'export' may only appear at the top level.",UnexpectedKeyword:({keyword:t})=>`Unexpected keyword '${t}'.`,UnexpectedLeadingDecorator:"Leading decorators must be attached to a class declaration.",UnexpectedLexicalDeclaration:"Lexical declaration cannot appear in a single-statement context.",UnexpectedNewTarget:"`new.target` can only be used in functions or class properties.",UnexpectedNumericSeparator:"A numeric separator is only allowed between two digits.",UnexpectedPrivateField:"Unexpected private name.",UnexpectedReservedWord:({reservedWord:t})=>`Unexpected reserved word '${t}'.`,UnexpectedSuper:"'super' is only allowed in object methods and classes.",UnexpectedToken:({expected:t,unexpected:e})=>`Unexpected token${e?` '${e}'.`:""}${t?`, expected "${t}"`:""}`,UnexpectedTokenUnaryExponentiation:"Illegal expression. Wrap left hand side or entire exponentiation in parentheses.",UnexpectedUsingDeclaration:"Using declaration cannot appear in the top level when source type is `script` or in the bare case statement.",UnexpectedVoidPattern:"Unexpected void binding.",UnsupportedBind:"Binding should be performed on object property.",UnsupportedDecoratorExport:"A decorated export must export a class declaration.",UnsupportedDefaultExport:"Only expressions, functions or classes are allowed as the `default` export.",UnsupportedImport:"`import` can only be used in `import()` or `import.meta`.",UnsupportedMetaProperty:({target:t,onlyValidPropertyName:e})=>`The only valid meta property for ${t} is ${t}.${e}.`,UnsupportedParameterDecorator:"Decorators cannot be used to decorate parameters.",UnsupportedPropertyDecorator:"Decorators cannot be used to decorate object literal properties.",UnsupportedSuper:"'super' can only be used with function calls (i.e. super()) or in property accesses (i.e. super.prop or super[prop]).",UnterminatedComment:"Unterminated comment.",UnterminatedRegExp:"Unterminated regular expression.",UnterminatedString:"Unterminated string constant.",UnterminatedTemplate:"Unterminated template.",UsingDeclarationExport:"Using declaration cannot be exported.",UsingDeclarationHasBindingPattern:"Using declaration cannot have destructuring patterns.",VarRedeclaration:({identifierName:t})=>`Identifier '${t}' has already been declared.`,VoidPatternCatchClauseParam:"A void binding can not be the catch clause parameter. Use `try { ... } catch { ... }` if you want to discard the caught error.",VoidPatternInitializer:"A void binding may not have an initializer.",YieldBindingIdentifier:"Can not use 'yield' as identifier inside a generator.",YieldInParameter:"Yield expression is not allowed in formal parameters.",YieldNotInGeneratorFunction:"'yield' is only allowed within generator functions.",ZeroDigitNumericSeparator:"Numeric separator can not be used after leading 0."},C={StrictDelete:"Deleting local variable in strict mode.",StrictEvalArguments:({referenceName:t})=>`Assigning to '${t}' in strict mode.`,StrictEvalArgumentsBinding:({bindingName:t})=>`Binding '${t}' in strict mode.`,StrictFunction:"In strict mode code, functions can only be declared at top level or inside a block.",StrictNumericEscape:"The only valid numeric escape in strict mode is '\\0'.",StrictOctalLiteral:"Legacy octal literals are not allowed in strict mode.",StrictWith:"'with' in strict mode."},M={ParseExpressionEmptyInput:"Unexpected parseExpression() input: The input is empty or contains only comments.",ParseExpressionExpectsEOF:({unexpected:t})=>`Unexpected parseExpression() input: The input should contain exactly one expression, but the first expression is followed by the unexpected character \`${String.fromCodePoint(t)}\`.`},H=new Set(["ArrowFunctionExpression","AssignmentExpression","ConditionalExpression","YieldExpression"]),Y=Object.assign({PipeBodyIsTighter:"Unexpected yield after pipeline body; any yield expression acting as Hack-style pipe body must be parenthesized due to its loose operator precedence.",PipeTopicRequiresHackPipes:'Topic reference is used, but the pipelineOperator plugin was not passed a "proposal": "hack" or "smart" option.',PipeTopicUnbound:"Topic reference is unbound; it must be inside a pipe body.",PipeTopicUnconfiguredToken:({token:t})=>`Invalid topic token ${t}. In order to use ${t} as a topic reference, the pipelineOperator plugin must be configured with { "proposal": "hack", "topicToken": "${t}" }.`,PipeTopicUnused:"Hack-style pipe body does not contain a topic reference; Hack-style pipes must use topic at least once.",PipeUnparenthesizedBody:({type:t})=>`Hack-style pipe body cannot be an unparenthesized ${g({type:t})}; please wrap it in parentheses.`},{PipelineBodyNoArrow:'Unexpected arrow "=>" after pipeline body; arrow function in pipeline body must be parenthesized.',PipelineBodySequenceExpression:"Pipeline body may not be a comma-separated sequence expression.",PipelineHeadSequenceExpression:"Pipeline head should not be a comma-separated sequence expression.",PipelineTopicUnused:"Pipeline is in topic style but does not use topic reference.",PrimaryTopicNotAllowed:"Topic reference was used in a lexical context without topic binding.",PrimaryTopicRequiresSmartPipeline:'Topic reference is used, but the pipelineOperator plugin was not passed a "proposal": "hack" or "smart" option.'}),Fs=["message"];function Tt(t,e,s){Object.defineProperty(t,e,{enumerable:!1,configurable:!0,value:s})}function Ls({toMessage:t,code:e,reasonCode:s,syntaxPlugin:i}){let r=s==="MissingPlugin"||s==="MissingOneOfPlugins";{let a={AccessorCannotDeclareThisParameter:"AccesorCannotDeclareThisParameter",AccessorCannotHaveTypeParameters:"AccesorCannotHaveTypeParameters",ConstInitializerMustBeStringOrNumericLiteralOrLiteralEnumReference:"ConstInitiailizerMustBeStringOrNumericLiteralOrLiteralEnumReference",SetAccessorCannotHaveOptionalParameter:"SetAccesorCannotHaveOptionalParameter",SetAccessorCannotHaveRestParameter:"SetAccesorCannotHaveRestParameter",SetAccessorCannotHaveReturnType:"SetAccesorCannotHaveReturnType"};a[s]&&(s=a[s])}return function a(o,p){let m=new SyntaxError;return m.code=e,m.reasonCode=s,m.loc=o,m.pos=o.index,m.syntaxPlugin=i,r&&(m.missingPlugin=p.missingPlugin),Tt(m,"clone",function(d={}){var A;let{line:P,column:T,index:k}=(A=d.loc)!=null?A:o;return a(new c(P,T,k),Object.assign({},p,d.details))}),Tt(m,"details",p),Object.defineProperty(m,"message",{configurable:!0,get(){let d=`${t(p)} (${o.line}:${o.column})`;return this.message=d,d},set(d){Object.defineProperty(this,"message",{value:d,writable:!0})}}),m}}function Q(t,e){if(Array.isArray(t))return i=>Q(i,t[0]);let s={};for(let i of Object.keys(t)){let r=t[i],a=typeof r=="string"?{message:()=>r}:typeof r=="function"?{message:r}:r,{message:o}=a,p=l(a,Fs),m=typeof o=="string"?()=>o:o;s[i]=Ls(Object.assign({code:"BABEL_PARSER_SYNTAX_ERROR",reasonCode:i,toMessage:m},e?{syntaxPlugin:e}:{},p))}return s}var f=Object.assign({},Q(x),Q(E),Q(C),Q(M),Q`pipelineOperator`(Y));function Bs(){return{sourceType:"script",sourceFilename:void 0,startIndex:0,startColumn:0,startLine:1,allowAwaitOutsideFunction:!1,allowReturnOutsideFunction:!1,allowNewTargetOutsideFunction:!1,allowImportExportEverywhere:!1,allowSuperOutsideMethod:!1,allowUndeclaredExports:!1,allowYieldOutsideFunction:!1,plugins:[],strictMode:void 0,ranges:!1,tokens:!1,createImportExpressions:!1,createParenthesizedExpressions:!1,errorRecovery:!1,attachComment:!0,annexB:!0}}function Os(t){let e=Bs();if(t==null)return e;if(t.annexB!=null&&t.annexB!==!1)throw new Error("The `annexB` option can only be set to `false`.");for(let s of Object.keys(e))t[s]!=null&&(e[s]=t[s]);if(e.startLine===1)t.startIndex==null&&e.startColumn>0?e.startIndex=e.startColumn:t.startColumn==null&&e.startIndex>0&&(e.startColumn=e.startIndex);else if((t.startColumn==null||t.startIndex==null)&&t.startIndex!=null)throw new Error("With a `startLine > 1` you must also specify `startIndex` and `startColumn`.");if(e.sourceType==="commonjs"){if(t.allowAwaitOutsideFunction!=null)throw new Error("The `allowAwaitOutsideFunction` option cannot be used with `sourceType: 'commonjs'`.");if(t.allowReturnOutsideFunction!=null)throw new Error("`sourceType: 'commonjs'` implies `allowReturnOutsideFunction: true`, please remove the `allowReturnOutsideFunction` option or use `sourceType: 'script'`.");if(t.allowNewTargetOutsideFunction!=null)throw new Error("`sourceType: 'commonjs'` implies `allowNewTargetOutsideFunction: true`, please remove the `allowNewTargetOutsideFunction` option or use `sourceType: 'script'`.")}return e}var{defineProperty:Ms}=Object,Et=(t,e)=>{t&&Ms(t,e,{enumerable:!1,value:t[e]})};function de(t){return Et(t.loc.start,"index"),Et(t.loc.end,"index"),t}var $s=t=>class extends t{parse(){let e=de(super.parse());return this.optionFlags&256&&(e.tokens=e.tokens.map(de)),e}parseRegExpLiteral({pattern:e,flags:s}){let i=null;try{i=new RegExp(e,s)}catch{}let r=this.estreeParseLiteral(i);return r.regex={pattern:e,flags:s},r}parseBigIntLiteral(e){let s;try{s=BigInt(e)}catch{s=null}let i=this.estreeParseLiteral(s);return i.bigint=String(i.value||e),i}parseDecimalLiteral(e){let s=this.estreeParseLiteral(null);return s.decimal=String(s.value||e),s}estreeParseLiteral(e){return this.parseLiteral(e,"Literal")}parseStringLiteral(e){return this.estreeParseLiteral(e)}parseNumericLiteral(e){return this.estreeParseLiteral(e)}parseNullLiteral(){return this.estreeParseLiteral(null)}parseBooleanLiteral(e){return this.estreeParseLiteral(e)}estreeParseChainExpression(e,s){let i=this.startNodeAtNode(e);return i.expression=e,this.finishNodeAt(i,"ChainExpression",s)}directiveToStmt(e){let s=e.value;delete e.value,this.castNodeTo(s,"Literal"),s.raw=s.extra.raw,s.value=s.extra.expressionValue;let i=this.castNodeTo(e,"ExpressionStatement");return i.expression=s,i.directive=s.extra.rawValue,delete s.extra,i}fillOptionalPropertiesForTSESLint(e){}cloneEstreeStringLiteral(e){let{start:s,end:i,loc:r,range:a,raw:o,value:p}=e,m=Object.create(e.constructor.prototype);return m.type="Literal",m.start=s,m.end=i,m.loc=r,m.range=a,m.raw=o,m.value=p,m}initFunction(e,s){super.initFunction(e,s),e.expression=!1}checkDeclaration(e){e!=null&&this.isObjectProperty(e)?this.checkDeclaration(e.value):super.checkDeclaration(e)}getObjectOrClassMethodParams(e){return e.value.params}isValidDirective(e){var s;return e.type==="ExpressionStatement"&&e.expression.type==="Literal"&&typeof e.expression.value=="string"&&!((s=e.expression.extra)!=null&&s.parenthesized)}parseBlockBody(e,s,i,r,a){super.parseBlockBody(e,s,i,r,a);let o=e.directives.map(p=>this.directiveToStmt(p));e.body=o.concat(e.body),delete e.directives}parsePrivateName(){let e=super.parsePrivateName();return this.getPluginOption("estree","classFeatures")?this.convertPrivateNameToPrivateIdentifier(e):e}convertPrivateNameToPrivateIdentifier(e){let s=super.getPrivateNameSV(e);return delete e.id,e.name=s,this.castNodeTo(e,"PrivateIdentifier")}isPrivateName(e){return this.getPluginOption("estree","classFeatures")?e.type==="PrivateIdentifier":super.isPrivateName(e)}getPrivateNameSV(e){return this.getPluginOption("estree","classFeatures")?e.name:super.getPrivateNameSV(e)}parseLiteral(e,s){let i=super.parseLiteral(e,s);return i.raw=i.extra.raw,delete i.extra,i}parseFunctionBody(e,s,i=!1){super.parseFunctionBody(e,s,i),e.expression=e.body.type!=="BlockStatement"}parseMethod(e,s,i,r,a,o,p=!1){let m=this.startNode();m.kind=e.kind,m=super.parseMethod(m,s,i,r,a,o,p),delete m.kind;let{typeParameters:d}=e;d&&(delete e.typeParameters,m.typeParameters=d,this.resetStartLocationFromNode(m,d));let A=this.castNodeTo(m,"FunctionExpression");return e.value=A,o==="ClassPrivateMethod"&&(e.computed=!1),o==="ObjectMethod"?(e.kind==="method"&&(e.kind="init"),e.shorthand=!1,this.finishNode(e,"Property")):this.finishNode(e,"MethodDefinition")}nameIsConstructor(e){return e.type==="Literal"?e.value==="constructor":super.nameIsConstructor(e)}parseClassProperty(...e){let s=super.parseClassProperty(...e);return this.getPluginOption("estree","classFeatures")&&this.castNodeTo(s,"PropertyDefinition"),s}parseClassPrivateProperty(...e){let s=super.parseClassPrivateProperty(...e);return this.getPluginOption("estree","classFeatures")&&(this.castNodeTo(s,"PropertyDefinition"),s.computed=!1),s}parseClassAccessorProperty(e){let s=super.parseClassAccessorProperty(e);return this.getPluginOption("estree","classFeatures")&&(s.abstract&&this.hasPlugin("typescript")?(delete s.abstract,this.castNodeTo(s,"TSAbstractAccessorProperty")):this.castNodeTo(s,"AccessorProperty")),s}parseObjectProperty(e,s,i,r){let a=super.parseObjectProperty(e,s,i,r);return a&&(a.kind="init",this.castNodeTo(a,"Property")),a}finishObjectProperty(e){return e.kind="init",this.finishNode(e,"Property")}isValidLVal(e,s,i,r){return e==="Property"?"value":super.isValidLVal(e,s,i,r)}isAssignable(e,s){return e!=null&&this.isObjectProperty(e)?this.isAssignable(e.value,s):super.isAssignable(e,s)}toAssignable(e,s=!1){if(e!=null&&this.isObjectProperty(e)){let{key:i,value:r}=e;this.isPrivateName(i)&&this.classScope.usePrivateName(this.getPrivateNameSV(i),i.loc.start),this.toAssignable(r,s)}else super.toAssignable(e,s)}toAssignableObjectExpressionProp(e,s,i){e.type==="Property"&&(e.kind==="get"||e.kind==="set")?this.raise(f.PatternHasAccessor,e.key):e.type==="Property"&&e.method?this.raise(f.PatternHasMethod,e.key):super.toAssignableObjectExpressionProp(e,s,i)}finishCallExpression(e,s){let i=super.finishCallExpression(e,s);if(i.callee.type==="Import"){var r;this.castNodeTo(i,"ImportExpression"),i.source=i.arguments[0],i.options=(r=i.arguments[1])!=null?r:null;{var a;i.attributes=(a=i.arguments[1])!=null?a:null}delete i.arguments,delete i.callee}else i.type==="OptionalCallExpression"?this.castNodeTo(i,"CallExpression"):i.optional=!1;return i}toReferencedArguments(e){e.type!=="ImportExpression"&&super.toReferencedArguments(e)}parseExport(e,s){let i=this.state.lastTokStartLoc,r=super.parseExport(e,s);switch(r.type){case"ExportAllDeclaration":r.exported=null;break;case"ExportNamedDeclaration":r.specifiers.length===1&&r.specifiers[0].type==="ExportNamespaceSpecifier"&&(this.castNodeTo(r,"ExportAllDeclaration"),r.exported=r.specifiers[0].exported,delete r.specifiers);case"ExportDefaultDeclaration":{var a;let{declaration:o}=r;o?.type==="ClassDeclaration"&&((a=o.decorators)==null?void 0:a.length)>0&&o.start===r.start&&this.resetStartLocation(r,i)}break}return r}stopParseSubscript(e,s){let i=super.stopParseSubscript(e,s);return s.optionalChainMember?this.estreeParseChainExpression(i,e.loc.end):i}parseMember(e,s,i,r,a){let o=super.parseMember(e,s,i,r,a);return o.type==="OptionalMemberExpression"?this.castNodeTo(o,"MemberExpression"):o.optional=!1,o}isOptionalMemberExpression(e){return e.type==="ChainExpression"?e.expression.type==="MemberExpression":super.isOptionalMemberExpression(e)}hasPropertyAsPrivateName(e){return e.type==="ChainExpression"&&(e=e.expression),super.hasPropertyAsPrivateName(e)}isObjectProperty(e){return e.type==="Property"&&e.kind==="init"&&!e.method}isObjectMethod(e){return e.type==="Property"&&(e.method||e.kind==="get"||e.kind==="set")}castNodeTo(e,s){let i=super.castNodeTo(e,s);return this.fillOptionalPropertiesForTSESLint(i),i}cloneIdentifier(e){let s=super.cloneIdentifier(e);return this.fillOptionalPropertiesForTSESLint(s),s}cloneStringLiteral(e){return e.type==="Literal"?this.cloneEstreeStringLiteral(e):super.cloneStringLiteral(e)}finishNodeAt(e,s,i){return de(super.finishNodeAt(e,s,i))}finishNode(e,s){let i=super.finishNode(e,s);return this.fillOptionalPropertiesForTSESLint(i),i}resetStartLocation(e,s){super.resetStartLocation(e,s),de(e)}resetEndLocation(e,s=this.state.lastTokEndLoc){super.resetEndLocation(e,s),de(e)}},me=class{constructor(t,e){this.token=void 0,this.preserveSpace=void 0,this.token=t,this.preserveSpace=!!e}},O={brace:new me("{"),j_oTag:new me("<tag"),j_cTag:new me("</tag"),j_expr:new me("<tag>...</tag>",!0)};O.template=new me("`",!0);var D=!0,b=!0,$e=!0,fe=!0,se=!0,Rs=!0,Ct=class{constructor(t,e={}){this.label=void 0,this.keyword=void 0,this.beforeExpr=void 0,this.startsExpr=void 0,this.rightAssociative=void 0,this.isLoop=void 0,this.isAssign=void 0,this.prefix=void 0,this.postfix=void 0,this.binop=void 0,this.label=t,this.keyword=e.keyword,this.beforeExpr=!!e.beforeExpr,this.startsExpr=!!e.startsExpr,this.rightAssociative=!!e.rightAssociative,this.isLoop=!!e.isLoop,this.isAssign=!!e.isAssign,this.prefix=!!e.prefix,this.postfix=!!e.postfix,this.binop=e.binop!=null?e.binop:null,this.updateContext=null}},Re=new Map;function B(t,e={}){e.keyword=t;let s=v(t,e);return Re.set(t,s),s}function q(t,e){return v(t,{beforeExpr:D,binop:e})}var ye=-1,ee=[],Ue=[],je=[],ze=[],Ve=[],He=[];function v(t,e={}){var s,i,r,a;return++ye,Ue.push(t),je.push((s=e.binop)!=null?s:-1),ze.push((i=e.beforeExpr)!=null?i:!1),Ve.push((r=e.startsExpr)!=null?r:!1),He.push((a=e.prefix)!=null?a:!1),ee.push(new Ct(t,e)),ye}function F(t,e={}){var s,i,r,a;return++ye,Re.set(t,ye),Ue.push(t),je.push((s=e.binop)!=null?s:-1),ze.push((i=e.beforeExpr)!=null?i:!1),Ve.push((r=e.startsExpr)!=null?r:!1),He.push((a=e.prefix)!=null?a:!1),ee.push(new Ct("name",e)),ye}var Us={bracketL:v("[",{beforeExpr:D,startsExpr:b}),bracketHashL:v("#[",{beforeExpr:D,startsExpr:b}),bracketBarL:v("[|",{beforeExpr:D,startsExpr:b}),bracketR:v("]"),bracketBarR:v("|]"),braceL:v("{",{beforeExpr:D,startsExpr:b}),braceBarL:v("{|",{beforeExpr:D,startsExpr:b}),braceHashL:v("#{",{beforeExpr:D,startsExpr:b}),braceR:v("}"),braceBarR:v("|}"),parenL:v("(",{beforeExpr:D,startsExpr:b}),parenR:v(")"),comma:v(",",{beforeExpr:D}),semi:v(";",{beforeExpr:D}),colon:v(":",{beforeExpr:D}),doubleColon:v("::",{beforeExpr:D}),dot:v("."),question:v("?",{beforeExpr:D}),questionDot:v("?."),arrow:v("=>",{beforeExpr:D}),template:v("template"),ellipsis:v("...",{beforeExpr:D}),backQuote:v("`",{startsExpr:b}),dollarBraceL:v("${",{beforeExpr:D,startsExpr:b}),templateTail:v("...`",{startsExpr:b}),templateNonTail:v("...${",{beforeExpr:D,startsExpr:b}),at:v("@"),hash:v("#",{startsExpr:b}),interpreterDirective:v("#!..."),eq:v("=",{beforeExpr:D,isAssign:fe}),assign:v("_=",{beforeExpr:D,isAssign:fe}),slashAssign:v("_=",{beforeExpr:D,isAssign:fe}),xorAssign:v("_=",{beforeExpr:D,isAssign:fe}),moduloAssign:v("_=",{beforeExpr:D,isAssign:fe}),incDec:v("++/--",{prefix:se,postfix:Rs,startsExpr:b}),bang:v("!",{beforeExpr:D,prefix:se,startsExpr:b}),tilde:v("~",{beforeExpr:D,prefix:se,startsExpr:b}),doubleCaret:v("^^",{startsExpr:b}),doubleAt:v("@@",{startsExpr:b}),pipeline:q("|>",0),nullishCoalescing:q("??",1),logicalOR:q("||",1),logicalAND:q("&&",2),bitwiseOR:q("|",3),bitwiseXOR:q("^",4),bitwiseAND:q("&",5),equality:q("==/!=/===/!==",6),lt:q("</>/<=/>=",7),gt:q("</>/<=/>=",7),relational:q("</>/<=/>=",7),bitShift:q("<</>>/>>>",8),bitShiftL:q("<</>>/>>>",8),bitShiftR:q("<</>>/>>>",8),plusMin:v("+/-",{beforeExpr:D,binop:9,prefix:se,startsExpr:b}),modulo:v("%",{binop:10,startsExpr:b}),star:v("*",{binop:10}),slash:q("/",10),exponent:v("**",{beforeExpr:D,binop:11,rightAssociative:!0}),_in:B("in",{beforeExpr:D,binop:7}),_instanceof:B("instanceof",{beforeExpr:D,binop:7}),_break:B("break"),_case:B("case",{beforeExpr:D}),_catch:B("catch"),_continue:B("continue"),_debugger:B("debugger"),_default:B("default",{beforeExpr:D}),_else:B("else",{beforeExpr:D}),_finally:B("finally"),_function:B("function",{startsExpr:b}),_if:B("if"),_return:B("return",{beforeExpr:D}),_switch:B("switch"),_throw:B("throw",{beforeExpr:D,prefix:se,startsExpr:b}),_try:B("try"),_var:B("var"),_const:B("const"),_with:B("with"),_new:B("new",{beforeExpr:D,startsExpr:b}),_this:B("this",{startsExpr:b}),_super:B("super",{startsExpr:b}),_class:B("class",{startsExpr:b}),_extends:B("extends",{beforeExpr:D}),_export:B("export"),_import:B("import",{startsExpr:b}),_null:B("null",{startsExpr:b}),_true:B("true",{startsExpr:b}),_false:B("false",{startsExpr:b}),_typeof:B("typeof",{beforeExpr:D,prefix:se,startsExpr:b}),_void:B("void",{beforeExpr:D,prefix:se,startsExpr:b}),_delete:B("delete",{beforeExpr:D,prefix:se,startsExpr:b}),_do:B("do",{isLoop:$e,beforeExpr:D}),_for:B("for",{isLoop:$e}),_while:B("while",{isLoop:$e}),_as:F("as",{startsExpr:b}),_assert:F("assert",{startsExpr:b}),_async:F("async",{startsExpr:b}),_await:F("await",{startsExpr:b}),_defer:F("defer",{startsExpr:b}),_from:F("from",{startsExpr:b}),_get:F("get",{startsExpr:b}),_let:F("let",{startsExpr:b}),_meta:F("meta",{startsExpr:b}),_of:F("of",{startsExpr:b}),_sent:F("sent",{startsExpr:b}),_set:F("set",{startsExpr:b}),_source:F("source",{startsExpr:b}),_static:F("static",{startsExpr:b}),_using:F("using",{startsExpr:b}),_yield:F("yield",{startsExpr:b}),_asserts:F("asserts",{startsExpr:b}),_checks:F("checks",{startsExpr:b}),_exports:F("exports",{startsExpr:b}),_global:F("global",{startsExpr:b}),_implements:F("implements",{startsExpr:b}),_intrinsic:F("intrinsic",{startsExpr:b}),_infer:F("infer",{startsExpr:b}),_is:F("is",{startsExpr:b}),_mixins:F("mixins",{startsExpr:b}),_proto:F("proto",{startsExpr:b}),_require:F("require",{startsExpr:b}),_satisfies:F("satisfies",{startsExpr:b}),_keyof:F("keyof",{startsExpr:b}),_readonly:F("readonly",{startsExpr:b}),_unique:F("unique",{startsExpr:b}),_abstract:F("abstract",{startsExpr:b}),_declare:F("declare",{startsExpr:b}),_enum:F("enum",{startsExpr:b}),_module:F("module",{startsExpr:b}),_namespace:F("namespace",{startsExpr:b}),_interface:F("interface",{startsExpr:b}),_type:F("type",{startsExpr:b}),_opaque:F("opaque",{startsExpr:b}),name:v("name",{startsExpr:b}),placeholder:v("%%",{startsExpr:b}),string:v("string",{startsExpr:b}),num:v("num",{startsExpr:b}),bigint:v("bigint",{startsExpr:b}),decimal:v("decimal",{startsExpr:b}),regexp:v("regexp",{startsExpr:b}),privateName:v("#name",{startsExpr:b}),eof:v("eof"),jsxName:v("jsxName"),jsxText:v("jsxText",{beforeExpr:D}),jsxTagStart:v("jsxTagStart",{startsExpr:b}),jsxTagEnd:v("jsxTagEnd")};function $(t){return t>=93&&t<=133}function js(t){return t<=92}function G(t){return t>=58&&t<=133}function St(t){return t>=58&&t<=137}function zs(t){return ze[t]}function xe(t){return Ve[t]}function Vs(t){return t>=29&&t<=33}function kt(t){return t>=129&&t<=131}function Hs(t){return t>=90&&t<=92}function qe(t){return t>=58&&t<=92}function qs(t){return t>=39&&t<=59}function Js(t){return t===34}function Ws(t){return He[t]}function Ks(t){return t>=121&&t<=123}function Xs(t){return t>=124&&t<=130}function ie(t){return Ue[t]}function Ee(t){return je[t]}function Ys(t){return t===57}function Ce(t){return t>=24&&t<=25}function te(t){return ee[t]}ee[8].updateContext=t=>{t.pop()},ee[5].updateContext=ee[7].updateContext=ee[23].updateContext=t=>{t.push(O.brace)},ee[22].updateContext=t=>{t[t.length-1]===O.template?t.pop():t.push(O.template)},ee[143].updateContext=t=>{t.push(O.j_expr,O.j_oTag)};var Je="\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088F\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5C\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDC-\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C8A\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7DC\uA7F1-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC",vt="\xB7\u0300-\u036F\u0387\u0483-\u0487\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u0669\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u06F0-\u06F9\u0711\u0730-\u074A\u07A6-\u07B0\u07C0-\u07C9\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0897-\u089F\u08CA-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0966-\u096F\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09E6-\u09EF\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A66-\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AE6-\u0AEF\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B66-\u0B6F\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0BE6-\u0BEF\u0C00-\u0C04\u0C3C\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0CE6-\u0CEF\u0CF3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D66-\u0D6F\u0D81-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0E50-\u0E59\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECE\u0ED0-\u0ED9\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1040-\u1049\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F-\u109D\u135D-\u135F\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u17E0-\u17E9\u180B-\u180D\u180F-\u1819\u18A9\u1920-\u192B\u1930-\u193B\u1946-\u194F\u19D0-\u19DA\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AB0-\u1ABD\u1ABF-\u1ADD\u1AE0-\u1AEB\u1B00-\u1B04\u1B34-\u1B44\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BB0-\u1BB9\u1BE6-\u1BF3\u1C24-\u1C37\u1C40-\u1C49\u1C50-\u1C59\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DFF\u200C\u200D\u203F\u2040\u2054\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\u30FB\uA620-\uA629\uA66F\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA82C\uA880\uA881\uA8B4-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F1\uA8FF-\uA909\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9D0-\uA9D9\uA9E5\uA9F0-\uA9F9\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA50-\uAA59\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uABF0-\uABF9\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFF10-\uFF19\uFF3F\uFF65",Gs=new RegExp("["+Je+"]"),Qs=new RegExp("["+Je+vt+"]");Je=vt=null;var It=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,4,51,13,310,10,21,11,7,25,5,2,41,2,8,70,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,7,25,39,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,39,27,10,22,251,41,7,1,17,5,57,28,11,0,9,21,43,17,47,20,28,22,13,52,58,1,3,0,14,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,20,1,64,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,31,9,2,0,3,0,2,37,2,0,26,0,2,0,45,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,38,6,186,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,19,72,200,32,32,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,24,43,261,18,16,0,2,12,2,33,125,0,80,921,103,110,18,195,2637,96,16,1071,18,5,26,3994,6,582,6842,29,1763,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,433,44,212,63,33,24,3,24,45,74,6,0,67,12,65,1,2,0,15,4,10,7381,42,31,98,114,8702,3,2,6,2,1,2,290,16,0,30,2,3,0,15,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,1845,30,7,5,262,61,147,44,11,6,17,0,322,29,19,43,485,27,229,29,3,0,208,30,2,2,2,1,2,6,3,4,10,1,225,6,2,3,2,1,2,14,2,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42719,33,4381,3,5773,3,7472,16,621,2467,541,1507,4938,6,8489],Zs=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,7,9,32,4,318,1,78,5,71,10,50,3,123,2,54,14,32,10,3,1,11,3,46,10,8,0,46,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,3,0,158,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,68,8,2,0,3,0,2,3,2,4,2,0,15,1,83,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,7,19,58,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,199,7,137,9,54,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,55,9,266,3,10,1,2,0,49,6,4,4,14,10,5350,0,7,14,11465,27,2343,9,87,9,39,4,60,6,26,9,535,9,470,0,2,54,8,3,82,0,12,1,19628,1,4178,9,519,45,3,22,543,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,101,0,161,6,10,9,357,0,62,13,499,13,245,1,2,9,233,0,3,0,8,1,6,0,475,6,110,6,6,9,4759,9,787719,239];function We(t,e){let s=65536;for(let i=0,r=e.length;i<r;i+=2){if(s+=e[i],s>t)return!1;if(s+=e[i+1],s>=t)return!0}return!1}function Z(t){return t<65?t===36:t<=90?!0:t<97?t===95:t<=122?!0:t<=65535?t>=170&&Gs.test(String.fromCharCode(t)):We(t,It)}function le(t){return t<48?t===36:t<58?!0:t<65?!1:t<=90?!0:t<97?t===95:t<=122?!0:t<=65535?t>=170&&Qs.test(String.fromCharCode(t)):We(t,It)||We(t,Zs)}var Ke={keyword:["break","case","catch","continue","debugger","default","do","else","finally","for","function","if","return","switch","throw","try","var","const","while","with","new","this","super","class","extends","export","import","null","true","false","in","instanceof","typeof","void","delete"],strict:["implements","interface","let","package","private","protected","public","static","yield"],strictBind:["eval","arguments"]},ei=new Set(Ke.keyword),ti=new Set(Ke.strict),si=new Set(Ke.strictBind);function Nt(t,e){return e&&t==="await"||t==="enum"}function _t(t,e){return Nt(t,e)||ti.has(t)}function Dt(t){return si.has(t)}function Ft(t,e){return _t(t,e)||Dt(t)}function ii(t){return ei.has(t)}function ri(t,e,s){return t===64&&e===64&&Z(s)}var ai=new Set(["break","case","catch","continue","debugger","default","do","else","finally","for","function","if","return","switch","throw","try","var","const","while","with","new","this","super","class","extends","export","import","null","true","false","in","instanceof","typeof","void","delete","implements","interface","let","package","private","protected","public","static","yield","eval","arguments","enum","await"]);function ni(t){return ai.has(t)}var Xe=class{constructor(t){this.flags=0,this.names=new Map,this.firstLexicalName="",this.flags=t}},Ye=class{constructor(t,e){this.parser=void 0,this.scopeStack=[],this.inModule=void 0,this.undefinedExports=new Map,this.parser=t,this.inModule=e}get inTopLevel(){return(this.currentScope().flags&1)>0}get inFunction(){return(this.currentVarScopeFlags()&2)>0}get allowSuper(){return(this.currentThisScopeFlags()&16)>0}get allowDirectSuper(){return(this.currentThisScopeFlags()&32)>0}get allowNewTarget(){return(this.currentThisScopeFlags()&512)>0}get inClass(){return(this.currentThisScopeFlags()&64)>0}get inClassAndNotInNonArrowFunction(){let t=this.currentThisScopeFlags();return(t&64)>0&&(t&2)===0}get inStaticBlock(){for(let t=this.scopeStack.length-1;;t--){let{flags:e}=this.scopeStack[t];if(e&128)return!0;if(e&1731)return!1}}get inNonArrowFunction(){return(this.currentThisScopeFlags()&2)>0}get inBareCaseStatement(){return(this.currentScope().flags&256)>0}get treatFunctionsAsVar(){return this.treatFunctionsAsVarInScope(this.currentScope())}createScope(t){return new Xe(t)}enter(t){this.scopeStack.push(this.createScope(t))}exit(){return this.scopeStack.pop().flags}treatFunctionsAsVarInScope(t){return!!(t.flags&130||!this.parser.inModule&&t.flags&1)}declareName(t,e,s){let i=this.currentScope();if(e&8||e&16){this.checkRedeclarationInScope(i,t,e,s);let r=i.names.get(t)||0;e&16?r=r|4:(i.firstLexicalName||(i.firstLexicalName=t),r=r|2),i.names.set(t,r),e&8&&this.maybeExportDefined(i,t)}else if(e&4)for(let r=this.scopeStack.length-1;r>=0&&(i=this.scopeStack[r],this.checkRedeclarationInScope(i,t,e,s),i.names.set(t,(i.names.get(t)||0)|1),this.maybeExportDefined(i,t),!(i.flags&1667));--r);this.parser.inModule&&i.flags&1&&this.undefinedExports.delete(t)}maybeExportDefined(t,e){this.parser.inModule&&t.flags&1&&this.undefinedExports.delete(e)}checkRedeclarationInScope(t,e,s,i){this.isRedeclaredInScope(t,e,s)&&this.parser.raise(f.VarRedeclaration,i,{identifierName:e})}isRedeclaredInScope(t,e,s){if(!(s&1))return!1;if(s&8)return t.names.has(e);let i=t.names.get(e)||0;return s&16?(i&2)>0||!this.treatFunctionsAsVarInScope(t)&&(i&1)>0:(i&2)>0&&!(t.flags&8&&t.firstLexicalName===e)||!this.treatFunctionsAsVarInScope(t)&&(i&4)>0}checkLocalExport(t){let{name:e}=t;this.scopeStack[0].names.has(e)||this.undefinedExports.set(e,t.loc.start)}currentScope(){return this.scopeStack[this.scopeStack.length-1]}currentVarScopeFlags(){for(let t=this.scopeStack.length-1;;t--){let{flags:e}=this.scopeStack[t];if(e&1667)return e}}currentThisScopeFlags(){for(let t=this.scopeStack.length-1;;t--){let{flags:e}=this.scopeStack[t];if(e&1731&&!(e&4))return e}}},oi=class extends Xe{constructor(...t){super(...t),this.declareFunctions=new Set}},li=class extends Ye{createScope(t){return new oi(t)}declareName(t,e,s){let i=this.currentScope();if(e&2048){this.checkRedeclarationInScope(i,t,e,s),this.maybeExportDefined(i,t),i.declareFunctions.add(t);return}super.declareName(t,e,s)}isRedeclaredInScope(t,e,s){if(super.isRedeclaredInScope(t,e,s))return!0;if(s&2048&&!t.declareFunctions.has(e)){let i=t.names.get(e);return(i&4)>0||(i&2)>0}return!1}checkLocalExport(t){this.scopeStack[0].declareFunctions.has(t.name)||super.checkLocalExport(t)}},hi=new Set(["_","any","bool","boolean","empty","extends","false","interface","mixed","null","number","static","string","true","typeof","void"]),N=Q`flow`({AmbiguousConditionalArrow:"Ambiguous expression: wrap the arrow functions in parentheses to disambiguate.",AmbiguousDeclareModuleKind:"Found both `declare module.exports` and `declare export` in the same module. Modules can only have 1 since they are either an ES module or they are a CommonJS module.",AssignReservedType:({reservedType:t})=>`Cannot overwrite reserved type ${t}.`,DeclareClassElement:"The `declare` modifier can only appear on class fields.",DeclareClassFieldInitializer:"Initializers are not allowed in fields with the `declare` modifier.",DuplicateDeclareModuleExports:"Duplicate `declare module.exports` statement.",EnumBooleanMemberNotInitialized:({memberName:t,enumName:e})=>`Boolean enum members need to be initialized. Use either \`${t} = true,\` or \`${t} = false,\` in enum \`${e}\`.`,EnumDuplicateMemberName:({memberName:t,enumName:e})=>`Enum member names need to be unique, but the name \`${t}\` has already been used before in enum \`${e}\`.`,EnumInconsistentMemberValues:({enumName:t})=>`Enum \`${t}\` has inconsistent member initializers. Either use no initializers, or consistently use literals (either booleans, numbers, or strings) for all member initializers.`,EnumInvalidExplicitType:({invalidEnumType:t,enumName:e})=>`Enum type \`${t}\` is not valid. Use one of \`boolean\`, \`number\`, \`string\`, or \`symbol\` in enum \`${e}\`.`,EnumInvalidExplicitTypeUnknownSupplied:({enumName:t})=>`Supplied enum type is not valid. Use one of \`boolean\`, \`number\`, \`string\`, or \`symbol\` in enum \`${t}\`.`,EnumInvalidMemberInitializerPrimaryType:({enumName:t,memberName:e,explicitType:s})=>`Enum \`${t}\` has type \`${s}\`, so the initializer of \`${e}\` needs to be a ${s} literal.`,EnumInvalidMemberInitializerSymbolType:({enumName:t,memberName:e})=>`Symbol enum members cannot be initialized. Use \`${e},\` in enum \`${t}\`.`,EnumInvalidMemberInitializerUnknownType:({enumName:t,memberName:e})=>`The enum member initializer for \`${e}\` needs to be a literal (either a boolean, number, or string) in enum \`${t}\`.`,EnumInvalidMemberName:({enumName:t,memberName:e,suggestion:s})=>`Enum member names cannot start with lowercase 'a' through 'z'. Instead of using \`${e}\`, consider using \`${s}\`, in enum \`${t}\`.`,EnumNumberMemberNotInitialized:({enumName:t,memberName:e})=>`Number enum members need to be initialized, e.g. \`${e} = 1\` in enum \`${t}\`.`,EnumStringMemberInconsistentlyInitialized:({enumName:t})=>`String enum members need to consistently either all use initializers, or use no initializers, in enum \`${t}\`.`,GetterMayNotHaveThisParam:"A getter cannot have a `this` parameter.",ImportReflectionHasImportType:"An `import module` declaration can not use `type` or `typeof` keyword.",ImportTypeShorthandOnlyInPureImport:"The `type` and `typeof` keywords on named imports can only be used on regular `import` statements. It cannot be used with `import type` or `import typeof` statements.",InexactInsideExact:"Explicit inexact syntax cannot appear inside an explicit exact object type.",InexactInsideNonObject:"Explicit inexact syntax cannot appear in class or interface definitions.",InexactVariance:"Explicit inexact syntax cannot have variance.",InvalidNonTypeImportInDeclareModule:"Imports within a `declare module` body must always be `import type` or `import typeof`.",MissingTypeParamDefault:"Type parameter declaration needs a default, since a preceding type parameter declaration has a default.",NestedDeclareModule:"`declare module` cannot be used inside another `declare module`.",NestedFlowComment:"Cannot have a flow comment inside another flow comment.",PatternIsOptional:Object.assign({message:"A binding pattern parameter cannot be optional in an implementation signature."},{reasonCode:"OptionalBindingPattern"}),SetterMayNotHaveThisParam:"A setter cannot have a `this` parameter.",SpreadVariance:"Spread properties cannot have variance.",ThisParamAnnotationRequired:"A type annotation is required for the `this` parameter.",ThisParamBannedInConstructor:"Constructors cannot have a `this` parameter; constructors don't bind `this` like other functions.",ThisParamMayNotBeOptional:"The `this` parameter cannot be optional.",ThisParamMustBeFirst:"The `this` parameter must be the first function parameter.",ThisParamNoDefault:"The `this` parameter may not have a default value.",TypeBeforeInitializer:"Type annotations must come before default assignments, e.g. instead of `age = 25: number` use `age: number = 25`.",TypeCastInPattern:"The type cast expression is expected to be wrapped with parenthesis.",UnexpectedExplicitInexactInObject:"Explicit inexact syntax must appear at the end of an inexact object.",UnexpectedReservedType:({reservedType:t})=>`Unexpected reserved type ${t}.`,UnexpectedReservedUnderscore:"`_` is only allowed as a type argument to call or new.",UnexpectedSpaceBetweenModuloChecks:"Spaces between `%` and `checks` are not allowed here.",UnexpectedSpreadType:"Spread operator cannot appear in class or interface definitions.",UnexpectedSubtractionOperand:'Unexpected token, expected "number" or "bigint".',UnexpectedTokenAfterTypeParameter:"Expected an arrow function after this type parameter declaration.",UnexpectedTypeParameterBeforeAsyncArrowFunction:"Type parameters must come after the async keyword, e.g. instead of `<T> async () => {}`, use `async <T>() => {}`.",UnsupportedDeclareExportKind:({unsupportedExportKind:t,suggestion:e})=>`\`declare export ${t}\` is not supported. Use \`${e}\` instead.`,UnsupportedStatementInDeclareModule:"Only declares and type imports are allowed inside declare module.",UnterminatedFlowComment:"Unterminated flow-comment."});function ci(t){return t.type==="DeclareExportAllDeclaration"||t.type==="DeclareExportDeclaration"&&(!t.declaration||t.declaration.type!=="TypeAlias"&&t.declaration.type!=="InterfaceDeclaration")}function Lt(t){return t.importKind==="type"||t.importKind==="typeof"}var pi={const:"declare export var",let:"declare export var",type:"export type",interface:"export interface"};function ui(t,e){let s=[],i=[];for(let r=0;r<t.length;r++)(e(t[r],r,t)?s:i).push(t[r]);return[s,i]}var di=/\*?\s*@((?:no)?flow)\b/,mi=t=>class extends t{constructor(...e){super(...e),this.flowPragma=void 0}getScopeHandler(){return li}shouldParseTypes(){return this.getPluginOption("flow","all")||this.flowPragma==="flow"}finishToken(e,s){e!==134&&e!==13&&e!==28&&this.flowPragma===void 0&&(this.flowPragma=null),super.finishToken(e,s)}addComment(e){if(this.flowPragma===void 0){let s=di.exec(e.value);if(s)if(s[1]==="flow")this.flowPragma="flow";else if(s[1]==="noflow")this.flowPragma="noflow";else throw new Error("Unexpected flow pragma")}super.addComment(e)}flowParseTypeInitialiser(e){let s=this.state.inType;this.state.inType=!0,this.expect(e||14);let i=this.flowParseType();return this.state.inType=s,i}flowParsePredicate(){let e=this.startNode(),s=this.state.startLoc;return this.next(),this.expectContextual(110),this.state.lastTokStartLoc.index>s.index+1&&this.raise(N.UnexpectedSpaceBetweenModuloChecks,s),this.eat(10)?(e.value=super.parseExpression(),this.expect(11),this.finishNode(e,"DeclaredPredicate")):this.finishNode(e,"InferredPredicate")}flowParseTypeAndPredicateInitialiser(){let e=this.state.inType;this.state.inType=!0,this.expect(14);let s=null,i=null;return this.match(54)?(this.state.inType=e,i=this.flowParsePredicate()):(s=this.flowParseType(),this.state.inType=e,this.match(54)&&(i=this.flowParsePredicate())),[s,i]}flowParseDeclareClass(e){return this.next(),this.flowParseInterfaceish(e,!0),this.finishNode(e,"DeclareClass")}flowParseDeclareFunction(e){this.next();let s=e.id=this.parseIdentifier(),i=this.startNode(),r=this.startNode();this.match(47)?i.typeParameters=this.flowParseTypeParameterDeclaration():i.typeParameters=null,this.expect(10);let a=this.flowParseFunctionTypeParams();return i.params=a.params,i.rest=a.rest,i.this=a._this,this.expect(11),[i.returnType,e.predicate]=this.flowParseTypeAndPredicateInitialiser(),r.typeAnnotation=this.finishNode(i,"FunctionTypeAnnotation"),s.typeAnnotation=this.finishNode(r,"TypeAnnotation"),this.resetEndLocation(s),this.semicolon(),this.scope.declareName(e.id.name,2048,e.id.loc.start),this.finishNode(e,"DeclareFunction")}flowParseDeclare(e,s){if(this.match(80))return this.flowParseDeclareClass(e);if(this.match(68))return this.flowParseDeclareFunction(e);if(this.match(74))return this.flowParseDeclareVariable(e);if(this.eatContextual(127))return this.match(16)?this.flowParseDeclareModuleExports(e):(s&&this.raise(N.NestedDeclareModule,this.state.lastTokStartLoc),this.flowParseDeclareModule(e));if(this.isContextual(130))return this.flowParseDeclareTypeAlias(e);if(this.isContextual(131))return this.flowParseDeclareOpaqueType(e);if(this.isContextual(129))return this.flowParseDeclareInterface(e);if(this.match(82))return this.flowParseDeclareExportDeclaration(e,s);throw this.unexpected()}flowParseDeclareVariable(e){return this.next(),e.id=this.flowParseTypeAnnotatableIdentifier(!0),this.scope.declareName(e.id.name,5,e.id.loc.start),this.semicolon(),this.finishNode(e,"DeclareVariable")}flowParseDeclareModule(e){this.scope.enter(0),this.match(134)?e.id=super.parseExprAtom():e.id=this.parseIdentifier();let s=e.body=this.startNode(),i=s.body=[];for(this.expect(5);!this.match(8);){let o=this.startNode();this.match(83)?(this.next(),!this.isContextual(130)&&!this.match(87)&&this.raise(N.InvalidNonTypeImportInDeclareModule,this.state.lastTokStartLoc),i.push(super.parseImport(o))):(this.expectContextual(125,N.UnsupportedStatementInDeclareModule),i.push(this.flowParseDeclare(o,!0)))}this.scope.exit(),this.expect(8),this.finishNode(s,"BlockStatement");let r=null,a=!1;return i.forEach(o=>{ci(o)?(r==="CommonJS"&&this.raise(N.AmbiguousDeclareModuleKind,o),r="ES"):o.type==="DeclareModuleExports"&&(a&&this.raise(N.DuplicateDeclareModuleExports,o),r==="ES"&&this.raise(N.AmbiguousDeclareModuleKind,o),r="CommonJS",a=!0)}),e.kind=r||"CommonJS",this.finishNode(e,"DeclareModule")}flowParseDeclareExportDeclaration(e,s){if(this.expect(82),this.eat(65))return this.match(68)||this.match(80)?e.declaration=this.flowParseDeclare(this.startNode()):(e.declaration=this.flowParseType(),this.semicolon()),e.default=!0,this.finishNode(e,"DeclareExportDeclaration");if(this.match(75)||this.isLet()||(this.isContextual(130)||this.isContextual(129))&&!s){let i=this.state.value;throw this.raise(N.UnsupportedDeclareExportKind,this.state.startLoc,{unsupportedExportKind:i,suggestion:pi[i]})}if(this.match(74)||this.match(68)||this.match(80)||this.isContextual(131))return e.declaration=this.flowParseDeclare(this.startNode()),e.default=!1,this.finishNode(e,"DeclareExportDeclaration");if(this.match(55)||this.match(5)||this.isContextual(129)||this.isContextual(130)||this.isContextual(131))return e=this.parseExport(e,null),e.type==="ExportNamedDeclaration"?(e.default=!1,delete e.exportKind,this.castNodeTo(e,"DeclareExportDeclaration")):this.castNodeTo(e,"DeclareExportAllDeclaration");throw this.unexpected()}flowParseDeclareModuleExports(e){return this.next(),this.expectContextual(111),e.typeAnnotation=this.flowParseTypeAnnotation(),this.semicolon(),this.finishNode(e,"DeclareModuleExports")}flowParseDeclareTypeAlias(e){this.next();let s=this.flowParseTypeAlias(e);return this.castNodeTo(s,"DeclareTypeAlias"),s}flowParseDeclareOpaqueType(e){this.next();let s=this.flowParseOpaqueType(e,!0);return this.castNodeTo(s,"DeclareOpaqueType"),s}flowParseDeclareInterface(e){return this.next(),this.flowParseInterfaceish(e,!1),this.finishNode(e,"DeclareInterface")}flowParseInterfaceish(e,s){if(e.id=this.flowParseRestrictedIdentifier(!s,!0),this.scope.declareName(e.id.name,s?17:8201,e.id.loc.start),this.match(47)?e.typeParameters=this.flowParseTypeParameterDeclaration():e.typeParameters=null,e.extends=[],this.eat(81))do e.extends.push(this.flowParseInterfaceExtends());while(!s&&this.eat(12));if(s){if(e.implements=[],e.mixins=[],this.eatContextual(117))do e.mixins.push(this.flowParseInterfaceExtends());while(this.eat(12));if(this.eatContextual(113))do e.implements.push(this.flowParseInterfaceExtends());while(this.eat(12))}e.body=this.flowParseObjectType({allowStatic:s,allowExact:!1,allowSpread:!1,allowProto:s,allowInexact:!1})}flowParseInterfaceExtends(){let e=this.startNode();return e.id=this.flowParseQualifiedTypeIdentifier(),this.match(47)?e.typeParameters=this.flowParseTypeParameterInstantiation():e.typeParameters=null,this.finishNode(e,"InterfaceExtends")}flowParseInterface(e){return this.flowParseInterfaceish(e,!1),this.finishNode(e,"InterfaceDeclaration")}checkNotUnderscore(e){e==="_"&&this.raise(N.UnexpectedReservedUnderscore,this.state.startLoc)}checkReservedType(e,s,i){hi.has(e)&&this.raise(i?N.AssignReservedType:N.UnexpectedReservedType,s,{reservedType:e})}flowParseRestrictedIdentifier(e,s){return this.checkReservedType(this.state.value,this.state.startLoc,s),this.parseIdentifier(e)}flowParseTypeAlias(e){return e.id=this.flowParseRestrictedIdentifier(!1,!0),this.scope.declareName(e.id.name,8201,e.id.loc.start),this.match(47)?e.typeParameters=this.flowParseTypeParameterDeclaration():e.typeParameters=null,e.right=this.flowParseTypeInitialiser(29),this.semicolon(),this.finishNode(e,"TypeAlias")}flowParseOpaqueType(e,s){return this.expectContextual(130),e.id=this.flowParseRestrictedIdentifier(!0,!0),this.scope.declareName(e.id.name,8201,e.id.loc.start),this.match(47)?e.typeParameters=this.flowParseTypeParameterDeclaration():e.typeParameters=null,e.supertype=null,this.match(14)&&(e.supertype=this.flowParseTypeInitialiser(14)),e.impltype=null,s||(e.impltype=this.flowParseTypeInitialiser(29)),this.semicolon(),this.finishNode(e,"OpaqueType")}flowParseTypeParameter(e=!1){let s=this.state.startLoc,i=this.startNode(),r=this.flowParseVariance(),a=this.flowParseTypeAnnotatableIdentifier();return i.name=a.name,i.variance=r,i.bound=a.typeAnnotation,this.match(29)?(this.eat(29),i.default=this.flowParseType()):e&&this.raise(N.MissingTypeParamDefault,s),this.finishNode(i,"TypeParameter")}flowParseTypeParameterDeclaration(){let e=this.state.inType,s=this.startNode();s.params=[],this.state.inType=!0,this.match(47)||this.match(143)?this.next():this.unexpected();let i=!1;do{let r=this.flowParseTypeParameter(i);s.params.push(r),r.default&&(i=!0),this.match(48)||this.expect(12)}while(!this.match(48));return this.expect(48),this.state.inType=e,this.finishNode(s,"TypeParameterDeclaration")}flowInTopLevelContext(e){if(this.curContext()!==O.brace){let s=this.state.context;this.state.context=[s[0]];try{return e()}finally{this.state.context=s}}else return e()}flowParseTypeParameterInstantiationInExpression(){if(this.reScan_lt()===47)return this.flowParseTypeParameterInstantiation()}flowParseTypeParameterInstantiation(){let e=this.startNode(),s=this.state.inType;return this.state.inType=!0,e.params=[],this.flowInTopLevelContext(()=>{this.expect(47);let i=this.state.noAnonFunctionType;for(this.state.noAnonFunctionType=!1;!this.match(48);)e.params.push(this.flowParseType()),this.match(48)||this.expect(12);this.state.noAnonFunctionType=i}),this.state.inType=s,!this.state.inType&&this.curContext()===O.brace&&this.reScan_lt_gt(),this.expect(48),this.finishNode(e,"TypeParameterInstantiation")}flowParseTypeParameterInstantiationCallOrNew(){if(this.reScan_lt()!==47)return null;let e=this.startNode(),s=this.state.inType;for(e.params=[],this.state.inType=!0,this.expect(47);!this.match(48);)e.params.push(this.flowParseTypeOrImplicitInstantiation()),this.match(48)||this.expect(12);return this.expect(48),this.state.inType=s,this.finishNode(e,"TypeParameterInstantiation")}flowParseInterfaceType(){let e=this.startNode();if(this.expectContextual(129),e.extends=[],this.eat(81))do e.extends.push(this.flowParseInterfaceExtends());while(this.eat(12));return e.body=this.flowParseObjectType({allowStatic:!1,allowExact:!1,allowSpread:!1,allowProto:!1,allowInexact:!1}),this.finishNode(e,"InterfaceTypeAnnotation")}flowParseObjectPropertyKey(){return this.match(135)||this.match(134)?super.parseExprAtom():this.parseIdentifier(!0)}flowParseObjectTypeIndexer(e,s,i){return e.static=s,this.lookahead().type===14?(e.id=this.flowParseObjectPropertyKey(),e.key=this.flowParseTypeInitialiser()):(e.id=null,e.key=this.flowParseType()),this.expect(3),e.value=this.flowParseTypeInitialiser(),e.variance=i,this.finishNode(e,"ObjectTypeIndexer")}flowParseObjectTypeInternalSlot(e,s){return e.static=s,e.id=this.flowParseObjectPropertyKey(),this.expect(3),this.expect(3),this.match(47)||this.match(10)?(e.method=!0,e.optional=!1,e.value=this.flowParseObjectTypeMethodish(this.startNodeAt(e.loc.start))):(e.method=!1,this.eat(17)&&(e.optional=!0),e.value=this.flowParseTypeInitialiser()),this.finishNode(e,"ObjectTypeInternalSlot")}flowParseObjectTypeMethodish(e){for(e.params=[],e.rest=null,e.typeParameters=null,e.this=null,this.match(47)&&(e.typeParameters=this.flowParseTypeParameterDeclaration()),this.expect(10),this.match(78)&&(e.this=this.flowParseFunctionTypeParam(!0),e.this.name=null,this.match(11)||this.expect(12));!this.match(11)&&!this.match(21);)e.params.push(this.flowParseFunctionTypeParam(!1)),this.match(11)||this.expect(12);return this.eat(21)&&(e.rest=this.flowParseFunctionTypeParam(!1)),this.expect(11),e.returnType=this.flowParseTypeInitialiser(),this.finishNode(e,"FunctionTypeAnnotation")}flowParseObjectTypeCallProperty(e,s){let i=this.startNode();return e.static=s,e.value=this.flowParseObjectTypeMethodish(i),this.finishNode(e,"ObjectTypeCallProperty")}flowParseObjectType({allowStatic:e,allowExact:s,allowSpread:i,allowProto:r,allowInexact:a}){let o=this.state.inType;this.state.inType=!0;let p=this.startNode();p.callProperties=[],p.properties=[],p.indexers=[],p.internalSlots=[];let m,d,A=!1;for(s&&this.match(6)?(this.expect(6),m=9,d=!0):(this.expect(5),m=8,d=!1),p.exact=d;!this.match(m);){let T=!1,k=null,L=null,R=this.startNode();if(r&&this.isContextual(118)){let U=this.lookahead();U.type!==14&&U.type!==17&&(this.next(),k=this.state.startLoc,e=!1)}if(e&&this.isContextual(106)){let U=this.lookahead();U.type!==14&&U.type!==17&&(this.next(),T=!0)}let _=this.flowParseVariance();if(this.eat(0))k!=null&&this.unexpected(k),this.eat(0)?(_&&this.unexpected(_.loc.start),p.internalSlots.push(this.flowParseObjectTypeInternalSlot(R,T))):p.indexers.push(this.flowParseObjectTypeIndexer(R,T,_));else if(this.match(10)||this.match(47))k!=null&&this.unexpected(k),_&&this.unexpected(_.loc.start),p.callProperties.push(this.flowParseObjectTypeCallProperty(R,T));else{let U="init";if(this.isContextual(99)||this.isContextual(104)){let Pe=this.lookahead();St(Pe.type)&&(U=this.state.value,this.next())}let J=this.flowParseObjectTypeProperty(R,T,k,_,U,i,a??!d);J===null?(A=!0,L=this.state.lastTokStartLoc):p.properties.push(J)}this.flowObjectTypeSemicolon(),L&&!this.match(8)&&!this.match(9)&&this.raise(N.UnexpectedExplicitInexactInObject,L)}this.expect(m),i&&(p.inexact=A);let P=this.finishNode(p,"ObjectTypeAnnotation");return this.state.inType=o,P}flowParseObjectTypeProperty(e,s,i,r,a,o,p){if(this.eat(21))return this.match(12)||this.match(13)||this.match(8)||this.match(9)?(o?p||this.raise(N.InexactInsideExact,this.state.lastTokStartLoc):this.raise(N.InexactInsideNonObject,this.state.lastTokStartLoc),r&&this.raise(N.InexactVariance,r),null):(o||this.raise(N.UnexpectedSpreadType,this.state.lastTokStartLoc),i!=null&&this.unexpected(i),r&&this.raise(N.SpreadVariance,r),e.argument=this.flowParseType(),this.finishNode(e,"ObjectTypeSpreadProperty"));{e.key=this.flowParseObjectPropertyKey(),e.static=s,e.proto=i!=null,e.kind=a;let m=!1;return this.match(47)||this.match(10)?(e.method=!0,i!=null&&this.unexpected(i),r&&this.unexpected(r.loc.start),e.value=this.flowParseObjectTypeMethodish(this.startNodeAt(e.loc.start)),(a==="get"||a==="set")&&this.flowCheckGetterSetterParams(e),!o&&e.key.name==="constructor"&&e.value.this&&this.raise(N.ThisParamBannedInConstructor,e.value.this)):(a!=="init"&&this.unexpected(),e.method=!1,this.eat(17)&&(m=!0),e.value=this.flowParseTypeInitialiser(),e.variance=r),e.optional=m,this.finishNode(e,"ObjectTypeProperty")}}flowCheckGetterSetterParams(e){let s=e.kind==="get"?0:1,i=e.value.params.length+(e.value.rest?1:0);e.value.this&&this.raise(e.kind==="get"?N.GetterMayNotHaveThisParam:N.SetterMayNotHaveThisParam,e.value.this),i!==s&&this.raise(e.kind==="get"?f.BadGetterArity:f.BadSetterArity,e),e.kind==="set"&&e.value.rest&&this.raise(f.BadSetterRestParameter,e)}flowObjectTypeSemicolon(){!this.eat(13)&&!this.eat(12)&&!this.match(8)&&!this.match(9)&&this.unexpected()}flowParseQualifiedTypeIdentifier(e,s){e??(e=this.state.startLoc);let i=s||this.flowParseRestrictedIdentifier(!0);for(;this.eat(16);){let r=this.startNodeAt(e);r.qualification=i,r.id=this.flowParseRestrictedIdentifier(!0),i=this.finishNode(r,"QualifiedTypeIdentifier")}return i}flowParseGenericType(e,s){let i=this.startNodeAt(e);return i.typeParameters=null,i.id=this.flowParseQualifiedTypeIdentifier(e,s),this.match(47)&&(i.typeParameters=this.flowParseTypeParameterInstantiation()),this.finishNode(i,"GenericTypeAnnotation")}flowParseTypeofType(){let e=this.startNode();return this.expect(87),e.argument=this.flowParsePrimaryType(),this.finishNode(e,"TypeofTypeAnnotation")}flowParseTupleType(){let e=this.startNode();for(e.types=[],this.expect(0);this.state.pos<this.length&&!this.match(3)&&(e.types.push(this.flowParseType()),!this.match(3));)this.expect(12);return this.expect(3),this.finishNode(e,"TupleTypeAnnotation")}flowParseFunctionTypeParam(e){let s=null,i=!1,r=null,a=this.startNode(),o=this.lookahead(),p=this.state.type===78;return o.type===14||o.type===17?(p&&!e&&this.raise(N.ThisParamMustBeFirst,a),s=this.parseIdentifier(p),this.eat(17)&&(i=!0,p&&this.raise(N.ThisParamMayNotBeOptional,a)),r=this.flowParseTypeInitialiser()):r=this.flowParseType(),a.name=s,a.optional=i,a.typeAnnotation=r,this.finishNode(a,"FunctionTypeParam")}reinterpretTypeAsFunctionTypeParam(e){let s=this.startNodeAt(e.loc.start);return s.name=null,s.optional=!1,s.typeAnnotation=e,this.finishNode(s,"FunctionTypeParam")}flowParseFunctionTypeParams(e=[]){let s=null,i=null;for(this.match(78)&&(i=this.flowParseFunctionTypeParam(!0),i.name=null,this.match(11)||this.expect(12));!this.match(11)&&!this.match(21);)e.push(this.flowParseFunctionTypeParam(!1)),this.match(11)||this.expect(12);return this.eat(21)&&(s=this.flowParseFunctionTypeParam(!1)),{params:e,rest:s,_this:i}}flowIdentToTypeAnnotation(e,s,i){switch(i.name){case"any":return this.finishNode(s,"AnyTypeAnnotation");case"bool":case"boolean":return this.finishNode(s,"BooleanTypeAnnotation");case"mixed":return this.finishNode(s,"MixedTypeAnnotation");case"empty":return this.finishNode(s,"EmptyTypeAnnotation");case"number":return this.finishNode(s,"NumberTypeAnnotation");case"string":return this.finishNode(s,"StringTypeAnnotation");case"symbol":return this.finishNode(s,"SymbolTypeAnnotation");default:return this.checkNotUnderscore(i.name),this.flowParseGenericType(e,i)}}flowParsePrimaryType(){let e=this.state.startLoc,s=this.startNode(),i,r,a=!1,o=this.state.noAnonFunctionType;switch(this.state.type){case 5:return this.flowParseObjectType({allowStatic:!1,allowExact:!1,allowSpread:!0,allowProto:!1,allowInexact:!0});case 6:return this.flowParseObjectType({allowStatic:!1,allowExact:!0,allowSpread:!0,allowProto:!1,allowInexact:!1});case 0:return this.state.noAnonFunctionType=!1,r=this.flowParseTupleType(),this.state.noAnonFunctionType=o,r;case 47:{let p=this.startNode();return p.typeParameters=this.flowParseTypeParameterDeclaration(),this.expect(10),i=this.flowParseFunctionTypeParams(),p.params=i.params,p.rest=i.rest,p.this=i._this,this.expect(11),this.expect(19),p.returnType=this.flowParseType(),this.finishNode(p,"FunctionTypeAnnotation")}case 10:{let p=this.startNode();if(this.next(),!this.match(11)&&!this.match(21))if($(this.state.type)||this.match(78)){let m=this.lookahead().type;a=m!==17&&m!==14}else a=!0;if(a){if(this.state.noAnonFunctionType=!1,r=this.flowParseType(),this.state.noAnonFunctionType=o,this.state.noAnonFunctionType||!(this.match(12)||this.match(11)&&this.lookahead().type===19))return this.expect(11),r;this.eat(12)}return r?i=this.flowParseFunctionTypeParams([this.reinterpretTypeAsFunctionTypeParam(r)]):i=this.flowParseFunctionTypeParams(),p.params=i.params,p.rest=i.rest,p.this=i._this,this.expect(11),this.expect(19),p.returnType=this.flowParseType(),p.typeParameters=null,this.finishNode(p,"FunctionTypeAnnotation")}case 134:return this.parseLiteral(this.state.value,"StringLiteralTypeAnnotation");case 85:case 86:return s.value=this.match(85),this.next(),this.finishNode(s,"BooleanLiteralTypeAnnotation");case 53:if(this.state.value==="-"){if(this.next(),this.match(135))return this.parseLiteralAtNode(-this.state.value,"NumberLiteralTypeAnnotation",s);if(this.match(136))return this.parseLiteralAtNode(-this.state.value,"BigIntLiteralTypeAnnotation",s);throw this.raise(N.UnexpectedSubtractionOperand,this.state.startLoc)}throw this.unexpected();case 135:return this.parseLiteral(this.state.value,"NumberLiteralTypeAnnotation");case 136:return this.parseLiteral(this.state.value,"BigIntLiteralTypeAnnotation");case 88:return this.next(),this.finishNode(s,"VoidTypeAnnotation");case 84:return this.next(),this.finishNode(s,"NullLiteralTypeAnnotation");case 78:return this.next(),this.finishNode(s,"ThisTypeAnnotation");case 55:return this.next(),this.finishNode(s,"ExistsTypeAnnotation");case 87:return this.flowParseTypeofType();default:if(qe(this.state.type)){let p=ie(this.state.type);return this.next(),super.createIdentifier(s,p)}else if($(this.state.type))return this.isContextual(129)?this.flowParseInterfaceType():this.flowIdentToTypeAnnotation(e,s,this.parseIdentifier())}throw this.unexpected()}flowParsePostfixType(){let e=this.state.startLoc,s=this.flowParsePrimaryType(),i=!1;for(;(this.match(0)||this.match(18))&&!this.canInsertSemicolon();){let r=this.startNodeAt(e),a=this.eat(18);i=i||a,this.expect(0),!a&&this.match(3)?(r.elementType=s,this.next(),s=this.finishNode(r,"ArrayTypeAnnotation")):(r.objectType=s,r.indexType=this.flowParseType(),this.expect(3),i?(r.optional=a,s=this.finishNode(r,"OptionalIndexedAccessType")):s=this.finishNode(r,"IndexedAccessType"))}return s}flowParsePrefixType(){let e=this.startNode();return this.eat(17)?(e.typeAnnotation=this.flowParsePrefixType(),this.finishNode(e,"NullableTypeAnnotation")):this.flowParsePostfixType()}flowParseAnonFunctionWithoutParens(){let e=this.flowParsePrefixType();if(!this.state.noAnonFunctionType&&this.eat(19)){let s=this.startNodeAt(e.loc.start);return s.params=[this.reinterpretTypeAsFunctionTypeParam(e)],s.rest=null,s.this=null,s.returnType=this.flowParseType(),s.typeParameters=null,this.finishNode(s,"FunctionTypeAnnotation")}return e}flowParseIntersectionType(){let e=this.startNode();this.eat(45);let s=this.flowParseAnonFunctionWithoutParens();for(e.types=[s];this.eat(45);)e.types.push(this.flowParseAnonFunctionWithoutParens());return e.types.length===1?s:this.finishNode(e,"IntersectionTypeAnnotation")}flowParseUnionType(){let e=this.startNode();this.eat(43);let s=this.flowParseIntersectionType();for(e.types=[s];this.eat(43);)e.types.push(this.flowParseIntersectionType());return e.types.length===1?s:this.finishNode(e,"UnionTypeAnnotation")}flowParseType(){let e=this.state.inType;this.state.inType=!0;let s=this.flowParseUnionType();return this.state.inType=e,s}flowParseTypeOrImplicitInstantiation(){if(this.state.type===132&&this.state.value==="_"){let e=this.state.startLoc,s=this.parseIdentifier();return this.flowParseGenericType(e,s)}else return this.flowParseType()}flowParseTypeAnnotation(){let e=this.startNode();return e.typeAnnotation=this.flowParseTypeInitialiser(),this.finishNode(e,"TypeAnnotation")}flowParseTypeAnnotatableIdentifier(e){let s=e?this.parseIdentifier():this.flowParseRestrictedIdentifier();return this.match(14)&&(s.typeAnnotation=this.flowParseTypeAnnotation(),this.resetEndLocation(s)),s}typeCastToParameter(e){return e.expression.typeAnnotation=e.typeAnnotation,this.resetEndLocation(e.expression,e.typeAnnotation.loc.end),e.expression}flowParseVariance(){let e=null;return this.match(53)?(e=this.startNode(),this.state.value==="+"?e.kind="plus":e.kind="minus",this.next(),this.finishNode(e,"Variance")):e}parseFunctionBody(e,s,i=!1){if(s){this.forwardNoArrowParamsConversionAt(e,()=>super.parseFunctionBody(e,!0,i));return}super.parseFunctionBody(e,!1,i)}parseFunctionBodyAndFinish(e,s,i=!1){if(this.match(14)){let r=this.startNode();[r.typeAnnotation,e.predicate]=this.flowParseTypeAndPredicateInitialiser(),e.returnType=r.typeAnnotation?this.finishNode(r,"TypeAnnotation"):null}return super.parseFunctionBodyAndFinish(e,s,i)}parseStatementLike(e){if(this.state.strict&&this.isContextual(129)){let i=this.lookahead();if(G(i.type)){let r=this.startNode();return this.next(),this.flowParseInterface(r)}}else if(this.isContextual(126)){let i=this.startNode();return this.next(),this.flowParseEnumDeclaration(i)}let s=super.parseStatementLike(e);return this.flowPragma===void 0&&!this.isValidDirective(s)&&(this.flowPragma=null),s}parseExpressionStatement(e,s,i){if(s.type==="Identifier"){if(s.name==="declare"){if(this.match(80)||$(this.state.type)||this.match(68)||this.match(74)||this.match(82))return this.flowParseDeclare(e)}else if($(this.state.type)){if(s.name==="interface")return this.flowParseInterface(e);if(s.name==="type")return this.flowParseTypeAlias(e);if(s.name==="opaque")return this.flowParseOpaqueType(e,!1)}}return super.parseExpressionStatement(e,s,i)}shouldParseExportDeclaration(){let{type:e}=this.state;return e===126||kt(e)?!this.state.containsEsc:super.shouldParseExportDeclaration()}isExportDefaultSpecifier(){let{type:e}=this.state;return e===126||kt(e)?this.state.containsEsc:super.isExportDefaultSpecifier()}parseExportDefaultExpression(){if(this.isContextual(126)){let e=this.startNode();return this.next(),this.flowParseEnumDeclaration(e)}return super.parseExportDefaultExpression()}parseConditional(e,s,i){if(!this.match(17))return e;if(this.state.maybeInArrowParameters){let P=this.lookaheadCharCode();if(P===44||P===61||P===58||P===41)return this.setOptionalParametersError(i),e}this.expect(17);let r=this.state.clone(),a=this.state.noArrowAt,o=this.startNodeAt(s),{consequent:p,failed:m}=this.tryParseConditionalConsequent(),[d,A]=this.getArrowLikeExpressions(p);if(m||A.length>0){let P=[...a];if(A.length>0){this.state=r,this.state.noArrowAt=P;for(let T=0;T<A.length;T++)P.push(A[T].start);({consequent:p,failed:m}=this.tryParseConditionalConsequent()),[d,A]=this.getArrowLikeExpressions(p)}m&&d.length>1&&this.raise(N.AmbiguousConditionalArrow,r.startLoc),m&&d.length===1&&(this.state=r,P.push(d[0].start),this.state.noArrowAt=P,{consequent:p,failed:m}=this.tryParseConditionalConsequent())}return this.getArrowLikeExpressions(p,!0),this.state.noArrowAt=a,this.expect(14),o.test=e,o.consequent=p,o.alternate=this.forwardNoArrowParamsConversionAt(o,()=>this.parseMaybeAssign(void 0,void 0)),this.finishNode(o,"ConditionalExpression")}tryParseConditionalConsequent(){this.state.noArrowParamsConversionAt.push(this.state.start);let e=this.parseMaybeAssignAllowIn(),s=!this.match(14);return this.state.noArrowParamsConversionAt.pop(),{consequent:e,failed:s}}getArrowLikeExpressions(e,s){let i=[e],r=[];for(;i.length!==0;){let a=i.pop();a.type==="ArrowFunctionExpression"&&a.body.type!=="BlockStatement"?(a.typeParameters||!a.returnType?this.finishArrowValidation(a):r.push(a),i.push(a.body)):a.type==="ConditionalExpression"&&(i.push(a.consequent),i.push(a.alternate))}return s?(r.forEach(a=>this.finishArrowValidation(a)),[r,[]]):ui(r,a=>a.params.every(o=>this.isAssignable(o,!0)))}finishArrowValidation(e){var s;this.toAssignableList(e.params,(s=e.extra)==null?void 0:s.trailingCommaLoc,!1),this.scope.enter(518),super.checkParams(e,!1,!0),this.scope.exit()}forwardNoArrowParamsConversionAt(e,s){let i;return this.state.noArrowParamsConversionAt.includes(this.offsetToSourcePos(e.start))?(this.state.noArrowParamsConversionAt.push(this.state.start),i=s(),this.state.noArrowParamsConversionAt.pop()):i=s(),i}parseParenItem(e,s){let i=super.parseParenItem(e,s);if(this.eat(17)&&(i.optional=!0,this.resetEndLocation(e)),this.match(14)){let r=this.startNodeAt(s);return r.expression=i,r.typeAnnotation=this.flowParseTypeAnnotation(),this.finishNode(r,"TypeCastExpression")}return i}assertModuleNodeAllowed(e){e.type==="ImportDeclaration"&&(e.importKind==="type"||e.importKind==="typeof")||e.type==="ExportNamedDeclaration"&&e.exportKind==="type"||e.type==="ExportAllDeclaration"&&e.exportKind==="type"||super.assertModuleNodeAllowed(e)}parseExportDeclaration(e){if(this.isContextual(130)){e.exportKind="type";let s=this.startNode();return this.next(),this.match(5)?(e.specifiers=this.parseExportSpecifiers(!0),super.parseExportFrom(e),null):this.flowParseTypeAlias(s)}else if(this.isContextual(131)){e.exportKind="type";let s=this.startNode();return this.next(),this.flowParseOpaqueType(s,!1)}else if(this.isContextual(129)){e.exportKind="type";let s=this.startNode();return this.next(),this.flowParseInterface(s)}else if(this.isContextual(126)){e.exportKind="value";let s=this.startNode();return this.next(),this.flowParseEnumDeclaration(s)}else return super.parseExportDeclaration(e)}eatExportStar(e){return super.eatExportStar(e)?!0:this.isContextual(130)&&this.lookahead().type===55?(e.exportKind="type",this.next(),this.next(),!0):!1}maybeParseExportNamespaceSpecifier(e){let{startLoc:s}=this.state,i=super.maybeParseExportNamespaceSpecifier(e);return i&&e.exportKind==="type"&&this.unexpected(s),i}parseClassId(e,s,i){super.parseClassId(e,s,i),this.match(47)&&(e.typeParameters=this.flowParseTypeParameterDeclaration())}parseClassMember(e,s,i){let{startLoc:r}=this.state;if(this.isContextual(125)){if(super.parseClassMemberFromModifier(e,s))return;s.declare=!0}super.parseClassMember(e,s,i),s.declare&&(s.type!=="ClassProperty"&&s.type!=="ClassPrivateProperty"&&s.type!=="PropertyDefinition"?this.raise(N.DeclareClassElement,r):s.value&&this.raise(N.DeclareClassFieldInitializer,s.value))}isIterator(e){return e==="iterator"||e==="asyncIterator"}readIterator(){let e=super.readWord1(),s="@@"+e;(!this.isIterator(e)||!this.state.inType)&&this.raise(f.InvalidIdentifier,this.state.curPosition(),{identifierName:s}),this.finishToken(132,s)}getTokenFromCode(e){let s=this.input.charCodeAt(this.state.pos+1);e===123&&s===124?this.finishOp(6,2):this.state.inType&&(e===62||e===60)?this.finishOp(e===62?48:47,1):this.state.inType&&e===63?s===46?this.finishOp(18,2):this.finishOp(17,1):ri(e,s,this.input.charCodeAt(this.state.pos+2))?(this.state.pos+=2,this.readIterator()):super.getTokenFromCode(e)}isAssignable(e,s){return e.type==="TypeCastExpression"?this.isAssignable(e.expression,s):super.isAssignable(e,s)}toAssignable(e,s=!1){!s&&e.type==="AssignmentExpression"&&e.left.type==="TypeCastExpression"&&(e.left=this.typeCastToParameter(e.left)),super.toAssignable(e,s)}toAssignableList(e,s,i){for(let r=0;r<e.length;r++){let a=e[r];a?.type==="TypeCastExpression"&&(e[r]=this.typeCastToParameter(a))}super.toAssignableList(e,s,i)}toReferencedList(e,s){for(let r=0;r<e.length;r++){var i;let a=e[r];a&&a.type==="TypeCastExpression"&&!((i=a.extra)!=null&&i.parenthesized)&&(e.length>1||!s)&&this.raise(N.TypeCastInPattern,a.typeAnnotation)}return e}parseArrayLike(e,s,i){let r=super.parseArrayLike(e,s,i);return i!=null&&!this.state.maybeInArrowParameters&&this.toReferencedList(r.elements),r}isValidLVal(e,s,i,r){return e==="TypeCastExpression"||super.isValidLVal(e,s,i,r)}parseClassProperty(e){return this.match(14)&&(e.typeAnnotation=this.flowParseTypeAnnotation()),super.parseClassProperty(e)}parseClassPrivateProperty(e){return this.match(14)&&(e.typeAnnotation=this.flowParseTypeAnnotation()),super.parseClassPrivateProperty(e)}isClassMethod(){return this.match(47)||super.isClassMethod()}isClassProperty(){return this.match(14)||super.isClassProperty()}isNonstaticConstructor(e){return!this.match(14)&&super.isNonstaticConstructor(e)}pushClassMethod(e,s,i,r,a,o){if(s.variance&&this.unexpected(s.variance.loc.start),delete s.variance,this.match(47)&&(s.typeParameters=this.flowParseTypeParameterDeclaration()),super.pushClassMethod(e,s,i,r,a,o),s.params&&a){let p=s.params;p.length>0&&this.isThisParam(p[0])&&this.raise(N.ThisParamBannedInConstructor,s)}else if(s.type==="MethodDefinition"&&a&&s.value.params){let p=s.value.params;p.length>0&&this.isThisParam(p[0])&&this.raise(N.ThisParamBannedInConstructor,s)}}pushClassPrivateMethod(e,s,i,r){s.variance&&this.unexpected(s.variance.loc.start),delete s.variance,this.match(47)&&(s.typeParameters=this.flowParseTypeParameterDeclaration()),super.pushClassPrivateMethod(e,s,i,r)}parseClassSuper(e){if(super.parseClassSuper(e),e.superClass&&(this.match(47)||this.match(51))&&(e.superTypeParameters=this.flowParseTypeParameterInstantiationInExpression()),this.isContextual(113)){this.next();let s=e.implements=[];do{let i=this.startNode();i.id=this.flowParseRestrictedIdentifier(!0),this.match(47)?i.typeParameters=this.flowParseTypeParameterInstantiation():i.typeParameters=null,s.push(this.finishNode(i,"ClassImplements"))}while(this.eat(12))}}checkGetterSetterParams(e){super.checkGetterSetterParams(e);let s=this.getObjectOrClassMethodParams(e);if(s.length>0){let i=s[0];this.isThisParam(i)&&e.kind==="get"?this.raise(N.GetterMayNotHaveThisParam,i):this.isThisParam(i)&&this.raise(N.SetterMayNotHaveThisParam,i)}}parsePropertyNamePrefixOperator(e){e.variance=this.flowParseVariance()}parseObjPropValue(e,s,i,r,a,o,p){e.variance&&this.unexpected(e.variance.loc.start),delete e.variance;let m;this.match(47)&&!o&&(m=this.flowParseTypeParameterDeclaration(),this.match(10)||this.unexpected());let d=super.parseObjPropValue(e,s,i,r,a,o,p);return m&&((d.value||d).typeParameters=m),d}parseFunctionParamType(e){return this.eat(17)&&(e.type!=="Identifier"&&this.raise(N.PatternIsOptional,e),this.isThisParam(e)&&this.raise(N.ThisParamMayNotBeOptional,e),e.optional=!0),this.match(14)?e.typeAnnotation=this.flowParseTypeAnnotation():this.isThisParam(e)&&this.raise(N.ThisParamAnnotationRequired,e),this.match(29)&&this.isThisParam(e)&&this.raise(N.ThisParamNoDefault,e),this.resetEndLocation(e),e}parseMaybeDefault(e,s){let i=super.parseMaybeDefault(e,s);return i.type==="AssignmentPattern"&&i.typeAnnotation&&i.right.start<i.typeAnnotation.start&&this.raise(N.TypeBeforeInitializer,i.typeAnnotation),i}checkImportReflection(e){super.checkImportReflection(e),e.module&&e.importKind!=="value"&&this.raise(N.ImportReflectionHasImportType,e.specifiers[0].loc.start)}parseImportSpecifierLocal(e,s,i){s.local=Lt(e)?this.flowParseRestrictedIdentifier(!0,!0):this.parseIdentifier(),e.specifiers.push(this.finishImportSpecifier(s,i))}isPotentialImportPhase(e){if(super.isPotentialImportPhase(e))return!0;if(this.isContextual(130)){if(!e)return!0;let s=this.lookaheadCharCode();return s===123||s===42}return!e&&this.isContextual(87)}applyImportPhase(e,s,i,r){if(super.applyImportPhase(e,s,i,r),s){if(!i&&this.match(65))return;e.exportKind=i==="type"?i:"value"}else i==="type"&&this.match(55)&&this.unexpected(),e.importKind=i==="type"||i==="typeof"?i:"value"}parseImportSpecifier(e,s,i,r,a){let o=e.imported,p=null;o.type==="Identifier"&&(o.name==="type"?p="type":o.name==="typeof"&&(p="typeof"));let m=!1;if(this.isContextual(93)&&!this.isLookaheadContextual("as")){let A=this.parseIdentifier(!0);p!==null&&!G(this.state.type)?(e.imported=A,e.importKind=p,e.local=this.cloneIdentifier(A)):(e.imported=o,e.importKind=null,e.local=this.parseIdentifier())}else{if(p!==null&&G(this.state.type))e.imported=this.parseIdentifier(!0),e.importKind=p;else{if(s)throw this.raise(f.ImportBindingIsString,e,{importName:o.value});e.imported=o,e.importKind=null}this.eatContextual(93)?e.local=this.parseIdentifier():(m=!0,e.local=this.cloneIdentifier(e.imported))}let d=Lt(e);return i&&d&&this.raise(N.ImportTypeShorthandOnlyInPureImport,e),(i||d)&&this.checkReservedType(e.local.name,e.local.loc.start,!0),m&&!i&&!d&&this.checkReservedWord(e.local.name,e.loc.start,!0,!0),this.finishImportSpecifier(e,"ImportSpecifier")}parseBindingAtom(){switch(this.state.type){case 78:return this.parseIdentifier(!0);default:return super.parseBindingAtom()}}parseFunctionParams(e,s){let i=e.kind;i!=="get"&&i!=="set"&&this.match(47)&&(e.typeParameters=this.flowParseTypeParameterDeclaration()),super.parseFunctionParams(e,s)}parseVarId(e,s){super.parseVarId(e,s),this.match(14)&&(e.id.typeAnnotation=this.flowParseTypeAnnotation(),this.resetEndLocation(e.id))}parseAsyncArrowFromCallExpression(e,s){if(this.match(14)){let i=this.state.noAnonFunctionType;this.state.noAnonFunctionType=!0,e.returnType=this.flowParseTypeAnnotation(),this.state.noAnonFunctionType=i}return super.parseAsyncArrowFromCallExpression(e,s)}shouldParseAsyncArrow(){return this.match(14)||super.shouldParseAsyncArrow()}parseMaybeAssign(e,s){var i;let r=null,a;if(this.hasPlugin("jsx")&&(this.match(143)||this.match(47))){if(r=this.state.clone(),a=this.tryParse(()=>super.parseMaybeAssign(e,s),r),!a.error)return a.node;let{context:m}=this.state,d=m[m.length-1];(d===O.j_oTag||d===O.j_expr)&&m.pop()}if((i=a)!=null&&i.error||this.match(47)){var o,p;r=r||this.state.clone();let m,d=this.tryParse(P=>{var T;m=this.flowParseTypeParameterDeclaration();let k=this.forwardNoArrowParamsConversionAt(m,()=>{let R=super.parseMaybeAssign(e,s);return this.resetStartLocationFromNode(R,m),R});(T=k.extra)!=null&&T.parenthesized&&P();let L=this.maybeUnwrapTypeCastExpression(k);return L.type!=="ArrowFunctionExpression"&&P(),L.typeParameters=m,this.resetStartLocationFromNode(L,m),k},r),A=null;if(d.node&&this.maybeUnwrapTypeCastExpression(d.node).type==="ArrowFunctionExpression"){if(!d.error&&!d.aborted)return d.node.async&&this.raise(N.UnexpectedTypeParameterBeforeAsyncArrowFunction,m),d.node;A=d.node}if((o=a)!=null&&o.node)return this.state=a.failState,a.node;if(A)return this.state=d.failState,A;throw(p=a)!=null&&p.thrown?a.error:d.thrown?d.error:this.raise(N.UnexpectedTokenAfterTypeParameter,m)}return super.parseMaybeAssign(e,s)}parseArrow(e){if(this.match(14)){let s=this.tryParse(()=>{let i=this.state.noAnonFunctionType;this.state.noAnonFunctionType=!0;let r=this.startNode();return[r.typeAnnotation,e.predicate]=this.flowParseTypeAndPredicateInitialiser(),this.state.noAnonFunctionType=i,this.canInsertSemicolon()&&this.unexpected(),this.match(19)||this.unexpected(),r});if(s.thrown)return null;s.error&&(this.state=s.failState),e.returnType=s.node.typeAnnotation?this.finishNode(s.node,"TypeAnnotation"):null}return super.parseArrow(e)}shouldParseArrow(e){return this.match(14)||super.shouldParseArrow(e)}setArrowFunctionParameters(e,s){this.state.noArrowParamsConversionAt.includes(this.offsetToSourcePos(e.start))?e.params=s:super.setArrowFunctionParameters(e,s)}checkParams(e,s,i,r=!0){if(!(i&&this.state.noArrowParamsConversionAt.includes(this.offsetToSourcePos(e.start)))){for(let a=0;a<e.params.length;a++)this.isThisParam(e.params[a])&&a>0&&this.raise(N.ThisParamMustBeFirst,e.params[a]);super.checkParams(e,s,i,r)}}parseParenAndDistinguishExpression(e){return super.parseParenAndDistinguishExpression(e&&!this.state.noArrowAt.includes(this.sourceToOffsetPos(this.state.start)))}parseSubscripts(e,s,i){if(e.type==="Identifier"&&e.name==="async"&&this.state.noArrowAt.includes(s.index)){this.next();let r=this.startNodeAt(s);r.callee=e,r.arguments=super.parseCallExpressionArguments(),e=this.finishNode(r,"CallExpression")}else if(e.type==="Identifier"&&e.name==="async"&&this.match(47)){let r=this.state.clone(),a=this.tryParse(p=>this.parseAsyncArrowWithTypeParameters(s)||p(),r);if(!a.error&&!a.aborted)return a.node;let o=this.tryParse(()=>super.parseSubscripts(e,s,i),r);if(o.node&&!o.error)return o.node;if(a.node)return this.state=a.failState,a.node;if(o.node)return this.state=o.failState,o.node;throw a.error||o.error}return super.parseSubscripts(e,s,i)}parseSubscript(e,s,i,r){if(this.match(18)&&this.isLookaheadToken_lt()){if(r.optionalChainMember=!0,i)return r.stop=!0,e;this.next();let a=this.startNodeAt(s);return a.callee=e,a.typeArguments=this.flowParseTypeParameterInstantiationInExpression(),this.expect(10),a.arguments=this.parseCallExpressionArguments(),a.optional=!0,this.finishCallExpression(a,!0)}else if(!i&&this.shouldParseTypes()&&(this.match(47)||this.match(51))){let a=this.startNodeAt(s);a.callee=e;let o=this.tryParse(()=>(a.typeArguments=this.flowParseTypeParameterInstantiationCallOrNew(),this.expect(10),a.arguments=super.parseCallExpressionArguments(),r.optionalChainMember&&(a.optional=!1),this.finishCallExpression(a,r.optionalChainMember)));if(o.node)return o.error&&(this.state=o.failState),o.node}return super.parseSubscript(e,s,i,r)}parseNewCallee(e){super.parseNewCallee(e);let s=null;this.shouldParseTypes()&&this.match(47)&&(s=this.tryParse(()=>this.flowParseTypeParameterInstantiationCallOrNew()).node),e.typeArguments=s}parseAsyncArrowWithTypeParameters(e){let s=this.startNodeAt(e);if(this.parseFunctionParams(s,!1),!!this.parseArrow(s))return super.parseArrowExpression(s,void 0,!0)}readToken_mult_modulo(e){let s=this.input.charCodeAt(this.state.pos+1);if(e===42&&s===47&&this.state.hasFlowComment){this.state.hasFlowComment=!1,this.state.pos+=2,this.nextToken();return}super.readToken_mult_modulo(e)}readToken_pipe_amp(e){let s=this.input.charCodeAt(this.state.pos+1);if(e===124&&s===125){this.finishOp(9,2);return}super.readToken_pipe_amp(e)}parseTopLevel(e,s){let i=super.parseTopLevel(e,s);return this.state.hasFlowComment&&this.raise(N.UnterminatedFlowComment,this.state.curPosition()),i}skipBlockComment(){if(this.hasPlugin("flowComments")&&this.skipFlowComment()){if(this.state.hasFlowComment)throw this.raise(N.NestedFlowComment,this.state.startLoc);this.hasFlowCommentCompletion();let e=this.skipFlowComment();e&&(this.state.pos+=e,this.state.hasFlowComment=!0);return}return super.skipBlockComment(this.state.hasFlowComment?"*-/":"*/")}skipFlowComment(){let{pos:e}=this.state,s=2;for(;[32,9].includes(this.input.charCodeAt(e+s));)s++;let i=this.input.charCodeAt(s+e),r=this.input.charCodeAt(s+e+1);return i===58&&r===58?s+2:this.input.slice(s+e,s+e+12)==="flow-include"?s+12:i===58&&r!==58?s:!1}hasFlowCommentCompletion(){if(this.input.indexOf("*/",this.state.pos)===-1)throw this.raise(f.UnterminatedComment,this.state.curPosition())}flowEnumErrorBooleanMemberNotInitialized(e,{enumName:s,memberName:i}){this.raise(N.EnumBooleanMemberNotInitialized,e,{memberName:i,enumName:s})}flowEnumErrorInvalidMemberInitializer(e,s){return this.raise(s.explicitType?s.explicitType==="symbol"?N.EnumInvalidMemberInitializerSymbolType:N.EnumInvalidMemberInitializerPrimaryType:N.EnumInvalidMemberInitializerUnknownType,e,s)}flowEnumErrorNumberMemberNotInitialized(e,s){this.raise(N.EnumNumberMemberNotInitialized,e,s)}flowEnumErrorStringMemberInconsistentlyInitialized(e,s){this.raise(N.EnumStringMemberInconsistentlyInitialized,e,s)}flowEnumMemberInit(){let e=this.state.startLoc,s=()=>this.match(12)||this.match(8);switch(this.state.type){case 135:{let i=this.parseNumericLiteral(this.state.value);return s()?{type:"number",loc:i.loc.start,value:i}:{type:"invalid",loc:e}}case 134:{let i=this.parseStringLiteral(this.state.value);return s()?{type:"string",loc:i.loc.start,value:i}:{type:"invalid",loc:e}}case 85:case 86:{let i=this.parseBooleanLiteral(this.match(85));return s()?{type:"boolean",loc:i.loc.start,value:i}:{type:"invalid",loc:e}}default:return{type:"invalid",loc:e}}}flowEnumMemberRaw(){let e=this.state.startLoc,s=this.parseIdentifier(!0),i=this.eat(29)?this.flowEnumMemberInit():{type:"none",loc:e};return{id:s,init:i}}flowEnumCheckExplicitTypeMismatch(e,s,i){let{explicitType:r}=s;r!==null&&r!==i&&this.flowEnumErrorInvalidMemberInitializer(e,s)}flowEnumMembers({enumName:e,explicitType:s}){let i=new Set,r={booleanMembers:[],numberMembers:[],stringMembers:[],defaultedMembers:[]},a=!1;for(;!this.match(8);){if(this.eat(21)){a=!0;break}let o=this.startNode(),{id:p,init:m}=this.flowEnumMemberRaw(),d=p.name;if(d==="")continue;/^[a-z]/.test(d)&&this.raise(N.EnumInvalidMemberName,p,{memberName:d,suggestion:d[0].toUpperCase()+d.slice(1),enumName:e}),i.has(d)&&this.raise(N.EnumDuplicateMemberName,p,{memberName:d,enumName:e}),i.add(d);let A={enumName:e,explicitType:s,memberName:d};switch(o.id=p,m.type){case"boolean":{this.flowEnumCheckExplicitTypeMismatch(m.loc,A,"boolean"),o.init=m.value,r.booleanMembers.push(this.finishNode(o,"EnumBooleanMember"));break}case"number":{this.flowEnumCheckExplicitTypeMismatch(m.loc,A,"number"),o.init=m.value,r.numberMembers.push(this.finishNode(o,"EnumNumberMember"));break}case"string":{this.flowEnumCheckExplicitTypeMismatch(m.loc,A,"string"),o.init=m.value,r.stringMembers.push(this.finishNode(o,"EnumStringMember"));break}case"invalid":throw this.flowEnumErrorInvalidMemberInitializer(m.loc,A);case"none":switch(s){case"boolean":this.flowEnumErrorBooleanMemberNotInitialized(m.loc,A);break;case"number":this.flowEnumErrorNumberMemberNotInitialized(m.loc,A);break;default:r.defaultedMembers.push(this.finishNode(o,"EnumDefaultedMember"))}}this.match(8)||this.expect(12)}return{members:r,hasUnknownMembers:a}}flowEnumStringMembers(e,s,{enumName:i}){if(e.length===0)return s;if(s.length===0)return e;if(s.length>e.length){for(let r of e)this.flowEnumErrorStringMemberInconsistentlyInitialized(r,{enumName:i});return s}else{for(let r of s)this.flowEnumErrorStringMemberInconsistentlyInitialized(r,{enumName:i});return e}}flowEnumParseExplicitType({enumName:e}){if(!this.eatContextual(102))return null;if(!$(this.state.type))throw this.raise(N.EnumInvalidExplicitTypeUnknownSupplied,this.state.startLoc,{enumName:e});let{value:s}=this.state;return this.next(),s!=="boolean"&&s!=="number"&&s!=="string"&&s!=="symbol"&&this.raise(N.EnumInvalidExplicitType,this.state.startLoc,{enumName:e,invalidEnumType:s}),s}flowEnumBody(e,s){let i=s.name,r=s.loc.start,a=this.flowEnumParseExplicitType({enumName:i});this.expect(5);let{members:o,hasUnknownMembers:p}=this.flowEnumMembers({enumName:i,explicitType:a});switch(e.hasUnknownMembers=p,a){case"boolean":return e.explicitType=!0,e.members=o.booleanMembers,this.expect(8),this.finishNode(e,"EnumBooleanBody");case"number":return e.explicitType=!0,e.members=o.numberMembers,this.expect(8),this.finishNode(e,"EnumNumberBody");case"string":return e.explicitType=!0,e.members=this.flowEnumStringMembers(o.stringMembers,o.defaultedMembers,{enumName:i}),this.expect(8),this.finishNode(e,"EnumStringBody");case"symbol":return e.members=o.defaultedMembers,this.expect(8),this.finishNode(e,"EnumSymbolBody");default:{let m=()=>(e.members=[],this.expect(8),this.finishNode(e,"EnumStringBody"));e.explicitType=!1;let d=o.booleanMembers.length,A=o.numberMembers.length,P=o.stringMembers.length,T=o.defaultedMembers.length;if(!d&&!A&&!P&&!T)return m();if(!d&&!A)return e.members=this.flowEnumStringMembers(o.stringMembers,o.defaultedMembers,{enumName:i}),this.expect(8),this.finishNode(e,"EnumStringBody");if(!A&&!P&&d>=T){for(let k of o.defaultedMembers)this.flowEnumErrorBooleanMemberNotInitialized(k.loc.start,{enumName:i,memberName:k.id.name});return e.members=o.booleanMembers,this.expect(8),this.finishNode(e,"EnumBooleanBody")}else if(!d&&!P&&A>=T){for(let k of o.defaultedMembers)this.flowEnumErrorNumberMemberNotInitialized(k.loc.start,{enumName:i,memberName:k.id.name});return e.members=o.numberMembers,this.expect(8),this.finishNode(e,"EnumNumberBody")}else return this.raise(N.EnumInconsistentMemberValues,r,{enumName:i}),m()}}}flowParseEnumDeclaration(e){let s=this.parseIdentifier();return e.id=s,e.body=this.flowEnumBody(this.startNode(),s),this.finishNode(e,"EnumDeclaration")}jsxParseOpeningElementAfterName(e){return this.shouldParseTypes()&&(this.match(47)||this.match(51))&&(e.typeArguments=this.flowParseTypeParameterInstantiationInExpression()),super.jsxParseOpeningElementAfterName(e)}isLookaheadToken_lt(){let e=this.nextTokenStart();if(this.input.charCodeAt(e)===60){let s=this.input.charCodeAt(e+1);return s!==60&&s!==61}return!1}reScan_lt_gt(){let{type:e}=this.state;e===47?(this.state.pos-=1,this.readToken_lt()):e===48&&(this.state.pos-=1,this.readToken_gt())}reScan_lt(){let{type:e}=this.state;return e===51?(this.state.pos-=2,this.finishOp(47,1),47):e}maybeUnwrapTypeCastExpression(e){return e.type==="TypeCastExpression"?e.expression:e}},fi={__proto__:null,quot:'"',amp:"&",apos:"'",lt:"<",gt:">",nbsp:"\xA0",iexcl:"\xA1",cent:"\xA2",pound:"\xA3",curren:"\xA4",yen:"\xA5",brvbar:"\xA6",sect:"\xA7",uml:"\xA8",copy:"\xA9",ordf:"\xAA",laquo:"\xAB",not:"\xAC",shy:"\xAD",reg:"\xAE",macr:"\xAF",deg:"\xB0",plusmn:"\xB1",sup2:"\xB2",sup3:"\xB3",acute:"\xB4",micro:"\xB5",para:"\xB6",middot:"\xB7",cedil:"\xB8",sup1:"\xB9",ordm:"\xBA",raquo:"\xBB",frac14:"\xBC",frac12:"\xBD",frac34:"\xBE",iquest:"\xBF",Agrave:"\xC0",Aacute:"\xC1",Acirc:"\xC2",Atilde:"\xC3",Auml:"\xC4",Aring:"\xC5",AElig:"\xC6",Ccedil:"\xC7",Egrave:"\xC8",Eacute:"\xC9",Ecirc:"\xCA",Euml:"\xCB",Igrave:"\xCC",Iacute:"\xCD",Icirc:"\xCE",Iuml:"\xCF",ETH:"\xD0",Ntilde:"\xD1",Ograve:"\xD2",Oacute:"\xD3",Ocirc:"\xD4",Otilde:"\xD5",Ouml:"\xD6",times:"\xD7",Oslash:"\xD8",Ugrave:"\xD9",Uacute:"\xDA",Ucirc:"\xDB",Uuml:"\xDC",Yacute:"\xDD",THORN:"\xDE",szlig:"\xDF",agrave:"\xE0",aacute:"\xE1",acirc:"\xE2",atilde:"\xE3",auml:"\xE4",aring:"\xE5",aelig:"\xE6",ccedil:"\xE7",egrave:"\xE8",eacute:"\xE9",ecirc:"\xEA",euml:"\xEB",igrave:"\xEC",iacute:"\xED",icirc:"\xEE",iuml:"\xEF",eth:"\xF0",ntilde:"\xF1",ograve:"\xF2",oacute:"\xF3",ocirc:"\xF4",otilde:"\xF5",ouml:"\xF6",divide:"\xF7",oslash:"\xF8",ugrave:"\xF9",uacute:"\xFA",ucirc:"\xFB",uuml:"\xFC",yacute:"\xFD",thorn:"\xFE",yuml:"\xFF",OElig:"\u0152",oelig:"\u0153",Scaron:"\u0160",scaron:"\u0161",Yuml:"\u0178",fnof:"\u0192",circ:"\u02C6",tilde:"\u02DC",Alpha:"\u0391",Beta:"\u0392",Gamma:"\u0393",Delta:"\u0394",Epsilon:"\u0395",Zeta:"\u0396",Eta:"\u0397",Theta:"\u0398",Iota:"\u0399",Kappa:"\u039A",Lambda:"\u039B",Mu:"\u039C",Nu:"\u039D",Xi:"\u039E",Omicron:"\u039F",Pi:"\u03A0",Rho:"\u03A1",Sigma:"\u03A3",Tau:"\u03A4",Upsilon:"\u03A5",Phi:"\u03A6",Chi:"\u03A7",Psi:"\u03A8",Omega:"\u03A9",alpha:"\u03B1",beta:"\u03B2",gamma:"\u03B3",delta:"\u03B4",epsilon:"\u03B5",zeta:"\u03B6",eta:"\u03B7",theta:"\u03B8",iota:"\u03B9",kappa:"\u03BA",lambda:"\u03BB",mu:"\u03BC",nu:"\u03BD",xi:"\u03BE",omicron:"\u03BF",pi:"\u03C0",rho:"\u03C1",sigmaf:"\u03C2",sigma:"\u03C3",tau:"\u03C4",upsilon:"\u03C5",phi:"\u03C6",chi:"\u03C7",psi:"\u03C8",omega:"\u03C9",thetasym:"\u03D1",upsih:"\u03D2",piv:"\u03D6",ensp:"\u2002",emsp:"\u2003",thinsp:"\u2009",zwnj:"\u200C",zwj:"\u200D",lrm:"\u200E",rlm:"\u200F",ndash:"\u2013",mdash:"\u2014",lsquo:"\u2018",rsquo:"\u2019",sbquo:"\u201A",ldquo:"\u201C",rdquo:"\u201D",bdquo:"\u201E",dagger:"\u2020",Dagger:"\u2021",bull:"\u2022",hellip:"\u2026",permil:"\u2030",prime:"\u2032",Prime:"\u2033",lsaquo:"\u2039",rsaquo:"\u203A",oline:"\u203E",frasl:"\u2044",euro:"\u20AC",image:"\u2111",weierp:"\u2118",real:"\u211C",trade:"\u2122",alefsym:"\u2135",larr:"\u2190",uarr:"\u2191",rarr:"\u2192",darr:"\u2193",harr:"\u2194",crarr:"\u21B5",lArr:"\u21D0",uArr:"\u21D1",rArr:"\u21D2",dArr:"\u21D3",hArr:"\u21D4",forall:"\u2200",part:"\u2202",exist:"\u2203",empty:"\u2205",nabla:"\u2207",isin:"\u2208",notin:"\u2209",ni:"\u220B",prod:"\u220F",sum:"\u2211",minus:"\u2212",lowast:"\u2217",radic:"\u221A",prop:"\u221D",infin:"\u221E",ang:"\u2220",and:"\u2227",or:"\u2228",cap:"\u2229",cup:"\u222A",int:"\u222B",there4:"\u2234",sim:"\u223C",cong:"\u2245",asymp:"\u2248",ne:"\u2260",equiv:"\u2261",le:"\u2264",ge:"\u2265",sub:"\u2282",sup:"\u2283",nsub:"\u2284",sube:"\u2286",supe:"\u2287",oplus:"\u2295",otimes:"\u2297",perp:"\u22A5",sdot:"\u22C5",lceil:"\u2308",rceil:"\u2309",lfloor:"\u230A",rfloor:"\u230B",lang:"\u2329",rang:"\u232A",loz:"\u25CA",spades:"\u2660",clubs:"\u2663",hearts:"\u2665",diams:"\u2666"},yi=/\r\n|[\r\n\u2028\u2029]/,Se=new RegExp(yi.source,"g");function ce(t){switch(t){case 10:case 13:case 8232:case 8233:return!0;default:return!1}}function Bt(t,e,s){for(let i=e;i<s;i++)if(ce(t.charCodeAt(i)))return!0;return!1}var Ge=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,Qe=/(?:[^\S\n\r\u2028\u2029]|\/\/.*|\/\*.*?\*\/)*/g;function xi(t){switch(t){case 9:case 11:case 12:case 32:case 160:case 5760:case 8192:case 8193:case 8194:case 8195:case 8196:case 8197:case 8198:case 8199:case 8200:case 8201:case 8202:case 8239:case 8287:case 12288:case 65279:return!0;default:return!1}}var he=Q`jsx`({AttributeIsEmpty:"JSX attributes must only be assigned a non-empty expression.",MissingClosingTagElement:({openingTagName:t})=>`Expected corresponding JSX closing tag for <${t}>.`,MissingClosingTagFragment:"Expected corresponding JSX closing tag for <>.",UnexpectedSequenceExpression:"Sequence expressions cannot be directly nested inside JSX. Did you mean to wrap it in parentheses (...)?",UnexpectedToken:({unexpected:t,HTMLEntity:e})=>`Unexpected token \`${t}\`. Did you mean \`${e}\` or \`{'${t}'}\`?`,UnsupportedJsxValue:"JSX value should be either an expression or a quoted JSX text.",UnterminatedJsxContent:"Unterminated JSX contents.",UnwrappedAdjacentJSXElements:"Adjacent JSX elements must be wrapped in an enclosing tag. Did you want a JSX fragment <>...</>?"});function re(t){return t?t.type==="JSXOpeningFragment"||t.type==="JSXClosingFragment":!1}function pe(t){if(t.type==="JSXIdentifier")return t.name;if(t.type==="JSXNamespacedName")return t.namespace.name+":"+t.name.name;if(t.type==="JSXMemberExpression")return pe(t.object)+"."+pe(t.property);throw new Error("Node had unexpected type: "+t.type)}var gi=t=>class extends t{jsxReadToken(){let e="",s=this.state.pos;for(;;){if(this.state.pos>=this.length)throw this.raise(he.UnterminatedJsxContent,this.state.startLoc);let i=this.input.charCodeAt(this.state.pos);switch(i){case 60:case 123:if(this.state.pos===this.state.start){i===60&&this.state.canStartJSXElement?(++this.state.pos,this.finishToken(143)):super.getTokenFromCode(i);return}e+=this.input.slice(s,this.state.pos),this.finishToken(142,e);return;case 38:e+=this.input.slice(s,this.state.pos),e+=this.jsxReadEntity(),s=this.state.pos;break;case 62:case 125:default:ce(i)?(e+=this.input.slice(s,this.state.pos),e+=this.jsxReadNewLine(!0),s=this.state.pos):++this.state.pos}}}jsxReadNewLine(e){let s=this.input.charCodeAt(this.state.pos),i;return++this.state.pos,s===13&&this.input.charCodeAt(this.state.pos)===10?(++this.state.pos,i=e?`
|
|
7
7
|
`:`\r
|
|
@@ -22,17 +22,17 @@ import{a as nt,b as z,c as V,d as De,e as ue,f as j,j as K,l as X}from"./chunk-P
|
|
|
22
22
|
return (async () => {
|
|
23
23
|
${h}
|
|
24
24
|
})();
|
|
25
|
-
`)(n,y)}transpile(n){let l=this.generateFunctionCallCode(n.action_data?.kwargs||{});return l?[l.endsWith(";")?l:`${l};`]:["// Skipping function: missing functionName"]}generateFunctionCallCode(n){let l=n.functionName;if(!l)return null;let c;if(Array.isArray(n.args))c=n.args.map(String);else if(Array.isArray(n.parameterNames)){let x=n.parameterValues||[];c=n.parameterNames.map((w,g)=>g<x.length?String(x[g]):"undefined")}else return`await ${l}()`;if(c.length===0)return`await ${l}()`;let u=["page","testContext","request","agent"],h=["undefined","null","true","false"],y=c.map(x=>u.includes(x)||h.includes(x)||/^-?\d+(\.\d+)?$/.test(x)?x:x.startsWith("$")?`agent.agentServices.readVariable('${x.substring(1)}')`:`"${x}"`);return`await ${l}(${y.join(", ")})`}},Kr=class{async execute(n,l,c){let u=l.action_data;if(!u)throw new Error("Action data not found");let h=u.kwargs.statement;if(!h)throw new Error("Missing statement for ai_action");let y=u.kwargs.use_pure_vision,{executeStep:x}=await import("./agentHelpers-
|
|
25
|
+
`)(n,y)}transpile(n){let l=this.generateFunctionCallCode(n.action_data?.kwargs||{});return l?[l.endsWith(";")?l:`${l};`]:["// Skipping function: missing functionName"]}generateFunctionCallCode(n){let l=n.functionName;if(!l)return null;let c;if(Array.isArray(n.args))c=n.args.map(String);else if(Array.isArray(n.parameterNames)){let x=n.parameterValues||[];c=n.parameterNames.map((w,g)=>g<x.length?String(x[g]):"undefined")}else return`await ${l}()`;if(c.length===0)return`await ${l}()`;let u=["page","testContext","request","agent"],h=["undefined","null","true","false"],y=c.map(x=>u.includes(x)||h.includes(x)||/^-?\d+(\.\d+)?$/.test(x)?x:x.startsWith("$")?`agent.agentServices.readVariable('${x.substring(1)}')`:`"${x}"`);return`await ${l}(${y.join(", ")})`}},Kr=class{async execute(n,l,c){let u=l.action_data;if(!u)throw new Error("Action data not found");let h=u.kwargs.statement;if(!h)throw new Error("Missing statement for ai_action");let y=u.kwargs.use_pure_vision,{executeStep:x}=await import("./agentHelpers-ZEELTQHQ-7LTM7RPI.js"),w=await x(h,n,c,{usePureVision:y});if(w.status!=="success")throw new Error(w.error||"Action execution failed")}transpile(n,l){let c=n.action_data?.kwargs?.statement;if(!c)return["// Skipping ai_action: missing statement"];let u=JSON.stringify(c),h=n.action_data?.kwargs?.use_pure_vision;return[`await agent.execute(page, ${u}, '${l||""}', ${h});`]}},bn=rs.object({statement:rs.string().describe('The action to perform (e.g., "click the submit button")')}),Xr=class{async execute(n,l,c){let u=l.action_data;if(!u)throw new Error("Action data not found");let h=u.kwargs.statement;if(!h)throw new Error("Missing statement for ai_step");let{runTask:y}=await import("./agentHelpers-ZEELTQHQ-7LTM7RPI.js"),x=await y(h,n,c);if(x.status!=="success")throw new Error(x.error||"Task execution failed")}transpile(n,l){let c=n.action_data?.kwargs?.statement;return c?[`await agent.run(page, ${JSON.stringify(c)}, '${l||""}');`]:["// Skipping ai_step: missing statement"]}},En=as.object({statement:as.string().describe('The complete step to execute (e.g., "fill in the login form and submit")')}),Yr=class{async execute(n,l,c){let u=l.action_data;if(!u)throw new Error("Action data not found");let h=u.kwargs.condition;if(!h)throw new Error("Missing condition for ai_wait_until");let y=(u.kwargs.timeout_seconds||60)*1e3,x=1e3,w=Date.now(),{evaluateStatement:g}=await import("./agentHelpers-ZEELTQHQ-7LTM7RPI.js");for(;Date.now()-w<y;){if((await g(h,n,c,{})).success)return;await n.waitForTimeout(x)}throw new Error(`Timeout waiting for condition: ${h}`)}transpile(n,l){let c=n.action_data?.kwargs?.condition,u=n.action_data?.kwargs?.timeout_seconds||60;return c?[`await agent.waitUntilCondition(page, ${JSON.stringify(c)}, ${u}, '${l}');`]:["// Skipping ai_wait_until: missing condition"]}},Gr=ot.object({condition:ot.string().describe('The condition to wait for (e.g., "the loading spinner disappears")'),timeout_seconds:ot.number().positive().optional().describe("Timeout in seconds (default: 60)")});function Sn(n,l){n.register({name:"ai_wait_until",description:'Wait until a specific condition is met on the page (e.g., "page loads", "spinner disappears", "button becomes enabled"). Use this instead of wait when the goal is to wait for something to happen rather than waiting a fixed duration.',schema:Gr,async execute(c,u){let{condition:h,timeout_seconds:y=60}=c,{page:x,agentServices:w}=u;try{let g={action_description:`Wait until: ${h}`,action_data:{action_name:"ai_wait_until",kwargs:{condition:h,timeout_seconds:y}}};return await l.execute(x,g,w),{success:!0,actionEntity:g,message:`Condition met: ${h}`}}catch(g){return{success:!1,error:g.message,actionEntity:{action_description:`Wait until: ${h} (failed)`,action_data:{action_name:"ai_wait_until",kwargs:{condition:h,timeout_seconds:y}},feedback:g.message}}}}})}j();var Qr=class{async execute(n,l,c){let u=l.action_data;if(!u)throw new Error("Action data not found");let h=u.kwargs.text||u.kwargs.option,y=V(n,l),x=z(c,l.action_data?.kwargs?.timeout_ms);if(y&&h)await y.selectOption(h,{timeout:x});else throw new Error("Missing locator or option label for select_dropdown_option action")}transpile(n){let l=n.action_data?.kwargs?.text||n.action_data?.kwargs?.option||"",c=[];return c.push(`action_data: { kwargs: { text: ${JSON.stringify(l)} } }`),n.locator?c.push(`locator: ${JSON.stringify(n.locator)}`):n.xpath&&c.push(`xpath: ${JSON.stringify(n.xpath)}`),n.frame_path&&n.frame_path.length>0&&c.push(`frame_path: ${JSON.stringify(n.frame_path)}`),['await agent.execAction("select_dropdown_option", page, {',...c.map(u=>` ${u},`),"});"]}};async function Zr(n,l,c,u){return{...await X(l,n),action_description:u||`Select option "${c}"`,action_data:{action_name:"select_dropdown_option",kwargs:{text:c}}}}function ns(n,l){return{action_description:`${n} (failed - element not found)`,action_data:{action_name:"select_dropdown_option",kwargs:l},feedback:"Element not found in DOM"}}var ea=Fe.object({element_index:Fe.number().int().describe("Index of the dropdown/select element"),option:Fe.string().describe("Option value, label, or index to select"),timeout_ms:Fe.number().optional().describe("Per-action timeout in ms. Overrides the default 5s action timeout.")});function vn(n,l){n.register({name:"select_dropdown_option",description:"Select an option from a dropdown/select element by value, label, or index.",schema:ea,usesElementIndex:!0,async execute(c,u){let{element_index:h,option:y}=c,{page:x,agentServices:w,actionDescription:g}=u;try{let E=await K(u,h);if(!E)return{success:!1,error:`Dropdown element with index ${h} not found`,actionEntity:ns(g||`Select option in dropdown ${h}`,{index:h,option:y})};let C=await Zr(E,x,y,g);return await l.execute(x,C,w),{success:!0,actionEntity:C,message:`Selected option "${y}" in dropdown ${h}`}}catch(E){return{success:!1,error:E.message,actionEntity:ns(`Select option in dropdown ${h}`,{index:h,option:y})}}}})}j();var ta=class{async execute(n,l,c){let u=l.action_data;if(!u)throw new Error("Action data not found");let h=u.kwargs.date;if(!h)throw new Error("Date value is required");if(!/^\d{4}-\d{2}-\d{2}$/.test(h))throw new Error(`Invalid date format: ${h}. Expected format: YYYY-MM-DD (e.g., 2024-03-15)`);let y=c.replaceVariables(String(h)),x=V(n,l);if(x){let w=await x.getAttribute("type").catch(()=>null);if(w&&w!=="date")throw new Error(`Element is not a native date picker (type="${w}"). This action only works with <input type="date">. For custom date pickers, use AI-powered actions.`);await x.fill(y,{timeout:z(c,l.action_data?.kwargs?.timeout_ms)})}else throw new Error("No locator found for set_date_for_native_date_picker action")}transpile(n){let l=n.action_data?.kwargs?.date??"",c=[];return c.push(`action_data: { kwargs: { date: ${JSON.stringify(l)} } }`),n.locator?c.push(`locator: ${JSON.stringify(n.locator)}`):n.xpath&&c.push(`xpath: ${JSON.stringify(n.xpath)}`),n.frame_path&&n.frame_path.length>0&&c.push(`frame_path: ${JSON.stringify(n.frame_path)}`),['await agent.execAction("set_date_for_native_date_picker", page, {',...c.map(u=>` ${u},`),"});"]}};async function sa(n,l,c,u){return{...await X(c,l),action_description:n,action_data:{action_name:"set_date_for_native_date_picker",kwargs:{date:u}}}}function lt(n,l){return{action_description:`${n} (failed - element not found)`,action_data:{action_name:"set_date_for_native_date_picker",kwargs:l},feedback:"Element not found in DOM"}}var ia=Le.object({element_index:Le.number().int().describe("Index of the native date picker input element"),date:Le.string().regex(/^\d{4}-\d{2}-\d{2}$/).describe("Date in YYYY-MM-DD format (e.g., 2024-03-15)"),timeout_ms:Le.number().optional().describe("Per-action timeout in ms. Overrides the default 5s action timeout.")});function Nn(n,l){n.register({name:"set_date_for_native_date_picker",description:`Set a date in a native HTML date picker input (<input type="date">).
|
|
26
26
|
|
|
27
27
|
IMPORTANT: ONLY use this action for input elements that have type="date" attribute (native HTML date picker).
|
|
28
28
|
Do NOT use it for custom/non-native date pickers
|
|
29
29
|
|
|
30
30
|
The date must be in YYYY-MM-DD format (e.g., 2024-03-15).`,schema:ia,usesElementIndex:!0,async execute(c,u){let{element_index:h,date:y}=c,{page:x,agentServices:w}=u;try{let g=await K(u,h);if(!g)return{success:!1,error:`Date picker element with index ${h} not found`,actionEntity:lt(`Set date to ${y} on element ${h}`,{index:h,date:y})};let E=g.attributes.type;if(E!=="date")return{success:!1,error:`Element ${h} is not a native date picker (type="${E}"). This action only works with <input type="date">.`,actionEntity:lt(`Set date to ${y} on element ${h}`,{index:h,date:y})};let C=await sa(`Set date to ${y} on element ${h}`,g,x,y);return await l.execute(x,C,w),{success:!0,actionEntity:C,message:`Set date to ${y} on element ${h}`}}catch(g){return{success:!1,error:g.message,actionEntity:lt(`Set date to ${y} on element ${h}`,{index:h,date:y})}}}})}var ra=class{async execute(n,l,c){let u=l.action_data;if(!u)throw new Error("Action data not found");let h=u.kwargs.page_id??u.kwargs.tab_index??0;if(typeof h=="number"){let y=n.context().pages(),x=h===-1?y.length-1:h;if(c){let w=await c.switchTab(x);await w.waitForLoadState("load",{timeout:15e3}).catch(()=>{}),await w.waitForTimeout(500)}}else throw new Error("Missing page_id for switch_tab action")}transpile(n){return['await agent.execAction("switch_tab", page, {',` action_data: { kwargs: { page_id: ${n.action_data?.kwargs?.page_id??n.action_data?.kwargs?.tab_index??0} } },`,"});"]}},aa=os.object({tab_index:os.number().int().nonnegative().describe("Index of the tab to switch to (0-based). Use 0 for first tab, 1 for second, etc.")});function Dn(n,l){n.register({name:"switch_tab",description:"Switch to a different browser tab by index (0-based).",schema:aa,async execute(c,u){let h=c.tab_index,{page:y,agentServices:x,actionDescription:w}=u;try{let g={action_description:w||`Switch to tab ${h}`,action_data:{action_name:"switch_tab",kwargs:{page_id:h}}};return await l.execute(y,g,x),{success:!0,actionEntity:g,message:`Switched to tab ${h}`}}catch(g){return{success:!1,error:g.message,actionEntity:{action_description:(w||`Switch to tab ${h}`)+" (failed)",action_data:{action_name:"switch_tab",kwargs:{page_id:h}},feedback:g.message}}}}})}async function Bn(n,l,c,u,h,y){let x=Array.isArray(l)?l:[l];if(x.length===0)throw new Error("No file paths provided for upload");let w=x.map(C=>{if(C.startsWith("/")||C.match(/^[A-Za-z]:\\/))return C;let M=u.testDataDir||process.cwd();return oa.join(M,C)});W.info(`Uploading files: ${w.join(", ")}`);let g=c.timeout||2e4,E={useFileInput:c.useFileInput||!1,timeout:g};if(c.selector&&typeof c.selector!="string"){let C=c.selector;await At(n,C,w,E);return}if(c.selector&&typeof c.selector=="string"){let C=c.selector,M=(C.startsWith("xpath="),n.locator(C));await At(n,M,w,E);return}if(h){let C=x.map(H=>`"${H}"`).join(", "),M="";c.targetDescription?M=`Upload ${C} to ${c.targetDescription}`:M=`Upload ${C}`,W.info(`Using AI to handle file upload: ${M}`),await h(n,M,y)}else throw new Error("No selector provided and AI action execution is not available")}async function At(n,l,c,u){let{useFileInput:h,timeout:y,mockShowOpenFilePicker:x}=u;if(x){W.info("Using mockShowOpenFilePicker approach");let w=c.map(g=>({path:g,buffer:new Uint8Array(na.readFileSync(g))}));await n.evaluate(g=>{window.__pw_showOpenFilePicker_mock_files=g},w),await l.click({timeout:y}),await n.waitForTimeout(3e3),await n.evaluate(()=>{delete window.__pw_showOpenFilePicker_mock_files})}else if(h)W.info("Using direct file input approach"),await l.setInputFiles(c,{timeout:y}),await n.waitForTimeout(3e3);else{W.info("Using file chooser approach");let w=n.waitForEvent("filechooser",{timeout:y});w.catch(()=>{}),await l.click({timeout:y}),await(await w).setFiles(c),await n.waitForTimeout(3e3)}W.info(`Successfully uploaded ${c.length} file(s)`)}j();var la=class{async execute(n,l,c){let u=l.action_data;if(!u)throw new Error("Action data not found");let h=[];if(u.kwargs.paths?h=Array.isArray(u.kwargs.paths)?u.kwargs.paths:[u.kwargs.paths]:u.kwargs.path&&(h=Array.isArray(u.kwargs.path)?u.kwargs.path:[u.kwargs.path]),h.length===0)throw new Error("No file paths provided for upload_file action");await c.downloadTestDataFiles(h);let y=h.map(E=>c.getTestDataFilePath(E)),x=V(n,l);if(!x)throw new Error("Missing locator for upload_file action");let w=u.kwargs.use_file_input||!1,g=c.getActionSettings().mock_show_open_file_picker??!1;await At(n,x,y,{useFileInput:w,timeout:z(c,l.action_data?.kwargs?.timeout_ms),mockShowOpenFilePicker:g})}transpile(n){let l=n.action_data?.kwargs||{},c=[],u={};return l.paths?u.paths=l.paths:l.path&&(u.path=l.path),l.use_file_input&&(u.use_file_input=!0),c.push(`action_data: { kwargs: ${JSON.stringify(u)} }`),n.locator?c.push(`locator: ${JSON.stringify(n.locator)}`):n.xpath&&c.push(`xpath: ${JSON.stringify(n.xpath)}`),n.frame_path&&n.frame_path.length>0&&c.push(`frame_path: ${JSON.stringify(n.frame_path)}`),['await agent.execAction("upload_file", page, {',...c.map(h=>` ${h},`),"});"]}};async function ha(n,l,c={},u){return{...await X(l,n),action_description:u||"Upload file to element",action_data:{action_name:"upload_file",kwargs:{...c}}}}function ls(n,l){return{action_description:`${n} (failed - element not found)`,action_data:{action_name:"upload_file",kwargs:l},feedback:"Element not found in DOM"}}var ca=oe.object({element_index:oe.number().int().describe("Index of the target element to trigger the file upload dialog"),paths:oe.string().describe("Paths to the files to upload"),timeout_ms:oe.number().optional().describe("Per-action timeout in ms. Overrides the default 5s action timeout.")});function Mn(n,l){n.register({name:"upload_file",description:'Click on target element (usually contains hints like "Upload file" or "Choose file" etc.) to trigger the file upload dialog, and choose the files to upload',schema:ca,usesElementIndex:!0,async execute(c,u){let{element_index:h,paths:y}=c,{page:x,agentServices:w,actionDescription:g}=u;try{let E=await K(u,h);if(!E)return{success:!1,error:`File input element with index ${h} not found`,actionEntity:ls(g||`Upload file to element ${h}`,{index:h,paths:y})};let C=await ha(E,x,{paths:y},g);return await l.execute(x,C,w),{success:!0,actionEntity:C,message:`Uploaded file to element ${h}`}}catch(E){return{success:!1,error:E.message,actionEntity:ls(g||`Upload file to element ${h}`,{index:h,paths:y})}}}})}var $n=oe.object({element_index:oe.number().int().describe("Index of the file input element"),paths:oe.string().describe("Path to the file to upload (can be relative or absolute)"),timeout_ms:oe.number().optional().describe("Per-action timeout in ms. Overrides the default 5s action timeout.")}),pa=class{async execute(n,l){let c=l.action_data;if(!c)throw new Error("Action data not found");let u=c.kwargs.seconds||1;await n.waitForTimeout(u*1e3)}transpile(n){return[`await page.waitForTimeout(${(n.action_data?.kwargs?.seconds||1)*1e3});`]}},ua=hs.object({seconds:hs.number().positive().describe("Number of seconds to wait")});function Un(n,l){n.register({name:"wait",description:"Wait for a specified number of seconds before continuing.",schema:ua,async execute(c,u){let{seconds:h}=c,{page:y,agentServices:x,actionDescription:w}=u;try{let g={action_description:w||`Wait ${h} seconds`,action_data:{action_name:"wait",kwargs:{seconds:h}}};return await l.execute(y,g,x),{success:!0,actionEntity:g,message:`Waited ${h} seconds`}}catch(g){return{success:!1,error:g.message,actionEntity:{action_description:(w||`Wait ${h} seconds`)+" (failed)",action_data:{action_name:"wait",kwargs:{seconds:h}},feedback:g.message}}}}})}var da=class{async execute(n,l,c){let u=l.action_data;if(!u)throw new Error("Action data not found");let h=u.kwargs.timeout_seconds||10;await c.waitForDownloadComplete(n,h)}transpile(n){return['await agent.execAction("wait_for_download_complete", page, {',` action_data: { kwargs: { timeout_seconds: ${n.action_data?.kwargs?.timeout_seconds||10} } },`,"});"]}},ma=cs.object({timeout_seconds:cs.number().positive().optional().describe("Maximum time in seconds to wait for download to complete (default: 10)")});function zn(n,l){n.register({name:"wait_for_download_complete",description:"Wait for an in-progress download to complete.",schema:ma,async execute(c,u){let{timeout_seconds:h=10}=c,{page:y,agentServices:x}=u;try{let w={action_description:`Wait for download to complete (timeout: ${h}s)`,action_data:{action_name:"wait_for_download_complete",kwargs:{timeout_seconds:h}}};return await l.execute(y,w,x),{success:!0,actionEntity:w,message:"Download completed"}}catch(w){return{success:!1,error:w.message,actionEntity:{action_description:"Wait for download to complete (failed)",action_data:{action_name:"wait_for_download_complete",kwargs:{timeout_seconds:h}},feedback:w.message}}}}})}var us=class{async execute(n,l){let c=l.action_data;if(!c)throw new Error("Action data not found");let u=c.kwargs.keys;if(!u||typeof u!="string")throw new Error("Missing or invalid keys for press action");await n.keyboard.press(u),await n.waitForTimeout(500)}transpile(n){let l=n.action_data?.kwargs?.keys;return[`await page.keyboard.press(${JSON.stringify(l)});`]}},fa=ps.object({keys:ps.string().describe("A single key or key combination to press (e.g. Escape, Backspace, Insert, PageDown, Delete, Tab, Enter). Key combinations like `Control+o`, `Control+Shift+T`, `ControlOrMeta+a` are supported. Note: This does NOT support sequences - to press multiple keys in sequence (e.g., Control+A then Backspace), call this action multiple times.")});function Hn(n,l){n.register({name:"press",description:"Press a single keyboard key or key combination. Supports combinations like `Control+A` for select all. Does NOT support sequences - call this action multiple times to press keys in sequence.",schema:fa,async execute(c,u){let{keys:h}=c,{page:y,agentServices:x,actionDescription:w}=u;try{let g={action_description:w||`Press keys "${h}"`,action_data:{action_name:"press",kwargs:{keys:h}}};return await l.execute(y,g,x),{success:!0,actionEntity:g,message:`Pressed keys "${h}"`}}catch(g){return{success:!1,error:g.message,actionEntity:{action_description:(w||`Press keys "${h}"`)+" (failed)",action_data:{action_name:"press",kwargs:{keys:h}},feedback:g.message}}}}})}j();var xa=class{async execute(n,l){await n.reload({timeout:ue}),await n.waitForLoadState("load",{timeout:ue}),await n.waitForTimeout(1e3)}transpile(n){return['await agent.execAction("reload_page", page, {});']}},ga=ya.object({});function Jn(n,l){n.register({name:"reload_page",description:"Reload the current page. WARNING: This will reset any in-progress forms or multi-step flows (like login). Only use when you need to refresh stale data or clear a stuck state. Do NOT use during login, checkout, or form submission flows.",schema:ga,async execute(c,u){let{page:h,agentServices:y}=u;try{let x={action_description:"Reload page",action_data:{action_name:"reload_page",kwargs:{}}};return await l.execute(h,x,y),{success:!0,actionEntity:x,message:`Reloaded ${h.url()}`}}catch(x){return{success:!1,error:x.message,actionEntity:{action_description:"Reload page (failed)",action_data:{action_name:"reload_page",kwargs:{}},feedback:x.message}}}}})}j();var ds=class{async execute(n,l,c){let u=V(n,l),h=z(c,l.action_data?.kwargs?.timeout_ms);if(u)await u.click({button:"right",timeout:h});else throw new Error("No locator found for right_click action")}transpile(n){let l=[];return n.locator?l.push(`locator: ${JSON.stringify(n.locator)}`):n.xpath&&l.push(`xpath: ${JSON.stringify(n.xpath)}`),n.frame_path&&n.frame_path.length>0&&l.push(`frame_path: ${JSON.stringify(n.frame_path)}`),l.length===0?['await agent.execAction("right_click", page, {});']:['await agent.execAction("right_click", page, {',...l.map(c=>` ${c},`),"});"]}};async function wa(n,l,c,u,h={}){return{...await X(u,c),action_description:l,action_data:{action_name:n,kwargs:{...h}}}}function ms(n,l,c){return{action_description:`${n} (failed - element not found)`,action_data:{action_name:l,kwargs:c},feedback:"Element not found in DOM"}}var Aa=ht.object({element_index:ht.number().int().describe("Index of the element to right-click"),timeout_ms:ht.number().optional().describe("Per-action timeout in ms. Overrides the default 5s action timeout.")});function Kn(n,l){n.register({name:"right_click",description:"Right-click an interactive element.",schema:Aa,usesElementIndex:!0,async execute(c,u){let{element_index:h}=c,{page:y,agentServices:x,actionDescription:w}=u;try{let g=await K(u,h);if(!g)return{success:!1,error:`Element with index ${h} not found.`,actionEntity:ms(`Right-click element ${h}`,"right_click",{index:h})};let E=w||`Right-click element ${h}`,C=await wa("right_click",E,g,y);return await l.execute(y,C,x),{success:!0,actionEntity:C,message:`Right-clicked element ${h}`}}catch(g){return{success:!1,error:g.message,actionEntity:ms(`Right-click element ${h}`,"right_click",{index:h})}}}})}var Pa=class{async execute(n,l,c){let u=l.action_data;if(!u)throw new Error("Action data not found");let h=u.kwargs.name,y=u.kwargs.value;if(!h||y===void 0)throw new Error("Missing variable name or value for save_variable");h.startsWith("$")&&(h=h.slice(1)),c.saveVariable(h,y)}transpile(n){let l=n.action_data?.kwargs?.name||"",c=n.action_data?.kwargs?.value;return['await agent.execAction("save_variable", page, {',` action_data: { kwargs: { name: ${JSON.stringify(l)}, value: ${JSON.stringify(c)} } },`,"});"]}},ba=ct.object({name:ct.string().describe("Variable name to save"),value:ct.string().describe("Value to save in the variable")});function Yn(n,l){n.register({name:"save_variable",description:"Save a value to a named variable for later use in the test.",schema:ba,async execute(c,u){let{name:h,value:y}=c,{page:x,agentServices:w}=u;try{let g={action_description:`Save variable "${h}" = "${y}"`,action_data:{action_name:"save_variable",kwargs:{name:h,value:y}}};return await l.execute(x,g,w),{success:!0,actionEntity:g,message:`Saved variable "${h}"`}}catch(g){return{success:!1,error:g.message,actionEntity:{action_description:`Save variable "${h}" (failed)`,action_data:{action_name:"save_variable",kwargs:{name:h,value:y}},feedback:g.message}}}}})}var Be=class{async execute(n,l){let c=l.action_data;if(!c)throw new Error("Action data not found");let u=c.kwargs.down??!0,h=c.kwargs.num_pages??1,y=u?1:-1;await n.evaluate(`window.scrollBy(0, window.innerHeight * ${h} * ${y})`)}transpile(n){let l=n.action_data?.kwargs?.down??!0;return[`await page.evaluate('window.scrollBy(0, window.innerHeight * ${(n.action_data?.kwargs?.num_pages??1)*(l?1:-1)})');`]}};async function Ta(n,l,c={}){return{action_description:l,action_data:{action_name:n,kwargs:{...c}}}}function Ea(n,l,c){return{action_description:`${n} (failed)`,action_data:{action_name:l,kwargs:c},feedback:"Scroll failed!"}}var Ca=pt.object({down:pt.boolean().describe("True to scroll down, False to scroll up"),num_pages:pt.number().nonnegative().describe("Number of pages to scroll (0.5 = half page, 1.0 = one page, etc.)")});function Qn(n,l){n.register({name:"scroll",description:"Scroll the page by specified number of pages (set down=True to scroll down, down=False to scroll up, num_pages=number of pages to scroll like 0.5 for half page, 1.0 for one page, etc.). ",schema:Ca,async execute(c,u){let{down:h,num_pages:y}=c,{page:x,agentServices:w,actionDescription:g}=u;try{let E=g||`Scroll ${h?"down":"up"} ${y} page(s)`,C=await Ta("scroll",E,{down:h,num_pages:y});return await l.execute(x,C,w),{success:!0,actionEntity:C,message:`Scrolled ${h?"down":"up"} ${y} page(s)`}}catch(E){return{success:!1,error:E.message,actionEntity:Ea(g||`Scroll ${h?"down":"up"} ${y} page(s)`,"scroll",{down:h,num_pages:y})}}}})}j();var Sa=class{async execute(n,l,c){let u=l.action_data;if(!u)throw new Error("Action data not found");let h=u.kwargs.delta_x||0,y=u.kwargs.delta_y||0,x=V(n,l),w=z(c,l.action_data?.kwargs?.timeout_ms);if(x)await x.hover({timeout:w}),await n.mouse.wheel(h,y);else throw new Error("No locator found for scroll_on_element action")}transpile(n){let l=De(n);if(!l){let h=n.action_data?.kwargs?.delta_x||0,y=n.action_data?.kwargs?.delta_y||0;return['await agent.execAction("scroll_on_element", page, {',` action_data: { kwargs: { delta_x: ${h}, delta_y: ${y} } },`,"});"]}let c=n.action_data?.kwargs?.delta_x||0,u=n.action_data?.kwargs?.delta_y||0;return[`await ${l}.hover({ timeout: ${z()} });`,`await page.mouse.wheel(${c}, ${u});`]}};async function ka(n,l,c,u,h={}){return{...await X(u,c),action_description:l,action_data:{action_name:n,kwargs:{...h}}}}function fs(n,l,c){return{action_description:`${n} (failed)`,action_data:{action_name:l,kwargs:c},feedback:"Element not found in DOM"}}var va=Te.object({element_index:Te.number().int().describe("Index of the scrollable element"),delta_x:Te.number().optional().describe("The number of pixels to scroll horizontally. Positive values scroll right, negative values scroll left."),delta_y:Te.number().optional().describe("The number of pixels to scroll vertically. Positive values scroll down, negative values scroll up."),timeout_ms:Te.number().optional().describe("Per-action timeout in ms. Overrides the default 5s action timeout.")});function eo(n,l){n.register({name:"scroll_on_element",description:"Scroll on a scrollable element horizontally and vertically.",schema:va,usesElementIndex:!0,async execute(c,u){let{element_index:h,delta_x:y,delta_y:x}=c,{page:w,agentServices:g}=u;try{let E=await K(u,h);if(!E)return{success:!1,error:`Element with index ${h} not found`,actionEntity:fs(`Scroll on element ${h} horizontally: ${y}px, vertically: ${x}px`,"scroll_on_element",{index:h,delta_x:y,delta_y:x})};let C=await ka("scroll_on_element",`Scroll on element ${h} horizontally: ${y}px, vertically: ${x}px`,E,w,{delta_x:y,delta_y:x});return await l.execute(w,C,g),{success:!0,actionEntity:C,message:`Scrolled on element ${h} horizontally: ${y}px, vertically: ${x}px`}}catch(E){return{success:!1,error:E.message,actionEntity:fs(`Scroll on element ${h} horizontally: ${y}px, vertically: ${x}px`,"scroll_on_element",{index:h,delta_x:y,delta_y:x})}}}})}var Ia=class{async execute(n,l){let c=l.action_data;if(!c)throw new Error("Action data not found");let u=c.kwargs.text;if(u)await n.getByText(u,{exact:!1}).first().scrollIntoViewIfNeeded(),await n.waitForTimeout(500);else throw new Error("Missing text for scroll_to_text action")}transpile(n){let l=n.action_data?.kwargs?.text||"";return[`await page.getByText(${JSON.stringify(l)}, { exact: false }).first().scrollIntoViewIfNeeded();`]}},Na=ys.object({text:ys.string().describe("Text to scroll to on the page")});function so(n,l){n.register({name:"scroll_to_text",description:"Scroll the page until specified text becomes visible.",schema:Na,async execute(c,u){let{text:h}=c,{page:y,agentServices:x,actionDescription:w}=u;try{let g={action_description:w||`Scroll to text "${h}"`,action_data:{action_name:"scroll_to_text",kwargs:{text:h}}};return await l.execute(y,g,x),{success:!0,actionEntity:g,message:`Scrolled to text "${h}"`}}catch(g){return{success:!1,error:g.message,actionEntity:{action_description:(w||`Scroll to text "${h}"`)+" (failed)",action_data:{action_name:"scroll_to_text",kwargs:{text:h}},feedback:g.message}}}}})}var _a=class{async execute(n,l,c){if(!l.xpath)throw new Error("XPath not found in action entity");let u=[];for(let h of n.frames())try{let y=await h.evaluate(x=>{let w=document.evaluate(x,document,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;return w?{options:Array.from(w.options).map(g=>({text:g.text,value:g.value,index:g.index})),id:w.id,name:w.name}:null},l.xpath);if(y){let x=[];for(let w of y.options){let g=JSON.stringify(w.text);x.push(`${w.index}: text=${g}`)}u.push(...x)}}catch{}if(u.length>0){let h=u.join(`
|
|
31
31
|
`);h+=`
|
|
32
|
-
Use the exact text string in select_dropdown_option`,c.addNote(h)}else c.addNote("No options found in any frame for dropdown")}transpile(n){let l=[];return n.xpath&&l.push(`xpath: ${JSON.stringify(n.xpath)}`),n.frame_path&&n.frame_path.length>0&&l.push(`frame_path: ${JSON.stringify(n.frame_path)}`),l.length===0?['await agent.execAction("get_dropdown_options", page, {});']:['await agent.execAction("get_dropdown_options", page, {',...l.map(c=>` ${c},`),"});"]}};async function Da(n,l,c){return{...await X(l,n),action_description:c||"Get dropdown options",action_data:{action_name:"get_dropdown_options",kwargs:{}}}}function gs(n,l){return{action_description:`${n} (failed - element not found)`,action_data:{action_name:"get_dropdown_options",kwargs:l},feedback:"Element not found in DOM"}}var Fa=xs.object({element_index:xs.number().int().describe("Index of the dropdown/select element")});function ro(n,l){n.register({name:"get_dropdown_options",description:"Get all options from a native dropdown",schema:Fa,usesElementIndex:!0,async execute(c,u){let{element_index:h}=c,{page:y,agentServices:x,actionDescription:w}=u;try{let g=await K(u,h);if(!g)return{success:!1,error:`Dropdown element with index ${h} not found`,actionEntity:gs(w||`Get options from dropdown ${h}`,{index:h})};let E=await Da(g,y,w);return await l.execute(y,E,x),{success:!0,actionEntity:E,message:E.feedback||"No options found"}}catch(g){return{success:!1,error:g.message,actionEntity:gs(w||`Get options from dropdown ${h}`,{index:h})}}}})}j();var Ba=class{async execute(n,l){await n.goBack({timeout:ue}),await n.waitForLoadState("load",{timeout:ue}),await n.waitForTimeout(1e3)}transpile(n){return['await agent.execAction("go_back", page, {});']}},Oa=La.object({});function no(n,l){n.register({name:"go_back",description:"Navigate back to the previous page in browser history.",schema:Oa,async execute(c,u){let{page:h,agentServices:y,actionDescription:x}=u;try{let w={action_description:x||"Go back",action_data:{action_name:"go_back",kwargs:{}}};return await l.execute(h,w,y),{success:!0,actionEntity:w,message:"Navigated back"}}catch(w){return{success:!1,error:w.message,actionEntity:{action_description:(x||"Go back")+" (failed)",action_data:{action_name:"go_back",kwargs:{}},feedback:w.message}}}}})}j();var ws=class{async execute(n,l,c){let u=l.action_data;if(!u)throw new Error("Action data not found");let h=u.kwargs.url;if(!h)throw new Error("Missing URL for go_to_url action");let y=u.kwargs.new_tab===!0,x=c.replaceVariables(String(h));if(x.startsWith("/")){let E=n.url(),C=null;try{let M=new URL(E);M.origin&&M.origin!=="null"&&(C=M.origin)}catch{}C&&(x=C+x)}let w=u.kwargs.timeout_seconds?u.kwargs.timeout_seconds*1e3:ue,g=n;y&&(g=await n.context().newPage(),c.setPage(g)),await g.goto(x,{timeout:w})}transpile(n){let l=n.action_data?.kwargs?.url||"",c=n.action_data?.kwargs?.new_tab===!0,u=n.action_data?.kwargs?.timeout_seconds,h=[`url: ${JSON.stringify(l)}`];return c&&h.push("new_tab: true"),u&&h.push(`timeout_seconds: ${u}`),['await agent.execAction("go_to_url", page, {',` action_data: { kwargs: { ${h.join(", ")} } },`,"});"]}},Ma=Oe.object({url:Oe.string().describe("URL to navigate to (must be a valid HTTP/HTTPS URL)"),new_tab:Oe.boolean().optional().describe("If true, open the URL in a new tab instead of the current page. Default is false."),timeout_seconds:Oe.number().positive().optional().describe("Navigation timeout in seconds. Default is 20 seconds.")});function lo(n,l){n.register({name:"go_to_url",description:"Navigate to a specific URL. Use this to visit web pages. Set new_tab=true to open in a new tab.",schema:Ma,async execute(c,u){let{url:h,new_tab:y,timeout_seconds:x}=c,{page:w,agentServices:g,actionDescription:E}=u,C={url:h,new_tab:y??!1};x!==void 0&&(C.timeout_seconds=x);let M=x?` (timeout: ${x}s)`:"";try{let H=y?`Open ${h} in new tab`:`Navigate to ${h}`,Y={action_description:E||H,action_data:{action_name:"go_to_url",kwargs:C}};return await l.execute(w,Y,g),{success:!0,actionEntity:Y,message:(y?`Opened ${h} in new tab`:`Navigated to ${h}`)+M}}catch(H){let Y=y?`Open ${h} in new tab`:`Navigate to ${h}`;return{success:!1,error:H.message,actionEntity:{action_description:(E||Y)+" (failed)",action_data:{action_name:"go_to_url",kwargs:C},feedback:H.message}}}}})}j();var As=class{async execute(n,l,c){let u=V(n,l),h=z(c,l.action_data?.kwargs?.timeout_ms);if(u){await u.waitFor({state:"attached",timeout:h});let y=await u.elementHandle();if(!y)throw new Error("Unable to obtain element handle for hover action");let x=await y.boundingBox();if(!x)throw new Error("Unable to determine bounding box for hover action");let w=x.x+x.width/2,g=x.y+x.height/2;await n.mouse.move(w,g)}else throw new Error("No locator found for hover action")}transpile(n){let l=[];return n.locator?l.push(`locator: ${JSON.stringify(n.locator)}`):n.xpath&&l.push(`xpath: ${JSON.stringify(n.xpath)}`),n.frame_path&&n.frame_path.length>0&&l.push(`frame_path: ${JSON.stringify(n.frame_path)}`),l.length===0?['await agent.execAction("hover", page, {});']:['await agent.execAction("hover", page, {',...l.map(c=>` ${c},`),"});"]}};async function $a(n,l,c,u,h={}){return{...await X(u,c),action_description:l,action_data:{action_name:n,kwargs:{...h}}}}function Ps(n,l,c){return{action_description:`${n} (failed - element not found)`,action_data:{action_name:l,kwargs:c},feedback:"Element not found in DOM"}}var Ra=ut.object({element_index:ut.number().int().describe("Index of the element to hover over"),timeout_ms:ut.number().optional().describe("Per-action timeout in ms. Overrides the default 5s action timeout.")});function co(n,l){n.register({name:"hover",description:"Hover over an interactive element.",schema:Ra,usesElementIndex:!0,async execute(c,u){let{element_index:h}=c,{page:y,agentServices:x,actionDescription:w}=u;try{let g=await K(u,h);if(!g)return{success:!1,error:`Element with index ${h} not found.`,actionEntity:Ps(`Hover element ${h}`,"hover",{index:h})};let E=w||`Hover over element ${h}`,C=await $a("hover",E,g,y);return await l.execute(y,C,x),{success:!0,actionEntity:C,message:`Hovered over element ${h}`}}catch(g){return{success:!1,error:g.message,actionEntity:Ps(`Hover element ${h}`,"hover",{index:h})}}}})}j();var bs=class{async execute(n,l,c){let u=l.action_data;if(!u)throw new Error("Action data not found");let h=u.kwargs.text??u.kwargs.value??"",y=c.replaceVariables(String(h)),x=V(n,l),w=z(c,l.action_data?.kwargs?.timeout_ms);if(x){await x.evaluate(E=>{E.value&&(E.value="")},null,{timeout:w}),await x.click({timeout:w}),await n.waitForTimeout(200);let g=c.getActionSettings().type_delay;g!==void 0?await n.keyboard.type(y,{delay:g}):await n.keyboard.type(y)}else throw new Error("No locator found for input_text action")}transpile(n){let l=n.action_data?.kwargs?.text??n.action_data?.kwargs?.value??"",c=[];return c.push(`action_data: { kwargs: { text: ${JSON.stringify(l)} } }`),n.locator?c.push(`locator: ${JSON.stringify(n.locator)}`):n.xpath&&c.push(`xpath: ${JSON.stringify(n.xpath)}`),n.frame_path&&n.frame_path.length>0&&c.push(`frame_path: ${JSON.stringify(n.frame_path)}`),['await agent.execAction("input_text", page, {',...c.map(u=>` ${u},`),"});"]}};async function Ua(n,l,c,u,h={}){return{...await X(u,c),action_description:l,action_data:{action_name:n,kwargs:{...h}}}}function Ts(n,l,c){return{action_description:`${n} (failed - element not found)`,action_data:{action_name:l,kwargs:c},feedback:"Element not found in DOM"}}var ja=Me.object({element_index:Me.number().int().describe("Index of the input element"),text:Me.string().describe("Text to type into the input. To use a placeholder, write {{ placeholder_name }} using exact placeholder name. Use clear_input first if you want to replace existing content."),timeout_ms:Me.number().optional().describe("Per-action timeout in ms. Overrides the default 5s action timeout.")});function uo(n,l){n.register({name:"input_text",description:"Type text into an input field. To replace existing content, use clear_input first.",schema:ja,usesElementIndex:!0,async execute(c,u){let{element_index:h,text:y}=c,{page:x,agentServices:w,actionDescription:g}=u;try{let E=await K(u,h);if(!E)return{success:!1,error:`Input element with index ${h} not found`,actionEntity:Ts(g||`Input text to element ${h}`,"input_text",{index:h,text:y})};let C=g||`Input text to element ${h}`,M=await Ua("input_text",C,E,x,{text:y});return await l.execute(x,M,w),{success:!0,actionEntity:M,message:`Input text to element ${h}`}}catch(E){return{success:!1,error:E.message,actionEntity:Ts(`Input text to element ${h}`,"input_text",{index:h,text:y})}}}})}var za=class{async execute(n,l,c){let u=l.action_data;if(!u)throw new Error("Action data not found");let h=u.kwargs.page_id??u.kwargs.index;if(h===void 0&&(h=n.context().pages().indexOf(n)),typeof h=="number"){if(h===0)throw new Error("Cannot close the first tab (page_id 0). Skipping close_tab action.");c&&await c.closeTab(h)}else throw new Error("Missing page_id for close_tab action")}transpile(n){let l=n.action_data?.kwargs?.page_id;return l=l??n.action_data?.kwargs?.index,['await agent.execAction("close_tab", page, {',` action_data: { kwargs: { page_id: ${l} } },`,"});"]}},Va=Es.object({index:Es.number().int().nonnegative().optional().describe("Index of the tab to close (0-based). Defaults to current tab if not specified.")});function fo(n,l){n.register({name:"close_tab",description:"Close a browser tab by index. If no index is specified, closes the current tab.",schema:Va,async execute(c,u){let{index:h}=c,{page:y,agentServices:x,actionDescription:w}=u;try{let g={action_description:w||`Close tab ${h}`,action_data:{action_name:"close_tab",kwargs:{page_id:h}}};return await l.execute(y,g,x),{success:!0,actionEntity:g,message:`Closed tab ${h}`}}catch(g){return{success:!1,error:g.message,actionEntity:{action_description:(w||"Close tab")+" (failed)",action_data:{action_name:"close_tab",kwargs:{}},feedback:g.message}}}}})}var Ha=class{async execute(n,l){}transpile(n){return["// Done - no action needed"]}},qa=dt.object({success:dt.boolean().describe("Whether the task was completed successfully"),summary:dt.string().describe("Summary of what was accomplished or why it failed")});function xo(n,l){n.register({name:"done",description:"Mark the current task as complete. Use when you have finished all requested actions.",schema:qa,async execute(c,u){let{page:h,agentServices:y}=u;try{let x={action_description:"Task completed",action_data:{action_name:"done",kwargs:{}}};return await l.execute(h,x,y),{success:!0,actionEntity:x,message:"Task marked as complete"}}catch(x){return{success:!1,error:x.message,actionEntity:{action_description:"Task completed (failed)",action_data:{action_name:"done",kwargs:{}},feedback:x.message}}}}})}j();var Cs=class{async execute(n,l,c){let u=V(n,l),h=z(c,l.action_data?.kwargs?.timeout_ms);if(u)await u.dblclick({timeout:h});else throw new Error("No locator found for double_click action")}transpile(n){let l=[];return n.locator?l.push(`locator: ${JSON.stringify(n.locator)}`):n.xpath&&l.push(`xpath: ${JSON.stringify(n.xpath)}`),n.frame_path&&n.frame_path.length>0&&l.push(`frame_path: ${JSON.stringify(n.frame_path)}`),l.length===0?['await agent.execAction("double_click", page, {});']:['await agent.execAction("double_click", page, {',...l.map(c=>` ${c},`),"});"]}};async function Ja(n,l,c,u,h={}){return{...await X(u,c),action_description:l,action_data:{action_name:n,kwargs:{...h}}}}function Ss(n,l,c){return{action_description:`${n} (failed - element not found)`,action_data:{action_name:l,kwargs:c},feedback:"Element not found in DOM"}}var Wa=mt.object({element_index:mt.number().int().describe("Index of the element to double-click"),timeout_ms:mt.number().optional().describe("Per-action timeout in ms. Overrides the default 5s action timeout.")});function wo(n,l){n.register({name:"double_click",description:"Double-click an interactive element.",schema:Wa,usesElementIndex:!0,async execute(c,u){let{element_index:h}=c,{page:y,agentServices:x,actionDescription:w}=u;try{let g=await K(u,h);if(!g)return{success:!1,error:`Element with index ${h} not found.`,actionEntity:Ss(`Double-click element ${h}`,"double_click",{index:h})};let E=w||`Double-click element ${h}`,C=await Ja("double_click",E,g,y);return await l.execute(y,C,x),{success:!0,actionEntity:C,message:`Double-clicked element ${h}`}}catch(g){return{success:!1,error:g.message,actionEntity:Ss(`Double-click element ${h}`,"double_click",{index:h})}}}})}var Ka=class{async execute(n,l,c){let u=l.action_data;if(!u)throw new Error("Action data not found");let h=u.kwargs.otp_secret_key;if(!h)throw new Error("Missing otp_secret_key for generate_2fa_code");let y=c.replaceVariables(String(h)),x=await c.generate2faCode(y);c.saveVariable("otp_code",x)}transpile(n){let l=n.action_data?.kwargs?.otp_secret_key||"";return['await agent.execAction("generate_2fa_code", page, {',` action_data: { kwargs: { otp_secret_key: ${JSON.stringify(l)} } },`,"});"]}},Xa=ks.object({otp_secret_key:ks.string().describe("The OTP secret key to generate the 2FA code from")});function Po(n,l){n.register({name:"generate_2fa_code",description:'Generate a 2FA code from an OTP secret key. The code is saved to the "otp_code" variable. To use the otp_code, you must use `$otp_code` to access it.',schema:Xa,async execute(c,u){let{otp_secret_key:h}=c,{page:y,agentServices:x}=u;try{let w={action_description:"Generate 2FA code",action_data:{action_name:"generate_2fa_code",kwargs:{otp_secret_key:h}}};return await l.execute(y,w,x),{success:!0,actionEntity:w,message:'Generated 2FA code and saved to variable "otp_code"'}}catch(w){return{success:!1,error:w.message,actionEntity:{action_description:"Generate 2FA code (failed)",action_data:{action_name:"generate_2fa_code",kwargs:{otp_secret_key:h}},feedback:w.message}}}}})}var Ya=ss(Mr(),1);function Ga(n){if(!n.trim())return!1;try{return(0,Ya.parse)(n,{sourceType:"module",plugins:["typescript"]}),!0}catch{return!1}}var bt={};Zt(bt,{default:()=>Za});es(bt,Qa);var ft=class{async execute(n,l,c){let u=l.action_data?.kwargs,h=typeof u?.code=="string",y=h?u?.statement||l.action_description:l.action_description||u?.statement;if(h&&y){let C=Date.now();try{await this.executeJSAssertion(n,u.code,c),W.info(`[VERIFY:JS] \u2713 ${((Date.now()-C)/1e3).toFixed(1)}s: ${y}`);return}catch(M){let H=((Date.now()-C)/1e3).toFixed(1);W.info(`[VERIFY:JS\u2192AI] JS failed ${H}s (${M instanceof Error?M.message:String(M)}), falling back to AI: ${y}`)}}else if(h){let C=Date.now();await this.executeJSAssertion(n,u.code,c),W.info(`[VERIFY:JS] \u2713 ${((Date.now()-C)/1e3).toFixed(1)}s: ${y||"js-only"}`);return}if(!y)throw new Error("Missing statement or code for verify action");let x=Date.now();W.info(`[VERIFY:AI] Evaluating: ${y}`);let{evaluateStatement:w}=await import("./agentHelpers-242MN5TR-AK52N3RJ.js"),g=await w(y,n,c,{useCleanScreenshotForAssertion:!0}),E=g.explanation||g.error||(g.success?`Assertion passed: ${y}`:"Assertion failed");if(c.addNote(E),!g.success)throw W.info(`[VERIFY:AI] \u2717 ${((Date.now()-x)/1e3).toFixed(1)}s: ${y}`),new Error(g.error||g.explanation||"Assertion failed");W.info(`[VERIFY:AI] \u2713 ${((Date.now()-x)/1e3).toFixed(1)}s: ${y}`)}async executeJSAssertion(n,l,c){try{await new Function("page","expect","agentServices",`
|
|
32
|
+
Use the exact text string in select_dropdown_option`,c.addNote(h)}else c.addNote("No options found in any frame for dropdown")}transpile(n){let l=[];return n.xpath&&l.push(`xpath: ${JSON.stringify(n.xpath)}`),n.frame_path&&n.frame_path.length>0&&l.push(`frame_path: ${JSON.stringify(n.frame_path)}`),l.length===0?['await agent.execAction("get_dropdown_options", page, {});']:['await agent.execAction("get_dropdown_options", page, {',...l.map(c=>` ${c},`),"});"]}};async function Da(n,l,c){return{...await X(l,n),action_description:c||"Get dropdown options",action_data:{action_name:"get_dropdown_options",kwargs:{}}}}function gs(n,l){return{action_description:`${n} (failed - element not found)`,action_data:{action_name:"get_dropdown_options",kwargs:l},feedback:"Element not found in DOM"}}var Fa=xs.object({element_index:xs.number().int().describe("Index of the dropdown/select element")});function ro(n,l){n.register({name:"get_dropdown_options",description:"Get all options from a native dropdown",schema:Fa,usesElementIndex:!0,async execute(c,u){let{element_index:h}=c,{page:y,agentServices:x,actionDescription:w}=u;try{let g=await K(u,h);if(!g)return{success:!1,error:`Dropdown element with index ${h} not found`,actionEntity:gs(w||`Get options from dropdown ${h}`,{index:h})};let E=await Da(g,y,w);return await l.execute(y,E,x),{success:!0,actionEntity:E,message:E.feedback||"No options found"}}catch(g){return{success:!1,error:g.message,actionEntity:gs(w||`Get options from dropdown ${h}`,{index:h})}}}})}j();var Ba=class{async execute(n,l){await n.goBack({timeout:ue}),await n.waitForLoadState("load",{timeout:ue}),await n.waitForTimeout(1e3)}transpile(n){return['await agent.execAction("go_back", page, {});']}},Oa=La.object({});function no(n,l){n.register({name:"go_back",description:"Navigate back to the previous page in browser history.",schema:Oa,async execute(c,u){let{page:h,agentServices:y,actionDescription:x}=u;try{let w={action_description:x||"Go back",action_data:{action_name:"go_back",kwargs:{}}};return await l.execute(h,w,y),{success:!0,actionEntity:w,message:"Navigated back"}}catch(w){return{success:!1,error:w.message,actionEntity:{action_description:(x||"Go back")+" (failed)",action_data:{action_name:"go_back",kwargs:{}},feedback:w.message}}}}})}j();var ws=class{async execute(n,l,c){let u=l.action_data;if(!u)throw new Error("Action data not found");let h=u.kwargs.url;if(!h)throw new Error("Missing URL for go_to_url action");let y=u.kwargs.new_tab===!0,x=c.replaceVariables(String(h));if(x.startsWith("/")){let E=n.url(),C=null;try{let M=new URL(E);M.origin&&M.origin!=="null"&&(C=M.origin)}catch{}C&&(x=C+x)}let w=u.kwargs.timeout_seconds?u.kwargs.timeout_seconds*1e3:ue,g=n;y&&(g=await n.context().newPage(),c.setPage(g)),await g.goto(x,{timeout:w})}transpile(n){let l=n.action_data?.kwargs?.url||"",c=n.action_data?.kwargs?.new_tab===!0,u=n.action_data?.kwargs?.timeout_seconds,h=[`url: ${JSON.stringify(l)}`];return c&&h.push("new_tab: true"),u&&h.push(`timeout_seconds: ${u}`),['await agent.execAction("go_to_url", page, {',` action_data: { kwargs: { ${h.join(", ")} } },`,"});"]}},Ma=Oe.object({url:Oe.string().describe("URL to navigate to (must be a valid HTTP/HTTPS URL)"),new_tab:Oe.boolean().optional().describe("If true, open the URL in a new tab instead of the current page. Default is false."),timeout_seconds:Oe.number().positive().optional().describe("Navigation timeout in seconds. Default is 20 seconds.")});function lo(n,l){n.register({name:"go_to_url",description:"Navigate to a specific URL. Use this to visit web pages. Set new_tab=true to open in a new tab.",schema:Ma,async execute(c,u){let{url:h,new_tab:y,timeout_seconds:x}=c,{page:w,agentServices:g,actionDescription:E}=u,C={url:h,new_tab:y??!1};x!==void 0&&(C.timeout_seconds=x);let M=x?` (timeout: ${x}s)`:"";try{let H=y?`Open ${h} in new tab`:`Navigate to ${h}`,Y={action_description:E||H,action_data:{action_name:"go_to_url",kwargs:C}};return await l.execute(w,Y,g),{success:!0,actionEntity:Y,message:(y?`Opened ${h} in new tab`:`Navigated to ${h}`)+M}}catch(H){let Y=y?`Open ${h} in new tab`:`Navigate to ${h}`;return{success:!1,error:H.message,actionEntity:{action_description:(E||Y)+" (failed)",action_data:{action_name:"go_to_url",kwargs:C},feedback:H.message}}}}})}j();var As=class{async execute(n,l,c){let u=V(n,l),h=z(c,l.action_data?.kwargs?.timeout_ms);if(u){await u.waitFor({state:"attached",timeout:h});let y=await u.elementHandle();if(!y)throw new Error("Unable to obtain element handle for hover action");let x=await y.boundingBox();if(!x)throw new Error("Unable to determine bounding box for hover action");let w=x.x+x.width/2,g=x.y+x.height/2;await n.mouse.move(w,g)}else throw new Error("No locator found for hover action")}transpile(n){let l=[];return n.locator?l.push(`locator: ${JSON.stringify(n.locator)}`):n.xpath&&l.push(`xpath: ${JSON.stringify(n.xpath)}`),n.frame_path&&n.frame_path.length>0&&l.push(`frame_path: ${JSON.stringify(n.frame_path)}`),l.length===0?['await agent.execAction("hover", page, {});']:['await agent.execAction("hover", page, {',...l.map(c=>` ${c},`),"});"]}};async function $a(n,l,c,u,h={}){return{...await X(u,c),action_description:l,action_data:{action_name:n,kwargs:{...h}}}}function Ps(n,l,c){return{action_description:`${n} (failed - element not found)`,action_data:{action_name:l,kwargs:c},feedback:"Element not found in DOM"}}var Ra=ut.object({element_index:ut.number().int().describe("Index of the element to hover over"),timeout_ms:ut.number().optional().describe("Per-action timeout in ms. Overrides the default 5s action timeout.")});function co(n,l){n.register({name:"hover",description:"Hover over an interactive element.",schema:Ra,usesElementIndex:!0,async execute(c,u){let{element_index:h}=c,{page:y,agentServices:x,actionDescription:w}=u;try{let g=await K(u,h);if(!g)return{success:!1,error:`Element with index ${h} not found.`,actionEntity:Ps(`Hover element ${h}`,"hover",{index:h})};let E=w||`Hover over element ${h}`,C=await $a("hover",E,g,y);return await l.execute(y,C,x),{success:!0,actionEntity:C,message:`Hovered over element ${h}`}}catch(g){return{success:!1,error:g.message,actionEntity:Ps(`Hover element ${h}`,"hover",{index:h})}}}})}j();var bs=class{async execute(n,l,c){let u=l.action_data;if(!u)throw new Error("Action data not found");let h=u.kwargs.text??u.kwargs.value??"",y=c.replaceVariables(String(h)),x=V(n,l),w=z(c,l.action_data?.kwargs?.timeout_ms);if(x){await x.evaluate(E=>{E.value&&(E.value="")},null,{timeout:w}),await x.click({timeout:w}),await n.waitForTimeout(200);let g=c.getActionSettings().type_delay;g!==void 0?await n.keyboard.type(y,{delay:g}):await n.keyboard.type(y)}else throw new Error("No locator found for input_text action")}transpile(n){let l=n.action_data?.kwargs?.text??n.action_data?.kwargs?.value??"",c=[];return c.push(`action_data: { kwargs: { text: ${JSON.stringify(l)} } }`),n.locator?c.push(`locator: ${JSON.stringify(n.locator)}`):n.xpath&&c.push(`xpath: ${JSON.stringify(n.xpath)}`),n.frame_path&&n.frame_path.length>0&&c.push(`frame_path: ${JSON.stringify(n.frame_path)}`),['await agent.execAction("input_text", page, {',...c.map(u=>` ${u},`),"});"]}};async function Ua(n,l,c,u,h={}){return{...await X(u,c),action_description:l,action_data:{action_name:n,kwargs:{...h}}}}function Ts(n,l,c){return{action_description:`${n} (failed - element not found)`,action_data:{action_name:l,kwargs:c},feedback:"Element not found in DOM"}}var ja=Me.object({element_index:Me.number().int().describe("Index of the input element"),text:Me.string().describe("Text to type into the input. To use a placeholder, write {{ placeholder_name }} using exact placeholder name. Use clear_input first if you want to replace existing content."),timeout_ms:Me.number().optional().describe("Per-action timeout in ms. Overrides the default 5s action timeout.")});function uo(n,l){n.register({name:"input_text",description:"Type text into an input field. To replace existing content, use clear_input first.",schema:ja,usesElementIndex:!0,async execute(c,u){let{element_index:h,text:y}=c,{page:x,agentServices:w,actionDescription:g}=u;try{let E=await K(u,h);if(!E)return{success:!1,error:`Input element with index ${h} not found`,actionEntity:Ts(g||`Input text to element ${h}`,"input_text",{index:h,text:y})};let C=g||`Input text to element ${h}`,M=await Ua("input_text",C,E,x,{text:y});return await l.execute(x,M,w),{success:!0,actionEntity:M,message:`Input text to element ${h}`}}catch(E){return{success:!1,error:E.message,actionEntity:Ts(`Input text to element ${h}`,"input_text",{index:h,text:y})}}}})}var za=class{async execute(n,l,c){let u=l.action_data;if(!u)throw new Error("Action data not found");let h=u.kwargs.page_id??u.kwargs.index;if(h===void 0&&(h=n.context().pages().indexOf(n)),typeof h=="number"){if(h===0)throw new Error("Cannot close the first tab (page_id 0). Skipping close_tab action.");c&&await c.closeTab(h)}else throw new Error("Missing page_id for close_tab action")}transpile(n){let l=n.action_data?.kwargs?.page_id;return l=l??n.action_data?.kwargs?.index,['await agent.execAction("close_tab", page, {',` action_data: { kwargs: { page_id: ${l} } },`,"});"]}},Va=Es.object({index:Es.number().int().nonnegative().optional().describe("Index of the tab to close (0-based). Defaults to current tab if not specified.")});function fo(n,l){n.register({name:"close_tab",description:"Close a browser tab by index. If no index is specified, closes the current tab.",schema:Va,async execute(c,u){let{index:h}=c,{page:y,agentServices:x,actionDescription:w}=u;try{let g={action_description:w||`Close tab ${h}`,action_data:{action_name:"close_tab",kwargs:{page_id:h}}};return await l.execute(y,g,x),{success:!0,actionEntity:g,message:`Closed tab ${h}`}}catch(g){return{success:!1,error:g.message,actionEntity:{action_description:(w||"Close tab")+" (failed)",action_data:{action_name:"close_tab",kwargs:{}},feedback:g.message}}}}})}var Ha=class{async execute(n,l){}transpile(n){return["// Done - no action needed"]}},qa=dt.object({success:dt.boolean().describe("Whether the task was completed successfully"),summary:dt.string().describe("Summary of what was accomplished or why it failed")});function xo(n,l){n.register({name:"done",description:"Mark the current task as complete. Use when you have finished all requested actions.",schema:qa,async execute(c,u){let{page:h,agentServices:y}=u;try{let x={action_description:"Task completed",action_data:{action_name:"done",kwargs:{}}};return await l.execute(h,x,y),{success:!0,actionEntity:x,message:"Task marked as complete"}}catch(x){return{success:!1,error:x.message,actionEntity:{action_description:"Task completed (failed)",action_data:{action_name:"done",kwargs:{}},feedback:x.message}}}}})}j();var Cs=class{async execute(n,l,c){let u=V(n,l),h=z(c,l.action_data?.kwargs?.timeout_ms);if(u)await u.dblclick({timeout:h});else throw new Error("No locator found for double_click action")}transpile(n){let l=[];return n.locator?l.push(`locator: ${JSON.stringify(n.locator)}`):n.xpath&&l.push(`xpath: ${JSON.stringify(n.xpath)}`),n.frame_path&&n.frame_path.length>0&&l.push(`frame_path: ${JSON.stringify(n.frame_path)}`),l.length===0?['await agent.execAction("double_click", page, {});']:['await agent.execAction("double_click", page, {',...l.map(c=>` ${c},`),"});"]}};async function Ja(n,l,c,u,h={}){return{...await X(u,c),action_description:l,action_data:{action_name:n,kwargs:{...h}}}}function Ss(n,l,c){return{action_description:`${n} (failed - element not found)`,action_data:{action_name:l,kwargs:c},feedback:"Element not found in DOM"}}var Wa=mt.object({element_index:mt.number().int().describe("Index of the element to double-click"),timeout_ms:mt.number().optional().describe("Per-action timeout in ms. Overrides the default 5s action timeout.")});function wo(n,l){n.register({name:"double_click",description:"Double-click an interactive element.",schema:Wa,usesElementIndex:!0,async execute(c,u){let{element_index:h}=c,{page:y,agentServices:x,actionDescription:w}=u;try{let g=await K(u,h);if(!g)return{success:!1,error:`Element with index ${h} not found.`,actionEntity:Ss(`Double-click element ${h}`,"double_click",{index:h})};let E=w||`Double-click element ${h}`,C=await Ja("double_click",E,g,y);return await l.execute(y,C,x),{success:!0,actionEntity:C,message:`Double-clicked element ${h}`}}catch(g){return{success:!1,error:g.message,actionEntity:Ss(`Double-click element ${h}`,"double_click",{index:h})}}}})}var Ka=class{async execute(n,l,c){let u=l.action_data;if(!u)throw new Error("Action data not found");let h=u.kwargs.otp_secret_key;if(!h)throw new Error("Missing otp_secret_key for generate_2fa_code");let y=c.replaceVariables(String(h)),x=await c.generate2faCode(y);c.saveVariable("otp_code",x)}transpile(n){let l=n.action_data?.kwargs?.otp_secret_key||"";return['await agent.execAction("generate_2fa_code", page, {',` action_data: { kwargs: { otp_secret_key: ${JSON.stringify(l)} } },`,"});"]}},Xa=ks.object({otp_secret_key:ks.string().describe("The OTP secret key to generate the 2FA code from")});function Po(n,l){n.register({name:"generate_2fa_code",description:'Generate a 2FA code from an OTP secret key. The code is saved to the "otp_code" variable. To use the otp_code, you must use `$otp_code` to access it.',schema:Xa,async execute(c,u){let{otp_secret_key:h}=c,{page:y,agentServices:x}=u;try{let w={action_description:"Generate 2FA code",action_data:{action_name:"generate_2fa_code",kwargs:{otp_secret_key:h}}};return await l.execute(y,w,x),{success:!0,actionEntity:w,message:'Generated 2FA code and saved to variable "otp_code"'}}catch(w){return{success:!1,error:w.message,actionEntity:{action_description:"Generate 2FA code (failed)",action_data:{action_name:"generate_2fa_code",kwargs:{otp_secret_key:h}},feedback:w.message}}}}})}var Ya=ss(Mr(),1);function Ga(n){if(!n.trim())return!1;try{return(0,Ya.parse)(n,{sourceType:"module",plugins:["typescript"]}),!0}catch{return!1}}var bt={};Zt(bt,{default:()=>Za});es(bt,Qa);var ft=class{async execute(n,l,c){let u=l.action_data?.kwargs,h=typeof u?.code=="string",y=h?u?.statement||l.action_description:l.action_description||u?.statement;if(h&&y){let C=Date.now();try{await this.executeJSAssertion(n,u.code,c),W.info(`[VERIFY:JS] \u2713 ${((Date.now()-C)/1e3).toFixed(1)}s: ${y}`);return}catch(M){let H=((Date.now()-C)/1e3).toFixed(1);W.info(`[VERIFY:JS\u2192AI] JS failed ${H}s (${M instanceof Error?M.message:String(M)}), falling back to AI: ${y}`)}}else if(h){let C=Date.now();await this.executeJSAssertion(n,u.code,c),W.info(`[VERIFY:JS] \u2713 ${((Date.now()-C)/1e3).toFixed(1)}s: ${y||"js-only"}`);return}if(!y)throw new Error("Missing statement or code for verify action");let x=Date.now();W.info(`[VERIFY:AI] Evaluating: ${y}`);let{evaluateStatement:w}=await import("./agentHelpers-ZEELTQHQ-7LTM7RPI.js"),g=await w(y,n,c,{useCleanScreenshotForAssertion:!0}),E=g.explanation||g.error||(g.success?`Assertion passed: ${y}`:"Assertion failed");if(c.addNote(E),!g.success)throw W.info(`[VERIFY:AI] \u2717 ${((Date.now()-x)/1e3).toFixed(1)}s: ${y}`),new Error(g.error||g.explanation||"Assertion failed");W.info(`[VERIFY:AI] \u2713 ${((Date.now()-x)/1e3).toFixed(1)}s: ${y}`)}async executeJSAssertion(n,l,c){try{await new Function("page","expect","agentServices",`
|
|
33
33
|
return (async () => {
|
|
34
34
|
${l}
|
|
35
35
|
})();
|
|
36
36
|
`)(n,bt.expect,c)}catch(u){throw new Error(`Assertion failed: ${u instanceof Error?u.message:String(u)}`)}}transpile(n,l){let c=n.action_data?.kwargs,u=typeof c?.code=="string",h=u?c?.statement||n.action_description:n.action_description||c?.statement,y=JSON.stringify(l||"");if(u){let x=c.code;if(!Ga(x))return[`throw new Error("Invalid assertion code syntax: " + ${JSON.stringify(x)});`];if(h){let w=x.split(`
|
|
37
37
|
`),g=JSON.stringify(h);return["{ const _t = Date.now(); try {",...w.map(E=>` ${E}`),` console.log(\`[VERIFY:JS] \u2713 \${((Date.now()-_t)/1000).toFixed(1)}s: ${g}\`);`,"} catch (_e) {",` console.log(\`[VERIFY:JS\u2192AI] JS failed \${((Date.now()-_t)/1000).toFixed(1)}s: (\${_e instanceof Error ? _e.message : String(_e)}), falling back to AI: ${g}\`);`,` await agent.assert(page, ${g}, ${y});`,"} }"]}return x.split(`
|
|
38
|
-
`)}return h?[`await agent.assert(page, ${JSON.stringify(h)}, ${y});`]:["// Skipping verify: missing statement or code"]}},en=vs.object({statement:vs.string().describe('The nature language statement to verify (e.g., "The login was successful")')});function Eo(n,l){n.register({name:"verify",description:"Verify that a statement is true based on the current page state. Use this to check assertions about the page content, element visibility, or any condition.",schema:en,async execute(c,u){let{statement:h}=c,{page:y,agentServices:x}=u;try{let w={action_description:`${h}`,action_data:{action_name:"verify",kwargs:{statement:h}}};return await l.execute(y,w,x),{success:!0,actionEntity:w,message:`Assertion verified: ${h}`}}catch(w){return{success:!1,error:w.message,actionEntity:{action_description:`Verify: ${h} (failed)`,action_data:{action_name:"verify",kwargs:{statement:h}},feedback:w.message}}}},availability:{openai:!0,mcp:!0}})}var tn=class{async execute(n,l,c){let u=l.action_data;if(!u)throw new Error("Action data not found");let h=u.kwargs.element_description,y=u.kwargs.variable_name;if(!h||!y)throw new Error("Missing element_description or variable_name for ai_extract");let x=`Extract ${h} and save to ${y}`,{executeStep:w}=await import("./agentHelpers-242MN5TR-AK52N3RJ.js"),g=await w(x,n,c);if(g.status!=="success")throw new Error(g.error||"Extraction failed")}transpile(n,l){let c=n.action_data?.kwargs?.element_description,u=n.action_data?.kwargs?.variable_name;if(!c||!u)return["// Skipping ai_extract: missing element_description or variable_name"];let h=JSON.stringify(c),y=JSON.stringify(u);return[`await agent.extract(page, ${h}, ${y}, '${l||""}');`]}},sn=yt.object({element_description:yt.string().describe('Description of the element to extract (e.g., "the price of the product")'),variable_name:yt.string().describe("Name of the variable to store the extracted value")});function So(n,l){n.register({name:"ai_extract",description:"Use AI to extract information from the page and save it to a variable. MCP-only tool.",schema:sn,async execute(c,u){let{element_description:h,variable_name:y}=c,{page:x,agentServices:w}=u;try{let g={action_description:`Extract ${h} to ${y}`,action_data:{action_name:"ai_extract",kwargs:{element_description:h,variable_name:y}}};return await l.execute(x,g,w),{success:!0,actionEntity:g,message:`Extracted ${h} to ${y}`}}catch(g){return{success:!1,error:g.message,actionEntity:{action_description:`Extract ${h} (failed)`,action_data:{action_name:"ai_extract",kwargs:{element_description:h,variable_name:y}},feedback:g.message}}}},availability:{openai:!1,mcp:!0}})}j();var rn=class{async execute(n,l,c){let u=V(n,l),h=z(c,l.action_data?.kwargs?.timeout_ms);if(u)await u.click({timeout:h}),await n.keyboard.press("ControlOrMeta+a"),await n.waitForTimeout(200),await n.keyboard.press("Backspace"),await n.waitForTimeout(200);else throw new Error("No locator found for clear_input action")}transpile(n){let l=[];return n.locator?l.push(`locator: ${JSON.stringify(n.locator)}`):n.xpath&&l.push(`xpath: ${JSON.stringify(n.xpath)}`),n.frame_path&&n.frame_path.length>0&&l.push(`frame_path: ${JSON.stringify(n.frame_path)}`),l.length===0?['await agent.execAction("clear_input", page, {});']:['await agent.execAction("clear_input", page, {',...l.map(c=>` ${c},`),"});"]}};async function an(n,l,c,u,h={}){return{...await X(u,c),action_description:l,action_data:{action_name:n,kwargs:{...h}}}}function Is(n,l,c){return{action_description:`${n} (failed - element not found)`,action_data:{action_name:l,kwargs:c},feedback:"Element not found in DOM"}}var nn=xt.object({element_index:xt.number().int().describe("Index of the input element to clear"),timeout_ms:xt.number().optional().describe("Per-action timeout in ms. Overrides the default 5s action timeout.")});function vo(n,l){n.register({name:"clear_input",description:"Clear the contents of an input field, textarea, or other editable element.",schema:nn,usesElementIndex:!0,async execute(c,u){let{element_index:h}=c,{page:y,agentServices:x,actionDescription:w}=u;try{let g=await K(u,h);if(!g)return{success:!1,error:`Input element with index ${h} not found`,actionEntity:Is(w||`Clear element ${h}`,"clear_input",{index:h})};let E=w||`Clear element ${h}`,C=await an("clear_input",E,g,y);return await l.execute(y,C,x),{success:!0,actionEntity:C,message:`Cleared element ${h}`}}catch(g){return{success:!1,error:g.message,actionEntity:Is(`Clear element ${h}`,"clear_input",{index:h})}}}})}j();var wt=class{async execute(n,l,c){let u=V(n,l),h=z(c,l.action_data?.kwargs?.timeout_ms);if(u){await u.click({timeout:h});try{await n.waitForTimeout(1e3)}catch{}}else throw new Error("No locator found for click action")}transpile(n){let l=De(n);if(!l)return['await agent.execAction("click", page, {});'];let c=z();return[`await ${l}.click({ timeout: ${c} });`]}};async function on(n,l,c,u,h={}){return{...await X(u,c),action_description:l,action_data:{action_name:n,kwargs:{...h}}}}function Ns(n,l,c){return{action_description:`${n} (failed - element not found)`,action_data:{action_name:l,kwargs:c},feedback:"Element not found in DOM"}}var ln=gt.object({element_index:gt.number().int().describe("Index of the element to click (0-based). Return -1 if no element found"),timeout_ms:gt.number().optional().describe("Per-action timeout in ms. Overrides the default 5s action timeout.")});function No(n,l){n.register({name:"click",description:"Click an interactive element.",schema:ln,usesElementIndex:!0,async execute(c,u){let{element_index:h}=c,{page:y,agentServices:x,actionDescription:w}=u;try{let g=await K(u,h);if(!g)return{success:!1,error:`Element with index ${h} not found.`,actionEntity:Ns(`Click element ${h}`,"click",{index:h})};let E=w||`Click element ${h}`,C=await on("click",E,g,y);return await l.execute(y,C,x),{success:!0,actionEntity:C,message:`Clicked element ${h}`}}catch(g){return{success:!1,error:g.message,actionEntity:Ns(`Click element ${h}`,"click",{index:h})}}}})}var hn=["ai_action","ai_step","ai_assert","ai_extract","ai_wait_until","verify","assert"],cn=["js_code","function","wait","wait_for_download_complete","wait_for_page_ready","extract_email_content","extract_activation_code"],_s=class{static isAiAction(n){let l=n.action_data?.action_name;return!l||(l==="verify"||l==="ai_assert"||l==="assert")&&n.action_data?.kwargs?.code?!1:hn.includes(l)}static getAiStatement(n){let l=n.action_data?.action_name;if(!l)return null;let c=n.action_data?.kwargs||{};switch(l){case"ai_action":case"ai_step":return c.statement||null;case"verify":case"ai_assert":case"assert":return c.statement||n.action_description||null;case"ai_extract":let u=c.element_description,h=c.variable_name;return u&&h?`Extract ${u} and save to ${h}`:null;case"ai_wait_until":return c.condition||null;default:return null}}static canSelfHeal(n){let l=n.action_data?.action_name;return!l||(l==="verify"||l==="ai_assert"||l==="assert")&&n.action_data?.kwargs?.code?!1:!cn.includes(l)}},Pt=class I{static registerAction(l,c){I.actions.set(l,c)}constructor(){I.initialized||(this.registerBuiltinActions(),I.initialized=!0)}registerBuiltinActions(){I.registerAction("go_to_url",new ws),I.registerAction("go_back",new Ba),I.registerAction("reload_page",new xa),I.registerAction("close_tab",new za),I.registerAction("switch_tab",new ra),I.registerAction("click",new wt),I.registerAction("hover",new As),I.registerAction("right_click",new ds),I.registerAction("double_click",new Cs),I.registerAction("click_by_coordinates",new Hr),I.registerAction("right_click_by_coordinates",new jr),I.registerAction("double_click_by_coordinates",new qr),I.registerAction("drag_drop",new Jr),I.registerAction("input_text",new bs),I.registerAction("clear_input",new rn),I.registerAction("press",new us),I.registerAction("send_keys_on_element",new $r),I.registerAction("scroll_on_element",new Sa),I.registerAction("scroll_to_text",new Ia),I.registerAction("scroll",new Be),I.registerAction("upload_file",new la),I.registerAction("wait_for_download_complete",new da),I.registerAction("get_dropdown_options",new _a),I.registerAction("select_dropdown_option",new Qr),I.registerAction("set_date_for_native_date_picker",new ta),I.registerAction("verify",new ft),I.registerAction("ai_action",new Kr),I.registerAction("ai_extract",new tn),I.registerAction("ai_step",new Xr),I.registerAction("ai_wait_until",new Yr),I.registerAction("generate_2fa_code",new Ka),I.registerAction("wait",new pa),I.registerAction("wait_for_page_ready",new Ur),I.registerAction("save_variable",new Pa),I.registerAction("js_code",new Vr),I.registerAction("js_action",new zr),I.registerAction("function",new Wr),I.registerAction("done",new Ha),I.registerAction("click_element",new wt),I.registerAction("click_element_by_index",new wt),I.registerAction("hover_element_by_index",new As),I.registerAction("right_click_on_element",new ds),I.registerAction("double_click_on_element",new Cs),I.registerAction("scroll_down",new Be),I.registerAction("scroll_up",new Be),I.registerAction("scroll_element",new Be),I.registerAction("send_keys",new us),I.registerAction("open_tab",new ws),I.registerAction("fill",new bs),I.registerAction("ai_assert",new ft),I.registerAction("assert",new ft)}getAction(l){return I.actions.get(l)}hasAction(l){return I.actions.has(l)}getActionNames(){return Array.from(I.actions.keys())}async execute(l,c,u){if(!u)throw new Error("AgentServices not found");let h=c.action_data?.action_name;if(!h)throw new Error("Action name not found in action_data");let y=this.getAction(h);if(!y)throw new Error(`Unknown action: ${h}`);await y.execute(l,c,u)}transpile(l,c,u){let{sanitizeForComment:h}=(j(),at(nt)),y=l.action_description||"",x=l.action_data?.action_name||"",w=this.getAction(x);if(!w)return[`// ${c}: Unknown action: ${x}`];let g=w.transpile(l,c);if(_s.isAiAction(l))return[`// ${c}: ${h(y)}`,"page = agent.agentServices.validatePage(page);",...g];let E=JSON.stringify(y),C=g.map(Y=>` ${Y}`),M=_s.canSelfHeal(l),H=u?`'${u}'`:"undefined";return[`// ${c}: ${h(y)}`,"page = agent.agentServices.validatePage(page);","await agent.step(page, async () => {",...C,`}, ${E}, '${c}', ${H}, ${M});`]}transpileUncachedAction(l,c,u=!1,h=!1){let{sanitizeForComment:y}=(j(),at(nt));if(!l)return[`// ${c}: Skipping - no description`];let x=JSON.stringify(l);return h?[`// ${c}: ${y(l)}`,"page = agent.agentServices.validatePage(page);",`await agent.run(page, ${x}, '${c}');`]:[`// ${c}: ${y(l)}`,"page = agent.agentServices.validatePage(page);",`await agent.execute(page, ${x}, '${c}', ${u});`]}};Pt.actions=new Map,Pt.initialized=!1;var pn=Pt,_o=pn;export{Sn as a,vn as b,Nn as c,Dn as d,Bn as e,Mn as f,Un as g,zn as h,Hn as i,Jn as j,Kn as k,Yn as l,Qn as m,eo as n,so as o,ro as p,no as q,lo as r,co as s,uo as t,fo as u,xo as v,wo as w,Po as x,Eo as y,So as z,vo as A,No as B,_s as C,pn as D,_o as E};
|
|
38
|
+
`)}return h?[`await agent.assert(page, ${JSON.stringify(h)}, ${y});`]:["// Skipping verify: missing statement or code"]}},en=vs.object({statement:vs.string().describe('The nature language statement to verify (e.g., "The login was successful")')});function Eo(n,l){n.register({name:"verify",description:"Verify that a statement is true based on the current page state. Use this to check assertions about the page content, element visibility, or any condition.",schema:en,async execute(c,u){let{statement:h}=c,{page:y,agentServices:x}=u;try{let w={action_description:`${h}`,action_data:{action_name:"verify",kwargs:{statement:h}}};return await l.execute(y,w,x),{success:!0,actionEntity:w,message:`Assertion verified: ${h}`}}catch(w){return{success:!1,error:w.message,actionEntity:{action_description:`Verify: ${h} (failed)`,action_data:{action_name:"verify",kwargs:{statement:h}},feedback:w.message}}}},availability:{openai:!0,mcp:!0}})}var tn=class{async execute(n,l,c){let u=l.action_data;if(!u)throw new Error("Action data not found");let h=u.kwargs.element_description,y=u.kwargs.variable_name;if(!h||!y)throw new Error("Missing element_description or variable_name for ai_extract");let x=`Extract ${h} and save to ${y}`,{executeStep:w}=await import("./agentHelpers-ZEELTQHQ-7LTM7RPI.js"),g=await w(x,n,c);if(g.status!=="success")throw new Error(g.error||"Extraction failed")}transpile(n,l){let c=n.action_data?.kwargs?.element_description,u=n.action_data?.kwargs?.variable_name;if(!c||!u)return["// Skipping ai_extract: missing element_description or variable_name"];let h=JSON.stringify(c),y=JSON.stringify(u);return[`await agent.extract(page, ${h}, ${y}, '${l||""}');`]}},sn=yt.object({element_description:yt.string().describe('Description of the element to extract (e.g., "the price of the product")'),variable_name:yt.string().describe("Name of the variable to store the extracted value")});function So(n,l){n.register({name:"ai_extract",description:"Use AI to extract information from the page and save it to a variable. MCP-only tool.",schema:sn,async execute(c,u){let{element_description:h,variable_name:y}=c,{page:x,agentServices:w}=u;try{let g={action_description:`Extract ${h} to ${y}`,action_data:{action_name:"ai_extract",kwargs:{element_description:h,variable_name:y}}};return await l.execute(x,g,w),{success:!0,actionEntity:g,message:`Extracted ${h} to ${y}`}}catch(g){return{success:!1,error:g.message,actionEntity:{action_description:`Extract ${h} (failed)`,action_data:{action_name:"ai_extract",kwargs:{element_description:h,variable_name:y}},feedback:g.message}}}},availability:{openai:!1,mcp:!0}})}j();var rn=class{async execute(n,l,c){let u=V(n,l),h=z(c,l.action_data?.kwargs?.timeout_ms);if(u)await u.click({timeout:h}),await n.keyboard.press("ControlOrMeta+a"),await n.waitForTimeout(200),await n.keyboard.press("Backspace"),await n.waitForTimeout(200);else throw new Error("No locator found for clear_input action")}transpile(n){let l=[];return n.locator?l.push(`locator: ${JSON.stringify(n.locator)}`):n.xpath&&l.push(`xpath: ${JSON.stringify(n.xpath)}`),n.frame_path&&n.frame_path.length>0&&l.push(`frame_path: ${JSON.stringify(n.frame_path)}`),l.length===0?['await agent.execAction("clear_input", page, {});']:['await agent.execAction("clear_input", page, {',...l.map(c=>` ${c},`),"});"]}};async function an(n,l,c,u,h={}){return{...await X(u,c),action_description:l,action_data:{action_name:n,kwargs:{...h}}}}function Is(n,l,c){return{action_description:`${n} (failed - element not found)`,action_data:{action_name:l,kwargs:c},feedback:"Element not found in DOM"}}var nn=xt.object({element_index:xt.number().int().describe("Index of the input element to clear"),timeout_ms:xt.number().optional().describe("Per-action timeout in ms. Overrides the default 5s action timeout.")});function vo(n,l){n.register({name:"clear_input",description:"Clear the contents of an input field, textarea, or other editable element.",schema:nn,usesElementIndex:!0,async execute(c,u){let{element_index:h}=c,{page:y,agentServices:x,actionDescription:w}=u;try{let g=await K(u,h);if(!g)return{success:!1,error:`Input element with index ${h} not found`,actionEntity:Is(w||`Clear element ${h}`,"clear_input",{index:h})};let E=w||`Clear element ${h}`,C=await an("clear_input",E,g,y);return await l.execute(y,C,x),{success:!0,actionEntity:C,message:`Cleared element ${h}`}}catch(g){return{success:!1,error:g.message,actionEntity:Is(`Clear element ${h}`,"clear_input",{index:h})}}}})}j();var wt=class{async execute(n,l,c){let u=V(n,l),h=z(c,l.action_data?.kwargs?.timeout_ms);if(u){await u.click({timeout:h});try{await n.waitForTimeout(1e3)}catch{}}else throw new Error("No locator found for click action")}transpile(n){let l=De(n);if(!l)return['await agent.execAction("click", page, {});'];let c=z();return[`await ${l}.click({ timeout: ${c} });`]}};async function on(n,l,c,u,h={}){return{...await X(u,c),action_description:l,action_data:{action_name:n,kwargs:{...h}}}}function Ns(n,l,c){return{action_description:`${n} (failed - element not found)`,action_data:{action_name:l,kwargs:c},feedback:"Element not found in DOM"}}var ln=gt.object({element_index:gt.number().int().describe("Index of the element to click (0-based). Return -1 if no element found"),timeout_ms:gt.number().optional().describe("Per-action timeout in ms. Overrides the default 5s action timeout.")});function No(n,l){n.register({name:"click",description:"Click an interactive element.",schema:ln,usesElementIndex:!0,async execute(c,u){let{element_index:h}=c,{page:y,agentServices:x,actionDescription:w}=u;try{let g=await K(u,h);if(!g)return{success:!1,error:`Element with index ${h} not found.`,actionEntity:Ns(`Click element ${h}`,"click",{index:h})};let E=w||`Click element ${h}`,C=await on("click",E,g,y);return await l.execute(y,C,x),{success:!0,actionEntity:C,message:`Clicked element ${h}`}}catch(g){return{success:!1,error:g.message,actionEntity:Ns(`Click element ${h}`,"click",{index:h})}}}})}var hn=["ai_action","ai_step","ai_assert","ai_extract","ai_wait_until","verify","assert"],cn=["js_code","function","wait","wait_for_download_complete","wait_for_page_ready","extract_email_content","extract_activation_code"],_s=class{static isAiAction(n){let l=n.action_data?.action_name;return!l||(l==="verify"||l==="ai_assert"||l==="assert")&&n.action_data?.kwargs?.code?!1:hn.includes(l)}static getAiStatement(n){let l=n.action_data?.action_name;if(!l)return null;let c=n.action_data?.kwargs||{};switch(l){case"ai_action":case"ai_step":return c.statement||null;case"verify":case"ai_assert":case"assert":return c.statement||n.action_description||null;case"ai_extract":let u=c.element_description,h=c.variable_name;return u&&h?`Extract ${u} and save to ${h}`:null;case"ai_wait_until":return c.condition||null;default:return null}}static canSelfHeal(n){let l=n.action_data?.action_name;return!l||(l==="verify"||l==="ai_assert"||l==="assert")&&n.action_data?.kwargs?.code?!1:!cn.includes(l)}},Pt=class I{static registerAction(l,c){I.actions.set(l,c)}constructor(){I.initialized||(this.registerBuiltinActions(),I.initialized=!0)}registerBuiltinActions(){I.registerAction("go_to_url",new ws),I.registerAction("go_back",new Ba),I.registerAction("reload_page",new xa),I.registerAction("close_tab",new za),I.registerAction("switch_tab",new ra),I.registerAction("click",new wt),I.registerAction("hover",new As),I.registerAction("right_click",new ds),I.registerAction("double_click",new Cs),I.registerAction("click_by_coordinates",new Hr),I.registerAction("right_click_by_coordinates",new jr),I.registerAction("double_click_by_coordinates",new qr),I.registerAction("drag_drop",new Jr),I.registerAction("input_text",new bs),I.registerAction("clear_input",new rn),I.registerAction("press",new us),I.registerAction("send_keys_on_element",new $r),I.registerAction("scroll_on_element",new Sa),I.registerAction("scroll_to_text",new Ia),I.registerAction("scroll",new Be),I.registerAction("upload_file",new la),I.registerAction("wait_for_download_complete",new da),I.registerAction("get_dropdown_options",new _a),I.registerAction("select_dropdown_option",new Qr),I.registerAction("set_date_for_native_date_picker",new ta),I.registerAction("verify",new ft),I.registerAction("ai_action",new Kr),I.registerAction("ai_extract",new tn),I.registerAction("ai_step",new Xr),I.registerAction("ai_wait_until",new Yr),I.registerAction("generate_2fa_code",new Ka),I.registerAction("wait",new pa),I.registerAction("wait_for_page_ready",new Ur),I.registerAction("save_variable",new Pa),I.registerAction("js_code",new Vr),I.registerAction("js_action",new zr),I.registerAction("function",new Wr),I.registerAction("done",new Ha),I.registerAction("click_element",new wt),I.registerAction("click_element_by_index",new wt),I.registerAction("hover_element_by_index",new As),I.registerAction("right_click_on_element",new ds),I.registerAction("double_click_on_element",new Cs),I.registerAction("scroll_down",new Be),I.registerAction("scroll_up",new Be),I.registerAction("scroll_element",new Be),I.registerAction("send_keys",new us),I.registerAction("open_tab",new ws),I.registerAction("fill",new bs),I.registerAction("ai_assert",new ft),I.registerAction("assert",new ft)}getAction(l){return I.actions.get(l)}hasAction(l){return I.actions.has(l)}getActionNames(){return Array.from(I.actions.keys())}async execute(l,c,u){if(!u)throw new Error("AgentServices not found");let h=c.action_data?.action_name;if(!h)throw new Error("Action name not found in action_data");let y=this.getAction(h);if(!y)throw new Error(`Unknown action: ${h}`);await y.execute(l,c,u)}transpile(l,c,u){let{sanitizeForComment:h}=(j(),at(nt)),y=l.action_description||"",x=l.action_data?.action_name||"",w=this.getAction(x);if(!w)return[`// ${c}: Unknown action: ${x}`];let g=w.transpile(l,c);if(_s.isAiAction(l))return[`// ${c}: ${h(y)}`,"page = agent.agentServices.validatePage(page);",...g];let E=JSON.stringify(y),C=g.map(Y=>` ${Y}`),M=_s.canSelfHeal(l),H=u?`'${u}'`:"undefined";return[`// ${c}: ${h(y)}`,"page = agent.agentServices.validatePage(page);","await agent.step(page, async () => {",...C,`}, ${E}, '${c}', ${H}, ${M});`]}transpileUncachedAction(l,c,u=!1,h=!1,y){let{sanitizeForComment:x}=(j(),at(nt));if(!l)return[`// ${c}: Skipping - no description`];let w=JSON.stringify(l);if(h){let g=y?`, { stmtUid: '${y}' }`:"";return[`// ${c}: ${x(l)}`,"page = agent.agentServices.validatePage(page);",`await agent.run(page, ${w}, '${c}'${g});`]}return[`// ${c}: ${x(l)}`,"page = agent.agentServices.validatePage(page);",`await agent.execute(page, ${w}, '${c}', ${u});`]}};Pt.actions=new Map,Pt.initialized=!1;var pn=Pt,_o=pn;export{Sn as a,vn as b,Nn as c,Dn as d,Bn as e,Mn as f,Un as g,zn as h,Hn as i,Jn as j,Kn as k,Yn as l,Qn as m,eo as n,so as o,ro as p,no as q,lo as r,co as s,uo as t,fo as u,xo as v,wo as w,Po as x,Eo as y,So as z,vo as A,No as B,_s as C,pn as D,_o as E};
|