import { __exports as S } from "../../../../../../../../_virtual/typescript.js";
import { __require as x } from "./utils.js";
import { __require as P } from "./core.js";
import { __require as E } from "../validators/is.js";
var v;
function D() {
  if (v)
    return S;
  v = 1;
  var e = x(), n = P(), m = E();
  const a = (0, e.defineAliasedType)("TypeScript"), t = (0, e.assertValueType)("boolean"), p = {
    returnType: {
      validate: (0, e.assertNodeType)("TSTypeAnnotation", "Noop"),
      optional: !0
    },
    typeParameters: {
      validate: (0, e.assertNodeType)("TSTypeParameterDeclaration", "Noop"),
      optional: !0
    }
  };
  a("TSParameterProperty", {
    aliases: ["LVal"],
    visitor: ["parameter"],
    fields: {
      accessibility: {
        validate: (0, e.assertOneOf)("public", "private", "protected"),
        optional: !0
      },
      readonly: {
        validate: (0, e.assertValueType)("boolean"),
        optional: !0
      },
      parameter: {
        validate: (0, e.assertNodeType)("Identifier", "AssignmentPattern")
      },
      override: {
        validate: (0, e.assertValueType)("boolean"),
        optional: !0
      },
      decorators: {
        validate: (0, e.chain)((0, e.assertValueType)("array"), (0, e.assertEach)((0, e.assertNodeType)("Decorator"))),
        optional: !0
      }
    }
  }), a("TSDeclareFunction", {
    aliases: ["Statement", "Declaration"],
    visitor: ["id", "typeParameters", "params", "returnType"],
    fields: Object.assign({}, n.functionDeclarationCommon, p)
  }), a("TSDeclareMethod", {
    visitor: ["decorators", "key", "typeParameters", "params", "returnType"],
    fields: Object.assign({}, n.classMethodOrDeclareMethodCommon, p)
  }), a("TSQualifiedName", {
    aliases: ["TSEntityName"],
    visitor: ["left", "right"],
    fields: {
      left: (0, e.validateType)("TSEntityName"),
      right: (0, e.validateType)("Identifier")
    }
  });
  const r = {
    typeParameters: (0, e.validateOptionalType)("TSTypeParameterDeclaration"),
    parameters: (0, e.validateArrayOfType)(["Identifier", "RestElement"]),
    typeAnnotation: (0, e.validateOptionalType)("TSTypeAnnotation")
  }, o = {
    aliases: ["TSTypeElement"],
    visitor: ["typeParameters", "parameters", "typeAnnotation"],
    fields: r
  };
  a("TSCallSignatureDeclaration", o), a("TSConstructSignatureDeclaration", o);
  const l = {
    key: (0, e.validateType)("Expression"),
    computed: (0, e.validate)(t),
    optional: (0, e.validateOptional)(t)
  };
  a("TSPropertySignature", {
    aliases: ["TSTypeElement"],
    visitor: ["key", "typeAnnotation", "initializer"],
    fields: Object.assign({}, l, {
      readonly: (0, e.validateOptional)(t),
      typeAnnotation: (0, e.validateOptionalType)("TSTypeAnnotation"),
      initializer: (0, e.validateOptionalType)("Expression"),
      kind: {
        validate: (0, e.assertOneOf)("get", "set")
      }
    })
  }), a("TSMethodSignature", {
    aliases: ["TSTypeElement"],
    visitor: ["key", "typeParameters", "parameters", "typeAnnotation"],
    fields: Object.assign({}, r, l, {
      kind: {
        validate: (0, e.assertOneOf)("method", "get", "set")
      }
    })
  }), a("TSIndexSignature", {
    aliases: ["TSTypeElement"],
    visitor: ["parameters", "typeAnnotation"],
    fields: {
      readonly: (0, e.validateOptional)(t),
      static: (0, e.validateOptional)(t),
      parameters: (0, e.validateArrayOfType)("Identifier"),
      typeAnnotation: (0, e.validateOptionalType)("TSTypeAnnotation")
    }
  });
  const f = ["TSAnyKeyword", "TSBooleanKeyword", "TSBigIntKeyword", "TSIntrinsicKeyword", "TSNeverKeyword", "TSNullKeyword", "TSNumberKeyword", "TSObjectKeyword", "TSStringKeyword", "TSSymbolKeyword", "TSUndefinedKeyword", "TSUnknownKeyword", "TSVoidKeyword"];
  for (const s of f)
    a(s, {
      aliases: ["TSType", "TSBaseType"],
      visitor: [],
      fields: {}
    });
  a("TSThisType", {
    aliases: ["TSType", "TSBaseType"],
    visitor: [],
    fields: {}
  });
  const T = {
    aliases: ["TSType"],
    visitor: ["typeParameters", "parameters", "typeAnnotation"]
  };
  a("TSFunctionType", Object.assign({}, T, {
    fields: r
  })), a("TSConstructorType", Object.assign({}, T, {
    fields: Object.assign({}, r, {
      abstract: (0, e.validateOptional)(t)
    })
  })), a("TSTypeReference", {
    aliases: ["TSType"],
    visitor: ["typeName", "typeParameters"],
    fields: {
      typeName: (0, e.validateType)("TSEntityName"),
      typeParameters: (0, e.validateOptionalType)("TSTypeParameterInstantiation")
    }
  }), a("TSTypePredicate", {
    aliases: ["TSType"],
    visitor: ["parameterName", "typeAnnotation"],
    builder: ["parameterName", "typeAnnotation", "asserts"],
    fields: {
      parameterName: (0, e.validateType)(["Identifier", "TSThisType"]),
      typeAnnotation: (0, e.validateOptionalType)("TSTypeAnnotation"),
      asserts: (0, e.validateOptional)(t)
    }
  }), a("TSTypeQuery", {
    aliases: ["TSType"],
    visitor: ["exprName", "typeParameters"],
    fields: {
      exprName: (0, e.validateType)(["TSEntityName", "TSImportType"]),
      typeParameters: (0, e.validateOptionalType)("TSTypeParameterInstantiation")
    }
  }), a("TSTypeLiteral", {
    aliases: ["TSType"],
    visitor: ["members"],
    fields: {
      members: (0, e.validateArrayOfType)("TSTypeElement")
    }
  }), a("TSArrayType", {
    aliases: ["TSType"],
    visitor: ["elementType"],
    fields: {
      elementType: (0, e.validateType)("TSType")
    }
  }), a("TSTupleType", {
    aliases: ["TSType"],
    visitor: ["elementTypes"],
    fields: {
      elementTypes: (0, e.validateArrayOfType)(["TSType", "TSNamedTupleMember"])
    }
  }), a("TSOptionalType", {
    aliases: ["TSType"],
    visitor: ["typeAnnotation"],
    fields: {
      typeAnnotation: (0, e.validateType)("TSType")
    }
  }), a("TSRestType", {
    aliases: ["TSType"],
    visitor: ["typeAnnotation"],
    fields: {
      typeAnnotation: (0, e.validateType)("TSType")
    }
  }), a("TSNamedTupleMember", {
    visitor: ["label", "elementType"],
    builder: ["label", "elementType", "optional"],
    fields: {
      label: (0, e.validateType)("Identifier"),
      optional: {
        validate: t,
        default: !1
      },
      elementType: (0, e.validateType)("TSType")
    }
  });
  const y = {
    aliases: ["TSType"],
    visitor: ["types"],
    fields: {
      types: (0, e.validateArrayOfType)("TSType")
    }
  };
  return a("TSUnionType", y), a("TSIntersectionType", y), a("TSConditionalType", {
    aliases: ["TSType"],
    visitor: ["checkType", "extendsType", "trueType", "falseType"],
    fields: {
      checkType: (0, e.validateType)("TSType"),
      extendsType: (0, e.validateType)("TSType"),
      trueType: (0, e.validateType)("TSType"),
      falseType: (0, e.validateType)("TSType")
    }
  }), a("TSInferType", {
    aliases: ["TSType"],
    visitor: ["typeParameter"],
    fields: {
      typeParameter: (0, e.validateType)("TSTypeParameter")
    }
  }), a("TSParenthesizedType", {
    aliases: ["TSType"],
    visitor: ["typeAnnotation"],
    fields: {
      typeAnnotation: (0, e.validateType)("TSType")
    }
  }), a("TSTypeOperator", {
    aliases: ["TSType"],
    visitor: ["typeAnnotation"],
    fields: {
      operator: (0, e.validate)((0, e.assertValueType)("string")),
      typeAnnotation: (0, e.validateType)("TSType")
    }
  }), a("TSIndexedAccessType", {
    aliases: ["TSType"],
    visitor: ["objectType", "indexType"],
    fields: {
      objectType: (0, e.validateType)("TSType"),
      indexType: (0, e.validateType)("TSType")
    }
  }), a("TSMappedType", {
    aliases: ["TSType"],
    visitor: ["typeParameter", "typeAnnotation", "nameType"],
    fields: {
      readonly: (0, e.validateOptional)((0, e.assertOneOf)(!0, !1, "+", "-")),
      typeParameter: (0, e.validateType)("TSTypeParameter"),
      optional: (0, e.validateOptional)((0, e.assertOneOf)(!0, !1, "+", "-")),
      typeAnnotation: (0, e.validateOptionalType)("TSType"),
      nameType: (0, e.validateOptionalType)("TSType")
    }
  }), a("TSLiteralType", {
    aliases: ["TSType", "TSBaseType"],
    visitor: ["literal"],
    fields: {
      literal: {
        validate: function() {
          const s = (0, e.assertNodeType)("NumericLiteral", "BigIntLiteral"), c = (0, e.assertOneOf)("-"), u = (0, e.assertNodeType)("NumericLiteral", "StringLiteral", "BooleanLiteral", "BigIntLiteral");
          function d(O, A, i) {
            (0, m.default)("UnaryExpression", i) ? (c(i, "operator", i.operator), s(i, "argument", i.argument)) : u(O, A, i);
          }
          return d.oneOfNodeTypes = ["NumericLiteral", "StringLiteral", "BooleanLiteral", "BigIntLiteral", "UnaryExpression"], d;
        }()
      }
    }
  }), a("TSExpressionWithTypeArguments", {
    aliases: ["TSType"],
    visitor: ["expression", "typeParameters"],
    fields: {
      expression: (0, e.validateType)("TSEntityName"),
      typeParameters: (0, e.validateOptionalType)("TSTypeParameterInstantiation")
    }
  }), a("TSInterfaceDeclaration", {
    aliases: ["Statement", "Declaration"],
    visitor: ["id", "typeParameters", "extends", "body"],
    fields: {
      declare: (0, e.validateOptional)(t),
      id: (0, e.validateType)("Identifier"),
      typeParameters: (0, e.validateOptionalType)("TSTypeParameterDeclaration"),
      extends: (0, e.validateOptional)((0, e.arrayOfType)("TSExpressionWithTypeArguments")),
      body: (0, e.validateType)("TSInterfaceBody")
    }
  }), a("TSInterfaceBody", {
    visitor: ["body"],
    fields: {
      body: (0, e.validateArrayOfType)("TSTypeElement")
    }
  }), a("TSTypeAliasDeclaration", {
    aliases: ["Statement", "Declaration"],
    visitor: ["id", "typeParameters", "typeAnnotation"],
    fields: {
      declare: (0, e.validateOptional)(t),
      id: (0, e.validateType)("Identifier"),
      typeParameters: (0, e.validateOptionalType)("TSTypeParameterDeclaration"),
      typeAnnotation: (0, e.validateType)("TSType")
    }
  }), a("TSInstantiationExpression", {
    aliases: ["Expression"],
    visitor: ["expression", "typeParameters"],
    fields: {
      expression: (0, e.validateType)("Expression"),
      typeParameters: (0, e.validateOptionalType)("TSTypeParameterInstantiation")
    }
  }), a("TSAsExpression", {
    aliases: ["Expression", "LVal", "PatternLike"],
    visitor: ["expression", "typeAnnotation"],
    fields: {
      expression: (0, e.validateType)("Expression"),
      typeAnnotation: (0, e.validateType)("TSType")
    }
  }), a("TSTypeAssertion", {
    aliases: ["Expression", "LVal", "PatternLike"],
    visitor: ["typeAnnotation", "expression"],
    fields: {
      typeAnnotation: (0, e.validateType)("TSType"),
      expression: (0, e.validateType)("Expression")
    }
  }), a("TSEnumDeclaration", {
    aliases: ["Statement", "Declaration"],
    visitor: ["id", "members"],
    fields: {
      declare: (0, e.validateOptional)(t),
      const: (0, e.validateOptional)(t),
      id: (0, e.validateType)("Identifier"),
      members: (0, e.validateArrayOfType)("TSEnumMember"),
      initializer: (0, e.validateOptionalType)("Expression")
    }
  }), a("TSEnumMember", {
    visitor: ["id", "initializer"],
    fields: {
      id: (0, e.validateType)(["Identifier", "StringLiteral"]),
      initializer: (0, e.validateOptionalType)("Expression")
    }
  }), a("TSModuleDeclaration", {
    aliases: ["Statement", "Declaration"],
    visitor: ["id", "body"],
    fields: {
      declare: (0, e.validateOptional)(t),
      global: (0, e.validateOptional)(t),
      id: (0, e.validateType)(["Identifier", "StringLiteral"]),
      body: (0, e.validateType)(["TSModuleBlock", "TSModuleDeclaration"])
    }
  }), a("TSModuleBlock", {
    aliases: ["Scopable", "Block", "BlockParent"],
    visitor: ["body"],
    fields: {
      body: (0, e.validateArrayOfType)("Statement")
    }
  }), a("TSImportType", {
    aliases: ["TSType"],
    visitor: ["argument", "qualifier", "typeParameters"],
    fields: {
      argument: (0, e.validateType)("StringLiteral"),
      qualifier: (0, e.validateOptionalType)("TSEntityName"),
      typeParameters: (0, e.validateOptionalType)("TSTypeParameterInstantiation")
    }
  }), a("TSImportEqualsDeclaration", {
    aliases: ["Statement"],
    visitor: ["id", "moduleReference"],
    fields: {
      isExport: (0, e.validate)(t),
      id: (0, e.validateType)("Identifier"),
      moduleReference: (0, e.validateType)(["TSEntityName", "TSExternalModuleReference"]),
      importKind: {
        validate: (0, e.assertOneOf)("type", "value"),
        optional: !0
      }
    }
  }), a("TSExternalModuleReference", {
    visitor: ["expression"],
    fields: {
      expression: (0, e.validateType)("StringLiteral")
    }
  }), a("TSNonNullExpression", {
    aliases: ["Expression", "LVal", "PatternLike"],
    visitor: ["expression"],
    fields: {
      expression: (0, e.validateType)("Expression")
    }
  }), a("TSExportAssignment", {
    aliases: ["Statement"],
    visitor: ["expression"],
    fields: {
      expression: (0, e.validateType)("Expression")
    }
  }), a("TSNamespaceExportDeclaration", {
    aliases: ["Statement"],
    visitor: ["id"],
    fields: {
      id: (0, e.validateType)("Identifier")
    }
  }), a("TSTypeAnnotation", {
    visitor: ["typeAnnotation"],
    fields: {
      typeAnnotation: {
        validate: (0, e.assertNodeType)("TSType")
      }
    }
  }), a("TSTypeParameterInstantiation", {
    visitor: ["params"],
    fields: {
      params: {
        validate: (0, e.chain)((0, e.assertValueType)("array"), (0, e.assertEach)((0, e.assertNodeType)("TSType")))
      }
    }
  }), a("TSTypeParameterDeclaration", {
    visitor: ["params"],
    fields: {
      params: {
        validate: (0, e.chain)((0, e.assertValueType)("array"), (0, e.assertEach)((0, e.assertNodeType)("TSTypeParameter")))
      }
    }
  }), a("TSTypeParameter", {
    builder: ["constraint", "default", "name"],
    visitor: ["constraint", "default"],
    fields: {
      name: {
        validate: (0, e.assertValueType)("string")
      },
      in: {
        validate: (0, e.assertValueType)("boolean"),
        optional: !0
      },
      out: {
        validate: (0, e.assertValueType)("boolean"),
        optional: !0
      },
      constraint: {
        validate: (0, e.assertNodeType)("TSType"),
        optional: !0
      },
      default: {
        validate: (0, e.assertNodeType)("TSType"),
        optional: !0
      }
    }
  }), S;
}
export {
  D as __require
};
//# sourceMappingURL=typescript.js.map
