From 11cc0972ae09492dcf7d971e2a615f2f79722e47 Mon Sep 17 00:00:00 2001 From: Zach FettersMoore <4425109+BobaFetters@users.noreply.github.com> Date: Wed, 26 Apr 2023 11:42:04 -0400 Subject: [PATCH 1/2] SelectionSet Codegen __typename fix -Adds data to CompilationResult from JS Frontend that includes the defined root types for query, mutation, and subscription -Uses the new root type data to set the `isRootFieldType` field on `GraphQLCompositeType` which is used when determining __typename field generation for selection sets --- .gitignore | 3 ++ .../ApolloCodegenFrontendBundle.swift | 2 +- .../Frontend/CompilationResult.swift | 27 +++++++++++ .../Frontend/GraphQLSchema.swift | 5 +- .../Frontend/JavaScript/src/compiler/index.ts | 10 +++- .../Frontend/JavaScript/src/compiler/ir.ts | 7 +++ .../ApolloCodegenLib/Frontend/auto_rollup.sh | 7 +++ .../SelectionSetTemplateTests.swift | 48 +++++++++++++++++++ 8 files changed, 104 insertions(+), 5 deletions(-) create mode 100644 Sources/ApolloCodegenLib/Frontend/auto_rollup.sh diff --git a/.gitignore b/.gitignore index 4a2ea0f599..257e93a3c8 100644 --- a/.gitignore +++ b/.gitignore @@ -70,3 +70,6 @@ SwiftScripts/.build-** # Local generated packages we don't need in the main project Sources/AnimalKingdomAPI/Generated/Package.swift Sources/AnimalKingdomAPI/Generated/Package.resolved + +# Generated js files we don't need committed +Sources/ApolloCodegenLib/Frontend/dist/ diff --git a/Sources/ApolloCodegenLib/Frontend/ApolloCodegenFrontendBundle.swift b/Sources/ApolloCodegenLib/Frontend/ApolloCodegenFrontendBundle.swift index 54258524cc..92928d0f3a 100644 --- a/Sources/ApolloCodegenLib/Frontend/ApolloCodegenFrontendBundle.swift +++ b/Sources/ApolloCodegenLib/Frontend/ApolloCodegenFrontendBundle.swift @@ -1 +1 @@ -let ApolloCodegenFrontendBundle: String = #"var ApolloCodegenFrontend=function(e){"use strict";function t(e,t){if(!Boolean(e))throw new Error(t)}function n(e){return"object"==typeof e&&null!==e}function i(e,t){if(!Boolean(e))throw new Error(null!=t?t:"Unexpected invariant triggered.")}const r=/\r\n|[\n\r]/g;function o(e,t){let n=0,o=1;for(const s of e.body.matchAll(r)){if("number"==typeof s.index||i(!1),s.index>=t)break;n=s.index+s[0].length,o+=1}return{line:o,column:t+1-n}}function s(e,t){const n=e.locationOffset.column-1,i="".padStart(n)+e.body,r=t.line-1,o=e.locationOffset.line-1,s=t.line+o,c=1===t.line?n:0,u=t.column+c,l=`${e.name}:${s}:${u}\n`,p=i.split(/\r\n|[\n\r]/g),d=p[r];if(d.length>120){const e=Math.floor(u/80),t=u%80,n=[];for(let e=0;e["|",e])),["|","^".padStart(t)],["|",n[e+1]]])}return l+a([[s-1+" |",p[r-1]],[`${s} |`,d],["|","^".padStart(u)],[`${s+1} |`,p[r+1]]])}function a(e){const t=e.filter((([e,t])=>void 0!==t)),n=Math.max(...t.map((([e])=>e.length)));return t.map((([e,t])=>e.padStart(n)+(t?" "+t:""))).join("\n")}class GraphQLError extends Error{constructor(e,...t){var i,r,s;const{nodes:a,source:u,positions:l,path:p,originalError:d,extensions:f}=function(e){const t=e[0];return null==t||"kind"in t||"length"in t?{nodes:t,source:e[1],positions:e[2],path:e[3],originalError:e[4],extensions:e[5]}:t}(t);super(e),this.name="GraphQLError",this.path=null!=p?p:void 0,this.originalError=null!=d?d:void 0,this.nodes=c(Array.isArray(a)?a:a?[a]:void 0);const h=c(null===(i=this.nodes)||void 0===i?void 0:i.map((e=>e.loc)).filter((e=>null!=e)));this.source=null!=u?u:null==h||null===(r=h[0])||void 0===r?void 0:r.source,this.positions=null!=l?l:null==h?void 0:h.map((e=>e.start)),this.locations=l&&u?l.map((e=>o(u,e))):null==h?void 0:h.map((e=>o(e.source,e.start)));const m=n(null==d?void 0:d.extensions)?null==d?void 0:d.extensions:void 0;this.extensions=null!==(s=null!=f?f:m)&&void 0!==s?s:Object.create(null),Object.defineProperties(this,{message:{writable:!0,enumerable:!0},name:{enumerable:!1},nodes:{enumerable:!1},source:{enumerable:!1},positions:{enumerable:!1},originalError:{enumerable:!1}}),null!=d&&d.stack?Object.defineProperty(this,"stack",{value:d.stack,writable:!0,configurable:!0}):Error.captureStackTrace?Error.captureStackTrace(this,GraphQLError):Object.defineProperty(this,"stack",{value:Error().stack,writable:!0,configurable:!0})}get[Symbol.toStringTag](){return"GraphQLError"}toString(){let e=this.message;if(this.nodes)for(const n of this.nodes)n.loc&&(e+="\n\n"+s((t=n.loc).source,o(t.source,t.start)));else if(this.source&&this.locations)for(const t of this.locations)e+="\n\n"+s(this.source,t);var t;return e}toJSON(){const e={message:this.message};return null!=this.locations&&(e.locations=this.locations),null!=this.path&&(e.path=this.path),null!=this.extensions&&Object.keys(this.extensions).length>0&&(e.extensions=this.extensions),e}}function c(e){return void 0===e||0===e.length?void 0:e}function u(e,t,n){return new GraphQLError(`Syntax Error: ${n}`,void 0,e,[t])}class Location{constructor(e,t,n){this.start=e.start,this.end=t.end,this.startToken=e,this.endToken=t,this.source=n}get[Symbol.toStringTag](){return"Location"}toJSON(){return{start:this.start,end:this.end}}}class Token{constructor(e,t,n,i,r,o){this.kind=e,this.start=t,this.end=n,this.line=i,this.column=r,this.value=o,this.prev=null,this.next=null}get[Symbol.toStringTag](){return"Token"}toJSON(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}}}const l={Name:[],Document:["definitions"],OperationDefinition:["name","variableDefinitions","directives","selectionSet"],VariableDefinition:["variable","type","defaultValue","directives"],Variable:["name"],SelectionSet:["selections"],Field:["alias","name","arguments","directives","selectionSet","required"],ListNullability:["element"],RequiredDesignator:["element"],OptionalDesignator:["element"],Argument:["name","value"],FragmentSpread:["name","directives"],InlineFragment:["typeCondition","directives","selectionSet"],FragmentDefinition:["name","variableDefinitions","typeCondition","directives","selectionSet"],IntValue:[],FloatValue:[],StringValue:[],BooleanValue:[],NullValue:[],EnumValue:[],ListValue:["values"],ObjectValue:["fields"],ObjectField:["name","value"],Directive:["name","arguments"],NamedType:["name"],ListType:["type"],NonNullType:["type"],SchemaDefinition:["description","directives","operationTypes"],OperationTypeDefinition:["type"],ScalarTypeDefinition:["description","name","directives"],ObjectTypeDefinition:["description","name","interfaces","directives","fields"],FieldDefinition:["description","name","arguments","type","directives"],InputValueDefinition:["description","name","type","defaultValue","directives"],InterfaceTypeDefinition:["description","name","interfaces","directives","fields"],UnionTypeDefinition:["description","name","directives","types"],EnumTypeDefinition:["description","name","directives","values"],EnumValueDefinition:["description","name","directives"],InputObjectTypeDefinition:["description","name","directives","fields"],DirectiveDefinition:["description","name","arguments","locations"],SchemaExtension:["directives","operationTypes"],ScalarTypeExtension:["name","directives"],ObjectTypeExtension:["name","interfaces","directives","fields"],InterfaceTypeExtension:["name","interfaces","directives","fields"],UnionTypeExtension:["name","directives","types"],EnumTypeExtension:["name","directives","values"],InputObjectTypeExtension:["name","directives","fields"]},p=new Set(Object.keys(l));function d(e){const t=null==e?void 0:e.kind;return"string"==typeof t&&p.has(t)}let f,h,m,v;function y(e){return 9===e||32===e}function E(e){return e>=48&&e<=57}function T(e){return e>=97&&e<=122||e>=65&&e<=90}function N(e){return T(e)||95===e}function I(e){return T(e)||E(e)||95===e}function g(e){var t;let n=Number.MAX_SAFE_INTEGER,i=null,r=-1;for(let t=0;t0===t?e:e.slice(n))).slice(null!==(t=i)&&void 0!==t?t:0,r+1)}function _(e){let t=0;for(;t",e.EOF="",e.BANG="!",e.QUESTION_MARK="?",e.DOLLAR="$",e.AMP="&",e.PAREN_L="(",e.PAREN_R=")",e.SPREAD="...",e.COLON=":",e.EQUALS="=",e.AT="@",e.BRACKET_L="[",e.BRACKET_R="]",e.BRACE_L="{",e.PIPE="|",e.BRACE_R="}",e.NAME="Name",e.INT="Int",e.FLOAT="Float",e.STRING="String",e.BLOCK_STRING="BlockString",e.COMMENT="Comment"}(v||(v={}));class Lexer{constructor(e){const t=new Token(v.SOF,0,0,0,0);this.source=e,this.lastToken=t,this.token=t,this.line=1,this.lineStart=0}get[Symbol.toStringTag](){return"Lexer"}advance(){this.lastToken=this.token;return this.token=this.lookahead()}lookahead(){let e=this.token;if(e.kind!==v.EOF)do{if(e.next)e=e.next;else{const t=k(this,e.end);e.next=t,t.prev=e,e=t}}while(e.kind===v.COMMENT);return e}}function b(e){return e>=0&&e<=55295||e>=57344&&e<=1114111}function L(e,t){return S(e.charCodeAt(t))&&A(e.charCodeAt(t+1))}function S(e){return e>=55296&&e<=56319}function A(e){return e>=56320&&e<=57343}function D(e,t){const n=e.source.body.codePointAt(t);if(void 0===n)return v.EOF;if(n>=32&&n<=126){const e=String.fromCodePoint(n);return'"'===e?"'\"'":`"${e}"`}return"U+"+n.toString(16).toUpperCase().padStart(4,"0")}function w(e,t,n,i,r){const o=e.line,s=1+n-e.lineStart;return new Token(t,n,i,o,s,r)}function k(e,t){const n=e.source.body,i=n.length;let r=t;for(;r=48&&e<=57?e-48:e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:-1}function j(e,t){const n=e.source.body;switch(n.charCodeAt(t+1)){case 34:return{value:'"',size:2};case 92:return{value:"\\",size:2};case 47:return{value:"/",size:2};case 98:return{value:"\b",size:2};case 102:return{value:"\f",size:2};case 110:return{value:"\n",size:2};case 114:return{value:"\r",size:2};case 116:return{value:"\t",size:2}}throw u(e.source,t,`Invalid character escape sequence: "${n.slice(t,t+2)}".`)}function V(e,t){const n=e.source.body,i=n.length;let r=e.lineStart,o=t+3,s=o,a="";const c=[];for(;o2)return"[Array]";const n=Math.min(10,e.length),i=e.length-n,r=[];for(let i=0;i1&&r.push(`... ${i} more items`);return"["+r.join(", ")+"]"}(e,n);return function(e,t){const n=Object.entries(e);if(0===n.length)return"{}";if(t.length>2)return"["+function(e){const t=Object.prototype.toString.call(e).replace(/^\[object /,"").replace(/]$/,"");if("Object"===t&&"function"==typeof e.constructor){const t=e.constructor.name;if("string"==typeof t&&""!==t)return t}return t}(e)+"]";return"{ "+n.map((([e,n])=>e+": "+B(n,t))).join(", ")+" }"}(e,n)}(e,t);default:return String(e)}}const Y=function(e,t){return e instanceof t};class Source{constructor(e,n="GraphQL request",i={line:1,column:1}){"string"==typeof e||t(!1,`Body must be a string. Received: ${P(e)}.`),this.body=e,this.name=n,this.locationOffset=i,this.locationOffset.line>0||t(!1,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||t(!1,"column in locationOffset is 1-indexed and must be positive.")}get[Symbol.toStringTag](){return"Source"}}function J(e,t){return new Parser(e,t).parseDocument()}class Parser{constructor(e,t){const n=function(e){return Y(e,Source)}(e)?e:new Source(e);this._lexer=new Lexer(n),this._options=t}parseName(){const e=this.expectToken(v.NAME);return this.node(e,{kind:m.NAME,value:e.value})}parseDocument(){return this.node(this._lexer.token,{kind:m.DOCUMENT,definitions:this.many(v.SOF,this.parseDefinition,v.EOF)})}parseDefinition(){if(this.peek(v.BRACE_L))return this.parseOperationDefinition();const e=this.peekDescription(),t=e?this._lexer.lookahead():this._lexer.token;if(t.kind===v.NAME){switch(t.value){case"schema":return this.parseSchemaDefinition();case"scalar":return this.parseScalarTypeDefinition();case"type":return this.parseObjectTypeDefinition();case"interface":return this.parseInterfaceTypeDefinition();case"union":return this.parseUnionTypeDefinition();case"enum":return this.parseEnumTypeDefinition();case"input":return this.parseInputObjectTypeDefinition();case"directive":return this.parseDirectiveDefinition()}if(e)throw u(this._lexer.source,this._lexer.token.start,"Unexpected description, descriptions are supported only on type definitions.");switch(t.value){case"query":case"mutation":case"subscription":return this.parseOperationDefinition();case"fragment":return this.parseFragmentDefinition();case"extend":return this.parseTypeSystemExtension()}}throw this.unexpected(t)}parseOperationDefinition(){const e=this._lexer.token;if(this.peek(v.BRACE_L))return this.node(e,{kind:m.OPERATION_DEFINITION,operation:f.QUERY,name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet()});const t=this.parseOperationType();let n;return this.peek(v.NAME)&&(n=this.parseName()),this.node(e,{kind:m.OPERATION_DEFINITION,operation:t,name:n,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseOperationType(){const e=this.expectToken(v.NAME);switch(e.value){case"query":return f.QUERY;case"mutation":return f.MUTATION;case"subscription":return f.SUBSCRIPTION}throw this.unexpected(e)}parseVariableDefinitions(){return this.optionalMany(v.PAREN_L,this.parseVariableDefinition,v.PAREN_R)}parseVariableDefinition(){return this.node(this._lexer.token,{kind:m.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(v.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(v.EQUALS)?this.parseConstValueLiteral():void 0,directives:this.parseConstDirectives()})}parseVariable(){const e=this._lexer.token;return this.expectToken(v.DOLLAR),this.node(e,{kind:m.VARIABLE,name:this.parseName()})}parseSelectionSet(){return this.node(this._lexer.token,{kind:m.SELECTION_SET,selections:this.many(v.BRACE_L,this.parseSelection,v.BRACE_R)})}parseSelection(){return this.peek(v.SPREAD)?this.parseFragment():this.parseField()}parseField(){var e;const t=this._lexer.token,n=this.parseName();let i,r;this.expectOptionalToken(v.COLON)?(i=n,r=this.parseName()):r=n;const o=this.parseArguments(!1),s=null!==(e=this._options)&&void 0!==e&&e.experimentalClientControlledNullability?this.parseRequiredStatus():void 0,a=this.parseDirectives(!1),c=this.peek(v.BRACE_L)?this.parseSelectionSet():void 0;return this.node(t,{kind:m.FIELD,alias:i,name:r,arguments:o,required:s,directives:a,selectionSet:c})}parseRequiredStatus(){const e=this.parseListNullability(),t=this.parseNullabilityDesignatorNode(e);return null!=t?t:e}parseListNullability(){const e=this._lexer.token;if(this.expectOptionalToken(v.BRACKET_L)){const t=this.parseRequiredStatus();return this.expectToken(v.BRACKET_R),this.node(e,{kind:m.LIST_NULLABILITY,element:t})}}parseNullabilityDesignatorNode(e){var t;return null!==(t=this.parseRequiredDesignatorNode(e))&&void 0!==t?t:this.parseOptionalDesignatorNode(e)}parseRequiredDesignatorNode(e){const t=this._lexer.token;if(this.expectOptionalToken(v.BANG))return this.node(t,{kind:m.REQUIRED_DESIGNATOR,element:e})}parseOptionalDesignatorNode(e){const t=this._lexer.token;if(this.expectOptionalToken(v.QUESTION_MARK))return this.node(t,{kind:m.OPTIONAL_DESIGNATOR,element:e})}parseArguments(e){const t=e?this.parseConstArgument:this.parseArgument;return this.optionalMany(v.PAREN_L,t,v.PAREN_R)}parseArgument(e=!1){const t=this._lexer.token,n=this.parseName();return this.expectToken(v.COLON),this.node(t,{kind:m.ARGUMENT,name:n,value:this.parseValueLiteral(e)})}parseConstArgument(){return this.parseArgument(!0)}parseFragment(){const e=this._lexer.token;this.expectToken(v.SPREAD);const t=this.expectOptionalKeyword("on");return!t&&this.peek(v.NAME)?this.node(e,{kind:m.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1)}):this.node(e,{kind:m.INLINE_FRAGMENT,typeCondition:t?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentDefinition(){var e;const t=this._lexer.token;return this.expectKeyword("fragment"),!0===(null===(e=this._options)||void 0===e?void 0:e.allowLegacyFragmentVariables)?this.node(t,{kind:m.FRAGMENT_DEFINITION,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()}):this.node(t,{kind:m.FRAGMENT_DEFINITION,name:this.parseFragmentName(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentName(){if("on"===this._lexer.token.value)throw this.unexpected();return this.parseName()}parseValueLiteral(e){const t=this._lexer.token;switch(t.kind){case v.BRACKET_L:return this.parseList(e);case v.BRACE_L:return this.parseObject(e);case v.INT:return this._lexer.advance(),this.node(t,{kind:m.INT,value:t.value});case v.FLOAT:return this._lexer.advance(),this.node(t,{kind:m.FLOAT,value:t.value});case v.STRING:case v.BLOCK_STRING:return this.parseStringLiteral();case v.NAME:switch(this._lexer.advance(),t.value){case"true":return this.node(t,{kind:m.BOOLEAN,value:!0});case"false":return this.node(t,{kind:m.BOOLEAN,value:!1});case"null":return this.node(t,{kind:m.NULL});default:return this.node(t,{kind:m.ENUM,value:t.value})}case v.DOLLAR:if(e){if(this.expectToken(v.DOLLAR),this._lexer.token.kind===v.NAME){const e=this._lexer.token.value;throw u(this._lexer.source,t.start,`Unexpected variable "$${e}" in constant value.`)}throw this.unexpected(t)}return this.parseVariable();default:throw this.unexpected()}}parseConstValueLiteral(){return this.parseValueLiteral(!0)}parseStringLiteral(){const e=this._lexer.token;return this._lexer.advance(),this.node(e,{kind:m.STRING,value:e.value,block:e.kind===v.BLOCK_STRING})}parseList(e){return this.node(this._lexer.token,{kind:m.LIST,values:this.any(v.BRACKET_L,(()=>this.parseValueLiteral(e)),v.BRACKET_R)})}parseObject(e){return this.node(this._lexer.token,{kind:m.OBJECT,fields:this.any(v.BRACE_L,(()=>this.parseObjectField(e)),v.BRACE_R)})}parseObjectField(e){const t=this._lexer.token,n=this.parseName();return this.expectToken(v.COLON),this.node(t,{kind:m.OBJECT_FIELD,name:n,value:this.parseValueLiteral(e)})}parseDirectives(e){const t=[];for(;this.peek(v.AT);)t.push(this.parseDirective(e));return t}parseConstDirectives(){return this.parseDirectives(!0)}parseDirective(e){const t=this._lexer.token;return this.expectToken(v.AT),this.node(t,{kind:m.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(e)})}parseTypeReference(){const e=this._lexer.token;let t;if(this.expectOptionalToken(v.BRACKET_L)){const n=this.parseTypeReference();this.expectToken(v.BRACKET_R),t=this.node(e,{kind:m.LIST_TYPE,type:n})}else t=this.parseNamedType();return this.expectOptionalToken(v.BANG)?this.node(e,{kind:m.NON_NULL_TYPE,type:t}):t}parseNamedType(){return this.node(this._lexer.token,{kind:m.NAMED_TYPE,name:this.parseName()})}peekDescription(){return this.peek(v.STRING)||this.peek(v.BLOCK_STRING)}parseDescription(){if(this.peekDescription())return this.parseStringLiteral()}parseSchemaDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("schema");const n=this.parseConstDirectives(),i=this.many(v.BRACE_L,this.parseOperationTypeDefinition,v.BRACE_R);return this.node(e,{kind:m.SCHEMA_DEFINITION,description:t,directives:n,operationTypes:i})}parseOperationTypeDefinition(){const e=this._lexer.token,t=this.parseOperationType();this.expectToken(v.COLON);const n=this.parseNamedType();return this.node(e,{kind:m.OPERATION_TYPE_DEFINITION,operation:t,type:n})}parseScalarTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("scalar");const n=this.parseName(),i=this.parseConstDirectives();return this.node(e,{kind:m.SCALAR_TYPE_DEFINITION,description:t,name:n,directives:i})}parseObjectTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("type");const n=this.parseName(),i=this.parseImplementsInterfaces(),r=this.parseConstDirectives(),o=this.parseFieldsDefinition();return this.node(e,{kind:m.OBJECT_TYPE_DEFINITION,description:t,name:n,interfaces:i,directives:r,fields:o})}parseImplementsInterfaces(){return this.expectOptionalKeyword("implements")?this.delimitedMany(v.AMP,this.parseNamedType):[]}parseFieldsDefinition(){return this.optionalMany(v.BRACE_L,this.parseFieldDefinition,v.BRACE_R)}parseFieldDefinition(){const e=this._lexer.token,t=this.parseDescription(),n=this.parseName(),i=this.parseArgumentDefs();this.expectToken(v.COLON);const r=this.parseTypeReference(),o=this.parseConstDirectives();return this.node(e,{kind:m.FIELD_DEFINITION,description:t,name:n,arguments:i,type:r,directives:o})}parseArgumentDefs(){return this.optionalMany(v.PAREN_L,this.parseInputValueDef,v.PAREN_R)}parseInputValueDef(){const e=this._lexer.token,t=this.parseDescription(),n=this.parseName();this.expectToken(v.COLON);const i=this.parseTypeReference();let r;this.expectOptionalToken(v.EQUALS)&&(r=this.parseConstValueLiteral());const o=this.parseConstDirectives();return this.node(e,{kind:m.INPUT_VALUE_DEFINITION,description:t,name:n,type:i,defaultValue:r,directives:o})}parseInterfaceTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("interface");const n=this.parseName(),i=this.parseImplementsInterfaces(),r=this.parseConstDirectives(),o=this.parseFieldsDefinition();return this.node(e,{kind:m.INTERFACE_TYPE_DEFINITION,description:t,name:n,interfaces:i,directives:r,fields:o})}parseUnionTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("union");const n=this.parseName(),i=this.parseConstDirectives(),r=this.parseUnionMemberTypes();return this.node(e,{kind:m.UNION_TYPE_DEFINITION,description:t,name:n,directives:i,types:r})}parseUnionMemberTypes(){return this.expectOptionalToken(v.EQUALS)?this.delimitedMany(v.PIPE,this.parseNamedType):[]}parseEnumTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("enum");const n=this.parseName(),i=this.parseConstDirectives(),r=this.parseEnumValuesDefinition();return this.node(e,{kind:m.ENUM_TYPE_DEFINITION,description:t,name:n,directives:i,values:r})}parseEnumValuesDefinition(){return this.optionalMany(v.BRACE_L,this.parseEnumValueDefinition,v.BRACE_R)}parseEnumValueDefinition(){const e=this._lexer.token,t=this.parseDescription(),n=this.parseEnumValueName(),i=this.parseConstDirectives();return this.node(e,{kind:m.ENUM_VALUE_DEFINITION,description:t,name:n,directives:i})}parseEnumValueName(){if("true"===this._lexer.token.value||"false"===this._lexer.token.value||"null"===this._lexer.token.value)throw u(this._lexer.source,this._lexer.token.start,`${q(this._lexer.token)} is reserved and cannot be used for an enum value.`);return this.parseName()}parseInputObjectTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("input");const n=this.parseName(),i=this.parseConstDirectives(),r=this.parseInputFieldsDefinition();return this.node(e,{kind:m.INPUT_OBJECT_TYPE_DEFINITION,description:t,name:n,directives:i,fields:r})}parseInputFieldsDefinition(){return this.optionalMany(v.BRACE_L,this.parseInputValueDef,v.BRACE_R)}parseTypeSystemExtension(){const e=this._lexer.lookahead();if(e.kind===v.NAME)switch(e.value){case"schema":return this.parseSchemaExtension();case"scalar":return this.parseScalarTypeExtension();case"type":return this.parseObjectTypeExtension();case"interface":return this.parseInterfaceTypeExtension();case"union":return this.parseUnionTypeExtension();case"enum":return this.parseEnumTypeExtension();case"input":return this.parseInputObjectTypeExtension()}throw this.unexpected(e)}parseSchemaExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");const t=this.parseConstDirectives(),n=this.optionalMany(v.BRACE_L,this.parseOperationTypeDefinition,v.BRACE_R);if(0===t.length&&0===n.length)throw this.unexpected();return this.node(e,{kind:m.SCHEMA_EXTENSION,directives:t,operationTypes:n})}parseScalarTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("scalar");const t=this.parseName(),n=this.parseConstDirectives();if(0===n.length)throw this.unexpected();return this.node(e,{kind:m.SCALAR_TYPE_EXTENSION,name:t,directives:n})}parseObjectTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");const t=this.parseName(),n=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),r=this.parseFieldsDefinition();if(0===n.length&&0===i.length&&0===r.length)throw this.unexpected();return this.node(e,{kind:m.OBJECT_TYPE_EXTENSION,name:t,interfaces:n,directives:i,fields:r})}parseInterfaceTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");const t=this.parseName(),n=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),r=this.parseFieldsDefinition();if(0===n.length&&0===i.length&&0===r.length)throw this.unexpected();return this.node(e,{kind:m.INTERFACE_TYPE_EXTENSION,name:t,interfaces:n,directives:i,fields:r})}parseUnionTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");const t=this.parseName(),n=this.parseConstDirectives(),i=this.parseUnionMemberTypes();if(0===n.length&&0===i.length)throw this.unexpected();return this.node(e,{kind:m.UNION_TYPE_EXTENSION,name:t,directives:n,types:i})}parseEnumTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");const t=this.parseName(),n=this.parseConstDirectives(),i=this.parseEnumValuesDefinition();if(0===n.length&&0===i.length)throw this.unexpected();return this.node(e,{kind:m.ENUM_TYPE_EXTENSION,name:t,directives:n,values:i})}parseInputObjectTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");const t=this.parseName(),n=this.parseConstDirectives(),i=this.parseInputFieldsDefinition();if(0===n.length&&0===i.length)throw this.unexpected();return this.node(e,{kind:m.INPUT_OBJECT_TYPE_EXTENSION,name:t,directives:n,fields:i})}parseDirectiveDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("directive"),this.expectToken(v.AT);const n=this.parseName(),i=this.parseArgumentDefs(),r=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");const o=this.parseDirectiveLocations();return this.node(e,{kind:m.DIRECTIVE_DEFINITION,description:t,name:n,arguments:i,repeatable:r,locations:o})}parseDirectiveLocations(){return this.delimitedMany(v.PIPE,this.parseDirectiveLocation)}parseDirectiveLocation(){const e=this._lexer.token,t=this.parseName();if(Object.prototype.hasOwnProperty.call(h,t.value))return t;throw this.unexpected(e)}node(e,t){var n;return!0!==(null===(n=this._options)||void 0===n?void 0:n.noLocation)&&(t.loc=new Location(e,this._lexer.lastToken,this._lexer.source)),t}peek(e){return this._lexer.token.kind===e}expectToken(e){const t=this._lexer.token;if(t.kind===e)return this._lexer.advance(),t;throw u(this._lexer.source,t.start,`Expected ${K(e)}, found ${q(t)}.`)}expectOptionalToken(e){return this._lexer.token.kind===e&&(this._lexer.advance(),!0)}expectKeyword(e){const t=this._lexer.token;if(t.kind!==v.NAME||t.value!==e)throw u(this._lexer.source,t.start,`Expected "${e}", found ${q(t)}.`);this._lexer.advance()}expectOptionalKeyword(e){const t=this._lexer.token;return t.kind===v.NAME&&t.value===e&&(this._lexer.advance(),!0)}unexpected(e){const t=null!=e?e:this._lexer.token;return u(this._lexer.source,t.start,`Unexpected ${q(t)}.`)}any(e,t,n){this.expectToken(e);const i=[];for(;!this.expectOptionalToken(n);)i.push(t.call(this));return i}optionalMany(e,t,n){if(this.expectOptionalToken(e)){const e=[];do{e.push(t.call(this))}while(!this.expectOptionalToken(n));return e}return[]}many(e,t,n){this.expectToken(e);const i=[];do{i.push(t.call(this))}while(!this.expectOptionalToken(n));return i}delimitedMany(e,t){this.expectOptionalToken(e);const n=[];do{n.push(t.call(this))}while(this.expectOptionalToken(e));return n}}function q(e){const t=e.value;return K(e.kind)+(null!=t?` "${t}"`:"")}function K(e){return function(e){return e===v.BANG||e===v.QUESTION_MARK||e===v.DOLLAR||e===v.AMP||e===v.PAREN_L||e===v.PAREN_R||e===v.SPREAD||e===v.COLON||e===v.EQUALS||e===v.AT||e===v.BRACKET_L||e===v.BRACKET_R||e===v.BRACE_L||e===v.PIPE||e===v.BRACE_R}(e)?`"${e}"`:e}function X(e,t){const[n,i]=t?[e,t]:[void 0,e];let r=" Did you mean ";n&&(r+=n+" ");const o=i.map((e=>`"${e}"`));switch(o.length){case 0:return"";case 1:return r+o[0]+"?";case 2:return r+o[0]+" or "+o[1]+"?"}const s=o.slice(0,5),a=s.pop();return r+s.join(", ")+", or "+a+"?"}function z(e){return e}function H(e,t){const n=Object.create(null);for(const i of e)n[t(i)]=i;return n}function W(e,t,n){const i=Object.create(null);for(const r of e)i[t(r)]=n(r);return i}function Z(e,t){const n=Object.create(null);for(const i of Object.keys(e))n[i]=t(e[i],i);return n}function ee(e,t){let n=0,i=0;for(;n0);let a=0;do{++i,a=10*a+o-te,o=t.charCodeAt(i)}while(ne(o)&&a>0);if(sa)return 1}else{if(ro)return 1;++n,++i}}return e.length-t.length}const te=48;function ne(e){return!isNaN(e)&&te<=e&&e<=57}function ie(e,t){const n=Object.create(null),i=new LexicalDistance(e),r=Math.floor(.4*e.length)+1;for(const e of t){const t=i.measure(e,r);void 0!==t&&(n[e]=t)}return Object.keys(n).sort(((e,t)=>{const i=n[e]-n[t];return 0!==i?i:ee(e,t)}))}class LexicalDistance{constructor(e){this._input=e,this._inputLowerCase=e.toLowerCase(),this._inputArray=re(this._inputLowerCase),this._rows=[new Array(e.length+1).fill(0),new Array(e.length+1).fill(0),new Array(e.length+1).fill(0)]}measure(e,t){if(this._input===e)return 0;const n=e.toLowerCase();if(this._inputLowerCase===n)return 1;let i=re(n),r=this._inputArray;if(i.lengtht)return;const a=this._rows;for(let e=0;e<=s;e++)a[0][e]=e;for(let e=1;e<=o;e++){const n=a[(e-1)%3],o=a[e%3];let c=o[0]=e;for(let t=1;t<=s;t++){const s=i[e-1]===r[t-1]?0:1;let u=Math.min(n[t]+1,o[t-1]+1,n[t-1]+s);if(e>1&&t>1&&i[e-1]===r[t-2]&&i[e-2]===r[t-1]){const n=a[(e-2)%3][t-2];u=Math.min(u,n+1)}ut)return}const c=a[o%3][s];return c<=t?c:void 0}}function re(e){const t=e.length,n=new Array(t);for(let i=0;ie.value},Variable:{leave:e=>"$"+e.name},Document:{leave:e=>me(e.definitions,"\n\n")},OperationDefinition:{leave(e){const t=ye("(",me(e.variableDefinitions,", "),")"),n=me([e.operation,me([e.name,t]),me(e.directives," ")]," ");return("query"===n?"":n+" ")+e.selectionSet}},VariableDefinition:{leave:({variable:e,type:t,defaultValue:n,directives:i})=>e+": "+t+ye(" = ",n)+ye(" ",me(i," "))},SelectionSet:{leave:({selections:e})=>ve(e)},Field:{leave({alias:e,name:t,arguments:n,directives:i,selectionSet:r,required:o}){const s=me([ye("",e,": "),t],"");let a=s+ye("(",me(n,", "),")");a.length>80&&(a=s+ye("(\n",Ee(me(n,"\n")),"\n)"));const c=me([a,o],"");return me([c,me(i," "),r]," ")}},RequiredDesignator:{leave:({element:e})=>(null!=e?e:"")+"!"},OptionalDesignator:{leave:({element:e})=>(null!=e?e:"")+"?"},ListNullability:{leave:({element:e})=>"["+(null!=e?e:"")+"]"},Argument:{leave:({name:e,value:t})=>e+": "+t},FragmentSpread:{leave:({name:e,directives:t})=>"..."+e+ye(" ",me(t," "))},InlineFragment:{leave:({typeCondition:e,directives:t,selectionSet:n})=>me(["...",ye("on ",e),me(t," "),n]," ")},FragmentDefinition:{leave:({name:e,typeCondition:t,variableDefinitions:n,directives:i,selectionSet:r})=>`fragment ${e}${ye("(",me(n,", "),")")} on ${t} ${ye("",me(i," ")," ")}`+r},IntValue:{leave:({value:e})=>e},FloatValue:{leave:({value:e})=>e},StringValue:{leave:({value:e,block:t})=>t?function(e,t){const n=e.replace(/"""/g,'\\"""'),i=n.split(/\r\n|[\n\r]/g),r=1===i.length,o=i.length>1&&i.slice(1).every((e=>0===e.length||y(e.charCodeAt(0)))),s=n.endsWith('\\"""'),a=e.endsWith('"')&&!s,c=e.endsWith("\\"),u=a||c,l=!(null!=t&&t.minimize)&&(!r||e.length>70||u||o||s);let p="";const d=r&&y(e.charCodeAt(0));return(l&&!d||o)&&(p+="\n"),p+=n,(l||u)&&(p+="\n"),'"""'+p+'"""'}(e):`"${e.replace(se,ae)}"`},BooleanValue:{leave:({value:e})=>e?"true":"false"},NullValue:{leave:()=>"null"},EnumValue:{leave:({value:e})=>e},ListValue:{leave:({values:e})=>"["+me(e,", ")+"]"},ObjectValue:{leave:({fields:e})=>"{"+me(e,", ")+"}"},ObjectField:{leave:({name:e,value:t})=>e+": "+t},Directive:{leave:({name:e,arguments:t})=>"@"+e+ye("(",me(t,", "),")")},NamedType:{leave:({name:e})=>e},ListType:{leave:({type:e})=>"["+e+"]"},NonNullType:{leave:({type:e})=>e+"!"},SchemaDefinition:{leave:({description:e,directives:t,operationTypes:n})=>ye("",e,"\n")+me(["schema",me(t," "),ve(n)]," ")},OperationTypeDefinition:{leave:({operation:e,type:t})=>e+": "+t},ScalarTypeDefinition:{leave:({description:e,name:t,directives:n})=>ye("",e,"\n")+me(["scalar",t,me(n," ")]," ")},ObjectTypeDefinition:{leave:({description:e,name:t,interfaces:n,directives:i,fields:r})=>ye("",e,"\n")+me(["type",t,ye("implements ",me(n," & ")),me(i," "),ve(r)]," ")},FieldDefinition:{leave:({description:e,name:t,arguments:n,type:i,directives:r})=>ye("",e,"\n")+t+(Te(n)?ye("(\n",Ee(me(n,"\n")),"\n)"):ye("(",me(n,", "),")"))+": "+i+ye(" ",me(r," "))},InputValueDefinition:{leave:({description:e,name:t,type:n,defaultValue:i,directives:r})=>ye("",e,"\n")+me([t+": "+n,ye("= ",i),me(r," ")]," ")},InterfaceTypeDefinition:{leave:({description:e,name:t,interfaces:n,directives:i,fields:r})=>ye("",e,"\n")+me(["interface",t,ye("implements ",me(n," & ")),me(i," "),ve(r)]," ")},UnionTypeDefinition:{leave:({description:e,name:t,directives:n,types:i})=>ye("",e,"\n")+me(["union",t,me(n," "),ye("= ",me(i," | "))]," ")},EnumTypeDefinition:{leave:({description:e,name:t,directives:n,values:i})=>ye("",e,"\n")+me(["enum",t,me(n," "),ve(i)]," ")},EnumValueDefinition:{leave:({description:e,name:t,directives:n})=>ye("",e,"\n")+me([t,me(n," ")]," ")},InputObjectTypeDefinition:{leave:({description:e,name:t,directives:n,fields:i})=>ye("",e,"\n")+me(["input",t,me(n," "),ve(i)]," ")},DirectiveDefinition:{leave:({description:e,name:t,arguments:n,repeatable:i,locations:r})=>ye("",e,"\n")+"directive @"+t+(Te(n)?ye("(\n",Ee(me(n,"\n")),"\n)"):ye("(",me(n,", "),")"))+(i?" repeatable":"")+" on "+me(r," | ")},SchemaExtension:{leave:({directives:e,operationTypes:t})=>me(["extend schema",me(e," "),ve(t)]," ")},ScalarTypeExtension:{leave:({name:e,directives:t})=>me(["extend scalar",e,me(t," ")]," ")},ObjectTypeExtension:{leave:({name:e,interfaces:t,directives:n,fields:i})=>me(["extend type",e,ye("implements ",me(t," & ")),me(n," "),ve(i)]," ")},InterfaceTypeExtension:{leave:({name:e,interfaces:t,directives:n,fields:i})=>me(["extend interface",e,ye("implements ",me(t," & ")),me(n," "),ve(i)]," ")},UnionTypeExtension:{leave:({name:e,directives:t,types:n})=>me(["extend union",e,me(t," "),ye("= ",me(n," | "))]," ")},EnumTypeExtension:{leave:({name:e,directives:t,values:n})=>me(["extend enum",e,me(t," "),ve(n)]," ")},InputObjectTypeExtension:{leave:({name:e,directives:t,fields:n})=>me(["extend input",e,me(t," "),ve(n)]," ")}};function me(e,t=""){var n;return null!==(n=null==e?void 0:e.filter((e=>e)).join(t))&&void 0!==n?n:""}function ve(e){return ye("{\n",Ee(me(e,"\n")),"\n}")}function ye(e,t,n=""){return null!=t&&""!==t?e+t+n:""}function Ee(e){return ye(" ",e.replace(/\n/g,"\n "))}function Te(e){var t;return null!==(t=null==e?void 0:e.some((e=>e.includes("\n"))))&&void 0!==t&&t}function Ne(e,t){switch(e.kind){case m.NULL:return null;case m.INT:return parseInt(e.value,10);case m.FLOAT:return parseFloat(e.value);case m.STRING:case m.ENUM:case m.BOOLEAN:return e.value;case m.LIST:return e.values.map((e=>Ne(e,t)));case m.OBJECT:return W(e.fields,(e=>e.name.value),(e=>Ne(e.value,t)));case m.VARIABLE:return null==t?void 0:t[e.name.value]}}function Ie(e){if(null!=e||t(!1,"Must provide name."),"string"==typeof e||t(!1,"Expected name to be a string."),0===e.length)throw new GraphQLError("Expected name to be a non-empty string.");for(let t=1;ts(Ne(e,t)),this.extensions=oe(e.extensions),this.astNode=e.astNode,this.extensionASTNodes=null!==(o=e.extensionASTNodes)&&void 0!==o?o:[],null==e.specifiedByURL||"string"==typeof e.specifiedByURL||t(!1,`${this.name} must provide "specifiedByURL" as a string, but got: ${P(e.specifiedByURL)}.`),null==e.serialize||"function"==typeof e.serialize||t(!1,`${this.name} must provide "serialize" function. If this custom Scalar is also used as an input type, ensure "parseValue" and "parseLiteral" functions are also provided.`),e.parseLiteral&&("function"==typeof e.parseValue&&"function"==typeof e.parseLiteral||t(!1,`${this.name} must provide both "parseValue" and "parseLiteral" functions.`))}get[Symbol.toStringTag](){return"GraphQLScalarType"}toConfig(){return{name:this.name,description:this.description,specifiedByURL:this.specifiedByURL,serialize:this.serialize,parseValue:this.parseValue,parseLiteral:this.parseLiteral,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}class GraphQLObjectType{constructor(e){var n;this.name=Ie(e.name),this.description=e.description,this.isTypeOf=e.isTypeOf,this.extensions=oe(e.extensions),this.astNode=e.astNode,this.extensionASTNodes=null!==(n=e.extensionASTNodes)&&void 0!==n?n:[],this._fields=()=>Je(e),this._interfaces=()=>Ye(e),null==e.isTypeOf||"function"==typeof e.isTypeOf||t(!1,`${this.name} must provide "isTypeOf" as a function, but got: ${P(e.isTypeOf)}.`)}get[Symbol.toStringTag](){return"GraphQLObjectType"}getFields(){return"function"==typeof this._fields&&(this._fields=this._fields()),this._fields}getInterfaces(){return"function"==typeof this._interfaces&&(this._interfaces=this._interfaces()),this._interfaces}toConfig(){return{name:this.name,description:this.description,interfaces:this.getInterfaces(),fields:Xe(this.getFields()),isTypeOf:this.isTypeOf,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}function Ye(e){var n;const i=Pe(null!==(n=e.interfaces)&&void 0!==n?n:[]);return Array.isArray(i)||t(!1,`${e.name} interfaces must be an Array or a function which returns an Array.`),i}function Je(e){const n=Be(e.fields);return Ke(n)||t(!1,`${e.name} fields must be an object with field names as keys or a function which returns such an object.`),Z(n,((n,i)=>{var r;Ke(n)||t(!1,`${e.name}.${i} field config must be an object.`),null==n.resolve||"function"==typeof n.resolve||t(!1,`${e.name}.${i} field resolver must be a function if provided, but got: ${P(n.resolve)}.`);const o=null!==(r=n.args)&&void 0!==r?r:{};return Ke(o)||t(!1,`${e.name}.${i} args must be an object with argument names as keys.`),{name:Ie(i),description:n.description,type:n.type,args:qe(o),resolve:n.resolve,subscribe:n.subscribe,deprecationReason:n.deprecationReason,extensions:oe(n.extensions),astNode:n.astNode}}))}function qe(e){return Object.entries(e).map((([e,t])=>({name:Ie(e),description:t.description,type:t.type,defaultValue:t.defaultValue,deprecationReason:t.deprecationReason,extensions:oe(t.extensions),astNode:t.astNode})))}function Ke(e){return n(e)&&!Array.isArray(e)}function Xe(e){return Z(e,(e=>({description:e.description,type:e.type,args:ze(e.args),resolve:e.resolve,subscribe:e.subscribe,deprecationReason:e.deprecationReason,extensions:e.extensions,astNode:e.astNode})))}function ze(e){return W(e,(e=>e.name),(e=>({description:e.description,type:e.type,defaultValue:e.defaultValue,deprecationReason:e.deprecationReason,extensions:e.extensions,astNode:e.astNode})))}function He(e){return xe(e.type)&&void 0===e.defaultValue}class GraphQLInterfaceType{constructor(e){var n;this.name=Ie(e.name),this.description=e.description,this.resolveType=e.resolveType,this.extensions=oe(e.extensions),this.astNode=e.astNode,this.extensionASTNodes=null!==(n=e.extensionASTNodes)&&void 0!==n?n:[],this._fields=Je.bind(void 0,e),this._interfaces=Ye.bind(void 0,e),null==e.resolveType||"function"==typeof e.resolveType||t(!1,`${this.name} must provide "resolveType" as a function, but got: ${P(e.resolveType)}.`)}get[Symbol.toStringTag](){return"GraphQLInterfaceType"}getFields(){return"function"==typeof this._fields&&(this._fields=this._fields()),this._fields}getInterfaces(){return"function"==typeof this._interfaces&&(this._interfaces=this._interfaces()),this._interfaces}toConfig(){return{name:this.name,description:this.description,interfaces:this.getInterfaces(),fields:Xe(this.getFields()),resolveType:this.resolveType,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}class GraphQLUnionType{constructor(e){var n;this.name=Ie(e.name),this.description=e.description,this.resolveType=e.resolveType,this.extensions=oe(e.extensions),this.astNode=e.astNode,this.extensionASTNodes=null!==(n=e.extensionASTNodes)&&void 0!==n?n:[],this._types=We.bind(void 0,e),null==e.resolveType||"function"==typeof e.resolveType||t(!1,`${this.name} must provide "resolveType" as a function, but got: ${P(e.resolveType)}.`)}get[Symbol.toStringTag](){return"GraphQLUnionType"}getTypes(){return"function"==typeof this._types&&(this._types=this._types()),this._types}toConfig(){return{name:this.name,description:this.description,types:this.getTypes(),resolveType:this.resolveType,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}function We(e){const n=Pe(e.types);return Array.isArray(n)||t(!1,`Must provide Array of types or a function which returns such an array for Union ${e.name}.`),n}class GraphQLEnumType{constructor(e){var n,i,r;this.name=Ie(e.name),this.description=e.description,this.extensions=oe(e.extensions),this.astNode=e.astNode,this.extensionASTNodes=null!==(n=e.extensionASTNodes)&&void 0!==n?n:[],this._values=(i=this.name,Ke(r=e.values)||t(!1,`${i} values must be an object with value names as keys.`),Object.entries(r).map((([e,n])=>(Ke(n)||t(!1,`${i}.${e} must refer to an object with a "value" key representing an internal value but got: ${P(n)}.`),{name:ge(e),description:n.description,value:void 0!==n.value?n.value:e,deprecationReason:n.deprecationReason,extensions:oe(n.extensions),astNode:n.astNode})))),this._valueLookup=new Map(this._values.map((e=>[e.value,e]))),this._nameLookup=H(this._values,(e=>e.name))}get[Symbol.toStringTag](){return"GraphQLEnumType"}getValues(){return this._values}getValue(e){return this._nameLookup[e]}serialize(e){const t=this._valueLookup.get(e);if(void 0===t)throw new GraphQLError(`Enum "${this.name}" cannot represent value: ${P(e)}`);return t.name}parseValue(e){if("string"!=typeof e){const t=P(e);throw new GraphQLError(`Enum "${this.name}" cannot represent non-string value: ${t}.`+Ze(this,t))}const t=this.getValue(e);if(null==t)throw new GraphQLError(`Value "${e}" does not exist in "${this.name}" enum.`+Ze(this,e));return t.value}parseLiteral(e,t){if(e.kind!==m.ENUM){const t=fe(e);throw new GraphQLError(`Enum "${this.name}" cannot represent non-enum value: ${t}.`+Ze(this,t),e)}const n=this.getValue(e.value);if(null==n){const t=fe(e);throw new GraphQLError(`Value "${t}" does not exist in "${this.name}" enum.`+Ze(this,t),e)}return n.value}toConfig(){const e=W(this.getValues(),(e=>e.name),(e=>({description:e.description,value:e.value,deprecationReason:e.deprecationReason,extensions:e.extensions,astNode:e.astNode})));return{name:this.name,description:this.description,values:e,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}function Ze(e,t){return X("the enum value",ie(t,e.getValues().map((e=>e.name))))}class GraphQLInputObjectType{constructor(e){var t;this.name=Ie(e.name),this.description=e.description,this.extensions=oe(e.extensions),this.astNode=e.astNode,this.extensionASTNodes=null!==(t=e.extensionASTNodes)&&void 0!==t?t:[],this._fields=et.bind(void 0,e)}get[Symbol.toStringTag](){return"GraphQLInputObjectType"}getFields(){return"function"==typeof this._fields&&(this._fields=this._fields()),this._fields}toConfig(){const e=Z(this.getFields(),(e=>({description:e.description,type:e.type,defaultValue:e.defaultValue,deprecationReason:e.deprecationReason,extensions:e.extensions,astNode:e.astNode})));return{name:this.name,description:this.description,fields:e,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}function et(e){const n=Be(e.fields);return Ke(n)||t(!1,`${e.name} fields must be an object with field names as keys or a function which returns such an object.`),Z(n,((n,i)=>(!("resolve"in n)||t(!1,`${e.name}.${i} field has a resolve property, but Input Types cannot define resolvers.`),{name:Ie(i),description:n.description,type:n.type,defaultValue:n.defaultValue,deprecationReason:n.deprecationReason,extensions:oe(n.extensions),astNode:n.astNode})))}function tt(e){return xe(e.type)&&void 0===e.defaultValue}function nt(e,t){return e===t||(xe(e)&&xe(t)||!(!we(e)||!we(t)))&&nt(e.ofType,t.ofType)}function it(e,t,n){return t===n||(xe(n)?!!xe(t)&&it(e,t.ofType,n.ofType):xe(t)?it(e,t.ofType,n):we(n)?!!we(t)&&it(e,t.ofType,n.ofType):!we(t)&&($e(n)&&(Le(t)||be(t))&&e.isSubType(n,t)))}function rt(e,t,n){return t===n||($e(t)?$e(n)?e.getPossibleTypes(t).some((t=>e.isSubType(n,t))):e.isSubType(t,n):!!$e(n)&&e.isSubType(n,t))}const ot=2147483647,st=-2147483648,at=new GraphQLScalarType({name:"Int",description:"The `Int` scalar type represents non-fractional signed whole numeric values. Int can represent values between -(2^31) and 2^31 - 1.",serialize(e){const t=ht(e);if("boolean"==typeof t)return t?1:0;let n=t;if("string"==typeof t&&""!==t&&(n=Number(t)),"number"!=typeof n||!Number.isInteger(n))throw new GraphQLError(`Int cannot represent non-integer value: ${P(t)}`);if(n>ot||not||eot||te.name===t))}function ht(e){if(n(e)){if("function"==typeof e.valueOf){const t=e.valueOf();if(!n(t))return t}if("function"==typeof e.toJSON)return e.toJSON()}return e}function mt(e){return Y(e,GraphQLDirective)}class GraphQLDirective{constructor(e){var i,r;this.name=Ie(e.name),this.description=e.description,this.locations=e.locations,this.isRepeatable=null!==(i=e.isRepeatable)&&void 0!==i&&i,this.extensions=oe(e.extensions),this.astNode=e.astNode,Array.isArray(e.locations)||t(!1,`@${e.name} locations must be an Array.`);const o=null!==(r=e.args)&&void 0!==r?r:{};n(o)&&!Array.isArray(o)||t(!1,`@${e.name} args must be an object with argument names as keys.`),this.args=qe(o)}get[Symbol.toStringTag](){return"GraphQLDirective"}toConfig(){return{name:this.name,description:this.description,locations:this.locations,args:ze(this.args),isRepeatable:this.isRepeatable,extensions:this.extensions,astNode:this.astNode}}toString(){return"@"+this.name}toJSON(){return this.toString()}}const vt=new GraphQLDirective({name:"include",description:"Directs the executor to include this field or fragment only when the `if` argument is true.",locations:[h.FIELD,h.FRAGMENT_SPREAD,h.INLINE_FRAGMENT],args:{if:{type:new GraphQLNonNull(lt),description:"Included when true."}}}),yt=new GraphQLDirective({name:"skip",description:"Directs the executor to skip this field or fragment when the `if` argument is true.",locations:[h.FIELD,h.FRAGMENT_SPREAD,h.INLINE_FRAGMENT],args:{if:{type:new GraphQLNonNull(lt),description:"Skipped when true."}}}),Et="No longer supported",Tt=new GraphQLDirective({name:"deprecated",description:"Marks an element of a GraphQL schema as no longer supported.",locations:[h.FIELD_DEFINITION,h.ARGUMENT_DEFINITION,h.INPUT_FIELD_DEFINITION,h.ENUM_VALUE],args:{reason:{type:ut,description:"Explains why this element was deprecated, usually also including a suggestion for how to access supported similar data. Formatted using the Markdown syntax, as specified by [CommonMark](https://commonmark.org/).",defaultValue:Et}}}),Nt=new GraphQLDirective({name:"specifiedBy",description:"Exposes a URL that specifies the behavior of this scalar.",locations:[h.SCALAR],args:{url:{type:new GraphQLNonNull(ut),description:"The URL that specifies the behavior of this scalar."}}}),It=Object.freeze([vt,yt,Tt,Nt]);function gt(e,t){if(xe(t)){const n=gt(e,t.ofType);return(null==n?void 0:n.kind)===m.NULL?null:n}if(null===e)return{kind:m.NULL};if(void 0===e)return null;if(we(t)){const n=t.ofType;if("object"==typeof(r=e)&&"function"==typeof(null==r?void 0:r[Symbol.iterator])){const t=[];for(const i of e){const e=gt(i,n);null!=e&&t.push(e)}return{kind:m.LIST,values:t}}return gt(e,n)}var r;if(De(t)){if(!n(e))return null;const i=[];for(const n of Object.values(t.getFields())){const t=gt(e[n.name],n.type);t&&i.push({kind:m.OBJECT_FIELD,name:{kind:m.NAME,value:n.name},value:t})}return{kind:m.OBJECT,fields:i}}if(Ce(t)){const n=t.serialize(e);if(null==n)return null;if("boolean"==typeof n)return{kind:m.BOOLEAN,value:n};if("number"==typeof n&&Number.isFinite(n)){const e=String(n);return _t.test(e)?{kind:m.INT,value:e}:{kind:m.FLOAT,value:e}}if("string"==typeof n)return Ae(t)?{kind:m.ENUM,value:n}:t===pt&&_t.test(n)?{kind:m.INT,value:n}:{kind:m.STRING,value:n};throw new TypeError(`Cannot convert value to AST: ${P(n)}.`)}i(!1,"Unexpected input type: "+P(t))}const _t=/^-?(?:0|[1-9][0-9]*)$/,Ot=new GraphQLObjectType({name:"__Schema",description:"A GraphQL Schema defines the capabilities of a GraphQL server. It exposes all available types and directives on the server, as well as the entry points for query, mutation, and subscription operations.",fields:()=>({description:{type:ut,resolve:e=>e.description},types:{description:"A list of all types supported by this server.",type:new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(St))),resolve:e=>Object.values(e.getTypeMap())},queryType:{description:"The type that query operations will be rooted at.",type:new GraphQLNonNull(St),resolve:e=>e.getQueryType()},mutationType:{description:"If this server supports mutation, the type that mutation operations will be rooted at.",type:St,resolve:e=>e.getMutationType()},subscriptionType:{description:"If this server support subscription, the type that subscription operations will be rooted at.",type:St,resolve:e=>e.getSubscriptionType()},directives:{description:"A list of all directives supported by this server.",type:new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(bt))),resolve:e=>e.getDirectives()}})}),bt=new GraphQLObjectType({name:"__Directive",description:"A Directive provides a way to describe alternate runtime execution and type validation behavior in a GraphQL document.\n\nIn some cases, you need to provide options to alter GraphQL's execution behavior in ways field arguments will not suffice, such as conditionally including or skipping a field. Directives provide this by describing additional information to the executor.",fields:()=>({name:{type:new GraphQLNonNull(ut),resolve:e=>e.name},description:{type:ut,resolve:e=>e.description},isRepeatable:{type:new GraphQLNonNull(lt),resolve:e=>e.isRepeatable},locations:{type:new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(Lt))),resolve:e=>e.locations},args:{type:new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(Dt))),args:{includeDeprecated:{type:lt,defaultValue:!1}},resolve:(e,{includeDeprecated:t})=>t?e.args:e.args.filter((e=>null==e.deprecationReason))}})}),Lt=new GraphQLEnumType({name:"__DirectiveLocation",description:"A Directive can be adjacent to many parts of the GraphQL language, a __DirectiveLocation describes one such possible adjacencies.",values:{QUERY:{value:h.QUERY,description:"Location adjacent to a query operation."},MUTATION:{value:h.MUTATION,description:"Location adjacent to a mutation operation."},SUBSCRIPTION:{value:h.SUBSCRIPTION,description:"Location adjacent to a subscription operation."},FIELD:{value:h.FIELD,description:"Location adjacent to a field."},FRAGMENT_DEFINITION:{value:h.FRAGMENT_DEFINITION,description:"Location adjacent to a fragment definition."},FRAGMENT_SPREAD:{value:h.FRAGMENT_SPREAD,description:"Location adjacent to a fragment spread."},INLINE_FRAGMENT:{value:h.INLINE_FRAGMENT,description:"Location adjacent to an inline fragment."},VARIABLE_DEFINITION:{value:h.VARIABLE_DEFINITION,description:"Location adjacent to a variable definition."},SCHEMA:{value:h.SCHEMA,description:"Location adjacent to a schema definition."},SCALAR:{value:h.SCALAR,description:"Location adjacent to a scalar definition."},OBJECT:{value:h.OBJECT,description:"Location adjacent to an object type definition."},FIELD_DEFINITION:{value:h.FIELD_DEFINITION,description:"Location adjacent to a field definition."},ARGUMENT_DEFINITION:{value:h.ARGUMENT_DEFINITION,description:"Location adjacent to an argument definition."},INTERFACE:{value:h.INTERFACE,description:"Location adjacent to an interface definition."},UNION:{value:h.UNION,description:"Location adjacent to a union definition."},ENUM:{value:h.ENUM,description:"Location adjacent to an enum definition."},ENUM_VALUE:{value:h.ENUM_VALUE,description:"Location adjacent to an enum value definition."},INPUT_OBJECT:{value:h.INPUT_OBJECT,description:"Location adjacent to an input object type definition."},INPUT_FIELD_DEFINITION:{value:h.INPUT_FIELD_DEFINITION,description:"Location adjacent to an input object field definition."}}}),St=new GraphQLObjectType({name:"__Type",description:"The fundamental unit of any GraphQL Schema is the type. There are many kinds of types in GraphQL as represented by the `__TypeKind` enum.\n\nDepending on the kind of a type, certain fields describe information about that type. Scalar types provide no information beyond a name, description and optional `specifiedByURL`, while Enum types provide their values. Object and Interface types provide the fields they describe. Abstract types, Union and Interface, provide the Object types possible at runtime. List and NonNull types compose other types.",fields:()=>({kind:{type:new GraphQLNonNull(xt),resolve:e=>Oe(e)?kt.SCALAR:be(e)?kt.OBJECT:Le(e)?kt.INTERFACE:Se(e)?kt.UNION:Ae(e)?kt.ENUM:De(e)?kt.INPUT_OBJECT:we(e)?kt.LIST:xe(e)?kt.NON_NULL:void i(!1,`Unexpected type: "${P(e)}".`)},name:{type:ut,resolve:e=>"name"in e?e.name:void 0},description:{type:ut,resolve:e=>"description"in e?e.description:void 0},specifiedByURL:{type:ut,resolve:e=>"specifiedByURL"in e?e.specifiedByURL:void 0},fields:{type:new GraphQLList(new GraphQLNonNull(At)),args:{includeDeprecated:{type:lt,defaultValue:!1}},resolve(e,{includeDeprecated:t}){if(be(e)||Le(e)){const n=Object.values(e.getFields());return t?n:n.filter((e=>null==e.deprecationReason))}}},interfaces:{type:new GraphQLList(new GraphQLNonNull(St)),resolve(e){if(be(e)||Le(e))return e.getInterfaces()}},possibleTypes:{type:new GraphQLList(new GraphQLNonNull(St)),resolve(e,t,n,{schema:i}){if($e(e))return i.getPossibleTypes(e)}},enumValues:{type:new GraphQLList(new GraphQLNonNull(wt)),args:{includeDeprecated:{type:lt,defaultValue:!1}},resolve(e,{includeDeprecated:t}){if(Ae(e)){const n=e.getValues();return t?n:n.filter((e=>null==e.deprecationReason))}}},inputFields:{type:new GraphQLList(new GraphQLNonNull(Dt)),args:{includeDeprecated:{type:lt,defaultValue:!1}},resolve(e,{includeDeprecated:t}){if(De(e)){const n=Object.values(e.getFields());return t?n:n.filter((e=>null==e.deprecationReason))}}},ofType:{type:St,resolve:e=>"ofType"in e?e.ofType:void 0}})}),At=new GraphQLObjectType({name:"__Field",description:"Object and Interface types are described by a list of Fields, each of which has a name, potentially a list of arguments, and a return type.",fields:()=>({name:{type:new GraphQLNonNull(ut),resolve:e=>e.name},description:{type:ut,resolve:e=>e.description},args:{type:new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(Dt))),args:{includeDeprecated:{type:lt,defaultValue:!1}},resolve:(e,{includeDeprecated:t})=>t?e.args:e.args.filter((e=>null==e.deprecationReason))},type:{type:new GraphQLNonNull(St),resolve:e=>e.type},isDeprecated:{type:new GraphQLNonNull(lt),resolve:e=>null!=e.deprecationReason},deprecationReason:{type:ut,resolve:e=>e.deprecationReason}})}),Dt=new GraphQLObjectType({name:"__InputValue",description:"Arguments provided to Fields or Directives and the input fields of an InputObject are represented as Input Values which describe their type and optionally a default value.",fields:()=>({name:{type:new GraphQLNonNull(ut),resolve:e=>e.name},description:{type:ut,resolve:e=>e.description},type:{type:new GraphQLNonNull(St),resolve:e=>e.type},defaultValue:{type:ut,description:"A GraphQL-formatted string representing the default value for this input value.",resolve(e){const{type:t,defaultValue:n}=e,i=gt(n,t);return i?fe(i):null}},isDeprecated:{type:new GraphQLNonNull(lt),resolve:e=>null!=e.deprecationReason},deprecationReason:{type:ut,resolve:e=>e.deprecationReason}})}),wt=new GraphQLObjectType({name:"__EnumValue",description:"One possible value for a given Enum. Enum values are unique values, not a placeholder for a string or numeric value. However an Enum value is returned in a JSON response as a string.",fields:()=>({name:{type:new GraphQLNonNull(ut),resolve:e=>e.name},description:{type:ut,resolve:e=>e.description},isDeprecated:{type:new GraphQLNonNull(lt),resolve:e=>null!=e.deprecationReason},deprecationReason:{type:ut,resolve:e=>e.deprecationReason}})});let kt;!function(e){e.SCALAR="SCALAR",e.OBJECT="OBJECT",e.INTERFACE="INTERFACE",e.UNION="UNION",e.ENUM="ENUM",e.INPUT_OBJECT="INPUT_OBJECT",e.LIST="LIST",e.NON_NULL="NON_NULL"}(kt||(kt={}));const xt=new GraphQLEnumType({name:"__TypeKind",description:"An enum describing what kind of type a given `__Type` is.",values:{SCALAR:{value:kt.SCALAR,description:"Indicates this type is a scalar."},OBJECT:{value:kt.OBJECT,description:"Indicates this type is an object. `fields` and `interfaces` are valid fields."},INTERFACE:{value:kt.INTERFACE,description:"Indicates this type is an interface. `fields`, `interfaces`, and `possibleTypes` are valid fields."},UNION:{value:kt.UNION,description:"Indicates this type is a union. `possibleTypes` is a valid field."},ENUM:{value:kt.ENUM,description:"Indicates this type is an enum. `enumValues` is a valid field."},INPUT_OBJECT:{value:kt.INPUT_OBJECT,description:"Indicates this type is an input object. `inputFields` is a valid field."},LIST:{value:kt.LIST,description:"Indicates this type is a list. `ofType` is a valid field."},NON_NULL:{value:kt.NON_NULL,description:"Indicates this type is a non-null. `ofType` is a valid field."}}}),Ft={name:"__schema",type:new GraphQLNonNull(Ot),description:"Access the current type schema of this server.",args:[],resolve:(e,t,n,{schema:i})=>i,deprecationReason:void 0,extensions:Object.create(null),astNode:void 0},Rt={name:"__type",type:St,description:"Request the type information of a single type.",args:[{name:"name",description:void 0,type:new GraphQLNonNull(ut),defaultValue:void 0,deprecationReason:void 0,extensions:Object.create(null),astNode:void 0}],resolve:(e,{name:t},n,{schema:i})=>i.getType(t),deprecationReason:void 0,extensions:Object.create(null),astNode:void 0},Ct={name:"__typename",type:new GraphQLNonNull(ut),description:"The name of the current Object type at runtime.",args:[],resolve:(e,t,n,{parentType:i})=>i.name,deprecationReason:void 0,extensions:Object.create(null),astNode:void 0},Gt=Object.freeze([Ot,bt,Lt,St,At,Dt,wt,xt]);function $t(e){return Gt.some((({name:t})=>e.name===t))}function Qt(e){if(!function(e){return Y(e,GraphQLSchema)}(e))throw new Error(`Expected ${P(e)} to be a GraphQL schema.`);return e}class GraphQLSchema{constructor(e){var i,r;this.__validationErrors=!0===e.assumeValid?[]:void 0,n(e)||t(!1,"Must provide configuration object."),!e.types||Array.isArray(e.types)||t(!1,`"types" must be Array if provided but got: ${P(e.types)}.`),!e.directives||Array.isArray(e.directives)||t(!1,`"directives" must be Array if provided but got: ${P(e.directives)}.`),this.description=e.description,this.extensions=oe(e.extensions),this.astNode=e.astNode,this.extensionASTNodes=null!==(i=e.extensionASTNodes)&&void 0!==i?i:[],this._queryType=e.query,this._mutationType=e.mutation,this._subscriptionType=e.subscription,this._directives=null!==(r=e.directives)&&void 0!==r?r:It;const o=new Set(e.types);if(null!=e.types)for(const t of e.types)o.delete(t),Ut(t,o);null!=this._queryType&&Ut(this._queryType,o),null!=this._mutationType&&Ut(this._mutationType,o),null!=this._subscriptionType&&Ut(this._subscriptionType,o);for(const e of this._directives)if(mt(e))for(const t of e.args)Ut(t.type,o);Ut(Ot,o),this._typeMap=Object.create(null),this._subTypeMap=Object.create(null),this._implementationsMap=Object.create(null);for(const e of o){if(null==e)continue;const n=e.name;if(n||t(!1,"One of the provided types for building the Schema is missing a name."),void 0!==this._typeMap[n])throw new Error(`Schema must contain uniquely named types but contains multiple types named "${n}".`);if(this._typeMap[n]=e,Le(e)){for(const t of e.getInterfaces())if(Le(t)){let n=this._implementationsMap[t.name];void 0===n&&(n=this._implementationsMap[t.name]={objects:[],interfaces:[]}),n.interfaces.push(e)}}else if(be(e))for(const t of e.getInterfaces())if(Le(t)){let n=this._implementationsMap[t.name];void 0===n&&(n=this._implementationsMap[t.name]={objects:[],interfaces:[]}),n.objects.push(e)}}}get[Symbol.toStringTag](){return"GraphQLSchema"}getQueryType(){return this._queryType}getMutationType(){return this._mutationType}getSubscriptionType(){return this._subscriptionType}getRootType(e){switch(e){case f.QUERY:return this.getQueryType();case f.MUTATION:return this.getMutationType();case f.SUBSCRIPTION:return this.getSubscriptionType()}}getTypeMap(){return this._typeMap}getType(e){return this.getTypeMap()[e]}getPossibleTypes(e){return Se(e)?e.getTypes():this.getImplementations(e).objects}getImplementations(e){const t=this._implementationsMap[e.name];return null!=t?t:{objects:[],interfaces:[]}}isSubType(e,t){let n=this._subTypeMap[e.name];if(void 0===n){if(n=Object.create(null),Se(e))for(const t of e.getTypes())n[t.name]=!0;else{const t=this.getImplementations(e);for(const e of t.objects)n[e.name]=!0;for(const e of t.interfaces)n[e.name]=!0}this._subTypeMap[e.name]=n}return void 0!==n[t.name]}getDirectives(){return this._directives}getDirective(e){return this.getDirectives().find((t=>t.name===e))}toConfig(){return{description:this.description,query:this.getQueryType(),mutation:this.getMutationType(),subscription:this.getSubscriptionType(),types:Object.values(this.getTypeMap()),directives:this.getDirectives(),extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes,assumeValid:void 0!==this.__validationErrors}}}function Ut(e,t){const n=Me(e);if(!t.has(n))if(t.add(n),Se(n))for(const e of n.getTypes())Ut(e,t);else if(be(n)||Le(n)){for(const e of n.getInterfaces())Ut(e,t);for(const e of Object.values(n.getFields())){Ut(e.type,t);for(const n of e.args)Ut(n.type,t)}}else if(De(n))for(const e of Object.values(n.getFields()))Ut(e.type,t);return t}function jt(e){if(Qt(e),e.__validationErrors)return e.__validationErrors;const t=new SchemaValidationContext(e);!function(e){const t=e.schema,n=t.getQueryType();if(n){if(!be(n)){var i;e.reportError(`Query root type must be Object type, it cannot be ${P(n)}.`,null!==(i=Vt(t,f.QUERY))&&void 0!==i?i:n.astNode)}}else e.reportError("Query root type must be provided.",t.astNode);const r=t.getMutationType();var o;r&&!be(r)&&e.reportError(`Mutation root type must be Object type if provided, it cannot be ${P(r)}.`,null!==(o=Vt(t,f.MUTATION))&&void 0!==o?o:r.astNode);const s=t.getSubscriptionType();var a;s&&!be(s)&&e.reportError(`Subscription root type must be Object type if provided, it cannot be ${P(s)}.`,null!==(a=Vt(t,f.SUBSCRIPTION))&&void 0!==a?a:s.astNode)}(t),function(e){for(const n of e.schema.getDirectives())if(mt(n)){Mt(e,n);for(const i of n.args){var t;if(Mt(e,i),Fe(i.type)||e.reportError(`The type of @${n.name}(${i.name}:) must be Input Type but got: ${P(i.type)}.`,i.astNode),He(i)&&null!=i.deprecationReason)e.reportError(`Required argument @${n.name}(${i.name}:) cannot be deprecated.`,[Wt(i.astNode),null===(t=i.astNode)||void 0===t?void 0:t.type])}}else e.reportError(`Expected directive but got: ${P(n)}.`,null==n?void 0:n.astNode)}(t),function(e){const t=function(e){const t=Object.create(null),n=[],i=Object.create(null);return r;function r(o){if(t[o.name])return;t[o.name]=!0,i[o.name]=n.length;const s=Object.values(o.getFields());for(const t of s)if(xe(t.type)&&De(t.type.ofType)){const o=t.type.ofType,s=i[o.name];if(n.push(t),void 0===s)r(o);else{const t=n.slice(s),i=t.map((e=>e.name)).join(".");e.reportError(`Cannot reference Input Object "${o.name}" within itself through a series of non-null fields: "${i}".`,t.map((e=>e.astNode)))}n.pop()}i[o.name]=void 0}}(e),n=e.schema.getTypeMap();for(const i of Object.values(n))Ve(i)?($t(i)||Mt(e,i),be(i)||Le(i)?(Pt(e,i),Bt(e,i)):Se(i)?qt(e,i):Ae(i)?Kt(e,i):De(i)&&(Xt(e,i),t(i))):e.reportError(`Expected GraphQL named type but got: ${P(i)}.`,i.astNode)}(t);const n=t.getErrors();return e.__validationErrors=n,n}class SchemaValidationContext{constructor(e){this._errors=[],this.schema=e}reportError(e,t){const n=Array.isArray(t)?t.filter(Boolean):t;this._errors.push(new GraphQLError(e,n))}getErrors(){return this._errors}}function Vt(e,t){var n;return null===(n=[e.astNode,...e.extensionASTNodes].flatMap((e=>{var t;return null!==(t=null==e?void 0:e.operationTypes)&&void 0!==t?t:[]})).find((e=>e.operation===t)))||void 0===n?void 0:n.type}function Mt(e,t){t.name.startsWith("__")&&e.reportError(`Name "${t.name}" must not begin with "__", which is reserved by GraphQL introspection.`,t.astNode)}function Pt(e,t){const n=Object.values(t.getFields());0===n.length&&e.reportError(`Type ${t.name} must define one or more fields.`,[t.astNode,...t.extensionASTNodes]);for(const s of n){var i;if(Mt(e,s),!Re(s.type))e.reportError(`The type of ${t.name}.${s.name} must be Output Type but got: ${P(s.type)}.`,null===(i=s.astNode)||void 0===i?void 0:i.type);for(const n of s.args){const i=n.name;var r,o;if(Mt(e,n),!Fe(n.type))e.reportError(`The type of ${t.name}.${s.name}(${i}:) must be Input Type but got: ${P(n.type)}.`,null===(r=n.astNode)||void 0===r?void 0:r.type);if(He(n)&&null!=n.deprecationReason)e.reportError(`Required argument ${t.name}.${s.name}(${i}:) cannot be deprecated.`,[Wt(n.astNode),null===(o=n.astNode)||void 0===o?void 0:o.type])}}}function Bt(e,t){const n=Object.create(null);for(const i of t.getInterfaces())Le(i)?t!==i?n[i.name]?e.reportError(`Type ${t.name} can only implement ${i.name} once.`,zt(t,i)):(n[i.name]=!0,Jt(e,t,i),Yt(e,t,i)):e.reportError(`Type ${t.name} cannot implement itself because it would create a circular reference.`,zt(t,i)):e.reportError(`Type ${P(t)} must only implement Interface types, it cannot implement ${P(i)}.`,zt(t,i))}function Yt(e,t,n){const i=t.getFields();for(const c of Object.values(n.getFields())){const u=c.name,l=i[u];if(l){var r,o;if(!it(e.schema,l.type,c.type))e.reportError(`Interface field ${n.name}.${u} expects type ${P(c.type)} but ${t.name}.${u} is type ${P(l.type)}.`,[null===(r=c.astNode)||void 0===r?void 0:r.type,null===(o=l.astNode)||void 0===o?void 0:o.type]);for(const i of c.args){const r=i.name,o=l.args.find((e=>e.name===r));var s,a;if(o){if(!nt(i.type,o.type))e.reportError(`Interface field argument ${n.name}.${u}(${r}:) expects type ${P(i.type)} but ${t.name}.${u}(${r}:) is type ${P(o.type)}.`,[null===(s=i.astNode)||void 0===s?void 0:s.type,null===(a=o.astNode)||void 0===a?void 0:a.type])}else e.reportError(`Interface field argument ${n.name}.${u}(${r}:) expected but ${t.name}.${u} does not provide it.`,[i.astNode,l.astNode])}for(const i of l.args){const r=i.name;!c.args.find((e=>e.name===r))&&He(i)&&e.reportError(`Object field ${t.name}.${u} includes required argument ${r} that is missing from the Interface field ${n.name}.${u}.`,[i.astNode,c.astNode])}}else e.reportError(`Interface field ${n.name}.${u} expected but ${t.name} does not provide it.`,[c.astNode,t.astNode,...t.extensionASTNodes])}}function Jt(e,t,n){const i=t.getInterfaces();for(const r of n.getInterfaces())i.includes(r)||e.reportError(r===t?`Type ${t.name} cannot implement ${n.name} because it would create a circular reference.`:`Type ${t.name} must implement ${r.name} because it is implemented by ${n.name}.`,[...zt(n,r),...zt(t,n)])}function qt(e,t){const n=t.getTypes();0===n.length&&e.reportError(`Union type ${t.name} must define one or more member types.`,[t.astNode,...t.extensionASTNodes]);const i=Object.create(null);for(const r of n)i[r.name]?e.reportError(`Union type ${t.name} can only include type ${r.name} once.`,Ht(t,r.name)):(i[r.name]=!0,be(r)||e.reportError(`Union type ${t.name} can only include Object types, it cannot include ${P(r)}.`,Ht(t,String(r))))}function Kt(e,t){const n=t.getValues();0===n.length&&e.reportError(`Enum type ${t.name} must define one or more values.`,[t.astNode,...t.extensionASTNodes]);for(const t of n)Mt(e,t)}function Xt(e,t){const n=Object.values(t.getFields());0===n.length&&e.reportError(`Input Object type ${t.name} must define one or more fields.`,[t.astNode,...t.extensionASTNodes]);for(const o of n){var i,r;if(Mt(e,o),!Fe(o.type))e.reportError(`The type of ${t.name}.${o.name} must be Input Type but got: ${P(o.type)}.`,null===(i=o.astNode)||void 0===i?void 0:i.type);if(tt(o)&&null!=o.deprecationReason)e.reportError(`Required input field ${t.name}.${o.name} cannot be deprecated.`,[Wt(o.astNode),null===(r=o.astNode)||void 0===r?void 0:r.type])}}function zt(e,t){const{astNode:n,extensionASTNodes:i}=e;return(null!=n?[n,...i]:i).flatMap((e=>{var t;return null!==(t=e.interfaces)&&void 0!==t?t:[]})).filter((e=>e.name.value===t.name))}function Ht(e,t){const{astNode:n,extensionASTNodes:i}=e;return(null!=n?[n,...i]:i).flatMap((e=>{var t;return null!==(t=e.types)&&void 0!==t?t:[]})).filter((e=>e.name.value===t))}function Wt(e){var t;return null==e||null===(t=e.directives)||void 0===t?void 0:t.find((e=>e.name.value===Tt.name))}function Zt(e,t){switch(t.kind){case m.LIST_TYPE:{const n=Zt(e,t.type);return n&&new GraphQLList(n)}case m.NON_NULL_TYPE:{const n=Zt(e,t.type);return n&&new GraphQLNonNull(n)}case m.NAMED_TYPE:return e.getType(t.name.value)}}class TypeInfo{constructor(e,t,n){this._schema=e,this._typeStack=[],this._parentTypeStack=[],this._inputTypeStack=[],this._fieldDefStack=[],this._defaultValueStack=[],this._directive=null,this._argument=null,this._enumValue=null,this._getFieldDef=null!=n?n:en,t&&(Fe(t)&&this._inputTypeStack.push(t),Ge(t)&&this._parentTypeStack.push(t),Re(t)&&this._typeStack.push(t))}get[Symbol.toStringTag](){return"TypeInfo"}getType(){if(this._typeStack.length>0)return this._typeStack[this._typeStack.length-1]}getParentType(){if(this._parentTypeStack.length>0)return this._parentTypeStack[this._parentTypeStack.length-1]}getInputType(){if(this._inputTypeStack.length>0)return this._inputTypeStack[this._inputTypeStack.length-1]}getParentInputType(){if(this._inputTypeStack.length>1)return this._inputTypeStack[this._inputTypeStack.length-2]}getFieldDef(){if(this._fieldDefStack.length>0)return this._fieldDefStack[this._fieldDefStack.length-1]}getDefaultValue(){if(this._defaultValueStack.length>0)return this._defaultValueStack[this._defaultValueStack.length-1]}getDirective(){return this._directive}getArgument(){return this._argument}getEnumValue(){return this._enumValue}enter(e){const t=this._schema;switch(e.kind){case m.SELECTION_SET:{const e=Me(this.getType());this._parentTypeStack.push(Ge(e)?e:void 0);break}case m.FIELD:{const n=this.getParentType();let i,r;n&&(i=this._getFieldDef(t,n,e),i&&(r=i.type)),this._fieldDefStack.push(i),this._typeStack.push(Re(r)?r:void 0);break}case m.DIRECTIVE:this._directive=t.getDirective(e.name.value);break;case m.OPERATION_DEFINITION:{const n=t.getRootType(e.operation);this._typeStack.push(be(n)?n:void 0);break}case m.INLINE_FRAGMENT:case m.FRAGMENT_DEFINITION:{const n=e.typeCondition,i=n?Zt(t,n):Me(this.getType());this._typeStack.push(Re(i)?i:void 0);break}case m.VARIABLE_DEFINITION:{const n=Zt(t,e.type);this._inputTypeStack.push(Fe(n)?n:void 0);break}case m.ARGUMENT:{var n;let t,i;const r=null!==(n=this.getDirective())&&void 0!==n?n:this.getFieldDef();r&&(t=r.args.find((t=>t.name===e.name.value)),t&&(i=t.type)),this._argument=t,this._defaultValueStack.push(t?t.defaultValue:void 0),this._inputTypeStack.push(Fe(i)?i:void 0);break}case m.LIST:{const e=je(this.getInputType()),t=we(e)?e.ofType:e;this._defaultValueStack.push(void 0),this._inputTypeStack.push(Fe(t)?t:void 0);break}case m.OBJECT_FIELD:{const t=Me(this.getInputType());let n,i;De(t)&&(i=t.getFields()[e.name.value],i&&(n=i.type)),this._defaultValueStack.push(i?i.defaultValue:void 0),this._inputTypeStack.push(Fe(n)?n:void 0);break}case m.ENUM:{const t=Me(this.getInputType());let n;Ae(t)&&(n=t.getValue(e.value)),this._enumValue=n;break}}}leave(e){switch(e.kind){case m.SELECTION_SET:this._parentTypeStack.pop();break;case m.FIELD:this._fieldDefStack.pop(),this._typeStack.pop();break;case m.DIRECTIVE:this._directive=null;break;case m.OPERATION_DEFINITION:case m.INLINE_FRAGMENT:case m.FRAGMENT_DEFINITION:this._typeStack.pop();break;case m.VARIABLE_DEFINITION:this._inputTypeStack.pop();break;case m.ARGUMENT:this._argument=null,this._defaultValueStack.pop(),this._inputTypeStack.pop();break;case m.LIST:case m.OBJECT_FIELD:this._defaultValueStack.pop(),this._inputTypeStack.pop();break;case m.ENUM:this._enumValue=null}}}function en(e,t,n){const i=n.name.value;return i===Ft.name&&e.getQueryType()===t?Ft:i===Rt.name&&e.getQueryType()===t?Rt:i===Ct.name&&Ge(t)?Ct:be(t)||Le(t)?t.getFields()[i]:void 0}function tn(e,t){return{enter(...n){const i=n[0];e.enter(i);const r=de(t,i.kind).enter;if(r){const o=r.apply(t,n);return void 0!==o&&(e.leave(i),d(o)&&e.enter(o)),o}},leave(...n){const i=n[0],r=de(t,i.kind).leave;let o;return r&&(o=r.apply(t,n)),e.leave(i),o}}}function nn(e){return e.kind===m.OPERATION_DEFINITION||e.kind===m.FRAGMENT_DEFINITION}function rn(e){return e.kind===m.SCALAR_TYPE_DEFINITION||e.kind===m.OBJECT_TYPE_DEFINITION||e.kind===m.INTERFACE_TYPE_DEFINITION||e.kind===m.UNION_TYPE_DEFINITION||e.kind===m.ENUM_TYPE_DEFINITION||e.kind===m.INPUT_OBJECT_TYPE_DEFINITION}function on(e){return e.kind===m.SCALAR_TYPE_EXTENSION||e.kind===m.OBJECT_TYPE_EXTENSION||e.kind===m.INTERFACE_TYPE_EXTENSION||e.kind===m.UNION_TYPE_EXTENSION||e.kind===m.ENUM_TYPE_EXTENSION||e.kind===m.INPUT_OBJECT_TYPE_EXTENSION}function sn(e){const t=Object.create(null),n=e.getSchema(),i=n?n.getDirectives():It;for(const e of i)t[e.name]=e.args.map((e=>e.name));const r=e.getDocument().definitions;for(const e of r)if(e.kind===m.DIRECTIVE_DEFINITION){var o;const n=null!==(o=e.arguments)&&void 0!==o?o:[];t[e.name.value]=n.map((e=>e.name.value))}return{Directive(n){const i=n.name.value,r=t[i];if(n.arguments&&r)for(const t of n.arguments){const n=t.name.value;if(!r.includes(n)){const o=ie(n,r);e.reportError(new GraphQLError(`Unknown argument "${n}" on directive "@${i}".`+X(o),t))}}return!1}}}function an(e){const t=Object.create(null),n=e.getSchema(),r=n?n.getDirectives():It;for(const e of r)t[e.name]=e.locations;const o=e.getDocument().definitions;for(const e of o)e.kind===m.DIRECTIVE_DEFINITION&&(t[e.name.value]=e.locations.map((e=>e.value)));return{Directive(n,r,o,s,a){const c=n.name.value,u=t[c];if(!u)return void e.reportError(new GraphQLError(`Unknown directive "@${c}".`,n));const l=function(e){const t=e[e.length-1];switch("kind"in t||i(!1),t.kind){case m.OPERATION_DEFINITION:return function(e){switch(e){case f.QUERY:return h.QUERY;case f.MUTATION:return h.MUTATION;case f.SUBSCRIPTION:return h.SUBSCRIPTION}}(t.operation);case m.FIELD:return h.FIELD;case m.FRAGMENT_SPREAD:return h.FRAGMENT_SPREAD;case m.INLINE_FRAGMENT:return h.INLINE_FRAGMENT;case m.FRAGMENT_DEFINITION:return h.FRAGMENT_DEFINITION;case m.VARIABLE_DEFINITION:return h.VARIABLE_DEFINITION;case m.SCHEMA_DEFINITION:case m.SCHEMA_EXTENSION:return h.SCHEMA;case m.SCALAR_TYPE_DEFINITION:case m.SCALAR_TYPE_EXTENSION:return h.SCALAR;case m.OBJECT_TYPE_DEFINITION:case m.OBJECT_TYPE_EXTENSION:return h.OBJECT;case m.FIELD_DEFINITION:return h.FIELD_DEFINITION;case m.INTERFACE_TYPE_DEFINITION:case m.INTERFACE_TYPE_EXTENSION:return h.INTERFACE;case m.UNION_TYPE_DEFINITION:case m.UNION_TYPE_EXTENSION:return h.UNION;case m.ENUM_TYPE_DEFINITION:case m.ENUM_TYPE_EXTENSION:return h.ENUM;case m.ENUM_VALUE_DEFINITION:return h.ENUM_VALUE;case m.INPUT_OBJECT_TYPE_DEFINITION:case m.INPUT_OBJECT_TYPE_EXTENSION:return h.INPUT_OBJECT;case m.INPUT_VALUE_DEFINITION:{const t=e[e.length-3];return"kind"in t||i(!1),t.kind===m.INPUT_OBJECT_TYPE_DEFINITION?h.INPUT_FIELD_DEFINITION:h.ARGUMENT_DEFINITION}default:i(!1,"Unexpected kind: "+P(t.kind))}}(a);l&&!u.includes(l)&&e.reportError(new GraphQLError(`Directive "@${c}" may not be used on ${l}.`,n))}}}function cn(e){const t=e.getSchema(),n=t?t.getTypeMap():Object.create(null),i=Object.create(null);for(const t of e.getDocument().definitions)rn(t)&&(i[t.name.value]=!0);const r=[...Object.keys(n),...Object.keys(i)];return{NamedType(t,o,s,a,c){const u=t.name.value;if(!n[u]&&!i[u]){var l;const n=null!==(l=c[2])&&void 0!==l?l:s,i=null!=n&&("kind"in(p=n)&&(function(e){return e.kind===m.SCHEMA_DEFINITION||rn(e)||e.kind===m.DIRECTIVE_DEFINITION}(p)||function(e){return e.kind===m.SCHEMA_EXTENSION||on(e)}(p)));if(i&&un.includes(u))return;const o=ie(u,i?un.concat(r):r);e.reportError(new GraphQLError(`Unknown type "${u}".`+X(o),t))}var p}}}const un=[...dt,...Gt].map((e=>e.name));function ln(e){const t=[],n=[];return{OperationDefinition:e=>(t.push(e),!1),FragmentDefinition:e=>(n.push(e),!1),Document:{leave(){const i=Object.create(null);for(const n of t)for(const t of e.getRecursivelyReferencedFragments(n))i[t.name.value]=!0;for(const t of n){const n=t.name.value;!0!==i[n]&&e.reportError(new GraphQLError(`Fragment "${n}" is never used.`,t))}}}}}function pn(e,t){const n=[e];for(;we(je(n[n.length-1]));){const e=ke(je(n[n.length-1])).ofType;n.push(e)}if(t){const e=le(t,{RequiredDesignator:{leave({element:e}){if(e)return new GraphQLNonNull(je(e));const t=n.pop();return new GraphQLNonNull(je(t))}},OptionalDesignator:{leave({element:e}){if(e)return je(e);return je(n.pop())}},ListNullability:{leave({element:e}){let i=n.pop();if(we(je(i))||(i=n.pop()),!i)throw new GraphQLError("List nullability modifier is too deep.",t);const r=xe(i);return e?r?new GraphQLNonNull(new GraphQLList(e)):new GraphQLList(e):i}}});if(n.length>0)throw new GraphQLError("List nullability modifier is too shallow.",t);return e}return e}function dn(e){switch(e.kind){case m.OBJECT:return{...e,fields:(t=e.fields,t.map((e=>({...e,value:dn(e.value)}))).sort(((e,t)=>ee(e.name.value,t.name.value))))};case m.LIST:return{...e,values:e.values.map(dn)};case m.INT:case m.FLOAT:case m.STRING:case m.BOOLEAN:case m.NULL:case m.ENUM:case m.VARIABLE:return e}var t}function fn(e){return Array.isArray(e)?e.map((([e,t])=>`subfields "${e}" conflict because `+fn(t))).join(" and "):e}function hn(e,t,n,i,r,o,s){const a=e.getFragment(s);if(!a)return;const[c,u]=In(e,n,a);if(o!==c){vn(e,t,n,i,r,o,c);for(const a of u)i.has(a,s,r)||(i.add(a,s,r),hn(e,t,n,i,r,o,a))}}function mn(e,t,n,i,r,o,s){if(o===s)return;if(i.has(o,s,r))return;i.add(o,s,r);const a=e.getFragment(o),c=e.getFragment(s);if(!a||!c)return;const[u,l]=In(e,n,a),[p,d]=In(e,n,c);vn(e,t,n,i,r,u,p);for(const s of d)mn(e,t,n,i,r,o,s);for(const o of l)mn(e,t,n,i,r,o,s)}function vn(e,t,n,i,r,o,s){for(const[a,c]of Object.entries(o)){const o=s[a];if(o)for(const s of c)for(const c of o){const o=yn(e,n,i,r,a,s,c);o&&t.push(o)}}}function yn(e,t,n,i,r,o,s){const[a,c,u]=o,[l,p,d]=s,f=i||a!==l&&be(a)&&be(l);if(!f){const e=c.name.value,t=p.name.value;if(e!==t)return[[r,`"${e}" and "${t}" are different fields`],[c],[p]];if(En(c)!==En(p))return[[r,"they have differing arguments"],[c],[p]]}const h=null==u?void 0:u.type,m=null==d?void 0:d.type;if(h&&m){const e=pn(h,c.required),t=pn(m,p.required);if(Tn(e,t))return[[r,`they return conflicting types "${P(e)}" and "${P(t)}"`],[c],[p]]}const v=c.selectionSet,y=p.selectionSet;if(v&&y){return function(e,t,n,i){if(e.length>0)return[[t,e.map((([e])=>e))],[n,...e.map((([,e])=>e)).flat()],[i,...e.map((([,,e])=>e)).flat()]]}(function(e,t,n,i,r,o,s,a){const c=[],[u,l]=Nn(e,t,r,o),[p,d]=Nn(e,t,s,a);vn(e,c,t,n,i,u,p);for(const r of d)hn(e,c,t,n,i,u,r);for(const r of l)hn(e,c,t,n,i,p,r);for(const r of l)for(const o of d)mn(e,c,t,n,i,r,o);return c}(e,t,n,f,Me(h),v,Me(m),y),r,c,p)}}function En(e){var t;const n=null!==(t=e.arguments)&&void 0!==t?t:[];return fe(dn({kind:m.OBJECT,fields:n.map((e=>({kind:m.OBJECT_FIELD,name:e.name,value:e.value})))}))}function Tn(e,t){return we(e)?!we(t)||Tn(e.ofType,t.ofType):!!we(t)||(xe(e)?!xe(t)||Tn(e.ofType,t.ofType):!!xe(t)||!(!Ce(e)&&!Ce(t))&&e!==t)}function Nn(e,t,n,i){const r=t.get(i);if(r)return r;const o=Object.create(null),s=Object.create(null);gn(e,n,i,o,s);const a=[o,Object.keys(s)];return t.set(i,a),a}function In(e,t,n){const i=t.get(n.selectionSet);if(i)return i;const r=Zt(e.getSchema(),n.typeCondition);return Nn(e,t,r,n.selectionSet)}function gn(e,t,n,i,r){for(const o of n.selections)switch(o.kind){case m.FIELD:{const e=o.name.value;let n;(be(t)||Le(t))&&(n=t.getFields()[e]);const r=o.alias?o.alias.value:e;i[r]||(i[r]=[]),i[r].push([t,o,n]);break}case m.FRAGMENT_SPREAD:r[o.name.value]=!0;break;case m.INLINE_FRAGMENT:{const n=o.typeCondition,s=n?Zt(e.getSchema(),n):t;gn(e,s,o.selectionSet,i,r);break}}}class PairSet{constructor(){this._data=new Map}has(e,t,n){var i;const[r,o]=ee.name));const o=e.getDocument().definitions;for(const e of o)if(e.kind===m.DIRECTIVE_DEFINITION){var s;const t=null!==(s=e.arguments)&&void 0!==s?s:[];n[e.name.value]=H(t.filter(bn),(e=>e.name.value))}return{Directive:{leave(t){const i=t.name.value,r=n[i];if(r){var o;const n=null!==(o=t.arguments)&&void 0!==o?o:[],s=new Set(n.map((e=>e.name.value)));for(const[n,o]of Object.entries(r))if(!s.has(n)){const r=_e(o.type)?P(o.type):fe(o.type);e.reportError(new GraphQLError(`Directive "@${i}" argument "${n}" of type "${r}" is required, but it was not provided.`,t))}}}}}}function bn(e){return e.type.kind===m.NON_NULL_TYPE&&null==e.defaultValue}function Ln(e,t,n){if(e){if(e.kind===m.VARIABLE){const i=e.name.value;if(null==n||void 0===n[i])return;const r=n[i];if(null===r&&xe(t))return;return r}if(xe(t)){if(e.kind===m.NULL)return;return Ln(e,t.ofType,n)}if(e.kind===m.NULL)return null;if(we(t)){const i=t.ofType;if(e.kind===m.LIST){const t=[];for(const r of e.values)if(Sn(r,n)){if(xe(i))return;t.push(null)}else{const e=Ln(r,i,n);if(void 0===e)return;t.push(e)}return t}const r=Ln(e,i,n);if(void 0===r)return;return[r]}if(De(t)){if(e.kind!==m.OBJECT)return;const i=Object.create(null),r=H(e.fields,(e=>e.name.value));for(const e of Object.values(t.getFields())){const t=r[e.name];if(!t||Sn(t.value,n)){if(void 0!==e.defaultValue)i[e.name]=e.defaultValue;else if(xe(e.type))return;continue}const o=Ln(t.value,e.type,n);if(void 0===o)return;i[e.name]=o}return i}if(Ce(t)){let i;try{i=t.parseLiteral(e,n)}catch(e){return}if(void 0===i)return;return i}i(!1,"Unexpected input type: "+P(t))}}function Sn(e,t){return e.kind===m.VARIABLE&&(null==t||void 0===t[e.name.value])}function An(e,t,n){var i;const r=null===(i=t.directives)||void 0===i?void 0:i.find((t=>t.name.value===e.name));if(r)return function(e,t,n){var i;const r={},o=H(null!==(i=t.arguments)&&void 0!==i?i:[],(e=>e.name.value));for(const i of e.args){const e=i.name,c=i.type,u=o[e];if(!u){if(void 0!==i.defaultValue)r[e]=i.defaultValue;else if(xe(c))throw new GraphQLError(`Argument "${e}" of required type "${P(c)}" was not provided.`,t);continue}const l=u.value;let p=l.kind===m.NULL;if(l.kind===m.VARIABLE){const t=l.name.value;if(null==n||(s=n,a=t,!Object.prototype.hasOwnProperty.call(s,a))){if(void 0!==i.defaultValue)r[e]=i.defaultValue;else if(xe(c))throw new GraphQLError(`Argument "${e}" of required type "${P(c)}" was provided the variable "$${t}" which was not provided a runtime value.`,l);continue}p=null==n[t]}if(p&&xe(c))throw new GraphQLError(`Argument "${e}" of non-null type "${P(c)}" must not be null.`,l);const d=Ln(l,c,n);if(void 0===d)throw new GraphQLError(`Argument "${e}" has invalid value ${fe(l)}.`,l);r[e]=d}var s,a;return r}(e,r,n)}function Dn(e,t,n,i,r){const o=new Map;return wn(e,t,n,i,r,o,new Set),o}function wn(e,t,n,i,r,o,s){for(const c of r.selections)switch(c.kind){case m.FIELD:{if(!kn(n,c))continue;const e=(a=c).alias?a.alias.value:a.name.value,t=o.get(e);void 0!==t?t.push(c):o.set(e,[c]);break}case m.INLINE_FRAGMENT:if(!kn(n,c)||!xn(e,c,i))continue;wn(e,t,n,i,c.selectionSet,o,s);break;case m.FRAGMENT_SPREAD:{const r=c.name.value;if(s.has(r)||!kn(n,c))continue;s.add(r);const a=t[r];if(!a||!xn(e,a,i))continue;wn(e,t,n,i,a.selectionSet,o,s);break}}var a}function kn(e,t){const n=An(yt,t,e);if(!0===(null==n?void 0:n.if))return!1;const i=An(vt,t,e);return!1!==(null==i?void 0:i.if)}function xn(e,t,n){const i=t.typeCondition;if(!i)return!0;const r=Zt(e,i);return r===n||!!$e(r)&&e.isSubType(r,n)}function Fn(e,t){const n=new Map;for(const i of e){const e=t(i),r=n.get(e);void 0===r?n.set(e,[i]):r.push(i)}return n}function Rn(e){return{Field:t,Directive:t};function t(t){var n;const i=Fn(null!==(n=t.arguments)&&void 0!==n?n:[],(e=>e.name.value));for(const[t,n]of i)n.length>1&&e.reportError(new GraphQLError(`There can be only one argument named "${t}".`,n.map((e=>e.name))))}}function Cn(e){const t=Object.create(null),n=e.getSchema(),i=n?n.getDirectives():It;for(const e of i)t[e.name]=!e.isRepeatable;const r=e.getDocument().definitions;for(const e of r)e.kind===m.DIRECTIVE_DEFINITION&&(t[e.name.value]=!e.repeatable);const o=Object.create(null),s=Object.create(null);return{enter(n){if(!("directives"in n)||!n.directives)return;let i;if(n.kind===m.SCHEMA_DEFINITION||n.kind===m.SCHEMA_EXTENSION)i=o;else if(rn(n)||on(n)){const e=n.name.value;i=s[e],void 0===i&&(s[e]=i=Object.create(null))}else i=Object.create(null);for(const r of n.directives){const n=r.name.value;t[n]&&(i[n]?e.reportError(new GraphQLError(`The directive "@${n}" can only be used once at this location.`,[i[n],r])):i[n]=r)}}}}function Gn(e,t){return!!(be(e)||Le(e)||De(e))&&null!=e.getFields()[t]}function $n(e){const t=[];let n=Object.create(null);return{ObjectValue:{enter(){t.push(n),n=Object.create(null)},leave(){const e=t.pop();e||i(!1),n=e}},ObjectField(t){const i=t.name.value;n[i]?e.reportError(new GraphQLError(`There can be only one input field named "${i}".`,[n[i],t.name])):n[i]=t.name}}}function Qn(e,t){const n=e.getInputType();if(!n)return;const i=Me(n);if(Ce(i))try{if(void 0===i.parseLiteral(t,void 0)){const i=P(n);e.reportError(new GraphQLError(`Expected value of type "${i}", found ${fe(t)}.`,t))}}catch(i){const r=P(n);i instanceof GraphQLError?e.reportError(i):e.reportError(new GraphQLError(`Expected value of type "${r}", found ${fe(t)}; `+i.message,t,void 0,void 0,void 0,i))}else{const i=P(n);e.reportError(new GraphQLError(`Expected value of type "${i}", found ${fe(t)}.`,t))}}function Un(e,t,n,i,r){if(xe(i)&&!xe(t)){const o=void 0!==r;if(!(null!=n&&n.kind!==m.NULL)&&!o)return!1;return it(e,t,i.ofType)}return it(e,t,i)}const jn=Object.freeze([function(e){return{Document(t){for(const n of t.definitions)if(!nn(n)){const t=n.kind===m.SCHEMA_DEFINITION||n.kind===m.SCHEMA_EXTENSION?"schema":'"'+n.name.value+'"';e.reportError(new GraphQLError(`The ${t} definition is not executable.`,n))}return!1}}},function(e){const t=Object.create(null);return{OperationDefinition(n){const i=n.name;return i&&(t[i.value]?e.reportError(new GraphQLError(`There can be only one operation named "${i.value}".`,[t[i.value],i])):t[i.value]=i),!1},FragmentDefinition:()=>!1}},function(e){let t=0;return{Document(e){t=e.definitions.filter((e=>e.kind===m.OPERATION_DEFINITION)).length},OperationDefinition(n){!n.name&&t>1&&e.reportError(new GraphQLError("This anonymous operation must be the only defined operation.",n))}}},function(e){return{OperationDefinition(t){if("subscription"===t.operation){const n=e.getSchema(),i=n.getSubscriptionType();if(i){const r=t.name?t.name.value:null,o=Object.create(null),s=e.getDocument(),a=Object.create(null);for(const e of s.definitions)e.kind===m.FRAGMENT_DEFINITION&&(a[e.name.value]=e);const c=Dn(n,a,o,i,t.selectionSet);if(c.size>1){const t=[...c.values()].slice(1).flat();e.reportError(new GraphQLError(null!=r?`Subscription "${r}" must select only one top level field.`:"Anonymous Subscription must select only one top level field.",t))}for(const t of c.values()){t[0].name.value.startsWith("__")&&e.reportError(new GraphQLError(null!=r?`Subscription "${r}" must not select an introspection top level field.`:"Anonymous Subscription must not select an introspection top level field.",t))}}}}}},cn,function(e){return{InlineFragment(t){const n=t.typeCondition;if(n){const t=Zt(e.getSchema(),n);if(t&&!Ge(t)){const t=fe(n);e.reportError(new GraphQLError(`Fragment cannot condition on non composite type "${t}".`,n))}}},FragmentDefinition(t){const n=Zt(e.getSchema(),t.typeCondition);if(n&&!Ge(n)){const n=fe(t.typeCondition);e.reportError(new GraphQLError(`Fragment "${t.name.value}" cannot condition on non composite type "${n}".`,t.typeCondition))}}}},function(e){return{VariableDefinition(t){const n=Zt(e.getSchema(),t.type);if(void 0!==n&&!Fe(n)){const n=t.variable.name.value,i=fe(t.type);e.reportError(new GraphQLError(`Variable "$${n}" cannot be non-input type "${i}".`,t.type))}}}},function(e){return{Field(t){const n=e.getType(),i=t.selectionSet;if(n)if(Ce(Me(n))){if(i){const r=t.name.value,o=P(n);e.reportError(new GraphQLError(`Field "${r}" must not have a selection since type "${o}" has no subfields.`,i))}}else if(!i){const i=t.name.value,r=P(n);e.reportError(new GraphQLError(`Field "${i}" of type "${r}" must have a selection of subfields. Did you mean "${i} { ... }"?`,t))}}}},function(e){return{Field(t){const n=e.getParentType();if(n){if(!e.getFieldDef()){const i=e.getSchema(),r=t.name.value;let o=X("to use an inline fragment on",function(e,t,n){if(!$e(t))return[];const i=new Set,r=Object.create(null);for(const s of e.getPossibleTypes(t))if(s.getFields()[n]){i.add(s),r[s.name]=1;for(const e of s.getInterfaces()){var o;e.getFields()[n]&&(i.add(e),r[e.name]=(null!==(o=r[e.name])&&void 0!==o?o:0)+1)}}return[...i].sort(((t,n)=>{const i=r[n.name]-r[t.name];return 0!==i?i:Le(t)&&e.isSubType(t,n)?-1:Le(n)&&e.isSubType(n,t)?1:ee(t.name,n.name)})).map((e=>e.name))}(i,n,r));""===o&&(o=X(function(e,t){if(be(e)||Le(e)){return ie(t,Object.keys(e.getFields()))}return[]}(n,r))),e.reportError(new GraphQLError(`Cannot query field "${r}" on type "${n.name}".`+o,t))}}}}},function(e){const t=Object.create(null);return{OperationDefinition:()=>!1,FragmentDefinition(n){const i=n.name.value;return t[i]?e.reportError(new GraphQLError(`There can be only one fragment named "${i}".`,[t[i],n.name])):t[i]=n.name,!1}}},function(e){return{FragmentSpread(t){const n=t.name.value;e.getFragment(n)||e.reportError(new GraphQLError(`Unknown fragment "${n}".`,t.name))}}},ln,function(e){return{InlineFragment(t){const n=e.getType(),i=e.getParentType();if(Ge(n)&&Ge(i)&&!rt(e.getSchema(),n,i)){const r=P(i),o=P(n);e.reportError(new GraphQLError(`Fragment cannot be spread here as objects of type "${r}" can never be of type "${o}".`,t))}},FragmentSpread(t){const n=t.name.value,i=function(e,t){const n=e.getFragment(t);if(n){const t=Zt(e.getSchema(),n.typeCondition);if(Ge(t))return t}}(e,n),r=e.getParentType();if(i&&r&&!rt(e.getSchema(),i,r)){const o=P(r),s=P(i);e.reportError(new GraphQLError(`Fragment "${n}" cannot be spread here as objects of type "${o}" can never be of type "${s}".`,t))}}}},function(e){const t=Object.create(null),n=[],i=Object.create(null);return{OperationDefinition:()=>!1,FragmentDefinition:e=>(r(e),!1)};function r(o){if(t[o.name.value])return;const s=o.name.value;t[s]=!0;const a=e.getFragmentSpreads(o.selectionSet);if(0!==a.length){i[s]=n.length;for(const t of a){const o=t.name.value,s=i[o];if(n.push(t),void 0===s){const t=e.getFragment(o);t&&r(t)}else{const t=n.slice(s),i=t.slice(0,-1).map((e=>'"'+e.name.value+'"')).join(", ");e.reportError(new GraphQLError(`Cannot spread fragment "${o}" within itself`+(""!==i?` via ${i}.`:"."),t))}n.pop()}i[s]=void 0}}},function(e){return{OperationDefinition(t){var n;const i=Fn(null!==(n=t.variableDefinitions)&&void 0!==n?n:[],(e=>e.variable.name.value));for(const[t,n]of i)n.length>1&&e.reportError(new GraphQLError(`There can be only one variable named "$${t}".`,n.map((e=>e.variable.name))))}}},function(e){let t=Object.create(null);return{OperationDefinition:{enter(){t=Object.create(null)},leave(n){const i=e.getRecursiveVariableUsages(n);for(const{node:r}of i){const i=r.name.value;!0!==t[i]&&e.reportError(new GraphQLError(n.name?`Variable "$${i}" is not defined by operation "${n.name.value}".`:`Variable "$${i}" is not defined.`,[r,n]))}}},VariableDefinition(e){t[e.variable.name.value]=!0}}},function(e){let t=[];return{OperationDefinition:{enter(){t=[]},leave(n){const i=Object.create(null),r=e.getRecursiveVariableUsages(n);for(const{node:e}of r)i[e.name.value]=!0;for(const r of t){const t=r.variable.name.value;!0!==i[t]&&e.reportError(new GraphQLError(n.name?`Variable "$${t}" is never used in operation "${n.name.value}".`:`Variable "$${t}" is never used.`,r))}}},VariableDefinition(e){t.push(e)}}},an,Cn,function(e){return{...sn(e),Argument(t){const n=e.getArgument(),i=e.getFieldDef(),r=e.getParentType();if(!n&&i&&r){const n=t.name.value,o=ie(n,i.args.map((e=>e.name)));e.reportError(new GraphQLError(`Unknown argument "${n}" on field "${r.name}.${i.name}".`+X(o),t))}}}},Rn,function(e){return{ListValue(t){if(!we(je(e.getParentInputType())))return Qn(e,t),!1},ObjectValue(t){const n=Me(e.getInputType());if(!De(n))return Qn(e,t),!1;const i=H(t.fields,(e=>e.name.value));for(const r of Object.values(n.getFields())){if(!i[r.name]&&tt(r)){const i=P(r.type);e.reportError(new GraphQLError(`Field "${n.name}.${r.name}" of required type "${i}" was not provided.`,t))}}},ObjectField(t){const n=Me(e.getParentInputType());if(!e.getInputType()&&De(n)){const i=ie(t.name.value,Object.keys(n.getFields()));e.reportError(new GraphQLError(`Field "${t.name.value}" is not defined by type "${n.name}".`+X(i),t))}},NullValue(t){const n=e.getInputType();xe(n)&&e.reportError(new GraphQLError(`Expected value of type "${P(n)}", found ${fe(t)}.`,t))},EnumValue:t=>Qn(e,t),IntValue:t=>Qn(e,t),FloatValue:t=>Qn(e,t),StringValue:t=>Qn(e,t),BooleanValue:t=>Qn(e,t)}},function(e){return{...On(e),Field:{leave(t){var n;const i=e.getFieldDef();if(!i)return!1;const r=new Set(null===(n=t.arguments)||void 0===n?void 0:n.map((e=>e.name.value)));for(const n of i.args)if(!r.has(n.name)&&He(n)){const r=P(n.type);e.reportError(new GraphQLError(`Field "${i.name}" argument "${n.name}" of type "${r}" is required, but it was not provided.`,t))}}}}},function(e){let t=Object.create(null);return{OperationDefinition:{enter(){t=Object.create(null)},leave(n){const i=e.getRecursiveVariableUsages(n);for(const{node:n,type:r,defaultValue:o}of i){const i=n.name.value,s=t[i];if(s&&r){const t=e.getSchema(),a=Zt(t,s.type);if(a&&!Un(t,a,s.defaultValue,r,o)){const t=P(a),o=P(r);e.reportError(new GraphQLError(`Variable "$${i}" of type "${t}" used in position expecting type "${o}".`,[s,n]))}}}}},VariableDefinition(e){t[e.variable.name.value]=e}}},function(e){return{Field(t){const n=e.getFieldDef(),i=t.required;if(n&&i){const r=function(e){let t=e,n=0;for(;we(je(t));){t=ke(je(t)).ofType,n+=1}return n}(n.type),o=le(i,{RequiredDesignator:{leave:({element:e})=>null!=e?e:0},OptionalDesignator:{leave:({element:e})=>null!=e?e:0},ListNullability:{leave:({element:e})=>(null!=e?e:0)+1}});r>o?e.reportError(new GraphQLError("List nullability modifier is too shallow.",t.required)):r1)for(let r=0;r0&&e.reportError(new GraphQLError("Must provide only one schema definition.",t)),++s)}}},function(e){const t=e.getSchema(),n=Object.create(null),i=t?{query:t.getQueryType(),mutation:t.getMutationType(),subscription:t.getSubscriptionType()}:{};return{SchemaDefinition:r,SchemaExtension:r};function r(t){var r;const o=null!==(r=t.operationTypes)&&void 0!==r?r:[];for(const t of o){const r=t.operation,o=n[r];i[r]?e.reportError(new GraphQLError(`Type for ${r} already defined in the schema. It cannot be redefined.`,t)):o?e.reportError(new GraphQLError(`There can be only one ${r} type in schema.`,[o,t])):n[r]=t}return!1}},function(e){const t=Object.create(null),n=e.getSchema();return{ScalarTypeDefinition:i,ObjectTypeDefinition:i,InterfaceTypeDefinition:i,UnionTypeDefinition:i,EnumTypeDefinition:i,InputObjectTypeDefinition:i};function i(i){const r=i.name.value;if(null==n||!n.getType(r))return t[r]?e.reportError(new GraphQLError(`There can be only one type named "${r}".`,[t[r],i.name])):t[r]=i.name,!1;e.reportError(new GraphQLError(`Type "${r}" already exists in the schema. It cannot also be defined in this type definition.`,i.name))}},function(e){const t=e.getSchema(),n=t?t.getTypeMap():Object.create(null),i=Object.create(null);return{EnumTypeDefinition:r,EnumTypeExtension:r};function r(t){var r;const o=t.name.value;i[o]||(i[o]=Object.create(null));const s=null!==(r=t.values)&&void 0!==r?r:[],a=i[o];for(const t of s){const i=t.name.value,r=n[o];Ae(r)&&r.getValue(i)?e.reportError(new GraphQLError(`Enum value "${o}.${i}" already exists in the schema. It cannot also be defined in this type extension.`,t.name)):a[i]?e.reportError(new GraphQLError(`Enum value "${o}.${i}" can only be defined once.`,[a[i],t.name])):a[i]=t.name}return!1}},function(e){const t=e.getSchema(),n=t?t.getTypeMap():Object.create(null),i=Object.create(null);return{InputObjectTypeDefinition:r,InputObjectTypeExtension:r,InterfaceTypeDefinition:r,InterfaceTypeExtension:r,ObjectTypeDefinition:r,ObjectTypeExtension:r};function r(t){var r;const o=t.name.value;i[o]||(i[o]=Object.create(null));const s=null!==(r=t.fields)&&void 0!==r?r:[],a=i[o];for(const t of s){const i=t.name.value;Gn(n[o],i)?e.reportError(new GraphQLError(`Field "${o}.${i}" already exists in the schema. It cannot also be defined in this type extension.`,t.name)):a[i]?e.reportError(new GraphQLError(`Field "${o}.${i}" can only be defined once.`,[a[i],t.name])):a[i]=t.name}return!1}},function(e){return{DirectiveDefinition(e){var t;const i=null!==(t=e.arguments)&&void 0!==t?t:[];return n(`@${e.name.value}`,i)},InterfaceTypeDefinition:t,InterfaceTypeExtension:t,ObjectTypeDefinition:t,ObjectTypeExtension:t};function t(e){var t;const i=e.name.value,r=null!==(t=e.fields)&&void 0!==t?t:[];for(const e of r){var o;n(`${i}.${e.name.value}`,null!==(o=e.arguments)&&void 0!==o?o:[])}return!1}function n(t,n){const i=Fn(n,(e=>e.name.value));for(const[n,r]of i)r.length>1&&e.reportError(new GraphQLError(`Argument "${t}(${n}:)" can only be defined once.`,r.map((e=>e.name))));return!1}},function(e){const t=Object.create(null),n=e.getSchema();return{DirectiveDefinition(i){const r=i.name.value;if(null==n||!n.getDirective(r))return t[r]?e.reportError(new GraphQLError(`There can be only one directive named "@${r}".`,[t[r],i.name])):t[r]=i.name,!1;e.reportError(new GraphQLError(`Directive "@${r}" already exists in the schema. It cannot be redefined.`,i.name))}}},cn,an,Cn,function(e){const t=e.getSchema(),n=Object.create(null);for(const t of e.getDocument().definitions)rn(t)&&(n[t.name.value]=t);return{ScalarTypeExtension:r,ObjectTypeExtension:r,InterfaceTypeExtension:r,UnionTypeExtension:r,EnumTypeExtension:r,InputObjectTypeExtension:r};function r(r){const o=r.name.value,s=n[o],a=null==t?void 0:t.getType(o);let c;if(s?c=_n[s.kind]:a&&(c=function(e){if(Oe(e))return m.SCALAR_TYPE_EXTENSION;if(be(e))return m.OBJECT_TYPE_EXTENSION;if(Le(e))return m.INTERFACE_TYPE_EXTENSION;if(Se(e))return m.UNION_TYPE_EXTENSION;if(Ae(e))return m.ENUM_TYPE_EXTENSION;if(De(e))return m.INPUT_OBJECT_TYPE_EXTENSION;i(!1,"Unexpected type: "+P(e))}(a)),c){if(c!==r.kind){const t=function(e){switch(e){case m.SCALAR_TYPE_EXTENSION:return"scalar";case m.OBJECT_TYPE_EXTENSION:return"object";case m.INTERFACE_TYPE_EXTENSION:return"interface";case m.UNION_TYPE_EXTENSION:return"union";case m.ENUM_TYPE_EXTENSION:return"enum";case m.INPUT_OBJECT_TYPE_EXTENSION:return"input object";default:i(!1,"Unexpected kind: "+P(e))}}(r.kind);e.reportError(new GraphQLError(`Cannot extend non-${t} type "${o}".`,s?[s,r]:r))}}else{const i=ie(o,Object.keys({...n,...null==t?void 0:t.getTypeMap()}));e.reportError(new GraphQLError(`Cannot extend type "${o}" because it is not defined.`+X(i),r.name))}}},sn,Rn,$n,On]);class ASTValidationContext{constructor(e,t){this._ast=e,this._fragments=void 0,this._fragmentSpreads=new Map,this._recursivelyReferencedFragments=new Map,this._onError=t}get[Symbol.toStringTag](){return"ASTValidationContext"}reportError(e){this._onError(e)}getDocument(){return this._ast}getFragment(e){let t;if(this._fragments)t=this._fragments;else{t=Object.create(null);for(const e of this.getDocument().definitions)e.kind===m.FRAGMENT_DEFINITION&&(t[e.name.value]=e);this._fragments=t}return t[e]}getFragmentSpreads(e){let t=this._fragmentSpreads.get(e);if(!t){t=[];const n=[e];let i;for(;i=n.pop();)for(const e of i.selections)e.kind===m.FRAGMENT_SPREAD?t.push(e):e.selectionSet&&n.push(e.selectionSet);this._fragmentSpreads.set(e,t)}return t}getRecursivelyReferencedFragments(e){let t=this._recursivelyReferencedFragments.get(e);if(!t){t=[];const n=Object.create(null),i=[e.selectionSet];let r;for(;r=i.pop();)for(const e of this.getFragmentSpreads(r)){const r=e.name.value;if(!0!==n[r]){n[r]=!0;const e=this.getFragment(r);e&&(t.push(e),i.push(e.selectionSet))}}this._recursivelyReferencedFragments.set(e,t)}return t}}class SDLValidationContext extends ASTValidationContext{constructor(e,t,n){super(e,n),this._schema=t}get[Symbol.toStringTag](){return"SDLValidationContext"}getSchema(){return this._schema}}class ValidationContext extends ASTValidationContext{constructor(e,t,n,i){super(t,i),this._schema=e,this._typeInfo=n,this._variableUsages=new Map,this._recursiveVariableUsages=new Map}get[Symbol.toStringTag](){return"ValidationContext"}getSchema(){return this._schema}getVariableUsages(e){let t=this._variableUsages.get(e);if(!t){const n=[],i=new TypeInfo(this._schema);le(e,tn(i,{VariableDefinition:()=>!1,Variable(e){n.push({node:e,type:i.getInputType(),defaultValue:i.getDefaultValue()})}})),t=n,this._variableUsages.set(e,t)}return t}getRecursiveVariableUsages(e){let t=this._recursiveVariableUsages.get(e);if(!t){t=this.getVariableUsages(e);for(const n of this.getRecursivelyReferencedFragments(e))t=t.concat(this.getVariableUsages(n));this._recursiveVariableUsages.set(e,t)}return t}getType(){return this._typeInfo.getType()}getParentType(){return this._typeInfo.getParentType()}getInputType(){return this._typeInfo.getInputType()}getParentInputType(){return this._typeInfo.getParentInputType()}getFieldDef(){return this._typeInfo.getFieldDef()}getDirective(){return this._typeInfo.getDirective()}getArgument(){return this._typeInfo.getArgument()}getEnumValue(){return this._typeInfo.getEnumValue()}}function Mn(e,n,i=jn,r,o=new TypeInfo(e)){var s;const a=null!==(s=null==r?void 0:r.maxErrors)&&void 0!==s?s:100;n||t(!1,"Must provide document."),function(e){const t=jt(e);if(0!==t.length)throw new Error(t.map((e=>e.message)).join("\n\n"))}(e);const c=Object.freeze({}),u=[],l=new ValidationContext(e,n,o,(e=>{if(u.length>=a)throw u.push(new GraphQLError("Too many validation errors, error limit reached. Validation aborted.")),c;u.push(e)})),p=pe(i.map((e=>e(l))));try{le(n,tn(o,p))}catch(e){if(e!==c)throw e}return u}function Pn(e,t,n=Vn){const i=[],r=new SDLValidationContext(e,t,(e=>{i.push(e)}));return le(e,pe(n.map((e=>e(r))))),i}function Bn(e,i){n(e)&&n(e.__schema)||t(!1,`Invalid or incomplete introspection result. Ensure that you are passing "data" property of introspection response and no "errors" was returned alongside: ${P(e)}.`);const r=e.__schema,o=W(r.types,(e=>e.name),(e=>function(e){if(null!=e&&null!=e.name&&null!=e.kind)switch(e.kind){case kt.SCALAR:return new GraphQLScalarType({name:(i=e).name,description:i.description,specifiedByURL:i.specifiedByURL});case kt.OBJECT:return new GraphQLObjectType({name:(n=e).name,description:n.description,interfaces:()=>h(n),fields:()=>m(n)});case kt.INTERFACE:return new GraphQLInterfaceType({name:(t=e).name,description:t.description,interfaces:()=>h(t),fields:()=>m(t)});case kt.UNION:return function(e){if(!e.possibleTypes){const t=P(e);throw new Error(`Introspection result missing possibleTypes: ${t}.`)}return new GraphQLUnionType({name:e.name,description:e.description,types:()=>e.possibleTypes.map(d)})}(e);case kt.ENUM:return function(e){if(!e.enumValues){const t=P(e);throw new Error(`Introspection result missing enumValues: ${t}.`)}return new GraphQLEnumType({name:e.name,description:e.description,values:W(e.enumValues,(e=>e.name),(e=>({description:e.description,deprecationReason:e.deprecationReason})))})}(e);case kt.INPUT_OBJECT:return function(e){if(!e.inputFields){const t=P(e);throw new Error(`Introspection result missing inputFields: ${t}.`)}return new GraphQLInputObjectType({name:e.name,description:e.description,fields:()=>E(e.inputFields)})}(e)}var t;var n;var i;const r=P(e);throw new Error(`Invalid or incomplete introspection result. Ensure that a full introspection query is used in order to build a client schema: ${r}.`)}(e)));for(const e of[...dt,...Gt])o[e.name]&&(o[e.name]=e);const s=r.queryType?d(r.queryType):null,a=r.mutationType?d(r.mutationType):null,c=r.subscriptionType?d(r.subscriptionType):null,u=r.directives?r.directives.map((function(e){if(!e.args){const t=P(e);throw new Error(`Introspection result missing directive args: ${t}.`)}if(!e.locations){const t=P(e);throw new Error(`Introspection result missing directive locations: ${t}.`)}return new GraphQLDirective({name:e.name,description:e.description,isRepeatable:e.isRepeatable,locations:e.locations.slice(),args:E(e.args)})})):[];return new GraphQLSchema({description:r.description,query:s,mutation:a,subscription:c,types:Object.values(o),directives:u,assumeValid:null==i?void 0:i.assumeValid});function l(e){if(e.kind===kt.LIST){const t=e.ofType;if(!t)throw new Error("Decorated type deeper than introspection query.");return new GraphQLList(l(t))}if(e.kind===kt.NON_NULL){const t=e.ofType;if(!t)throw new Error("Decorated type deeper than introspection query.");const n=l(t);return new GraphQLNonNull(function(e){if(!Ue(e))throw new Error(`Expected ${P(e)} to be a GraphQL nullable type.`);return e}(n))}return p(e)}function p(e){const t=e.name;if(!t)throw new Error(`Unknown type reference: ${P(e)}.`);const n=o[t];if(!n)throw new Error(`Invalid or incomplete schema, unknown type: ${t}. Ensure that a full introspection query is used in order to build a client schema.`);return n}function d(e){return function(e){if(!be(e))throw new Error(`Expected ${P(e)} to be a GraphQL Object type.`);return e}(p(e))}function f(e){return function(e){if(!Le(e))throw new Error(`Expected ${P(e)} to be a GraphQL Interface type.`);return e}(p(e))}function h(e){if(null===e.interfaces&&e.kind===kt.INTERFACE)return[];if(!e.interfaces){const t=P(e);throw new Error(`Introspection result missing interfaces: ${t}.`)}return e.interfaces.map(f)}function m(e){if(!e.fields)throw new Error(`Introspection result missing fields: ${P(e)}.`);return W(e.fields,(e=>e.name),y)}function y(e){const t=l(e.type);if(!Re(t)){const e=P(t);throw new Error(`Introspection must provide output type for fields, but received: ${e}.`)}if(!e.args){const t=P(e);throw new Error(`Introspection result missing field args: ${t}.`)}return{description:e.description,deprecationReason:e.deprecationReason,type:t,args:E(e.args)}}function E(e){return W(e,(e=>e.name),T)}function T(e){const t=l(e.type);if(!Fe(t)){const e=P(t);throw new Error(`Introspection must provide input type for arguments, but received: ${e}.`)}const n=null!=e.defaultValue?Ln(function(e,t){const n=new Parser(e,t);n.expectToken(v.SOF);const i=n.parseValueLiteral(!1);return n.expectToken(v.EOF),i}(e.defaultValue),t):void 0;return{description:e.description,type:t,defaultValue:n,deprecationReason:e.deprecationReason}}}function Yn(e,n,i){Qt(e),null!=n&&n.kind===m.DOCUMENT||t(!1,"Must provide valid Document AST."),!0!==(null==i?void 0:i.assumeValid)&&!0!==(null==i?void 0:i.assumeValidSDL)&&function(e,t){const n=Pn(e,t);if(0!==n.length)throw new Error(n.map((e=>e.message)).join("\n\n"))}(n,e);const r=e.toConfig(),o=Jn(r,n,i);return r===o?e:new GraphQLSchema(o)}function Jn(e,t,n){var r,o,s,a;const c=[],u=Object.create(null),l=[];let p;const d=[];for(const e of t.definitions)if(e.kind===m.SCHEMA_DEFINITION)p=e;else if(e.kind===m.SCHEMA_EXTENSION)d.push(e);else if(rn(e))c.push(e);else if(on(e)){const t=e.name.value,n=u[t];u[t]=n?n.concat([e]):[e]}else e.kind===m.DIRECTIVE_DEFINITION&&l.push(e);if(0===Object.keys(u).length&&0===c.length&&0===l.length&&0===d.length&&null==p)return e;const f=Object.create(null);for(const t of e.types)f[t.name]=T(t);for(const e of c){var h;const t=e.name.value;f[t]=null!==(h=qn[t])&&void 0!==h?h:k(e)}const v={query:e.query&&E(e.query),mutation:e.mutation&&E(e.mutation),subscription:e.subscription&&E(e.subscription),...p&&g([p]),...g(d)};return{description:null===(r=p)||void 0===r||null===(o=r.description)||void 0===o?void 0:o.value,...v,types:Object.values(f),directives:[...e.directives.map((function(e){const t=e.toConfig();return new GraphQLDirective({...t,args:Z(t.args,I)})})),...l.map((function(e){var t;return new GraphQLDirective({name:e.name.value,description:null===(t=e.description)||void 0===t?void 0:t.value,locations:e.locations.map((({value:e})=>e)),isRepeatable:e.repeatable,args:L(e.arguments),astNode:e})}))],extensions:Object.create(null),astNode:null!==(s=p)&&void 0!==s?s:e.astNode,extensionASTNodes:e.extensionASTNodes.concat(d),assumeValid:null!==(a=null==n?void 0:n.assumeValid)&&void 0!==a&&a};function y(e){return we(e)?new GraphQLList(y(e.ofType)):xe(e)?new GraphQLNonNull(y(e.ofType)):E(e)}function E(e){return f[e.name]}function T(e){return $t(e)||ft(e)?e:Oe(e)?function(e){var t;const n=e.toConfig(),i=null!==(t=u[n.name])&&void 0!==t?t:[];let r=n.specifiedByURL;for(const e of i){var o;r=null!==(o=Xn(e))&&void 0!==o?o:r}return new GraphQLScalarType({...n,specifiedByURL:r,extensionASTNodes:n.extensionASTNodes.concat(i)})}(e):be(e)?function(e){var t;const n=e.toConfig(),i=null!==(t=u[n.name])&&void 0!==t?t:[];return new GraphQLObjectType({...n,interfaces:()=>[...e.getInterfaces().map(E),...D(i)],fields:()=>({...Z(n.fields,N),...b(i)}),extensionASTNodes:n.extensionASTNodes.concat(i)})}(e):Le(e)?function(e){var t;const n=e.toConfig(),i=null!==(t=u[n.name])&&void 0!==t?t:[];return new GraphQLInterfaceType({...n,interfaces:()=>[...e.getInterfaces().map(E),...D(i)],fields:()=>({...Z(n.fields,N),...b(i)}),extensionASTNodes:n.extensionASTNodes.concat(i)})}(e):Se(e)?function(e){var t;const n=e.toConfig(),i=null!==(t=u[n.name])&&void 0!==t?t:[];return new GraphQLUnionType({...n,types:()=>[...e.getTypes().map(E),...w(i)],extensionASTNodes:n.extensionASTNodes.concat(i)})}(e):Ae(e)?function(e){var t;const n=e.toConfig(),i=null!==(t=u[e.name])&&void 0!==t?t:[];return new GraphQLEnumType({...n,values:{...n.values,...A(i)},extensionASTNodes:n.extensionASTNodes.concat(i)})}(e):De(e)?function(e){var t;const n=e.toConfig(),i=null!==(t=u[n.name])&&void 0!==t?t:[];return new GraphQLInputObjectType({...n,fields:()=>({...Z(n.fields,(e=>({...e,type:y(e.type)}))),...S(i)}),extensionASTNodes:n.extensionASTNodes.concat(i)})}(e):void i(!1,"Unexpected type: "+P(e))}function N(e){return{...e,type:y(e.type),args:e.args&&Z(e.args,I)}}function I(e){return{...e,type:y(e.type)}}function g(e){const t={};for(const i of e){var n;const e=null!==(n=i.operationTypes)&&void 0!==n?n:[];for(const n of e)t[n.operation]=_(n.type)}return t}function _(e){var t;const n=e.name.value,i=null!==(t=qn[n])&&void 0!==t?t:f[n];if(void 0===i)throw new Error(`Unknown type: "${n}".`);return i}function O(e){return e.kind===m.LIST_TYPE?new GraphQLList(O(e.type)):e.kind===m.NON_NULL_TYPE?new GraphQLNonNull(O(e.type)):_(e)}function b(e){const t=Object.create(null);for(const r of e){var n;const e=null!==(n=r.fields)&&void 0!==n?n:[];for(const n of e){var i;t[n.name.value]={type:O(n.type),description:null===(i=n.description)||void 0===i?void 0:i.value,args:L(n.arguments),deprecationReason:Kn(n),astNode:n}}}return t}function L(e){const t=null!=e?e:[],n=Object.create(null);for(const e of t){var i;const t=O(e.type);n[e.name.value]={type:t,description:null===(i=e.description)||void 0===i?void 0:i.value,defaultValue:Ln(e.defaultValue,t),deprecationReason:Kn(e),astNode:e}}return n}function S(e){const t=Object.create(null);for(const r of e){var n;const e=null!==(n=r.fields)&&void 0!==n?n:[];for(const n of e){var i;const e=O(n.type);t[n.name.value]={type:e,description:null===(i=n.description)||void 0===i?void 0:i.value,defaultValue:Ln(n.defaultValue,e),deprecationReason:Kn(n),astNode:n}}}return t}function A(e){const t=Object.create(null);for(const r of e){var n;const e=null!==(n=r.values)&&void 0!==n?n:[];for(const n of e){var i;t[n.name.value]={description:null===(i=n.description)||void 0===i?void 0:i.value,deprecationReason:Kn(n),astNode:n}}}return t}function D(e){return e.flatMap((e=>{var t,n;return null!==(t=null===(n=e.interfaces)||void 0===n?void 0:n.map(_))&&void 0!==t?t:[]}))}function w(e){return e.flatMap((e=>{var t,n;return null!==(t=null===(n=e.types)||void 0===n?void 0:n.map(_))&&void 0!==t?t:[]}))}function k(e){var t;const n=e.name.value,i=null!==(t=u[n])&&void 0!==t?t:[];switch(e.kind){case m.OBJECT_TYPE_DEFINITION:{var r;const t=[e,...i];return new GraphQLObjectType({name:n,description:null===(r=e.description)||void 0===r?void 0:r.value,interfaces:()=>D(t),fields:()=>b(t),astNode:e,extensionASTNodes:i})}case m.INTERFACE_TYPE_DEFINITION:{var o;const t=[e,...i];return new GraphQLInterfaceType({name:n,description:null===(o=e.description)||void 0===o?void 0:o.value,interfaces:()=>D(t),fields:()=>b(t),astNode:e,extensionASTNodes:i})}case m.ENUM_TYPE_DEFINITION:{var s;const t=[e,...i];return new GraphQLEnumType({name:n,description:null===(s=e.description)||void 0===s?void 0:s.value,values:A(t),astNode:e,extensionASTNodes:i})}case m.UNION_TYPE_DEFINITION:{var a;const t=[e,...i];return new GraphQLUnionType({name:n,description:null===(a=e.description)||void 0===a?void 0:a.value,types:()=>w(t),astNode:e,extensionASTNodes:i})}case m.SCALAR_TYPE_DEFINITION:var c;return new GraphQLScalarType({name:n,description:null===(c=e.description)||void 0===c?void 0:c.value,specifiedByURL:Xn(e),astNode:e,extensionASTNodes:i});case m.INPUT_OBJECT_TYPE_DEFINITION:{var l;const t=[e,...i];return new GraphQLInputObjectType({name:n,description:null===(l=e.description)||void 0===l?void 0:l.value,fields:()=>S(t),astNode:e,extensionASTNodes:i})}}}}const qn=H([...dt,...Gt],(e=>e.name));function Kn(e){const t=An(Tt,e);return null==t?void 0:t.reason}function Xn(e){const t=An(Nt,e);return null==t?void 0:t.url}function zn(e,n){null!=e&&e.kind===m.DOCUMENT||t(!1,"Must provide valid Document AST."),!0!==(null==n?void 0:n.assumeValid)&&!0!==(null==n?void 0:n.assumeValidSDL)&&function(e){const t=Pn(e);if(0!==t.length)throw new Error(t.map((e=>e.message)).join("\n\n"))}(e);const i=Jn({description:void 0,types:[],directives:[],extensions:Object.create(null),extensionASTNodes:[],assumeValid:!1},e,n);if(null==i.astNode)for(const e of i.types)switch(e.name){case"Query":i.query=e;break;case"Mutation":i.mutation=e;break;case"Subscription":i.subscription=e}const r=[...i.directives,...It.filter((e=>i.directives.every((t=>t.name!==e.name))))];return new GraphQLSchema({...i,directives:r})}function Hn(e){return function(e,t,n){const r=e.getDirectives().filter(t),o=Object.values(e.getTypeMap()).filter(n);return[Zn(e),...r.map((e=>function(e){return si(e)+"directive @"+e.name+ii(e.args)+(e.isRepeatable?" repeatable":"")+" on "+e.locations.join(" | ")}(e))),...o.map((e=>function(e){if(Oe(e))return function(e){return si(e)+`scalar ${e.name}`+function(e){if(null==e.specifiedByURL)return"";return` @specifiedBy(url: ${fe({kind:m.STRING,value:e.specifiedByURL})})`}(e)}(e);if(be(e))return function(e){return si(e)+`type ${e.name}`+ei(e)+ti(e)}(e);if(Le(e))return function(e){return si(e)+`interface ${e.name}`+ei(e)+ti(e)}(e);if(Se(e))return function(e){const t=e.getTypes(),n=t.length?" = "+t.join(" | "):"";return si(e)+"union "+e.name+n}(e);if(Ae(e))return function(e){const t=e.getValues().map(((e,t)=>si(e," ",!t)+" "+e.name+oi(e.deprecationReason)));return si(e)+`enum ${e.name}`+ni(t)}(e);if(De(e))return function(e){const t=Object.values(e.getFields()).map(((e,t)=>si(e," ",!t)+" "+ri(e)));return si(e)+`input ${e.name}`+ni(t)}(e);i(!1,"Unexpected type: "+P(e))}(e)))].filter(Boolean).join("\n\n")}(e,(e=>{return t=e,!It.some((({name:e})=>e===t.name));var t}),Wn)}function Wn(e){return!ft(e)&&!$t(e)}function Zn(e){if(null==e.description&&function(e){const t=e.getQueryType();if(t&&"Query"!==t.name)return!1;const n=e.getMutationType();if(n&&"Mutation"!==n.name)return!1;const i=e.getSubscriptionType();if(i&&"Subscription"!==i.name)return!1;return!0}(e))return;const t=[],n=e.getQueryType();n&&t.push(` query: ${n.name}`);const i=e.getMutationType();i&&t.push(` mutation: ${i.name}`);const r=e.getSubscriptionType();return r&&t.push(` subscription: ${r.name}`),si(e)+`schema {\n${t.join("\n")}\n}`}function ei(e){const t=e.getInterfaces();return t.length?" implements "+t.map((e=>e.name)).join(" & "):""}function ti(e){return ni(Object.values(e.getFields()).map(((e,t)=>si(e," ",!t)+" "+e.name+ii(e.args," ")+": "+String(e.type)+oi(e.deprecationReason))))}function ni(e){return 0!==e.length?" {\n"+e.join("\n")+"\n}":""}function ii(e,t=""){return 0===e.length?"":e.every((e=>!e.description))?"("+e.map(ri).join(", ")+")":"(\n"+e.map(((e,n)=>si(e," "+t,!n)+" "+t+ri(e))).join("\n")+"\n"+t+")"}function ri(e){const t=gt(e.defaultValue,e.type);let n=e.name+": "+String(e.type);return t&&(n+=` = ${fe(t)}`),n+oi(e.deprecationReason)}function oi(e){if(null==e)return"";if(e!==Et){return` @deprecated(reason: ${fe({kind:m.STRING,value:e})})`}return" @deprecated"}function si(e,t="",n=!0){const{description:i}=e;if(null==i)return"";return(t&&!n?"\n"+t:t)+fe({kind:m.STRING,value:i,block:O(i)}).replace(/\n/g,"\n"+t)+"\n"}function ai(e){const t=[];for(const n of e)t.push(...n.definitions);return{kind:m.DOCUMENT,definitions:t}}const ci=[ln];function ui(e){var t;const n=function(e){if(e)return function(t){const n=e;return{Field(e){var i;const r=(null!==(i=e.alias)&&void 0!==i?i:e.name).value,o=r.charAt(0).toLowerCase()+r.slice(1);n.includes(o)&&t.reportError(new GraphQLError(`Field name "${r}" is not allowed because it conflicts with generated object APIs. Please use an alias to change the field name.`,{nodes:e}))}}};return}(null===(t=e.disallowedFieldNames)||void 0===t?void 0:t.allFields),i=function(e){if(e)return function(t){const n=e;return{VariableDefinition(e){const i=e.variable.name.value,r=i.charAt(0).toLowerCase()+i.slice(1);n.includes(r)&&t.reportError(new GraphQLError(`Input Parameter name "${i}" is not allowed because it conflicts with generated object APIs.`,{nodes:e}))}}};return}(e.disallowedInputParameterNames);return[li,pi,...n?[n]:[],...i?[i]:[],...jn.filter((e=>!ci.includes(e)))]}function li(e){return{OperationDefinition:t=>(t.name||e.reportError(new GraphQLError("Apollo does not support anonymous operations because operation names are used during code generation. Please give this operation a name.",t)),!1)}}function pi(e){return{Field(t){"__typename"==(t.alias&&t.alias.value)&&e.reportError(new GraphQLError("Apollo needs to be able to insert __typename when needed, so using it as an alias is not supported.",t))}}}const di={kind:m.DIRECTIVE_DEFINITION,description:(fi="A directive used by the Apollo iOS client to annotate operations or fragments that should be used exclusively for generating local cache mutations instead of as standard operations.",{kind:m.STRING,value:fi}),name:hi("apollo_client_ios_localCacheMutation"),repeatable:!1,locations:[hi("QUERY"),hi("MUTATION"),hi("SUBSCRIPTION"),hi("FRAGMENT_DEFINITION")]};var fi;function hi(e){return{kind:m.NAME,value:e}}const mi={kind:m.DOCUMENT,definitions:[di]};const vi={kind:m.FIELD,name:{kind:m.NAME,value:"__typename"}};class GraphQLSchemaValidationError extends Error{constructor(e){super(e.map((e=>e.message)).join("\n\n")),this.validationErrors=e,this.name="GraphQLSchemaValidationError"}}function yi(e){return e.startsWith("__")}const Ei={kind:m.FIELD,name:{kind:m.NAME,value:"__typename"}};function Ti(e,t){return t&&(e=function(e){return le(e,{enter:e=>e.kind!==m.SELECTION_SET?void 0:{...e,selections:e.selections.filter((e=>!("Field"===e.kind&&"__typename"===e.name.value)))},leave(e){if((e.kind===m.FIELD||e.kind===m.FRAGMENT_DEFINITION||e.kind===m.INLINE_FRAGMENT)&&e.selectionSet)return{...e,selectionSet:{...e.selectionSet,selections:[vi,...e.selectionSet.selections]}}}})}(e)),le(e,{SelectionSet:{leave:(e,t,n)=>d(n)&&![m.FIELD,m.FRAGMENT_DEFINITION].includes(n.kind)?e:function(e){return e.selections.find((e=>e.kind==Ei.kind&&e.name.value==Ei.name.value))?e:{...e,selections:[Ei,...e.selections]}}(e)},Field:{enter:e=>function(e){return e.name.value==Ei.name.value?{...e,alias:void 0,directives:void 0}:e}(e)},Directive:{enter:e=>function(e){return e.name.value==di.name.value?null:e}(e)}})}function Ni(e){return null!=e}function Ii(e){switch(e.kind){case m.VARIABLE:return{kind:e.kind,value:e.name.value};case m.LIST:return{kind:e.kind,value:e.values.map(Ii)};case m.OBJECT:return{kind:e.kind,value:e.fields.reduce(((e,t)=>(e[t.name.value]=Ii(t.value),e)),{})};default:return e}}function gi(e){var t,n;return null===(n=null===(t=e.loc)||void 0===t?void 0:t.source)||void 0===n?void 0:n.name}function _i(e,t,n,i){var r;const o=new Map;for(const e of t.definitions)e.kind===m.FRAGMENT_DEFINITION&&o.set(e.name.value,e);const s=[],a=new Map,c=new Set;for(const e of t.definitions)e.kind===m.OPERATION_DEFINITION&&s.push(l(e));for(const[e,t]of o.entries())a.set(e,p(t));return{operations:s,fragments:Array.from(a.values()),referencedTypes:Array.from(c.values()),schemaDocumentation:null!==(r=e.description)&&void 0!==r?r:void 0};function u(t){if(!c.has(t)){if(c.add(t),Le(t))for(const n of e.getPossibleTypes(t))u(Me(n));if(Se(t)){const e=t.getTypes();for(t of e)u(Me(t))}if(De(t)&&function(e){const t=e.getFields();for(const e in t){u(Me(t[e].type))}}(t),be(t))for(const e of t.getInterfaces())u(Me(e))}}function l(t){var i;if(!t.name)throw new GraphQLError("Operations should be named",{nodes:t});const r=gi(t),o=t.name.value,s=t.operation,a=(t.variableDefinitions||[]).map((t=>{const n=t.variable.name.value,i=t.defaultValue?Ii(t.defaultValue):void 0,r=Zt(e,t.type);if(!r)throw new GraphQLError(`Couldn't get type from type node "${t.type}"`,{nodes:t});return u(Me(r)),{name:n,type:r,defaultValue:i}})),c=fe(Ti(t,n)),l=e.getRootType(s),[p]=null!==(i=h(t.directives))&&void 0!==i?i:[void 0,void 0];return u(l),{name:o,operationType:s,variables:a,rootType:l,selectionSet:d(t.selectionSet,l),directives:p,source:c,filePath:r}}function p(t){var i;const r=t.name.value,o=gi(t),s=fe(Ti(t,n)),a=Zt(e,t.typeCondition),[c]=null!==(i=h(t.directives))&&void 0!==i?i:[void 0,void 0];return u(Me(a)),{name:r,filePath:o,source:s,typeCondition:a,selectionSet:d(t.selectionSet,a),directives:c}}function d(t,n){return{parentType:n,selections:t.selections.map((t=>function(t,n){var r,s,c,l;const[v,y]=null!==(r=h(t.directives))&&void 0!==r?r:[void 0,void 0];switch(t.kind){case m.FIELD:{const r=t.name.value;if("__typename"==r)return;const o=null===(s=t.alias)||void 0===s?void 0:s.value,a=function(e,t,n){return n===Ft.name&&e.getQueryType()===t?Ft:n===Rt.name&&e.getQueryType()===t?Rt:n===Ct.name&&(be(t)||Le(t)||Se(t))?Ct:be(t)||Le(t)?t.getFields()[n]:void 0}(e,n,r);if(!a)throw new GraphQLError(`Cannot query field "${r}" on type "${String(n)}"`,{nodes:t});const p=pn(a.type,t.required),h=Me(p);u(Me(h));const{description:m,deprecationReason:E}=a;let T={kind:"Field",name:r,alias:o,type:p,arguments:f(a,t.arguments),inclusionConditions:y,description:!yi(r)&&m?m:void 0,deprecationReason:E||void 0,directives:v};function N(e,t,n){var i;if(t&&n){const r=(null!==(i=e.alias)&&void 0!==i?i:e.name).value,o=r.charAt(0).toLowerCase()+r.slice(1);if(null==t?void 0:t.includes(o))throw new GraphQLError(`Schema name "${n}" conflicts with name of a generated object API. Please choose a different schema name. Suggestions: "${n}Schema", "${n}GraphQL", "${n}API"`,{nodes:e})}}if(we(p)||xe(p)&&we(p.ofType)?N(t,null===(c=i.disallowedFieldNames)||void 0===c?void 0:c.entityList,i.schemaNamespace):Ge(h)&&N(t,null===(l=i.disallowedFieldNames)||void 0===l?void 0:l.entity,i.schemaNamespace),Ge(h)){const e=t.selectionSet;if(!e)throw new GraphQLError(`Composite field "${r}" on type "${String(n)}" requires selection set`,{nodes:t});T.selectionSet=d(e,h)}return T}case m.INLINE_FRAGMENT:{const i=t.typeCondition,r=i?Zt(e,i):n;return u(r),{kind:"InlineFragment",selectionSet:d(t.selectionSet,r),inclusionConditions:y,directives:v}}case m.FRAGMENT_SPREAD:{const e=t.name.value,n=function(e){let t=a.get(e);if(t)return t;const n=o.get(e);return n?(o.delete(e),t=p(n),a.set(e,t),t):void 0}(e);if(!n)throw new GraphQLError(`Unknown fragment "${e}".`,{nodes:t.name});return{kind:"FragmentSpread",fragment:n,inclusionConditions:y,directives:v}}}}(t,n))).filter(Ni)}}function f(...e){const t=e[0].args;return e[1]&&e[1].length>0?e[1].map((e=>{var n;const i=e.name.value,r=t.find((t=>t.name===e.name.value)),o=null==r?void 0:r.type;if(!o)throw new GraphQLError(`Cannot find directive argument type for argument "${i}".`,{nodes:[e]});return{name:i,value:Ii(e.value),type:o,deprecationReason:null!==(n=r.deprecationReason)&&void 0!==n?n:void 0}})):void 0}function h(t){if(t&&t.length>0){const n=[],i=[];for(const r of t){const t=r.name.value,o=e.getDirective(t);if(!o)throw new GraphQLError(`Cannot find directive "${t}".`,{nodes:r});n.push({name:t,arguments:f(o,r.arguments)});const s=v(r,o);s&&i.push(s)}return[n,i.length>0?i:void 0]}}function v(e,t){var n;if("include"==t.name||"skip"==t.name){const i=null===(n=e.arguments)||void 0===n?void 0:n[0].value,r="skip"==t.name;switch(null==i?void 0:i.kind){case m.BOOLEAN:return r?i.value?"SKIPPED":"INCLUDED":i.value?"INCLUDED":"SKIPPED";case m.VARIABLE:return{variable:i.name.value,isInverted:r};default:throw new GraphQLError('Conditional inclusion directive has invalid "if" argument.',{nodes:e})}}}}return e.GraphQLEnumType=GraphQLEnumType,e.GraphQLError=GraphQLError,e.GraphQLInputObjectType=GraphQLInputObjectType,e.GraphQLInterfaceType=GraphQLInterfaceType,e.GraphQLObjectType=GraphQLObjectType,e.GraphQLScalarType=GraphQLScalarType,e.GraphQLSchema=GraphQLSchema,e.GraphQLSchemaValidationError=GraphQLSchemaValidationError,e.GraphQLUnionType=GraphQLUnionType,e.Source=Source,e.compileDocument=function(e,t,n,i){return _i(e,t,n,i)},e.loadSchemaFromSources=function(e){var t,n=new Array;for(const i of e)if(i.name.endsWith(".json")){if(t)throw new Error(`Schema search paths can only include one JSON schema definition.\n Found "${t.name} & "${i.name}".`);t=i}else n.push(J(i));var i=function(e){return e.definitions.some((e=>e.kind==m.DIRECTIVE_DEFINITION&&e.name.value==di.name.value))?e:ai([e,mi])}(ai(n));t||function(e){const t=Pn(e);if(0!==t.length)throw new GraphQLSchemaValidationError(t)}(i);const r=t?Yn(function(e){let t=JSON.parse(e);t.data&&(t=t.data);return Bn(t)}(t.body),i,{assumeValid:!0,assumeValidSDL:!0}):zn(i,{assumeValid:!0,assumeValidSDL:!0});return function(e){const t=jt(e);if(0!==t.length)throw new GraphQLSchemaValidationError(t)}(r),r},e.mergeDocuments=function(e){return ai(e)},e.parseOperationDocument=function(e,t){return J(e,{experimentalClientControlledNullability:t})},e.printSchemaToSDL=function(e){return Hn(e)},e.validateDocument=function(e,t,n){return Mn(e,t,ui(n))},Object.defineProperty(e,"__esModule",{value:!0}),e}({});"# +let ApolloCodegenFrontendBundle: String = #"var ApolloCodegenFrontend=function(e){"use strict";function t(e,t){if(!Boolean(e))throw new Error(t)}function n(e){return"object"==typeof e&&null!==e}function i(e,t){if(!Boolean(e))throw new Error(null!=t?t:"Unexpected invariant triggered.")}const r=/\r\n|[\n\r]/g;function o(e,t){let n=0,o=1;for(const s of e.body.matchAll(r)){if("number"==typeof s.index||i(!1),s.index>=t)break;n=s.index+s[0].length,o+=1}return{line:o,column:t+1-n}}function s(e,t){const n=e.locationOffset.column-1,i="".padStart(n)+e.body,r=t.line-1,o=e.locationOffset.line-1,s=t.line+o,c=1===t.line?n:0,u=t.column+c,l=`${e.name}:${s}:${u}\n`,p=i.split(/\r\n|[\n\r]/g),d=p[r];if(d.length>120){const e=Math.floor(u/80),t=u%80,n=[];for(let e=0;e["|",e])),["|","^".padStart(t)],["|",n[e+1]]])}return l+a([[s-1+" |",p[r-1]],[`${s} |`,d],["|","^".padStart(u)],[`${s+1} |`,p[r+1]]])}function a(e){const t=e.filter((([e,t])=>void 0!==t)),n=Math.max(...t.map((([e])=>e.length)));return t.map((([e,t])=>e.padStart(n)+(t?" "+t:""))).join("\n")}class GraphQLError extends Error{constructor(e,...t){var i,r,s;const{nodes:a,source:u,positions:l,path:p,originalError:d,extensions:f}=function(e){const t=e[0];return null==t||"kind"in t||"length"in t?{nodes:t,source:e[1],positions:e[2],path:e[3],originalError:e[4],extensions:e[5]}:t}(t);super(e),this.name="GraphQLError",this.path=null!=p?p:void 0,this.originalError=null!=d?d:void 0,this.nodes=c(Array.isArray(a)?a:a?[a]:void 0);const h=c(null===(i=this.nodes)||void 0===i?void 0:i.map((e=>e.loc)).filter((e=>null!=e)));this.source=null!=u?u:null==h||null===(r=h[0])||void 0===r?void 0:r.source,this.positions=null!=l?l:null==h?void 0:h.map((e=>e.start)),this.locations=l&&u?l.map((e=>o(u,e))):null==h?void 0:h.map((e=>o(e.source,e.start)));const m=n(null==d?void 0:d.extensions)?null==d?void 0:d.extensions:void 0;this.extensions=null!==(s=null!=f?f:m)&&void 0!==s?s:Object.create(null),Object.defineProperties(this,{message:{writable:!0,enumerable:!0},name:{enumerable:!1},nodes:{enumerable:!1},source:{enumerable:!1},positions:{enumerable:!1},originalError:{enumerable:!1}}),null!=d&&d.stack?Object.defineProperty(this,"stack",{value:d.stack,writable:!0,configurable:!0}):Error.captureStackTrace?Error.captureStackTrace(this,GraphQLError):Object.defineProperty(this,"stack",{value:Error().stack,writable:!0,configurable:!0})}get[Symbol.toStringTag](){return"GraphQLError"}toString(){let e=this.message;if(this.nodes)for(const n of this.nodes)n.loc&&(e+="\n\n"+s((t=n.loc).source,o(t.source,t.start)));else if(this.source&&this.locations)for(const t of this.locations)e+="\n\n"+s(this.source,t);var t;return e}toJSON(){const e={message:this.message};return null!=this.locations&&(e.locations=this.locations),null!=this.path&&(e.path=this.path),null!=this.extensions&&Object.keys(this.extensions).length>0&&(e.extensions=this.extensions),e}}function c(e){return void 0===e||0===e.length?void 0:e}function u(e,t,n){return new GraphQLError(`Syntax Error: ${n}`,void 0,e,[t])}class Location{constructor(e,t,n){this.start=e.start,this.end=t.end,this.startToken=e,this.endToken=t,this.source=n}get[Symbol.toStringTag](){return"Location"}toJSON(){return{start:this.start,end:this.end}}}class Token{constructor(e,t,n,i,r,o){this.kind=e,this.start=t,this.end=n,this.line=i,this.column=r,this.value=o,this.prev=null,this.next=null}get[Symbol.toStringTag](){return"Token"}toJSON(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}}}const l={Name:[],Document:["definitions"],OperationDefinition:["name","variableDefinitions","directives","selectionSet"],VariableDefinition:["variable","type","defaultValue","directives"],Variable:["name"],SelectionSet:["selections"],Field:["alias","name","arguments","directives","selectionSet","required"],ListNullability:["element"],RequiredDesignator:["element"],OptionalDesignator:["element"],Argument:["name","value"],FragmentSpread:["name","directives"],InlineFragment:["typeCondition","directives","selectionSet"],FragmentDefinition:["name","variableDefinitions","typeCondition","directives","selectionSet"],IntValue:[],FloatValue:[],StringValue:[],BooleanValue:[],NullValue:[],EnumValue:[],ListValue:["values"],ObjectValue:["fields"],ObjectField:["name","value"],Directive:["name","arguments"],NamedType:["name"],ListType:["type"],NonNullType:["type"],SchemaDefinition:["description","directives","operationTypes"],OperationTypeDefinition:["type"],ScalarTypeDefinition:["description","name","directives"],ObjectTypeDefinition:["description","name","interfaces","directives","fields"],FieldDefinition:["description","name","arguments","type","directives"],InputValueDefinition:["description","name","type","defaultValue","directives"],InterfaceTypeDefinition:["description","name","interfaces","directives","fields"],UnionTypeDefinition:["description","name","directives","types"],EnumTypeDefinition:["description","name","directives","values"],EnumValueDefinition:["description","name","directives"],InputObjectTypeDefinition:["description","name","directives","fields"],DirectiveDefinition:["description","name","arguments","locations"],SchemaExtension:["directives","operationTypes"],ScalarTypeExtension:["name","directives"],ObjectTypeExtension:["name","interfaces","directives","fields"],InterfaceTypeExtension:["name","interfaces","directives","fields"],UnionTypeExtension:["name","directives","types"],EnumTypeExtension:["name","directives","values"],InputObjectTypeExtension:["name","directives","fields"]},p=new Set(Object.keys(l));function d(e){const t=null==e?void 0:e.kind;return"string"==typeof t&&p.has(t)}let f,h,m,v;function y(e){return 9===e||32===e}function E(e){return e>=48&&e<=57}function T(e){return e>=97&&e<=122||e>=65&&e<=90}function N(e){return T(e)||95===e}function I(e){return T(e)||E(e)||95===e}function g(e){var t;let n=Number.MAX_SAFE_INTEGER,i=null,r=-1;for(let t=0;t0===t?e:e.slice(n))).slice(null!==(t=i)&&void 0!==t?t:0,r+1)}function _(e){let t=0;for(;t",e.EOF="",e.BANG="!",e.QUESTION_MARK="?",e.DOLLAR="$",e.AMP="&",e.PAREN_L="(",e.PAREN_R=")",e.SPREAD="...",e.COLON=":",e.EQUALS="=",e.AT="@",e.BRACKET_L="[",e.BRACKET_R="]",e.BRACE_L="{",e.PIPE="|",e.BRACE_R="}",e.NAME="Name",e.INT="Int",e.FLOAT="Float",e.STRING="String",e.BLOCK_STRING="BlockString",e.COMMENT="Comment"}(v||(v={}));class Lexer{constructor(e){const t=new Token(v.SOF,0,0,0,0);this.source=e,this.lastToken=t,this.token=t,this.line=1,this.lineStart=0}get[Symbol.toStringTag](){return"Lexer"}advance(){this.lastToken=this.token;return this.token=this.lookahead()}lookahead(){let e=this.token;if(e.kind!==v.EOF)do{if(e.next)e=e.next;else{const t=k(this,e.end);e.next=t,t.prev=e,e=t}}while(e.kind===v.COMMENT);return e}}function b(e){return e>=0&&e<=55295||e>=57344&&e<=1114111}function L(e,t){return S(e.charCodeAt(t))&&A(e.charCodeAt(t+1))}function S(e){return e>=55296&&e<=56319}function A(e){return e>=56320&&e<=57343}function D(e,t){const n=e.source.body.codePointAt(t);if(void 0===n)return v.EOF;if(n>=32&&n<=126){const e=String.fromCodePoint(n);return'"'===e?"'\"'":`"${e}"`}return"U+"+n.toString(16).toUpperCase().padStart(4,"0")}function w(e,t,n,i,r){const o=e.line,s=1+n-e.lineStart;return new Token(t,n,i,o,s,r)}function k(e,t){const n=e.source.body,i=n.length;let r=t;for(;r=48&&e<=57?e-48:e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:-1}function j(e,t){const n=e.source.body;switch(n.charCodeAt(t+1)){case 34:return{value:'"',size:2};case 92:return{value:"\\",size:2};case 47:return{value:"/",size:2};case 98:return{value:"\b",size:2};case 102:return{value:"\f",size:2};case 110:return{value:"\n",size:2};case 114:return{value:"\r",size:2};case 116:return{value:"\t",size:2}}throw u(e.source,t,`Invalid character escape sequence: "${n.slice(t,t+2)}".`)}function V(e,t){const n=e.source.body,i=n.length;let r=e.lineStart,o=t+3,s=o,a="";const c=[];for(;oB)return"[Array]";const n=Math.min(P,e.length),i=e.length-n,r=[];for(let i=0;i1&&r.push(`... ${i} more items`);return"["+r.join(", ")+"]"}(e,n);return function(e,t){const n=Object.entries(e);if(0===n.length)return"{}";if(t.length>B)return"["+function(e){const t=Object.prototype.toString.call(e).replace(/^\[object /,"").replace(/]$/,"");if("Object"===t&&"function"==typeof e.constructor){const t=e.constructor.name;if("string"==typeof t&&""!==t)return t}return t}(e)+"]";const i=n.map((([e,n])=>e+": "+J(n,t)));return"{ "+i.join(", ")+" }"}(e,n)}(e,t);default:return String(e)}}const q=function(e,t){return e instanceof t};class Source{constructor(e,n="GraphQL request",i={line:1,column:1}){"string"==typeof e||t(!1,`Body must be a string. Received: ${Y(e)}.`),this.body=e,this.name=n,this.locationOffset=i,this.locationOffset.line>0||t(!1,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||t(!1,"column in locationOffset is 1-indexed and must be positive.")}get[Symbol.toStringTag](){return"Source"}}function K(e,t){return new Parser(e,t).parseDocument()}class Parser{constructor(e,t){const n=function(e){return q(e,Source)}(e)?e:new Source(e);this._lexer=new Lexer(n),this._options=t}parseName(){const e=this.expectToken(v.NAME);return this.node(e,{kind:m.NAME,value:e.value})}parseDocument(){return this.node(this._lexer.token,{kind:m.DOCUMENT,definitions:this.many(v.SOF,this.parseDefinition,v.EOF)})}parseDefinition(){if(this.peek(v.BRACE_L))return this.parseOperationDefinition();const e=this.peekDescription(),t=e?this._lexer.lookahead():this._lexer.token;if(t.kind===v.NAME){switch(t.value){case"schema":return this.parseSchemaDefinition();case"scalar":return this.parseScalarTypeDefinition();case"type":return this.parseObjectTypeDefinition();case"interface":return this.parseInterfaceTypeDefinition();case"union":return this.parseUnionTypeDefinition();case"enum":return this.parseEnumTypeDefinition();case"input":return this.parseInputObjectTypeDefinition();case"directive":return this.parseDirectiveDefinition()}if(e)throw u(this._lexer.source,this._lexer.token.start,"Unexpected description, descriptions are supported only on type definitions.");switch(t.value){case"query":case"mutation":case"subscription":return this.parseOperationDefinition();case"fragment":return this.parseFragmentDefinition();case"extend":return this.parseTypeSystemExtension()}}throw this.unexpected(t)}parseOperationDefinition(){const e=this._lexer.token;if(this.peek(v.BRACE_L))return this.node(e,{kind:m.OPERATION_DEFINITION,operation:f.QUERY,name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet()});const t=this.parseOperationType();let n;return this.peek(v.NAME)&&(n=this.parseName()),this.node(e,{kind:m.OPERATION_DEFINITION,operation:t,name:n,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseOperationType(){const e=this.expectToken(v.NAME);switch(e.value){case"query":return f.QUERY;case"mutation":return f.MUTATION;case"subscription":return f.SUBSCRIPTION}throw this.unexpected(e)}parseVariableDefinitions(){return this.optionalMany(v.PAREN_L,this.parseVariableDefinition,v.PAREN_R)}parseVariableDefinition(){return this.node(this._lexer.token,{kind:m.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(v.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(v.EQUALS)?this.parseConstValueLiteral():void 0,directives:this.parseConstDirectives()})}parseVariable(){const e=this._lexer.token;return this.expectToken(v.DOLLAR),this.node(e,{kind:m.VARIABLE,name:this.parseName()})}parseSelectionSet(){return this.node(this._lexer.token,{kind:m.SELECTION_SET,selections:this.many(v.BRACE_L,this.parseSelection,v.BRACE_R)})}parseSelection(){return this.peek(v.SPREAD)?this.parseFragment():this.parseField()}parseField(){var e;const t=this._lexer.token,n=this.parseName();let i,r;this.expectOptionalToken(v.COLON)?(i=n,r=this.parseName()):r=n;const o=this.parseArguments(!1),s=null!==(e=this._options)&&void 0!==e&&e.experimentalClientControlledNullability?this.parseRequiredStatus():void 0,a=this.parseDirectives(!1),c=this.peek(v.BRACE_L)?this.parseSelectionSet():void 0;return this.node(t,{kind:m.FIELD,alias:i,name:r,arguments:o,required:s,directives:a,selectionSet:c})}parseRequiredStatus(){const e=this.parseListNullability(),t=this.parseNullabilityDesignatorNode(e);return null!=t?t:e}parseListNullability(){const e=this._lexer.token;if(this.expectOptionalToken(v.BRACKET_L)){const t=this.parseRequiredStatus();return this.expectToken(v.BRACKET_R),this.node(e,{kind:m.LIST_NULLABILITY,element:t})}}parseNullabilityDesignatorNode(e){var t;return null!==(t=this.parseRequiredDesignatorNode(e))&&void 0!==t?t:this.parseOptionalDesignatorNode(e)}parseRequiredDesignatorNode(e){const t=this._lexer.token;if(this.expectOptionalToken(v.BANG))return this.node(t,{kind:m.REQUIRED_DESIGNATOR,element:e})}parseOptionalDesignatorNode(e){const t=this._lexer.token;if(this.expectOptionalToken(v.QUESTION_MARK))return this.node(t,{kind:m.OPTIONAL_DESIGNATOR,element:e})}parseArguments(e){const t=e?this.parseConstArgument:this.parseArgument;return this.optionalMany(v.PAREN_L,t,v.PAREN_R)}parseArgument(e=!1){const t=this._lexer.token,n=this.parseName();return this.expectToken(v.COLON),this.node(t,{kind:m.ARGUMENT,name:n,value:this.parseValueLiteral(e)})}parseConstArgument(){return this.parseArgument(!0)}parseFragment(){const e=this._lexer.token;this.expectToken(v.SPREAD);const t=this.expectOptionalKeyword("on");return!t&&this.peek(v.NAME)?this.node(e,{kind:m.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1)}):this.node(e,{kind:m.INLINE_FRAGMENT,typeCondition:t?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentDefinition(){var e;const t=this._lexer.token;return this.expectKeyword("fragment"),!0===(null===(e=this._options)||void 0===e?void 0:e.allowLegacyFragmentVariables)?this.node(t,{kind:m.FRAGMENT_DEFINITION,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()}):this.node(t,{kind:m.FRAGMENT_DEFINITION,name:this.parseFragmentName(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentName(){if("on"===this._lexer.token.value)throw this.unexpected();return this.parseName()}parseValueLiteral(e){const t=this._lexer.token;switch(t.kind){case v.BRACKET_L:return this.parseList(e);case v.BRACE_L:return this.parseObject(e);case v.INT:return this._lexer.advance(),this.node(t,{kind:m.INT,value:t.value});case v.FLOAT:return this._lexer.advance(),this.node(t,{kind:m.FLOAT,value:t.value});case v.STRING:case v.BLOCK_STRING:return this.parseStringLiteral();case v.NAME:switch(this._lexer.advance(),t.value){case"true":return this.node(t,{kind:m.BOOLEAN,value:!0});case"false":return this.node(t,{kind:m.BOOLEAN,value:!1});case"null":return this.node(t,{kind:m.NULL});default:return this.node(t,{kind:m.ENUM,value:t.value})}case v.DOLLAR:if(e){if(this.expectToken(v.DOLLAR),this._lexer.token.kind===v.NAME){const e=this._lexer.token.value;throw u(this._lexer.source,t.start,`Unexpected variable "$${e}" in constant value.`)}throw this.unexpected(t)}return this.parseVariable();default:throw this.unexpected()}}parseConstValueLiteral(){return this.parseValueLiteral(!0)}parseStringLiteral(){const e=this._lexer.token;return this._lexer.advance(),this.node(e,{kind:m.STRING,value:e.value,block:e.kind===v.BLOCK_STRING})}parseList(e){return this.node(this._lexer.token,{kind:m.LIST,values:this.any(v.BRACKET_L,(()=>this.parseValueLiteral(e)),v.BRACKET_R)})}parseObject(e){return this.node(this._lexer.token,{kind:m.OBJECT,fields:this.any(v.BRACE_L,(()=>this.parseObjectField(e)),v.BRACE_R)})}parseObjectField(e){const t=this._lexer.token,n=this.parseName();return this.expectToken(v.COLON),this.node(t,{kind:m.OBJECT_FIELD,name:n,value:this.parseValueLiteral(e)})}parseDirectives(e){const t=[];for(;this.peek(v.AT);)t.push(this.parseDirective(e));return t}parseConstDirectives(){return this.parseDirectives(!0)}parseDirective(e){const t=this._lexer.token;return this.expectToken(v.AT),this.node(t,{kind:m.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(e)})}parseTypeReference(){const e=this._lexer.token;let t;if(this.expectOptionalToken(v.BRACKET_L)){const n=this.parseTypeReference();this.expectToken(v.BRACKET_R),t=this.node(e,{kind:m.LIST_TYPE,type:n})}else t=this.parseNamedType();return this.expectOptionalToken(v.BANG)?this.node(e,{kind:m.NON_NULL_TYPE,type:t}):t}parseNamedType(){return this.node(this._lexer.token,{kind:m.NAMED_TYPE,name:this.parseName()})}peekDescription(){return this.peek(v.STRING)||this.peek(v.BLOCK_STRING)}parseDescription(){if(this.peekDescription())return this.parseStringLiteral()}parseSchemaDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("schema");const n=this.parseConstDirectives(),i=this.many(v.BRACE_L,this.parseOperationTypeDefinition,v.BRACE_R);return this.node(e,{kind:m.SCHEMA_DEFINITION,description:t,directives:n,operationTypes:i})}parseOperationTypeDefinition(){const e=this._lexer.token,t=this.parseOperationType();this.expectToken(v.COLON);const n=this.parseNamedType();return this.node(e,{kind:m.OPERATION_TYPE_DEFINITION,operation:t,type:n})}parseScalarTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("scalar");const n=this.parseName(),i=this.parseConstDirectives();return this.node(e,{kind:m.SCALAR_TYPE_DEFINITION,description:t,name:n,directives:i})}parseObjectTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("type");const n=this.parseName(),i=this.parseImplementsInterfaces(),r=this.parseConstDirectives(),o=this.parseFieldsDefinition();return this.node(e,{kind:m.OBJECT_TYPE_DEFINITION,description:t,name:n,interfaces:i,directives:r,fields:o})}parseImplementsInterfaces(){return this.expectOptionalKeyword("implements")?this.delimitedMany(v.AMP,this.parseNamedType):[]}parseFieldsDefinition(){return this.optionalMany(v.BRACE_L,this.parseFieldDefinition,v.BRACE_R)}parseFieldDefinition(){const e=this._lexer.token,t=this.parseDescription(),n=this.parseName(),i=this.parseArgumentDefs();this.expectToken(v.COLON);const r=this.parseTypeReference(),o=this.parseConstDirectives();return this.node(e,{kind:m.FIELD_DEFINITION,description:t,name:n,arguments:i,type:r,directives:o})}parseArgumentDefs(){return this.optionalMany(v.PAREN_L,this.parseInputValueDef,v.PAREN_R)}parseInputValueDef(){const e=this._lexer.token,t=this.parseDescription(),n=this.parseName();this.expectToken(v.COLON);const i=this.parseTypeReference();let r;this.expectOptionalToken(v.EQUALS)&&(r=this.parseConstValueLiteral());const o=this.parseConstDirectives();return this.node(e,{kind:m.INPUT_VALUE_DEFINITION,description:t,name:n,type:i,defaultValue:r,directives:o})}parseInterfaceTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("interface");const n=this.parseName(),i=this.parseImplementsInterfaces(),r=this.parseConstDirectives(),o=this.parseFieldsDefinition();return this.node(e,{kind:m.INTERFACE_TYPE_DEFINITION,description:t,name:n,interfaces:i,directives:r,fields:o})}parseUnionTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("union");const n=this.parseName(),i=this.parseConstDirectives(),r=this.parseUnionMemberTypes();return this.node(e,{kind:m.UNION_TYPE_DEFINITION,description:t,name:n,directives:i,types:r})}parseUnionMemberTypes(){return this.expectOptionalToken(v.EQUALS)?this.delimitedMany(v.PIPE,this.parseNamedType):[]}parseEnumTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("enum");const n=this.parseName(),i=this.parseConstDirectives(),r=this.parseEnumValuesDefinition();return this.node(e,{kind:m.ENUM_TYPE_DEFINITION,description:t,name:n,directives:i,values:r})}parseEnumValuesDefinition(){return this.optionalMany(v.BRACE_L,this.parseEnumValueDefinition,v.BRACE_R)}parseEnumValueDefinition(){const e=this._lexer.token,t=this.parseDescription(),n=this.parseEnumValueName(),i=this.parseConstDirectives();return this.node(e,{kind:m.ENUM_VALUE_DEFINITION,description:t,name:n,directives:i})}parseEnumValueName(){if("true"===this._lexer.token.value||"false"===this._lexer.token.value||"null"===this._lexer.token.value)throw u(this._lexer.source,this._lexer.token.start,`${X(this._lexer.token)} is reserved and cannot be used for an enum value.`);return this.parseName()}parseInputObjectTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("input");const n=this.parseName(),i=this.parseConstDirectives(),r=this.parseInputFieldsDefinition();return this.node(e,{kind:m.INPUT_OBJECT_TYPE_DEFINITION,description:t,name:n,directives:i,fields:r})}parseInputFieldsDefinition(){return this.optionalMany(v.BRACE_L,this.parseInputValueDef,v.BRACE_R)}parseTypeSystemExtension(){const e=this._lexer.lookahead();if(e.kind===v.NAME)switch(e.value){case"schema":return this.parseSchemaExtension();case"scalar":return this.parseScalarTypeExtension();case"type":return this.parseObjectTypeExtension();case"interface":return this.parseInterfaceTypeExtension();case"union":return this.parseUnionTypeExtension();case"enum":return this.parseEnumTypeExtension();case"input":return this.parseInputObjectTypeExtension()}throw this.unexpected(e)}parseSchemaExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");const t=this.parseConstDirectives(),n=this.optionalMany(v.BRACE_L,this.parseOperationTypeDefinition,v.BRACE_R);if(0===t.length&&0===n.length)throw this.unexpected();return this.node(e,{kind:m.SCHEMA_EXTENSION,directives:t,operationTypes:n})}parseScalarTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("scalar");const t=this.parseName(),n=this.parseConstDirectives();if(0===n.length)throw this.unexpected();return this.node(e,{kind:m.SCALAR_TYPE_EXTENSION,name:t,directives:n})}parseObjectTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");const t=this.parseName(),n=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),r=this.parseFieldsDefinition();if(0===n.length&&0===i.length&&0===r.length)throw this.unexpected();return this.node(e,{kind:m.OBJECT_TYPE_EXTENSION,name:t,interfaces:n,directives:i,fields:r})}parseInterfaceTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");const t=this.parseName(),n=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),r=this.parseFieldsDefinition();if(0===n.length&&0===i.length&&0===r.length)throw this.unexpected();return this.node(e,{kind:m.INTERFACE_TYPE_EXTENSION,name:t,interfaces:n,directives:i,fields:r})}parseUnionTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");const t=this.parseName(),n=this.parseConstDirectives(),i=this.parseUnionMemberTypes();if(0===n.length&&0===i.length)throw this.unexpected();return this.node(e,{kind:m.UNION_TYPE_EXTENSION,name:t,directives:n,types:i})}parseEnumTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");const t=this.parseName(),n=this.parseConstDirectives(),i=this.parseEnumValuesDefinition();if(0===n.length&&0===i.length)throw this.unexpected();return this.node(e,{kind:m.ENUM_TYPE_EXTENSION,name:t,directives:n,values:i})}parseInputObjectTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");const t=this.parseName(),n=this.parseConstDirectives(),i=this.parseInputFieldsDefinition();if(0===n.length&&0===i.length)throw this.unexpected();return this.node(e,{kind:m.INPUT_OBJECT_TYPE_EXTENSION,name:t,directives:n,fields:i})}parseDirectiveDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("directive"),this.expectToken(v.AT);const n=this.parseName(),i=this.parseArgumentDefs(),r=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");const o=this.parseDirectiveLocations();return this.node(e,{kind:m.DIRECTIVE_DEFINITION,description:t,name:n,arguments:i,repeatable:r,locations:o})}parseDirectiveLocations(){return this.delimitedMany(v.PIPE,this.parseDirectiveLocation)}parseDirectiveLocation(){const e=this._lexer.token,t=this.parseName();if(Object.prototype.hasOwnProperty.call(h,t.value))return t;throw this.unexpected(e)}node(e,t){var n;return!0!==(null===(n=this._options)||void 0===n?void 0:n.noLocation)&&(t.loc=new Location(e,this._lexer.lastToken,this._lexer.source)),t}peek(e){return this._lexer.token.kind===e}expectToken(e){const t=this._lexer.token;if(t.kind===e)return this._lexer.advance(),t;throw u(this._lexer.source,t.start,`Expected ${z(e)}, found ${X(t)}.`)}expectOptionalToken(e){return this._lexer.token.kind===e&&(this._lexer.advance(),!0)}expectKeyword(e){const t=this._lexer.token;if(t.kind!==v.NAME||t.value!==e)throw u(this._lexer.source,t.start,`Expected "${e}", found ${X(t)}.`);this._lexer.advance()}expectOptionalKeyword(e){const t=this._lexer.token;return t.kind===v.NAME&&t.value===e&&(this._lexer.advance(),!0)}unexpected(e){const t=null!=e?e:this._lexer.token;return u(this._lexer.source,t.start,`Unexpected ${X(t)}.`)}any(e,t,n){this.expectToken(e);const i=[];for(;!this.expectOptionalToken(n);)i.push(t.call(this));return i}optionalMany(e,t,n){if(this.expectOptionalToken(e)){const e=[];do{e.push(t.call(this))}while(!this.expectOptionalToken(n));return e}return[]}many(e,t,n){this.expectToken(e);const i=[];do{i.push(t.call(this))}while(!this.expectOptionalToken(n));return i}delimitedMany(e,t){this.expectOptionalToken(e);const n=[];do{n.push(t.call(this))}while(this.expectOptionalToken(e));return n}}function X(e){const t=e.value;return z(e.kind)+(null!=t?` "${t}"`:"")}function z(e){return function(e){return e===v.BANG||e===v.QUESTION_MARK||e===v.DOLLAR||e===v.AMP||e===v.PAREN_L||e===v.PAREN_R||e===v.SPREAD||e===v.COLON||e===v.EQUALS||e===v.AT||e===v.BRACKET_L||e===v.BRACKET_R||e===v.BRACE_L||e===v.PIPE||e===v.BRACE_R}(e)?`"${e}"`:e}const H=5;function W(e,t){const[n,i]=t?[e,t]:[void 0,e];let r=" Did you mean ";n&&(r+=n+" ");const o=i.map((e=>`"${e}"`));switch(o.length){case 0:return"";case 1:return r+o[0]+"?";case 2:return r+o[0]+" or "+o[1]+"?"}const s=o.slice(0,H),a=s.pop();return r+s.join(", ")+", or "+a+"?"}function Z(e){return e}function ee(e,t){const n=Object.create(null);for(const i of e)n[t(i)]=i;return n}function te(e,t,n){const i=Object.create(null);for(const r of e)i[t(r)]=n(r);return i}function ne(e,t){const n=Object.create(null);for(const i of Object.keys(e))n[i]=t(e[i],i);return n}function ie(e,t){let n=0,i=0;for(;n0);let a=0;do{++i,a=10*a+o-re,o=t.charCodeAt(i)}while(se(o)&&a>0);if(sa)return 1}else{if(ro)return 1;++n,++i}}return e.length-t.length}const re=48,oe=57;function se(e){return!isNaN(e)&&re<=e&&e<=oe}function ae(e,t){const n=Object.create(null),i=new LexicalDistance(e),r=Math.floor(.4*e.length)+1;for(const e of t){const t=i.measure(e,r);void 0!==t&&(n[e]=t)}return Object.keys(n).sort(((e,t)=>{const i=n[e]-n[t];return 0!==i?i:ie(e,t)}))}class LexicalDistance{constructor(e){this._input=e,this._inputLowerCase=e.toLowerCase(),this._inputArray=ce(this._inputLowerCase),this._rows=[new Array(e.length+1).fill(0),new Array(e.length+1).fill(0),new Array(e.length+1).fill(0)]}measure(e,t){if(this._input===e)return 0;const n=e.toLowerCase();if(this._inputLowerCase===n)return 1;let i=ce(n),r=this._inputArray;if(i.lengtht)return;const a=this._rows;for(let e=0;e<=s;e++)a[0][e]=e;for(let e=1;e<=o;e++){const n=a[(e-1)%3],o=a[e%3];let c=o[0]=e;for(let t=1;t<=s;t++){const s=i[e-1]===r[t-1]?0:1;let u=Math.min(n[t]+1,o[t-1]+1,n[t-1]+s);if(e>1&&t>1&&i[e-1]===r[t-2]&&i[e-2]===r[t-1]){const n=a[(e-2)%3][t-2];u=Math.min(u,n+1)}ut)return}const c=a[o%3][s];return c<=t?c:void 0}}function ce(e){const t=e.length,n=new Array(t);for(let i=0;ie.value},Variable:{leave:e=>"$"+e.name},Document:{leave:e=>Te(e.definitions,"\n\n")},OperationDefinition:{leave(e){const t=Ie("(",Te(e.variableDefinitions,", "),")"),n=Te([e.operation,Te([e.name,t]),Te(e.directives," ")]," ");return("query"===n?"":n+" ")+e.selectionSet}},VariableDefinition:{leave:({variable:e,type:t,defaultValue:n,directives:i})=>e+": "+t+Ie(" = ",n)+Ie(" ",Te(i," "))},SelectionSet:{leave:({selections:e})=>Ne(e)},Field:{leave({alias:e,name:t,arguments:n,directives:i,selectionSet:r,required:o}){const s=Te([Ie("",e,": "),t],"");let a=s+Ie("(",Te(n,", "),")");a.length>80&&(a=s+Ie("(\n",ge(Te(n,"\n")),"\n)"));const c=Te([a,o],"");return Te([c,Te(i," "),r]," ")}},RequiredDesignator:{leave:({element:e})=>(null!=e?e:"")+"!"},OptionalDesignator:{leave:({element:e})=>(null!=e?e:"")+"?"},ListNullability:{leave:({element:e})=>"["+(null!=e?e:"")+"]"},Argument:{leave:({name:e,value:t})=>e+": "+t},FragmentSpread:{leave:({name:e,directives:t})=>"..."+e+Ie(" ",Te(t," "))},InlineFragment:{leave:({typeCondition:e,directives:t,selectionSet:n})=>Te(["...",Ie("on ",e),Te(t," "),n]," ")},FragmentDefinition:{leave:({name:e,typeCondition:t,variableDefinitions:n,directives:i,selectionSet:r})=>`fragment ${e}${Ie("(",Te(n,", "),")")} on ${t} ${Ie("",Te(i," ")," ")}`+r},IntValue:{leave:({value:e})=>e},FloatValue:{leave:({value:e})=>e},StringValue:{leave:({value:e,block:t})=>t?function(e,t){const n=e.replace(/"""/g,'\\"""'),i=n.split(/\r\n|[\n\r]/g),r=1===i.length,o=i.length>1&&i.slice(1).every((e=>0===e.length||y(e.charCodeAt(0)))),s=n.endsWith('\\"""'),a=e.endsWith('"')&&!s,c=e.endsWith("\\"),u=a||c,l=!(null!=t&&t.minimize)&&(!r||e.length>70||u||o||s);let p="";const d=r&&y(e.charCodeAt(0));return(l&&!d||o)&&(p+="\n"),p+=n,(l||u)&&(p+="\n"),'"""'+p+'"""'}(e):`"${e.replace(le,pe)}"`},BooleanValue:{leave:({value:e})=>e?"true":"false"},NullValue:{leave:()=>"null"},EnumValue:{leave:({value:e})=>e},ListValue:{leave:({values:e})=>"["+Te(e,", ")+"]"},ObjectValue:{leave:({fields:e})=>"{"+Te(e,", ")+"}"},ObjectField:{leave:({name:e,value:t})=>e+": "+t},Directive:{leave:({name:e,arguments:t})=>"@"+e+Ie("(",Te(t,", "),")")},NamedType:{leave:({name:e})=>e},ListType:{leave:({type:e})=>"["+e+"]"},NonNullType:{leave:({type:e})=>e+"!"},SchemaDefinition:{leave:({description:e,directives:t,operationTypes:n})=>Ie("",e,"\n")+Te(["schema",Te(t," "),Ne(n)]," ")},OperationTypeDefinition:{leave:({operation:e,type:t})=>e+": "+t},ScalarTypeDefinition:{leave:({description:e,name:t,directives:n})=>Ie("",e,"\n")+Te(["scalar",t,Te(n," ")]," ")},ObjectTypeDefinition:{leave:({description:e,name:t,interfaces:n,directives:i,fields:r})=>Ie("",e,"\n")+Te(["type",t,Ie("implements ",Te(n," & ")),Te(i," "),Ne(r)]," ")},FieldDefinition:{leave:({description:e,name:t,arguments:n,type:i,directives:r})=>Ie("",e,"\n")+t+(_e(n)?Ie("(\n",ge(Te(n,"\n")),"\n)"):Ie("(",Te(n,", "),")"))+": "+i+Ie(" ",Te(r," "))},InputValueDefinition:{leave:({description:e,name:t,type:n,defaultValue:i,directives:r})=>Ie("",e,"\n")+Te([t+": "+n,Ie("= ",i),Te(r," ")]," ")},InterfaceTypeDefinition:{leave:({description:e,name:t,interfaces:n,directives:i,fields:r})=>Ie("",e,"\n")+Te(["interface",t,Ie("implements ",Te(n," & ")),Te(i," "),Ne(r)]," ")},UnionTypeDefinition:{leave:({description:e,name:t,directives:n,types:i})=>Ie("",e,"\n")+Te(["union",t,Te(n," "),Ie("= ",Te(i," | "))]," ")},EnumTypeDefinition:{leave:({description:e,name:t,directives:n,values:i})=>Ie("",e,"\n")+Te(["enum",t,Te(n," "),Ne(i)]," ")},EnumValueDefinition:{leave:({description:e,name:t,directives:n})=>Ie("",e,"\n")+Te([t,Te(n," ")]," ")},InputObjectTypeDefinition:{leave:({description:e,name:t,directives:n,fields:i})=>Ie("",e,"\n")+Te(["input",t,Te(n," "),Ne(i)]," ")},DirectiveDefinition:{leave:({description:e,name:t,arguments:n,repeatable:i,locations:r})=>Ie("",e,"\n")+"directive @"+t+(_e(n)?Ie("(\n",ge(Te(n,"\n")),"\n)"):Ie("(",Te(n,", "),")"))+(i?" repeatable":"")+" on "+Te(r," | ")},SchemaExtension:{leave:({directives:e,operationTypes:t})=>Te(["extend schema",Te(e," "),Ne(t)]," ")},ScalarTypeExtension:{leave:({name:e,directives:t})=>Te(["extend scalar",e,Te(t," ")]," ")},ObjectTypeExtension:{leave:({name:e,interfaces:t,directives:n,fields:i})=>Te(["extend type",e,Ie("implements ",Te(t," & ")),Te(n," "),Ne(i)]," ")},InterfaceTypeExtension:{leave:({name:e,interfaces:t,directives:n,fields:i})=>Te(["extend interface",e,Ie("implements ",Te(t," & ")),Te(n," "),Ne(i)]," ")},UnionTypeExtension:{leave:({name:e,directives:t,types:n})=>Te(["extend union",e,Te(t," "),Ie("= ",Te(n," | "))]," ")},EnumTypeExtension:{leave:({name:e,directives:t,values:n})=>Te(["extend enum",e,Te(t," "),Ne(n)]," ")},InputObjectTypeExtension:{leave:({name:e,directives:t,fields:n})=>Te(["extend input",e,Te(t," "),Ne(n)]," ")}};function Te(e,t=""){var n;return null!==(n=null==e?void 0:e.filter((e=>e)).join(t))&&void 0!==n?n:""}function Ne(e){return Ie("{\n",ge(Te(e,"\n")),"\n}")}function Ie(e,t,n=""){return null!=t&&""!==t?e+t+n:""}function ge(e){return Ie(" ",e.replace(/\n/g,"\n "))}function _e(e){var t;return null!==(t=null==e?void 0:e.some((e=>e.includes("\n"))))&&void 0!==t&&t}function Oe(e,t){switch(e.kind){case m.NULL:return null;case m.INT:return parseInt(e.value,10);case m.FLOAT:return parseFloat(e.value);case m.STRING:case m.ENUM:case m.BOOLEAN:return e.value;case m.LIST:return e.values.map((e=>Oe(e,t)));case m.OBJECT:return te(e.fields,(e=>e.name.value),(e=>Oe(e.value,t)));case m.VARIABLE:return null==t?void 0:t[e.name.value]}}function be(e){if(null!=e||t(!1,"Must provide name."),"string"==typeof e||t(!1,"Expected name to be a string."),0===e.length)throw new GraphQLError("Expected name to be a non-empty string.");for(let t=1;ts(Oe(e,t)),this.extensions=ue(e.extensions),this.astNode=e.astNode,this.extensionASTNodes=null!==(o=e.extensionASTNodes)&&void 0!==o?o:[],null==e.specifiedByURL||"string"==typeof e.specifiedByURL||t(!1,`${this.name} must provide "specifiedByURL" as a string, but got: ${Y(e.specifiedByURL)}.`),null==e.serialize||"function"==typeof e.serialize||t(!1,`${this.name} must provide "serialize" function. If this custom Scalar is also used as an input type, ensure "parseValue" and "parseLiteral" functions are also provided.`),e.parseLiteral&&("function"==typeof e.parseValue&&"function"==typeof e.parseLiteral||t(!1,`${this.name} must provide both "parseValue" and "parseLiteral" functions.`))}get[Symbol.toStringTag](){return"GraphQLScalarType"}toConfig(){return{name:this.name,description:this.description,specifiedByURL:this.specifiedByURL,serialize:this.serialize,parseValue:this.parseValue,parseLiteral:this.parseLiteral,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}class GraphQLObjectType{constructor(e){var n;this.name=be(e.name),this.description=e.description,this.isTypeOf=e.isTypeOf,this.extensions=ue(e.extensions),this.astNode=e.astNode,this.extensionASTNodes=null!==(n=e.extensionASTNodes)&&void 0!==n?n:[],this._fields=()=>ze(e),this._interfaces=()=>Xe(e),null==e.isTypeOf||"function"==typeof e.isTypeOf||t(!1,`${this.name} must provide "isTypeOf" as a function, but got: ${Y(e.isTypeOf)}.`)}get[Symbol.toStringTag](){return"GraphQLObjectType"}getFields(){return"function"==typeof this._fields&&(this._fields=this._fields()),this._fields}getInterfaces(){return"function"==typeof this._interfaces&&(this._interfaces=this._interfaces()),this._interfaces}toConfig(){return{name:this.name,description:this.description,interfaces:this.getInterfaces(),fields:Ze(this.getFields()),isTypeOf:this.isTypeOf,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}function Xe(e){var n;const i=qe(null!==(n=e.interfaces)&&void 0!==n?n:[]);return Array.isArray(i)||t(!1,`${e.name} interfaces must be an Array or a function which returns an Array.`),i}function ze(e){const n=Ke(e.fields);return We(n)||t(!1,`${e.name} fields must be an object with field names as keys or a function which returns such an object.`),ne(n,((n,i)=>{var r;We(n)||t(!1,`${e.name}.${i} field config must be an object.`),null==n.resolve||"function"==typeof n.resolve||t(!1,`${e.name}.${i} field resolver must be a function if provided, but got: ${Y(n.resolve)}.`);const o=null!==(r=n.args)&&void 0!==r?r:{};return We(o)||t(!1,`${e.name}.${i} args must be an object with argument names as keys.`),{name:be(i),description:n.description,type:n.type,args:He(o),resolve:n.resolve,subscribe:n.subscribe,deprecationReason:n.deprecationReason,extensions:ue(n.extensions),astNode:n.astNode}}))}function He(e){return Object.entries(e).map((([e,t])=>({name:be(e),description:t.description,type:t.type,defaultValue:t.defaultValue,deprecationReason:t.deprecationReason,extensions:ue(t.extensions),astNode:t.astNode})))}function We(e){return n(e)&&!Array.isArray(e)}function Ze(e){return ne(e,(e=>({description:e.description,type:e.type,args:et(e.args),resolve:e.resolve,subscribe:e.subscribe,deprecationReason:e.deprecationReason,extensions:e.extensions,astNode:e.astNode})))}function et(e){return te(e,(e=>e.name),(e=>({description:e.description,type:e.type,defaultValue:e.defaultValue,deprecationReason:e.deprecationReason,extensions:e.extensions,astNode:e.astNode})))}function tt(e){return Ge(e.type)&&void 0===e.defaultValue}class GraphQLInterfaceType{constructor(e){var n;this.name=be(e.name),this.description=e.description,this.resolveType=e.resolveType,this.extensions=ue(e.extensions),this.astNode=e.astNode,this.extensionASTNodes=null!==(n=e.extensionASTNodes)&&void 0!==n?n:[],this._fields=ze.bind(void 0,e),this._interfaces=Xe.bind(void 0,e),null==e.resolveType||"function"==typeof e.resolveType||t(!1,`${this.name} must provide "resolveType" as a function, but got: ${Y(e.resolveType)}.`)}get[Symbol.toStringTag](){return"GraphQLInterfaceType"}getFields(){return"function"==typeof this._fields&&(this._fields=this._fields()),this._fields}getInterfaces(){return"function"==typeof this._interfaces&&(this._interfaces=this._interfaces()),this._interfaces}toConfig(){return{name:this.name,description:this.description,interfaces:this.getInterfaces(),fields:Ze(this.getFields()),resolveType:this.resolveType,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}class GraphQLUnionType{constructor(e){var n;this.name=be(e.name),this.description=e.description,this.resolveType=e.resolveType,this.extensions=ue(e.extensions),this.astNode=e.astNode,this.extensionASTNodes=null!==(n=e.extensionASTNodes)&&void 0!==n?n:[],this._types=nt.bind(void 0,e),null==e.resolveType||"function"==typeof e.resolveType||t(!1,`${this.name} must provide "resolveType" as a function, but got: ${Y(e.resolveType)}.`)}get[Symbol.toStringTag](){return"GraphQLUnionType"}getTypes(){return"function"==typeof this._types&&(this._types=this._types()),this._types}toConfig(){return{name:this.name,description:this.description,types:this.getTypes(),resolveType:this.resolveType,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}function nt(e){const n=qe(e.types);return Array.isArray(n)||t(!1,`Must provide Array of types or a function which returns such an array for Union ${e.name}.`),n}class GraphQLEnumType{constructor(e){var n,i,r;this.name=be(e.name),this.description=e.description,this.extensions=ue(e.extensions),this.astNode=e.astNode,this.extensionASTNodes=null!==(n=e.extensionASTNodes)&&void 0!==n?n:[],this._values=(i=this.name,We(r=e.values)||t(!1,`${i} values must be an object with value names as keys.`),Object.entries(r).map((([e,n])=>(We(n)||t(!1,`${i}.${e} must refer to an object with a "value" key representing an internal value but got: ${Y(n)}.`),{name:Le(e),description:n.description,value:void 0!==n.value?n.value:e,deprecationReason:n.deprecationReason,extensions:ue(n.extensions),astNode:n.astNode})))),this._valueLookup=new Map(this._values.map((e=>[e.value,e]))),this._nameLookup=ee(this._values,(e=>e.name))}get[Symbol.toStringTag](){return"GraphQLEnumType"}getValues(){return this._values}getValue(e){return this._nameLookup[e]}serialize(e){const t=this._valueLookup.get(e);if(void 0===t)throw new GraphQLError(`Enum "${this.name}" cannot represent value: ${Y(e)}`);return t.name}parseValue(e){if("string"!=typeof e){const t=Y(e);throw new GraphQLError(`Enum "${this.name}" cannot represent non-string value: ${t}.`+it(this,t))}const t=this.getValue(e);if(null==t)throw new GraphQLError(`Value "${e}" does not exist in "${this.name}" enum.`+it(this,e));return t.value}parseLiteral(e,t){if(e.kind!==m.ENUM){const t=ye(e);throw new GraphQLError(`Enum "${this.name}" cannot represent non-enum value: ${t}.`+it(this,t),e)}const n=this.getValue(e.value);if(null==n){const t=ye(e);throw new GraphQLError(`Value "${t}" does not exist in "${this.name}" enum.`+it(this,t),e)}return n.value}toConfig(){const e=te(this.getValues(),(e=>e.name),(e=>({description:e.description,value:e.value,deprecationReason:e.deprecationReason,extensions:e.extensions,astNode:e.astNode})));return{name:this.name,description:this.description,values:e,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}function it(e,t){return W("the enum value",ae(t,e.getValues().map((e=>e.name))))}class GraphQLInputObjectType{constructor(e){var t;this.name=be(e.name),this.description=e.description,this.extensions=ue(e.extensions),this.astNode=e.astNode,this.extensionASTNodes=null!==(t=e.extensionASTNodes)&&void 0!==t?t:[],this._fields=rt.bind(void 0,e)}get[Symbol.toStringTag](){return"GraphQLInputObjectType"}getFields(){return"function"==typeof this._fields&&(this._fields=this._fields()),this._fields}toConfig(){const e=ne(this.getFields(),(e=>({description:e.description,type:e.type,defaultValue:e.defaultValue,deprecationReason:e.deprecationReason,extensions:e.extensions,astNode:e.astNode})));return{name:this.name,description:this.description,fields:e,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}function rt(e){const n=Ke(e.fields);return We(n)||t(!1,`${e.name} fields must be an object with field names as keys or a function which returns such an object.`),ne(n,((n,i)=>(!("resolve"in n)||t(!1,`${e.name}.${i} field has a resolve property, but Input Types cannot define resolvers.`),{name:be(i),description:n.description,type:n.type,defaultValue:n.defaultValue,deprecationReason:n.deprecationReason,extensions:ue(n.extensions),astNode:n.astNode})))}function ot(e){return Ge(e.type)&&void 0===e.defaultValue}function st(e,t){return e===t||(Ge(e)&&Ge(t)||!(!Re(e)||!Re(t)))&&st(e.ofType,t.ofType)}function at(e,t,n){return t===n||(Ge(n)?!!Ge(t)&&at(e,t.ofType,n.ofType):Ge(t)?at(e,t.ofType,n):Re(n)?!!Re(t)&&at(e,t.ofType,n.ofType):!Re(t)&&(Ve(n)&&(we(t)||De(t))&&e.isSubType(n,t)))}function ct(e,t,n){return t===n||(Ve(t)?Ve(n)?e.getPossibleTypes(t).some((t=>e.isSubType(n,t))):e.isSubType(t,n):!!Ve(n)&&e.isSubType(n,t))}const ut=2147483647,lt=-2147483648,pt=new GraphQLScalarType({name:"Int",description:"The `Int` scalar type represents non-fractional signed whole numeric values. Int can represent values between -(2^31) and 2^31 - 1.",serialize(e){const t=Et(e);if("boolean"==typeof t)return t?1:0;let n=t;if("string"==typeof t&&""!==t&&(n=Number(t)),"number"!=typeof n||!Number.isInteger(n))throw new GraphQLError(`Int cannot represent non-integer value: ${Y(t)}`);if(n>ut||nut||eut||te.name===t))}function Et(e){if(n(e)){if("function"==typeof e.valueOf){const t=e.valueOf();if(!n(t))return t}if("function"==typeof e.toJSON)return e.toJSON()}return e}function Tt(e){return q(e,GraphQLDirective)}class GraphQLDirective{constructor(e){var i,r;this.name=be(e.name),this.description=e.description,this.locations=e.locations,this.isRepeatable=null!==(i=e.isRepeatable)&&void 0!==i&&i,this.extensions=ue(e.extensions),this.astNode=e.astNode,Array.isArray(e.locations)||t(!1,`@${e.name} locations must be an Array.`);const o=null!==(r=e.args)&&void 0!==r?r:{};n(o)&&!Array.isArray(o)||t(!1,`@${e.name} args must be an object with argument names as keys.`),this.args=He(o)}get[Symbol.toStringTag](){return"GraphQLDirective"}toConfig(){return{name:this.name,description:this.description,locations:this.locations,args:et(this.args),isRepeatable:this.isRepeatable,extensions:this.extensions,astNode:this.astNode}}toString(){return"@"+this.name}toJSON(){return this.toString()}}const Nt=new GraphQLDirective({name:"include",description:"Directs the executor to include this field or fragment only when the `if` argument is true.",locations:[h.FIELD,h.FRAGMENT_SPREAD,h.INLINE_FRAGMENT],args:{if:{type:new GraphQLNonNull(ht),description:"Included when true."}}}),It=new GraphQLDirective({name:"skip",description:"Directs the executor to skip this field or fragment when the `if` argument is true.",locations:[h.FIELD,h.FRAGMENT_SPREAD,h.INLINE_FRAGMENT],args:{if:{type:new GraphQLNonNull(ht),description:"Skipped when true."}}}),gt="No longer supported",_t=new GraphQLDirective({name:"deprecated",description:"Marks an element of a GraphQL schema as no longer supported.",locations:[h.FIELD_DEFINITION,h.ARGUMENT_DEFINITION,h.INPUT_FIELD_DEFINITION,h.ENUM_VALUE],args:{reason:{type:ft,description:"Explains why this element was deprecated, usually also including a suggestion for how to access supported similar data. Formatted using the Markdown syntax, as specified by [CommonMark](https://commonmark.org/).",defaultValue:gt}}}),Ot=new GraphQLDirective({name:"specifiedBy",description:"Exposes a URL that specifies the behavior of this scalar.",locations:[h.SCALAR],args:{url:{type:new GraphQLNonNull(ft),description:"The URL that specifies the behavior of this scalar."}}}),bt=Object.freeze([Nt,It,_t,Ot]);function Lt(e,t){if(Ge(t)){const n=Lt(e,t.ofType);return(null==n?void 0:n.kind)===m.NULL?null:n}if(null===e)return{kind:m.NULL};if(void 0===e)return null;if(Re(t)){const n=t.ofType;if("object"==typeof(r=e)&&"function"==typeof(null==r?void 0:r[Symbol.iterator])){const t=[];for(const i of e){const e=Lt(i,n);null!=e&&t.push(e)}return{kind:m.LIST,values:t}}return Lt(e,n)}var r;if(Fe(t)){if(!n(e))return null;const i=[];for(const n of Object.values(t.getFields())){const t=Lt(e[n.name],n.type);t&&i.push({kind:m.OBJECT_FIELD,name:{kind:m.NAME,value:n.name},value:t})}return{kind:m.OBJECT,fields:i}}if(Ue(t)){const n=t.serialize(e);if(null==n)return null;if("boolean"==typeof n)return{kind:m.BOOLEAN,value:n};if("number"==typeof n&&Number.isFinite(n)){const e=String(n);return St.test(e)?{kind:m.INT,value:e}:{kind:m.FLOAT,value:e}}if("string"==typeof n)return xe(t)?{kind:m.ENUM,value:n}:t===mt&&St.test(n)?{kind:m.INT,value:n}:{kind:m.STRING,value:n};throw new TypeError(`Cannot convert value to AST: ${Y(n)}.`)}i(!1,"Unexpected input type: "+Y(t))}const St=/^-?(?:0|[1-9][0-9]*)$/,At=new GraphQLObjectType({name:"__Schema",description:"A GraphQL Schema defines the capabilities of a GraphQL server. It exposes all available types and directives on the server, as well as the entry points for query, mutation, and subscription operations.",fields:()=>({description:{type:ft,resolve:e=>e.description},types:{description:"A list of all types supported by this server.",type:new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(kt))),resolve:e=>Object.values(e.getTypeMap())},queryType:{description:"The type that query operations will be rooted at.",type:new GraphQLNonNull(kt),resolve:e=>e.getQueryType()},mutationType:{description:"If this server supports mutation, the type that mutation operations will be rooted at.",type:kt,resolve:e=>e.getMutationType()},subscriptionType:{description:"If this server support subscription, the type that subscription operations will be rooted at.",type:kt,resolve:e=>e.getSubscriptionType()},directives:{description:"A list of all directives supported by this server.",type:new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(Dt))),resolve:e=>e.getDirectives()}})}),Dt=new GraphQLObjectType({name:"__Directive",description:"A Directive provides a way to describe alternate runtime execution and type validation behavior in a GraphQL document.\n\nIn some cases, you need to provide options to alter GraphQL's execution behavior in ways field arguments will not suffice, such as conditionally including or skipping a field. Directives provide this by describing additional information to the executor.",fields:()=>({name:{type:new GraphQLNonNull(ft),resolve:e=>e.name},description:{type:ft,resolve:e=>e.description},isRepeatable:{type:new GraphQLNonNull(ht),resolve:e=>e.isRepeatable},locations:{type:new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(wt))),resolve:e=>e.locations},args:{type:new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(Ft))),args:{includeDeprecated:{type:ht,defaultValue:!1}},resolve:(e,{includeDeprecated:t})=>t?e.args:e.args.filter((e=>null==e.deprecationReason))}})}),wt=new GraphQLEnumType({name:"__DirectiveLocation",description:"A Directive can be adjacent to many parts of the GraphQL language, a __DirectiveLocation describes one such possible adjacencies.",values:{QUERY:{value:h.QUERY,description:"Location adjacent to a query operation."},MUTATION:{value:h.MUTATION,description:"Location adjacent to a mutation operation."},SUBSCRIPTION:{value:h.SUBSCRIPTION,description:"Location adjacent to a subscription operation."},FIELD:{value:h.FIELD,description:"Location adjacent to a field."},FRAGMENT_DEFINITION:{value:h.FRAGMENT_DEFINITION,description:"Location adjacent to a fragment definition."},FRAGMENT_SPREAD:{value:h.FRAGMENT_SPREAD,description:"Location adjacent to a fragment spread."},INLINE_FRAGMENT:{value:h.INLINE_FRAGMENT,description:"Location adjacent to an inline fragment."},VARIABLE_DEFINITION:{value:h.VARIABLE_DEFINITION,description:"Location adjacent to a variable definition."},SCHEMA:{value:h.SCHEMA,description:"Location adjacent to a schema definition."},SCALAR:{value:h.SCALAR,description:"Location adjacent to a scalar definition."},OBJECT:{value:h.OBJECT,description:"Location adjacent to an object type definition."},FIELD_DEFINITION:{value:h.FIELD_DEFINITION,description:"Location adjacent to a field definition."},ARGUMENT_DEFINITION:{value:h.ARGUMENT_DEFINITION,description:"Location adjacent to an argument definition."},INTERFACE:{value:h.INTERFACE,description:"Location adjacent to an interface definition."},UNION:{value:h.UNION,description:"Location adjacent to a union definition."},ENUM:{value:h.ENUM,description:"Location adjacent to an enum definition."},ENUM_VALUE:{value:h.ENUM_VALUE,description:"Location adjacent to an enum value definition."},INPUT_OBJECT:{value:h.INPUT_OBJECT,description:"Location adjacent to an input object type definition."},INPUT_FIELD_DEFINITION:{value:h.INPUT_FIELD_DEFINITION,description:"Location adjacent to an input object field definition."}}}),kt=new GraphQLObjectType({name:"__Type",description:"The fundamental unit of any GraphQL Schema is the type. There are many kinds of types in GraphQL as represented by the `__TypeKind` enum.\n\nDepending on the kind of a type, certain fields describe information about that type. Scalar types provide no information beyond a name, description and optional `specifiedByURL`, while Enum types provide their values. Object and Interface types provide the fields they describe. Abstract types, Union and Interface, provide the Object types possible at runtime. List and NonNull types compose other types.",fields:()=>({kind:{type:new GraphQLNonNull(Gt),resolve:e=>Ae(e)?Ct.SCALAR:De(e)?Ct.OBJECT:we(e)?Ct.INTERFACE:ke(e)?Ct.UNION:xe(e)?Ct.ENUM:Fe(e)?Ct.INPUT_OBJECT:Re(e)?Ct.LIST:Ge(e)?Ct.NON_NULL:void i(!1,`Unexpected type: "${Y(e)}".`)},name:{type:ft,resolve:e=>"name"in e?e.name:void 0},description:{type:ft,resolve:e=>"description"in e?e.description:void 0},specifiedByURL:{type:ft,resolve:e=>"specifiedByURL"in e?e.specifiedByURL:void 0},fields:{type:new GraphQLList(new GraphQLNonNull(xt)),args:{includeDeprecated:{type:ht,defaultValue:!1}},resolve(e,{includeDeprecated:t}){if(De(e)||we(e)){const n=Object.values(e.getFields());return t?n:n.filter((e=>null==e.deprecationReason))}}},interfaces:{type:new GraphQLList(new GraphQLNonNull(kt)),resolve(e){if(De(e)||we(e))return e.getInterfaces()}},possibleTypes:{type:new GraphQLList(new GraphQLNonNull(kt)),resolve(e,t,n,{schema:i}){if(Ve(e))return i.getPossibleTypes(e)}},enumValues:{type:new GraphQLList(new GraphQLNonNull(Rt)),args:{includeDeprecated:{type:ht,defaultValue:!1}},resolve(e,{includeDeprecated:t}){if(xe(e)){const n=e.getValues();return t?n:n.filter((e=>null==e.deprecationReason))}}},inputFields:{type:new GraphQLList(new GraphQLNonNull(Ft)),args:{includeDeprecated:{type:ht,defaultValue:!1}},resolve(e,{includeDeprecated:t}){if(Fe(e)){const n=Object.values(e.getFields());return t?n:n.filter((e=>null==e.deprecationReason))}}},ofType:{type:kt,resolve:e=>"ofType"in e?e.ofType:void 0}})}),xt=new GraphQLObjectType({name:"__Field",description:"Object and Interface types are described by a list of Fields, each of which has a name, potentially a list of arguments, and a return type.",fields:()=>({name:{type:new GraphQLNonNull(ft),resolve:e=>e.name},description:{type:ft,resolve:e=>e.description},args:{type:new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(Ft))),args:{includeDeprecated:{type:ht,defaultValue:!1}},resolve:(e,{includeDeprecated:t})=>t?e.args:e.args.filter((e=>null==e.deprecationReason))},type:{type:new GraphQLNonNull(kt),resolve:e=>e.type},isDeprecated:{type:new GraphQLNonNull(ht),resolve:e=>null!=e.deprecationReason},deprecationReason:{type:ft,resolve:e=>e.deprecationReason}})}),Ft=new GraphQLObjectType({name:"__InputValue",description:"Arguments provided to Fields or Directives and the input fields of an InputObject are represented as Input Values which describe their type and optionally a default value.",fields:()=>({name:{type:new GraphQLNonNull(ft),resolve:e=>e.name},description:{type:ft,resolve:e=>e.description},type:{type:new GraphQLNonNull(kt),resolve:e=>e.type},defaultValue:{type:ft,description:"A GraphQL-formatted string representing the default value for this input value.",resolve(e){const{type:t,defaultValue:n}=e,i=Lt(n,t);return i?ye(i):null}},isDeprecated:{type:new GraphQLNonNull(ht),resolve:e=>null!=e.deprecationReason},deprecationReason:{type:ft,resolve:e=>e.deprecationReason}})}),Rt=new GraphQLObjectType({name:"__EnumValue",description:"One possible value for a given Enum. Enum values are unique values, not a placeholder for a string or numeric value. However an Enum value is returned in a JSON response as a string.",fields:()=>({name:{type:new GraphQLNonNull(ft),resolve:e=>e.name},description:{type:ft,resolve:e=>e.description},isDeprecated:{type:new GraphQLNonNull(ht),resolve:e=>null!=e.deprecationReason},deprecationReason:{type:ft,resolve:e=>e.deprecationReason}})});let Ct;!function(e){e.SCALAR="SCALAR",e.OBJECT="OBJECT",e.INTERFACE="INTERFACE",e.UNION="UNION",e.ENUM="ENUM",e.INPUT_OBJECT="INPUT_OBJECT",e.LIST="LIST",e.NON_NULL="NON_NULL"}(Ct||(Ct={}));const Gt=new GraphQLEnumType({name:"__TypeKind",description:"An enum describing what kind of type a given `__Type` is.",values:{SCALAR:{value:Ct.SCALAR,description:"Indicates this type is a scalar."},OBJECT:{value:Ct.OBJECT,description:"Indicates this type is an object. `fields` and `interfaces` are valid fields."},INTERFACE:{value:Ct.INTERFACE,description:"Indicates this type is an interface. `fields`, `interfaces`, and `possibleTypes` are valid fields."},UNION:{value:Ct.UNION,description:"Indicates this type is a union. `possibleTypes` is a valid field."},ENUM:{value:Ct.ENUM,description:"Indicates this type is an enum. `enumValues` is a valid field."},INPUT_OBJECT:{value:Ct.INPUT_OBJECT,description:"Indicates this type is an input object. `inputFields` is a valid field."},LIST:{value:Ct.LIST,description:"Indicates this type is a list. `ofType` is a valid field."},NON_NULL:{value:Ct.NON_NULL,description:"Indicates this type is a non-null. `ofType` is a valid field."}}}),$t={name:"__schema",type:new GraphQLNonNull(At),description:"Access the current type schema of this server.",args:[],resolve:(e,t,n,{schema:i})=>i,deprecationReason:void 0,extensions:Object.create(null),astNode:void 0},Qt={name:"__type",type:kt,description:"Request the type information of a single type.",args:[{name:"name",description:void 0,type:new GraphQLNonNull(ft),defaultValue:void 0,deprecationReason:void 0,extensions:Object.create(null),astNode:void 0}],resolve:(e,{name:t},n,{schema:i})=>i.getType(t),deprecationReason:void 0,extensions:Object.create(null),astNode:void 0},Ut={name:"__typename",type:new GraphQLNonNull(ft),description:"The name of the current Object type at runtime.",args:[],resolve:(e,t,n,{parentType:i})=>i.name,deprecationReason:void 0,extensions:Object.create(null),astNode:void 0},jt=Object.freeze([At,Dt,wt,kt,xt,Ft,Rt,Gt]);function Vt(e){return jt.some((({name:t})=>e.name===t))}function Mt(e){if(!function(e){return q(e,GraphQLSchema)}(e))throw new Error(`Expected ${Y(e)} to be a GraphQL schema.`);return e}class GraphQLSchema{constructor(e){var i,r;this.__validationErrors=!0===e.assumeValid?[]:void 0,n(e)||t(!1,"Must provide configuration object."),!e.types||Array.isArray(e.types)||t(!1,`"types" must be Array if provided but got: ${Y(e.types)}.`),!e.directives||Array.isArray(e.directives)||t(!1,`"directives" must be Array if provided but got: ${Y(e.directives)}.`),this.description=e.description,this.extensions=ue(e.extensions),this.astNode=e.astNode,this.extensionASTNodes=null!==(i=e.extensionASTNodes)&&void 0!==i?i:[],this._queryType=e.query,this._mutationType=e.mutation,this._subscriptionType=e.subscription,this._directives=null!==(r=e.directives)&&void 0!==r?r:bt;const o=new Set(e.types);if(null!=e.types)for(const t of e.types)o.delete(t),Pt(t,o);null!=this._queryType&&Pt(this._queryType,o),null!=this._mutationType&&Pt(this._mutationType,o),null!=this._subscriptionType&&Pt(this._subscriptionType,o);for(const e of this._directives)if(Tt(e))for(const t of e.args)Pt(t.type,o);Pt(At,o),this._typeMap=Object.create(null),this._subTypeMap=Object.create(null),this._implementationsMap=Object.create(null);for(const e of o){if(null==e)continue;const n=e.name;if(n||t(!1,"One of the provided types for building the Schema is missing a name."),void 0!==this._typeMap[n])throw new Error(`Schema must contain uniquely named types but contains multiple types named "${n}".`);if(this._typeMap[n]=e,we(e)){for(const t of e.getInterfaces())if(we(t)){let n=this._implementationsMap[t.name];void 0===n&&(n=this._implementationsMap[t.name]={objects:[],interfaces:[]}),n.interfaces.push(e)}}else if(De(e))for(const t of e.getInterfaces())if(we(t)){let n=this._implementationsMap[t.name];void 0===n&&(n=this._implementationsMap[t.name]={objects:[],interfaces:[]}),n.objects.push(e)}}}get[Symbol.toStringTag](){return"GraphQLSchema"}getQueryType(){return this._queryType}getMutationType(){return this._mutationType}getSubscriptionType(){return this._subscriptionType}getRootType(e){switch(e){case f.QUERY:return this.getQueryType();case f.MUTATION:return this.getMutationType();case f.SUBSCRIPTION:return this.getSubscriptionType()}}getTypeMap(){return this._typeMap}getType(e){return this.getTypeMap()[e]}getPossibleTypes(e){return ke(e)?e.getTypes():this.getImplementations(e).objects}getImplementations(e){const t=this._implementationsMap[e.name];return null!=t?t:{objects:[],interfaces:[]}}isSubType(e,t){let n=this._subTypeMap[e.name];if(void 0===n){if(n=Object.create(null),ke(e))for(const t of e.getTypes())n[t.name]=!0;else{const t=this.getImplementations(e);for(const e of t.objects)n[e.name]=!0;for(const e of t.interfaces)n[e.name]=!0}this._subTypeMap[e.name]=n}return void 0!==n[t.name]}getDirectives(){return this._directives}getDirective(e){return this.getDirectives().find((t=>t.name===e))}toConfig(){return{description:this.description,query:this.getQueryType(),mutation:this.getMutationType(),subscription:this.getSubscriptionType(),types:Object.values(this.getTypeMap()),directives:this.getDirectives(),extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes,assumeValid:void 0!==this.__validationErrors}}}function Pt(e,t){const n=Je(e);if(!t.has(n))if(t.add(n),ke(n))for(const e of n.getTypes())Pt(e,t);else if(De(n)||we(n)){for(const e of n.getInterfaces())Pt(e,t);for(const e of Object.values(n.getFields())){Pt(e.type,t);for(const n of e.args)Pt(n.type,t)}}else if(Fe(n))for(const e of Object.values(n.getFields()))Pt(e.type,t);return t}function Bt(e){if(Mt(e),e.__validationErrors)return e.__validationErrors;const t=new SchemaValidationContext(e);!function(e){const t=e.schema,n=t.getQueryType();if(n){if(!De(n)){var i;e.reportError(`Query root type must be Object type, it cannot be ${Y(n)}.`,null!==(i=Yt(t,f.QUERY))&&void 0!==i?i:n.astNode)}}else e.reportError("Query root type must be provided.",t.astNode);const r=t.getMutationType();var o;r&&!De(r)&&e.reportError(`Mutation root type must be Object type if provided, it cannot be ${Y(r)}.`,null!==(o=Yt(t,f.MUTATION))&&void 0!==o?o:r.astNode);const s=t.getSubscriptionType();var a;s&&!De(s)&&e.reportError(`Subscription root type must be Object type if provided, it cannot be ${Y(s)}.`,null!==(a=Yt(t,f.SUBSCRIPTION))&&void 0!==a?a:s.astNode)}(t),function(e){for(const n of e.schema.getDirectives())if(Tt(n)){Jt(e,n);for(const i of n.args){var t;if(Jt(e,i),$e(i.type)||e.reportError(`The type of @${n.name}(${i.name}:) must be Input Type but got: ${Y(i.type)}.`,i.astNode),tt(i)&&null!=i.deprecationReason)e.reportError(`Required argument @${n.name}(${i.name}:) cannot be deprecated.`,[nn(i.astNode),null===(t=i.astNode)||void 0===t?void 0:t.type])}}else e.reportError(`Expected directive but got: ${Y(n)}.`,null==n?void 0:n.astNode)}(t),function(e){const t=function(e){const t=Object.create(null),n=[],i=Object.create(null);return r;function r(o){if(t[o.name])return;t[o.name]=!0,i[o.name]=n.length;const s=Object.values(o.getFields());for(const t of s)if(Ge(t.type)&&Fe(t.type.ofType)){const o=t.type.ofType,s=i[o.name];if(n.push(t),void 0===s)r(o);else{const t=n.slice(s),i=t.map((e=>e.name)).join(".");e.reportError(`Cannot reference Input Object "${o.name}" within itself through a series of non-null fields: "${i}".`,t.map((e=>e.astNode)))}n.pop()}i[o.name]=void 0}}(e),n=e.schema.getTypeMap();for(const i of Object.values(n))Ye(i)?(Vt(i)||Jt(e,i),De(i)||we(i)?(qt(e,i),Kt(e,i)):ke(i)?Ht(e,i):xe(i)?Wt(e,i):Fe(i)&&(Zt(e,i),t(i))):e.reportError(`Expected GraphQL named type but got: ${Y(i)}.`,i.astNode)}(t);const n=t.getErrors();return e.__validationErrors=n,n}class SchemaValidationContext{constructor(e){this._errors=[],this.schema=e}reportError(e,t){const n=Array.isArray(t)?t.filter(Boolean):t;this._errors.push(new GraphQLError(e,n))}getErrors(){return this._errors}}function Yt(e,t){var n;return null===(n=[e.astNode,...e.extensionASTNodes].flatMap((e=>{var t;return null!==(t=null==e?void 0:e.operationTypes)&&void 0!==t?t:[]})).find((e=>e.operation===t)))||void 0===n?void 0:n.type}function Jt(e,t){t.name.startsWith("__")&&e.reportError(`Name "${t.name}" must not begin with "__", which is reserved by GraphQL introspection.`,t.astNode)}function qt(e,t){const n=Object.values(t.getFields());0===n.length&&e.reportError(`Type ${t.name} must define one or more fields.`,[t.astNode,...t.extensionASTNodes]);for(const s of n){var i;if(Jt(e,s),!Qe(s.type))e.reportError(`The type of ${t.name}.${s.name} must be Output Type but got: ${Y(s.type)}.`,null===(i=s.astNode)||void 0===i?void 0:i.type);for(const n of s.args){const i=n.name;var r,o;if(Jt(e,n),!$e(n.type))e.reportError(`The type of ${t.name}.${s.name}(${i}:) must be Input Type but got: ${Y(n.type)}.`,null===(r=n.astNode)||void 0===r?void 0:r.type);if(tt(n)&&null!=n.deprecationReason)e.reportError(`Required argument ${t.name}.${s.name}(${i}:) cannot be deprecated.`,[nn(n.astNode),null===(o=n.astNode)||void 0===o?void 0:o.type])}}}function Kt(e,t){const n=Object.create(null);for(const i of t.getInterfaces())we(i)?t!==i?n[i.name]?e.reportError(`Type ${t.name} can only implement ${i.name} once.`,en(t,i)):(n[i.name]=!0,zt(e,t,i),Xt(e,t,i)):e.reportError(`Type ${t.name} cannot implement itself because it would create a circular reference.`,en(t,i)):e.reportError(`Type ${Y(t)} must only implement Interface types, it cannot implement ${Y(i)}.`,en(t,i))}function Xt(e,t,n){const i=t.getFields();for(const c of Object.values(n.getFields())){const u=c.name,l=i[u];if(l){var r,o;if(!at(e.schema,l.type,c.type))e.reportError(`Interface field ${n.name}.${u} expects type ${Y(c.type)} but ${t.name}.${u} is type ${Y(l.type)}.`,[null===(r=c.astNode)||void 0===r?void 0:r.type,null===(o=l.astNode)||void 0===o?void 0:o.type]);for(const i of c.args){const r=i.name,o=l.args.find((e=>e.name===r));var s,a;if(o){if(!st(i.type,o.type))e.reportError(`Interface field argument ${n.name}.${u}(${r}:) expects type ${Y(i.type)} but ${t.name}.${u}(${r}:) is type ${Y(o.type)}.`,[null===(s=i.astNode)||void 0===s?void 0:s.type,null===(a=o.astNode)||void 0===a?void 0:a.type])}else e.reportError(`Interface field argument ${n.name}.${u}(${r}:) expected but ${t.name}.${u} does not provide it.`,[i.astNode,l.astNode])}for(const i of l.args){const r=i.name;!c.args.find((e=>e.name===r))&&tt(i)&&e.reportError(`Object field ${t.name}.${u} includes required argument ${r} that is missing from the Interface field ${n.name}.${u}.`,[i.astNode,c.astNode])}}else e.reportError(`Interface field ${n.name}.${u} expected but ${t.name} does not provide it.`,[c.astNode,t.astNode,...t.extensionASTNodes])}}function zt(e,t,n){const i=t.getInterfaces();for(const r of n.getInterfaces())i.includes(r)||e.reportError(r===t?`Type ${t.name} cannot implement ${n.name} because it would create a circular reference.`:`Type ${t.name} must implement ${r.name} because it is implemented by ${n.name}.`,[...en(n,r),...en(t,n)])}function Ht(e,t){const n=t.getTypes();0===n.length&&e.reportError(`Union type ${t.name} must define one or more member types.`,[t.astNode,...t.extensionASTNodes]);const i=Object.create(null);for(const r of n)i[r.name]?e.reportError(`Union type ${t.name} can only include type ${r.name} once.`,tn(t,r.name)):(i[r.name]=!0,De(r)||e.reportError(`Union type ${t.name} can only include Object types, it cannot include ${Y(r)}.`,tn(t,String(r))))}function Wt(e,t){const n=t.getValues();0===n.length&&e.reportError(`Enum type ${t.name} must define one or more values.`,[t.astNode,...t.extensionASTNodes]);for(const t of n)Jt(e,t)}function Zt(e,t){const n=Object.values(t.getFields());0===n.length&&e.reportError(`Input Object type ${t.name} must define one or more fields.`,[t.astNode,...t.extensionASTNodes]);for(const o of n){var i,r;if(Jt(e,o),!$e(o.type))e.reportError(`The type of ${t.name}.${o.name} must be Input Type but got: ${Y(o.type)}.`,null===(i=o.astNode)||void 0===i?void 0:i.type);if(ot(o)&&null!=o.deprecationReason)e.reportError(`Required input field ${t.name}.${o.name} cannot be deprecated.`,[nn(o.astNode),null===(r=o.astNode)||void 0===r?void 0:r.type])}}function en(e,t){const{astNode:n,extensionASTNodes:i}=e;return(null!=n?[n,...i]:i).flatMap((e=>{var t;return null!==(t=e.interfaces)&&void 0!==t?t:[]})).filter((e=>e.name.value===t.name))}function tn(e,t){const{astNode:n,extensionASTNodes:i}=e;return(null!=n?[n,...i]:i).flatMap((e=>{var t;return null!==(t=e.types)&&void 0!==t?t:[]})).filter((e=>e.name.value===t))}function nn(e){var t;return null==e||null===(t=e.directives)||void 0===t?void 0:t.find((e=>e.name.value===_t.name))}function rn(e,t){switch(t.kind){case m.LIST_TYPE:{const n=rn(e,t.type);return n&&new GraphQLList(n)}case m.NON_NULL_TYPE:{const n=rn(e,t.type);return n&&new GraphQLNonNull(n)}case m.NAMED_TYPE:return e.getType(t.name.value)}}class TypeInfo{constructor(e,t,n){this._schema=e,this._typeStack=[],this._parentTypeStack=[],this._inputTypeStack=[],this._fieldDefStack=[],this._defaultValueStack=[],this._directive=null,this._argument=null,this._enumValue=null,this._getFieldDef=null!=n?n:on,t&&($e(t)&&this._inputTypeStack.push(t),je(t)&&this._parentTypeStack.push(t),Qe(t)&&this._typeStack.push(t))}get[Symbol.toStringTag](){return"TypeInfo"}getType(){if(this._typeStack.length>0)return this._typeStack[this._typeStack.length-1]}getParentType(){if(this._parentTypeStack.length>0)return this._parentTypeStack[this._parentTypeStack.length-1]}getInputType(){if(this._inputTypeStack.length>0)return this._inputTypeStack[this._inputTypeStack.length-1]}getParentInputType(){if(this._inputTypeStack.length>1)return this._inputTypeStack[this._inputTypeStack.length-2]}getFieldDef(){if(this._fieldDefStack.length>0)return this._fieldDefStack[this._fieldDefStack.length-1]}getDefaultValue(){if(this._defaultValueStack.length>0)return this._defaultValueStack[this._defaultValueStack.length-1]}getDirective(){return this._directive}getArgument(){return this._argument}getEnumValue(){return this._enumValue}enter(e){const t=this._schema;switch(e.kind){case m.SELECTION_SET:{const e=Je(this.getType());this._parentTypeStack.push(je(e)?e:void 0);break}case m.FIELD:{const n=this.getParentType();let i,r;n&&(i=this._getFieldDef(t,n,e),i&&(r=i.type)),this._fieldDefStack.push(i),this._typeStack.push(Qe(r)?r:void 0);break}case m.DIRECTIVE:this._directive=t.getDirective(e.name.value);break;case m.OPERATION_DEFINITION:{const n=t.getRootType(e.operation);this._typeStack.push(De(n)?n:void 0);break}case m.INLINE_FRAGMENT:case m.FRAGMENT_DEFINITION:{const n=e.typeCondition,i=n?rn(t,n):Je(this.getType());this._typeStack.push(Qe(i)?i:void 0);break}case m.VARIABLE_DEFINITION:{const n=rn(t,e.type);this._inputTypeStack.push($e(n)?n:void 0);break}case m.ARGUMENT:{var n;let t,i;const r=null!==(n=this.getDirective())&&void 0!==n?n:this.getFieldDef();r&&(t=r.args.find((t=>t.name===e.name.value)),t&&(i=t.type)),this._argument=t,this._defaultValueStack.push(t?t.defaultValue:void 0),this._inputTypeStack.push($e(i)?i:void 0);break}case m.LIST:{const e=Be(this.getInputType()),t=Re(e)?e.ofType:e;this._defaultValueStack.push(void 0),this._inputTypeStack.push($e(t)?t:void 0);break}case m.OBJECT_FIELD:{const t=Je(this.getInputType());let n,i;Fe(t)&&(i=t.getFields()[e.name.value],i&&(n=i.type)),this._defaultValueStack.push(i?i.defaultValue:void 0),this._inputTypeStack.push($e(n)?n:void 0);break}case m.ENUM:{const t=Je(this.getInputType());let n;xe(t)&&(n=t.getValue(e.value)),this._enumValue=n;break}}}leave(e){switch(e.kind){case m.SELECTION_SET:this._parentTypeStack.pop();break;case m.FIELD:this._fieldDefStack.pop(),this._typeStack.pop();break;case m.DIRECTIVE:this._directive=null;break;case m.OPERATION_DEFINITION:case m.INLINE_FRAGMENT:case m.FRAGMENT_DEFINITION:this._typeStack.pop();break;case m.VARIABLE_DEFINITION:this._inputTypeStack.pop();break;case m.ARGUMENT:this._argument=null,this._defaultValueStack.pop(),this._inputTypeStack.pop();break;case m.LIST:case m.OBJECT_FIELD:this._defaultValueStack.pop(),this._inputTypeStack.pop();break;case m.ENUM:this._enumValue=null}}}function on(e,t,n){const i=n.name.value;return i===$t.name&&e.getQueryType()===t?$t:i===Qt.name&&e.getQueryType()===t?Qt:i===Ut.name&&je(t)?Ut:De(t)||we(t)?t.getFields()[i]:void 0}function sn(e,t){return{enter(...n){const i=n[0];e.enter(i);const r=ve(t,i.kind).enter;if(r){const o=r.apply(t,n);return void 0!==o&&(e.leave(i),d(o)&&e.enter(o)),o}},leave(...n){const i=n[0],r=ve(t,i.kind).leave;let o;return r&&(o=r.apply(t,n)),e.leave(i),o}}}function an(e){return e.kind===m.OPERATION_DEFINITION||e.kind===m.FRAGMENT_DEFINITION}function cn(e){return e.kind===m.SCALAR_TYPE_DEFINITION||e.kind===m.OBJECT_TYPE_DEFINITION||e.kind===m.INTERFACE_TYPE_DEFINITION||e.kind===m.UNION_TYPE_DEFINITION||e.kind===m.ENUM_TYPE_DEFINITION||e.kind===m.INPUT_OBJECT_TYPE_DEFINITION}function un(e){return e.kind===m.SCALAR_TYPE_EXTENSION||e.kind===m.OBJECT_TYPE_EXTENSION||e.kind===m.INTERFACE_TYPE_EXTENSION||e.kind===m.UNION_TYPE_EXTENSION||e.kind===m.ENUM_TYPE_EXTENSION||e.kind===m.INPUT_OBJECT_TYPE_EXTENSION}function ln(e){const t=Object.create(null),n=e.getSchema(),i=n?n.getDirectives():bt;for(const e of i)t[e.name]=e.args.map((e=>e.name));const r=e.getDocument().definitions;for(const e of r)if(e.kind===m.DIRECTIVE_DEFINITION){var o;const n=null!==(o=e.arguments)&&void 0!==o?o:[];t[e.name.value]=n.map((e=>e.name.value))}return{Directive(n){const i=n.name.value,r=t[i];if(n.arguments&&r)for(const t of n.arguments){const n=t.name.value;if(!r.includes(n)){const o=ae(n,r);e.reportError(new GraphQLError(`Unknown argument "${n}" on directive "@${i}".`+W(o),t))}}return!1}}}function pn(e){const t=Object.create(null),n=e.getSchema(),r=n?n.getDirectives():bt;for(const e of r)t[e.name]=e.locations;const o=e.getDocument().definitions;for(const e of o)e.kind===m.DIRECTIVE_DEFINITION&&(t[e.name.value]=e.locations.map((e=>e.value)));return{Directive(n,r,o,s,a){const c=n.name.value,u=t[c];if(!u)return void e.reportError(new GraphQLError(`Unknown directive "@${c}".`,n));const l=function(e){const t=e[e.length-1];switch("kind"in t||i(!1),t.kind){case m.OPERATION_DEFINITION:return function(e){switch(e){case f.QUERY:return h.QUERY;case f.MUTATION:return h.MUTATION;case f.SUBSCRIPTION:return h.SUBSCRIPTION}}(t.operation);case m.FIELD:return h.FIELD;case m.FRAGMENT_SPREAD:return h.FRAGMENT_SPREAD;case m.INLINE_FRAGMENT:return h.INLINE_FRAGMENT;case m.FRAGMENT_DEFINITION:return h.FRAGMENT_DEFINITION;case m.VARIABLE_DEFINITION:return h.VARIABLE_DEFINITION;case m.SCHEMA_DEFINITION:case m.SCHEMA_EXTENSION:return h.SCHEMA;case m.SCALAR_TYPE_DEFINITION:case m.SCALAR_TYPE_EXTENSION:return h.SCALAR;case m.OBJECT_TYPE_DEFINITION:case m.OBJECT_TYPE_EXTENSION:return h.OBJECT;case m.FIELD_DEFINITION:return h.FIELD_DEFINITION;case m.INTERFACE_TYPE_DEFINITION:case m.INTERFACE_TYPE_EXTENSION:return h.INTERFACE;case m.UNION_TYPE_DEFINITION:case m.UNION_TYPE_EXTENSION:return h.UNION;case m.ENUM_TYPE_DEFINITION:case m.ENUM_TYPE_EXTENSION:return h.ENUM;case m.ENUM_VALUE_DEFINITION:return h.ENUM_VALUE;case m.INPUT_OBJECT_TYPE_DEFINITION:case m.INPUT_OBJECT_TYPE_EXTENSION:return h.INPUT_OBJECT;case m.INPUT_VALUE_DEFINITION:{const t=e[e.length-3];return"kind"in t||i(!1),t.kind===m.INPUT_OBJECT_TYPE_DEFINITION?h.INPUT_FIELD_DEFINITION:h.ARGUMENT_DEFINITION}default:i(!1,"Unexpected kind: "+Y(t.kind))}}(a);l&&!u.includes(l)&&e.reportError(new GraphQLError(`Directive "@${c}" may not be used on ${l}.`,n))}}}function dn(e){const t=e.getSchema(),n=t?t.getTypeMap():Object.create(null),i=Object.create(null);for(const t of e.getDocument().definitions)cn(t)&&(i[t.name.value]=!0);const r=[...Object.keys(n),...Object.keys(i)];return{NamedType(t,o,s,a,c){const u=t.name.value;if(!n[u]&&!i[u]){var l;const n=null!==(l=c[2])&&void 0!==l?l:s,i=null!=n&&("kind"in(p=n)&&(function(e){return e.kind===m.SCHEMA_DEFINITION||cn(e)||e.kind===m.DIRECTIVE_DEFINITION}(p)||function(e){return e.kind===m.SCHEMA_EXTENSION||un(e)}(p)));if(i&&fn.includes(u))return;const o=ae(u,i?fn.concat(r):r);e.reportError(new GraphQLError(`Unknown type "${u}".`+W(o),t))}var p}}}const fn=[...vt,...jt].map((e=>e.name));function hn(e){const t=[],n=[];return{OperationDefinition:e=>(t.push(e),!1),FragmentDefinition:e=>(n.push(e),!1),Document:{leave(){const i=Object.create(null);for(const n of t)for(const t of e.getRecursivelyReferencedFragments(n))i[t.name.value]=!0;for(const t of n){const n=t.name.value;!0!==i[n]&&e.reportError(new GraphQLError(`Fragment "${n}" is never used.`,t))}}}}}function mn(e,t){const n=[e];for(;Re(Be(n[n.length-1]));){const e=Ce(Be(n[n.length-1])).ofType;n.push(e)}if(t){const e=he(t,{RequiredDesignator:{leave({element:e}){if(e)return new GraphQLNonNull(Be(e));const t=n.pop();return new GraphQLNonNull(Be(t))}},OptionalDesignator:{leave({element:e}){if(e)return Be(e);return Be(n.pop())}},ListNullability:{leave({element:e}){let i=n.pop();if(Re(Be(i))||(i=n.pop()),!i)throw new GraphQLError("List nullability modifier is too deep.",t);const r=Ge(i);return e?r?new GraphQLNonNull(new GraphQLList(e)):new GraphQLList(e):i}}});if(n.length>0)throw new GraphQLError("List nullability modifier is too shallow.",t);return e}return e}function vn(e){switch(e.kind){case m.OBJECT:return{...e,fields:(t=e.fields,t.map((e=>({...e,value:vn(e.value)}))).sort(((e,t)=>ie(e.name.value,t.name.value))))};case m.LIST:return{...e,values:e.values.map(vn)};case m.INT:case m.FLOAT:case m.STRING:case m.BOOLEAN:case m.NULL:case m.ENUM:case m.VARIABLE:return e}var t}function yn(e){return Array.isArray(e)?e.map((([e,t])=>`subfields "${e}" conflict because `+yn(t))).join(" and "):e}function En(e,t,n,i,r,o,s){const a=e.getFragment(s);if(!a)return;const[c,u]=bn(e,n,a);if(o!==c){Nn(e,t,n,i,r,o,c);for(const a of u)i.has(a,s,r)||(i.add(a,s,r),En(e,t,n,i,r,o,a))}}function Tn(e,t,n,i,r,o,s){if(o===s)return;if(i.has(o,s,r))return;i.add(o,s,r);const a=e.getFragment(o),c=e.getFragment(s);if(!a||!c)return;const[u,l]=bn(e,n,a),[p,d]=bn(e,n,c);Nn(e,t,n,i,r,u,p);for(const s of d)Tn(e,t,n,i,r,o,s);for(const o of l)Tn(e,t,n,i,r,o,s)}function Nn(e,t,n,i,r,o,s){for(const[a,c]of Object.entries(o)){const o=s[a];if(o)for(const s of c)for(const c of o){const o=In(e,n,i,r,a,s,c);o&&t.push(o)}}}function In(e,t,n,i,r,o,s){const[a,c,u]=o,[l,p,d]=s,f=i||a!==l&&De(a)&&De(l);if(!f){const e=c.name.value,t=p.name.value;if(e!==t)return[[r,`"${e}" and "${t}" are different fields`],[c],[p]];if(gn(c)!==gn(p))return[[r,"they have differing arguments"],[c],[p]]}const h=null==u?void 0:u.type,m=null==d?void 0:d.type;if(h&&m){const e=mn(h,c.required),t=mn(m,p.required);if(_n(e,t))return[[r,`they return conflicting types "${Y(e)}" and "${Y(t)}"`],[c],[p]]}const v=c.selectionSet,y=p.selectionSet;if(v&&y){const i=function(e,t,n,i,r,o,s,a){const c=[],[u,l]=On(e,t,r,o),[p,d]=On(e,t,s,a);Nn(e,c,t,n,i,u,p);for(const r of d)En(e,c,t,n,i,u,r);for(const r of l)En(e,c,t,n,i,p,r);for(const r of l)for(const o of d)Tn(e,c,t,n,i,r,o);return c}(e,t,n,f,Je(h),v,Je(m),y);return function(e,t,n,i){if(e.length>0)return[[t,e.map((([e])=>e))],[n,...e.map((([,e])=>e)).flat()],[i,...e.map((([,,e])=>e)).flat()]]}(i,r,c,p)}}function gn(e){var t;const n=null!==(t=e.arguments)&&void 0!==t?t:[];return ye(vn({kind:m.OBJECT,fields:n.map((e=>({kind:m.OBJECT_FIELD,name:e.name,value:e.value})))}))}function _n(e,t){return Re(e)?!Re(t)||_n(e.ofType,t.ofType):!!Re(t)||(Ge(e)?!Ge(t)||_n(e.ofType,t.ofType):!!Ge(t)||!(!Ue(e)&&!Ue(t))&&e!==t)}function On(e,t,n,i){const r=t.get(i);if(r)return r;const o=Object.create(null),s=Object.create(null);Ln(e,n,i,o,s);const a=[o,Object.keys(s)];return t.set(i,a),a}function bn(e,t,n){const i=t.get(n.selectionSet);if(i)return i;const r=rn(e.getSchema(),n.typeCondition);return On(e,t,r,n.selectionSet)}function Ln(e,t,n,i,r){for(const o of n.selections)switch(o.kind){case m.FIELD:{const e=o.name.value;let n;(De(t)||we(t))&&(n=t.getFields()[e]);const r=o.alias?o.alias.value:e;i[r]||(i[r]=[]),i[r].push([t,o,n]);break}case m.FRAGMENT_SPREAD:r[o.name.value]=!0;break;case m.INLINE_FRAGMENT:{const n=o.typeCondition,s=n?rn(e.getSchema(),n):t;Ln(e,s,o.selectionSet,i,r);break}}}class PairSet{constructor(){this._data=new Map}has(e,t,n){var i;const[r,o]=ee.name));const o=e.getDocument().definitions;for(const e of o)if(e.kind===m.DIRECTIVE_DEFINITION){var s;const t=null!==(s=e.arguments)&&void 0!==s?s:[];n[e.name.value]=ee(t.filter(Dn),(e=>e.name.value))}return{Directive:{leave(t){const i=t.name.value,r=n[i];if(r){var o;const n=null!==(o=t.arguments)&&void 0!==o?o:[],s=new Set(n.map((e=>e.name.value)));for(const[n,o]of Object.entries(r))if(!s.has(n)){const r=Se(o.type)?Y(o.type):ye(o.type);e.reportError(new GraphQLError(`Directive "@${i}" argument "${n}" of type "${r}" is required, but it was not provided.`,t))}}}}}}function Dn(e){return e.type.kind===m.NON_NULL_TYPE&&null==e.defaultValue}function wn(e,t,n){if(e){if(e.kind===m.VARIABLE){const i=e.name.value;if(null==n||void 0===n[i])return;const r=n[i];if(null===r&&Ge(t))return;return r}if(Ge(t)){if(e.kind===m.NULL)return;return wn(e,t.ofType,n)}if(e.kind===m.NULL)return null;if(Re(t)){const i=t.ofType;if(e.kind===m.LIST){const t=[];for(const r of e.values)if(kn(r,n)){if(Ge(i))return;t.push(null)}else{const e=wn(r,i,n);if(void 0===e)return;t.push(e)}return t}const r=wn(e,i,n);if(void 0===r)return;return[r]}if(Fe(t)){if(e.kind!==m.OBJECT)return;const i=Object.create(null),r=ee(e.fields,(e=>e.name.value));for(const e of Object.values(t.getFields())){const t=r[e.name];if(!t||kn(t.value,n)){if(void 0!==e.defaultValue)i[e.name]=e.defaultValue;else if(Ge(e.type))return;continue}const o=wn(t.value,e.type,n);if(void 0===o)return;i[e.name]=o}return i}if(Ue(t)){let i;try{i=t.parseLiteral(e,n)}catch(e){return}if(void 0===i)return;return i}i(!1,"Unexpected input type: "+Y(t))}}function kn(e,t){return e.kind===m.VARIABLE&&(null==t||void 0===t[e.name.value])}function xn(e,t,n){var i;const r=null===(i=t.directives)||void 0===i?void 0:i.find((t=>t.name.value===e.name));if(r)return function(e,t,n){var i;const r={},o=ee(null!==(i=t.arguments)&&void 0!==i?i:[],(e=>e.name.value));for(const i of e.args){const e=i.name,c=i.type,u=o[e];if(!u){if(void 0!==i.defaultValue)r[e]=i.defaultValue;else if(Ge(c))throw new GraphQLError(`Argument "${e}" of required type "${Y(c)}" was not provided.`,t);continue}const l=u.value;let p=l.kind===m.NULL;if(l.kind===m.VARIABLE){const t=l.name.value;if(null==n||(s=n,a=t,!Object.prototype.hasOwnProperty.call(s,a))){if(void 0!==i.defaultValue)r[e]=i.defaultValue;else if(Ge(c))throw new GraphQLError(`Argument "${e}" of required type "${Y(c)}" was provided the variable "$${t}" which was not provided a runtime value.`,l);continue}p=null==n[t]}if(p&&Ge(c))throw new GraphQLError(`Argument "${e}" of non-null type "${Y(c)}" must not be null.`,l);const d=wn(l,c,n);if(void 0===d)throw new GraphQLError(`Argument "${e}" has invalid value ${ye(l)}.`,l);r[e]=d}var s,a;return r}(e,r,n)}function Fn(e,t,n,i,r){const o=new Map;return Rn(e,t,n,i,r,o,new Set),o}function Rn(e,t,n,i,r,o,s){for(const c of r.selections)switch(c.kind){case m.FIELD:{if(!Cn(n,c))continue;const e=(a=c).alias?a.alias.value:a.name.value,t=o.get(e);void 0!==t?t.push(c):o.set(e,[c]);break}case m.INLINE_FRAGMENT:if(!Cn(n,c)||!Gn(e,c,i))continue;Rn(e,t,n,i,c.selectionSet,o,s);break;case m.FRAGMENT_SPREAD:{const r=c.name.value;if(s.has(r)||!Cn(n,c))continue;s.add(r);const a=t[r];if(!a||!Gn(e,a,i))continue;Rn(e,t,n,i,a.selectionSet,o,s);break}}var a}function Cn(e,t){const n=xn(It,t,e);if(!0===(null==n?void 0:n.if))return!1;const i=xn(Nt,t,e);return!1!==(null==i?void 0:i.if)}function Gn(e,t,n){const i=t.typeCondition;if(!i)return!0;const r=rn(e,i);return r===n||!!Ve(r)&&e.isSubType(r,n)}function $n(e,t){const n=new Map;for(const i of e){const e=t(i),r=n.get(e);void 0===r?n.set(e,[i]):r.push(i)}return n}function Qn(e){return{Field:t,Directive:t};function t(t){var n;const i=$n(null!==(n=t.arguments)&&void 0!==n?n:[],(e=>e.name.value));for(const[t,n]of i)n.length>1&&e.reportError(new GraphQLError(`There can be only one argument named "${t}".`,n.map((e=>e.name))))}}function Un(e){const t=Object.create(null),n=e.getSchema(),i=n?n.getDirectives():bt;for(const e of i)t[e.name]=!e.isRepeatable;const r=e.getDocument().definitions;for(const e of r)e.kind===m.DIRECTIVE_DEFINITION&&(t[e.name.value]=!e.repeatable);const o=Object.create(null),s=Object.create(null);return{enter(n){if(!("directives"in n)||!n.directives)return;let i;if(n.kind===m.SCHEMA_DEFINITION||n.kind===m.SCHEMA_EXTENSION)i=o;else if(cn(n)||un(n)){const e=n.name.value;i=s[e],void 0===i&&(s[e]=i=Object.create(null))}else i=Object.create(null);for(const r of n.directives){const n=r.name.value;t[n]&&(i[n]?e.reportError(new GraphQLError(`The directive "@${n}" can only be used once at this location.`,[i[n],r])):i[n]=r)}}}}function jn(e,t){return!!(De(e)||we(e)||Fe(e))&&null!=e.getFields()[t]}function Vn(e){const t=[];let n=Object.create(null);return{ObjectValue:{enter(){t.push(n),n=Object.create(null)},leave(){const e=t.pop();e||i(!1),n=e}},ObjectField(t){const i=t.name.value;n[i]?e.reportError(new GraphQLError(`There can be only one input field named "${i}".`,[n[i],t.name])):n[i]=t.name}}}function Mn(e,t){const n=e.getInputType();if(!n)return;const i=Je(n);if(Ue(i))try{if(void 0===i.parseLiteral(t,void 0)){const i=Y(n);e.reportError(new GraphQLError(`Expected value of type "${i}", found ${ye(t)}.`,t))}}catch(i){const r=Y(n);i instanceof GraphQLError?e.reportError(i):e.reportError(new GraphQLError(`Expected value of type "${r}", found ${ye(t)}; `+i.message,t,void 0,void 0,void 0,i))}else{const i=Y(n);e.reportError(new GraphQLError(`Expected value of type "${i}", found ${ye(t)}.`,t))}}function Pn(e,t,n,i,r){if(Ge(i)&&!Ge(t)){if(!(null!=n&&n.kind!==m.NULL)&&!(void 0!==r))return!1;return at(e,t,i.ofType)}return at(e,t,i)}const Bn=Object.freeze([function(e){return{Document(t){for(const n of t.definitions)if(!an(n)){const t=n.kind===m.SCHEMA_DEFINITION||n.kind===m.SCHEMA_EXTENSION?"schema":'"'+n.name.value+'"';e.reportError(new GraphQLError(`The ${t} definition is not executable.`,n))}return!1}}},function(e){const t=Object.create(null);return{OperationDefinition(n){const i=n.name;return i&&(t[i.value]?e.reportError(new GraphQLError(`There can be only one operation named "${i.value}".`,[t[i.value],i])):t[i.value]=i),!1},FragmentDefinition:()=>!1}},function(e){let t=0;return{Document(e){t=e.definitions.filter((e=>e.kind===m.OPERATION_DEFINITION)).length},OperationDefinition(n){!n.name&&t>1&&e.reportError(new GraphQLError("This anonymous operation must be the only defined operation.",n))}}},function(e){return{OperationDefinition(t){if("subscription"===t.operation){const n=e.getSchema(),i=n.getSubscriptionType();if(i){const r=t.name?t.name.value:null,o=Object.create(null),s=e.getDocument(),a=Object.create(null);for(const e of s.definitions)e.kind===m.FRAGMENT_DEFINITION&&(a[e.name.value]=e);const c=Fn(n,a,o,i,t.selectionSet);if(c.size>1){const t=[...c.values()].slice(1).flat();e.reportError(new GraphQLError(null!=r?`Subscription "${r}" must select only one top level field.`:"Anonymous Subscription must select only one top level field.",t))}for(const t of c.values()){t[0].name.value.startsWith("__")&&e.reportError(new GraphQLError(null!=r?`Subscription "${r}" must not select an introspection top level field.`:"Anonymous Subscription must not select an introspection top level field.",t))}}}}}},dn,function(e){return{InlineFragment(t){const n=t.typeCondition;if(n){const t=rn(e.getSchema(),n);if(t&&!je(t)){const t=ye(n);e.reportError(new GraphQLError(`Fragment cannot condition on non composite type "${t}".`,n))}}},FragmentDefinition(t){const n=rn(e.getSchema(),t.typeCondition);if(n&&!je(n)){const n=ye(t.typeCondition);e.reportError(new GraphQLError(`Fragment "${t.name.value}" cannot condition on non composite type "${n}".`,t.typeCondition))}}}},function(e){return{VariableDefinition(t){const n=rn(e.getSchema(),t.type);if(void 0!==n&&!$e(n)){const n=t.variable.name.value,i=ye(t.type);e.reportError(new GraphQLError(`Variable "$${n}" cannot be non-input type "${i}".`,t.type))}}}},function(e){return{Field(t){const n=e.getType(),i=t.selectionSet;if(n)if(Ue(Je(n))){if(i){const r=t.name.value,o=Y(n);e.reportError(new GraphQLError(`Field "${r}" must not have a selection since type "${o}" has no subfields.`,i))}}else if(!i){const i=t.name.value,r=Y(n);e.reportError(new GraphQLError(`Field "${i}" of type "${r}" must have a selection of subfields. Did you mean "${i} { ... }"?`,t))}}}},function(e){return{Field(t){const n=e.getParentType();if(n){if(!e.getFieldDef()){const i=e.getSchema(),r=t.name.value;let o=W("to use an inline fragment on",function(e,t,n){if(!Ve(t))return[];const i=new Set,r=Object.create(null);for(const s of e.getPossibleTypes(t))if(s.getFields()[n]){i.add(s),r[s.name]=1;for(const e of s.getInterfaces()){var o;e.getFields()[n]&&(i.add(e),r[e.name]=(null!==(o=r[e.name])&&void 0!==o?o:0)+1)}}return[...i].sort(((t,n)=>{const i=r[n.name]-r[t.name];return 0!==i?i:we(t)&&e.isSubType(t,n)?-1:we(n)&&e.isSubType(n,t)?1:ie(t.name,n.name)})).map((e=>e.name))}(i,n,r));""===o&&(o=W(function(e,t){if(De(e)||we(e)){return ae(t,Object.keys(e.getFields()))}return[]}(n,r))),e.reportError(new GraphQLError(`Cannot query field "${r}" on type "${n.name}".`+o,t))}}}}},function(e){const t=Object.create(null);return{OperationDefinition:()=>!1,FragmentDefinition(n){const i=n.name.value;return t[i]?e.reportError(new GraphQLError(`There can be only one fragment named "${i}".`,[t[i],n.name])):t[i]=n.name,!1}}},function(e){return{FragmentSpread(t){const n=t.name.value;e.getFragment(n)||e.reportError(new GraphQLError(`Unknown fragment "${n}".`,t.name))}}},hn,function(e){return{InlineFragment(t){const n=e.getType(),i=e.getParentType();if(je(n)&&je(i)&&!ct(e.getSchema(),n,i)){const r=Y(i),o=Y(n);e.reportError(new GraphQLError(`Fragment cannot be spread here as objects of type "${r}" can never be of type "${o}".`,t))}},FragmentSpread(t){const n=t.name.value,i=function(e,t){const n=e.getFragment(t);if(n){const t=rn(e.getSchema(),n.typeCondition);if(je(t))return t}}(e,n),r=e.getParentType();if(i&&r&&!ct(e.getSchema(),i,r)){const o=Y(r),s=Y(i);e.reportError(new GraphQLError(`Fragment "${n}" cannot be spread here as objects of type "${o}" can never be of type "${s}".`,t))}}}},function(e){const t=Object.create(null),n=[],i=Object.create(null);return{OperationDefinition:()=>!1,FragmentDefinition:e=>(r(e),!1)};function r(o){if(t[o.name.value])return;const s=o.name.value;t[s]=!0;const a=e.getFragmentSpreads(o.selectionSet);if(0!==a.length){i[s]=n.length;for(const t of a){const o=t.name.value,s=i[o];if(n.push(t),void 0===s){const t=e.getFragment(o);t&&r(t)}else{const t=n.slice(s),i=t.slice(0,-1).map((e=>'"'+e.name.value+'"')).join(", ");e.reportError(new GraphQLError(`Cannot spread fragment "${o}" within itself`+(""!==i?` via ${i}.`:"."),t))}n.pop()}i[s]=void 0}}},function(e){return{OperationDefinition(t){var n;const i=$n(null!==(n=t.variableDefinitions)&&void 0!==n?n:[],(e=>e.variable.name.value));for(const[t,n]of i)n.length>1&&e.reportError(new GraphQLError(`There can be only one variable named "$${t}".`,n.map((e=>e.variable.name))))}}},function(e){let t=Object.create(null);return{OperationDefinition:{enter(){t=Object.create(null)},leave(n){const i=e.getRecursiveVariableUsages(n);for(const{node:r}of i){const i=r.name.value;!0!==t[i]&&e.reportError(new GraphQLError(n.name?`Variable "$${i}" is not defined by operation "${n.name.value}".`:`Variable "$${i}" is not defined.`,[r,n]))}}},VariableDefinition(e){t[e.variable.name.value]=!0}}},function(e){let t=[];return{OperationDefinition:{enter(){t=[]},leave(n){const i=Object.create(null),r=e.getRecursiveVariableUsages(n);for(const{node:e}of r)i[e.name.value]=!0;for(const r of t){const t=r.variable.name.value;!0!==i[t]&&e.reportError(new GraphQLError(n.name?`Variable "$${t}" is never used in operation "${n.name.value}".`:`Variable "$${t}" is never used.`,r))}}},VariableDefinition(e){t.push(e)}}},pn,Un,function(e){return{...ln(e),Argument(t){const n=e.getArgument(),i=e.getFieldDef(),r=e.getParentType();if(!n&&i&&r){const n=t.name.value,o=ae(n,i.args.map((e=>e.name)));e.reportError(new GraphQLError(`Unknown argument "${n}" on field "${r.name}.${i.name}".`+W(o),t))}}}},Qn,function(e){return{ListValue(t){if(!Re(Be(e.getParentInputType())))return Mn(e,t),!1},ObjectValue(t){const n=Je(e.getInputType());if(!Fe(n))return Mn(e,t),!1;const i=ee(t.fields,(e=>e.name.value));for(const r of Object.values(n.getFields())){if(!i[r.name]&&ot(r)){const i=Y(r.type);e.reportError(new GraphQLError(`Field "${n.name}.${r.name}" of required type "${i}" was not provided.`,t))}}},ObjectField(t){const n=Je(e.getParentInputType());if(!e.getInputType()&&Fe(n)){const i=ae(t.name.value,Object.keys(n.getFields()));e.reportError(new GraphQLError(`Field "${t.name.value}" is not defined by type "${n.name}".`+W(i),t))}},NullValue(t){const n=e.getInputType();Ge(n)&&e.reportError(new GraphQLError(`Expected value of type "${Y(n)}", found ${ye(t)}.`,t))},EnumValue:t=>Mn(e,t),IntValue:t=>Mn(e,t),FloatValue:t=>Mn(e,t),StringValue:t=>Mn(e,t),BooleanValue:t=>Mn(e,t)}},function(e){return{...An(e),Field:{leave(t){var n;const i=e.getFieldDef();if(!i)return!1;const r=new Set(null===(n=t.arguments)||void 0===n?void 0:n.map((e=>e.name.value)));for(const n of i.args)if(!r.has(n.name)&&tt(n)){const r=Y(n.type);e.reportError(new GraphQLError(`Field "${i.name}" argument "${n.name}" of type "${r}" is required, but it was not provided.`,t))}}}}},function(e){let t=Object.create(null);return{OperationDefinition:{enter(){t=Object.create(null)},leave(n){const i=e.getRecursiveVariableUsages(n);for(const{node:n,type:r,defaultValue:o}of i){const i=n.name.value,s=t[i];if(s&&r){const t=e.getSchema(),a=rn(t,s.type);if(a&&!Pn(t,a,s.defaultValue,r,o)){const t=Y(a),o=Y(r);e.reportError(new GraphQLError(`Variable "$${i}" of type "${t}" used in position expecting type "${o}".`,[s,n]))}}}}},VariableDefinition(e){t[e.variable.name.value]=e}}},function(e){return{Field(t){const n=e.getFieldDef(),i=t.required;if(n&&i){const r=function(e){let t=e,n=0;for(;Re(Be(t));){t=Ce(Be(t)).ofType,n+=1}return n}(n.type),o=he(i,{RequiredDesignator:{leave:({element:e})=>null!=e?e:0},OptionalDesignator:{leave:({element:e})=>null!=e?e:0},ListNullability:{leave:({element:e})=>(null!=e?e:0)+1}});r>o?e.reportError(new GraphQLError("List nullability modifier is too shallow.",t.required)):r1)for(let r=0;r0&&e.reportError(new GraphQLError("Must provide only one schema definition.",t)),++s)}}},function(e){const t=e.getSchema(),n=Object.create(null),i=t?{query:t.getQueryType(),mutation:t.getMutationType(),subscription:t.getSubscriptionType()}:{};return{SchemaDefinition:r,SchemaExtension:r};function r(t){var r;const o=null!==(r=t.operationTypes)&&void 0!==r?r:[];for(const t of o){const r=t.operation,o=n[r];i[r]?e.reportError(new GraphQLError(`Type for ${r} already defined in the schema. It cannot be redefined.`,t)):o?e.reportError(new GraphQLError(`There can be only one ${r} type in schema.`,[o,t])):n[r]=t}return!1}},function(e){const t=Object.create(null),n=e.getSchema();return{ScalarTypeDefinition:i,ObjectTypeDefinition:i,InterfaceTypeDefinition:i,UnionTypeDefinition:i,EnumTypeDefinition:i,InputObjectTypeDefinition:i};function i(i){const r=i.name.value;if(null==n||!n.getType(r))return t[r]?e.reportError(new GraphQLError(`There can be only one type named "${r}".`,[t[r],i.name])):t[r]=i.name,!1;e.reportError(new GraphQLError(`Type "${r}" already exists in the schema. It cannot also be defined in this type definition.`,i.name))}},function(e){const t=e.getSchema(),n=t?t.getTypeMap():Object.create(null),i=Object.create(null);return{EnumTypeDefinition:r,EnumTypeExtension:r};function r(t){var r;const o=t.name.value;i[o]||(i[o]=Object.create(null));const s=null!==(r=t.values)&&void 0!==r?r:[],a=i[o];for(const t of s){const i=t.name.value,r=n[o];xe(r)&&r.getValue(i)?e.reportError(new GraphQLError(`Enum value "${o}.${i}" already exists in the schema. It cannot also be defined in this type extension.`,t.name)):a[i]?e.reportError(new GraphQLError(`Enum value "${o}.${i}" can only be defined once.`,[a[i],t.name])):a[i]=t.name}return!1}},function(e){const t=e.getSchema(),n=t?t.getTypeMap():Object.create(null),i=Object.create(null);return{InputObjectTypeDefinition:r,InputObjectTypeExtension:r,InterfaceTypeDefinition:r,InterfaceTypeExtension:r,ObjectTypeDefinition:r,ObjectTypeExtension:r};function r(t){var r;const o=t.name.value;i[o]||(i[o]=Object.create(null));const s=null!==(r=t.fields)&&void 0!==r?r:[],a=i[o];for(const t of s){const i=t.name.value;jn(n[o],i)?e.reportError(new GraphQLError(`Field "${o}.${i}" already exists in the schema. It cannot also be defined in this type extension.`,t.name)):a[i]?e.reportError(new GraphQLError(`Field "${o}.${i}" can only be defined once.`,[a[i],t.name])):a[i]=t.name}return!1}},function(e){return{DirectiveDefinition(e){var t;const i=null!==(t=e.arguments)&&void 0!==t?t:[];return n(`@${e.name.value}`,i)},InterfaceTypeDefinition:t,InterfaceTypeExtension:t,ObjectTypeDefinition:t,ObjectTypeExtension:t};function t(e){var t;const i=e.name.value,r=null!==(t=e.fields)&&void 0!==t?t:[];for(const e of r){var o;n(`${i}.${e.name.value}`,null!==(o=e.arguments)&&void 0!==o?o:[])}return!1}function n(t,n){const i=$n(n,(e=>e.name.value));for(const[n,r]of i)r.length>1&&e.reportError(new GraphQLError(`Argument "${t}(${n}:)" can only be defined once.`,r.map((e=>e.name))));return!1}},function(e){const t=Object.create(null),n=e.getSchema();return{DirectiveDefinition(i){const r=i.name.value;if(null==n||!n.getDirective(r))return t[r]?e.reportError(new GraphQLError(`There can be only one directive named "@${r}".`,[t[r],i.name])):t[r]=i.name,!1;e.reportError(new GraphQLError(`Directive "@${r}" already exists in the schema. It cannot be redefined.`,i.name))}}},dn,pn,Un,function(e){const t=e.getSchema(),n=Object.create(null);for(const t of e.getDocument().definitions)cn(t)&&(n[t.name.value]=t);return{ScalarTypeExtension:r,ObjectTypeExtension:r,InterfaceTypeExtension:r,UnionTypeExtension:r,EnumTypeExtension:r,InputObjectTypeExtension:r};function r(r){const o=r.name.value,s=n[o],a=null==t?void 0:t.getType(o);let c;if(s?c=Sn[s.kind]:a&&(c=function(e){if(Ae(e))return m.SCALAR_TYPE_EXTENSION;if(De(e))return m.OBJECT_TYPE_EXTENSION;if(we(e))return m.INTERFACE_TYPE_EXTENSION;if(ke(e))return m.UNION_TYPE_EXTENSION;if(xe(e))return m.ENUM_TYPE_EXTENSION;if(Fe(e))return m.INPUT_OBJECT_TYPE_EXTENSION;i(!1,"Unexpected type: "+Y(e))}(a)),c){if(c!==r.kind){const t=function(e){switch(e){case m.SCALAR_TYPE_EXTENSION:return"scalar";case m.OBJECT_TYPE_EXTENSION:return"object";case m.INTERFACE_TYPE_EXTENSION:return"interface";case m.UNION_TYPE_EXTENSION:return"union";case m.ENUM_TYPE_EXTENSION:return"enum";case m.INPUT_OBJECT_TYPE_EXTENSION:return"input object";default:i(!1,"Unexpected kind: "+Y(e))}}(r.kind);e.reportError(new GraphQLError(`Cannot extend non-${t} type "${o}".`,s?[s,r]:r))}}else{const i=ae(o,Object.keys({...n,...null==t?void 0:t.getTypeMap()}));e.reportError(new GraphQLError(`Cannot extend type "${o}" because it is not defined.`+W(i),r.name))}}},ln,Qn,Vn,An]);class ASTValidationContext{constructor(e,t){this._ast=e,this._fragments=void 0,this._fragmentSpreads=new Map,this._recursivelyReferencedFragments=new Map,this._onError=t}get[Symbol.toStringTag](){return"ASTValidationContext"}reportError(e){this._onError(e)}getDocument(){return this._ast}getFragment(e){let t;if(this._fragments)t=this._fragments;else{t=Object.create(null);for(const e of this.getDocument().definitions)e.kind===m.FRAGMENT_DEFINITION&&(t[e.name.value]=e);this._fragments=t}return t[e]}getFragmentSpreads(e){let t=this._fragmentSpreads.get(e);if(!t){t=[];const n=[e];let i;for(;i=n.pop();)for(const e of i.selections)e.kind===m.FRAGMENT_SPREAD?t.push(e):e.selectionSet&&n.push(e.selectionSet);this._fragmentSpreads.set(e,t)}return t}getRecursivelyReferencedFragments(e){let t=this._recursivelyReferencedFragments.get(e);if(!t){t=[];const n=Object.create(null),i=[e.selectionSet];let r;for(;r=i.pop();)for(const e of this.getFragmentSpreads(r)){const r=e.name.value;if(!0!==n[r]){n[r]=!0;const e=this.getFragment(r);e&&(t.push(e),i.push(e.selectionSet))}}this._recursivelyReferencedFragments.set(e,t)}return t}}class SDLValidationContext extends ASTValidationContext{constructor(e,t,n){super(e,n),this._schema=t}get[Symbol.toStringTag](){return"SDLValidationContext"}getSchema(){return this._schema}}class ValidationContext extends ASTValidationContext{constructor(e,t,n,i){super(t,i),this._schema=e,this._typeInfo=n,this._variableUsages=new Map,this._recursiveVariableUsages=new Map}get[Symbol.toStringTag](){return"ValidationContext"}getSchema(){return this._schema}getVariableUsages(e){let t=this._variableUsages.get(e);if(!t){const n=[],i=new TypeInfo(this._schema);he(e,sn(i,{VariableDefinition:()=>!1,Variable(e){n.push({node:e,type:i.getInputType(),defaultValue:i.getDefaultValue()})}})),t=n,this._variableUsages.set(e,t)}return t}getRecursiveVariableUsages(e){let t=this._recursiveVariableUsages.get(e);if(!t){t=this.getVariableUsages(e);for(const n of this.getRecursivelyReferencedFragments(e))t=t.concat(this.getVariableUsages(n));this._recursiveVariableUsages.set(e,t)}return t}getType(){return this._typeInfo.getType()}getParentType(){return this._typeInfo.getParentType()}getInputType(){return this._typeInfo.getInputType()}getParentInputType(){return this._typeInfo.getParentInputType()}getFieldDef(){return this._typeInfo.getFieldDef()}getDirective(){return this._typeInfo.getDirective()}getArgument(){return this._typeInfo.getArgument()}getEnumValue(){return this._typeInfo.getEnumValue()}}function Jn(e,n,i=Bn,r,o=new TypeInfo(e)){var s;const a=null!==(s=null==r?void 0:r.maxErrors)&&void 0!==s?s:100;n||t(!1,"Must provide document."),function(e){const t=Bt(e);if(0!==t.length)throw new Error(t.map((e=>e.message)).join("\n\n"))}(e);const c=Object.freeze({}),u=[],l=new ValidationContext(e,n,o,(e=>{if(u.length>=a)throw u.push(new GraphQLError("Too many validation errors, error limit reached. Validation aborted.")),c;u.push(e)})),p=me(i.map((e=>e(l))));try{he(n,sn(o,p))}catch(e){if(e!==c)throw e}return u}function qn(e,t,n=Yn){const i=[],r=new SDLValidationContext(e,t,(e=>{i.push(e)}));return he(e,me(n.map((e=>e(r))))),i}function Kn(e,i){n(e)&&n(e.__schema)||t(!1,`Invalid or incomplete introspection result. Ensure that you are passing "data" property of introspection response and no "errors" was returned alongside: ${Y(e)}.`);const r=e.__schema,o=te(r.types,(e=>e.name),(e=>function(e){if(null!=e&&null!=e.name&&null!=e.kind)switch(e.kind){case Ct.SCALAR:return new GraphQLScalarType({name:(i=e).name,description:i.description,specifiedByURL:i.specifiedByURL});case Ct.OBJECT:return new GraphQLObjectType({name:(n=e).name,description:n.description,interfaces:()=>h(n),fields:()=>m(n)});case Ct.INTERFACE:return new GraphQLInterfaceType({name:(t=e).name,description:t.description,interfaces:()=>h(t),fields:()=>m(t)});case Ct.UNION:return function(e){if(!e.possibleTypes){const t=Y(e);throw new Error(`Introspection result missing possibleTypes: ${t}.`)}return new GraphQLUnionType({name:e.name,description:e.description,types:()=>e.possibleTypes.map(d)})}(e);case Ct.ENUM:return function(e){if(!e.enumValues){const t=Y(e);throw new Error(`Introspection result missing enumValues: ${t}.`)}return new GraphQLEnumType({name:e.name,description:e.description,values:te(e.enumValues,(e=>e.name),(e=>({description:e.description,deprecationReason:e.deprecationReason})))})}(e);case Ct.INPUT_OBJECT:return function(e){if(!e.inputFields){const t=Y(e);throw new Error(`Introspection result missing inputFields: ${t}.`)}return new GraphQLInputObjectType({name:e.name,description:e.description,fields:()=>E(e.inputFields)})}(e)}var t;var n;var i;const r=Y(e);throw new Error(`Invalid or incomplete introspection result. Ensure that a full introspection query is used in order to build a client schema: ${r}.`)}(e)));for(const e of[...vt,...jt])o[e.name]&&(o[e.name]=e);const s=r.queryType?d(r.queryType):null,a=r.mutationType?d(r.mutationType):null,c=r.subscriptionType?d(r.subscriptionType):null,u=r.directives?r.directives.map((function(e){if(!e.args){const t=Y(e);throw new Error(`Introspection result missing directive args: ${t}.`)}if(!e.locations){const t=Y(e);throw new Error(`Introspection result missing directive locations: ${t}.`)}return new GraphQLDirective({name:e.name,description:e.description,isRepeatable:e.isRepeatable,locations:e.locations.slice(),args:E(e.args)})})):[];return new GraphQLSchema({description:r.description,query:s,mutation:a,subscription:c,types:Object.values(o),directives:u,assumeValid:null==i?void 0:i.assumeValid});function l(e){if(e.kind===Ct.LIST){const t=e.ofType;if(!t)throw new Error("Decorated type deeper than introspection query.");return new GraphQLList(l(t))}if(e.kind===Ct.NON_NULL){const t=e.ofType;if(!t)throw new Error("Decorated type deeper than introspection query.");const n=l(t);return new GraphQLNonNull(function(e){if(!Pe(e))throw new Error(`Expected ${Y(e)} to be a GraphQL nullable type.`);return e}(n))}return p(e)}function p(e){const t=e.name;if(!t)throw new Error(`Unknown type reference: ${Y(e)}.`);const n=o[t];if(!n)throw new Error(`Invalid or incomplete schema, unknown type: ${t}. Ensure that a full introspection query is used in order to build a client schema.`);return n}function d(e){return function(e){if(!De(e))throw new Error(`Expected ${Y(e)} to be a GraphQL Object type.`);return e}(p(e))}function f(e){return function(e){if(!we(e))throw new Error(`Expected ${Y(e)} to be a GraphQL Interface type.`);return e}(p(e))}function h(e){if(null===e.interfaces&&e.kind===Ct.INTERFACE)return[];if(!e.interfaces){const t=Y(e);throw new Error(`Introspection result missing interfaces: ${t}.`)}return e.interfaces.map(f)}function m(e){if(!e.fields)throw new Error(`Introspection result missing fields: ${Y(e)}.`);return te(e.fields,(e=>e.name),y)}function y(e){const t=l(e.type);if(!Qe(t)){const e=Y(t);throw new Error(`Introspection must provide output type for fields, but received: ${e}.`)}if(!e.args){const t=Y(e);throw new Error(`Introspection result missing field args: ${t}.`)}return{description:e.description,deprecationReason:e.deprecationReason,type:t,args:E(e.args)}}function E(e){return te(e,(e=>e.name),T)}function T(e){const t=l(e.type);if(!$e(t)){const e=Y(t);throw new Error(`Introspection must provide input type for arguments, but received: ${e}.`)}const n=null!=e.defaultValue?wn(function(e,t){const n=new Parser(e,t);n.expectToken(v.SOF);const i=n.parseValueLiteral(!1);return n.expectToken(v.EOF),i}(e.defaultValue),t):void 0;return{description:e.description,type:t,defaultValue:n,deprecationReason:e.deprecationReason}}}function Xn(e,n,i){Mt(e),null!=n&&n.kind===m.DOCUMENT||t(!1,"Must provide valid Document AST."),!0!==(null==i?void 0:i.assumeValid)&&!0!==(null==i?void 0:i.assumeValidSDL)&&function(e,t){const n=qn(e,t);if(0!==n.length)throw new Error(n.map((e=>e.message)).join("\n\n"))}(n,e);const r=e.toConfig(),o=zn(r,n,i);return r===o?e:new GraphQLSchema(o)}function zn(e,t,n){var r,o,s,a;const c=[],u=Object.create(null),l=[];let p;const d=[];for(const e of t.definitions)if(e.kind===m.SCHEMA_DEFINITION)p=e;else if(e.kind===m.SCHEMA_EXTENSION)d.push(e);else if(cn(e))c.push(e);else if(un(e)){const t=e.name.value,n=u[t];u[t]=n?n.concat([e]):[e]}else e.kind===m.DIRECTIVE_DEFINITION&&l.push(e);if(0===Object.keys(u).length&&0===c.length&&0===l.length&&0===d.length&&null==p)return e;const f=Object.create(null);for(const t of e.types)f[t.name]=T(t);for(const e of c){var h;const t=e.name.value;f[t]=null!==(h=Hn[t])&&void 0!==h?h:k(e)}const v={query:e.query&&E(e.query),mutation:e.mutation&&E(e.mutation),subscription:e.subscription&&E(e.subscription),...p&&g([p]),...g(d)};return{description:null===(r=p)||void 0===r||null===(o=r.description)||void 0===o?void 0:o.value,...v,types:Object.values(f),directives:[...e.directives.map((function(e){const t=e.toConfig();return new GraphQLDirective({...t,args:ne(t.args,I)})})),...l.map((function(e){var t;return new GraphQLDirective({name:e.name.value,description:null===(t=e.description)||void 0===t?void 0:t.value,locations:e.locations.map((({value:e})=>e)),isRepeatable:e.repeatable,args:L(e.arguments),astNode:e})}))],extensions:Object.create(null),astNode:null!==(s=p)&&void 0!==s?s:e.astNode,extensionASTNodes:e.extensionASTNodes.concat(d),assumeValid:null!==(a=null==n?void 0:n.assumeValid)&&void 0!==a&&a};function y(e){return Re(e)?new GraphQLList(y(e.ofType)):Ge(e)?new GraphQLNonNull(y(e.ofType)):E(e)}function E(e){return f[e.name]}function T(e){return Vt(e)||yt(e)?e:Ae(e)?function(e){var t;const n=e.toConfig(),i=null!==(t=u[n.name])&&void 0!==t?t:[];let r=n.specifiedByURL;for(const e of i){var o;r=null!==(o=Zn(e))&&void 0!==o?o:r}return new GraphQLScalarType({...n,specifiedByURL:r,extensionASTNodes:n.extensionASTNodes.concat(i)})}(e):De(e)?function(e){var t;const n=e.toConfig(),i=null!==(t=u[n.name])&&void 0!==t?t:[];return new GraphQLObjectType({...n,interfaces:()=>[...e.getInterfaces().map(E),...D(i)],fields:()=>({...ne(n.fields,N),...b(i)}),extensionASTNodes:n.extensionASTNodes.concat(i)})}(e):we(e)?function(e){var t;const n=e.toConfig(),i=null!==(t=u[n.name])&&void 0!==t?t:[];return new GraphQLInterfaceType({...n,interfaces:()=>[...e.getInterfaces().map(E),...D(i)],fields:()=>({...ne(n.fields,N),...b(i)}),extensionASTNodes:n.extensionASTNodes.concat(i)})}(e):ke(e)?function(e){var t;const n=e.toConfig(),i=null!==(t=u[n.name])&&void 0!==t?t:[];return new GraphQLUnionType({...n,types:()=>[...e.getTypes().map(E),...w(i)],extensionASTNodes:n.extensionASTNodes.concat(i)})}(e):xe(e)?function(e){var t;const n=e.toConfig(),i=null!==(t=u[e.name])&&void 0!==t?t:[];return new GraphQLEnumType({...n,values:{...n.values,...A(i)},extensionASTNodes:n.extensionASTNodes.concat(i)})}(e):Fe(e)?function(e){var t;const n=e.toConfig(),i=null!==(t=u[n.name])&&void 0!==t?t:[];return new GraphQLInputObjectType({...n,fields:()=>({...ne(n.fields,(e=>({...e,type:y(e.type)}))),...S(i)}),extensionASTNodes:n.extensionASTNodes.concat(i)})}(e):void i(!1,"Unexpected type: "+Y(e))}function N(e){return{...e,type:y(e.type),args:e.args&&ne(e.args,I)}}function I(e){return{...e,type:y(e.type)}}function g(e){const t={};for(const i of e){var n;const e=null!==(n=i.operationTypes)&&void 0!==n?n:[];for(const n of e)t[n.operation]=_(n.type)}return t}function _(e){var t;const n=e.name.value,i=null!==(t=Hn[n])&&void 0!==t?t:f[n];if(void 0===i)throw new Error(`Unknown type: "${n}".`);return i}function O(e){return e.kind===m.LIST_TYPE?new GraphQLList(O(e.type)):e.kind===m.NON_NULL_TYPE?new GraphQLNonNull(O(e.type)):_(e)}function b(e){const t=Object.create(null);for(const r of e){var n;const e=null!==(n=r.fields)&&void 0!==n?n:[];for(const n of e){var i;t[n.name.value]={type:O(n.type),description:null===(i=n.description)||void 0===i?void 0:i.value,args:L(n.arguments),deprecationReason:Wn(n),astNode:n}}}return t}function L(e){const t=null!=e?e:[],n=Object.create(null);for(const e of t){var i;const t=O(e.type);n[e.name.value]={type:t,description:null===(i=e.description)||void 0===i?void 0:i.value,defaultValue:wn(e.defaultValue,t),deprecationReason:Wn(e),astNode:e}}return n}function S(e){const t=Object.create(null);for(const r of e){var n;const e=null!==(n=r.fields)&&void 0!==n?n:[];for(const n of e){var i;const e=O(n.type);t[n.name.value]={type:e,description:null===(i=n.description)||void 0===i?void 0:i.value,defaultValue:wn(n.defaultValue,e),deprecationReason:Wn(n),astNode:n}}}return t}function A(e){const t=Object.create(null);for(const r of e){var n;const e=null!==(n=r.values)&&void 0!==n?n:[];for(const n of e){var i;t[n.name.value]={description:null===(i=n.description)||void 0===i?void 0:i.value,deprecationReason:Wn(n),astNode:n}}}return t}function D(e){return e.flatMap((e=>{var t,n;return null!==(t=null===(n=e.interfaces)||void 0===n?void 0:n.map(_))&&void 0!==t?t:[]}))}function w(e){return e.flatMap((e=>{var t,n;return null!==(t=null===(n=e.types)||void 0===n?void 0:n.map(_))&&void 0!==t?t:[]}))}function k(e){var t;const n=e.name.value,i=null!==(t=u[n])&&void 0!==t?t:[];switch(e.kind){case m.OBJECT_TYPE_DEFINITION:{var r;const t=[e,...i];return new GraphQLObjectType({name:n,description:null===(r=e.description)||void 0===r?void 0:r.value,interfaces:()=>D(t),fields:()=>b(t),astNode:e,extensionASTNodes:i})}case m.INTERFACE_TYPE_DEFINITION:{var o;const t=[e,...i];return new GraphQLInterfaceType({name:n,description:null===(o=e.description)||void 0===o?void 0:o.value,interfaces:()=>D(t),fields:()=>b(t),astNode:e,extensionASTNodes:i})}case m.ENUM_TYPE_DEFINITION:{var s;const t=[e,...i];return new GraphQLEnumType({name:n,description:null===(s=e.description)||void 0===s?void 0:s.value,values:A(t),astNode:e,extensionASTNodes:i})}case m.UNION_TYPE_DEFINITION:{var a;const t=[e,...i];return new GraphQLUnionType({name:n,description:null===(a=e.description)||void 0===a?void 0:a.value,types:()=>w(t),astNode:e,extensionASTNodes:i})}case m.SCALAR_TYPE_DEFINITION:var c;return new GraphQLScalarType({name:n,description:null===(c=e.description)||void 0===c?void 0:c.value,specifiedByURL:Zn(e),astNode:e,extensionASTNodes:i});case m.INPUT_OBJECT_TYPE_DEFINITION:{var l;const t=[e,...i];return new GraphQLInputObjectType({name:n,description:null===(l=e.description)||void 0===l?void 0:l.value,fields:()=>S(t),astNode:e,extensionASTNodes:i})}}}}const Hn=ee([...vt,...jt],(e=>e.name));function Wn(e){const t=xn(_t,e);return null==t?void 0:t.reason}function Zn(e){const t=xn(Ot,e);return null==t?void 0:t.url}function ei(e,n){null!=e&&e.kind===m.DOCUMENT||t(!1,"Must provide valid Document AST."),!0!==(null==n?void 0:n.assumeValid)&&!0!==(null==n?void 0:n.assumeValidSDL)&&function(e){const t=qn(e);if(0!==t.length)throw new Error(t.map((e=>e.message)).join("\n\n"))}(e);const i=zn({description:void 0,types:[],directives:[],extensions:Object.create(null),extensionASTNodes:[],assumeValid:!1},e,n);if(null==i.astNode)for(const e of i.types)switch(e.name){case"Query":i.query=e;break;case"Mutation":i.mutation=e;break;case"Subscription":i.subscription=e}const r=[...i.directives,...bt.filter((e=>i.directives.every((t=>t.name!==e.name))))];return new GraphQLSchema({...i,directives:r})}function ti(e){return function(e,t,n){const r=e.getDirectives().filter(t),o=Object.values(e.getTypeMap()).filter(n);return[ii(e),...r.map((e=>function(e){return li(e)+"directive @"+e.name+ai(e.args)+(e.isRepeatable?" repeatable":"")+" on "+e.locations.join(" | ")}(e))),...o.map((e=>function(e){if(Ae(e))return function(e){return li(e)+`scalar ${e.name}`+function(e){if(null==e.specifiedByURL)return"";return` @specifiedBy(url: ${ye({kind:m.STRING,value:e.specifiedByURL})})`}(e)}(e);if(De(e))return function(e){return li(e)+`type ${e.name}`+ri(e)+oi(e)}(e);if(we(e))return function(e){return li(e)+`interface ${e.name}`+ri(e)+oi(e)}(e);if(ke(e))return function(e){const t=e.getTypes(),n=t.length?" = "+t.join(" | "):"";return li(e)+"union "+e.name+n}(e);if(xe(e))return function(e){const t=e.getValues().map(((e,t)=>li(e," ",!t)+" "+e.name+ui(e.deprecationReason)));return li(e)+`enum ${e.name}`+si(t)}(e);if(Fe(e))return function(e){const t=Object.values(e.getFields()).map(((e,t)=>li(e," ",!t)+" "+ci(e)));return li(e)+`input ${e.name}`+si(t)}(e);i(!1,"Unexpected type: "+Y(e))}(e)))].filter(Boolean).join("\n\n")}(e,(e=>{return t=e,!bt.some((({name:e})=>e===t.name));var t}),ni)}function ni(e){return!yt(e)&&!Vt(e)}function ii(e){if(null==e.description&&function(e){const t=e.getQueryType();if(t&&"Query"!==t.name)return!1;const n=e.getMutationType();if(n&&"Mutation"!==n.name)return!1;const i=e.getSubscriptionType();if(i&&"Subscription"!==i.name)return!1;return!0}(e))return;const t=[],n=e.getQueryType();n&&t.push(` query: ${n.name}`);const i=e.getMutationType();i&&t.push(` mutation: ${i.name}`);const r=e.getSubscriptionType();return r&&t.push(` subscription: ${r.name}`),li(e)+`schema {\n${t.join("\n")}\n}`}function ri(e){const t=e.getInterfaces();return t.length?" implements "+t.map((e=>e.name)).join(" & "):""}function oi(e){return si(Object.values(e.getFields()).map(((e,t)=>li(e," ",!t)+" "+e.name+ai(e.args," ")+": "+String(e.type)+ui(e.deprecationReason))))}function si(e){return 0!==e.length?" {\n"+e.join("\n")+"\n}":""}function ai(e,t=""){return 0===e.length?"":e.every((e=>!e.description))?"("+e.map(ci).join(", ")+")":"(\n"+e.map(((e,n)=>li(e," "+t,!n)+" "+t+ci(e))).join("\n")+"\n"+t+")"}function ci(e){const t=Lt(e.defaultValue,e.type);let n=e.name+": "+String(e.type);return t&&(n+=` = ${ye(t)}`),n+ui(e.deprecationReason)}function ui(e){if(null==e)return"";if(e!==gt){return` @deprecated(reason: ${ye({kind:m.STRING,value:e})})`}return" @deprecated"}function li(e,t="",n=!0){const{description:i}=e;if(null==i)return"";return(t&&!n?"\n"+t:t)+ye({kind:m.STRING,value:i,block:O(i)}).replace(/\n/g,"\n"+t)+"\n"}function pi(e){const t=[];for(const n of e)t.push(...n.definitions);return{kind:m.DOCUMENT,definitions:t}}const di=[hn];function fi(e){var t;const n=function(e){if(e)return function(t){const n=e;return{Field(e){var i;const r=(null!==(i=e.alias)&&void 0!==i?i:e.name).value,o=r.charAt(0).toLowerCase()+r.slice(1);n.includes(o)&&t.reportError(new GraphQLError(`Field name "${r}" is not allowed because it conflicts with generated object APIs. Please use an alias to change the field name.`,{nodes:e}))}}};return}(null===(t=e.disallowedFieldNames)||void 0===t?void 0:t.allFields),i=function(e){if(e)return function(t){const n=e;return{VariableDefinition(e){const i=e.variable.name.value,r=i.charAt(0).toLowerCase()+i.slice(1);n.includes(r)&&t.reportError(new GraphQLError(`Input Parameter name "${i}" is not allowed because it conflicts with generated object APIs.`,{nodes:e}))}}};return}(e.disallowedInputParameterNames);return[hi,mi,...n?[n]:[],...i?[i]:[],...Bn.filter((e=>!di.includes(e)))]}function hi(e){return{OperationDefinition:t=>(t.name||e.reportError(new GraphQLError("Apollo does not support anonymous operations because operation names are used during code generation. Please give this operation a name.",t)),!1)}}function mi(e){return{Field(t){"__typename"==(t.alias&&t.alias.value)&&e.reportError(new GraphQLError("Apollo needs to be able to insert __typename when needed, so using it as an alias is not supported.",t))}}}const vi={kind:m.DIRECTIVE_DEFINITION,description:(yi="A directive used by the Apollo iOS client to annotate operations or fragments that should be used exclusively for generating local cache mutations instead of as standard operations.",{kind:m.STRING,value:yi}),name:Ei("apollo_client_ios_localCacheMutation"),repeatable:!1,locations:[Ei("QUERY"),Ei("MUTATION"),Ei("SUBSCRIPTION"),Ei("FRAGMENT_DEFINITION")]};var yi;function Ei(e){return{kind:m.NAME,value:e}}const Ti={kind:m.DOCUMENT,definitions:[vi]};const Ni={kind:m.FIELD,name:{kind:m.NAME,value:"__typename"}};class GraphQLSchemaValidationError extends Error{constructor(e){super(e.map((e=>e.message)).join("\n\n")),this.validationErrors=e,this.name="GraphQLSchemaValidationError"}}function Ii(e){return e.startsWith("__")}const gi={kind:m.FIELD,name:{kind:m.NAME,value:"__typename"}};function _i(e,t){return t&&(e=function(e){return he(e,{enter:e=>e.kind!==m.SELECTION_SET?void 0:{...e,selections:e.selections.filter((e=>!("Field"===e.kind&&"__typename"===e.name.value)))},leave(e){if((e.kind===m.FIELD||e.kind===m.FRAGMENT_DEFINITION||e.kind===m.INLINE_FRAGMENT)&&e.selectionSet)return{...e,selectionSet:{...e.selectionSet,selections:[Ni,...e.selectionSet.selections]}}}})}(e)),he(e,{SelectionSet:{leave:(e,t,n)=>d(n)&&![m.FIELD,m.FRAGMENT_DEFINITION].includes(n.kind)?e:function(e){const t=e.selections.find((e=>e.kind==gi.kind&&e.name.value==gi.name.value));return t?e:{...e,selections:[gi,...e.selections]}}(e)},Field:{enter:e=>function(e){return e.name.value==gi.name.value?{...e,alias:void 0,directives:void 0}:e}(e)},Directive:{enter:e=>function(e){return e.name.value==vi.name.value?null:e}(e)}})}function Oi(e){return null!=e}function bi(e){switch(e.kind){case m.VARIABLE:return{kind:e.kind,value:e.name.value};case m.LIST:return{kind:e.kind,value:e.values.map(bi)};case m.OBJECT:return{kind:e.kind,value:e.fields.reduce(((e,t)=>(e[t.name.value]=bi(t.value),e)),{})};default:return e}}function Li(e){var t,n;return null===(n=null===(t=e.loc)||void 0===t?void 0:t.source)||void 0===n?void 0:n.name}function Si(e,t,n,i){var r;const o=new Map;for(const e of t.definitions)e.kind===m.FRAGMENT_DEFINITION&&o.set(e.name.value,e);const s=[],a=new Map,c=new Set,u={queryType:e.getQueryType(),mutationType:e.getMutationType(),subscriptionType:e.getSubscriptionType()};for(const e of t.definitions)e.kind===m.OPERATION_DEFINITION&&s.push(p(e));for(const[e,t]of o.entries())a.set(e,d(t));return{rootTypes:u,operations:s,fragments:Array.from(a.values()),referencedTypes:Array.from(c.values()),schemaDocumentation:null!==(r=e.description)&&void 0!==r?r:void 0};function l(t){if(!c.has(t)){if(c.add(t),we(t))for(const n of e.getPossibleTypes(t))l(Je(n));if(ke(t)){const e=t.getTypes();for(t of e)l(Je(t))}if(Fe(t)&&function(e){const t=e.getFields();for(const e in t){l(Je(t[e].type))}}(t),De(t))for(const e of t.getInterfaces())l(Je(e))}}function p(t){var i;if(!t.name)throw new GraphQLError("Operations should be named",{nodes:t});const r=Li(t),o=t.name.value,s=t.operation,a=(t.variableDefinitions||[]).map((t=>{const n=t.variable.name.value,i=t.defaultValue?bi(t.defaultValue):void 0,r=rn(e,t.type);if(!r)throw new GraphQLError(`Couldn't get type from type node "${t.type}"`,{nodes:t});return l(Je(r)),{name:n,type:r,defaultValue:i}})),c=ye(_i(t,n)),u=e.getRootType(s),[p]=null!==(i=v(t.directives))&&void 0!==i?i:[void 0,void 0];return l(u),{name:o,operationType:s,variables:a,rootType:u,selectionSet:f(t.selectionSet,u),directives:p,source:c,filePath:r}}function d(t){var i;const r=t.name.value,o=Li(t),s=ye(_i(t,n)),a=rn(e,t.typeCondition),[c]=null!==(i=v(t.directives))&&void 0!==i?i:[void 0,void 0];return l(Je(a)),{name:r,filePath:o,source:s,typeCondition:a,selectionSet:f(t.selectionSet,a),directives:c}}function f(t,n){return{parentType:n,selections:t.selections.map((t=>function(t,n){var r,s,c,u;const[p,y]=null!==(r=v(t.directives))&&void 0!==r?r:[void 0,void 0];switch(t.kind){case m.FIELD:{const E=t.name.value;if("__typename"==E)return;const T=null===(s=t.alias)||void 0===s?void 0:s.value,N=function(e,t,n){return n===$t.name&&e.getQueryType()===t?$t:n===Qt.name&&e.getQueryType()===t?Qt:n===Ut.name&&(De(t)||we(t)||ke(t))?Ut:De(t)||we(t)?t.getFields()[n]:void 0}(e,n,E);if(!N)throw new GraphQLError(`Cannot query field "${E}" on type "${String(n)}"`,{nodes:t});const I=mn(N.type,t.required),g=Je(I);l(Je(g));const{description:_,deprecationReason:O}=N;let b={kind:"Field",name:E,alias:T,type:I,arguments:h(N,t.arguments),inclusionConditions:y,description:!Ii(E)&&_?_:void 0,deprecationReason:O||void 0,directives:p};function L(e,t,n){var i;if(t&&n){const r=(null!==(i=e.alias)&&void 0!==i?i:e.name).value,o=r.charAt(0).toLowerCase()+r.slice(1);if(null==t?void 0:t.includes(o))throw new GraphQLError(`Schema name "${n}" conflicts with name of a generated object API. Please choose a different schema name. Suggestions: "${n}Schema", "${n}GraphQL", "${n}API"`,{nodes:e})}}if(Re(I)||Ge(I)&&Re(I.ofType)?L(t,null===(c=i.disallowedFieldNames)||void 0===c?void 0:c.entityList,i.schemaNamespace):je(g)&&L(t,null===(u=i.disallowedFieldNames)||void 0===u?void 0:u.entity,i.schemaNamespace),je(g)){const S=t.selectionSet;if(!S)throw new GraphQLError(`Composite field "${E}" on type "${String(n)}" requires selection set`,{nodes:t});b.selectionSet=f(S,g)}return b}case m.INLINE_FRAGMENT:{const A=t.typeCondition,D=A?rn(e,A):n;return l(D),{kind:"InlineFragment",selectionSet:f(t.selectionSet,D),inclusionConditions:y,directives:p}}case m.FRAGMENT_SPREAD:{const w=t.name.value,k=function(e){let t=a.get(e);if(t)return t;const n=o.get(e);return n?(o.delete(e),t=d(n),a.set(e,t),t):void 0}(w);if(!k)throw new GraphQLError(`Unknown fragment "${w}".`,{nodes:t.name});return{kind:"FragmentSpread",fragment:k,inclusionConditions:y,directives:p}}}}(t,n))).filter(Oi)}}function h(...e){const t=e[0].args;return e[1]&&e[1].length>0?e[1].map((e=>{var n;const i=e.name.value,r=t.find((t=>t.name===e.name.value)),o=null==r?void 0:r.type;if(!o)throw new GraphQLError(`Cannot find directive argument type for argument "${i}".`,{nodes:[e]});return{name:i,value:bi(e.value),type:o,deprecationReason:null!==(n=r.deprecationReason)&&void 0!==n?n:void 0}})):void 0}function v(t){if(t&&t.length>0){const n=[],i=[];for(const r of t){const t=r.name.value,o=e.getDirective(t);if(!o)throw new GraphQLError(`Cannot find directive "${t}".`,{nodes:r});n.push({name:t,arguments:h(o,r.arguments)});const s=y(r,o);s&&i.push(s)}return[n,i.length>0?i:void 0]}}function y(e,t){var n;if("include"==t.name||"skip"==t.name){const i=null===(n=e.arguments)||void 0===n?void 0:n[0].value,r="skip"==t.name;switch(null==i?void 0:i.kind){case m.BOOLEAN:return r?i.value?"SKIPPED":"INCLUDED":i.value?"INCLUDED":"SKIPPED";case m.VARIABLE:return{variable:i.name.value,isInverted:r};default:throw new GraphQLError('Conditional inclusion directive has invalid "if" argument.',{nodes:e})}}}}return e.GraphQLEnumType=GraphQLEnumType,e.GraphQLError=GraphQLError,e.GraphQLInputObjectType=GraphQLInputObjectType,e.GraphQLInterfaceType=GraphQLInterfaceType,e.GraphQLObjectType=GraphQLObjectType,e.GraphQLScalarType=GraphQLScalarType,e.GraphQLSchema=GraphQLSchema,e.GraphQLSchemaValidationError=GraphQLSchemaValidationError,e.GraphQLUnionType=GraphQLUnionType,e.Source=Source,e.compileDocument=function(e,t,n,i){return Si(e,t,n,i)},e.loadSchemaFromSources=function(e){var t,n=new Array;for(const i of e)if(i.name.endsWith(".json")){if(t)throw new Error(`Schema search paths can only include one JSON schema definition.\n Found "${t.name} & "${i.name}".`);t=i}else n.push(K(i));var i=function(e){return e.definitions.some((e=>e.kind==m.DIRECTIVE_DEFINITION&&e.name.value==vi.name.value))?e:pi([e,Ti])}(pi(n));t||function(e){const t=qn(e);if(0!==t.length)throw new GraphQLSchemaValidationError(t)}(i);const r=t?Xn(function(e){let t=JSON.parse(e);t.data&&(t=t.data);const n=Kn(t);return n}(t.body),i,{assumeValid:!0,assumeValidSDL:!0}):ei(i,{assumeValid:!0,assumeValidSDL:!0});return function(e){const t=Bt(e);if(0!==t.length)throw new GraphQLSchemaValidationError(t)}(r),r},e.mergeDocuments=function(e){return pi(e)},e.parseOperationDocument=function(e,t){return K(e,{experimentalClientControlledNullability:t})},e.printSchemaToSDL=function(e){return ti(e)},e.validateDocument=function(e,t,n){return Jn(e,t,fi(n))},Object.defineProperty(e,"__esModule",{value:!0}),e}({});"# \ No newline at end of file diff --git a/Sources/ApolloCodegenLib/Frontend/CompilationResult.swift b/Sources/ApolloCodegenLib/Frontend/CompilationResult.swift index 49ae4cbadd..9aa647b56c 100644 --- a/Sources/ApolloCodegenLib/Frontend/CompilationResult.swift +++ b/Sources/ApolloCodegenLib/Frontend/CompilationResult.swift @@ -5,6 +5,8 @@ public class CompilationResult: JavaScriptObject { private enum Constants { static let LocalCacheMutationDirectiveName = "apollo_client_ios_localCacheMutation" } + lazy var rootTypes: RootTypeDefinition = self["rootTypes"] + lazy var referencedTypes: [GraphQLNamedType] = self["referencedTypes"] lazy var operations: [OperationDefinition] = self["operations"] @@ -13,6 +15,31 @@ public class CompilationResult: JavaScriptObject { lazy var schemaDocumentation: String? = self["schemaDocumentation"] + required init(_ jsValue: JSValue, bridge: JavaScriptBridge) { + super.init(jsValue, bridge: bridge) + processRootTypes() + } + + private func processRootTypes() { + let typeList = [rootTypes.queryType.name, rootTypes.mutationType?.name, rootTypes.subscriptionType?.name].compactMap { $0 } + + operations.forEach { op in + op.rootType.isRootFieldType = typeList.contains(op.rootType.name) + } + + fragments.forEach { fragment in + fragment.type.isRootFieldType = typeList.contains(fragment.type.name) + } + } + + public class RootTypeDefinition: JavaScriptObject { + lazy var queryType: GraphQLNamedType = self["queryType"] + + lazy var mutationType: GraphQLNamedType? = self["mutationType"] + + lazy var subscriptionType: GraphQLNamedType? = self["subscriptionType"] + } + public class OperationDefinition: JavaScriptObject, Equatable { lazy var name: String = self["name"] diff --git a/Sources/ApolloCodegenLib/Frontend/GraphQLSchema.swift b/Sources/ApolloCodegenLib/Frontend/GraphQLSchema.swift index 888822a79d..224652a56e 100644 --- a/Sources/ApolloCodegenLib/Frontend/GraphQLSchema.swift +++ b/Sources/ApolloCodegenLib/Frontend/GraphQLSchema.swift @@ -113,9 +113,8 @@ public class GraphQLCompositeType: GraphQLNamedType { "Type - \(name)" } - var isRootFieldType: Bool { - ["Query", "Mutation", "Subscription"].contains(name) - } + var isRootFieldType: Bool = false + } protocol GraphQLInterfaceImplementingType: GraphQLCompositeType { diff --git a/Sources/ApolloCodegenLib/Frontend/JavaScript/src/compiler/index.ts b/Sources/ApolloCodegenLib/Frontend/JavaScript/src/compiler/index.ts index 66a52e25ad..76d02ddb84 100644 --- a/Sources/ApolloCodegenLib/Frontend/JavaScript/src/compiler/index.ts +++ b/Sources/ApolloCodegenLib/Frontend/JavaScript/src/compiler/index.ts @@ -46,6 +46,7 @@ function filePathForNode(node: ASTNode): string | undefined { } export interface CompilationResult { + rootTypes: ir.RootTypeDefinition; operations: ir.OperationDefinition[]; fragments: ir.FragmentDefinition[]; referencedTypes: GraphQLNamedType[]; @@ -71,6 +72,12 @@ export function compileToIR( const fragmentMap = new Map(); const referencedTypes = new Set(); + const rootTypes: ir.RootTypeDefinition = { + queryType: schema.getQueryType(), + mutationType: schema.getMutationType(), + subscriptionType: schema.getSubscriptionType() + }; + for (const definitionNode of document.definitions) { if (definitionNode.kind !== Kind.OPERATION_DEFINITION) continue; @@ -86,7 +93,8 @@ export function compileToIR( } return { - operations, + rootTypes: rootTypes, + operations: operations, fragments: Array.from(fragmentMap.values()), referencedTypes: Array.from(referencedTypes.values()), schemaDocumentation: schema.description ?? undefined diff --git a/Sources/ApolloCodegenLib/Frontend/JavaScript/src/compiler/ir.ts b/Sources/ApolloCodegenLib/Frontend/JavaScript/src/compiler/ir.ts index e8f87dec1d..27a6cf65ac 100644 --- a/Sources/ApolloCodegenLib/Frontend/JavaScript/src/compiler/ir.ts +++ b/Sources/ApolloCodegenLib/Frontend/JavaScript/src/compiler/ir.ts @@ -1,12 +1,19 @@ import { GraphQLCompositeType, GraphQLInputType, + GraphQLNamedType, GraphQLObjectType, GraphQLOutputType, GraphQLType, } from "graphql"; import { GraphQLValue } from "./values"; +export interface RootTypeDefinition { + queryType: GraphQLNamedType | unknown; + mutationType: GraphQLNamedType | unknown; + subscriptionType: GraphQLNamedType | unknown; +} + export interface OperationDefinition { name: string; operationType: OperationType; diff --git a/Sources/ApolloCodegenLib/Frontend/auto_rollup.sh b/Sources/ApolloCodegenLib/Frontend/auto_rollup.sh new file mode 100644 index 0000000000..34b3c4d7fe --- /dev/null +++ b/Sources/ApolloCodegenLib/Frontend/auto_rollup.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) +output_file="$SCRIPT_DIR/ApolloCodegenFrontendBundle.swift" +$( cd "$SCRIPT_DIR/Javascript" && rollup -c ) +minJS=$(cat "$SCRIPT_DIR/dist/ApolloCodegenFrontend.bundle.js") +printf "%s%s%s" "let ApolloCodegenFrontendBundle: String = #\"" "$minJS" "\"#" > $output_file diff --git a/Tests/ApolloCodegenTests/CodeGeneration/Templates/SelectionSet/SelectionSetTemplateTests.swift b/Tests/ApolloCodegenTests/CodeGeneration/Templates/SelectionSet/SelectionSetTemplateTests.swift index 94463b0156..a049adb932 100644 --- a/Tests/ApolloCodegenTests/CodeGeneration/Templates/SelectionSet/SelectionSetTemplateTests.swift +++ b/Tests/ApolloCodegenTests/CodeGeneration/Templates/SelectionSet/SelectionSetTemplateTests.swift @@ -336,6 +336,54 @@ class SelectionSetTemplateTests: XCTestCase { // then expect(actual).to(equalLineByLine(expected, atLine: 6, ignoringExtraLines: true)) } + + func test__render_selections__givenCustomRootTypes_doesNotGenerateTypenameField() throws { + // given + schemaSDL = """ + schema { + query: RootQueryType + mutation: RootMutationType + } + + type RootQueryType { + allAnimals: [Animal!] + } + + type RootMutationType { + feedAnimal: Animal! + } + + type Animal { + FieldName: String! + } + """ + + document = """ + query TestOperation { + allAnimals { + FieldName + } + } + """ + + let expected = """ + public static var __selections: [Apollo.Selection] { [ + .field("allAnimals", [AllAnimal]?.self), + ] } + """ + + // when + try buildSubjectAndOperation(cocoapodsImportStatements: true) + let allAnimals = try XCTUnwrap( + operation[field: "query"] as? IR.EntityField + ) + + let actual = subject.render(field: allAnimals) + print("Actual Output - \(actual)") + + // then + expect(actual).to(equalLineByLine(expected, atLine: 7, ignoringExtraLines: true)) + } // MARK: Selections - Fields From 0eaede2c19ecd3c08d4db36707ce69aedfa50503 Mon Sep 17 00:00:00 2001 From: Zach FettersMoore <4425109+BobaFetters@users.noreply.github.com> Date: Wed, 26 Apr 2023 16:25:25 -0400 Subject: [PATCH 2/2] Updating RootTypeDefinition model and fixing tests -Updated `RootTypeDefinition` so that `queryType` is required -Moved `processRootTypes` functionality out of `CompilationResult` and into `IR` class --- .../ApolloCodegenFrontendBundle.swift | 2 +- .../Frontend/CompilationResult.swift | 17 --------------- .../Frontend/JavaScript/src/compiler/index.ts | 11 +++++++--- .../Frontend/JavaScript/src/compiler/ir.ts | 6 +++--- Sources/ApolloCodegenLib/IR/IR.swift | 14 +++++++++++++ .../MockCompilationResult.swift | 21 ++++++++++++++++++- .../MockGraphQLType.swift | 1 - .../SelectionSetTemplateTests.swift | 5 ++--- 8 files changed, 48 insertions(+), 29 deletions(-) diff --git a/Sources/ApolloCodegenLib/Frontend/ApolloCodegenFrontendBundle.swift b/Sources/ApolloCodegenLib/Frontend/ApolloCodegenFrontendBundle.swift index 92928d0f3a..789133845e 100644 --- a/Sources/ApolloCodegenLib/Frontend/ApolloCodegenFrontendBundle.swift +++ b/Sources/ApolloCodegenLib/Frontend/ApolloCodegenFrontendBundle.swift @@ -1 +1 @@ -let ApolloCodegenFrontendBundle: String = #"var ApolloCodegenFrontend=function(e){"use strict";function t(e,t){if(!Boolean(e))throw new Error(t)}function n(e){return"object"==typeof e&&null!==e}function i(e,t){if(!Boolean(e))throw new Error(null!=t?t:"Unexpected invariant triggered.")}const r=/\r\n|[\n\r]/g;function o(e,t){let n=0,o=1;for(const s of e.body.matchAll(r)){if("number"==typeof s.index||i(!1),s.index>=t)break;n=s.index+s[0].length,o+=1}return{line:o,column:t+1-n}}function s(e,t){const n=e.locationOffset.column-1,i="".padStart(n)+e.body,r=t.line-1,o=e.locationOffset.line-1,s=t.line+o,c=1===t.line?n:0,u=t.column+c,l=`${e.name}:${s}:${u}\n`,p=i.split(/\r\n|[\n\r]/g),d=p[r];if(d.length>120){const e=Math.floor(u/80),t=u%80,n=[];for(let e=0;e["|",e])),["|","^".padStart(t)],["|",n[e+1]]])}return l+a([[s-1+" |",p[r-1]],[`${s} |`,d],["|","^".padStart(u)],[`${s+1} |`,p[r+1]]])}function a(e){const t=e.filter((([e,t])=>void 0!==t)),n=Math.max(...t.map((([e])=>e.length)));return t.map((([e,t])=>e.padStart(n)+(t?" "+t:""))).join("\n")}class GraphQLError extends Error{constructor(e,...t){var i,r,s;const{nodes:a,source:u,positions:l,path:p,originalError:d,extensions:f}=function(e){const t=e[0];return null==t||"kind"in t||"length"in t?{nodes:t,source:e[1],positions:e[2],path:e[3],originalError:e[4],extensions:e[5]}:t}(t);super(e),this.name="GraphQLError",this.path=null!=p?p:void 0,this.originalError=null!=d?d:void 0,this.nodes=c(Array.isArray(a)?a:a?[a]:void 0);const h=c(null===(i=this.nodes)||void 0===i?void 0:i.map((e=>e.loc)).filter((e=>null!=e)));this.source=null!=u?u:null==h||null===(r=h[0])||void 0===r?void 0:r.source,this.positions=null!=l?l:null==h?void 0:h.map((e=>e.start)),this.locations=l&&u?l.map((e=>o(u,e))):null==h?void 0:h.map((e=>o(e.source,e.start)));const m=n(null==d?void 0:d.extensions)?null==d?void 0:d.extensions:void 0;this.extensions=null!==(s=null!=f?f:m)&&void 0!==s?s:Object.create(null),Object.defineProperties(this,{message:{writable:!0,enumerable:!0},name:{enumerable:!1},nodes:{enumerable:!1},source:{enumerable:!1},positions:{enumerable:!1},originalError:{enumerable:!1}}),null!=d&&d.stack?Object.defineProperty(this,"stack",{value:d.stack,writable:!0,configurable:!0}):Error.captureStackTrace?Error.captureStackTrace(this,GraphQLError):Object.defineProperty(this,"stack",{value:Error().stack,writable:!0,configurable:!0})}get[Symbol.toStringTag](){return"GraphQLError"}toString(){let e=this.message;if(this.nodes)for(const n of this.nodes)n.loc&&(e+="\n\n"+s((t=n.loc).source,o(t.source,t.start)));else if(this.source&&this.locations)for(const t of this.locations)e+="\n\n"+s(this.source,t);var t;return e}toJSON(){const e={message:this.message};return null!=this.locations&&(e.locations=this.locations),null!=this.path&&(e.path=this.path),null!=this.extensions&&Object.keys(this.extensions).length>0&&(e.extensions=this.extensions),e}}function c(e){return void 0===e||0===e.length?void 0:e}function u(e,t,n){return new GraphQLError(`Syntax Error: ${n}`,void 0,e,[t])}class Location{constructor(e,t,n){this.start=e.start,this.end=t.end,this.startToken=e,this.endToken=t,this.source=n}get[Symbol.toStringTag](){return"Location"}toJSON(){return{start:this.start,end:this.end}}}class Token{constructor(e,t,n,i,r,o){this.kind=e,this.start=t,this.end=n,this.line=i,this.column=r,this.value=o,this.prev=null,this.next=null}get[Symbol.toStringTag](){return"Token"}toJSON(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}}}const l={Name:[],Document:["definitions"],OperationDefinition:["name","variableDefinitions","directives","selectionSet"],VariableDefinition:["variable","type","defaultValue","directives"],Variable:["name"],SelectionSet:["selections"],Field:["alias","name","arguments","directives","selectionSet","required"],ListNullability:["element"],RequiredDesignator:["element"],OptionalDesignator:["element"],Argument:["name","value"],FragmentSpread:["name","directives"],InlineFragment:["typeCondition","directives","selectionSet"],FragmentDefinition:["name","variableDefinitions","typeCondition","directives","selectionSet"],IntValue:[],FloatValue:[],StringValue:[],BooleanValue:[],NullValue:[],EnumValue:[],ListValue:["values"],ObjectValue:["fields"],ObjectField:["name","value"],Directive:["name","arguments"],NamedType:["name"],ListType:["type"],NonNullType:["type"],SchemaDefinition:["description","directives","operationTypes"],OperationTypeDefinition:["type"],ScalarTypeDefinition:["description","name","directives"],ObjectTypeDefinition:["description","name","interfaces","directives","fields"],FieldDefinition:["description","name","arguments","type","directives"],InputValueDefinition:["description","name","type","defaultValue","directives"],InterfaceTypeDefinition:["description","name","interfaces","directives","fields"],UnionTypeDefinition:["description","name","directives","types"],EnumTypeDefinition:["description","name","directives","values"],EnumValueDefinition:["description","name","directives"],InputObjectTypeDefinition:["description","name","directives","fields"],DirectiveDefinition:["description","name","arguments","locations"],SchemaExtension:["directives","operationTypes"],ScalarTypeExtension:["name","directives"],ObjectTypeExtension:["name","interfaces","directives","fields"],InterfaceTypeExtension:["name","interfaces","directives","fields"],UnionTypeExtension:["name","directives","types"],EnumTypeExtension:["name","directives","values"],InputObjectTypeExtension:["name","directives","fields"]},p=new Set(Object.keys(l));function d(e){const t=null==e?void 0:e.kind;return"string"==typeof t&&p.has(t)}let f,h,m,v;function y(e){return 9===e||32===e}function E(e){return e>=48&&e<=57}function T(e){return e>=97&&e<=122||e>=65&&e<=90}function N(e){return T(e)||95===e}function I(e){return T(e)||E(e)||95===e}function g(e){var t;let n=Number.MAX_SAFE_INTEGER,i=null,r=-1;for(let t=0;t0===t?e:e.slice(n))).slice(null!==(t=i)&&void 0!==t?t:0,r+1)}function _(e){let t=0;for(;t",e.EOF="",e.BANG="!",e.QUESTION_MARK="?",e.DOLLAR="$",e.AMP="&",e.PAREN_L="(",e.PAREN_R=")",e.SPREAD="...",e.COLON=":",e.EQUALS="=",e.AT="@",e.BRACKET_L="[",e.BRACKET_R="]",e.BRACE_L="{",e.PIPE="|",e.BRACE_R="}",e.NAME="Name",e.INT="Int",e.FLOAT="Float",e.STRING="String",e.BLOCK_STRING="BlockString",e.COMMENT="Comment"}(v||(v={}));class Lexer{constructor(e){const t=new Token(v.SOF,0,0,0,0);this.source=e,this.lastToken=t,this.token=t,this.line=1,this.lineStart=0}get[Symbol.toStringTag](){return"Lexer"}advance(){this.lastToken=this.token;return this.token=this.lookahead()}lookahead(){let e=this.token;if(e.kind!==v.EOF)do{if(e.next)e=e.next;else{const t=k(this,e.end);e.next=t,t.prev=e,e=t}}while(e.kind===v.COMMENT);return e}}function b(e){return e>=0&&e<=55295||e>=57344&&e<=1114111}function L(e,t){return S(e.charCodeAt(t))&&A(e.charCodeAt(t+1))}function S(e){return e>=55296&&e<=56319}function A(e){return e>=56320&&e<=57343}function D(e,t){const n=e.source.body.codePointAt(t);if(void 0===n)return v.EOF;if(n>=32&&n<=126){const e=String.fromCodePoint(n);return'"'===e?"'\"'":`"${e}"`}return"U+"+n.toString(16).toUpperCase().padStart(4,"0")}function w(e,t,n,i,r){const o=e.line,s=1+n-e.lineStart;return new Token(t,n,i,o,s,r)}function k(e,t){const n=e.source.body,i=n.length;let r=t;for(;r=48&&e<=57?e-48:e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:-1}function j(e,t){const n=e.source.body;switch(n.charCodeAt(t+1)){case 34:return{value:'"',size:2};case 92:return{value:"\\",size:2};case 47:return{value:"/",size:2};case 98:return{value:"\b",size:2};case 102:return{value:"\f",size:2};case 110:return{value:"\n",size:2};case 114:return{value:"\r",size:2};case 116:return{value:"\t",size:2}}throw u(e.source,t,`Invalid character escape sequence: "${n.slice(t,t+2)}".`)}function V(e,t){const n=e.source.body,i=n.length;let r=e.lineStart,o=t+3,s=o,a="";const c=[];for(;oB)return"[Array]";const n=Math.min(P,e.length),i=e.length-n,r=[];for(let i=0;i1&&r.push(`... ${i} more items`);return"["+r.join(", ")+"]"}(e,n);return function(e,t){const n=Object.entries(e);if(0===n.length)return"{}";if(t.length>B)return"["+function(e){const t=Object.prototype.toString.call(e).replace(/^\[object /,"").replace(/]$/,"");if("Object"===t&&"function"==typeof e.constructor){const t=e.constructor.name;if("string"==typeof t&&""!==t)return t}return t}(e)+"]";const i=n.map((([e,n])=>e+": "+J(n,t)));return"{ "+i.join(", ")+" }"}(e,n)}(e,t);default:return String(e)}}const q=function(e,t){return e instanceof t};class Source{constructor(e,n="GraphQL request",i={line:1,column:1}){"string"==typeof e||t(!1,`Body must be a string. Received: ${Y(e)}.`),this.body=e,this.name=n,this.locationOffset=i,this.locationOffset.line>0||t(!1,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||t(!1,"column in locationOffset is 1-indexed and must be positive.")}get[Symbol.toStringTag](){return"Source"}}function K(e,t){return new Parser(e,t).parseDocument()}class Parser{constructor(e,t){const n=function(e){return q(e,Source)}(e)?e:new Source(e);this._lexer=new Lexer(n),this._options=t}parseName(){const e=this.expectToken(v.NAME);return this.node(e,{kind:m.NAME,value:e.value})}parseDocument(){return this.node(this._lexer.token,{kind:m.DOCUMENT,definitions:this.many(v.SOF,this.parseDefinition,v.EOF)})}parseDefinition(){if(this.peek(v.BRACE_L))return this.parseOperationDefinition();const e=this.peekDescription(),t=e?this._lexer.lookahead():this._lexer.token;if(t.kind===v.NAME){switch(t.value){case"schema":return this.parseSchemaDefinition();case"scalar":return this.parseScalarTypeDefinition();case"type":return this.parseObjectTypeDefinition();case"interface":return this.parseInterfaceTypeDefinition();case"union":return this.parseUnionTypeDefinition();case"enum":return this.parseEnumTypeDefinition();case"input":return this.parseInputObjectTypeDefinition();case"directive":return this.parseDirectiveDefinition()}if(e)throw u(this._lexer.source,this._lexer.token.start,"Unexpected description, descriptions are supported only on type definitions.");switch(t.value){case"query":case"mutation":case"subscription":return this.parseOperationDefinition();case"fragment":return this.parseFragmentDefinition();case"extend":return this.parseTypeSystemExtension()}}throw this.unexpected(t)}parseOperationDefinition(){const e=this._lexer.token;if(this.peek(v.BRACE_L))return this.node(e,{kind:m.OPERATION_DEFINITION,operation:f.QUERY,name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet()});const t=this.parseOperationType();let n;return this.peek(v.NAME)&&(n=this.parseName()),this.node(e,{kind:m.OPERATION_DEFINITION,operation:t,name:n,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseOperationType(){const e=this.expectToken(v.NAME);switch(e.value){case"query":return f.QUERY;case"mutation":return f.MUTATION;case"subscription":return f.SUBSCRIPTION}throw this.unexpected(e)}parseVariableDefinitions(){return this.optionalMany(v.PAREN_L,this.parseVariableDefinition,v.PAREN_R)}parseVariableDefinition(){return this.node(this._lexer.token,{kind:m.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(v.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(v.EQUALS)?this.parseConstValueLiteral():void 0,directives:this.parseConstDirectives()})}parseVariable(){const e=this._lexer.token;return this.expectToken(v.DOLLAR),this.node(e,{kind:m.VARIABLE,name:this.parseName()})}parseSelectionSet(){return this.node(this._lexer.token,{kind:m.SELECTION_SET,selections:this.many(v.BRACE_L,this.parseSelection,v.BRACE_R)})}parseSelection(){return this.peek(v.SPREAD)?this.parseFragment():this.parseField()}parseField(){var e;const t=this._lexer.token,n=this.parseName();let i,r;this.expectOptionalToken(v.COLON)?(i=n,r=this.parseName()):r=n;const o=this.parseArguments(!1),s=null!==(e=this._options)&&void 0!==e&&e.experimentalClientControlledNullability?this.parseRequiredStatus():void 0,a=this.parseDirectives(!1),c=this.peek(v.BRACE_L)?this.parseSelectionSet():void 0;return this.node(t,{kind:m.FIELD,alias:i,name:r,arguments:o,required:s,directives:a,selectionSet:c})}parseRequiredStatus(){const e=this.parseListNullability(),t=this.parseNullabilityDesignatorNode(e);return null!=t?t:e}parseListNullability(){const e=this._lexer.token;if(this.expectOptionalToken(v.BRACKET_L)){const t=this.parseRequiredStatus();return this.expectToken(v.BRACKET_R),this.node(e,{kind:m.LIST_NULLABILITY,element:t})}}parseNullabilityDesignatorNode(e){var t;return null!==(t=this.parseRequiredDesignatorNode(e))&&void 0!==t?t:this.parseOptionalDesignatorNode(e)}parseRequiredDesignatorNode(e){const t=this._lexer.token;if(this.expectOptionalToken(v.BANG))return this.node(t,{kind:m.REQUIRED_DESIGNATOR,element:e})}parseOptionalDesignatorNode(e){const t=this._lexer.token;if(this.expectOptionalToken(v.QUESTION_MARK))return this.node(t,{kind:m.OPTIONAL_DESIGNATOR,element:e})}parseArguments(e){const t=e?this.parseConstArgument:this.parseArgument;return this.optionalMany(v.PAREN_L,t,v.PAREN_R)}parseArgument(e=!1){const t=this._lexer.token,n=this.parseName();return this.expectToken(v.COLON),this.node(t,{kind:m.ARGUMENT,name:n,value:this.parseValueLiteral(e)})}parseConstArgument(){return this.parseArgument(!0)}parseFragment(){const e=this._lexer.token;this.expectToken(v.SPREAD);const t=this.expectOptionalKeyword("on");return!t&&this.peek(v.NAME)?this.node(e,{kind:m.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1)}):this.node(e,{kind:m.INLINE_FRAGMENT,typeCondition:t?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentDefinition(){var e;const t=this._lexer.token;return this.expectKeyword("fragment"),!0===(null===(e=this._options)||void 0===e?void 0:e.allowLegacyFragmentVariables)?this.node(t,{kind:m.FRAGMENT_DEFINITION,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()}):this.node(t,{kind:m.FRAGMENT_DEFINITION,name:this.parseFragmentName(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentName(){if("on"===this._lexer.token.value)throw this.unexpected();return this.parseName()}parseValueLiteral(e){const t=this._lexer.token;switch(t.kind){case v.BRACKET_L:return this.parseList(e);case v.BRACE_L:return this.parseObject(e);case v.INT:return this._lexer.advance(),this.node(t,{kind:m.INT,value:t.value});case v.FLOAT:return this._lexer.advance(),this.node(t,{kind:m.FLOAT,value:t.value});case v.STRING:case v.BLOCK_STRING:return this.parseStringLiteral();case v.NAME:switch(this._lexer.advance(),t.value){case"true":return this.node(t,{kind:m.BOOLEAN,value:!0});case"false":return this.node(t,{kind:m.BOOLEAN,value:!1});case"null":return this.node(t,{kind:m.NULL});default:return this.node(t,{kind:m.ENUM,value:t.value})}case v.DOLLAR:if(e){if(this.expectToken(v.DOLLAR),this._lexer.token.kind===v.NAME){const e=this._lexer.token.value;throw u(this._lexer.source,t.start,`Unexpected variable "$${e}" in constant value.`)}throw this.unexpected(t)}return this.parseVariable();default:throw this.unexpected()}}parseConstValueLiteral(){return this.parseValueLiteral(!0)}parseStringLiteral(){const e=this._lexer.token;return this._lexer.advance(),this.node(e,{kind:m.STRING,value:e.value,block:e.kind===v.BLOCK_STRING})}parseList(e){return this.node(this._lexer.token,{kind:m.LIST,values:this.any(v.BRACKET_L,(()=>this.parseValueLiteral(e)),v.BRACKET_R)})}parseObject(e){return this.node(this._lexer.token,{kind:m.OBJECT,fields:this.any(v.BRACE_L,(()=>this.parseObjectField(e)),v.BRACE_R)})}parseObjectField(e){const t=this._lexer.token,n=this.parseName();return this.expectToken(v.COLON),this.node(t,{kind:m.OBJECT_FIELD,name:n,value:this.parseValueLiteral(e)})}parseDirectives(e){const t=[];for(;this.peek(v.AT);)t.push(this.parseDirective(e));return t}parseConstDirectives(){return this.parseDirectives(!0)}parseDirective(e){const t=this._lexer.token;return this.expectToken(v.AT),this.node(t,{kind:m.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(e)})}parseTypeReference(){const e=this._lexer.token;let t;if(this.expectOptionalToken(v.BRACKET_L)){const n=this.parseTypeReference();this.expectToken(v.BRACKET_R),t=this.node(e,{kind:m.LIST_TYPE,type:n})}else t=this.parseNamedType();return this.expectOptionalToken(v.BANG)?this.node(e,{kind:m.NON_NULL_TYPE,type:t}):t}parseNamedType(){return this.node(this._lexer.token,{kind:m.NAMED_TYPE,name:this.parseName()})}peekDescription(){return this.peek(v.STRING)||this.peek(v.BLOCK_STRING)}parseDescription(){if(this.peekDescription())return this.parseStringLiteral()}parseSchemaDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("schema");const n=this.parseConstDirectives(),i=this.many(v.BRACE_L,this.parseOperationTypeDefinition,v.BRACE_R);return this.node(e,{kind:m.SCHEMA_DEFINITION,description:t,directives:n,operationTypes:i})}parseOperationTypeDefinition(){const e=this._lexer.token,t=this.parseOperationType();this.expectToken(v.COLON);const n=this.parseNamedType();return this.node(e,{kind:m.OPERATION_TYPE_DEFINITION,operation:t,type:n})}parseScalarTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("scalar");const n=this.parseName(),i=this.parseConstDirectives();return this.node(e,{kind:m.SCALAR_TYPE_DEFINITION,description:t,name:n,directives:i})}parseObjectTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("type");const n=this.parseName(),i=this.parseImplementsInterfaces(),r=this.parseConstDirectives(),o=this.parseFieldsDefinition();return this.node(e,{kind:m.OBJECT_TYPE_DEFINITION,description:t,name:n,interfaces:i,directives:r,fields:o})}parseImplementsInterfaces(){return this.expectOptionalKeyword("implements")?this.delimitedMany(v.AMP,this.parseNamedType):[]}parseFieldsDefinition(){return this.optionalMany(v.BRACE_L,this.parseFieldDefinition,v.BRACE_R)}parseFieldDefinition(){const e=this._lexer.token,t=this.parseDescription(),n=this.parseName(),i=this.parseArgumentDefs();this.expectToken(v.COLON);const r=this.parseTypeReference(),o=this.parseConstDirectives();return this.node(e,{kind:m.FIELD_DEFINITION,description:t,name:n,arguments:i,type:r,directives:o})}parseArgumentDefs(){return this.optionalMany(v.PAREN_L,this.parseInputValueDef,v.PAREN_R)}parseInputValueDef(){const e=this._lexer.token,t=this.parseDescription(),n=this.parseName();this.expectToken(v.COLON);const i=this.parseTypeReference();let r;this.expectOptionalToken(v.EQUALS)&&(r=this.parseConstValueLiteral());const o=this.parseConstDirectives();return this.node(e,{kind:m.INPUT_VALUE_DEFINITION,description:t,name:n,type:i,defaultValue:r,directives:o})}parseInterfaceTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("interface");const n=this.parseName(),i=this.parseImplementsInterfaces(),r=this.parseConstDirectives(),o=this.parseFieldsDefinition();return this.node(e,{kind:m.INTERFACE_TYPE_DEFINITION,description:t,name:n,interfaces:i,directives:r,fields:o})}parseUnionTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("union");const n=this.parseName(),i=this.parseConstDirectives(),r=this.parseUnionMemberTypes();return this.node(e,{kind:m.UNION_TYPE_DEFINITION,description:t,name:n,directives:i,types:r})}parseUnionMemberTypes(){return this.expectOptionalToken(v.EQUALS)?this.delimitedMany(v.PIPE,this.parseNamedType):[]}parseEnumTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("enum");const n=this.parseName(),i=this.parseConstDirectives(),r=this.parseEnumValuesDefinition();return this.node(e,{kind:m.ENUM_TYPE_DEFINITION,description:t,name:n,directives:i,values:r})}parseEnumValuesDefinition(){return this.optionalMany(v.BRACE_L,this.parseEnumValueDefinition,v.BRACE_R)}parseEnumValueDefinition(){const e=this._lexer.token,t=this.parseDescription(),n=this.parseEnumValueName(),i=this.parseConstDirectives();return this.node(e,{kind:m.ENUM_VALUE_DEFINITION,description:t,name:n,directives:i})}parseEnumValueName(){if("true"===this._lexer.token.value||"false"===this._lexer.token.value||"null"===this._lexer.token.value)throw u(this._lexer.source,this._lexer.token.start,`${X(this._lexer.token)} is reserved and cannot be used for an enum value.`);return this.parseName()}parseInputObjectTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("input");const n=this.parseName(),i=this.parseConstDirectives(),r=this.parseInputFieldsDefinition();return this.node(e,{kind:m.INPUT_OBJECT_TYPE_DEFINITION,description:t,name:n,directives:i,fields:r})}parseInputFieldsDefinition(){return this.optionalMany(v.BRACE_L,this.parseInputValueDef,v.BRACE_R)}parseTypeSystemExtension(){const e=this._lexer.lookahead();if(e.kind===v.NAME)switch(e.value){case"schema":return this.parseSchemaExtension();case"scalar":return this.parseScalarTypeExtension();case"type":return this.parseObjectTypeExtension();case"interface":return this.parseInterfaceTypeExtension();case"union":return this.parseUnionTypeExtension();case"enum":return this.parseEnumTypeExtension();case"input":return this.parseInputObjectTypeExtension()}throw this.unexpected(e)}parseSchemaExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");const t=this.parseConstDirectives(),n=this.optionalMany(v.BRACE_L,this.parseOperationTypeDefinition,v.BRACE_R);if(0===t.length&&0===n.length)throw this.unexpected();return this.node(e,{kind:m.SCHEMA_EXTENSION,directives:t,operationTypes:n})}parseScalarTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("scalar");const t=this.parseName(),n=this.parseConstDirectives();if(0===n.length)throw this.unexpected();return this.node(e,{kind:m.SCALAR_TYPE_EXTENSION,name:t,directives:n})}parseObjectTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");const t=this.parseName(),n=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),r=this.parseFieldsDefinition();if(0===n.length&&0===i.length&&0===r.length)throw this.unexpected();return this.node(e,{kind:m.OBJECT_TYPE_EXTENSION,name:t,interfaces:n,directives:i,fields:r})}parseInterfaceTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");const t=this.parseName(),n=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),r=this.parseFieldsDefinition();if(0===n.length&&0===i.length&&0===r.length)throw this.unexpected();return this.node(e,{kind:m.INTERFACE_TYPE_EXTENSION,name:t,interfaces:n,directives:i,fields:r})}parseUnionTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");const t=this.parseName(),n=this.parseConstDirectives(),i=this.parseUnionMemberTypes();if(0===n.length&&0===i.length)throw this.unexpected();return this.node(e,{kind:m.UNION_TYPE_EXTENSION,name:t,directives:n,types:i})}parseEnumTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");const t=this.parseName(),n=this.parseConstDirectives(),i=this.parseEnumValuesDefinition();if(0===n.length&&0===i.length)throw this.unexpected();return this.node(e,{kind:m.ENUM_TYPE_EXTENSION,name:t,directives:n,values:i})}parseInputObjectTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");const t=this.parseName(),n=this.parseConstDirectives(),i=this.parseInputFieldsDefinition();if(0===n.length&&0===i.length)throw this.unexpected();return this.node(e,{kind:m.INPUT_OBJECT_TYPE_EXTENSION,name:t,directives:n,fields:i})}parseDirectiveDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("directive"),this.expectToken(v.AT);const n=this.parseName(),i=this.parseArgumentDefs(),r=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");const o=this.parseDirectiveLocations();return this.node(e,{kind:m.DIRECTIVE_DEFINITION,description:t,name:n,arguments:i,repeatable:r,locations:o})}parseDirectiveLocations(){return this.delimitedMany(v.PIPE,this.parseDirectiveLocation)}parseDirectiveLocation(){const e=this._lexer.token,t=this.parseName();if(Object.prototype.hasOwnProperty.call(h,t.value))return t;throw this.unexpected(e)}node(e,t){var n;return!0!==(null===(n=this._options)||void 0===n?void 0:n.noLocation)&&(t.loc=new Location(e,this._lexer.lastToken,this._lexer.source)),t}peek(e){return this._lexer.token.kind===e}expectToken(e){const t=this._lexer.token;if(t.kind===e)return this._lexer.advance(),t;throw u(this._lexer.source,t.start,`Expected ${z(e)}, found ${X(t)}.`)}expectOptionalToken(e){return this._lexer.token.kind===e&&(this._lexer.advance(),!0)}expectKeyword(e){const t=this._lexer.token;if(t.kind!==v.NAME||t.value!==e)throw u(this._lexer.source,t.start,`Expected "${e}", found ${X(t)}.`);this._lexer.advance()}expectOptionalKeyword(e){const t=this._lexer.token;return t.kind===v.NAME&&t.value===e&&(this._lexer.advance(),!0)}unexpected(e){const t=null!=e?e:this._lexer.token;return u(this._lexer.source,t.start,`Unexpected ${X(t)}.`)}any(e,t,n){this.expectToken(e);const i=[];for(;!this.expectOptionalToken(n);)i.push(t.call(this));return i}optionalMany(e,t,n){if(this.expectOptionalToken(e)){const e=[];do{e.push(t.call(this))}while(!this.expectOptionalToken(n));return e}return[]}many(e,t,n){this.expectToken(e);const i=[];do{i.push(t.call(this))}while(!this.expectOptionalToken(n));return i}delimitedMany(e,t){this.expectOptionalToken(e);const n=[];do{n.push(t.call(this))}while(this.expectOptionalToken(e));return n}}function X(e){const t=e.value;return z(e.kind)+(null!=t?` "${t}"`:"")}function z(e){return function(e){return e===v.BANG||e===v.QUESTION_MARK||e===v.DOLLAR||e===v.AMP||e===v.PAREN_L||e===v.PAREN_R||e===v.SPREAD||e===v.COLON||e===v.EQUALS||e===v.AT||e===v.BRACKET_L||e===v.BRACKET_R||e===v.BRACE_L||e===v.PIPE||e===v.BRACE_R}(e)?`"${e}"`:e}const H=5;function W(e,t){const[n,i]=t?[e,t]:[void 0,e];let r=" Did you mean ";n&&(r+=n+" ");const o=i.map((e=>`"${e}"`));switch(o.length){case 0:return"";case 1:return r+o[0]+"?";case 2:return r+o[0]+" or "+o[1]+"?"}const s=o.slice(0,H),a=s.pop();return r+s.join(", ")+", or "+a+"?"}function Z(e){return e}function ee(e,t){const n=Object.create(null);for(const i of e)n[t(i)]=i;return n}function te(e,t,n){const i=Object.create(null);for(const r of e)i[t(r)]=n(r);return i}function ne(e,t){const n=Object.create(null);for(const i of Object.keys(e))n[i]=t(e[i],i);return n}function ie(e,t){let n=0,i=0;for(;n0);let a=0;do{++i,a=10*a+o-re,o=t.charCodeAt(i)}while(se(o)&&a>0);if(sa)return 1}else{if(ro)return 1;++n,++i}}return e.length-t.length}const re=48,oe=57;function se(e){return!isNaN(e)&&re<=e&&e<=oe}function ae(e,t){const n=Object.create(null),i=new LexicalDistance(e),r=Math.floor(.4*e.length)+1;for(const e of t){const t=i.measure(e,r);void 0!==t&&(n[e]=t)}return Object.keys(n).sort(((e,t)=>{const i=n[e]-n[t];return 0!==i?i:ie(e,t)}))}class LexicalDistance{constructor(e){this._input=e,this._inputLowerCase=e.toLowerCase(),this._inputArray=ce(this._inputLowerCase),this._rows=[new Array(e.length+1).fill(0),new Array(e.length+1).fill(0),new Array(e.length+1).fill(0)]}measure(e,t){if(this._input===e)return 0;const n=e.toLowerCase();if(this._inputLowerCase===n)return 1;let i=ce(n),r=this._inputArray;if(i.lengtht)return;const a=this._rows;for(let e=0;e<=s;e++)a[0][e]=e;for(let e=1;e<=o;e++){const n=a[(e-1)%3],o=a[e%3];let c=o[0]=e;for(let t=1;t<=s;t++){const s=i[e-1]===r[t-1]?0:1;let u=Math.min(n[t]+1,o[t-1]+1,n[t-1]+s);if(e>1&&t>1&&i[e-1]===r[t-2]&&i[e-2]===r[t-1]){const n=a[(e-2)%3][t-2];u=Math.min(u,n+1)}ut)return}const c=a[o%3][s];return c<=t?c:void 0}}function ce(e){const t=e.length,n=new Array(t);for(let i=0;ie.value},Variable:{leave:e=>"$"+e.name},Document:{leave:e=>Te(e.definitions,"\n\n")},OperationDefinition:{leave(e){const t=Ie("(",Te(e.variableDefinitions,", "),")"),n=Te([e.operation,Te([e.name,t]),Te(e.directives," ")]," ");return("query"===n?"":n+" ")+e.selectionSet}},VariableDefinition:{leave:({variable:e,type:t,defaultValue:n,directives:i})=>e+": "+t+Ie(" = ",n)+Ie(" ",Te(i," "))},SelectionSet:{leave:({selections:e})=>Ne(e)},Field:{leave({alias:e,name:t,arguments:n,directives:i,selectionSet:r,required:o}){const s=Te([Ie("",e,": "),t],"");let a=s+Ie("(",Te(n,", "),")");a.length>80&&(a=s+Ie("(\n",ge(Te(n,"\n")),"\n)"));const c=Te([a,o],"");return Te([c,Te(i," "),r]," ")}},RequiredDesignator:{leave:({element:e})=>(null!=e?e:"")+"!"},OptionalDesignator:{leave:({element:e})=>(null!=e?e:"")+"?"},ListNullability:{leave:({element:e})=>"["+(null!=e?e:"")+"]"},Argument:{leave:({name:e,value:t})=>e+": "+t},FragmentSpread:{leave:({name:e,directives:t})=>"..."+e+Ie(" ",Te(t," "))},InlineFragment:{leave:({typeCondition:e,directives:t,selectionSet:n})=>Te(["...",Ie("on ",e),Te(t," "),n]," ")},FragmentDefinition:{leave:({name:e,typeCondition:t,variableDefinitions:n,directives:i,selectionSet:r})=>`fragment ${e}${Ie("(",Te(n,", "),")")} on ${t} ${Ie("",Te(i," ")," ")}`+r},IntValue:{leave:({value:e})=>e},FloatValue:{leave:({value:e})=>e},StringValue:{leave:({value:e,block:t})=>t?function(e,t){const n=e.replace(/"""/g,'\\"""'),i=n.split(/\r\n|[\n\r]/g),r=1===i.length,o=i.length>1&&i.slice(1).every((e=>0===e.length||y(e.charCodeAt(0)))),s=n.endsWith('\\"""'),a=e.endsWith('"')&&!s,c=e.endsWith("\\"),u=a||c,l=!(null!=t&&t.minimize)&&(!r||e.length>70||u||o||s);let p="";const d=r&&y(e.charCodeAt(0));return(l&&!d||o)&&(p+="\n"),p+=n,(l||u)&&(p+="\n"),'"""'+p+'"""'}(e):`"${e.replace(le,pe)}"`},BooleanValue:{leave:({value:e})=>e?"true":"false"},NullValue:{leave:()=>"null"},EnumValue:{leave:({value:e})=>e},ListValue:{leave:({values:e})=>"["+Te(e,", ")+"]"},ObjectValue:{leave:({fields:e})=>"{"+Te(e,", ")+"}"},ObjectField:{leave:({name:e,value:t})=>e+": "+t},Directive:{leave:({name:e,arguments:t})=>"@"+e+Ie("(",Te(t,", "),")")},NamedType:{leave:({name:e})=>e},ListType:{leave:({type:e})=>"["+e+"]"},NonNullType:{leave:({type:e})=>e+"!"},SchemaDefinition:{leave:({description:e,directives:t,operationTypes:n})=>Ie("",e,"\n")+Te(["schema",Te(t," "),Ne(n)]," ")},OperationTypeDefinition:{leave:({operation:e,type:t})=>e+": "+t},ScalarTypeDefinition:{leave:({description:e,name:t,directives:n})=>Ie("",e,"\n")+Te(["scalar",t,Te(n," ")]," ")},ObjectTypeDefinition:{leave:({description:e,name:t,interfaces:n,directives:i,fields:r})=>Ie("",e,"\n")+Te(["type",t,Ie("implements ",Te(n," & ")),Te(i," "),Ne(r)]," ")},FieldDefinition:{leave:({description:e,name:t,arguments:n,type:i,directives:r})=>Ie("",e,"\n")+t+(_e(n)?Ie("(\n",ge(Te(n,"\n")),"\n)"):Ie("(",Te(n,", "),")"))+": "+i+Ie(" ",Te(r," "))},InputValueDefinition:{leave:({description:e,name:t,type:n,defaultValue:i,directives:r})=>Ie("",e,"\n")+Te([t+": "+n,Ie("= ",i),Te(r," ")]," ")},InterfaceTypeDefinition:{leave:({description:e,name:t,interfaces:n,directives:i,fields:r})=>Ie("",e,"\n")+Te(["interface",t,Ie("implements ",Te(n," & ")),Te(i," "),Ne(r)]," ")},UnionTypeDefinition:{leave:({description:e,name:t,directives:n,types:i})=>Ie("",e,"\n")+Te(["union",t,Te(n," "),Ie("= ",Te(i," | "))]," ")},EnumTypeDefinition:{leave:({description:e,name:t,directives:n,values:i})=>Ie("",e,"\n")+Te(["enum",t,Te(n," "),Ne(i)]," ")},EnumValueDefinition:{leave:({description:e,name:t,directives:n})=>Ie("",e,"\n")+Te([t,Te(n," ")]," ")},InputObjectTypeDefinition:{leave:({description:e,name:t,directives:n,fields:i})=>Ie("",e,"\n")+Te(["input",t,Te(n," "),Ne(i)]," ")},DirectiveDefinition:{leave:({description:e,name:t,arguments:n,repeatable:i,locations:r})=>Ie("",e,"\n")+"directive @"+t+(_e(n)?Ie("(\n",ge(Te(n,"\n")),"\n)"):Ie("(",Te(n,", "),")"))+(i?" repeatable":"")+" on "+Te(r," | ")},SchemaExtension:{leave:({directives:e,operationTypes:t})=>Te(["extend schema",Te(e," "),Ne(t)]," ")},ScalarTypeExtension:{leave:({name:e,directives:t})=>Te(["extend scalar",e,Te(t," ")]," ")},ObjectTypeExtension:{leave:({name:e,interfaces:t,directives:n,fields:i})=>Te(["extend type",e,Ie("implements ",Te(t," & ")),Te(n," "),Ne(i)]," ")},InterfaceTypeExtension:{leave:({name:e,interfaces:t,directives:n,fields:i})=>Te(["extend interface",e,Ie("implements ",Te(t," & ")),Te(n," "),Ne(i)]," ")},UnionTypeExtension:{leave:({name:e,directives:t,types:n})=>Te(["extend union",e,Te(t," "),Ie("= ",Te(n," | "))]," ")},EnumTypeExtension:{leave:({name:e,directives:t,values:n})=>Te(["extend enum",e,Te(t," "),Ne(n)]," ")},InputObjectTypeExtension:{leave:({name:e,directives:t,fields:n})=>Te(["extend input",e,Te(t," "),Ne(n)]," ")}};function Te(e,t=""){var n;return null!==(n=null==e?void 0:e.filter((e=>e)).join(t))&&void 0!==n?n:""}function Ne(e){return Ie("{\n",ge(Te(e,"\n")),"\n}")}function Ie(e,t,n=""){return null!=t&&""!==t?e+t+n:""}function ge(e){return Ie(" ",e.replace(/\n/g,"\n "))}function _e(e){var t;return null!==(t=null==e?void 0:e.some((e=>e.includes("\n"))))&&void 0!==t&&t}function Oe(e,t){switch(e.kind){case m.NULL:return null;case m.INT:return parseInt(e.value,10);case m.FLOAT:return parseFloat(e.value);case m.STRING:case m.ENUM:case m.BOOLEAN:return e.value;case m.LIST:return e.values.map((e=>Oe(e,t)));case m.OBJECT:return te(e.fields,(e=>e.name.value),(e=>Oe(e.value,t)));case m.VARIABLE:return null==t?void 0:t[e.name.value]}}function be(e){if(null!=e||t(!1,"Must provide name."),"string"==typeof e||t(!1,"Expected name to be a string."),0===e.length)throw new GraphQLError("Expected name to be a non-empty string.");for(let t=1;ts(Oe(e,t)),this.extensions=ue(e.extensions),this.astNode=e.astNode,this.extensionASTNodes=null!==(o=e.extensionASTNodes)&&void 0!==o?o:[],null==e.specifiedByURL||"string"==typeof e.specifiedByURL||t(!1,`${this.name} must provide "specifiedByURL" as a string, but got: ${Y(e.specifiedByURL)}.`),null==e.serialize||"function"==typeof e.serialize||t(!1,`${this.name} must provide "serialize" function. If this custom Scalar is also used as an input type, ensure "parseValue" and "parseLiteral" functions are also provided.`),e.parseLiteral&&("function"==typeof e.parseValue&&"function"==typeof e.parseLiteral||t(!1,`${this.name} must provide both "parseValue" and "parseLiteral" functions.`))}get[Symbol.toStringTag](){return"GraphQLScalarType"}toConfig(){return{name:this.name,description:this.description,specifiedByURL:this.specifiedByURL,serialize:this.serialize,parseValue:this.parseValue,parseLiteral:this.parseLiteral,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}class GraphQLObjectType{constructor(e){var n;this.name=be(e.name),this.description=e.description,this.isTypeOf=e.isTypeOf,this.extensions=ue(e.extensions),this.astNode=e.astNode,this.extensionASTNodes=null!==(n=e.extensionASTNodes)&&void 0!==n?n:[],this._fields=()=>ze(e),this._interfaces=()=>Xe(e),null==e.isTypeOf||"function"==typeof e.isTypeOf||t(!1,`${this.name} must provide "isTypeOf" as a function, but got: ${Y(e.isTypeOf)}.`)}get[Symbol.toStringTag](){return"GraphQLObjectType"}getFields(){return"function"==typeof this._fields&&(this._fields=this._fields()),this._fields}getInterfaces(){return"function"==typeof this._interfaces&&(this._interfaces=this._interfaces()),this._interfaces}toConfig(){return{name:this.name,description:this.description,interfaces:this.getInterfaces(),fields:Ze(this.getFields()),isTypeOf:this.isTypeOf,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}function Xe(e){var n;const i=qe(null!==(n=e.interfaces)&&void 0!==n?n:[]);return Array.isArray(i)||t(!1,`${e.name} interfaces must be an Array or a function which returns an Array.`),i}function ze(e){const n=Ke(e.fields);return We(n)||t(!1,`${e.name} fields must be an object with field names as keys or a function which returns such an object.`),ne(n,((n,i)=>{var r;We(n)||t(!1,`${e.name}.${i} field config must be an object.`),null==n.resolve||"function"==typeof n.resolve||t(!1,`${e.name}.${i} field resolver must be a function if provided, but got: ${Y(n.resolve)}.`);const o=null!==(r=n.args)&&void 0!==r?r:{};return We(o)||t(!1,`${e.name}.${i} args must be an object with argument names as keys.`),{name:be(i),description:n.description,type:n.type,args:He(o),resolve:n.resolve,subscribe:n.subscribe,deprecationReason:n.deprecationReason,extensions:ue(n.extensions),astNode:n.astNode}}))}function He(e){return Object.entries(e).map((([e,t])=>({name:be(e),description:t.description,type:t.type,defaultValue:t.defaultValue,deprecationReason:t.deprecationReason,extensions:ue(t.extensions),astNode:t.astNode})))}function We(e){return n(e)&&!Array.isArray(e)}function Ze(e){return ne(e,(e=>({description:e.description,type:e.type,args:et(e.args),resolve:e.resolve,subscribe:e.subscribe,deprecationReason:e.deprecationReason,extensions:e.extensions,astNode:e.astNode})))}function et(e){return te(e,(e=>e.name),(e=>({description:e.description,type:e.type,defaultValue:e.defaultValue,deprecationReason:e.deprecationReason,extensions:e.extensions,astNode:e.astNode})))}function tt(e){return Ge(e.type)&&void 0===e.defaultValue}class GraphQLInterfaceType{constructor(e){var n;this.name=be(e.name),this.description=e.description,this.resolveType=e.resolveType,this.extensions=ue(e.extensions),this.astNode=e.astNode,this.extensionASTNodes=null!==(n=e.extensionASTNodes)&&void 0!==n?n:[],this._fields=ze.bind(void 0,e),this._interfaces=Xe.bind(void 0,e),null==e.resolveType||"function"==typeof e.resolveType||t(!1,`${this.name} must provide "resolveType" as a function, but got: ${Y(e.resolveType)}.`)}get[Symbol.toStringTag](){return"GraphQLInterfaceType"}getFields(){return"function"==typeof this._fields&&(this._fields=this._fields()),this._fields}getInterfaces(){return"function"==typeof this._interfaces&&(this._interfaces=this._interfaces()),this._interfaces}toConfig(){return{name:this.name,description:this.description,interfaces:this.getInterfaces(),fields:Ze(this.getFields()),resolveType:this.resolveType,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}class GraphQLUnionType{constructor(e){var n;this.name=be(e.name),this.description=e.description,this.resolveType=e.resolveType,this.extensions=ue(e.extensions),this.astNode=e.astNode,this.extensionASTNodes=null!==(n=e.extensionASTNodes)&&void 0!==n?n:[],this._types=nt.bind(void 0,e),null==e.resolveType||"function"==typeof e.resolveType||t(!1,`${this.name} must provide "resolveType" as a function, but got: ${Y(e.resolveType)}.`)}get[Symbol.toStringTag](){return"GraphQLUnionType"}getTypes(){return"function"==typeof this._types&&(this._types=this._types()),this._types}toConfig(){return{name:this.name,description:this.description,types:this.getTypes(),resolveType:this.resolveType,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}function nt(e){const n=qe(e.types);return Array.isArray(n)||t(!1,`Must provide Array of types or a function which returns such an array for Union ${e.name}.`),n}class GraphQLEnumType{constructor(e){var n,i,r;this.name=be(e.name),this.description=e.description,this.extensions=ue(e.extensions),this.astNode=e.astNode,this.extensionASTNodes=null!==(n=e.extensionASTNodes)&&void 0!==n?n:[],this._values=(i=this.name,We(r=e.values)||t(!1,`${i} values must be an object with value names as keys.`),Object.entries(r).map((([e,n])=>(We(n)||t(!1,`${i}.${e} must refer to an object with a "value" key representing an internal value but got: ${Y(n)}.`),{name:Le(e),description:n.description,value:void 0!==n.value?n.value:e,deprecationReason:n.deprecationReason,extensions:ue(n.extensions),astNode:n.astNode})))),this._valueLookup=new Map(this._values.map((e=>[e.value,e]))),this._nameLookup=ee(this._values,(e=>e.name))}get[Symbol.toStringTag](){return"GraphQLEnumType"}getValues(){return this._values}getValue(e){return this._nameLookup[e]}serialize(e){const t=this._valueLookup.get(e);if(void 0===t)throw new GraphQLError(`Enum "${this.name}" cannot represent value: ${Y(e)}`);return t.name}parseValue(e){if("string"!=typeof e){const t=Y(e);throw new GraphQLError(`Enum "${this.name}" cannot represent non-string value: ${t}.`+it(this,t))}const t=this.getValue(e);if(null==t)throw new GraphQLError(`Value "${e}" does not exist in "${this.name}" enum.`+it(this,e));return t.value}parseLiteral(e,t){if(e.kind!==m.ENUM){const t=ye(e);throw new GraphQLError(`Enum "${this.name}" cannot represent non-enum value: ${t}.`+it(this,t),e)}const n=this.getValue(e.value);if(null==n){const t=ye(e);throw new GraphQLError(`Value "${t}" does not exist in "${this.name}" enum.`+it(this,t),e)}return n.value}toConfig(){const e=te(this.getValues(),(e=>e.name),(e=>({description:e.description,value:e.value,deprecationReason:e.deprecationReason,extensions:e.extensions,astNode:e.astNode})));return{name:this.name,description:this.description,values:e,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}function it(e,t){return W("the enum value",ae(t,e.getValues().map((e=>e.name))))}class GraphQLInputObjectType{constructor(e){var t;this.name=be(e.name),this.description=e.description,this.extensions=ue(e.extensions),this.astNode=e.astNode,this.extensionASTNodes=null!==(t=e.extensionASTNodes)&&void 0!==t?t:[],this._fields=rt.bind(void 0,e)}get[Symbol.toStringTag](){return"GraphQLInputObjectType"}getFields(){return"function"==typeof this._fields&&(this._fields=this._fields()),this._fields}toConfig(){const e=ne(this.getFields(),(e=>({description:e.description,type:e.type,defaultValue:e.defaultValue,deprecationReason:e.deprecationReason,extensions:e.extensions,astNode:e.astNode})));return{name:this.name,description:this.description,fields:e,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}function rt(e){const n=Ke(e.fields);return We(n)||t(!1,`${e.name} fields must be an object with field names as keys or a function which returns such an object.`),ne(n,((n,i)=>(!("resolve"in n)||t(!1,`${e.name}.${i} field has a resolve property, but Input Types cannot define resolvers.`),{name:be(i),description:n.description,type:n.type,defaultValue:n.defaultValue,deprecationReason:n.deprecationReason,extensions:ue(n.extensions),astNode:n.astNode})))}function ot(e){return Ge(e.type)&&void 0===e.defaultValue}function st(e,t){return e===t||(Ge(e)&&Ge(t)||!(!Re(e)||!Re(t)))&&st(e.ofType,t.ofType)}function at(e,t,n){return t===n||(Ge(n)?!!Ge(t)&&at(e,t.ofType,n.ofType):Ge(t)?at(e,t.ofType,n):Re(n)?!!Re(t)&&at(e,t.ofType,n.ofType):!Re(t)&&(Ve(n)&&(we(t)||De(t))&&e.isSubType(n,t)))}function ct(e,t,n){return t===n||(Ve(t)?Ve(n)?e.getPossibleTypes(t).some((t=>e.isSubType(n,t))):e.isSubType(t,n):!!Ve(n)&&e.isSubType(n,t))}const ut=2147483647,lt=-2147483648,pt=new GraphQLScalarType({name:"Int",description:"The `Int` scalar type represents non-fractional signed whole numeric values. Int can represent values between -(2^31) and 2^31 - 1.",serialize(e){const t=Et(e);if("boolean"==typeof t)return t?1:0;let n=t;if("string"==typeof t&&""!==t&&(n=Number(t)),"number"!=typeof n||!Number.isInteger(n))throw new GraphQLError(`Int cannot represent non-integer value: ${Y(t)}`);if(n>ut||nut||eut||te.name===t))}function Et(e){if(n(e)){if("function"==typeof e.valueOf){const t=e.valueOf();if(!n(t))return t}if("function"==typeof e.toJSON)return e.toJSON()}return e}function Tt(e){return q(e,GraphQLDirective)}class GraphQLDirective{constructor(e){var i,r;this.name=be(e.name),this.description=e.description,this.locations=e.locations,this.isRepeatable=null!==(i=e.isRepeatable)&&void 0!==i&&i,this.extensions=ue(e.extensions),this.astNode=e.astNode,Array.isArray(e.locations)||t(!1,`@${e.name} locations must be an Array.`);const o=null!==(r=e.args)&&void 0!==r?r:{};n(o)&&!Array.isArray(o)||t(!1,`@${e.name} args must be an object with argument names as keys.`),this.args=He(o)}get[Symbol.toStringTag](){return"GraphQLDirective"}toConfig(){return{name:this.name,description:this.description,locations:this.locations,args:et(this.args),isRepeatable:this.isRepeatable,extensions:this.extensions,astNode:this.astNode}}toString(){return"@"+this.name}toJSON(){return this.toString()}}const Nt=new GraphQLDirective({name:"include",description:"Directs the executor to include this field or fragment only when the `if` argument is true.",locations:[h.FIELD,h.FRAGMENT_SPREAD,h.INLINE_FRAGMENT],args:{if:{type:new GraphQLNonNull(ht),description:"Included when true."}}}),It=new GraphQLDirective({name:"skip",description:"Directs the executor to skip this field or fragment when the `if` argument is true.",locations:[h.FIELD,h.FRAGMENT_SPREAD,h.INLINE_FRAGMENT],args:{if:{type:new GraphQLNonNull(ht),description:"Skipped when true."}}}),gt="No longer supported",_t=new GraphQLDirective({name:"deprecated",description:"Marks an element of a GraphQL schema as no longer supported.",locations:[h.FIELD_DEFINITION,h.ARGUMENT_DEFINITION,h.INPUT_FIELD_DEFINITION,h.ENUM_VALUE],args:{reason:{type:ft,description:"Explains why this element was deprecated, usually also including a suggestion for how to access supported similar data. Formatted using the Markdown syntax, as specified by [CommonMark](https://commonmark.org/).",defaultValue:gt}}}),Ot=new GraphQLDirective({name:"specifiedBy",description:"Exposes a URL that specifies the behavior of this scalar.",locations:[h.SCALAR],args:{url:{type:new GraphQLNonNull(ft),description:"The URL that specifies the behavior of this scalar."}}}),bt=Object.freeze([Nt,It,_t,Ot]);function Lt(e,t){if(Ge(t)){const n=Lt(e,t.ofType);return(null==n?void 0:n.kind)===m.NULL?null:n}if(null===e)return{kind:m.NULL};if(void 0===e)return null;if(Re(t)){const n=t.ofType;if("object"==typeof(r=e)&&"function"==typeof(null==r?void 0:r[Symbol.iterator])){const t=[];for(const i of e){const e=Lt(i,n);null!=e&&t.push(e)}return{kind:m.LIST,values:t}}return Lt(e,n)}var r;if(Fe(t)){if(!n(e))return null;const i=[];for(const n of Object.values(t.getFields())){const t=Lt(e[n.name],n.type);t&&i.push({kind:m.OBJECT_FIELD,name:{kind:m.NAME,value:n.name},value:t})}return{kind:m.OBJECT,fields:i}}if(Ue(t)){const n=t.serialize(e);if(null==n)return null;if("boolean"==typeof n)return{kind:m.BOOLEAN,value:n};if("number"==typeof n&&Number.isFinite(n)){const e=String(n);return St.test(e)?{kind:m.INT,value:e}:{kind:m.FLOAT,value:e}}if("string"==typeof n)return xe(t)?{kind:m.ENUM,value:n}:t===mt&&St.test(n)?{kind:m.INT,value:n}:{kind:m.STRING,value:n};throw new TypeError(`Cannot convert value to AST: ${Y(n)}.`)}i(!1,"Unexpected input type: "+Y(t))}const St=/^-?(?:0|[1-9][0-9]*)$/,At=new GraphQLObjectType({name:"__Schema",description:"A GraphQL Schema defines the capabilities of a GraphQL server. It exposes all available types and directives on the server, as well as the entry points for query, mutation, and subscription operations.",fields:()=>({description:{type:ft,resolve:e=>e.description},types:{description:"A list of all types supported by this server.",type:new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(kt))),resolve:e=>Object.values(e.getTypeMap())},queryType:{description:"The type that query operations will be rooted at.",type:new GraphQLNonNull(kt),resolve:e=>e.getQueryType()},mutationType:{description:"If this server supports mutation, the type that mutation operations will be rooted at.",type:kt,resolve:e=>e.getMutationType()},subscriptionType:{description:"If this server support subscription, the type that subscription operations will be rooted at.",type:kt,resolve:e=>e.getSubscriptionType()},directives:{description:"A list of all directives supported by this server.",type:new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(Dt))),resolve:e=>e.getDirectives()}})}),Dt=new GraphQLObjectType({name:"__Directive",description:"A Directive provides a way to describe alternate runtime execution and type validation behavior in a GraphQL document.\n\nIn some cases, you need to provide options to alter GraphQL's execution behavior in ways field arguments will not suffice, such as conditionally including or skipping a field. Directives provide this by describing additional information to the executor.",fields:()=>({name:{type:new GraphQLNonNull(ft),resolve:e=>e.name},description:{type:ft,resolve:e=>e.description},isRepeatable:{type:new GraphQLNonNull(ht),resolve:e=>e.isRepeatable},locations:{type:new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(wt))),resolve:e=>e.locations},args:{type:new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(Ft))),args:{includeDeprecated:{type:ht,defaultValue:!1}},resolve:(e,{includeDeprecated:t})=>t?e.args:e.args.filter((e=>null==e.deprecationReason))}})}),wt=new GraphQLEnumType({name:"__DirectiveLocation",description:"A Directive can be adjacent to many parts of the GraphQL language, a __DirectiveLocation describes one such possible adjacencies.",values:{QUERY:{value:h.QUERY,description:"Location adjacent to a query operation."},MUTATION:{value:h.MUTATION,description:"Location adjacent to a mutation operation."},SUBSCRIPTION:{value:h.SUBSCRIPTION,description:"Location adjacent to a subscription operation."},FIELD:{value:h.FIELD,description:"Location adjacent to a field."},FRAGMENT_DEFINITION:{value:h.FRAGMENT_DEFINITION,description:"Location adjacent to a fragment definition."},FRAGMENT_SPREAD:{value:h.FRAGMENT_SPREAD,description:"Location adjacent to a fragment spread."},INLINE_FRAGMENT:{value:h.INLINE_FRAGMENT,description:"Location adjacent to an inline fragment."},VARIABLE_DEFINITION:{value:h.VARIABLE_DEFINITION,description:"Location adjacent to a variable definition."},SCHEMA:{value:h.SCHEMA,description:"Location adjacent to a schema definition."},SCALAR:{value:h.SCALAR,description:"Location adjacent to a scalar definition."},OBJECT:{value:h.OBJECT,description:"Location adjacent to an object type definition."},FIELD_DEFINITION:{value:h.FIELD_DEFINITION,description:"Location adjacent to a field definition."},ARGUMENT_DEFINITION:{value:h.ARGUMENT_DEFINITION,description:"Location adjacent to an argument definition."},INTERFACE:{value:h.INTERFACE,description:"Location adjacent to an interface definition."},UNION:{value:h.UNION,description:"Location adjacent to a union definition."},ENUM:{value:h.ENUM,description:"Location adjacent to an enum definition."},ENUM_VALUE:{value:h.ENUM_VALUE,description:"Location adjacent to an enum value definition."},INPUT_OBJECT:{value:h.INPUT_OBJECT,description:"Location adjacent to an input object type definition."},INPUT_FIELD_DEFINITION:{value:h.INPUT_FIELD_DEFINITION,description:"Location adjacent to an input object field definition."}}}),kt=new GraphQLObjectType({name:"__Type",description:"The fundamental unit of any GraphQL Schema is the type. There are many kinds of types in GraphQL as represented by the `__TypeKind` enum.\n\nDepending on the kind of a type, certain fields describe information about that type. Scalar types provide no information beyond a name, description and optional `specifiedByURL`, while Enum types provide their values. Object and Interface types provide the fields they describe. Abstract types, Union and Interface, provide the Object types possible at runtime. List and NonNull types compose other types.",fields:()=>({kind:{type:new GraphQLNonNull(Gt),resolve:e=>Ae(e)?Ct.SCALAR:De(e)?Ct.OBJECT:we(e)?Ct.INTERFACE:ke(e)?Ct.UNION:xe(e)?Ct.ENUM:Fe(e)?Ct.INPUT_OBJECT:Re(e)?Ct.LIST:Ge(e)?Ct.NON_NULL:void i(!1,`Unexpected type: "${Y(e)}".`)},name:{type:ft,resolve:e=>"name"in e?e.name:void 0},description:{type:ft,resolve:e=>"description"in e?e.description:void 0},specifiedByURL:{type:ft,resolve:e=>"specifiedByURL"in e?e.specifiedByURL:void 0},fields:{type:new GraphQLList(new GraphQLNonNull(xt)),args:{includeDeprecated:{type:ht,defaultValue:!1}},resolve(e,{includeDeprecated:t}){if(De(e)||we(e)){const n=Object.values(e.getFields());return t?n:n.filter((e=>null==e.deprecationReason))}}},interfaces:{type:new GraphQLList(new GraphQLNonNull(kt)),resolve(e){if(De(e)||we(e))return e.getInterfaces()}},possibleTypes:{type:new GraphQLList(new GraphQLNonNull(kt)),resolve(e,t,n,{schema:i}){if(Ve(e))return i.getPossibleTypes(e)}},enumValues:{type:new GraphQLList(new GraphQLNonNull(Rt)),args:{includeDeprecated:{type:ht,defaultValue:!1}},resolve(e,{includeDeprecated:t}){if(xe(e)){const n=e.getValues();return t?n:n.filter((e=>null==e.deprecationReason))}}},inputFields:{type:new GraphQLList(new GraphQLNonNull(Ft)),args:{includeDeprecated:{type:ht,defaultValue:!1}},resolve(e,{includeDeprecated:t}){if(Fe(e)){const n=Object.values(e.getFields());return t?n:n.filter((e=>null==e.deprecationReason))}}},ofType:{type:kt,resolve:e=>"ofType"in e?e.ofType:void 0}})}),xt=new GraphQLObjectType({name:"__Field",description:"Object and Interface types are described by a list of Fields, each of which has a name, potentially a list of arguments, and a return type.",fields:()=>({name:{type:new GraphQLNonNull(ft),resolve:e=>e.name},description:{type:ft,resolve:e=>e.description},args:{type:new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(Ft))),args:{includeDeprecated:{type:ht,defaultValue:!1}},resolve:(e,{includeDeprecated:t})=>t?e.args:e.args.filter((e=>null==e.deprecationReason))},type:{type:new GraphQLNonNull(kt),resolve:e=>e.type},isDeprecated:{type:new GraphQLNonNull(ht),resolve:e=>null!=e.deprecationReason},deprecationReason:{type:ft,resolve:e=>e.deprecationReason}})}),Ft=new GraphQLObjectType({name:"__InputValue",description:"Arguments provided to Fields or Directives and the input fields of an InputObject are represented as Input Values which describe their type and optionally a default value.",fields:()=>({name:{type:new GraphQLNonNull(ft),resolve:e=>e.name},description:{type:ft,resolve:e=>e.description},type:{type:new GraphQLNonNull(kt),resolve:e=>e.type},defaultValue:{type:ft,description:"A GraphQL-formatted string representing the default value for this input value.",resolve(e){const{type:t,defaultValue:n}=e,i=Lt(n,t);return i?ye(i):null}},isDeprecated:{type:new GraphQLNonNull(ht),resolve:e=>null!=e.deprecationReason},deprecationReason:{type:ft,resolve:e=>e.deprecationReason}})}),Rt=new GraphQLObjectType({name:"__EnumValue",description:"One possible value for a given Enum. Enum values are unique values, not a placeholder for a string or numeric value. However an Enum value is returned in a JSON response as a string.",fields:()=>({name:{type:new GraphQLNonNull(ft),resolve:e=>e.name},description:{type:ft,resolve:e=>e.description},isDeprecated:{type:new GraphQLNonNull(ht),resolve:e=>null!=e.deprecationReason},deprecationReason:{type:ft,resolve:e=>e.deprecationReason}})});let Ct;!function(e){e.SCALAR="SCALAR",e.OBJECT="OBJECT",e.INTERFACE="INTERFACE",e.UNION="UNION",e.ENUM="ENUM",e.INPUT_OBJECT="INPUT_OBJECT",e.LIST="LIST",e.NON_NULL="NON_NULL"}(Ct||(Ct={}));const Gt=new GraphQLEnumType({name:"__TypeKind",description:"An enum describing what kind of type a given `__Type` is.",values:{SCALAR:{value:Ct.SCALAR,description:"Indicates this type is a scalar."},OBJECT:{value:Ct.OBJECT,description:"Indicates this type is an object. `fields` and `interfaces` are valid fields."},INTERFACE:{value:Ct.INTERFACE,description:"Indicates this type is an interface. `fields`, `interfaces`, and `possibleTypes` are valid fields."},UNION:{value:Ct.UNION,description:"Indicates this type is a union. `possibleTypes` is a valid field."},ENUM:{value:Ct.ENUM,description:"Indicates this type is an enum. `enumValues` is a valid field."},INPUT_OBJECT:{value:Ct.INPUT_OBJECT,description:"Indicates this type is an input object. `inputFields` is a valid field."},LIST:{value:Ct.LIST,description:"Indicates this type is a list. `ofType` is a valid field."},NON_NULL:{value:Ct.NON_NULL,description:"Indicates this type is a non-null. `ofType` is a valid field."}}}),$t={name:"__schema",type:new GraphQLNonNull(At),description:"Access the current type schema of this server.",args:[],resolve:(e,t,n,{schema:i})=>i,deprecationReason:void 0,extensions:Object.create(null),astNode:void 0},Qt={name:"__type",type:kt,description:"Request the type information of a single type.",args:[{name:"name",description:void 0,type:new GraphQLNonNull(ft),defaultValue:void 0,deprecationReason:void 0,extensions:Object.create(null),astNode:void 0}],resolve:(e,{name:t},n,{schema:i})=>i.getType(t),deprecationReason:void 0,extensions:Object.create(null),astNode:void 0},Ut={name:"__typename",type:new GraphQLNonNull(ft),description:"The name of the current Object type at runtime.",args:[],resolve:(e,t,n,{parentType:i})=>i.name,deprecationReason:void 0,extensions:Object.create(null),astNode:void 0},jt=Object.freeze([At,Dt,wt,kt,xt,Ft,Rt,Gt]);function Vt(e){return jt.some((({name:t})=>e.name===t))}function Mt(e){if(!function(e){return q(e,GraphQLSchema)}(e))throw new Error(`Expected ${Y(e)} to be a GraphQL schema.`);return e}class GraphQLSchema{constructor(e){var i,r;this.__validationErrors=!0===e.assumeValid?[]:void 0,n(e)||t(!1,"Must provide configuration object."),!e.types||Array.isArray(e.types)||t(!1,`"types" must be Array if provided but got: ${Y(e.types)}.`),!e.directives||Array.isArray(e.directives)||t(!1,`"directives" must be Array if provided but got: ${Y(e.directives)}.`),this.description=e.description,this.extensions=ue(e.extensions),this.astNode=e.astNode,this.extensionASTNodes=null!==(i=e.extensionASTNodes)&&void 0!==i?i:[],this._queryType=e.query,this._mutationType=e.mutation,this._subscriptionType=e.subscription,this._directives=null!==(r=e.directives)&&void 0!==r?r:bt;const o=new Set(e.types);if(null!=e.types)for(const t of e.types)o.delete(t),Pt(t,o);null!=this._queryType&&Pt(this._queryType,o),null!=this._mutationType&&Pt(this._mutationType,o),null!=this._subscriptionType&&Pt(this._subscriptionType,o);for(const e of this._directives)if(Tt(e))for(const t of e.args)Pt(t.type,o);Pt(At,o),this._typeMap=Object.create(null),this._subTypeMap=Object.create(null),this._implementationsMap=Object.create(null);for(const e of o){if(null==e)continue;const n=e.name;if(n||t(!1,"One of the provided types for building the Schema is missing a name."),void 0!==this._typeMap[n])throw new Error(`Schema must contain uniquely named types but contains multiple types named "${n}".`);if(this._typeMap[n]=e,we(e)){for(const t of e.getInterfaces())if(we(t)){let n=this._implementationsMap[t.name];void 0===n&&(n=this._implementationsMap[t.name]={objects:[],interfaces:[]}),n.interfaces.push(e)}}else if(De(e))for(const t of e.getInterfaces())if(we(t)){let n=this._implementationsMap[t.name];void 0===n&&(n=this._implementationsMap[t.name]={objects:[],interfaces:[]}),n.objects.push(e)}}}get[Symbol.toStringTag](){return"GraphQLSchema"}getQueryType(){return this._queryType}getMutationType(){return this._mutationType}getSubscriptionType(){return this._subscriptionType}getRootType(e){switch(e){case f.QUERY:return this.getQueryType();case f.MUTATION:return this.getMutationType();case f.SUBSCRIPTION:return this.getSubscriptionType()}}getTypeMap(){return this._typeMap}getType(e){return this.getTypeMap()[e]}getPossibleTypes(e){return ke(e)?e.getTypes():this.getImplementations(e).objects}getImplementations(e){const t=this._implementationsMap[e.name];return null!=t?t:{objects:[],interfaces:[]}}isSubType(e,t){let n=this._subTypeMap[e.name];if(void 0===n){if(n=Object.create(null),ke(e))for(const t of e.getTypes())n[t.name]=!0;else{const t=this.getImplementations(e);for(const e of t.objects)n[e.name]=!0;for(const e of t.interfaces)n[e.name]=!0}this._subTypeMap[e.name]=n}return void 0!==n[t.name]}getDirectives(){return this._directives}getDirective(e){return this.getDirectives().find((t=>t.name===e))}toConfig(){return{description:this.description,query:this.getQueryType(),mutation:this.getMutationType(),subscription:this.getSubscriptionType(),types:Object.values(this.getTypeMap()),directives:this.getDirectives(),extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes,assumeValid:void 0!==this.__validationErrors}}}function Pt(e,t){const n=Je(e);if(!t.has(n))if(t.add(n),ke(n))for(const e of n.getTypes())Pt(e,t);else if(De(n)||we(n)){for(const e of n.getInterfaces())Pt(e,t);for(const e of Object.values(n.getFields())){Pt(e.type,t);for(const n of e.args)Pt(n.type,t)}}else if(Fe(n))for(const e of Object.values(n.getFields()))Pt(e.type,t);return t}function Bt(e){if(Mt(e),e.__validationErrors)return e.__validationErrors;const t=new SchemaValidationContext(e);!function(e){const t=e.schema,n=t.getQueryType();if(n){if(!De(n)){var i;e.reportError(`Query root type must be Object type, it cannot be ${Y(n)}.`,null!==(i=Yt(t,f.QUERY))&&void 0!==i?i:n.astNode)}}else e.reportError("Query root type must be provided.",t.astNode);const r=t.getMutationType();var o;r&&!De(r)&&e.reportError(`Mutation root type must be Object type if provided, it cannot be ${Y(r)}.`,null!==(o=Yt(t,f.MUTATION))&&void 0!==o?o:r.astNode);const s=t.getSubscriptionType();var a;s&&!De(s)&&e.reportError(`Subscription root type must be Object type if provided, it cannot be ${Y(s)}.`,null!==(a=Yt(t,f.SUBSCRIPTION))&&void 0!==a?a:s.astNode)}(t),function(e){for(const n of e.schema.getDirectives())if(Tt(n)){Jt(e,n);for(const i of n.args){var t;if(Jt(e,i),$e(i.type)||e.reportError(`The type of @${n.name}(${i.name}:) must be Input Type but got: ${Y(i.type)}.`,i.astNode),tt(i)&&null!=i.deprecationReason)e.reportError(`Required argument @${n.name}(${i.name}:) cannot be deprecated.`,[nn(i.astNode),null===(t=i.astNode)||void 0===t?void 0:t.type])}}else e.reportError(`Expected directive but got: ${Y(n)}.`,null==n?void 0:n.astNode)}(t),function(e){const t=function(e){const t=Object.create(null),n=[],i=Object.create(null);return r;function r(o){if(t[o.name])return;t[o.name]=!0,i[o.name]=n.length;const s=Object.values(o.getFields());for(const t of s)if(Ge(t.type)&&Fe(t.type.ofType)){const o=t.type.ofType,s=i[o.name];if(n.push(t),void 0===s)r(o);else{const t=n.slice(s),i=t.map((e=>e.name)).join(".");e.reportError(`Cannot reference Input Object "${o.name}" within itself through a series of non-null fields: "${i}".`,t.map((e=>e.astNode)))}n.pop()}i[o.name]=void 0}}(e),n=e.schema.getTypeMap();for(const i of Object.values(n))Ye(i)?(Vt(i)||Jt(e,i),De(i)||we(i)?(qt(e,i),Kt(e,i)):ke(i)?Ht(e,i):xe(i)?Wt(e,i):Fe(i)&&(Zt(e,i),t(i))):e.reportError(`Expected GraphQL named type but got: ${Y(i)}.`,i.astNode)}(t);const n=t.getErrors();return e.__validationErrors=n,n}class SchemaValidationContext{constructor(e){this._errors=[],this.schema=e}reportError(e,t){const n=Array.isArray(t)?t.filter(Boolean):t;this._errors.push(new GraphQLError(e,n))}getErrors(){return this._errors}}function Yt(e,t){var n;return null===(n=[e.astNode,...e.extensionASTNodes].flatMap((e=>{var t;return null!==(t=null==e?void 0:e.operationTypes)&&void 0!==t?t:[]})).find((e=>e.operation===t)))||void 0===n?void 0:n.type}function Jt(e,t){t.name.startsWith("__")&&e.reportError(`Name "${t.name}" must not begin with "__", which is reserved by GraphQL introspection.`,t.astNode)}function qt(e,t){const n=Object.values(t.getFields());0===n.length&&e.reportError(`Type ${t.name} must define one or more fields.`,[t.astNode,...t.extensionASTNodes]);for(const s of n){var i;if(Jt(e,s),!Qe(s.type))e.reportError(`The type of ${t.name}.${s.name} must be Output Type but got: ${Y(s.type)}.`,null===(i=s.astNode)||void 0===i?void 0:i.type);for(const n of s.args){const i=n.name;var r,o;if(Jt(e,n),!$e(n.type))e.reportError(`The type of ${t.name}.${s.name}(${i}:) must be Input Type but got: ${Y(n.type)}.`,null===(r=n.astNode)||void 0===r?void 0:r.type);if(tt(n)&&null!=n.deprecationReason)e.reportError(`Required argument ${t.name}.${s.name}(${i}:) cannot be deprecated.`,[nn(n.astNode),null===(o=n.astNode)||void 0===o?void 0:o.type])}}}function Kt(e,t){const n=Object.create(null);for(const i of t.getInterfaces())we(i)?t!==i?n[i.name]?e.reportError(`Type ${t.name} can only implement ${i.name} once.`,en(t,i)):(n[i.name]=!0,zt(e,t,i),Xt(e,t,i)):e.reportError(`Type ${t.name} cannot implement itself because it would create a circular reference.`,en(t,i)):e.reportError(`Type ${Y(t)} must only implement Interface types, it cannot implement ${Y(i)}.`,en(t,i))}function Xt(e,t,n){const i=t.getFields();for(const c of Object.values(n.getFields())){const u=c.name,l=i[u];if(l){var r,o;if(!at(e.schema,l.type,c.type))e.reportError(`Interface field ${n.name}.${u} expects type ${Y(c.type)} but ${t.name}.${u} is type ${Y(l.type)}.`,[null===(r=c.astNode)||void 0===r?void 0:r.type,null===(o=l.astNode)||void 0===o?void 0:o.type]);for(const i of c.args){const r=i.name,o=l.args.find((e=>e.name===r));var s,a;if(o){if(!st(i.type,o.type))e.reportError(`Interface field argument ${n.name}.${u}(${r}:) expects type ${Y(i.type)} but ${t.name}.${u}(${r}:) is type ${Y(o.type)}.`,[null===(s=i.astNode)||void 0===s?void 0:s.type,null===(a=o.astNode)||void 0===a?void 0:a.type])}else e.reportError(`Interface field argument ${n.name}.${u}(${r}:) expected but ${t.name}.${u} does not provide it.`,[i.astNode,l.astNode])}for(const i of l.args){const r=i.name;!c.args.find((e=>e.name===r))&&tt(i)&&e.reportError(`Object field ${t.name}.${u} includes required argument ${r} that is missing from the Interface field ${n.name}.${u}.`,[i.astNode,c.astNode])}}else e.reportError(`Interface field ${n.name}.${u} expected but ${t.name} does not provide it.`,[c.astNode,t.astNode,...t.extensionASTNodes])}}function zt(e,t,n){const i=t.getInterfaces();for(const r of n.getInterfaces())i.includes(r)||e.reportError(r===t?`Type ${t.name} cannot implement ${n.name} because it would create a circular reference.`:`Type ${t.name} must implement ${r.name} because it is implemented by ${n.name}.`,[...en(n,r),...en(t,n)])}function Ht(e,t){const n=t.getTypes();0===n.length&&e.reportError(`Union type ${t.name} must define one or more member types.`,[t.astNode,...t.extensionASTNodes]);const i=Object.create(null);for(const r of n)i[r.name]?e.reportError(`Union type ${t.name} can only include type ${r.name} once.`,tn(t,r.name)):(i[r.name]=!0,De(r)||e.reportError(`Union type ${t.name} can only include Object types, it cannot include ${Y(r)}.`,tn(t,String(r))))}function Wt(e,t){const n=t.getValues();0===n.length&&e.reportError(`Enum type ${t.name} must define one or more values.`,[t.astNode,...t.extensionASTNodes]);for(const t of n)Jt(e,t)}function Zt(e,t){const n=Object.values(t.getFields());0===n.length&&e.reportError(`Input Object type ${t.name} must define one or more fields.`,[t.astNode,...t.extensionASTNodes]);for(const o of n){var i,r;if(Jt(e,o),!$e(o.type))e.reportError(`The type of ${t.name}.${o.name} must be Input Type but got: ${Y(o.type)}.`,null===(i=o.astNode)||void 0===i?void 0:i.type);if(ot(o)&&null!=o.deprecationReason)e.reportError(`Required input field ${t.name}.${o.name} cannot be deprecated.`,[nn(o.astNode),null===(r=o.astNode)||void 0===r?void 0:r.type])}}function en(e,t){const{astNode:n,extensionASTNodes:i}=e;return(null!=n?[n,...i]:i).flatMap((e=>{var t;return null!==(t=e.interfaces)&&void 0!==t?t:[]})).filter((e=>e.name.value===t.name))}function tn(e,t){const{astNode:n,extensionASTNodes:i}=e;return(null!=n?[n,...i]:i).flatMap((e=>{var t;return null!==(t=e.types)&&void 0!==t?t:[]})).filter((e=>e.name.value===t))}function nn(e){var t;return null==e||null===(t=e.directives)||void 0===t?void 0:t.find((e=>e.name.value===_t.name))}function rn(e,t){switch(t.kind){case m.LIST_TYPE:{const n=rn(e,t.type);return n&&new GraphQLList(n)}case m.NON_NULL_TYPE:{const n=rn(e,t.type);return n&&new GraphQLNonNull(n)}case m.NAMED_TYPE:return e.getType(t.name.value)}}class TypeInfo{constructor(e,t,n){this._schema=e,this._typeStack=[],this._parentTypeStack=[],this._inputTypeStack=[],this._fieldDefStack=[],this._defaultValueStack=[],this._directive=null,this._argument=null,this._enumValue=null,this._getFieldDef=null!=n?n:on,t&&($e(t)&&this._inputTypeStack.push(t),je(t)&&this._parentTypeStack.push(t),Qe(t)&&this._typeStack.push(t))}get[Symbol.toStringTag](){return"TypeInfo"}getType(){if(this._typeStack.length>0)return this._typeStack[this._typeStack.length-1]}getParentType(){if(this._parentTypeStack.length>0)return this._parentTypeStack[this._parentTypeStack.length-1]}getInputType(){if(this._inputTypeStack.length>0)return this._inputTypeStack[this._inputTypeStack.length-1]}getParentInputType(){if(this._inputTypeStack.length>1)return this._inputTypeStack[this._inputTypeStack.length-2]}getFieldDef(){if(this._fieldDefStack.length>0)return this._fieldDefStack[this._fieldDefStack.length-1]}getDefaultValue(){if(this._defaultValueStack.length>0)return this._defaultValueStack[this._defaultValueStack.length-1]}getDirective(){return this._directive}getArgument(){return this._argument}getEnumValue(){return this._enumValue}enter(e){const t=this._schema;switch(e.kind){case m.SELECTION_SET:{const e=Je(this.getType());this._parentTypeStack.push(je(e)?e:void 0);break}case m.FIELD:{const n=this.getParentType();let i,r;n&&(i=this._getFieldDef(t,n,e),i&&(r=i.type)),this._fieldDefStack.push(i),this._typeStack.push(Qe(r)?r:void 0);break}case m.DIRECTIVE:this._directive=t.getDirective(e.name.value);break;case m.OPERATION_DEFINITION:{const n=t.getRootType(e.operation);this._typeStack.push(De(n)?n:void 0);break}case m.INLINE_FRAGMENT:case m.FRAGMENT_DEFINITION:{const n=e.typeCondition,i=n?rn(t,n):Je(this.getType());this._typeStack.push(Qe(i)?i:void 0);break}case m.VARIABLE_DEFINITION:{const n=rn(t,e.type);this._inputTypeStack.push($e(n)?n:void 0);break}case m.ARGUMENT:{var n;let t,i;const r=null!==(n=this.getDirective())&&void 0!==n?n:this.getFieldDef();r&&(t=r.args.find((t=>t.name===e.name.value)),t&&(i=t.type)),this._argument=t,this._defaultValueStack.push(t?t.defaultValue:void 0),this._inputTypeStack.push($e(i)?i:void 0);break}case m.LIST:{const e=Be(this.getInputType()),t=Re(e)?e.ofType:e;this._defaultValueStack.push(void 0),this._inputTypeStack.push($e(t)?t:void 0);break}case m.OBJECT_FIELD:{const t=Je(this.getInputType());let n,i;Fe(t)&&(i=t.getFields()[e.name.value],i&&(n=i.type)),this._defaultValueStack.push(i?i.defaultValue:void 0),this._inputTypeStack.push($e(n)?n:void 0);break}case m.ENUM:{const t=Je(this.getInputType());let n;xe(t)&&(n=t.getValue(e.value)),this._enumValue=n;break}}}leave(e){switch(e.kind){case m.SELECTION_SET:this._parentTypeStack.pop();break;case m.FIELD:this._fieldDefStack.pop(),this._typeStack.pop();break;case m.DIRECTIVE:this._directive=null;break;case m.OPERATION_DEFINITION:case m.INLINE_FRAGMENT:case m.FRAGMENT_DEFINITION:this._typeStack.pop();break;case m.VARIABLE_DEFINITION:this._inputTypeStack.pop();break;case m.ARGUMENT:this._argument=null,this._defaultValueStack.pop(),this._inputTypeStack.pop();break;case m.LIST:case m.OBJECT_FIELD:this._defaultValueStack.pop(),this._inputTypeStack.pop();break;case m.ENUM:this._enumValue=null}}}function on(e,t,n){const i=n.name.value;return i===$t.name&&e.getQueryType()===t?$t:i===Qt.name&&e.getQueryType()===t?Qt:i===Ut.name&&je(t)?Ut:De(t)||we(t)?t.getFields()[i]:void 0}function sn(e,t){return{enter(...n){const i=n[0];e.enter(i);const r=ve(t,i.kind).enter;if(r){const o=r.apply(t,n);return void 0!==o&&(e.leave(i),d(o)&&e.enter(o)),o}},leave(...n){const i=n[0],r=ve(t,i.kind).leave;let o;return r&&(o=r.apply(t,n)),e.leave(i),o}}}function an(e){return e.kind===m.OPERATION_DEFINITION||e.kind===m.FRAGMENT_DEFINITION}function cn(e){return e.kind===m.SCALAR_TYPE_DEFINITION||e.kind===m.OBJECT_TYPE_DEFINITION||e.kind===m.INTERFACE_TYPE_DEFINITION||e.kind===m.UNION_TYPE_DEFINITION||e.kind===m.ENUM_TYPE_DEFINITION||e.kind===m.INPUT_OBJECT_TYPE_DEFINITION}function un(e){return e.kind===m.SCALAR_TYPE_EXTENSION||e.kind===m.OBJECT_TYPE_EXTENSION||e.kind===m.INTERFACE_TYPE_EXTENSION||e.kind===m.UNION_TYPE_EXTENSION||e.kind===m.ENUM_TYPE_EXTENSION||e.kind===m.INPUT_OBJECT_TYPE_EXTENSION}function ln(e){const t=Object.create(null),n=e.getSchema(),i=n?n.getDirectives():bt;for(const e of i)t[e.name]=e.args.map((e=>e.name));const r=e.getDocument().definitions;for(const e of r)if(e.kind===m.DIRECTIVE_DEFINITION){var o;const n=null!==(o=e.arguments)&&void 0!==o?o:[];t[e.name.value]=n.map((e=>e.name.value))}return{Directive(n){const i=n.name.value,r=t[i];if(n.arguments&&r)for(const t of n.arguments){const n=t.name.value;if(!r.includes(n)){const o=ae(n,r);e.reportError(new GraphQLError(`Unknown argument "${n}" on directive "@${i}".`+W(o),t))}}return!1}}}function pn(e){const t=Object.create(null),n=e.getSchema(),r=n?n.getDirectives():bt;for(const e of r)t[e.name]=e.locations;const o=e.getDocument().definitions;for(const e of o)e.kind===m.DIRECTIVE_DEFINITION&&(t[e.name.value]=e.locations.map((e=>e.value)));return{Directive(n,r,o,s,a){const c=n.name.value,u=t[c];if(!u)return void e.reportError(new GraphQLError(`Unknown directive "@${c}".`,n));const l=function(e){const t=e[e.length-1];switch("kind"in t||i(!1),t.kind){case m.OPERATION_DEFINITION:return function(e){switch(e){case f.QUERY:return h.QUERY;case f.MUTATION:return h.MUTATION;case f.SUBSCRIPTION:return h.SUBSCRIPTION}}(t.operation);case m.FIELD:return h.FIELD;case m.FRAGMENT_SPREAD:return h.FRAGMENT_SPREAD;case m.INLINE_FRAGMENT:return h.INLINE_FRAGMENT;case m.FRAGMENT_DEFINITION:return h.FRAGMENT_DEFINITION;case m.VARIABLE_DEFINITION:return h.VARIABLE_DEFINITION;case m.SCHEMA_DEFINITION:case m.SCHEMA_EXTENSION:return h.SCHEMA;case m.SCALAR_TYPE_DEFINITION:case m.SCALAR_TYPE_EXTENSION:return h.SCALAR;case m.OBJECT_TYPE_DEFINITION:case m.OBJECT_TYPE_EXTENSION:return h.OBJECT;case m.FIELD_DEFINITION:return h.FIELD_DEFINITION;case m.INTERFACE_TYPE_DEFINITION:case m.INTERFACE_TYPE_EXTENSION:return h.INTERFACE;case m.UNION_TYPE_DEFINITION:case m.UNION_TYPE_EXTENSION:return h.UNION;case m.ENUM_TYPE_DEFINITION:case m.ENUM_TYPE_EXTENSION:return h.ENUM;case m.ENUM_VALUE_DEFINITION:return h.ENUM_VALUE;case m.INPUT_OBJECT_TYPE_DEFINITION:case m.INPUT_OBJECT_TYPE_EXTENSION:return h.INPUT_OBJECT;case m.INPUT_VALUE_DEFINITION:{const t=e[e.length-3];return"kind"in t||i(!1),t.kind===m.INPUT_OBJECT_TYPE_DEFINITION?h.INPUT_FIELD_DEFINITION:h.ARGUMENT_DEFINITION}default:i(!1,"Unexpected kind: "+Y(t.kind))}}(a);l&&!u.includes(l)&&e.reportError(new GraphQLError(`Directive "@${c}" may not be used on ${l}.`,n))}}}function dn(e){const t=e.getSchema(),n=t?t.getTypeMap():Object.create(null),i=Object.create(null);for(const t of e.getDocument().definitions)cn(t)&&(i[t.name.value]=!0);const r=[...Object.keys(n),...Object.keys(i)];return{NamedType(t,o,s,a,c){const u=t.name.value;if(!n[u]&&!i[u]){var l;const n=null!==(l=c[2])&&void 0!==l?l:s,i=null!=n&&("kind"in(p=n)&&(function(e){return e.kind===m.SCHEMA_DEFINITION||cn(e)||e.kind===m.DIRECTIVE_DEFINITION}(p)||function(e){return e.kind===m.SCHEMA_EXTENSION||un(e)}(p)));if(i&&fn.includes(u))return;const o=ae(u,i?fn.concat(r):r);e.reportError(new GraphQLError(`Unknown type "${u}".`+W(o),t))}var p}}}const fn=[...vt,...jt].map((e=>e.name));function hn(e){const t=[],n=[];return{OperationDefinition:e=>(t.push(e),!1),FragmentDefinition:e=>(n.push(e),!1),Document:{leave(){const i=Object.create(null);for(const n of t)for(const t of e.getRecursivelyReferencedFragments(n))i[t.name.value]=!0;for(const t of n){const n=t.name.value;!0!==i[n]&&e.reportError(new GraphQLError(`Fragment "${n}" is never used.`,t))}}}}}function mn(e,t){const n=[e];for(;Re(Be(n[n.length-1]));){const e=Ce(Be(n[n.length-1])).ofType;n.push(e)}if(t){const e=he(t,{RequiredDesignator:{leave({element:e}){if(e)return new GraphQLNonNull(Be(e));const t=n.pop();return new GraphQLNonNull(Be(t))}},OptionalDesignator:{leave({element:e}){if(e)return Be(e);return Be(n.pop())}},ListNullability:{leave({element:e}){let i=n.pop();if(Re(Be(i))||(i=n.pop()),!i)throw new GraphQLError("List nullability modifier is too deep.",t);const r=Ge(i);return e?r?new GraphQLNonNull(new GraphQLList(e)):new GraphQLList(e):i}}});if(n.length>0)throw new GraphQLError("List nullability modifier is too shallow.",t);return e}return e}function vn(e){switch(e.kind){case m.OBJECT:return{...e,fields:(t=e.fields,t.map((e=>({...e,value:vn(e.value)}))).sort(((e,t)=>ie(e.name.value,t.name.value))))};case m.LIST:return{...e,values:e.values.map(vn)};case m.INT:case m.FLOAT:case m.STRING:case m.BOOLEAN:case m.NULL:case m.ENUM:case m.VARIABLE:return e}var t}function yn(e){return Array.isArray(e)?e.map((([e,t])=>`subfields "${e}" conflict because `+yn(t))).join(" and "):e}function En(e,t,n,i,r,o,s){const a=e.getFragment(s);if(!a)return;const[c,u]=bn(e,n,a);if(o!==c){Nn(e,t,n,i,r,o,c);for(const a of u)i.has(a,s,r)||(i.add(a,s,r),En(e,t,n,i,r,o,a))}}function Tn(e,t,n,i,r,o,s){if(o===s)return;if(i.has(o,s,r))return;i.add(o,s,r);const a=e.getFragment(o),c=e.getFragment(s);if(!a||!c)return;const[u,l]=bn(e,n,a),[p,d]=bn(e,n,c);Nn(e,t,n,i,r,u,p);for(const s of d)Tn(e,t,n,i,r,o,s);for(const o of l)Tn(e,t,n,i,r,o,s)}function Nn(e,t,n,i,r,o,s){for(const[a,c]of Object.entries(o)){const o=s[a];if(o)for(const s of c)for(const c of o){const o=In(e,n,i,r,a,s,c);o&&t.push(o)}}}function In(e,t,n,i,r,o,s){const[a,c,u]=o,[l,p,d]=s,f=i||a!==l&&De(a)&&De(l);if(!f){const e=c.name.value,t=p.name.value;if(e!==t)return[[r,`"${e}" and "${t}" are different fields`],[c],[p]];if(gn(c)!==gn(p))return[[r,"they have differing arguments"],[c],[p]]}const h=null==u?void 0:u.type,m=null==d?void 0:d.type;if(h&&m){const e=mn(h,c.required),t=mn(m,p.required);if(_n(e,t))return[[r,`they return conflicting types "${Y(e)}" and "${Y(t)}"`],[c],[p]]}const v=c.selectionSet,y=p.selectionSet;if(v&&y){const i=function(e,t,n,i,r,o,s,a){const c=[],[u,l]=On(e,t,r,o),[p,d]=On(e,t,s,a);Nn(e,c,t,n,i,u,p);for(const r of d)En(e,c,t,n,i,u,r);for(const r of l)En(e,c,t,n,i,p,r);for(const r of l)for(const o of d)Tn(e,c,t,n,i,r,o);return c}(e,t,n,f,Je(h),v,Je(m),y);return function(e,t,n,i){if(e.length>0)return[[t,e.map((([e])=>e))],[n,...e.map((([,e])=>e)).flat()],[i,...e.map((([,,e])=>e)).flat()]]}(i,r,c,p)}}function gn(e){var t;const n=null!==(t=e.arguments)&&void 0!==t?t:[];return ye(vn({kind:m.OBJECT,fields:n.map((e=>({kind:m.OBJECT_FIELD,name:e.name,value:e.value})))}))}function _n(e,t){return Re(e)?!Re(t)||_n(e.ofType,t.ofType):!!Re(t)||(Ge(e)?!Ge(t)||_n(e.ofType,t.ofType):!!Ge(t)||!(!Ue(e)&&!Ue(t))&&e!==t)}function On(e,t,n,i){const r=t.get(i);if(r)return r;const o=Object.create(null),s=Object.create(null);Ln(e,n,i,o,s);const a=[o,Object.keys(s)];return t.set(i,a),a}function bn(e,t,n){const i=t.get(n.selectionSet);if(i)return i;const r=rn(e.getSchema(),n.typeCondition);return On(e,t,r,n.selectionSet)}function Ln(e,t,n,i,r){for(const o of n.selections)switch(o.kind){case m.FIELD:{const e=o.name.value;let n;(De(t)||we(t))&&(n=t.getFields()[e]);const r=o.alias?o.alias.value:e;i[r]||(i[r]=[]),i[r].push([t,o,n]);break}case m.FRAGMENT_SPREAD:r[o.name.value]=!0;break;case m.INLINE_FRAGMENT:{const n=o.typeCondition,s=n?rn(e.getSchema(),n):t;Ln(e,s,o.selectionSet,i,r);break}}}class PairSet{constructor(){this._data=new Map}has(e,t,n){var i;const[r,o]=ee.name));const o=e.getDocument().definitions;for(const e of o)if(e.kind===m.DIRECTIVE_DEFINITION){var s;const t=null!==(s=e.arguments)&&void 0!==s?s:[];n[e.name.value]=ee(t.filter(Dn),(e=>e.name.value))}return{Directive:{leave(t){const i=t.name.value,r=n[i];if(r){var o;const n=null!==(o=t.arguments)&&void 0!==o?o:[],s=new Set(n.map((e=>e.name.value)));for(const[n,o]of Object.entries(r))if(!s.has(n)){const r=Se(o.type)?Y(o.type):ye(o.type);e.reportError(new GraphQLError(`Directive "@${i}" argument "${n}" of type "${r}" is required, but it was not provided.`,t))}}}}}}function Dn(e){return e.type.kind===m.NON_NULL_TYPE&&null==e.defaultValue}function wn(e,t,n){if(e){if(e.kind===m.VARIABLE){const i=e.name.value;if(null==n||void 0===n[i])return;const r=n[i];if(null===r&&Ge(t))return;return r}if(Ge(t)){if(e.kind===m.NULL)return;return wn(e,t.ofType,n)}if(e.kind===m.NULL)return null;if(Re(t)){const i=t.ofType;if(e.kind===m.LIST){const t=[];for(const r of e.values)if(kn(r,n)){if(Ge(i))return;t.push(null)}else{const e=wn(r,i,n);if(void 0===e)return;t.push(e)}return t}const r=wn(e,i,n);if(void 0===r)return;return[r]}if(Fe(t)){if(e.kind!==m.OBJECT)return;const i=Object.create(null),r=ee(e.fields,(e=>e.name.value));for(const e of Object.values(t.getFields())){const t=r[e.name];if(!t||kn(t.value,n)){if(void 0!==e.defaultValue)i[e.name]=e.defaultValue;else if(Ge(e.type))return;continue}const o=wn(t.value,e.type,n);if(void 0===o)return;i[e.name]=o}return i}if(Ue(t)){let i;try{i=t.parseLiteral(e,n)}catch(e){return}if(void 0===i)return;return i}i(!1,"Unexpected input type: "+Y(t))}}function kn(e,t){return e.kind===m.VARIABLE&&(null==t||void 0===t[e.name.value])}function xn(e,t,n){var i;const r=null===(i=t.directives)||void 0===i?void 0:i.find((t=>t.name.value===e.name));if(r)return function(e,t,n){var i;const r={},o=ee(null!==(i=t.arguments)&&void 0!==i?i:[],(e=>e.name.value));for(const i of e.args){const e=i.name,c=i.type,u=o[e];if(!u){if(void 0!==i.defaultValue)r[e]=i.defaultValue;else if(Ge(c))throw new GraphQLError(`Argument "${e}" of required type "${Y(c)}" was not provided.`,t);continue}const l=u.value;let p=l.kind===m.NULL;if(l.kind===m.VARIABLE){const t=l.name.value;if(null==n||(s=n,a=t,!Object.prototype.hasOwnProperty.call(s,a))){if(void 0!==i.defaultValue)r[e]=i.defaultValue;else if(Ge(c))throw new GraphQLError(`Argument "${e}" of required type "${Y(c)}" was provided the variable "$${t}" which was not provided a runtime value.`,l);continue}p=null==n[t]}if(p&&Ge(c))throw new GraphQLError(`Argument "${e}" of non-null type "${Y(c)}" must not be null.`,l);const d=wn(l,c,n);if(void 0===d)throw new GraphQLError(`Argument "${e}" has invalid value ${ye(l)}.`,l);r[e]=d}var s,a;return r}(e,r,n)}function Fn(e,t,n,i,r){const o=new Map;return Rn(e,t,n,i,r,o,new Set),o}function Rn(e,t,n,i,r,o,s){for(const c of r.selections)switch(c.kind){case m.FIELD:{if(!Cn(n,c))continue;const e=(a=c).alias?a.alias.value:a.name.value,t=o.get(e);void 0!==t?t.push(c):o.set(e,[c]);break}case m.INLINE_FRAGMENT:if(!Cn(n,c)||!Gn(e,c,i))continue;Rn(e,t,n,i,c.selectionSet,o,s);break;case m.FRAGMENT_SPREAD:{const r=c.name.value;if(s.has(r)||!Cn(n,c))continue;s.add(r);const a=t[r];if(!a||!Gn(e,a,i))continue;Rn(e,t,n,i,a.selectionSet,o,s);break}}var a}function Cn(e,t){const n=xn(It,t,e);if(!0===(null==n?void 0:n.if))return!1;const i=xn(Nt,t,e);return!1!==(null==i?void 0:i.if)}function Gn(e,t,n){const i=t.typeCondition;if(!i)return!0;const r=rn(e,i);return r===n||!!Ve(r)&&e.isSubType(r,n)}function $n(e,t){const n=new Map;for(const i of e){const e=t(i),r=n.get(e);void 0===r?n.set(e,[i]):r.push(i)}return n}function Qn(e){return{Field:t,Directive:t};function t(t){var n;const i=$n(null!==(n=t.arguments)&&void 0!==n?n:[],(e=>e.name.value));for(const[t,n]of i)n.length>1&&e.reportError(new GraphQLError(`There can be only one argument named "${t}".`,n.map((e=>e.name))))}}function Un(e){const t=Object.create(null),n=e.getSchema(),i=n?n.getDirectives():bt;for(const e of i)t[e.name]=!e.isRepeatable;const r=e.getDocument().definitions;for(const e of r)e.kind===m.DIRECTIVE_DEFINITION&&(t[e.name.value]=!e.repeatable);const o=Object.create(null),s=Object.create(null);return{enter(n){if(!("directives"in n)||!n.directives)return;let i;if(n.kind===m.SCHEMA_DEFINITION||n.kind===m.SCHEMA_EXTENSION)i=o;else if(cn(n)||un(n)){const e=n.name.value;i=s[e],void 0===i&&(s[e]=i=Object.create(null))}else i=Object.create(null);for(const r of n.directives){const n=r.name.value;t[n]&&(i[n]?e.reportError(new GraphQLError(`The directive "@${n}" can only be used once at this location.`,[i[n],r])):i[n]=r)}}}}function jn(e,t){return!!(De(e)||we(e)||Fe(e))&&null!=e.getFields()[t]}function Vn(e){const t=[];let n=Object.create(null);return{ObjectValue:{enter(){t.push(n),n=Object.create(null)},leave(){const e=t.pop();e||i(!1),n=e}},ObjectField(t){const i=t.name.value;n[i]?e.reportError(new GraphQLError(`There can be only one input field named "${i}".`,[n[i],t.name])):n[i]=t.name}}}function Mn(e,t){const n=e.getInputType();if(!n)return;const i=Je(n);if(Ue(i))try{if(void 0===i.parseLiteral(t,void 0)){const i=Y(n);e.reportError(new GraphQLError(`Expected value of type "${i}", found ${ye(t)}.`,t))}}catch(i){const r=Y(n);i instanceof GraphQLError?e.reportError(i):e.reportError(new GraphQLError(`Expected value of type "${r}", found ${ye(t)}; `+i.message,t,void 0,void 0,void 0,i))}else{const i=Y(n);e.reportError(new GraphQLError(`Expected value of type "${i}", found ${ye(t)}.`,t))}}function Pn(e,t,n,i,r){if(Ge(i)&&!Ge(t)){if(!(null!=n&&n.kind!==m.NULL)&&!(void 0!==r))return!1;return at(e,t,i.ofType)}return at(e,t,i)}const Bn=Object.freeze([function(e){return{Document(t){for(const n of t.definitions)if(!an(n)){const t=n.kind===m.SCHEMA_DEFINITION||n.kind===m.SCHEMA_EXTENSION?"schema":'"'+n.name.value+'"';e.reportError(new GraphQLError(`The ${t} definition is not executable.`,n))}return!1}}},function(e){const t=Object.create(null);return{OperationDefinition(n){const i=n.name;return i&&(t[i.value]?e.reportError(new GraphQLError(`There can be only one operation named "${i.value}".`,[t[i.value],i])):t[i.value]=i),!1},FragmentDefinition:()=>!1}},function(e){let t=0;return{Document(e){t=e.definitions.filter((e=>e.kind===m.OPERATION_DEFINITION)).length},OperationDefinition(n){!n.name&&t>1&&e.reportError(new GraphQLError("This anonymous operation must be the only defined operation.",n))}}},function(e){return{OperationDefinition(t){if("subscription"===t.operation){const n=e.getSchema(),i=n.getSubscriptionType();if(i){const r=t.name?t.name.value:null,o=Object.create(null),s=e.getDocument(),a=Object.create(null);for(const e of s.definitions)e.kind===m.FRAGMENT_DEFINITION&&(a[e.name.value]=e);const c=Fn(n,a,o,i,t.selectionSet);if(c.size>1){const t=[...c.values()].slice(1).flat();e.reportError(new GraphQLError(null!=r?`Subscription "${r}" must select only one top level field.`:"Anonymous Subscription must select only one top level field.",t))}for(const t of c.values()){t[0].name.value.startsWith("__")&&e.reportError(new GraphQLError(null!=r?`Subscription "${r}" must not select an introspection top level field.`:"Anonymous Subscription must not select an introspection top level field.",t))}}}}}},dn,function(e){return{InlineFragment(t){const n=t.typeCondition;if(n){const t=rn(e.getSchema(),n);if(t&&!je(t)){const t=ye(n);e.reportError(new GraphQLError(`Fragment cannot condition on non composite type "${t}".`,n))}}},FragmentDefinition(t){const n=rn(e.getSchema(),t.typeCondition);if(n&&!je(n)){const n=ye(t.typeCondition);e.reportError(new GraphQLError(`Fragment "${t.name.value}" cannot condition on non composite type "${n}".`,t.typeCondition))}}}},function(e){return{VariableDefinition(t){const n=rn(e.getSchema(),t.type);if(void 0!==n&&!$e(n)){const n=t.variable.name.value,i=ye(t.type);e.reportError(new GraphQLError(`Variable "$${n}" cannot be non-input type "${i}".`,t.type))}}}},function(e){return{Field(t){const n=e.getType(),i=t.selectionSet;if(n)if(Ue(Je(n))){if(i){const r=t.name.value,o=Y(n);e.reportError(new GraphQLError(`Field "${r}" must not have a selection since type "${o}" has no subfields.`,i))}}else if(!i){const i=t.name.value,r=Y(n);e.reportError(new GraphQLError(`Field "${i}" of type "${r}" must have a selection of subfields. Did you mean "${i} { ... }"?`,t))}}}},function(e){return{Field(t){const n=e.getParentType();if(n){if(!e.getFieldDef()){const i=e.getSchema(),r=t.name.value;let o=W("to use an inline fragment on",function(e,t,n){if(!Ve(t))return[];const i=new Set,r=Object.create(null);for(const s of e.getPossibleTypes(t))if(s.getFields()[n]){i.add(s),r[s.name]=1;for(const e of s.getInterfaces()){var o;e.getFields()[n]&&(i.add(e),r[e.name]=(null!==(o=r[e.name])&&void 0!==o?o:0)+1)}}return[...i].sort(((t,n)=>{const i=r[n.name]-r[t.name];return 0!==i?i:we(t)&&e.isSubType(t,n)?-1:we(n)&&e.isSubType(n,t)?1:ie(t.name,n.name)})).map((e=>e.name))}(i,n,r));""===o&&(o=W(function(e,t){if(De(e)||we(e)){return ae(t,Object.keys(e.getFields()))}return[]}(n,r))),e.reportError(new GraphQLError(`Cannot query field "${r}" on type "${n.name}".`+o,t))}}}}},function(e){const t=Object.create(null);return{OperationDefinition:()=>!1,FragmentDefinition(n){const i=n.name.value;return t[i]?e.reportError(new GraphQLError(`There can be only one fragment named "${i}".`,[t[i],n.name])):t[i]=n.name,!1}}},function(e){return{FragmentSpread(t){const n=t.name.value;e.getFragment(n)||e.reportError(new GraphQLError(`Unknown fragment "${n}".`,t.name))}}},hn,function(e){return{InlineFragment(t){const n=e.getType(),i=e.getParentType();if(je(n)&&je(i)&&!ct(e.getSchema(),n,i)){const r=Y(i),o=Y(n);e.reportError(new GraphQLError(`Fragment cannot be spread here as objects of type "${r}" can never be of type "${o}".`,t))}},FragmentSpread(t){const n=t.name.value,i=function(e,t){const n=e.getFragment(t);if(n){const t=rn(e.getSchema(),n.typeCondition);if(je(t))return t}}(e,n),r=e.getParentType();if(i&&r&&!ct(e.getSchema(),i,r)){const o=Y(r),s=Y(i);e.reportError(new GraphQLError(`Fragment "${n}" cannot be spread here as objects of type "${o}" can never be of type "${s}".`,t))}}}},function(e){const t=Object.create(null),n=[],i=Object.create(null);return{OperationDefinition:()=>!1,FragmentDefinition:e=>(r(e),!1)};function r(o){if(t[o.name.value])return;const s=o.name.value;t[s]=!0;const a=e.getFragmentSpreads(o.selectionSet);if(0!==a.length){i[s]=n.length;for(const t of a){const o=t.name.value,s=i[o];if(n.push(t),void 0===s){const t=e.getFragment(o);t&&r(t)}else{const t=n.slice(s),i=t.slice(0,-1).map((e=>'"'+e.name.value+'"')).join(", ");e.reportError(new GraphQLError(`Cannot spread fragment "${o}" within itself`+(""!==i?` via ${i}.`:"."),t))}n.pop()}i[s]=void 0}}},function(e){return{OperationDefinition(t){var n;const i=$n(null!==(n=t.variableDefinitions)&&void 0!==n?n:[],(e=>e.variable.name.value));for(const[t,n]of i)n.length>1&&e.reportError(new GraphQLError(`There can be only one variable named "$${t}".`,n.map((e=>e.variable.name))))}}},function(e){let t=Object.create(null);return{OperationDefinition:{enter(){t=Object.create(null)},leave(n){const i=e.getRecursiveVariableUsages(n);for(const{node:r}of i){const i=r.name.value;!0!==t[i]&&e.reportError(new GraphQLError(n.name?`Variable "$${i}" is not defined by operation "${n.name.value}".`:`Variable "$${i}" is not defined.`,[r,n]))}}},VariableDefinition(e){t[e.variable.name.value]=!0}}},function(e){let t=[];return{OperationDefinition:{enter(){t=[]},leave(n){const i=Object.create(null),r=e.getRecursiveVariableUsages(n);for(const{node:e}of r)i[e.name.value]=!0;for(const r of t){const t=r.variable.name.value;!0!==i[t]&&e.reportError(new GraphQLError(n.name?`Variable "$${t}" is never used in operation "${n.name.value}".`:`Variable "$${t}" is never used.`,r))}}},VariableDefinition(e){t.push(e)}}},pn,Un,function(e){return{...ln(e),Argument(t){const n=e.getArgument(),i=e.getFieldDef(),r=e.getParentType();if(!n&&i&&r){const n=t.name.value,o=ae(n,i.args.map((e=>e.name)));e.reportError(new GraphQLError(`Unknown argument "${n}" on field "${r.name}.${i.name}".`+W(o),t))}}}},Qn,function(e){return{ListValue(t){if(!Re(Be(e.getParentInputType())))return Mn(e,t),!1},ObjectValue(t){const n=Je(e.getInputType());if(!Fe(n))return Mn(e,t),!1;const i=ee(t.fields,(e=>e.name.value));for(const r of Object.values(n.getFields())){if(!i[r.name]&&ot(r)){const i=Y(r.type);e.reportError(new GraphQLError(`Field "${n.name}.${r.name}" of required type "${i}" was not provided.`,t))}}},ObjectField(t){const n=Je(e.getParentInputType());if(!e.getInputType()&&Fe(n)){const i=ae(t.name.value,Object.keys(n.getFields()));e.reportError(new GraphQLError(`Field "${t.name.value}" is not defined by type "${n.name}".`+W(i),t))}},NullValue(t){const n=e.getInputType();Ge(n)&&e.reportError(new GraphQLError(`Expected value of type "${Y(n)}", found ${ye(t)}.`,t))},EnumValue:t=>Mn(e,t),IntValue:t=>Mn(e,t),FloatValue:t=>Mn(e,t),StringValue:t=>Mn(e,t),BooleanValue:t=>Mn(e,t)}},function(e){return{...An(e),Field:{leave(t){var n;const i=e.getFieldDef();if(!i)return!1;const r=new Set(null===(n=t.arguments)||void 0===n?void 0:n.map((e=>e.name.value)));for(const n of i.args)if(!r.has(n.name)&&tt(n)){const r=Y(n.type);e.reportError(new GraphQLError(`Field "${i.name}" argument "${n.name}" of type "${r}" is required, but it was not provided.`,t))}}}}},function(e){let t=Object.create(null);return{OperationDefinition:{enter(){t=Object.create(null)},leave(n){const i=e.getRecursiveVariableUsages(n);for(const{node:n,type:r,defaultValue:o}of i){const i=n.name.value,s=t[i];if(s&&r){const t=e.getSchema(),a=rn(t,s.type);if(a&&!Pn(t,a,s.defaultValue,r,o)){const t=Y(a),o=Y(r);e.reportError(new GraphQLError(`Variable "$${i}" of type "${t}" used in position expecting type "${o}".`,[s,n]))}}}}},VariableDefinition(e){t[e.variable.name.value]=e}}},function(e){return{Field(t){const n=e.getFieldDef(),i=t.required;if(n&&i){const r=function(e){let t=e,n=0;for(;Re(Be(t));){t=Ce(Be(t)).ofType,n+=1}return n}(n.type),o=he(i,{RequiredDesignator:{leave:({element:e})=>null!=e?e:0},OptionalDesignator:{leave:({element:e})=>null!=e?e:0},ListNullability:{leave:({element:e})=>(null!=e?e:0)+1}});r>o?e.reportError(new GraphQLError("List nullability modifier is too shallow.",t.required)):r1)for(let r=0;r0&&e.reportError(new GraphQLError("Must provide only one schema definition.",t)),++s)}}},function(e){const t=e.getSchema(),n=Object.create(null),i=t?{query:t.getQueryType(),mutation:t.getMutationType(),subscription:t.getSubscriptionType()}:{};return{SchemaDefinition:r,SchemaExtension:r};function r(t){var r;const o=null!==(r=t.operationTypes)&&void 0!==r?r:[];for(const t of o){const r=t.operation,o=n[r];i[r]?e.reportError(new GraphQLError(`Type for ${r} already defined in the schema. It cannot be redefined.`,t)):o?e.reportError(new GraphQLError(`There can be only one ${r} type in schema.`,[o,t])):n[r]=t}return!1}},function(e){const t=Object.create(null),n=e.getSchema();return{ScalarTypeDefinition:i,ObjectTypeDefinition:i,InterfaceTypeDefinition:i,UnionTypeDefinition:i,EnumTypeDefinition:i,InputObjectTypeDefinition:i};function i(i){const r=i.name.value;if(null==n||!n.getType(r))return t[r]?e.reportError(new GraphQLError(`There can be only one type named "${r}".`,[t[r],i.name])):t[r]=i.name,!1;e.reportError(new GraphQLError(`Type "${r}" already exists in the schema. It cannot also be defined in this type definition.`,i.name))}},function(e){const t=e.getSchema(),n=t?t.getTypeMap():Object.create(null),i=Object.create(null);return{EnumTypeDefinition:r,EnumTypeExtension:r};function r(t){var r;const o=t.name.value;i[o]||(i[o]=Object.create(null));const s=null!==(r=t.values)&&void 0!==r?r:[],a=i[o];for(const t of s){const i=t.name.value,r=n[o];xe(r)&&r.getValue(i)?e.reportError(new GraphQLError(`Enum value "${o}.${i}" already exists in the schema. It cannot also be defined in this type extension.`,t.name)):a[i]?e.reportError(new GraphQLError(`Enum value "${o}.${i}" can only be defined once.`,[a[i],t.name])):a[i]=t.name}return!1}},function(e){const t=e.getSchema(),n=t?t.getTypeMap():Object.create(null),i=Object.create(null);return{InputObjectTypeDefinition:r,InputObjectTypeExtension:r,InterfaceTypeDefinition:r,InterfaceTypeExtension:r,ObjectTypeDefinition:r,ObjectTypeExtension:r};function r(t){var r;const o=t.name.value;i[o]||(i[o]=Object.create(null));const s=null!==(r=t.fields)&&void 0!==r?r:[],a=i[o];for(const t of s){const i=t.name.value;jn(n[o],i)?e.reportError(new GraphQLError(`Field "${o}.${i}" already exists in the schema. It cannot also be defined in this type extension.`,t.name)):a[i]?e.reportError(new GraphQLError(`Field "${o}.${i}" can only be defined once.`,[a[i],t.name])):a[i]=t.name}return!1}},function(e){return{DirectiveDefinition(e){var t;const i=null!==(t=e.arguments)&&void 0!==t?t:[];return n(`@${e.name.value}`,i)},InterfaceTypeDefinition:t,InterfaceTypeExtension:t,ObjectTypeDefinition:t,ObjectTypeExtension:t};function t(e){var t;const i=e.name.value,r=null!==(t=e.fields)&&void 0!==t?t:[];for(const e of r){var o;n(`${i}.${e.name.value}`,null!==(o=e.arguments)&&void 0!==o?o:[])}return!1}function n(t,n){const i=$n(n,(e=>e.name.value));for(const[n,r]of i)r.length>1&&e.reportError(new GraphQLError(`Argument "${t}(${n}:)" can only be defined once.`,r.map((e=>e.name))));return!1}},function(e){const t=Object.create(null),n=e.getSchema();return{DirectiveDefinition(i){const r=i.name.value;if(null==n||!n.getDirective(r))return t[r]?e.reportError(new GraphQLError(`There can be only one directive named "@${r}".`,[t[r],i.name])):t[r]=i.name,!1;e.reportError(new GraphQLError(`Directive "@${r}" already exists in the schema. It cannot be redefined.`,i.name))}}},dn,pn,Un,function(e){const t=e.getSchema(),n=Object.create(null);for(const t of e.getDocument().definitions)cn(t)&&(n[t.name.value]=t);return{ScalarTypeExtension:r,ObjectTypeExtension:r,InterfaceTypeExtension:r,UnionTypeExtension:r,EnumTypeExtension:r,InputObjectTypeExtension:r};function r(r){const o=r.name.value,s=n[o],a=null==t?void 0:t.getType(o);let c;if(s?c=Sn[s.kind]:a&&(c=function(e){if(Ae(e))return m.SCALAR_TYPE_EXTENSION;if(De(e))return m.OBJECT_TYPE_EXTENSION;if(we(e))return m.INTERFACE_TYPE_EXTENSION;if(ke(e))return m.UNION_TYPE_EXTENSION;if(xe(e))return m.ENUM_TYPE_EXTENSION;if(Fe(e))return m.INPUT_OBJECT_TYPE_EXTENSION;i(!1,"Unexpected type: "+Y(e))}(a)),c){if(c!==r.kind){const t=function(e){switch(e){case m.SCALAR_TYPE_EXTENSION:return"scalar";case m.OBJECT_TYPE_EXTENSION:return"object";case m.INTERFACE_TYPE_EXTENSION:return"interface";case m.UNION_TYPE_EXTENSION:return"union";case m.ENUM_TYPE_EXTENSION:return"enum";case m.INPUT_OBJECT_TYPE_EXTENSION:return"input object";default:i(!1,"Unexpected kind: "+Y(e))}}(r.kind);e.reportError(new GraphQLError(`Cannot extend non-${t} type "${o}".`,s?[s,r]:r))}}else{const i=ae(o,Object.keys({...n,...null==t?void 0:t.getTypeMap()}));e.reportError(new GraphQLError(`Cannot extend type "${o}" because it is not defined.`+W(i),r.name))}}},ln,Qn,Vn,An]);class ASTValidationContext{constructor(e,t){this._ast=e,this._fragments=void 0,this._fragmentSpreads=new Map,this._recursivelyReferencedFragments=new Map,this._onError=t}get[Symbol.toStringTag](){return"ASTValidationContext"}reportError(e){this._onError(e)}getDocument(){return this._ast}getFragment(e){let t;if(this._fragments)t=this._fragments;else{t=Object.create(null);for(const e of this.getDocument().definitions)e.kind===m.FRAGMENT_DEFINITION&&(t[e.name.value]=e);this._fragments=t}return t[e]}getFragmentSpreads(e){let t=this._fragmentSpreads.get(e);if(!t){t=[];const n=[e];let i;for(;i=n.pop();)for(const e of i.selections)e.kind===m.FRAGMENT_SPREAD?t.push(e):e.selectionSet&&n.push(e.selectionSet);this._fragmentSpreads.set(e,t)}return t}getRecursivelyReferencedFragments(e){let t=this._recursivelyReferencedFragments.get(e);if(!t){t=[];const n=Object.create(null),i=[e.selectionSet];let r;for(;r=i.pop();)for(const e of this.getFragmentSpreads(r)){const r=e.name.value;if(!0!==n[r]){n[r]=!0;const e=this.getFragment(r);e&&(t.push(e),i.push(e.selectionSet))}}this._recursivelyReferencedFragments.set(e,t)}return t}}class SDLValidationContext extends ASTValidationContext{constructor(e,t,n){super(e,n),this._schema=t}get[Symbol.toStringTag](){return"SDLValidationContext"}getSchema(){return this._schema}}class ValidationContext extends ASTValidationContext{constructor(e,t,n,i){super(t,i),this._schema=e,this._typeInfo=n,this._variableUsages=new Map,this._recursiveVariableUsages=new Map}get[Symbol.toStringTag](){return"ValidationContext"}getSchema(){return this._schema}getVariableUsages(e){let t=this._variableUsages.get(e);if(!t){const n=[],i=new TypeInfo(this._schema);he(e,sn(i,{VariableDefinition:()=>!1,Variable(e){n.push({node:e,type:i.getInputType(),defaultValue:i.getDefaultValue()})}})),t=n,this._variableUsages.set(e,t)}return t}getRecursiveVariableUsages(e){let t=this._recursiveVariableUsages.get(e);if(!t){t=this.getVariableUsages(e);for(const n of this.getRecursivelyReferencedFragments(e))t=t.concat(this.getVariableUsages(n));this._recursiveVariableUsages.set(e,t)}return t}getType(){return this._typeInfo.getType()}getParentType(){return this._typeInfo.getParentType()}getInputType(){return this._typeInfo.getInputType()}getParentInputType(){return this._typeInfo.getParentInputType()}getFieldDef(){return this._typeInfo.getFieldDef()}getDirective(){return this._typeInfo.getDirective()}getArgument(){return this._typeInfo.getArgument()}getEnumValue(){return this._typeInfo.getEnumValue()}}function Jn(e,n,i=Bn,r,o=new TypeInfo(e)){var s;const a=null!==(s=null==r?void 0:r.maxErrors)&&void 0!==s?s:100;n||t(!1,"Must provide document."),function(e){const t=Bt(e);if(0!==t.length)throw new Error(t.map((e=>e.message)).join("\n\n"))}(e);const c=Object.freeze({}),u=[],l=new ValidationContext(e,n,o,(e=>{if(u.length>=a)throw u.push(new GraphQLError("Too many validation errors, error limit reached. Validation aborted.")),c;u.push(e)})),p=me(i.map((e=>e(l))));try{he(n,sn(o,p))}catch(e){if(e!==c)throw e}return u}function qn(e,t,n=Yn){const i=[],r=new SDLValidationContext(e,t,(e=>{i.push(e)}));return he(e,me(n.map((e=>e(r))))),i}function Kn(e,i){n(e)&&n(e.__schema)||t(!1,`Invalid or incomplete introspection result. Ensure that you are passing "data" property of introspection response and no "errors" was returned alongside: ${Y(e)}.`);const r=e.__schema,o=te(r.types,(e=>e.name),(e=>function(e){if(null!=e&&null!=e.name&&null!=e.kind)switch(e.kind){case Ct.SCALAR:return new GraphQLScalarType({name:(i=e).name,description:i.description,specifiedByURL:i.specifiedByURL});case Ct.OBJECT:return new GraphQLObjectType({name:(n=e).name,description:n.description,interfaces:()=>h(n),fields:()=>m(n)});case Ct.INTERFACE:return new GraphQLInterfaceType({name:(t=e).name,description:t.description,interfaces:()=>h(t),fields:()=>m(t)});case Ct.UNION:return function(e){if(!e.possibleTypes){const t=Y(e);throw new Error(`Introspection result missing possibleTypes: ${t}.`)}return new GraphQLUnionType({name:e.name,description:e.description,types:()=>e.possibleTypes.map(d)})}(e);case Ct.ENUM:return function(e){if(!e.enumValues){const t=Y(e);throw new Error(`Introspection result missing enumValues: ${t}.`)}return new GraphQLEnumType({name:e.name,description:e.description,values:te(e.enumValues,(e=>e.name),(e=>({description:e.description,deprecationReason:e.deprecationReason})))})}(e);case Ct.INPUT_OBJECT:return function(e){if(!e.inputFields){const t=Y(e);throw new Error(`Introspection result missing inputFields: ${t}.`)}return new GraphQLInputObjectType({name:e.name,description:e.description,fields:()=>E(e.inputFields)})}(e)}var t;var n;var i;const r=Y(e);throw new Error(`Invalid or incomplete introspection result. Ensure that a full introspection query is used in order to build a client schema: ${r}.`)}(e)));for(const e of[...vt,...jt])o[e.name]&&(o[e.name]=e);const s=r.queryType?d(r.queryType):null,a=r.mutationType?d(r.mutationType):null,c=r.subscriptionType?d(r.subscriptionType):null,u=r.directives?r.directives.map((function(e){if(!e.args){const t=Y(e);throw new Error(`Introspection result missing directive args: ${t}.`)}if(!e.locations){const t=Y(e);throw new Error(`Introspection result missing directive locations: ${t}.`)}return new GraphQLDirective({name:e.name,description:e.description,isRepeatable:e.isRepeatable,locations:e.locations.slice(),args:E(e.args)})})):[];return new GraphQLSchema({description:r.description,query:s,mutation:a,subscription:c,types:Object.values(o),directives:u,assumeValid:null==i?void 0:i.assumeValid});function l(e){if(e.kind===Ct.LIST){const t=e.ofType;if(!t)throw new Error("Decorated type deeper than introspection query.");return new GraphQLList(l(t))}if(e.kind===Ct.NON_NULL){const t=e.ofType;if(!t)throw new Error("Decorated type deeper than introspection query.");const n=l(t);return new GraphQLNonNull(function(e){if(!Pe(e))throw new Error(`Expected ${Y(e)} to be a GraphQL nullable type.`);return e}(n))}return p(e)}function p(e){const t=e.name;if(!t)throw new Error(`Unknown type reference: ${Y(e)}.`);const n=o[t];if(!n)throw new Error(`Invalid or incomplete schema, unknown type: ${t}. Ensure that a full introspection query is used in order to build a client schema.`);return n}function d(e){return function(e){if(!De(e))throw new Error(`Expected ${Y(e)} to be a GraphQL Object type.`);return e}(p(e))}function f(e){return function(e){if(!we(e))throw new Error(`Expected ${Y(e)} to be a GraphQL Interface type.`);return e}(p(e))}function h(e){if(null===e.interfaces&&e.kind===Ct.INTERFACE)return[];if(!e.interfaces){const t=Y(e);throw new Error(`Introspection result missing interfaces: ${t}.`)}return e.interfaces.map(f)}function m(e){if(!e.fields)throw new Error(`Introspection result missing fields: ${Y(e)}.`);return te(e.fields,(e=>e.name),y)}function y(e){const t=l(e.type);if(!Qe(t)){const e=Y(t);throw new Error(`Introspection must provide output type for fields, but received: ${e}.`)}if(!e.args){const t=Y(e);throw new Error(`Introspection result missing field args: ${t}.`)}return{description:e.description,deprecationReason:e.deprecationReason,type:t,args:E(e.args)}}function E(e){return te(e,(e=>e.name),T)}function T(e){const t=l(e.type);if(!$e(t)){const e=Y(t);throw new Error(`Introspection must provide input type for arguments, but received: ${e}.`)}const n=null!=e.defaultValue?wn(function(e,t){const n=new Parser(e,t);n.expectToken(v.SOF);const i=n.parseValueLiteral(!1);return n.expectToken(v.EOF),i}(e.defaultValue),t):void 0;return{description:e.description,type:t,defaultValue:n,deprecationReason:e.deprecationReason}}}function Xn(e,n,i){Mt(e),null!=n&&n.kind===m.DOCUMENT||t(!1,"Must provide valid Document AST."),!0!==(null==i?void 0:i.assumeValid)&&!0!==(null==i?void 0:i.assumeValidSDL)&&function(e,t){const n=qn(e,t);if(0!==n.length)throw new Error(n.map((e=>e.message)).join("\n\n"))}(n,e);const r=e.toConfig(),o=zn(r,n,i);return r===o?e:new GraphQLSchema(o)}function zn(e,t,n){var r,o,s,a;const c=[],u=Object.create(null),l=[];let p;const d=[];for(const e of t.definitions)if(e.kind===m.SCHEMA_DEFINITION)p=e;else if(e.kind===m.SCHEMA_EXTENSION)d.push(e);else if(cn(e))c.push(e);else if(un(e)){const t=e.name.value,n=u[t];u[t]=n?n.concat([e]):[e]}else e.kind===m.DIRECTIVE_DEFINITION&&l.push(e);if(0===Object.keys(u).length&&0===c.length&&0===l.length&&0===d.length&&null==p)return e;const f=Object.create(null);for(const t of e.types)f[t.name]=T(t);for(const e of c){var h;const t=e.name.value;f[t]=null!==(h=Hn[t])&&void 0!==h?h:k(e)}const v={query:e.query&&E(e.query),mutation:e.mutation&&E(e.mutation),subscription:e.subscription&&E(e.subscription),...p&&g([p]),...g(d)};return{description:null===(r=p)||void 0===r||null===(o=r.description)||void 0===o?void 0:o.value,...v,types:Object.values(f),directives:[...e.directives.map((function(e){const t=e.toConfig();return new GraphQLDirective({...t,args:ne(t.args,I)})})),...l.map((function(e){var t;return new GraphQLDirective({name:e.name.value,description:null===(t=e.description)||void 0===t?void 0:t.value,locations:e.locations.map((({value:e})=>e)),isRepeatable:e.repeatable,args:L(e.arguments),astNode:e})}))],extensions:Object.create(null),astNode:null!==(s=p)&&void 0!==s?s:e.astNode,extensionASTNodes:e.extensionASTNodes.concat(d),assumeValid:null!==(a=null==n?void 0:n.assumeValid)&&void 0!==a&&a};function y(e){return Re(e)?new GraphQLList(y(e.ofType)):Ge(e)?new GraphQLNonNull(y(e.ofType)):E(e)}function E(e){return f[e.name]}function T(e){return Vt(e)||yt(e)?e:Ae(e)?function(e){var t;const n=e.toConfig(),i=null!==(t=u[n.name])&&void 0!==t?t:[];let r=n.specifiedByURL;for(const e of i){var o;r=null!==(o=Zn(e))&&void 0!==o?o:r}return new GraphQLScalarType({...n,specifiedByURL:r,extensionASTNodes:n.extensionASTNodes.concat(i)})}(e):De(e)?function(e){var t;const n=e.toConfig(),i=null!==(t=u[n.name])&&void 0!==t?t:[];return new GraphQLObjectType({...n,interfaces:()=>[...e.getInterfaces().map(E),...D(i)],fields:()=>({...ne(n.fields,N),...b(i)}),extensionASTNodes:n.extensionASTNodes.concat(i)})}(e):we(e)?function(e){var t;const n=e.toConfig(),i=null!==(t=u[n.name])&&void 0!==t?t:[];return new GraphQLInterfaceType({...n,interfaces:()=>[...e.getInterfaces().map(E),...D(i)],fields:()=>({...ne(n.fields,N),...b(i)}),extensionASTNodes:n.extensionASTNodes.concat(i)})}(e):ke(e)?function(e){var t;const n=e.toConfig(),i=null!==(t=u[n.name])&&void 0!==t?t:[];return new GraphQLUnionType({...n,types:()=>[...e.getTypes().map(E),...w(i)],extensionASTNodes:n.extensionASTNodes.concat(i)})}(e):xe(e)?function(e){var t;const n=e.toConfig(),i=null!==(t=u[e.name])&&void 0!==t?t:[];return new GraphQLEnumType({...n,values:{...n.values,...A(i)},extensionASTNodes:n.extensionASTNodes.concat(i)})}(e):Fe(e)?function(e){var t;const n=e.toConfig(),i=null!==(t=u[n.name])&&void 0!==t?t:[];return new GraphQLInputObjectType({...n,fields:()=>({...ne(n.fields,(e=>({...e,type:y(e.type)}))),...S(i)}),extensionASTNodes:n.extensionASTNodes.concat(i)})}(e):void i(!1,"Unexpected type: "+Y(e))}function N(e){return{...e,type:y(e.type),args:e.args&&ne(e.args,I)}}function I(e){return{...e,type:y(e.type)}}function g(e){const t={};for(const i of e){var n;const e=null!==(n=i.operationTypes)&&void 0!==n?n:[];for(const n of e)t[n.operation]=_(n.type)}return t}function _(e){var t;const n=e.name.value,i=null!==(t=Hn[n])&&void 0!==t?t:f[n];if(void 0===i)throw new Error(`Unknown type: "${n}".`);return i}function O(e){return e.kind===m.LIST_TYPE?new GraphQLList(O(e.type)):e.kind===m.NON_NULL_TYPE?new GraphQLNonNull(O(e.type)):_(e)}function b(e){const t=Object.create(null);for(const r of e){var n;const e=null!==(n=r.fields)&&void 0!==n?n:[];for(const n of e){var i;t[n.name.value]={type:O(n.type),description:null===(i=n.description)||void 0===i?void 0:i.value,args:L(n.arguments),deprecationReason:Wn(n),astNode:n}}}return t}function L(e){const t=null!=e?e:[],n=Object.create(null);for(const e of t){var i;const t=O(e.type);n[e.name.value]={type:t,description:null===(i=e.description)||void 0===i?void 0:i.value,defaultValue:wn(e.defaultValue,t),deprecationReason:Wn(e),astNode:e}}return n}function S(e){const t=Object.create(null);for(const r of e){var n;const e=null!==(n=r.fields)&&void 0!==n?n:[];for(const n of e){var i;const e=O(n.type);t[n.name.value]={type:e,description:null===(i=n.description)||void 0===i?void 0:i.value,defaultValue:wn(n.defaultValue,e),deprecationReason:Wn(n),astNode:n}}}return t}function A(e){const t=Object.create(null);for(const r of e){var n;const e=null!==(n=r.values)&&void 0!==n?n:[];for(const n of e){var i;t[n.name.value]={description:null===(i=n.description)||void 0===i?void 0:i.value,deprecationReason:Wn(n),astNode:n}}}return t}function D(e){return e.flatMap((e=>{var t,n;return null!==(t=null===(n=e.interfaces)||void 0===n?void 0:n.map(_))&&void 0!==t?t:[]}))}function w(e){return e.flatMap((e=>{var t,n;return null!==(t=null===(n=e.types)||void 0===n?void 0:n.map(_))&&void 0!==t?t:[]}))}function k(e){var t;const n=e.name.value,i=null!==(t=u[n])&&void 0!==t?t:[];switch(e.kind){case m.OBJECT_TYPE_DEFINITION:{var r;const t=[e,...i];return new GraphQLObjectType({name:n,description:null===(r=e.description)||void 0===r?void 0:r.value,interfaces:()=>D(t),fields:()=>b(t),astNode:e,extensionASTNodes:i})}case m.INTERFACE_TYPE_DEFINITION:{var o;const t=[e,...i];return new GraphQLInterfaceType({name:n,description:null===(o=e.description)||void 0===o?void 0:o.value,interfaces:()=>D(t),fields:()=>b(t),astNode:e,extensionASTNodes:i})}case m.ENUM_TYPE_DEFINITION:{var s;const t=[e,...i];return new GraphQLEnumType({name:n,description:null===(s=e.description)||void 0===s?void 0:s.value,values:A(t),astNode:e,extensionASTNodes:i})}case m.UNION_TYPE_DEFINITION:{var a;const t=[e,...i];return new GraphQLUnionType({name:n,description:null===(a=e.description)||void 0===a?void 0:a.value,types:()=>w(t),astNode:e,extensionASTNodes:i})}case m.SCALAR_TYPE_DEFINITION:var c;return new GraphQLScalarType({name:n,description:null===(c=e.description)||void 0===c?void 0:c.value,specifiedByURL:Zn(e),astNode:e,extensionASTNodes:i});case m.INPUT_OBJECT_TYPE_DEFINITION:{var l;const t=[e,...i];return new GraphQLInputObjectType({name:n,description:null===(l=e.description)||void 0===l?void 0:l.value,fields:()=>S(t),astNode:e,extensionASTNodes:i})}}}}const Hn=ee([...vt,...jt],(e=>e.name));function Wn(e){const t=xn(_t,e);return null==t?void 0:t.reason}function Zn(e){const t=xn(Ot,e);return null==t?void 0:t.url}function ei(e,n){null!=e&&e.kind===m.DOCUMENT||t(!1,"Must provide valid Document AST."),!0!==(null==n?void 0:n.assumeValid)&&!0!==(null==n?void 0:n.assumeValidSDL)&&function(e){const t=qn(e);if(0!==t.length)throw new Error(t.map((e=>e.message)).join("\n\n"))}(e);const i=zn({description:void 0,types:[],directives:[],extensions:Object.create(null),extensionASTNodes:[],assumeValid:!1},e,n);if(null==i.astNode)for(const e of i.types)switch(e.name){case"Query":i.query=e;break;case"Mutation":i.mutation=e;break;case"Subscription":i.subscription=e}const r=[...i.directives,...bt.filter((e=>i.directives.every((t=>t.name!==e.name))))];return new GraphQLSchema({...i,directives:r})}function ti(e){return function(e,t,n){const r=e.getDirectives().filter(t),o=Object.values(e.getTypeMap()).filter(n);return[ii(e),...r.map((e=>function(e){return li(e)+"directive @"+e.name+ai(e.args)+(e.isRepeatable?" repeatable":"")+" on "+e.locations.join(" | ")}(e))),...o.map((e=>function(e){if(Ae(e))return function(e){return li(e)+`scalar ${e.name}`+function(e){if(null==e.specifiedByURL)return"";return` @specifiedBy(url: ${ye({kind:m.STRING,value:e.specifiedByURL})})`}(e)}(e);if(De(e))return function(e){return li(e)+`type ${e.name}`+ri(e)+oi(e)}(e);if(we(e))return function(e){return li(e)+`interface ${e.name}`+ri(e)+oi(e)}(e);if(ke(e))return function(e){const t=e.getTypes(),n=t.length?" = "+t.join(" | "):"";return li(e)+"union "+e.name+n}(e);if(xe(e))return function(e){const t=e.getValues().map(((e,t)=>li(e," ",!t)+" "+e.name+ui(e.deprecationReason)));return li(e)+`enum ${e.name}`+si(t)}(e);if(Fe(e))return function(e){const t=Object.values(e.getFields()).map(((e,t)=>li(e," ",!t)+" "+ci(e)));return li(e)+`input ${e.name}`+si(t)}(e);i(!1,"Unexpected type: "+Y(e))}(e)))].filter(Boolean).join("\n\n")}(e,(e=>{return t=e,!bt.some((({name:e})=>e===t.name));var t}),ni)}function ni(e){return!yt(e)&&!Vt(e)}function ii(e){if(null==e.description&&function(e){const t=e.getQueryType();if(t&&"Query"!==t.name)return!1;const n=e.getMutationType();if(n&&"Mutation"!==n.name)return!1;const i=e.getSubscriptionType();if(i&&"Subscription"!==i.name)return!1;return!0}(e))return;const t=[],n=e.getQueryType();n&&t.push(` query: ${n.name}`);const i=e.getMutationType();i&&t.push(` mutation: ${i.name}`);const r=e.getSubscriptionType();return r&&t.push(` subscription: ${r.name}`),li(e)+`schema {\n${t.join("\n")}\n}`}function ri(e){const t=e.getInterfaces();return t.length?" implements "+t.map((e=>e.name)).join(" & "):""}function oi(e){return si(Object.values(e.getFields()).map(((e,t)=>li(e," ",!t)+" "+e.name+ai(e.args," ")+": "+String(e.type)+ui(e.deprecationReason))))}function si(e){return 0!==e.length?" {\n"+e.join("\n")+"\n}":""}function ai(e,t=""){return 0===e.length?"":e.every((e=>!e.description))?"("+e.map(ci).join(", ")+")":"(\n"+e.map(((e,n)=>li(e," "+t,!n)+" "+t+ci(e))).join("\n")+"\n"+t+")"}function ci(e){const t=Lt(e.defaultValue,e.type);let n=e.name+": "+String(e.type);return t&&(n+=` = ${ye(t)}`),n+ui(e.deprecationReason)}function ui(e){if(null==e)return"";if(e!==gt){return` @deprecated(reason: ${ye({kind:m.STRING,value:e})})`}return" @deprecated"}function li(e,t="",n=!0){const{description:i}=e;if(null==i)return"";return(t&&!n?"\n"+t:t)+ye({kind:m.STRING,value:i,block:O(i)}).replace(/\n/g,"\n"+t)+"\n"}function pi(e){const t=[];for(const n of e)t.push(...n.definitions);return{kind:m.DOCUMENT,definitions:t}}const di=[hn];function fi(e){var t;const n=function(e){if(e)return function(t){const n=e;return{Field(e){var i;const r=(null!==(i=e.alias)&&void 0!==i?i:e.name).value,o=r.charAt(0).toLowerCase()+r.slice(1);n.includes(o)&&t.reportError(new GraphQLError(`Field name "${r}" is not allowed because it conflicts with generated object APIs. Please use an alias to change the field name.`,{nodes:e}))}}};return}(null===(t=e.disallowedFieldNames)||void 0===t?void 0:t.allFields),i=function(e){if(e)return function(t){const n=e;return{VariableDefinition(e){const i=e.variable.name.value,r=i.charAt(0).toLowerCase()+i.slice(1);n.includes(r)&&t.reportError(new GraphQLError(`Input Parameter name "${i}" is not allowed because it conflicts with generated object APIs.`,{nodes:e}))}}};return}(e.disallowedInputParameterNames);return[hi,mi,...n?[n]:[],...i?[i]:[],...Bn.filter((e=>!di.includes(e)))]}function hi(e){return{OperationDefinition:t=>(t.name||e.reportError(new GraphQLError("Apollo does not support anonymous operations because operation names are used during code generation. Please give this operation a name.",t)),!1)}}function mi(e){return{Field(t){"__typename"==(t.alias&&t.alias.value)&&e.reportError(new GraphQLError("Apollo needs to be able to insert __typename when needed, so using it as an alias is not supported.",t))}}}const vi={kind:m.DIRECTIVE_DEFINITION,description:(yi="A directive used by the Apollo iOS client to annotate operations or fragments that should be used exclusively for generating local cache mutations instead of as standard operations.",{kind:m.STRING,value:yi}),name:Ei("apollo_client_ios_localCacheMutation"),repeatable:!1,locations:[Ei("QUERY"),Ei("MUTATION"),Ei("SUBSCRIPTION"),Ei("FRAGMENT_DEFINITION")]};var yi;function Ei(e){return{kind:m.NAME,value:e}}const Ti={kind:m.DOCUMENT,definitions:[vi]};const Ni={kind:m.FIELD,name:{kind:m.NAME,value:"__typename"}};class GraphQLSchemaValidationError extends Error{constructor(e){super(e.map((e=>e.message)).join("\n\n")),this.validationErrors=e,this.name="GraphQLSchemaValidationError"}}function Ii(e){return e.startsWith("__")}const gi={kind:m.FIELD,name:{kind:m.NAME,value:"__typename"}};function _i(e,t){return t&&(e=function(e){return he(e,{enter:e=>e.kind!==m.SELECTION_SET?void 0:{...e,selections:e.selections.filter((e=>!("Field"===e.kind&&"__typename"===e.name.value)))},leave(e){if((e.kind===m.FIELD||e.kind===m.FRAGMENT_DEFINITION||e.kind===m.INLINE_FRAGMENT)&&e.selectionSet)return{...e,selectionSet:{...e.selectionSet,selections:[Ni,...e.selectionSet.selections]}}}})}(e)),he(e,{SelectionSet:{leave:(e,t,n)=>d(n)&&![m.FIELD,m.FRAGMENT_DEFINITION].includes(n.kind)?e:function(e){const t=e.selections.find((e=>e.kind==gi.kind&&e.name.value==gi.name.value));return t?e:{...e,selections:[gi,...e.selections]}}(e)},Field:{enter:e=>function(e){return e.name.value==gi.name.value?{...e,alias:void 0,directives:void 0}:e}(e)},Directive:{enter:e=>function(e){return e.name.value==vi.name.value?null:e}(e)}})}function Oi(e){return null!=e}function bi(e){switch(e.kind){case m.VARIABLE:return{kind:e.kind,value:e.name.value};case m.LIST:return{kind:e.kind,value:e.values.map(bi)};case m.OBJECT:return{kind:e.kind,value:e.fields.reduce(((e,t)=>(e[t.name.value]=bi(t.value),e)),{})};default:return e}}function Li(e){var t,n;return null===(n=null===(t=e.loc)||void 0===t?void 0:t.source)||void 0===n?void 0:n.name}function Si(e,t,n,i){var r;const o=new Map;for(const e of t.definitions)e.kind===m.FRAGMENT_DEFINITION&&o.set(e.name.value,e);const s=[],a=new Map,c=new Set,u={queryType:e.getQueryType(),mutationType:e.getMutationType(),subscriptionType:e.getSubscriptionType()};for(const e of t.definitions)e.kind===m.OPERATION_DEFINITION&&s.push(p(e));for(const[e,t]of o.entries())a.set(e,d(t));return{rootTypes:u,operations:s,fragments:Array.from(a.values()),referencedTypes:Array.from(c.values()),schemaDocumentation:null!==(r=e.description)&&void 0!==r?r:void 0};function l(t){if(!c.has(t)){if(c.add(t),we(t))for(const n of e.getPossibleTypes(t))l(Je(n));if(ke(t)){const e=t.getTypes();for(t of e)l(Je(t))}if(Fe(t)&&function(e){const t=e.getFields();for(const e in t){l(Je(t[e].type))}}(t),De(t))for(const e of t.getInterfaces())l(Je(e))}}function p(t){var i;if(!t.name)throw new GraphQLError("Operations should be named",{nodes:t});const r=Li(t),o=t.name.value,s=t.operation,a=(t.variableDefinitions||[]).map((t=>{const n=t.variable.name.value,i=t.defaultValue?bi(t.defaultValue):void 0,r=rn(e,t.type);if(!r)throw new GraphQLError(`Couldn't get type from type node "${t.type}"`,{nodes:t});return l(Je(r)),{name:n,type:r,defaultValue:i}})),c=ye(_i(t,n)),u=e.getRootType(s),[p]=null!==(i=v(t.directives))&&void 0!==i?i:[void 0,void 0];return l(u),{name:o,operationType:s,variables:a,rootType:u,selectionSet:f(t.selectionSet,u),directives:p,source:c,filePath:r}}function d(t){var i;const r=t.name.value,o=Li(t),s=ye(_i(t,n)),a=rn(e,t.typeCondition),[c]=null!==(i=v(t.directives))&&void 0!==i?i:[void 0,void 0];return l(Je(a)),{name:r,filePath:o,source:s,typeCondition:a,selectionSet:f(t.selectionSet,a),directives:c}}function f(t,n){return{parentType:n,selections:t.selections.map((t=>function(t,n){var r,s,c,u;const[p,y]=null!==(r=v(t.directives))&&void 0!==r?r:[void 0,void 0];switch(t.kind){case m.FIELD:{const E=t.name.value;if("__typename"==E)return;const T=null===(s=t.alias)||void 0===s?void 0:s.value,N=function(e,t,n){return n===$t.name&&e.getQueryType()===t?$t:n===Qt.name&&e.getQueryType()===t?Qt:n===Ut.name&&(De(t)||we(t)||ke(t))?Ut:De(t)||we(t)?t.getFields()[n]:void 0}(e,n,E);if(!N)throw new GraphQLError(`Cannot query field "${E}" on type "${String(n)}"`,{nodes:t});const I=mn(N.type,t.required),g=Je(I);l(Je(g));const{description:_,deprecationReason:O}=N;let b={kind:"Field",name:E,alias:T,type:I,arguments:h(N,t.arguments),inclusionConditions:y,description:!Ii(E)&&_?_:void 0,deprecationReason:O||void 0,directives:p};function L(e,t,n){var i;if(t&&n){const r=(null!==(i=e.alias)&&void 0!==i?i:e.name).value,o=r.charAt(0).toLowerCase()+r.slice(1);if(null==t?void 0:t.includes(o))throw new GraphQLError(`Schema name "${n}" conflicts with name of a generated object API. Please choose a different schema name. Suggestions: "${n}Schema", "${n}GraphQL", "${n}API"`,{nodes:e})}}if(Re(I)||Ge(I)&&Re(I.ofType)?L(t,null===(c=i.disallowedFieldNames)||void 0===c?void 0:c.entityList,i.schemaNamespace):je(g)&&L(t,null===(u=i.disallowedFieldNames)||void 0===u?void 0:u.entity,i.schemaNamespace),je(g)){const S=t.selectionSet;if(!S)throw new GraphQLError(`Composite field "${E}" on type "${String(n)}" requires selection set`,{nodes:t});b.selectionSet=f(S,g)}return b}case m.INLINE_FRAGMENT:{const A=t.typeCondition,D=A?rn(e,A):n;return l(D),{kind:"InlineFragment",selectionSet:f(t.selectionSet,D),inclusionConditions:y,directives:p}}case m.FRAGMENT_SPREAD:{const w=t.name.value,k=function(e){let t=a.get(e);if(t)return t;const n=o.get(e);return n?(o.delete(e),t=d(n),a.set(e,t),t):void 0}(w);if(!k)throw new GraphQLError(`Unknown fragment "${w}".`,{nodes:t.name});return{kind:"FragmentSpread",fragment:k,inclusionConditions:y,directives:p}}}}(t,n))).filter(Oi)}}function h(...e){const t=e[0].args;return e[1]&&e[1].length>0?e[1].map((e=>{var n;const i=e.name.value,r=t.find((t=>t.name===e.name.value)),o=null==r?void 0:r.type;if(!o)throw new GraphQLError(`Cannot find directive argument type for argument "${i}".`,{nodes:[e]});return{name:i,value:bi(e.value),type:o,deprecationReason:null!==(n=r.deprecationReason)&&void 0!==n?n:void 0}})):void 0}function v(t){if(t&&t.length>0){const n=[],i=[];for(const r of t){const t=r.name.value,o=e.getDirective(t);if(!o)throw new GraphQLError(`Cannot find directive "${t}".`,{nodes:r});n.push({name:t,arguments:h(o,r.arguments)});const s=y(r,o);s&&i.push(s)}return[n,i.length>0?i:void 0]}}function y(e,t){var n;if("include"==t.name||"skip"==t.name){const i=null===(n=e.arguments)||void 0===n?void 0:n[0].value,r="skip"==t.name;switch(null==i?void 0:i.kind){case m.BOOLEAN:return r?i.value?"SKIPPED":"INCLUDED":i.value?"INCLUDED":"SKIPPED";case m.VARIABLE:return{variable:i.name.value,isInverted:r};default:throw new GraphQLError('Conditional inclusion directive has invalid "if" argument.',{nodes:e})}}}}return e.GraphQLEnumType=GraphQLEnumType,e.GraphQLError=GraphQLError,e.GraphQLInputObjectType=GraphQLInputObjectType,e.GraphQLInterfaceType=GraphQLInterfaceType,e.GraphQLObjectType=GraphQLObjectType,e.GraphQLScalarType=GraphQLScalarType,e.GraphQLSchema=GraphQLSchema,e.GraphQLSchemaValidationError=GraphQLSchemaValidationError,e.GraphQLUnionType=GraphQLUnionType,e.Source=Source,e.compileDocument=function(e,t,n,i){return Si(e,t,n,i)},e.loadSchemaFromSources=function(e){var t,n=new Array;for(const i of e)if(i.name.endsWith(".json")){if(t)throw new Error(`Schema search paths can only include one JSON schema definition.\n Found "${t.name} & "${i.name}".`);t=i}else n.push(K(i));var i=function(e){return e.definitions.some((e=>e.kind==m.DIRECTIVE_DEFINITION&&e.name.value==vi.name.value))?e:pi([e,Ti])}(pi(n));t||function(e){const t=qn(e);if(0!==t.length)throw new GraphQLSchemaValidationError(t)}(i);const r=t?Xn(function(e){let t=JSON.parse(e);t.data&&(t=t.data);const n=Kn(t);return n}(t.body),i,{assumeValid:!0,assumeValidSDL:!0}):ei(i,{assumeValid:!0,assumeValidSDL:!0});return function(e){const t=Bt(e);if(0!==t.length)throw new GraphQLSchemaValidationError(t)}(r),r},e.mergeDocuments=function(e){return pi(e)},e.parseOperationDocument=function(e,t){return K(e,{experimentalClientControlledNullability:t})},e.printSchemaToSDL=function(e){return ti(e)},e.validateDocument=function(e,t,n){return Jn(e,t,fi(n))},Object.defineProperty(e,"__esModule",{value:!0}),e}({});"# \ No newline at end of file +let ApolloCodegenFrontendBundle: String = #"var ApolloCodegenFrontend=function(e){"use strict";function t(e,t){if(!Boolean(e))throw new Error(t)}function n(e){return"object"==typeof e&&null!==e}function i(e,t){if(!Boolean(e))throw new Error(null!=t?t:"Unexpected invariant triggered.")}const r=/\r\n|[\n\r]/g;function o(e,t){let n=0,o=1;for(const s of e.body.matchAll(r)){if("number"==typeof s.index||i(!1),s.index>=t)break;n=s.index+s[0].length,o+=1}return{line:o,column:t+1-n}}function s(e,t){const n=e.locationOffset.column-1,i="".padStart(n)+e.body,r=t.line-1,o=e.locationOffset.line-1,s=t.line+o,c=1===t.line?n:0,u=t.column+c,l=`${e.name}:${s}:${u}\n`,p=i.split(/\r\n|[\n\r]/g),d=p[r];if(d.length>120){const e=Math.floor(u/80),t=u%80,n=[];for(let e=0;e["|",e])),["|","^".padStart(t)],["|",n[e+1]]])}return l+a([[s-1+" |",p[r-1]],[`${s} |`,d],["|","^".padStart(u)],[`${s+1} |`,p[r+1]]])}function a(e){const t=e.filter((([e,t])=>void 0!==t)),n=Math.max(...t.map((([e])=>e.length)));return t.map((([e,t])=>e.padStart(n)+(t?" "+t:""))).join("\n")}class GraphQLError extends Error{constructor(e,...t){var i,r,s;const{nodes:a,source:u,positions:l,path:p,originalError:d,extensions:f}=function(e){const t=e[0];return null==t||"kind"in t||"length"in t?{nodes:t,source:e[1],positions:e[2],path:e[3],originalError:e[4],extensions:e[5]}:t}(t);super(e),this.name="GraphQLError",this.path=null!=p?p:void 0,this.originalError=null!=d?d:void 0,this.nodes=c(Array.isArray(a)?a:a?[a]:void 0);const h=c(null===(i=this.nodes)||void 0===i?void 0:i.map((e=>e.loc)).filter((e=>null!=e)));this.source=null!=u?u:null==h||null===(r=h[0])||void 0===r?void 0:r.source,this.positions=null!=l?l:null==h?void 0:h.map((e=>e.start)),this.locations=l&&u?l.map((e=>o(u,e))):null==h?void 0:h.map((e=>o(e.source,e.start)));const m=n(null==d?void 0:d.extensions)?null==d?void 0:d.extensions:void 0;this.extensions=null!==(s=null!=f?f:m)&&void 0!==s?s:Object.create(null),Object.defineProperties(this,{message:{writable:!0,enumerable:!0},name:{enumerable:!1},nodes:{enumerable:!1},source:{enumerable:!1},positions:{enumerable:!1},originalError:{enumerable:!1}}),null!=d&&d.stack?Object.defineProperty(this,"stack",{value:d.stack,writable:!0,configurable:!0}):Error.captureStackTrace?Error.captureStackTrace(this,GraphQLError):Object.defineProperty(this,"stack",{value:Error().stack,writable:!0,configurable:!0})}get[Symbol.toStringTag](){return"GraphQLError"}toString(){let e=this.message;if(this.nodes)for(const n of this.nodes)n.loc&&(e+="\n\n"+s((t=n.loc).source,o(t.source,t.start)));else if(this.source&&this.locations)for(const t of this.locations)e+="\n\n"+s(this.source,t);var t;return e}toJSON(){const e={message:this.message};return null!=this.locations&&(e.locations=this.locations),null!=this.path&&(e.path=this.path),null!=this.extensions&&Object.keys(this.extensions).length>0&&(e.extensions=this.extensions),e}}function c(e){return void 0===e||0===e.length?void 0:e}function u(e,t,n){return new GraphQLError(`Syntax Error: ${n}`,void 0,e,[t])}class Location{constructor(e,t,n){this.start=e.start,this.end=t.end,this.startToken=e,this.endToken=t,this.source=n}get[Symbol.toStringTag](){return"Location"}toJSON(){return{start:this.start,end:this.end}}}class Token{constructor(e,t,n,i,r,o){this.kind=e,this.start=t,this.end=n,this.line=i,this.column=r,this.value=o,this.prev=null,this.next=null}get[Symbol.toStringTag](){return"Token"}toJSON(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}}}const l={Name:[],Document:["definitions"],OperationDefinition:["name","variableDefinitions","directives","selectionSet"],VariableDefinition:["variable","type","defaultValue","directives"],Variable:["name"],SelectionSet:["selections"],Field:["alias","name","arguments","directives","selectionSet","required"],ListNullability:["element"],RequiredDesignator:["element"],OptionalDesignator:["element"],Argument:["name","value"],FragmentSpread:["name","directives"],InlineFragment:["typeCondition","directives","selectionSet"],FragmentDefinition:["name","variableDefinitions","typeCondition","directives","selectionSet"],IntValue:[],FloatValue:[],StringValue:[],BooleanValue:[],NullValue:[],EnumValue:[],ListValue:["values"],ObjectValue:["fields"],ObjectField:["name","value"],Directive:["name","arguments"],NamedType:["name"],ListType:["type"],NonNullType:["type"],SchemaDefinition:["description","directives","operationTypes"],OperationTypeDefinition:["type"],ScalarTypeDefinition:["description","name","directives"],ObjectTypeDefinition:["description","name","interfaces","directives","fields"],FieldDefinition:["description","name","arguments","type","directives"],InputValueDefinition:["description","name","type","defaultValue","directives"],InterfaceTypeDefinition:["description","name","interfaces","directives","fields"],UnionTypeDefinition:["description","name","directives","types"],EnumTypeDefinition:["description","name","directives","values"],EnumValueDefinition:["description","name","directives"],InputObjectTypeDefinition:["description","name","directives","fields"],DirectiveDefinition:["description","name","arguments","locations"],SchemaExtension:["directives","operationTypes"],ScalarTypeExtension:["name","directives"],ObjectTypeExtension:["name","interfaces","directives","fields"],InterfaceTypeExtension:["name","interfaces","directives","fields"],UnionTypeExtension:["name","directives","types"],EnumTypeExtension:["name","directives","values"],InputObjectTypeExtension:["name","directives","fields"]},p=new Set(Object.keys(l));function d(e){const t=null==e?void 0:e.kind;return"string"==typeof t&&p.has(t)}let f,h,m,v;function y(e){return 9===e||32===e}function E(e){return e>=48&&e<=57}function T(e){return e>=97&&e<=122||e>=65&&e<=90}function N(e){return T(e)||95===e}function I(e){return T(e)||E(e)||95===e}function g(e){var t;let n=Number.MAX_SAFE_INTEGER,i=null,r=-1;for(let t=0;t0===t?e:e.slice(n))).slice(null!==(t=i)&&void 0!==t?t:0,r+1)}function _(e){let t=0;for(;t",e.EOF="",e.BANG="!",e.QUESTION_MARK="?",e.DOLLAR="$",e.AMP="&",e.PAREN_L="(",e.PAREN_R=")",e.SPREAD="...",e.COLON=":",e.EQUALS="=",e.AT="@",e.BRACKET_L="[",e.BRACKET_R="]",e.BRACE_L="{",e.PIPE="|",e.BRACE_R="}",e.NAME="Name",e.INT="Int",e.FLOAT="Float",e.STRING="String",e.BLOCK_STRING="BlockString",e.COMMENT="Comment"}(v||(v={}));class Lexer{constructor(e){const t=new Token(v.SOF,0,0,0,0);this.source=e,this.lastToken=t,this.token=t,this.line=1,this.lineStart=0}get[Symbol.toStringTag](){return"Lexer"}advance(){this.lastToken=this.token;return this.token=this.lookahead()}lookahead(){let e=this.token;if(e.kind!==v.EOF)do{if(e.next)e=e.next;else{const t=k(this,e.end);e.next=t,t.prev=e,e=t}}while(e.kind===v.COMMENT);return e}}function b(e){return e>=0&&e<=55295||e>=57344&&e<=1114111}function L(e,t){return S(e.charCodeAt(t))&&A(e.charCodeAt(t+1))}function S(e){return e>=55296&&e<=56319}function A(e){return e>=56320&&e<=57343}function D(e,t){const n=e.source.body.codePointAt(t);if(void 0===n)return v.EOF;if(n>=32&&n<=126){const e=String.fromCodePoint(n);return'"'===e?"'\"'":`"${e}"`}return"U+"+n.toString(16).toUpperCase().padStart(4,"0")}function w(e,t,n,i,r){const o=e.line,s=1+n-e.lineStart;return new Token(t,n,i,o,s,r)}function k(e,t){const n=e.source.body,i=n.length;let r=t;for(;r=48&&e<=57?e-48:e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:-1}function j(e,t){const n=e.source.body;switch(n.charCodeAt(t+1)){case 34:return{value:'"',size:2};case 92:return{value:"\\",size:2};case 47:return{value:"/",size:2};case 98:return{value:"\b",size:2};case 102:return{value:"\f",size:2};case 110:return{value:"\n",size:2};case 114:return{value:"\r",size:2};case 116:return{value:"\t",size:2}}throw u(e.source,t,`Invalid character escape sequence: "${n.slice(t,t+2)}".`)}function V(e,t){const n=e.source.body,i=n.length;let r=e.lineStart,o=t+3,s=o,a="";const c=[];for(;oB)return"[Array]";const n=Math.min(P,e.length),i=e.length-n,r=[];for(let i=0;i1&&r.push(`... ${i} more items`);return"["+r.join(", ")+"]"}(e,n);return function(e,t){const n=Object.entries(e);if(0===n.length)return"{}";if(t.length>B)return"["+function(e){const t=Object.prototype.toString.call(e).replace(/^\[object /,"").replace(/]$/,"");if("Object"===t&&"function"==typeof e.constructor){const t=e.constructor.name;if("string"==typeof t&&""!==t)return t}return t}(e)+"]";const i=n.map((([e,n])=>e+": "+J(n,t)));return"{ "+i.join(", ")+" }"}(e,n)}(e,t);default:return String(e)}}const q=function(e,t){return e instanceof t};class Source{constructor(e,n="GraphQL request",i={line:1,column:1}){"string"==typeof e||t(!1,`Body must be a string. Received: ${Y(e)}.`),this.body=e,this.name=n,this.locationOffset=i,this.locationOffset.line>0||t(!1,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||t(!1,"column in locationOffset is 1-indexed and must be positive.")}get[Symbol.toStringTag](){return"Source"}}function K(e,t){return new Parser(e,t).parseDocument()}class Parser{constructor(e,t){const n=function(e){return q(e,Source)}(e)?e:new Source(e);this._lexer=new Lexer(n),this._options=t}parseName(){const e=this.expectToken(v.NAME);return this.node(e,{kind:m.NAME,value:e.value})}parseDocument(){return this.node(this._lexer.token,{kind:m.DOCUMENT,definitions:this.many(v.SOF,this.parseDefinition,v.EOF)})}parseDefinition(){if(this.peek(v.BRACE_L))return this.parseOperationDefinition();const e=this.peekDescription(),t=e?this._lexer.lookahead():this._lexer.token;if(t.kind===v.NAME){switch(t.value){case"schema":return this.parseSchemaDefinition();case"scalar":return this.parseScalarTypeDefinition();case"type":return this.parseObjectTypeDefinition();case"interface":return this.parseInterfaceTypeDefinition();case"union":return this.parseUnionTypeDefinition();case"enum":return this.parseEnumTypeDefinition();case"input":return this.parseInputObjectTypeDefinition();case"directive":return this.parseDirectiveDefinition()}if(e)throw u(this._lexer.source,this._lexer.token.start,"Unexpected description, descriptions are supported only on type definitions.");switch(t.value){case"query":case"mutation":case"subscription":return this.parseOperationDefinition();case"fragment":return this.parseFragmentDefinition();case"extend":return this.parseTypeSystemExtension()}}throw this.unexpected(t)}parseOperationDefinition(){const e=this._lexer.token;if(this.peek(v.BRACE_L))return this.node(e,{kind:m.OPERATION_DEFINITION,operation:f.QUERY,name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet()});const t=this.parseOperationType();let n;return this.peek(v.NAME)&&(n=this.parseName()),this.node(e,{kind:m.OPERATION_DEFINITION,operation:t,name:n,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseOperationType(){const e=this.expectToken(v.NAME);switch(e.value){case"query":return f.QUERY;case"mutation":return f.MUTATION;case"subscription":return f.SUBSCRIPTION}throw this.unexpected(e)}parseVariableDefinitions(){return this.optionalMany(v.PAREN_L,this.parseVariableDefinition,v.PAREN_R)}parseVariableDefinition(){return this.node(this._lexer.token,{kind:m.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(v.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(v.EQUALS)?this.parseConstValueLiteral():void 0,directives:this.parseConstDirectives()})}parseVariable(){const e=this._lexer.token;return this.expectToken(v.DOLLAR),this.node(e,{kind:m.VARIABLE,name:this.parseName()})}parseSelectionSet(){return this.node(this._lexer.token,{kind:m.SELECTION_SET,selections:this.many(v.BRACE_L,this.parseSelection,v.BRACE_R)})}parseSelection(){return this.peek(v.SPREAD)?this.parseFragment():this.parseField()}parseField(){var e;const t=this._lexer.token,n=this.parseName();let i,r;this.expectOptionalToken(v.COLON)?(i=n,r=this.parseName()):r=n;const o=this.parseArguments(!1),s=null!==(e=this._options)&&void 0!==e&&e.experimentalClientControlledNullability?this.parseRequiredStatus():void 0,a=this.parseDirectives(!1),c=this.peek(v.BRACE_L)?this.parseSelectionSet():void 0;return this.node(t,{kind:m.FIELD,alias:i,name:r,arguments:o,required:s,directives:a,selectionSet:c})}parseRequiredStatus(){const e=this.parseListNullability(),t=this.parseNullabilityDesignatorNode(e);return null!=t?t:e}parseListNullability(){const e=this._lexer.token;if(this.expectOptionalToken(v.BRACKET_L)){const t=this.parseRequiredStatus();return this.expectToken(v.BRACKET_R),this.node(e,{kind:m.LIST_NULLABILITY,element:t})}}parseNullabilityDesignatorNode(e){var t;return null!==(t=this.parseRequiredDesignatorNode(e))&&void 0!==t?t:this.parseOptionalDesignatorNode(e)}parseRequiredDesignatorNode(e){const t=this._lexer.token;if(this.expectOptionalToken(v.BANG))return this.node(t,{kind:m.REQUIRED_DESIGNATOR,element:e})}parseOptionalDesignatorNode(e){const t=this._lexer.token;if(this.expectOptionalToken(v.QUESTION_MARK))return this.node(t,{kind:m.OPTIONAL_DESIGNATOR,element:e})}parseArguments(e){const t=e?this.parseConstArgument:this.parseArgument;return this.optionalMany(v.PAREN_L,t,v.PAREN_R)}parseArgument(e=!1){const t=this._lexer.token,n=this.parseName();return this.expectToken(v.COLON),this.node(t,{kind:m.ARGUMENT,name:n,value:this.parseValueLiteral(e)})}parseConstArgument(){return this.parseArgument(!0)}parseFragment(){const e=this._lexer.token;this.expectToken(v.SPREAD);const t=this.expectOptionalKeyword("on");return!t&&this.peek(v.NAME)?this.node(e,{kind:m.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1)}):this.node(e,{kind:m.INLINE_FRAGMENT,typeCondition:t?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentDefinition(){var e;const t=this._lexer.token;return this.expectKeyword("fragment"),!0===(null===(e=this._options)||void 0===e?void 0:e.allowLegacyFragmentVariables)?this.node(t,{kind:m.FRAGMENT_DEFINITION,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()}):this.node(t,{kind:m.FRAGMENT_DEFINITION,name:this.parseFragmentName(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentName(){if("on"===this._lexer.token.value)throw this.unexpected();return this.parseName()}parseValueLiteral(e){const t=this._lexer.token;switch(t.kind){case v.BRACKET_L:return this.parseList(e);case v.BRACE_L:return this.parseObject(e);case v.INT:return this._lexer.advance(),this.node(t,{kind:m.INT,value:t.value});case v.FLOAT:return this._lexer.advance(),this.node(t,{kind:m.FLOAT,value:t.value});case v.STRING:case v.BLOCK_STRING:return this.parseStringLiteral();case v.NAME:switch(this._lexer.advance(),t.value){case"true":return this.node(t,{kind:m.BOOLEAN,value:!0});case"false":return this.node(t,{kind:m.BOOLEAN,value:!1});case"null":return this.node(t,{kind:m.NULL});default:return this.node(t,{kind:m.ENUM,value:t.value})}case v.DOLLAR:if(e){if(this.expectToken(v.DOLLAR),this._lexer.token.kind===v.NAME){const e=this._lexer.token.value;throw u(this._lexer.source,t.start,`Unexpected variable "$${e}" in constant value.`)}throw this.unexpected(t)}return this.parseVariable();default:throw this.unexpected()}}parseConstValueLiteral(){return this.parseValueLiteral(!0)}parseStringLiteral(){const e=this._lexer.token;return this._lexer.advance(),this.node(e,{kind:m.STRING,value:e.value,block:e.kind===v.BLOCK_STRING})}parseList(e){return this.node(this._lexer.token,{kind:m.LIST,values:this.any(v.BRACKET_L,(()=>this.parseValueLiteral(e)),v.BRACKET_R)})}parseObject(e){return this.node(this._lexer.token,{kind:m.OBJECT,fields:this.any(v.BRACE_L,(()=>this.parseObjectField(e)),v.BRACE_R)})}parseObjectField(e){const t=this._lexer.token,n=this.parseName();return this.expectToken(v.COLON),this.node(t,{kind:m.OBJECT_FIELD,name:n,value:this.parseValueLiteral(e)})}parseDirectives(e){const t=[];for(;this.peek(v.AT);)t.push(this.parseDirective(e));return t}parseConstDirectives(){return this.parseDirectives(!0)}parseDirective(e){const t=this._lexer.token;return this.expectToken(v.AT),this.node(t,{kind:m.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(e)})}parseTypeReference(){const e=this._lexer.token;let t;if(this.expectOptionalToken(v.BRACKET_L)){const n=this.parseTypeReference();this.expectToken(v.BRACKET_R),t=this.node(e,{kind:m.LIST_TYPE,type:n})}else t=this.parseNamedType();return this.expectOptionalToken(v.BANG)?this.node(e,{kind:m.NON_NULL_TYPE,type:t}):t}parseNamedType(){return this.node(this._lexer.token,{kind:m.NAMED_TYPE,name:this.parseName()})}peekDescription(){return this.peek(v.STRING)||this.peek(v.BLOCK_STRING)}parseDescription(){if(this.peekDescription())return this.parseStringLiteral()}parseSchemaDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("schema");const n=this.parseConstDirectives(),i=this.many(v.BRACE_L,this.parseOperationTypeDefinition,v.BRACE_R);return this.node(e,{kind:m.SCHEMA_DEFINITION,description:t,directives:n,operationTypes:i})}parseOperationTypeDefinition(){const e=this._lexer.token,t=this.parseOperationType();this.expectToken(v.COLON);const n=this.parseNamedType();return this.node(e,{kind:m.OPERATION_TYPE_DEFINITION,operation:t,type:n})}parseScalarTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("scalar");const n=this.parseName(),i=this.parseConstDirectives();return this.node(e,{kind:m.SCALAR_TYPE_DEFINITION,description:t,name:n,directives:i})}parseObjectTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("type");const n=this.parseName(),i=this.parseImplementsInterfaces(),r=this.parseConstDirectives(),o=this.parseFieldsDefinition();return this.node(e,{kind:m.OBJECT_TYPE_DEFINITION,description:t,name:n,interfaces:i,directives:r,fields:o})}parseImplementsInterfaces(){return this.expectOptionalKeyword("implements")?this.delimitedMany(v.AMP,this.parseNamedType):[]}parseFieldsDefinition(){return this.optionalMany(v.BRACE_L,this.parseFieldDefinition,v.BRACE_R)}parseFieldDefinition(){const e=this._lexer.token,t=this.parseDescription(),n=this.parseName(),i=this.parseArgumentDefs();this.expectToken(v.COLON);const r=this.parseTypeReference(),o=this.parseConstDirectives();return this.node(e,{kind:m.FIELD_DEFINITION,description:t,name:n,arguments:i,type:r,directives:o})}parseArgumentDefs(){return this.optionalMany(v.PAREN_L,this.parseInputValueDef,v.PAREN_R)}parseInputValueDef(){const e=this._lexer.token,t=this.parseDescription(),n=this.parseName();this.expectToken(v.COLON);const i=this.parseTypeReference();let r;this.expectOptionalToken(v.EQUALS)&&(r=this.parseConstValueLiteral());const o=this.parseConstDirectives();return this.node(e,{kind:m.INPUT_VALUE_DEFINITION,description:t,name:n,type:i,defaultValue:r,directives:o})}parseInterfaceTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("interface");const n=this.parseName(),i=this.parseImplementsInterfaces(),r=this.parseConstDirectives(),o=this.parseFieldsDefinition();return this.node(e,{kind:m.INTERFACE_TYPE_DEFINITION,description:t,name:n,interfaces:i,directives:r,fields:o})}parseUnionTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("union");const n=this.parseName(),i=this.parseConstDirectives(),r=this.parseUnionMemberTypes();return this.node(e,{kind:m.UNION_TYPE_DEFINITION,description:t,name:n,directives:i,types:r})}parseUnionMemberTypes(){return this.expectOptionalToken(v.EQUALS)?this.delimitedMany(v.PIPE,this.parseNamedType):[]}parseEnumTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("enum");const n=this.parseName(),i=this.parseConstDirectives(),r=this.parseEnumValuesDefinition();return this.node(e,{kind:m.ENUM_TYPE_DEFINITION,description:t,name:n,directives:i,values:r})}parseEnumValuesDefinition(){return this.optionalMany(v.BRACE_L,this.parseEnumValueDefinition,v.BRACE_R)}parseEnumValueDefinition(){const e=this._lexer.token,t=this.parseDescription(),n=this.parseEnumValueName(),i=this.parseConstDirectives();return this.node(e,{kind:m.ENUM_VALUE_DEFINITION,description:t,name:n,directives:i})}parseEnumValueName(){if("true"===this._lexer.token.value||"false"===this._lexer.token.value||"null"===this._lexer.token.value)throw u(this._lexer.source,this._lexer.token.start,`${X(this._lexer.token)} is reserved and cannot be used for an enum value.`);return this.parseName()}parseInputObjectTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("input");const n=this.parseName(),i=this.parseConstDirectives(),r=this.parseInputFieldsDefinition();return this.node(e,{kind:m.INPUT_OBJECT_TYPE_DEFINITION,description:t,name:n,directives:i,fields:r})}parseInputFieldsDefinition(){return this.optionalMany(v.BRACE_L,this.parseInputValueDef,v.BRACE_R)}parseTypeSystemExtension(){const e=this._lexer.lookahead();if(e.kind===v.NAME)switch(e.value){case"schema":return this.parseSchemaExtension();case"scalar":return this.parseScalarTypeExtension();case"type":return this.parseObjectTypeExtension();case"interface":return this.parseInterfaceTypeExtension();case"union":return this.parseUnionTypeExtension();case"enum":return this.parseEnumTypeExtension();case"input":return this.parseInputObjectTypeExtension()}throw this.unexpected(e)}parseSchemaExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");const t=this.parseConstDirectives(),n=this.optionalMany(v.BRACE_L,this.parseOperationTypeDefinition,v.BRACE_R);if(0===t.length&&0===n.length)throw this.unexpected();return this.node(e,{kind:m.SCHEMA_EXTENSION,directives:t,operationTypes:n})}parseScalarTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("scalar");const t=this.parseName(),n=this.parseConstDirectives();if(0===n.length)throw this.unexpected();return this.node(e,{kind:m.SCALAR_TYPE_EXTENSION,name:t,directives:n})}parseObjectTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");const t=this.parseName(),n=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),r=this.parseFieldsDefinition();if(0===n.length&&0===i.length&&0===r.length)throw this.unexpected();return this.node(e,{kind:m.OBJECT_TYPE_EXTENSION,name:t,interfaces:n,directives:i,fields:r})}parseInterfaceTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");const t=this.parseName(),n=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),r=this.parseFieldsDefinition();if(0===n.length&&0===i.length&&0===r.length)throw this.unexpected();return this.node(e,{kind:m.INTERFACE_TYPE_EXTENSION,name:t,interfaces:n,directives:i,fields:r})}parseUnionTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");const t=this.parseName(),n=this.parseConstDirectives(),i=this.parseUnionMemberTypes();if(0===n.length&&0===i.length)throw this.unexpected();return this.node(e,{kind:m.UNION_TYPE_EXTENSION,name:t,directives:n,types:i})}parseEnumTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");const t=this.parseName(),n=this.parseConstDirectives(),i=this.parseEnumValuesDefinition();if(0===n.length&&0===i.length)throw this.unexpected();return this.node(e,{kind:m.ENUM_TYPE_EXTENSION,name:t,directives:n,values:i})}parseInputObjectTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");const t=this.parseName(),n=this.parseConstDirectives(),i=this.parseInputFieldsDefinition();if(0===n.length&&0===i.length)throw this.unexpected();return this.node(e,{kind:m.INPUT_OBJECT_TYPE_EXTENSION,name:t,directives:n,fields:i})}parseDirectiveDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("directive"),this.expectToken(v.AT);const n=this.parseName(),i=this.parseArgumentDefs(),r=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");const o=this.parseDirectiveLocations();return this.node(e,{kind:m.DIRECTIVE_DEFINITION,description:t,name:n,arguments:i,repeatable:r,locations:o})}parseDirectiveLocations(){return this.delimitedMany(v.PIPE,this.parseDirectiveLocation)}parseDirectiveLocation(){const e=this._lexer.token,t=this.parseName();if(Object.prototype.hasOwnProperty.call(h,t.value))return t;throw this.unexpected(e)}node(e,t){var n;return!0!==(null===(n=this._options)||void 0===n?void 0:n.noLocation)&&(t.loc=new Location(e,this._lexer.lastToken,this._lexer.source)),t}peek(e){return this._lexer.token.kind===e}expectToken(e){const t=this._lexer.token;if(t.kind===e)return this._lexer.advance(),t;throw u(this._lexer.source,t.start,`Expected ${z(e)}, found ${X(t)}.`)}expectOptionalToken(e){return this._lexer.token.kind===e&&(this._lexer.advance(),!0)}expectKeyword(e){const t=this._lexer.token;if(t.kind!==v.NAME||t.value!==e)throw u(this._lexer.source,t.start,`Expected "${e}", found ${X(t)}.`);this._lexer.advance()}expectOptionalKeyword(e){const t=this._lexer.token;return t.kind===v.NAME&&t.value===e&&(this._lexer.advance(),!0)}unexpected(e){const t=null!=e?e:this._lexer.token;return u(this._lexer.source,t.start,`Unexpected ${X(t)}.`)}any(e,t,n){this.expectToken(e);const i=[];for(;!this.expectOptionalToken(n);)i.push(t.call(this));return i}optionalMany(e,t,n){if(this.expectOptionalToken(e)){const e=[];do{e.push(t.call(this))}while(!this.expectOptionalToken(n));return e}return[]}many(e,t,n){this.expectToken(e);const i=[];do{i.push(t.call(this))}while(!this.expectOptionalToken(n));return i}delimitedMany(e,t){this.expectOptionalToken(e);const n=[];do{n.push(t.call(this))}while(this.expectOptionalToken(e));return n}}function X(e){const t=e.value;return z(e.kind)+(null!=t?` "${t}"`:"")}function z(e){return function(e){return e===v.BANG||e===v.QUESTION_MARK||e===v.DOLLAR||e===v.AMP||e===v.PAREN_L||e===v.PAREN_R||e===v.SPREAD||e===v.COLON||e===v.EQUALS||e===v.AT||e===v.BRACKET_L||e===v.BRACKET_R||e===v.BRACE_L||e===v.PIPE||e===v.BRACE_R}(e)?`"${e}"`:e}const H=5;function W(e,t){const[n,i]=t?[e,t]:[void 0,e];let r=" Did you mean ";n&&(r+=n+" ");const o=i.map((e=>`"${e}"`));switch(o.length){case 0:return"";case 1:return r+o[0]+"?";case 2:return r+o[0]+" or "+o[1]+"?"}const s=o.slice(0,H),a=s.pop();return r+s.join(", ")+", or "+a+"?"}function Z(e){return e}function ee(e,t){const n=Object.create(null);for(const i of e)n[t(i)]=i;return n}function te(e,t,n){const i=Object.create(null);for(const r of e)i[t(r)]=n(r);return i}function ne(e,t){const n=Object.create(null);for(const i of Object.keys(e))n[i]=t(e[i],i);return n}function ie(e,t){let n=0,i=0;for(;n0);let a=0;do{++i,a=10*a+o-re,o=t.charCodeAt(i)}while(se(o)&&a>0);if(sa)return 1}else{if(ro)return 1;++n,++i}}return e.length-t.length}const re=48,oe=57;function se(e){return!isNaN(e)&&re<=e&&e<=oe}function ae(e,t){const n=Object.create(null),i=new LexicalDistance(e),r=Math.floor(.4*e.length)+1;for(const e of t){const t=i.measure(e,r);void 0!==t&&(n[e]=t)}return Object.keys(n).sort(((e,t)=>{const i=n[e]-n[t];return 0!==i?i:ie(e,t)}))}class LexicalDistance{constructor(e){this._input=e,this._inputLowerCase=e.toLowerCase(),this._inputArray=ce(this._inputLowerCase),this._rows=[new Array(e.length+1).fill(0),new Array(e.length+1).fill(0),new Array(e.length+1).fill(0)]}measure(e,t){if(this._input===e)return 0;const n=e.toLowerCase();if(this._inputLowerCase===n)return 1;let i=ce(n),r=this._inputArray;if(i.lengtht)return;const a=this._rows;for(let e=0;e<=s;e++)a[0][e]=e;for(let e=1;e<=o;e++){const n=a[(e-1)%3],o=a[e%3];let c=o[0]=e;for(let t=1;t<=s;t++){const s=i[e-1]===r[t-1]?0:1;let u=Math.min(n[t]+1,o[t-1]+1,n[t-1]+s);if(e>1&&t>1&&i[e-1]===r[t-2]&&i[e-2]===r[t-1]){const n=a[(e-2)%3][t-2];u=Math.min(u,n+1)}ut)return}const c=a[o%3][s];return c<=t?c:void 0}}function ce(e){const t=e.length,n=new Array(t);for(let i=0;ie.value},Variable:{leave:e=>"$"+e.name},Document:{leave:e=>Te(e.definitions,"\n\n")},OperationDefinition:{leave(e){const t=Ie("(",Te(e.variableDefinitions,", "),")"),n=Te([e.operation,Te([e.name,t]),Te(e.directives," ")]," ");return("query"===n?"":n+" ")+e.selectionSet}},VariableDefinition:{leave:({variable:e,type:t,defaultValue:n,directives:i})=>e+": "+t+Ie(" = ",n)+Ie(" ",Te(i," "))},SelectionSet:{leave:({selections:e})=>Ne(e)},Field:{leave({alias:e,name:t,arguments:n,directives:i,selectionSet:r,required:o}){const s=Te([Ie("",e,": "),t],"");let a=s+Ie("(",Te(n,", "),")");a.length>80&&(a=s+Ie("(\n",ge(Te(n,"\n")),"\n)"));const c=Te([a,o],"");return Te([c,Te(i," "),r]," ")}},RequiredDesignator:{leave:({element:e})=>(null!=e?e:"")+"!"},OptionalDesignator:{leave:({element:e})=>(null!=e?e:"")+"?"},ListNullability:{leave:({element:e})=>"["+(null!=e?e:"")+"]"},Argument:{leave:({name:e,value:t})=>e+": "+t},FragmentSpread:{leave:({name:e,directives:t})=>"..."+e+Ie(" ",Te(t," "))},InlineFragment:{leave:({typeCondition:e,directives:t,selectionSet:n})=>Te(["...",Ie("on ",e),Te(t," "),n]," ")},FragmentDefinition:{leave:({name:e,typeCondition:t,variableDefinitions:n,directives:i,selectionSet:r})=>`fragment ${e}${Ie("(",Te(n,", "),")")} on ${t} ${Ie("",Te(i," ")," ")}`+r},IntValue:{leave:({value:e})=>e},FloatValue:{leave:({value:e})=>e},StringValue:{leave:({value:e,block:t})=>t?function(e,t){const n=e.replace(/"""/g,'\\"""'),i=n.split(/\r\n|[\n\r]/g),r=1===i.length,o=i.length>1&&i.slice(1).every((e=>0===e.length||y(e.charCodeAt(0)))),s=n.endsWith('\\"""'),a=e.endsWith('"')&&!s,c=e.endsWith("\\"),u=a||c,l=!(null!=t&&t.minimize)&&(!r||e.length>70||u||o||s);let p="";const d=r&&y(e.charCodeAt(0));return(l&&!d||o)&&(p+="\n"),p+=n,(l||u)&&(p+="\n"),'"""'+p+'"""'}(e):`"${e.replace(le,pe)}"`},BooleanValue:{leave:({value:e})=>e?"true":"false"},NullValue:{leave:()=>"null"},EnumValue:{leave:({value:e})=>e},ListValue:{leave:({values:e})=>"["+Te(e,", ")+"]"},ObjectValue:{leave:({fields:e})=>"{"+Te(e,", ")+"}"},ObjectField:{leave:({name:e,value:t})=>e+": "+t},Directive:{leave:({name:e,arguments:t})=>"@"+e+Ie("(",Te(t,", "),")")},NamedType:{leave:({name:e})=>e},ListType:{leave:({type:e})=>"["+e+"]"},NonNullType:{leave:({type:e})=>e+"!"},SchemaDefinition:{leave:({description:e,directives:t,operationTypes:n})=>Ie("",e,"\n")+Te(["schema",Te(t," "),Ne(n)]," ")},OperationTypeDefinition:{leave:({operation:e,type:t})=>e+": "+t},ScalarTypeDefinition:{leave:({description:e,name:t,directives:n})=>Ie("",e,"\n")+Te(["scalar",t,Te(n," ")]," ")},ObjectTypeDefinition:{leave:({description:e,name:t,interfaces:n,directives:i,fields:r})=>Ie("",e,"\n")+Te(["type",t,Ie("implements ",Te(n," & ")),Te(i," "),Ne(r)]," ")},FieldDefinition:{leave:({description:e,name:t,arguments:n,type:i,directives:r})=>Ie("",e,"\n")+t+(_e(n)?Ie("(\n",ge(Te(n,"\n")),"\n)"):Ie("(",Te(n,", "),")"))+": "+i+Ie(" ",Te(r," "))},InputValueDefinition:{leave:({description:e,name:t,type:n,defaultValue:i,directives:r})=>Ie("",e,"\n")+Te([t+": "+n,Ie("= ",i),Te(r," ")]," ")},InterfaceTypeDefinition:{leave:({description:e,name:t,interfaces:n,directives:i,fields:r})=>Ie("",e,"\n")+Te(["interface",t,Ie("implements ",Te(n," & ")),Te(i," "),Ne(r)]," ")},UnionTypeDefinition:{leave:({description:e,name:t,directives:n,types:i})=>Ie("",e,"\n")+Te(["union",t,Te(n," "),Ie("= ",Te(i," | "))]," ")},EnumTypeDefinition:{leave:({description:e,name:t,directives:n,values:i})=>Ie("",e,"\n")+Te(["enum",t,Te(n," "),Ne(i)]," ")},EnumValueDefinition:{leave:({description:e,name:t,directives:n})=>Ie("",e,"\n")+Te([t,Te(n," ")]," ")},InputObjectTypeDefinition:{leave:({description:e,name:t,directives:n,fields:i})=>Ie("",e,"\n")+Te(["input",t,Te(n," "),Ne(i)]," ")},DirectiveDefinition:{leave:({description:e,name:t,arguments:n,repeatable:i,locations:r})=>Ie("",e,"\n")+"directive @"+t+(_e(n)?Ie("(\n",ge(Te(n,"\n")),"\n)"):Ie("(",Te(n,", "),")"))+(i?" repeatable":"")+" on "+Te(r," | ")},SchemaExtension:{leave:({directives:e,operationTypes:t})=>Te(["extend schema",Te(e," "),Ne(t)]," ")},ScalarTypeExtension:{leave:({name:e,directives:t})=>Te(["extend scalar",e,Te(t," ")]," ")},ObjectTypeExtension:{leave:({name:e,interfaces:t,directives:n,fields:i})=>Te(["extend type",e,Ie("implements ",Te(t," & ")),Te(n," "),Ne(i)]," ")},InterfaceTypeExtension:{leave:({name:e,interfaces:t,directives:n,fields:i})=>Te(["extend interface",e,Ie("implements ",Te(t," & ")),Te(n," "),Ne(i)]," ")},UnionTypeExtension:{leave:({name:e,directives:t,types:n})=>Te(["extend union",e,Te(t," "),Ie("= ",Te(n," | "))]," ")},EnumTypeExtension:{leave:({name:e,directives:t,values:n})=>Te(["extend enum",e,Te(t," "),Ne(n)]," ")},InputObjectTypeExtension:{leave:({name:e,directives:t,fields:n})=>Te(["extend input",e,Te(t," "),Ne(n)]," ")}};function Te(e,t=""){var n;return null!==(n=null==e?void 0:e.filter((e=>e)).join(t))&&void 0!==n?n:""}function Ne(e){return Ie("{\n",ge(Te(e,"\n")),"\n}")}function Ie(e,t,n=""){return null!=t&&""!==t?e+t+n:""}function ge(e){return Ie(" ",e.replace(/\n/g,"\n "))}function _e(e){var t;return null!==(t=null==e?void 0:e.some((e=>e.includes("\n"))))&&void 0!==t&&t}function Oe(e,t){switch(e.kind){case m.NULL:return null;case m.INT:return parseInt(e.value,10);case m.FLOAT:return parseFloat(e.value);case m.STRING:case m.ENUM:case m.BOOLEAN:return e.value;case m.LIST:return e.values.map((e=>Oe(e,t)));case m.OBJECT:return te(e.fields,(e=>e.name.value),(e=>Oe(e.value,t)));case m.VARIABLE:return null==t?void 0:t[e.name.value]}}function be(e){if(null!=e||t(!1,"Must provide name."),"string"==typeof e||t(!1,"Expected name to be a string."),0===e.length)throw new GraphQLError("Expected name to be a non-empty string.");for(let t=1;ts(Oe(e,t)),this.extensions=ue(e.extensions),this.astNode=e.astNode,this.extensionASTNodes=null!==(o=e.extensionASTNodes)&&void 0!==o?o:[],null==e.specifiedByURL||"string"==typeof e.specifiedByURL||t(!1,`${this.name} must provide "specifiedByURL" as a string, but got: ${Y(e.specifiedByURL)}.`),null==e.serialize||"function"==typeof e.serialize||t(!1,`${this.name} must provide "serialize" function. If this custom Scalar is also used as an input type, ensure "parseValue" and "parseLiteral" functions are also provided.`),e.parseLiteral&&("function"==typeof e.parseValue&&"function"==typeof e.parseLiteral||t(!1,`${this.name} must provide both "parseValue" and "parseLiteral" functions.`))}get[Symbol.toStringTag](){return"GraphQLScalarType"}toConfig(){return{name:this.name,description:this.description,specifiedByURL:this.specifiedByURL,serialize:this.serialize,parseValue:this.parseValue,parseLiteral:this.parseLiteral,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}class GraphQLObjectType{constructor(e){var n;this.name=be(e.name),this.description=e.description,this.isTypeOf=e.isTypeOf,this.extensions=ue(e.extensions),this.astNode=e.astNode,this.extensionASTNodes=null!==(n=e.extensionASTNodes)&&void 0!==n?n:[],this._fields=()=>ze(e),this._interfaces=()=>Xe(e),null==e.isTypeOf||"function"==typeof e.isTypeOf||t(!1,`${this.name} must provide "isTypeOf" as a function, but got: ${Y(e.isTypeOf)}.`)}get[Symbol.toStringTag](){return"GraphQLObjectType"}getFields(){return"function"==typeof this._fields&&(this._fields=this._fields()),this._fields}getInterfaces(){return"function"==typeof this._interfaces&&(this._interfaces=this._interfaces()),this._interfaces}toConfig(){return{name:this.name,description:this.description,interfaces:this.getInterfaces(),fields:Ze(this.getFields()),isTypeOf:this.isTypeOf,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}function Xe(e){var n;const i=qe(null!==(n=e.interfaces)&&void 0!==n?n:[]);return Array.isArray(i)||t(!1,`${e.name} interfaces must be an Array or a function which returns an Array.`),i}function ze(e){const n=Ke(e.fields);return We(n)||t(!1,`${e.name} fields must be an object with field names as keys or a function which returns such an object.`),ne(n,((n,i)=>{var r;We(n)||t(!1,`${e.name}.${i} field config must be an object.`),null==n.resolve||"function"==typeof n.resolve||t(!1,`${e.name}.${i} field resolver must be a function if provided, but got: ${Y(n.resolve)}.`);const o=null!==(r=n.args)&&void 0!==r?r:{};return We(o)||t(!1,`${e.name}.${i} args must be an object with argument names as keys.`),{name:be(i),description:n.description,type:n.type,args:He(o),resolve:n.resolve,subscribe:n.subscribe,deprecationReason:n.deprecationReason,extensions:ue(n.extensions),astNode:n.astNode}}))}function He(e){return Object.entries(e).map((([e,t])=>({name:be(e),description:t.description,type:t.type,defaultValue:t.defaultValue,deprecationReason:t.deprecationReason,extensions:ue(t.extensions),astNode:t.astNode})))}function We(e){return n(e)&&!Array.isArray(e)}function Ze(e){return ne(e,(e=>({description:e.description,type:e.type,args:et(e.args),resolve:e.resolve,subscribe:e.subscribe,deprecationReason:e.deprecationReason,extensions:e.extensions,astNode:e.astNode})))}function et(e){return te(e,(e=>e.name),(e=>({description:e.description,type:e.type,defaultValue:e.defaultValue,deprecationReason:e.deprecationReason,extensions:e.extensions,astNode:e.astNode})))}function tt(e){return Ge(e.type)&&void 0===e.defaultValue}class GraphQLInterfaceType{constructor(e){var n;this.name=be(e.name),this.description=e.description,this.resolveType=e.resolveType,this.extensions=ue(e.extensions),this.astNode=e.astNode,this.extensionASTNodes=null!==(n=e.extensionASTNodes)&&void 0!==n?n:[],this._fields=ze.bind(void 0,e),this._interfaces=Xe.bind(void 0,e),null==e.resolveType||"function"==typeof e.resolveType||t(!1,`${this.name} must provide "resolveType" as a function, but got: ${Y(e.resolveType)}.`)}get[Symbol.toStringTag](){return"GraphQLInterfaceType"}getFields(){return"function"==typeof this._fields&&(this._fields=this._fields()),this._fields}getInterfaces(){return"function"==typeof this._interfaces&&(this._interfaces=this._interfaces()),this._interfaces}toConfig(){return{name:this.name,description:this.description,interfaces:this.getInterfaces(),fields:Ze(this.getFields()),resolveType:this.resolveType,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}class GraphQLUnionType{constructor(e){var n;this.name=be(e.name),this.description=e.description,this.resolveType=e.resolveType,this.extensions=ue(e.extensions),this.astNode=e.astNode,this.extensionASTNodes=null!==(n=e.extensionASTNodes)&&void 0!==n?n:[],this._types=nt.bind(void 0,e),null==e.resolveType||"function"==typeof e.resolveType||t(!1,`${this.name} must provide "resolveType" as a function, but got: ${Y(e.resolveType)}.`)}get[Symbol.toStringTag](){return"GraphQLUnionType"}getTypes(){return"function"==typeof this._types&&(this._types=this._types()),this._types}toConfig(){return{name:this.name,description:this.description,types:this.getTypes(),resolveType:this.resolveType,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}function nt(e){const n=qe(e.types);return Array.isArray(n)||t(!1,`Must provide Array of types or a function which returns such an array for Union ${e.name}.`),n}class GraphQLEnumType{constructor(e){var n,i,r;this.name=be(e.name),this.description=e.description,this.extensions=ue(e.extensions),this.astNode=e.astNode,this.extensionASTNodes=null!==(n=e.extensionASTNodes)&&void 0!==n?n:[],this._values=(i=this.name,We(r=e.values)||t(!1,`${i} values must be an object with value names as keys.`),Object.entries(r).map((([e,n])=>(We(n)||t(!1,`${i}.${e} must refer to an object with a "value" key representing an internal value but got: ${Y(n)}.`),{name:Le(e),description:n.description,value:void 0!==n.value?n.value:e,deprecationReason:n.deprecationReason,extensions:ue(n.extensions),astNode:n.astNode})))),this._valueLookup=new Map(this._values.map((e=>[e.value,e]))),this._nameLookup=ee(this._values,(e=>e.name))}get[Symbol.toStringTag](){return"GraphQLEnumType"}getValues(){return this._values}getValue(e){return this._nameLookup[e]}serialize(e){const t=this._valueLookup.get(e);if(void 0===t)throw new GraphQLError(`Enum "${this.name}" cannot represent value: ${Y(e)}`);return t.name}parseValue(e){if("string"!=typeof e){const t=Y(e);throw new GraphQLError(`Enum "${this.name}" cannot represent non-string value: ${t}.`+it(this,t))}const t=this.getValue(e);if(null==t)throw new GraphQLError(`Value "${e}" does not exist in "${this.name}" enum.`+it(this,e));return t.value}parseLiteral(e,t){if(e.kind!==m.ENUM){const t=ye(e);throw new GraphQLError(`Enum "${this.name}" cannot represent non-enum value: ${t}.`+it(this,t),e)}const n=this.getValue(e.value);if(null==n){const t=ye(e);throw new GraphQLError(`Value "${t}" does not exist in "${this.name}" enum.`+it(this,t),e)}return n.value}toConfig(){const e=te(this.getValues(),(e=>e.name),(e=>({description:e.description,value:e.value,deprecationReason:e.deprecationReason,extensions:e.extensions,astNode:e.astNode})));return{name:this.name,description:this.description,values:e,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}function it(e,t){return W("the enum value",ae(t,e.getValues().map((e=>e.name))))}class GraphQLInputObjectType{constructor(e){var t;this.name=be(e.name),this.description=e.description,this.extensions=ue(e.extensions),this.astNode=e.astNode,this.extensionASTNodes=null!==(t=e.extensionASTNodes)&&void 0!==t?t:[],this._fields=rt.bind(void 0,e)}get[Symbol.toStringTag](){return"GraphQLInputObjectType"}getFields(){return"function"==typeof this._fields&&(this._fields=this._fields()),this._fields}toConfig(){const e=ne(this.getFields(),(e=>({description:e.description,type:e.type,defaultValue:e.defaultValue,deprecationReason:e.deprecationReason,extensions:e.extensions,astNode:e.astNode})));return{name:this.name,description:this.description,fields:e,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}function rt(e){const n=Ke(e.fields);return We(n)||t(!1,`${e.name} fields must be an object with field names as keys or a function which returns such an object.`),ne(n,((n,i)=>(!("resolve"in n)||t(!1,`${e.name}.${i} field has a resolve property, but Input Types cannot define resolvers.`),{name:be(i),description:n.description,type:n.type,defaultValue:n.defaultValue,deprecationReason:n.deprecationReason,extensions:ue(n.extensions),astNode:n.astNode})))}function ot(e){return Ge(e.type)&&void 0===e.defaultValue}function st(e,t){return e===t||(Ge(e)&&Ge(t)||!(!Re(e)||!Re(t)))&&st(e.ofType,t.ofType)}function at(e,t,n){return t===n||(Ge(n)?!!Ge(t)&&at(e,t.ofType,n.ofType):Ge(t)?at(e,t.ofType,n):Re(n)?!!Re(t)&&at(e,t.ofType,n.ofType):!Re(t)&&(Ve(n)&&(we(t)||De(t))&&e.isSubType(n,t)))}function ct(e,t,n){return t===n||(Ve(t)?Ve(n)?e.getPossibleTypes(t).some((t=>e.isSubType(n,t))):e.isSubType(t,n):!!Ve(n)&&e.isSubType(n,t))}const ut=2147483647,lt=-2147483648,pt=new GraphQLScalarType({name:"Int",description:"The `Int` scalar type represents non-fractional signed whole numeric values. Int can represent values between -(2^31) and 2^31 - 1.",serialize(e){const t=Et(e);if("boolean"==typeof t)return t?1:0;let n=t;if("string"==typeof t&&""!==t&&(n=Number(t)),"number"!=typeof n||!Number.isInteger(n))throw new GraphQLError(`Int cannot represent non-integer value: ${Y(t)}`);if(n>ut||nut||eut||te.name===t))}function Et(e){if(n(e)){if("function"==typeof e.valueOf){const t=e.valueOf();if(!n(t))return t}if("function"==typeof e.toJSON)return e.toJSON()}return e}function Tt(e){return q(e,GraphQLDirective)}class GraphQLDirective{constructor(e){var i,r;this.name=be(e.name),this.description=e.description,this.locations=e.locations,this.isRepeatable=null!==(i=e.isRepeatable)&&void 0!==i&&i,this.extensions=ue(e.extensions),this.astNode=e.astNode,Array.isArray(e.locations)||t(!1,`@${e.name} locations must be an Array.`);const o=null!==(r=e.args)&&void 0!==r?r:{};n(o)&&!Array.isArray(o)||t(!1,`@${e.name} args must be an object with argument names as keys.`),this.args=He(o)}get[Symbol.toStringTag](){return"GraphQLDirective"}toConfig(){return{name:this.name,description:this.description,locations:this.locations,args:et(this.args),isRepeatable:this.isRepeatable,extensions:this.extensions,astNode:this.astNode}}toString(){return"@"+this.name}toJSON(){return this.toString()}}const Nt=new GraphQLDirective({name:"include",description:"Directs the executor to include this field or fragment only when the `if` argument is true.",locations:[h.FIELD,h.FRAGMENT_SPREAD,h.INLINE_FRAGMENT],args:{if:{type:new GraphQLNonNull(ht),description:"Included when true."}}}),It=new GraphQLDirective({name:"skip",description:"Directs the executor to skip this field or fragment when the `if` argument is true.",locations:[h.FIELD,h.FRAGMENT_SPREAD,h.INLINE_FRAGMENT],args:{if:{type:new GraphQLNonNull(ht),description:"Skipped when true."}}}),gt="No longer supported",_t=new GraphQLDirective({name:"deprecated",description:"Marks an element of a GraphQL schema as no longer supported.",locations:[h.FIELD_DEFINITION,h.ARGUMENT_DEFINITION,h.INPUT_FIELD_DEFINITION,h.ENUM_VALUE],args:{reason:{type:ft,description:"Explains why this element was deprecated, usually also including a suggestion for how to access supported similar data. Formatted using the Markdown syntax, as specified by [CommonMark](https://commonmark.org/).",defaultValue:gt}}}),Ot=new GraphQLDirective({name:"specifiedBy",description:"Exposes a URL that specifies the behavior of this scalar.",locations:[h.SCALAR],args:{url:{type:new GraphQLNonNull(ft),description:"The URL that specifies the behavior of this scalar."}}}),bt=Object.freeze([Nt,It,_t,Ot]);function Lt(e,t){if(Ge(t)){const n=Lt(e,t.ofType);return(null==n?void 0:n.kind)===m.NULL?null:n}if(null===e)return{kind:m.NULL};if(void 0===e)return null;if(Re(t)){const n=t.ofType;if("object"==typeof(r=e)&&"function"==typeof(null==r?void 0:r[Symbol.iterator])){const t=[];for(const i of e){const e=Lt(i,n);null!=e&&t.push(e)}return{kind:m.LIST,values:t}}return Lt(e,n)}var r;if(Fe(t)){if(!n(e))return null;const i=[];for(const n of Object.values(t.getFields())){const t=Lt(e[n.name],n.type);t&&i.push({kind:m.OBJECT_FIELD,name:{kind:m.NAME,value:n.name},value:t})}return{kind:m.OBJECT,fields:i}}if(Ue(t)){const n=t.serialize(e);if(null==n)return null;if("boolean"==typeof n)return{kind:m.BOOLEAN,value:n};if("number"==typeof n&&Number.isFinite(n)){const e=String(n);return St.test(e)?{kind:m.INT,value:e}:{kind:m.FLOAT,value:e}}if("string"==typeof n)return xe(t)?{kind:m.ENUM,value:n}:t===mt&&St.test(n)?{kind:m.INT,value:n}:{kind:m.STRING,value:n};throw new TypeError(`Cannot convert value to AST: ${Y(n)}.`)}i(!1,"Unexpected input type: "+Y(t))}const St=/^-?(?:0|[1-9][0-9]*)$/,At=new GraphQLObjectType({name:"__Schema",description:"A GraphQL Schema defines the capabilities of a GraphQL server. It exposes all available types and directives on the server, as well as the entry points for query, mutation, and subscription operations.",fields:()=>({description:{type:ft,resolve:e=>e.description},types:{description:"A list of all types supported by this server.",type:new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(kt))),resolve:e=>Object.values(e.getTypeMap())},queryType:{description:"The type that query operations will be rooted at.",type:new GraphQLNonNull(kt),resolve:e=>e.getQueryType()},mutationType:{description:"If this server supports mutation, the type that mutation operations will be rooted at.",type:kt,resolve:e=>e.getMutationType()},subscriptionType:{description:"If this server support subscription, the type that subscription operations will be rooted at.",type:kt,resolve:e=>e.getSubscriptionType()},directives:{description:"A list of all directives supported by this server.",type:new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(Dt))),resolve:e=>e.getDirectives()}})}),Dt=new GraphQLObjectType({name:"__Directive",description:"A Directive provides a way to describe alternate runtime execution and type validation behavior in a GraphQL document.\n\nIn some cases, you need to provide options to alter GraphQL's execution behavior in ways field arguments will not suffice, such as conditionally including or skipping a field. Directives provide this by describing additional information to the executor.",fields:()=>({name:{type:new GraphQLNonNull(ft),resolve:e=>e.name},description:{type:ft,resolve:e=>e.description},isRepeatable:{type:new GraphQLNonNull(ht),resolve:e=>e.isRepeatable},locations:{type:new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(wt))),resolve:e=>e.locations},args:{type:new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(Ft))),args:{includeDeprecated:{type:ht,defaultValue:!1}},resolve:(e,{includeDeprecated:t})=>t?e.args:e.args.filter((e=>null==e.deprecationReason))}})}),wt=new GraphQLEnumType({name:"__DirectiveLocation",description:"A Directive can be adjacent to many parts of the GraphQL language, a __DirectiveLocation describes one such possible adjacencies.",values:{QUERY:{value:h.QUERY,description:"Location adjacent to a query operation."},MUTATION:{value:h.MUTATION,description:"Location adjacent to a mutation operation."},SUBSCRIPTION:{value:h.SUBSCRIPTION,description:"Location adjacent to a subscription operation."},FIELD:{value:h.FIELD,description:"Location adjacent to a field."},FRAGMENT_DEFINITION:{value:h.FRAGMENT_DEFINITION,description:"Location adjacent to a fragment definition."},FRAGMENT_SPREAD:{value:h.FRAGMENT_SPREAD,description:"Location adjacent to a fragment spread."},INLINE_FRAGMENT:{value:h.INLINE_FRAGMENT,description:"Location adjacent to an inline fragment."},VARIABLE_DEFINITION:{value:h.VARIABLE_DEFINITION,description:"Location adjacent to a variable definition."},SCHEMA:{value:h.SCHEMA,description:"Location adjacent to a schema definition."},SCALAR:{value:h.SCALAR,description:"Location adjacent to a scalar definition."},OBJECT:{value:h.OBJECT,description:"Location adjacent to an object type definition."},FIELD_DEFINITION:{value:h.FIELD_DEFINITION,description:"Location adjacent to a field definition."},ARGUMENT_DEFINITION:{value:h.ARGUMENT_DEFINITION,description:"Location adjacent to an argument definition."},INTERFACE:{value:h.INTERFACE,description:"Location adjacent to an interface definition."},UNION:{value:h.UNION,description:"Location adjacent to a union definition."},ENUM:{value:h.ENUM,description:"Location adjacent to an enum definition."},ENUM_VALUE:{value:h.ENUM_VALUE,description:"Location adjacent to an enum value definition."},INPUT_OBJECT:{value:h.INPUT_OBJECT,description:"Location adjacent to an input object type definition."},INPUT_FIELD_DEFINITION:{value:h.INPUT_FIELD_DEFINITION,description:"Location adjacent to an input object field definition."}}}),kt=new GraphQLObjectType({name:"__Type",description:"The fundamental unit of any GraphQL Schema is the type. There are many kinds of types in GraphQL as represented by the `__TypeKind` enum.\n\nDepending on the kind of a type, certain fields describe information about that type. Scalar types provide no information beyond a name, description and optional `specifiedByURL`, while Enum types provide their values. Object and Interface types provide the fields they describe. Abstract types, Union and Interface, provide the Object types possible at runtime. List and NonNull types compose other types.",fields:()=>({kind:{type:new GraphQLNonNull(Gt),resolve:e=>Ae(e)?Ct.SCALAR:De(e)?Ct.OBJECT:we(e)?Ct.INTERFACE:ke(e)?Ct.UNION:xe(e)?Ct.ENUM:Fe(e)?Ct.INPUT_OBJECT:Re(e)?Ct.LIST:Ge(e)?Ct.NON_NULL:void i(!1,`Unexpected type: "${Y(e)}".`)},name:{type:ft,resolve:e=>"name"in e?e.name:void 0},description:{type:ft,resolve:e=>"description"in e?e.description:void 0},specifiedByURL:{type:ft,resolve:e=>"specifiedByURL"in e?e.specifiedByURL:void 0},fields:{type:new GraphQLList(new GraphQLNonNull(xt)),args:{includeDeprecated:{type:ht,defaultValue:!1}},resolve(e,{includeDeprecated:t}){if(De(e)||we(e)){const n=Object.values(e.getFields());return t?n:n.filter((e=>null==e.deprecationReason))}}},interfaces:{type:new GraphQLList(new GraphQLNonNull(kt)),resolve(e){if(De(e)||we(e))return e.getInterfaces()}},possibleTypes:{type:new GraphQLList(new GraphQLNonNull(kt)),resolve(e,t,n,{schema:i}){if(Ve(e))return i.getPossibleTypes(e)}},enumValues:{type:new GraphQLList(new GraphQLNonNull(Rt)),args:{includeDeprecated:{type:ht,defaultValue:!1}},resolve(e,{includeDeprecated:t}){if(xe(e)){const n=e.getValues();return t?n:n.filter((e=>null==e.deprecationReason))}}},inputFields:{type:new GraphQLList(new GraphQLNonNull(Ft)),args:{includeDeprecated:{type:ht,defaultValue:!1}},resolve(e,{includeDeprecated:t}){if(Fe(e)){const n=Object.values(e.getFields());return t?n:n.filter((e=>null==e.deprecationReason))}}},ofType:{type:kt,resolve:e=>"ofType"in e?e.ofType:void 0}})}),xt=new GraphQLObjectType({name:"__Field",description:"Object and Interface types are described by a list of Fields, each of which has a name, potentially a list of arguments, and a return type.",fields:()=>({name:{type:new GraphQLNonNull(ft),resolve:e=>e.name},description:{type:ft,resolve:e=>e.description},args:{type:new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(Ft))),args:{includeDeprecated:{type:ht,defaultValue:!1}},resolve:(e,{includeDeprecated:t})=>t?e.args:e.args.filter((e=>null==e.deprecationReason))},type:{type:new GraphQLNonNull(kt),resolve:e=>e.type},isDeprecated:{type:new GraphQLNonNull(ht),resolve:e=>null!=e.deprecationReason},deprecationReason:{type:ft,resolve:e=>e.deprecationReason}})}),Ft=new GraphQLObjectType({name:"__InputValue",description:"Arguments provided to Fields or Directives and the input fields of an InputObject are represented as Input Values which describe their type and optionally a default value.",fields:()=>({name:{type:new GraphQLNonNull(ft),resolve:e=>e.name},description:{type:ft,resolve:e=>e.description},type:{type:new GraphQLNonNull(kt),resolve:e=>e.type},defaultValue:{type:ft,description:"A GraphQL-formatted string representing the default value for this input value.",resolve(e){const{type:t,defaultValue:n}=e,i=Lt(n,t);return i?ye(i):null}},isDeprecated:{type:new GraphQLNonNull(ht),resolve:e=>null!=e.deprecationReason},deprecationReason:{type:ft,resolve:e=>e.deprecationReason}})}),Rt=new GraphQLObjectType({name:"__EnumValue",description:"One possible value for a given Enum. Enum values are unique values, not a placeholder for a string or numeric value. However an Enum value is returned in a JSON response as a string.",fields:()=>({name:{type:new GraphQLNonNull(ft),resolve:e=>e.name},description:{type:ft,resolve:e=>e.description},isDeprecated:{type:new GraphQLNonNull(ht),resolve:e=>null!=e.deprecationReason},deprecationReason:{type:ft,resolve:e=>e.deprecationReason}})});let Ct;!function(e){e.SCALAR="SCALAR",e.OBJECT="OBJECT",e.INTERFACE="INTERFACE",e.UNION="UNION",e.ENUM="ENUM",e.INPUT_OBJECT="INPUT_OBJECT",e.LIST="LIST",e.NON_NULL="NON_NULL"}(Ct||(Ct={}));const Gt=new GraphQLEnumType({name:"__TypeKind",description:"An enum describing what kind of type a given `__Type` is.",values:{SCALAR:{value:Ct.SCALAR,description:"Indicates this type is a scalar."},OBJECT:{value:Ct.OBJECT,description:"Indicates this type is an object. `fields` and `interfaces` are valid fields."},INTERFACE:{value:Ct.INTERFACE,description:"Indicates this type is an interface. `fields`, `interfaces`, and `possibleTypes` are valid fields."},UNION:{value:Ct.UNION,description:"Indicates this type is a union. `possibleTypes` is a valid field."},ENUM:{value:Ct.ENUM,description:"Indicates this type is an enum. `enumValues` is a valid field."},INPUT_OBJECT:{value:Ct.INPUT_OBJECT,description:"Indicates this type is an input object. `inputFields` is a valid field."},LIST:{value:Ct.LIST,description:"Indicates this type is a list. `ofType` is a valid field."},NON_NULL:{value:Ct.NON_NULL,description:"Indicates this type is a non-null. `ofType` is a valid field."}}}),$t={name:"__schema",type:new GraphQLNonNull(At),description:"Access the current type schema of this server.",args:[],resolve:(e,t,n,{schema:i})=>i,deprecationReason:void 0,extensions:Object.create(null),astNode:void 0},Qt={name:"__type",type:kt,description:"Request the type information of a single type.",args:[{name:"name",description:void 0,type:new GraphQLNonNull(ft),defaultValue:void 0,deprecationReason:void 0,extensions:Object.create(null),astNode:void 0}],resolve:(e,{name:t},n,{schema:i})=>i.getType(t),deprecationReason:void 0,extensions:Object.create(null),astNode:void 0},Ut={name:"__typename",type:new GraphQLNonNull(ft),description:"The name of the current Object type at runtime.",args:[],resolve:(e,t,n,{parentType:i})=>i.name,deprecationReason:void 0,extensions:Object.create(null),astNode:void 0},jt=Object.freeze([At,Dt,wt,kt,xt,Ft,Rt,Gt]);function Vt(e){return jt.some((({name:t})=>e.name===t))}function Mt(e){if(!function(e){return q(e,GraphQLSchema)}(e))throw new Error(`Expected ${Y(e)} to be a GraphQL schema.`);return e}class GraphQLSchema{constructor(e){var i,r;this.__validationErrors=!0===e.assumeValid?[]:void 0,n(e)||t(!1,"Must provide configuration object."),!e.types||Array.isArray(e.types)||t(!1,`"types" must be Array if provided but got: ${Y(e.types)}.`),!e.directives||Array.isArray(e.directives)||t(!1,`"directives" must be Array if provided but got: ${Y(e.directives)}.`),this.description=e.description,this.extensions=ue(e.extensions),this.astNode=e.astNode,this.extensionASTNodes=null!==(i=e.extensionASTNodes)&&void 0!==i?i:[],this._queryType=e.query,this._mutationType=e.mutation,this._subscriptionType=e.subscription,this._directives=null!==(r=e.directives)&&void 0!==r?r:bt;const o=new Set(e.types);if(null!=e.types)for(const t of e.types)o.delete(t),Pt(t,o);null!=this._queryType&&Pt(this._queryType,o),null!=this._mutationType&&Pt(this._mutationType,o),null!=this._subscriptionType&&Pt(this._subscriptionType,o);for(const e of this._directives)if(Tt(e))for(const t of e.args)Pt(t.type,o);Pt(At,o),this._typeMap=Object.create(null),this._subTypeMap=Object.create(null),this._implementationsMap=Object.create(null);for(const e of o){if(null==e)continue;const n=e.name;if(n||t(!1,"One of the provided types for building the Schema is missing a name."),void 0!==this._typeMap[n])throw new Error(`Schema must contain uniquely named types but contains multiple types named "${n}".`);if(this._typeMap[n]=e,we(e)){for(const t of e.getInterfaces())if(we(t)){let n=this._implementationsMap[t.name];void 0===n&&(n=this._implementationsMap[t.name]={objects:[],interfaces:[]}),n.interfaces.push(e)}}else if(De(e))for(const t of e.getInterfaces())if(we(t)){let n=this._implementationsMap[t.name];void 0===n&&(n=this._implementationsMap[t.name]={objects:[],interfaces:[]}),n.objects.push(e)}}}get[Symbol.toStringTag](){return"GraphQLSchema"}getQueryType(){return this._queryType}getMutationType(){return this._mutationType}getSubscriptionType(){return this._subscriptionType}getRootType(e){switch(e){case f.QUERY:return this.getQueryType();case f.MUTATION:return this.getMutationType();case f.SUBSCRIPTION:return this.getSubscriptionType()}}getTypeMap(){return this._typeMap}getType(e){return this.getTypeMap()[e]}getPossibleTypes(e){return ke(e)?e.getTypes():this.getImplementations(e).objects}getImplementations(e){const t=this._implementationsMap[e.name];return null!=t?t:{objects:[],interfaces:[]}}isSubType(e,t){let n=this._subTypeMap[e.name];if(void 0===n){if(n=Object.create(null),ke(e))for(const t of e.getTypes())n[t.name]=!0;else{const t=this.getImplementations(e);for(const e of t.objects)n[e.name]=!0;for(const e of t.interfaces)n[e.name]=!0}this._subTypeMap[e.name]=n}return void 0!==n[t.name]}getDirectives(){return this._directives}getDirective(e){return this.getDirectives().find((t=>t.name===e))}toConfig(){return{description:this.description,query:this.getQueryType(),mutation:this.getMutationType(),subscription:this.getSubscriptionType(),types:Object.values(this.getTypeMap()),directives:this.getDirectives(),extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes,assumeValid:void 0!==this.__validationErrors}}}function Pt(e,t){const n=Je(e);if(!t.has(n))if(t.add(n),ke(n))for(const e of n.getTypes())Pt(e,t);else if(De(n)||we(n)){for(const e of n.getInterfaces())Pt(e,t);for(const e of Object.values(n.getFields())){Pt(e.type,t);for(const n of e.args)Pt(n.type,t)}}else if(Fe(n))for(const e of Object.values(n.getFields()))Pt(e.type,t);return t}function Bt(e){if(Mt(e),e.__validationErrors)return e.__validationErrors;const t=new SchemaValidationContext(e);!function(e){const t=e.schema,n=t.getQueryType();if(n){if(!De(n)){var i;e.reportError(`Query root type must be Object type, it cannot be ${Y(n)}.`,null!==(i=Yt(t,f.QUERY))&&void 0!==i?i:n.astNode)}}else e.reportError("Query root type must be provided.",t.astNode);const r=t.getMutationType();var o;r&&!De(r)&&e.reportError(`Mutation root type must be Object type if provided, it cannot be ${Y(r)}.`,null!==(o=Yt(t,f.MUTATION))&&void 0!==o?o:r.astNode);const s=t.getSubscriptionType();var a;s&&!De(s)&&e.reportError(`Subscription root type must be Object type if provided, it cannot be ${Y(s)}.`,null!==(a=Yt(t,f.SUBSCRIPTION))&&void 0!==a?a:s.astNode)}(t),function(e){for(const n of e.schema.getDirectives())if(Tt(n)){Jt(e,n);for(const i of n.args){var t;if(Jt(e,i),$e(i.type)||e.reportError(`The type of @${n.name}(${i.name}:) must be Input Type but got: ${Y(i.type)}.`,i.astNode),tt(i)&&null!=i.deprecationReason)e.reportError(`Required argument @${n.name}(${i.name}:) cannot be deprecated.`,[nn(i.astNode),null===(t=i.astNode)||void 0===t?void 0:t.type])}}else e.reportError(`Expected directive but got: ${Y(n)}.`,null==n?void 0:n.astNode)}(t),function(e){const t=function(e){const t=Object.create(null),n=[],i=Object.create(null);return r;function r(o){if(t[o.name])return;t[o.name]=!0,i[o.name]=n.length;const s=Object.values(o.getFields());for(const t of s)if(Ge(t.type)&&Fe(t.type.ofType)){const o=t.type.ofType,s=i[o.name];if(n.push(t),void 0===s)r(o);else{const t=n.slice(s),i=t.map((e=>e.name)).join(".");e.reportError(`Cannot reference Input Object "${o.name}" within itself through a series of non-null fields: "${i}".`,t.map((e=>e.astNode)))}n.pop()}i[o.name]=void 0}}(e),n=e.schema.getTypeMap();for(const i of Object.values(n))Ye(i)?(Vt(i)||Jt(e,i),De(i)||we(i)?(qt(e,i),Kt(e,i)):ke(i)?Ht(e,i):xe(i)?Wt(e,i):Fe(i)&&(Zt(e,i),t(i))):e.reportError(`Expected GraphQL named type but got: ${Y(i)}.`,i.astNode)}(t);const n=t.getErrors();return e.__validationErrors=n,n}class SchemaValidationContext{constructor(e){this._errors=[],this.schema=e}reportError(e,t){const n=Array.isArray(t)?t.filter(Boolean):t;this._errors.push(new GraphQLError(e,n))}getErrors(){return this._errors}}function Yt(e,t){var n;return null===(n=[e.astNode,...e.extensionASTNodes].flatMap((e=>{var t;return null!==(t=null==e?void 0:e.operationTypes)&&void 0!==t?t:[]})).find((e=>e.operation===t)))||void 0===n?void 0:n.type}function Jt(e,t){t.name.startsWith("__")&&e.reportError(`Name "${t.name}" must not begin with "__", which is reserved by GraphQL introspection.`,t.astNode)}function qt(e,t){const n=Object.values(t.getFields());0===n.length&&e.reportError(`Type ${t.name} must define one or more fields.`,[t.astNode,...t.extensionASTNodes]);for(const s of n){var i;if(Jt(e,s),!Qe(s.type))e.reportError(`The type of ${t.name}.${s.name} must be Output Type but got: ${Y(s.type)}.`,null===(i=s.astNode)||void 0===i?void 0:i.type);for(const n of s.args){const i=n.name;var r,o;if(Jt(e,n),!$e(n.type))e.reportError(`The type of ${t.name}.${s.name}(${i}:) must be Input Type but got: ${Y(n.type)}.`,null===(r=n.astNode)||void 0===r?void 0:r.type);if(tt(n)&&null!=n.deprecationReason)e.reportError(`Required argument ${t.name}.${s.name}(${i}:) cannot be deprecated.`,[nn(n.astNode),null===(o=n.astNode)||void 0===o?void 0:o.type])}}}function Kt(e,t){const n=Object.create(null);for(const i of t.getInterfaces())we(i)?t!==i?n[i.name]?e.reportError(`Type ${t.name} can only implement ${i.name} once.`,en(t,i)):(n[i.name]=!0,zt(e,t,i),Xt(e,t,i)):e.reportError(`Type ${t.name} cannot implement itself because it would create a circular reference.`,en(t,i)):e.reportError(`Type ${Y(t)} must only implement Interface types, it cannot implement ${Y(i)}.`,en(t,i))}function Xt(e,t,n){const i=t.getFields();for(const c of Object.values(n.getFields())){const u=c.name,l=i[u];if(l){var r,o;if(!at(e.schema,l.type,c.type))e.reportError(`Interface field ${n.name}.${u} expects type ${Y(c.type)} but ${t.name}.${u} is type ${Y(l.type)}.`,[null===(r=c.astNode)||void 0===r?void 0:r.type,null===(o=l.astNode)||void 0===o?void 0:o.type]);for(const i of c.args){const r=i.name,o=l.args.find((e=>e.name===r));var s,a;if(o){if(!st(i.type,o.type))e.reportError(`Interface field argument ${n.name}.${u}(${r}:) expects type ${Y(i.type)} but ${t.name}.${u}(${r}:) is type ${Y(o.type)}.`,[null===(s=i.astNode)||void 0===s?void 0:s.type,null===(a=o.astNode)||void 0===a?void 0:a.type])}else e.reportError(`Interface field argument ${n.name}.${u}(${r}:) expected but ${t.name}.${u} does not provide it.`,[i.astNode,l.astNode])}for(const i of l.args){const r=i.name;!c.args.find((e=>e.name===r))&&tt(i)&&e.reportError(`Object field ${t.name}.${u} includes required argument ${r} that is missing from the Interface field ${n.name}.${u}.`,[i.astNode,c.astNode])}}else e.reportError(`Interface field ${n.name}.${u} expected but ${t.name} does not provide it.`,[c.astNode,t.astNode,...t.extensionASTNodes])}}function zt(e,t,n){const i=t.getInterfaces();for(const r of n.getInterfaces())i.includes(r)||e.reportError(r===t?`Type ${t.name} cannot implement ${n.name} because it would create a circular reference.`:`Type ${t.name} must implement ${r.name} because it is implemented by ${n.name}.`,[...en(n,r),...en(t,n)])}function Ht(e,t){const n=t.getTypes();0===n.length&&e.reportError(`Union type ${t.name} must define one or more member types.`,[t.astNode,...t.extensionASTNodes]);const i=Object.create(null);for(const r of n)i[r.name]?e.reportError(`Union type ${t.name} can only include type ${r.name} once.`,tn(t,r.name)):(i[r.name]=!0,De(r)||e.reportError(`Union type ${t.name} can only include Object types, it cannot include ${Y(r)}.`,tn(t,String(r))))}function Wt(e,t){const n=t.getValues();0===n.length&&e.reportError(`Enum type ${t.name} must define one or more values.`,[t.astNode,...t.extensionASTNodes]);for(const t of n)Jt(e,t)}function Zt(e,t){const n=Object.values(t.getFields());0===n.length&&e.reportError(`Input Object type ${t.name} must define one or more fields.`,[t.astNode,...t.extensionASTNodes]);for(const o of n){var i,r;if(Jt(e,o),!$e(o.type))e.reportError(`The type of ${t.name}.${o.name} must be Input Type but got: ${Y(o.type)}.`,null===(i=o.astNode)||void 0===i?void 0:i.type);if(ot(o)&&null!=o.deprecationReason)e.reportError(`Required input field ${t.name}.${o.name} cannot be deprecated.`,[nn(o.astNode),null===(r=o.astNode)||void 0===r?void 0:r.type])}}function en(e,t){const{astNode:n,extensionASTNodes:i}=e;return(null!=n?[n,...i]:i).flatMap((e=>{var t;return null!==(t=e.interfaces)&&void 0!==t?t:[]})).filter((e=>e.name.value===t.name))}function tn(e,t){const{astNode:n,extensionASTNodes:i}=e;return(null!=n?[n,...i]:i).flatMap((e=>{var t;return null!==(t=e.types)&&void 0!==t?t:[]})).filter((e=>e.name.value===t))}function nn(e){var t;return null==e||null===(t=e.directives)||void 0===t?void 0:t.find((e=>e.name.value===_t.name))}function rn(e,t){switch(t.kind){case m.LIST_TYPE:{const n=rn(e,t.type);return n&&new GraphQLList(n)}case m.NON_NULL_TYPE:{const n=rn(e,t.type);return n&&new GraphQLNonNull(n)}case m.NAMED_TYPE:return e.getType(t.name.value)}}class TypeInfo{constructor(e,t,n){this._schema=e,this._typeStack=[],this._parentTypeStack=[],this._inputTypeStack=[],this._fieldDefStack=[],this._defaultValueStack=[],this._directive=null,this._argument=null,this._enumValue=null,this._getFieldDef=null!=n?n:on,t&&($e(t)&&this._inputTypeStack.push(t),je(t)&&this._parentTypeStack.push(t),Qe(t)&&this._typeStack.push(t))}get[Symbol.toStringTag](){return"TypeInfo"}getType(){if(this._typeStack.length>0)return this._typeStack[this._typeStack.length-1]}getParentType(){if(this._parentTypeStack.length>0)return this._parentTypeStack[this._parentTypeStack.length-1]}getInputType(){if(this._inputTypeStack.length>0)return this._inputTypeStack[this._inputTypeStack.length-1]}getParentInputType(){if(this._inputTypeStack.length>1)return this._inputTypeStack[this._inputTypeStack.length-2]}getFieldDef(){if(this._fieldDefStack.length>0)return this._fieldDefStack[this._fieldDefStack.length-1]}getDefaultValue(){if(this._defaultValueStack.length>0)return this._defaultValueStack[this._defaultValueStack.length-1]}getDirective(){return this._directive}getArgument(){return this._argument}getEnumValue(){return this._enumValue}enter(e){const t=this._schema;switch(e.kind){case m.SELECTION_SET:{const e=Je(this.getType());this._parentTypeStack.push(je(e)?e:void 0);break}case m.FIELD:{const n=this.getParentType();let i,r;n&&(i=this._getFieldDef(t,n,e),i&&(r=i.type)),this._fieldDefStack.push(i),this._typeStack.push(Qe(r)?r:void 0);break}case m.DIRECTIVE:this._directive=t.getDirective(e.name.value);break;case m.OPERATION_DEFINITION:{const n=t.getRootType(e.operation);this._typeStack.push(De(n)?n:void 0);break}case m.INLINE_FRAGMENT:case m.FRAGMENT_DEFINITION:{const n=e.typeCondition,i=n?rn(t,n):Je(this.getType());this._typeStack.push(Qe(i)?i:void 0);break}case m.VARIABLE_DEFINITION:{const n=rn(t,e.type);this._inputTypeStack.push($e(n)?n:void 0);break}case m.ARGUMENT:{var n;let t,i;const r=null!==(n=this.getDirective())&&void 0!==n?n:this.getFieldDef();r&&(t=r.args.find((t=>t.name===e.name.value)),t&&(i=t.type)),this._argument=t,this._defaultValueStack.push(t?t.defaultValue:void 0),this._inputTypeStack.push($e(i)?i:void 0);break}case m.LIST:{const e=Be(this.getInputType()),t=Re(e)?e.ofType:e;this._defaultValueStack.push(void 0),this._inputTypeStack.push($e(t)?t:void 0);break}case m.OBJECT_FIELD:{const t=Je(this.getInputType());let n,i;Fe(t)&&(i=t.getFields()[e.name.value],i&&(n=i.type)),this._defaultValueStack.push(i?i.defaultValue:void 0),this._inputTypeStack.push($e(n)?n:void 0);break}case m.ENUM:{const t=Je(this.getInputType());let n;xe(t)&&(n=t.getValue(e.value)),this._enumValue=n;break}}}leave(e){switch(e.kind){case m.SELECTION_SET:this._parentTypeStack.pop();break;case m.FIELD:this._fieldDefStack.pop(),this._typeStack.pop();break;case m.DIRECTIVE:this._directive=null;break;case m.OPERATION_DEFINITION:case m.INLINE_FRAGMENT:case m.FRAGMENT_DEFINITION:this._typeStack.pop();break;case m.VARIABLE_DEFINITION:this._inputTypeStack.pop();break;case m.ARGUMENT:this._argument=null,this._defaultValueStack.pop(),this._inputTypeStack.pop();break;case m.LIST:case m.OBJECT_FIELD:this._defaultValueStack.pop(),this._inputTypeStack.pop();break;case m.ENUM:this._enumValue=null}}}function on(e,t,n){const i=n.name.value;return i===$t.name&&e.getQueryType()===t?$t:i===Qt.name&&e.getQueryType()===t?Qt:i===Ut.name&&je(t)?Ut:De(t)||we(t)?t.getFields()[i]:void 0}function sn(e,t){return{enter(...n){const i=n[0];e.enter(i);const r=ve(t,i.kind).enter;if(r){const o=r.apply(t,n);return void 0!==o&&(e.leave(i),d(o)&&e.enter(o)),o}},leave(...n){const i=n[0],r=ve(t,i.kind).leave;let o;return r&&(o=r.apply(t,n)),e.leave(i),o}}}function an(e){return e.kind===m.OPERATION_DEFINITION||e.kind===m.FRAGMENT_DEFINITION}function cn(e){return e.kind===m.SCALAR_TYPE_DEFINITION||e.kind===m.OBJECT_TYPE_DEFINITION||e.kind===m.INTERFACE_TYPE_DEFINITION||e.kind===m.UNION_TYPE_DEFINITION||e.kind===m.ENUM_TYPE_DEFINITION||e.kind===m.INPUT_OBJECT_TYPE_DEFINITION}function un(e){return e.kind===m.SCALAR_TYPE_EXTENSION||e.kind===m.OBJECT_TYPE_EXTENSION||e.kind===m.INTERFACE_TYPE_EXTENSION||e.kind===m.UNION_TYPE_EXTENSION||e.kind===m.ENUM_TYPE_EXTENSION||e.kind===m.INPUT_OBJECT_TYPE_EXTENSION}function ln(e){const t=Object.create(null),n=e.getSchema(),i=n?n.getDirectives():bt;for(const e of i)t[e.name]=e.args.map((e=>e.name));const r=e.getDocument().definitions;for(const e of r)if(e.kind===m.DIRECTIVE_DEFINITION){var o;const n=null!==(o=e.arguments)&&void 0!==o?o:[];t[e.name.value]=n.map((e=>e.name.value))}return{Directive(n){const i=n.name.value,r=t[i];if(n.arguments&&r)for(const t of n.arguments){const n=t.name.value;if(!r.includes(n)){const o=ae(n,r);e.reportError(new GraphQLError(`Unknown argument "${n}" on directive "@${i}".`+W(o),t))}}return!1}}}function pn(e){const t=Object.create(null),n=e.getSchema(),r=n?n.getDirectives():bt;for(const e of r)t[e.name]=e.locations;const o=e.getDocument().definitions;for(const e of o)e.kind===m.DIRECTIVE_DEFINITION&&(t[e.name.value]=e.locations.map((e=>e.value)));return{Directive(n,r,o,s,a){const c=n.name.value,u=t[c];if(!u)return void e.reportError(new GraphQLError(`Unknown directive "@${c}".`,n));const l=function(e){const t=e[e.length-1];switch("kind"in t||i(!1),t.kind){case m.OPERATION_DEFINITION:return function(e){switch(e){case f.QUERY:return h.QUERY;case f.MUTATION:return h.MUTATION;case f.SUBSCRIPTION:return h.SUBSCRIPTION}}(t.operation);case m.FIELD:return h.FIELD;case m.FRAGMENT_SPREAD:return h.FRAGMENT_SPREAD;case m.INLINE_FRAGMENT:return h.INLINE_FRAGMENT;case m.FRAGMENT_DEFINITION:return h.FRAGMENT_DEFINITION;case m.VARIABLE_DEFINITION:return h.VARIABLE_DEFINITION;case m.SCHEMA_DEFINITION:case m.SCHEMA_EXTENSION:return h.SCHEMA;case m.SCALAR_TYPE_DEFINITION:case m.SCALAR_TYPE_EXTENSION:return h.SCALAR;case m.OBJECT_TYPE_DEFINITION:case m.OBJECT_TYPE_EXTENSION:return h.OBJECT;case m.FIELD_DEFINITION:return h.FIELD_DEFINITION;case m.INTERFACE_TYPE_DEFINITION:case m.INTERFACE_TYPE_EXTENSION:return h.INTERFACE;case m.UNION_TYPE_DEFINITION:case m.UNION_TYPE_EXTENSION:return h.UNION;case m.ENUM_TYPE_DEFINITION:case m.ENUM_TYPE_EXTENSION:return h.ENUM;case m.ENUM_VALUE_DEFINITION:return h.ENUM_VALUE;case m.INPUT_OBJECT_TYPE_DEFINITION:case m.INPUT_OBJECT_TYPE_EXTENSION:return h.INPUT_OBJECT;case m.INPUT_VALUE_DEFINITION:{const t=e[e.length-3];return"kind"in t||i(!1),t.kind===m.INPUT_OBJECT_TYPE_DEFINITION?h.INPUT_FIELD_DEFINITION:h.ARGUMENT_DEFINITION}default:i(!1,"Unexpected kind: "+Y(t.kind))}}(a);l&&!u.includes(l)&&e.reportError(new GraphQLError(`Directive "@${c}" may not be used on ${l}.`,n))}}}function dn(e){const t=e.getSchema(),n=t?t.getTypeMap():Object.create(null),i=Object.create(null);for(const t of e.getDocument().definitions)cn(t)&&(i[t.name.value]=!0);const r=[...Object.keys(n),...Object.keys(i)];return{NamedType(t,o,s,a,c){const u=t.name.value;if(!n[u]&&!i[u]){var l;const n=null!==(l=c[2])&&void 0!==l?l:s,i=null!=n&&("kind"in(p=n)&&(function(e){return e.kind===m.SCHEMA_DEFINITION||cn(e)||e.kind===m.DIRECTIVE_DEFINITION}(p)||function(e){return e.kind===m.SCHEMA_EXTENSION||un(e)}(p)));if(i&&fn.includes(u))return;const o=ae(u,i?fn.concat(r):r);e.reportError(new GraphQLError(`Unknown type "${u}".`+W(o),t))}var p}}}const fn=[...vt,...jt].map((e=>e.name));function hn(e){const t=[],n=[];return{OperationDefinition:e=>(t.push(e),!1),FragmentDefinition:e=>(n.push(e),!1),Document:{leave(){const i=Object.create(null);for(const n of t)for(const t of e.getRecursivelyReferencedFragments(n))i[t.name.value]=!0;for(const t of n){const n=t.name.value;!0!==i[n]&&e.reportError(new GraphQLError(`Fragment "${n}" is never used.`,t))}}}}}function mn(e,t){const n=[e];for(;Re(Be(n[n.length-1]));){const e=Ce(Be(n[n.length-1])).ofType;n.push(e)}if(t){const e=he(t,{RequiredDesignator:{leave({element:e}){if(e)return new GraphQLNonNull(Be(e));const t=n.pop();return new GraphQLNonNull(Be(t))}},OptionalDesignator:{leave({element:e}){if(e)return Be(e);return Be(n.pop())}},ListNullability:{leave({element:e}){let i=n.pop();if(Re(Be(i))||(i=n.pop()),!i)throw new GraphQLError("List nullability modifier is too deep.",t);const r=Ge(i);return e?r?new GraphQLNonNull(new GraphQLList(e)):new GraphQLList(e):i}}});if(n.length>0)throw new GraphQLError("List nullability modifier is too shallow.",t);return e}return e}function vn(e){switch(e.kind){case m.OBJECT:return{...e,fields:(t=e.fields,t.map((e=>({...e,value:vn(e.value)}))).sort(((e,t)=>ie(e.name.value,t.name.value))))};case m.LIST:return{...e,values:e.values.map(vn)};case m.INT:case m.FLOAT:case m.STRING:case m.BOOLEAN:case m.NULL:case m.ENUM:case m.VARIABLE:return e}var t}function yn(e){return Array.isArray(e)?e.map((([e,t])=>`subfields "${e}" conflict because `+yn(t))).join(" and "):e}function En(e,t,n,i,r,o,s){const a=e.getFragment(s);if(!a)return;const[c,u]=bn(e,n,a);if(o!==c){Nn(e,t,n,i,r,o,c);for(const a of u)i.has(a,s,r)||(i.add(a,s,r),En(e,t,n,i,r,o,a))}}function Tn(e,t,n,i,r,o,s){if(o===s)return;if(i.has(o,s,r))return;i.add(o,s,r);const a=e.getFragment(o),c=e.getFragment(s);if(!a||!c)return;const[u,l]=bn(e,n,a),[p,d]=bn(e,n,c);Nn(e,t,n,i,r,u,p);for(const s of d)Tn(e,t,n,i,r,o,s);for(const o of l)Tn(e,t,n,i,r,o,s)}function Nn(e,t,n,i,r,o,s){for(const[a,c]of Object.entries(o)){const o=s[a];if(o)for(const s of c)for(const c of o){const o=In(e,n,i,r,a,s,c);o&&t.push(o)}}}function In(e,t,n,i,r,o,s){const[a,c,u]=o,[l,p,d]=s,f=i||a!==l&&De(a)&&De(l);if(!f){const e=c.name.value,t=p.name.value;if(e!==t)return[[r,`"${e}" and "${t}" are different fields`],[c],[p]];if(gn(c)!==gn(p))return[[r,"they have differing arguments"],[c],[p]]}const h=null==u?void 0:u.type,m=null==d?void 0:d.type;if(h&&m){const e=mn(h,c.required),t=mn(m,p.required);if(_n(e,t))return[[r,`they return conflicting types "${Y(e)}" and "${Y(t)}"`],[c],[p]]}const v=c.selectionSet,y=p.selectionSet;if(v&&y){const i=function(e,t,n,i,r,o,s,a){const c=[],[u,l]=On(e,t,r,o),[p,d]=On(e,t,s,a);Nn(e,c,t,n,i,u,p);for(const r of d)En(e,c,t,n,i,u,r);for(const r of l)En(e,c,t,n,i,p,r);for(const r of l)for(const o of d)Tn(e,c,t,n,i,r,o);return c}(e,t,n,f,Je(h),v,Je(m),y);return function(e,t,n,i){if(e.length>0)return[[t,e.map((([e])=>e))],[n,...e.map((([,e])=>e)).flat()],[i,...e.map((([,,e])=>e)).flat()]]}(i,r,c,p)}}function gn(e){var t;const n=null!==(t=e.arguments)&&void 0!==t?t:[];return ye(vn({kind:m.OBJECT,fields:n.map((e=>({kind:m.OBJECT_FIELD,name:e.name,value:e.value})))}))}function _n(e,t){return Re(e)?!Re(t)||_n(e.ofType,t.ofType):!!Re(t)||(Ge(e)?!Ge(t)||_n(e.ofType,t.ofType):!!Ge(t)||!(!Ue(e)&&!Ue(t))&&e!==t)}function On(e,t,n,i){const r=t.get(i);if(r)return r;const o=Object.create(null),s=Object.create(null);Ln(e,n,i,o,s);const a=[o,Object.keys(s)];return t.set(i,a),a}function bn(e,t,n){const i=t.get(n.selectionSet);if(i)return i;const r=rn(e.getSchema(),n.typeCondition);return On(e,t,r,n.selectionSet)}function Ln(e,t,n,i,r){for(const o of n.selections)switch(o.kind){case m.FIELD:{const e=o.name.value;let n;(De(t)||we(t))&&(n=t.getFields()[e]);const r=o.alias?o.alias.value:e;i[r]||(i[r]=[]),i[r].push([t,o,n]);break}case m.FRAGMENT_SPREAD:r[o.name.value]=!0;break;case m.INLINE_FRAGMENT:{const n=o.typeCondition,s=n?rn(e.getSchema(),n):t;Ln(e,s,o.selectionSet,i,r);break}}}class PairSet{constructor(){this._data=new Map}has(e,t,n){var i;const[r,o]=ee.name));const o=e.getDocument().definitions;for(const e of o)if(e.kind===m.DIRECTIVE_DEFINITION){var s;const t=null!==(s=e.arguments)&&void 0!==s?s:[];n[e.name.value]=ee(t.filter(Dn),(e=>e.name.value))}return{Directive:{leave(t){const i=t.name.value,r=n[i];if(r){var o;const n=null!==(o=t.arguments)&&void 0!==o?o:[],s=new Set(n.map((e=>e.name.value)));for(const[n,o]of Object.entries(r))if(!s.has(n)){const r=Se(o.type)?Y(o.type):ye(o.type);e.reportError(new GraphQLError(`Directive "@${i}" argument "${n}" of type "${r}" is required, but it was not provided.`,t))}}}}}}function Dn(e){return e.type.kind===m.NON_NULL_TYPE&&null==e.defaultValue}function wn(e,t,n){if(e){if(e.kind===m.VARIABLE){const i=e.name.value;if(null==n||void 0===n[i])return;const r=n[i];if(null===r&&Ge(t))return;return r}if(Ge(t)){if(e.kind===m.NULL)return;return wn(e,t.ofType,n)}if(e.kind===m.NULL)return null;if(Re(t)){const i=t.ofType;if(e.kind===m.LIST){const t=[];for(const r of e.values)if(kn(r,n)){if(Ge(i))return;t.push(null)}else{const e=wn(r,i,n);if(void 0===e)return;t.push(e)}return t}const r=wn(e,i,n);if(void 0===r)return;return[r]}if(Fe(t)){if(e.kind!==m.OBJECT)return;const i=Object.create(null),r=ee(e.fields,(e=>e.name.value));for(const e of Object.values(t.getFields())){const t=r[e.name];if(!t||kn(t.value,n)){if(void 0!==e.defaultValue)i[e.name]=e.defaultValue;else if(Ge(e.type))return;continue}const o=wn(t.value,e.type,n);if(void 0===o)return;i[e.name]=o}return i}if(Ue(t)){let i;try{i=t.parseLiteral(e,n)}catch(e){return}if(void 0===i)return;return i}i(!1,"Unexpected input type: "+Y(t))}}function kn(e,t){return e.kind===m.VARIABLE&&(null==t||void 0===t[e.name.value])}function xn(e,t,n){var i;const r=null===(i=t.directives)||void 0===i?void 0:i.find((t=>t.name.value===e.name));if(r)return function(e,t,n){var i;const r={},o=ee(null!==(i=t.arguments)&&void 0!==i?i:[],(e=>e.name.value));for(const i of e.args){const e=i.name,c=i.type,u=o[e];if(!u){if(void 0!==i.defaultValue)r[e]=i.defaultValue;else if(Ge(c))throw new GraphQLError(`Argument "${e}" of required type "${Y(c)}" was not provided.`,t);continue}const l=u.value;let p=l.kind===m.NULL;if(l.kind===m.VARIABLE){const t=l.name.value;if(null==n||(s=n,a=t,!Object.prototype.hasOwnProperty.call(s,a))){if(void 0!==i.defaultValue)r[e]=i.defaultValue;else if(Ge(c))throw new GraphQLError(`Argument "${e}" of required type "${Y(c)}" was provided the variable "$${t}" which was not provided a runtime value.`,l);continue}p=null==n[t]}if(p&&Ge(c))throw new GraphQLError(`Argument "${e}" of non-null type "${Y(c)}" must not be null.`,l);const d=wn(l,c,n);if(void 0===d)throw new GraphQLError(`Argument "${e}" has invalid value ${ye(l)}.`,l);r[e]=d}var s,a;return r}(e,r,n)}function Fn(e,t,n,i,r){const o=new Map;return Rn(e,t,n,i,r,o,new Set),o}function Rn(e,t,n,i,r,o,s){for(const c of r.selections)switch(c.kind){case m.FIELD:{if(!Cn(n,c))continue;const e=(a=c).alias?a.alias.value:a.name.value,t=o.get(e);void 0!==t?t.push(c):o.set(e,[c]);break}case m.INLINE_FRAGMENT:if(!Cn(n,c)||!Gn(e,c,i))continue;Rn(e,t,n,i,c.selectionSet,o,s);break;case m.FRAGMENT_SPREAD:{const r=c.name.value;if(s.has(r)||!Cn(n,c))continue;s.add(r);const a=t[r];if(!a||!Gn(e,a,i))continue;Rn(e,t,n,i,a.selectionSet,o,s);break}}var a}function Cn(e,t){const n=xn(It,t,e);if(!0===(null==n?void 0:n.if))return!1;const i=xn(Nt,t,e);return!1!==(null==i?void 0:i.if)}function Gn(e,t,n){const i=t.typeCondition;if(!i)return!0;const r=rn(e,i);return r===n||!!Ve(r)&&e.isSubType(r,n)}function $n(e,t){const n=new Map;for(const i of e){const e=t(i),r=n.get(e);void 0===r?n.set(e,[i]):r.push(i)}return n}function Qn(e){return{Field:t,Directive:t};function t(t){var n;const i=$n(null!==(n=t.arguments)&&void 0!==n?n:[],(e=>e.name.value));for(const[t,n]of i)n.length>1&&e.reportError(new GraphQLError(`There can be only one argument named "${t}".`,n.map((e=>e.name))))}}function Un(e){const t=Object.create(null),n=e.getSchema(),i=n?n.getDirectives():bt;for(const e of i)t[e.name]=!e.isRepeatable;const r=e.getDocument().definitions;for(const e of r)e.kind===m.DIRECTIVE_DEFINITION&&(t[e.name.value]=!e.repeatable);const o=Object.create(null),s=Object.create(null);return{enter(n){if(!("directives"in n)||!n.directives)return;let i;if(n.kind===m.SCHEMA_DEFINITION||n.kind===m.SCHEMA_EXTENSION)i=o;else if(cn(n)||un(n)){const e=n.name.value;i=s[e],void 0===i&&(s[e]=i=Object.create(null))}else i=Object.create(null);for(const r of n.directives){const n=r.name.value;t[n]&&(i[n]?e.reportError(new GraphQLError(`The directive "@${n}" can only be used once at this location.`,[i[n],r])):i[n]=r)}}}}function jn(e,t){return!!(De(e)||we(e)||Fe(e))&&null!=e.getFields()[t]}function Vn(e){const t=[];let n=Object.create(null);return{ObjectValue:{enter(){t.push(n),n=Object.create(null)},leave(){const e=t.pop();e||i(!1),n=e}},ObjectField(t){const i=t.name.value;n[i]?e.reportError(new GraphQLError(`There can be only one input field named "${i}".`,[n[i],t.name])):n[i]=t.name}}}function Mn(e,t){const n=e.getInputType();if(!n)return;const i=Je(n);if(Ue(i))try{if(void 0===i.parseLiteral(t,void 0)){const i=Y(n);e.reportError(new GraphQLError(`Expected value of type "${i}", found ${ye(t)}.`,t))}}catch(i){const r=Y(n);i instanceof GraphQLError?e.reportError(i):e.reportError(new GraphQLError(`Expected value of type "${r}", found ${ye(t)}; `+i.message,t,void 0,void 0,void 0,i))}else{const i=Y(n);e.reportError(new GraphQLError(`Expected value of type "${i}", found ${ye(t)}.`,t))}}function Pn(e,t,n,i,r){if(Ge(i)&&!Ge(t)){if(!(null!=n&&n.kind!==m.NULL)&&!(void 0!==r))return!1;return at(e,t,i.ofType)}return at(e,t,i)}const Bn=Object.freeze([function(e){return{Document(t){for(const n of t.definitions)if(!an(n)){const t=n.kind===m.SCHEMA_DEFINITION||n.kind===m.SCHEMA_EXTENSION?"schema":'"'+n.name.value+'"';e.reportError(new GraphQLError(`The ${t} definition is not executable.`,n))}return!1}}},function(e){const t=Object.create(null);return{OperationDefinition(n){const i=n.name;return i&&(t[i.value]?e.reportError(new GraphQLError(`There can be only one operation named "${i.value}".`,[t[i.value],i])):t[i.value]=i),!1},FragmentDefinition:()=>!1}},function(e){let t=0;return{Document(e){t=e.definitions.filter((e=>e.kind===m.OPERATION_DEFINITION)).length},OperationDefinition(n){!n.name&&t>1&&e.reportError(new GraphQLError("This anonymous operation must be the only defined operation.",n))}}},function(e){return{OperationDefinition(t){if("subscription"===t.operation){const n=e.getSchema(),i=n.getSubscriptionType();if(i){const r=t.name?t.name.value:null,o=Object.create(null),s=e.getDocument(),a=Object.create(null);for(const e of s.definitions)e.kind===m.FRAGMENT_DEFINITION&&(a[e.name.value]=e);const c=Fn(n,a,o,i,t.selectionSet);if(c.size>1){const t=[...c.values()].slice(1).flat();e.reportError(new GraphQLError(null!=r?`Subscription "${r}" must select only one top level field.`:"Anonymous Subscription must select only one top level field.",t))}for(const t of c.values()){t[0].name.value.startsWith("__")&&e.reportError(new GraphQLError(null!=r?`Subscription "${r}" must not select an introspection top level field.`:"Anonymous Subscription must not select an introspection top level field.",t))}}}}}},dn,function(e){return{InlineFragment(t){const n=t.typeCondition;if(n){const t=rn(e.getSchema(),n);if(t&&!je(t)){const t=ye(n);e.reportError(new GraphQLError(`Fragment cannot condition on non composite type "${t}".`,n))}}},FragmentDefinition(t){const n=rn(e.getSchema(),t.typeCondition);if(n&&!je(n)){const n=ye(t.typeCondition);e.reportError(new GraphQLError(`Fragment "${t.name.value}" cannot condition on non composite type "${n}".`,t.typeCondition))}}}},function(e){return{VariableDefinition(t){const n=rn(e.getSchema(),t.type);if(void 0!==n&&!$e(n)){const n=t.variable.name.value,i=ye(t.type);e.reportError(new GraphQLError(`Variable "$${n}" cannot be non-input type "${i}".`,t.type))}}}},function(e){return{Field(t){const n=e.getType(),i=t.selectionSet;if(n)if(Ue(Je(n))){if(i){const r=t.name.value,o=Y(n);e.reportError(new GraphQLError(`Field "${r}" must not have a selection since type "${o}" has no subfields.`,i))}}else if(!i){const i=t.name.value,r=Y(n);e.reportError(new GraphQLError(`Field "${i}" of type "${r}" must have a selection of subfields. Did you mean "${i} { ... }"?`,t))}}}},function(e){return{Field(t){const n=e.getParentType();if(n){if(!e.getFieldDef()){const i=e.getSchema(),r=t.name.value;let o=W("to use an inline fragment on",function(e,t,n){if(!Ve(t))return[];const i=new Set,r=Object.create(null);for(const s of e.getPossibleTypes(t))if(s.getFields()[n]){i.add(s),r[s.name]=1;for(const e of s.getInterfaces()){var o;e.getFields()[n]&&(i.add(e),r[e.name]=(null!==(o=r[e.name])&&void 0!==o?o:0)+1)}}return[...i].sort(((t,n)=>{const i=r[n.name]-r[t.name];return 0!==i?i:we(t)&&e.isSubType(t,n)?-1:we(n)&&e.isSubType(n,t)?1:ie(t.name,n.name)})).map((e=>e.name))}(i,n,r));""===o&&(o=W(function(e,t){if(De(e)||we(e)){return ae(t,Object.keys(e.getFields()))}return[]}(n,r))),e.reportError(new GraphQLError(`Cannot query field "${r}" on type "${n.name}".`+o,t))}}}}},function(e){const t=Object.create(null);return{OperationDefinition:()=>!1,FragmentDefinition(n){const i=n.name.value;return t[i]?e.reportError(new GraphQLError(`There can be only one fragment named "${i}".`,[t[i],n.name])):t[i]=n.name,!1}}},function(e){return{FragmentSpread(t){const n=t.name.value;e.getFragment(n)||e.reportError(new GraphQLError(`Unknown fragment "${n}".`,t.name))}}},hn,function(e){return{InlineFragment(t){const n=e.getType(),i=e.getParentType();if(je(n)&&je(i)&&!ct(e.getSchema(),n,i)){const r=Y(i),o=Y(n);e.reportError(new GraphQLError(`Fragment cannot be spread here as objects of type "${r}" can never be of type "${o}".`,t))}},FragmentSpread(t){const n=t.name.value,i=function(e,t){const n=e.getFragment(t);if(n){const t=rn(e.getSchema(),n.typeCondition);if(je(t))return t}}(e,n),r=e.getParentType();if(i&&r&&!ct(e.getSchema(),i,r)){const o=Y(r),s=Y(i);e.reportError(new GraphQLError(`Fragment "${n}" cannot be spread here as objects of type "${o}" can never be of type "${s}".`,t))}}}},function(e){const t=Object.create(null),n=[],i=Object.create(null);return{OperationDefinition:()=>!1,FragmentDefinition:e=>(r(e),!1)};function r(o){if(t[o.name.value])return;const s=o.name.value;t[s]=!0;const a=e.getFragmentSpreads(o.selectionSet);if(0!==a.length){i[s]=n.length;for(const t of a){const o=t.name.value,s=i[o];if(n.push(t),void 0===s){const t=e.getFragment(o);t&&r(t)}else{const t=n.slice(s),i=t.slice(0,-1).map((e=>'"'+e.name.value+'"')).join(", ");e.reportError(new GraphQLError(`Cannot spread fragment "${o}" within itself`+(""!==i?` via ${i}.`:"."),t))}n.pop()}i[s]=void 0}}},function(e){return{OperationDefinition(t){var n;const i=$n(null!==(n=t.variableDefinitions)&&void 0!==n?n:[],(e=>e.variable.name.value));for(const[t,n]of i)n.length>1&&e.reportError(new GraphQLError(`There can be only one variable named "$${t}".`,n.map((e=>e.variable.name))))}}},function(e){let t=Object.create(null);return{OperationDefinition:{enter(){t=Object.create(null)},leave(n){const i=e.getRecursiveVariableUsages(n);for(const{node:r}of i){const i=r.name.value;!0!==t[i]&&e.reportError(new GraphQLError(n.name?`Variable "$${i}" is not defined by operation "${n.name.value}".`:`Variable "$${i}" is not defined.`,[r,n]))}}},VariableDefinition(e){t[e.variable.name.value]=!0}}},function(e){let t=[];return{OperationDefinition:{enter(){t=[]},leave(n){const i=Object.create(null),r=e.getRecursiveVariableUsages(n);for(const{node:e}of r)i[e.name.value]=!0;for(const r of t){const t=r.variable.name.value;!0!==i[t]&&e.reportError(new GraphQLError(n.name?`Variable "$${t}" is never used in operation "${n.name.value}".`:`Variable "$${t}" is never used.`,r))}}},VariableDefinition(e){t.push(e)}}},pn,Un,function(e){return{...ln(e),Argument(t){const n=e.getArgument(),i=e.getFieldDef(),r=e.getParentType();if(!n&&i&&r){const n=t.name.value,o=ae(n,i.args.map((e=>e.name)));e.reportError(new GraphQLError(`Unknown argument "${n}" on field "${r.name}.${i.name}".`+W(o),t))}}}},Qn,function(e){return{ListValue(t){if(!Re(Be(e.getParentInputType())))return Mn(e,t),!1},ObjectValue(t){const n=Je(e.getInputType());if(!Fe(n))return Mn(e,t),!1;const i=ee(t.fields,(e=>e.name.value));for(const r of Object.values(n.getFields())){if(!i[r.name]&&ot(r)){const i=Y(r.type);e.reportError(new GraphQLError(`Field "${n.name}.${r.name}" of required type "${i}" was not provided.`,t))}}},ObjectField(t){const n=Je(e.getParentInputType());if(!e.getInputType()&&Fe(n)){const i=ae(t.name.value,Object.keys(n.getFields()));e.reportError(new GraphQLError(`Field "${t.name.value}" is not defined by type "${n.name}".`+W(i),t))}},NullValue(t){const n=e.getInputType();Ge(n)&&e.reportError(new GraphQLError(`Expected value of type "${Y(n)}", found ${ye(t)}.`,t))},EnumValue:t=>Mn(e,t),IntValue:t=>Mn(e,t),FloatValue:t=>Mn(e,t),StringValue:t=>Mn(e,t),BooleanValue:t=>Mn(e,t)}},function(e){return{...An(e),Field:{leave(t){var n;const i=e.getFieldDef();if(!i)return!1;const r=new Set(null===(n=t.arguments)||void 0===n?void 0:n.map((e=>e.name.value)));for(const n of i.args)if(!r.has(n.name)&&tt(n)){const r=Y(n.type);e.reportError(new GraphQLError(`Field "${i.name}" argument "${n.name}" of type "${r}" is required, but it was not provided.`,t))}}}}},function(e){let t=Object.create(null);return{OperationDefinition:{enter(){t=Object.create(null)},leave(n){const i=e.getRecursiveVariableUsages(n);for(const{node:n,type:r,defaultValue:o}of i){const i=n.name.value,s=t[i];if(s&&r){const t=e.getSchema(),a=rn(t,s.type);if(a&&!Pn(t,a,s.defaultValue,r,o)){const t=Y(a),o=Y(r);e.reportError(new GraphQLError(`Variable "$${i}" of type "${t}" used in position expecting type "${o}".`,[s,n]))}}}}},VariableDefinition(e){t[e.variable.name.value]=e}}},function(e){return{Field(t){const n=e.getFieldDef(),i=t.required;if(n&&i){const r=function(e){let t=e,n=0;for(;Re(Be(t));){t=Ce(Be(t)).ofType,n+=1}return n}(n.type),o=he(i,{RequiredDesignator:{leave:({element:e})=>null!=e?e:0},OptionalDesignator:{leave:({element:e})=>null!=e?e:0},ListNullability:{leave:({element:e})=>(null!=e?e:0)+1}});r>o?e.reportError(new GraphQLError("List nullability modifier is too shallow.",t.required)):r1)for(let r=0;r0&&e.reportError(new GraphQLError("Must provide only one schema definition.",t)),++s)}}},function(e){const t=e.getSchema(),n=Object.create(null),i=t?{query:t.getQueryType(),mutation:t.getMutationType(),subscription:t.getSubscriptionType()}:{};return{SchemaDefinition:r,SchemaExtension:r};function r(t){var r;const o=null!==(r=t.operationTypes)&&void 0!==r?r:[];for(const t of o){const r=t.operation,o=n[r];i[r]?e.reportError(new GraphQLError(`Type for ${r} already defined in the schema. It cannot be redefined.`,t)):o?e.reportError(new GraphQLError(`There can be only one ${r} type in schema.`,[o,t])):n[r]=t}return!1}},function(e){const t=Object.create(null),n=e.getSchema();return{ScalarTypeDefinition:i,ObjectTypeDefinition:i,InterfaceTypeDefinition:i,UnionTypeDefinition:i,EnumTypeDefinition:i,InputObjectTypeDefinition:i};function i(i){const r=i.name.value;if(null==n||!n.getType(r))return t[r]?e.reportError(new GraphQLError(`There can be only one type named "${r}".`,[t[r],i.name])):t[r]=i.name,!1;e.reportError(new GraphQLError(`Type "${r}" already exists in the schema. It cannot also be defined in this type definition.`,i.name))}},function(e){const t=e.getSchema(),n=t?t.getTypeMap():Object.create(null),i=Object.create(null);return{EnumTypeDefinition:r,EnumTypeExtension:r};function r(t){var r;const o=t.name.value;i[o]||(i[o]=Object.create(null));const s=null!==(r=t.values)&&void 0!==r?r:[],a=i[o];for(const t of s){const i=t.name.value,r=n[o];xe(r)&&r.getValue(i)?e.reportError(new GraphQLError(`Enum value "${o}.${i}" already exists in the schema. It cannot also be defined in this type extension.`,t.name)):a[i]?e.reportError(new GraphQLError(`Enum value "${o}.${i}" can only be defined once.`,[a[i],t.name])):a[i]=t.name}return!1}},function(e){const t=e.getSchema(),n=t?t.getTypeMap():Object.create(null),i=Object.create(null);return{InputObjectTypeDefinition:r,InputObjectTypeExtension:r,InterfaceTypeDefinition:r,InterfaceTypeExtension:r,ObjectTypeDefinition:r,ObjectTypeExtension:r};function r(t){var r;const o=t.name.value;i[o]||(i[o]=Object.create(null));const s=null!==(r=t.fields)&&void 0!==r?r:[],a=i[o];for(const t of s){const i=t.name.value;jn(n[o],i)?e.reportError(new GraphQLError(`Field "${o}.${i}" already exists in the schema. It cannot also be defined in this type extension.`,t.name)):a[i]?e.reportError(new GraphQLError(`Field "${o}.${i}" can only be defined once.`,[a[i],t.name])):a[i]=t.name}return!1}},function(e){return{DirectiveDefinition(e){var t;const i=null!==(t=e.arguments)&&void 0!==t?t:[];return n(`@${e.name.value}`,i)},InterfaceTypeDefinition:t,InterfaceTypeExtension:t,ObjectTypeDefinition:t,ObjectTypeExtension:t};function t(e){var t;const i=e.name.value,r=null!==(t=e.fields)&&void 0!==t?t:[];for(const e of r){var o;n(`${i}.${e.name.value}`,null!==(o=e.arguments)&&void 0!==o?o:[])}return!1}function n(t,n){const i=$n(n,(e=>e.name.value));for(const[n,r]of i)r.length>1&&e.reportError(new GraphQLError(`Argument "${t}(${n}:)" can only be defined once.`,r.map((e=>e.name))));return!1}},function(e){const t=Object.create(null),n=e.getSchema();return{DirectiveDefinition(i){const r=i.name.value;if(null==n||!n.getDirective(r))return t[r]?e.reportError(new GraphQLError(`There can be only one directive named "@${r}".`,[t[r],i.name])):t[r]=i.name,!1;e.reportError(new GraphQLError(`Directive "@${r}" already exists in the schema. It cannot be redefined.`,i.name))}}},dn,pn,Un,function(e){const t=e.getSchema(),n=Object.create(null);for(const t of e.getDocument().definitions)cn(t)&&(n[t.name.value]=t);return{ScalarTypeExtension:r,ObjectTypeExtension:r,InterfaceTypeExtension:r,UnionTypeExtension:r,EnumTypeExtension:r,InputObjectTypeExtension:r};function r(r){const o=r.name.value,s=n[o],a=null==t?void 0:t.getType(o);let c;if(s?c=Sn[s.kind]:a&&(c=function(e){if(Ae(e))return m.SCALAR_TYPE_EXTENSION;if(De(e))return m.OBJECT_TYPE_EXTENSION;if(we(e))return m.INTERFACE_TYPE_EXTENSION;if(ke(e))return m.UNION_TYPE_EXTENSION;if(xe(e))return m.ENUM_TYPE_EXTENSION;if(Fe(e))return m.INPUT_OBJECT_TYPE_EXTENSION;i(!1,"Unexpected type: "+Y(e))}(a)),c){if(c!==r.kind){const t=function(e){switch(e){case m.SCALAR_TYPE_EXTENSION:return"scalar";case m.OBJECT_TYPE_EXTENSION:return"object";case m.INTERFACE_TYPE_EXTENSION:return"interface";case m.UNION_TYPE_EXTENSION:return"union";case m.ENUM_TYPE_EXTENSION:return"enum";case m.INPUT_OBJECT_TYPE_EXTENSION:return"input object";default:i(!1,"Unexpected kind: "+Y(e))}}(r.kind);e.reportError(new GraphQLError(`Cannot extend non-${t} type "${o}".`,s?[s,r]:r))}}else{const i=ae(o,Object.keys({...n,...null==t?void 0:t.getTypeMap()}));e.reportError(new GraphQLError(`Cannot extend type "${o}" because it is not defined.`+W(i),r.name))}}},ln,Qn,Vn,An]);class ASTValidationContext{constructor(e,t){this._ast=e,this._fragments=void 0,this._fragmentSpreads=new Map,this._recursivelyReferencedFragments=new Map,this._onError=t}get[Symbol.toStringTag](){return"ASTValidationContext"}reportError(e){this._onError(e)}getDocument(){return this._ast}getFragment(e){let t;if(this._fragments)t=this._fragments;else{t=Object.create(null);for(const e of this.getDocument().definitions)e.kind===m.FRAGMENT_DEFINITION&&(t[e.name.value]=e);this._fragments=t}return t[e]}getFragmentSpreads(e){let t=this._fragmentSpreads.get(e);if(!t){t=[];const n=[e];let i;for(;i=n.pop();)for(const e of i.selections)e.kind===m.FRAGMENT_SPREAD?t.push(e):e.selectionSet&&n.push(e.selectionSet);this._fragmentSpreads.set(e,t)}return t}getRecursivelyReferencedFragments(e){let t=this._recursivelyReferencedFragments.get(e);if(!t){t=[];const n=Object.create(null),i=[e.selectionSet];let r;for(;r=i.pop();)for(const e of this.getFragmentSpreads(r)){const r=e.name.value;if(!0!==n[r]){n[r]=!0;const e=this.getFragment(r);e&&(t.push(e),i.push(e.selectionSet))}}this._recursivelyReferencedFragments.set(e,t)}return t}}class SDLValidationContext extends ASTValidationContext{constructor(e,t,n){super(e,n),this._schema=t}get[Symbol.toStringTag](){return"SDLValidationContext"}getSchema(){return this._schema}}class ValidationContext extends ASTValidationContext{constructor(e,t,n,i){super(t,i),this._schema=e,this._typeInfo=n,this._variableUsages=new Map,this._recursiveVariableUsages=new Map}get[Symbol.toStringTag](){return"ValidationContext"}getSchema(){return this._schema}getVariableUsages(e){let t=this._variableUsages.get(e);if(!t){const n=[],i=new TypeInfo(this._schema);he(e,sn(i,{VariableDefinition:()=>!1,Variable(e){n.push({node:e,type:i.getInputType(),defaultValue:i.getDefaultValue()})}})),t=n,this._variableUsages.set(e,t)}return t}getRecursiveVariableUsages(e){let t=this._recursiveVariableUsages.get(e);if(!t){t=this.getVariableUsages(e);for(const n of this.getRecursivelyReferencedFragments(e))t=t.concat(this.getVariableUsages(n));this._recursiveVariableUsages.set(e,t)}return t}getType(){return this._typeInfo.getType()}getParentType(){return this._typeInfo.getParentType()}getInputType(){return this._typeInfo.getInputType()}getParentInputType(){return this._typeInfo.getParentInputType()}getFieldDef(){return this._typeInfo.getFieldDef()}getDirective(){return this._typeInfo.getDirective()}getArgument(){return this._typeInfo.getArgument()}getEnumValue(){return this._typeInfo.getEnumValue()}}function Jn(e,n,i=Bn,r,o=new TypeInfo(e)){var s;const a=null!==(s=null==r?void 0:r.maxErrors)&&void 0!==s?s:100;n||t(!1,"Must provide document."),function(e){const t=Bt(e);if(0!==t.length)throw new Error(t.map((e=>e.message)).join("\n\n"))}(e);const c=Object.freeze({}),u=[],l=new ValidationContext(e,n,o,(e=>{if(u.length>=a)throw u.push(new GraphQLError("Too many validation errors, error limit reached. Validation aborted.")),c;u.push(e)})),p=me(i.map((e=>e(l))));try{he(n,sn(o,p))}catch(e){if(e!==c)throw e}return u}function qn(e,t,n=Yn){const i=[],r=new SDLValidationContext(e,t,(e=>{i.push(e)}));return he(e,me(n.map((e=>e(r))))),i}function Kn(e,i){n(e)&&n(e.__schema)||t(!1,`Invalid or incomplete introspection result. Ensure that you are passing "data" property of introspection response and no "errors" was returned alongside: ${Y(e)}.`);const r=e.__schema,o=te(r.types,(e=>e.name),(e=>function(e){if(null!=e&&null!=e.name&&null!=e.kind)switch(e.kind){case Ct.SCALAR:return new GraphQLScalarType({name:(i=e).name,description:i.description,specifiedByURL:i.specifiedByURL});case Ct.OBJECT:return new GraphQLObjectType({name:(n=e).name,description:n.description,interfaces:()=>h(n),fields:()=>m(n)});case Ct.INTERFACE:return new GraphQLInterfaceType({name:(t=e).name,description:t.description,interfaces:()=>h(t),fields:()=>m(t)});case Ct.UNION:return function(e){if(!e.possibleTypes){const t=Y(e);throw new Error(`Introspection result missing possibleTypes: ${t}.`)}return new GraphQLUnionType({name:e.name,description:e.description,types:()=>e.possibleTypes.map(d)})}(e);case Ct.ENUM:return function(e){if(!e.enumValues){const t=Y(e);throw new Error(`Introspection result missing enumValues: ${t}.`)}return new GraphQLEnumType({name:e.name,description:e.description,values:te(e.enumValues,(e=>e.name),(e=>({description:e.description,deprecationReason:e.deprecationReason})))})}(e);case Ct.INPUT_OBJECT:return function(e){if(!e.inputFields){const t=Y(e);throw new Error(`Introspection result missing inputFields: ${t}.`)}return new GraphQLInputObjectType({name:e.name,description:e.description,fields:()=>E(e.inputFields)})}(e)}var t;var n;var i;const r=Y(e);throw new Error(`Invalid or incomplete introspection result. Ensure that a full introspection query is used in order to build a client schema: ${r}.`)}(e)));for(const e of[...vt,...jt])o[e.name]&&(o[e.name]=e);const s=r.queryType?d(r.queryType):null,a=r.mutationType?d(r.mutationType):null,c=r.subscriptionType?d(r.subscriptionType):null,u=r.directives?r.directives.map((function(e){if(!e.args){const t=Y(e);throw new Error(`Introspection result missing directive args: ${t}.`)}if(!e.locations){const t=Y(e);throw new Error(`Introspection result missing directive locations: ${t}.`)}return new GraphQLDirective({name:e.name,description:e.description,isRepeatable:e.isRepeatable,locations:e.locations.slice(),args:E(e.args)})})):[];return new GraphQLSchema({description:r.description,query:s,mutation:a,subscription:c,types:Object.values(o),directives:u,assumeValid:null==i?void 0:i.assumeValid});function l(e){if(e.kind===Ct.LIST){const t=e.ofType;if(!t)throw new Error("Decorated type deeper than introspection query.");return new GraphQLList(l(t))}if(e.kind===Ct.NON_NULL){const t=e.ofType;if(!t)throw new Error("Decorated type deeper than introspection query.");const n=l(t);return new GraphQLNonNull(function(e){if(!Pe(e))throw new Error(`Expected ${Y(e)} to be a GraphQL nullable type.`);return e}(n))}return p(e)}function p(e){const t=e.name;if(!t)throw new Error(`Unknown type reference: ${Y(e)}.`);const n=o[t];if(!n)throw new Error(`Invalid or incomplete schema, unknown type: ${t}. Ensure that a full introspection query is used in order to build a client schema.`);return n}function d(e){return function(e){if(!De(e))throw new Error(`Expected ${Y(e)} to be a GraphQL Object type.`);return e}(p(e))}function f(e){return function(e){if(!we(e))throw new Error(`Expected ${Y(e)} to be a GraphQL Interface type.`);return e}(p(e))}function h(e){if(null===e.interfaces&&e.kind===Ct.INTERFACE)return[];if(!e.interfaces){const t=Y(e);throw new Error(`Introspection result missing interfaces: ${t}.`)}return e.interfaces.map(f)}function m(e){if(!e.fields)throw new Error(`Introspection result missing fields: ${Y(e)}.`);return te(e.fields,(e=>e.name),y)}function y(e){const t=l(e.type);if(!Qe(t)){const e=Y(t);throw new Error(`Introspection must provide output type for fields, but received: ${e}.`)}if(!e.args){const t=Y(e);throw new Error(`Introspection result missing field args: ${t}.`)}return{description:e.description,deprecationReason:e.deprecationReason,type:t,args:E(e.args)}}function E(e){return te(e,(e=>e.name),T)}function T(e){const t=l(e.type);if(!$e(t)){const e=Y(t);throw new Error(`Introspection must provide input type for arguments, but received: ${e}.`)}const n=null!=e.defaultValue?wn(function(e,t){const n=new Parser(e,t);n.expectToken(v.SOF);const i=n.parseValueLiteral(!1);return n.expectToken(v.EOF),i}(e.defaultValue),t):void 0;return{description:e.description,type:t,defaultValue:n,deprecationReason:e.deprecationReason}}}function Xn(e,n,i){Mt(e),null!=n&&n.kind===m.DOCUMENT||t(!1,"Must provide valid Document AST."),!0!==(null==i?void 0:i.assumeValid)&&!0!==(null==i?void 0:i.assumeValidSDL)&&function(e,t){const n=qn(e,t);if(0!==n.length)throw new Error(n.map((e=>e.message)).join("\n\n"))}(n,e);const r=e.toConfig(),o=zn(r,n,i);return r===o?e:new GraphQLSchema(o)}function zn(e,t,n){var r,o,s,a;const c=[],u=Object.create(null),l=[];let p;const d=[];for(const e of t.definitions)if(e.kind===m.SCHEMA_DEFINITION)p=e;else if(e.kind===m.SCHEMA_EXTENSION)d.push(e);else if(cn(e))c.push(e);else if(un(e)){const t=e.name.value,n=u[t];u[t]=n?n.concat([e]):[e]}else e.kind===m.DIRECTIVE_DEFINITION&&l.push(e);if(0===Object.keys(u).length&&0===c.length&&0===l.length&&0===d.length&&null==p)return e;const f=Object.create(null);for(const t of e.types)f[t.name]=T(t);for(const e of c){var h;const t=e.name.value;f[t]=null!==(h=Hn[t])&&void 0!==h?h:k(e)}const v={query:e.query&&E(e.query),mutation:e.mutation&&E(e.mutation),subscription:e.subscription&&E(e.subscription),...p&&g([p]),...g(d)};return{description:null===(r=p)||void 0===r||null===(o=r.description)||void 0===o?void 0:o.value,...v,types:Object.values(f),directives:[...e.directives.map((function(e){const t=e.toConfig();return new GraphQLDirective({...t,args:ne(t.args,I)})})),...l.map((function(e){var t;return new GraphQLDirective({name:e.name.value,description:null===(t=e.description)||void 0===t?void 0:t.value,locations:e.locations.map((({value:e})=>e)),isRepeatable:e.repeatable,args:L(e.arguments),astNode:e})}))],extensions:Object.create(null),astNode:null!==(s=p)&&void 0!==s?s:e.astNode,extensionASTNodes:e.extensionASTNodes.concat(d),assumeValid:null!==(a=null==n?void 0:n.assumeValid)&&void 0!==a&&a};function y(e){return Re(e)?new GraphQLList(y(e.ofType)):Ge(e)?new GraphQLNonNull(y(e.ofType)):E(e)}function E(e){return f[e.name]}function T(e){return Vt(e)||yt(e)?e:Ae(e)?function(e){var t;const n=e.toConfig(),i=null!==(t=u[n.name])&&void 0!==t?t:[];let r=n.specifiedByURL;for(const e of i){var o;r=null!==(o=Zn(e))&&void 0!==o?o:r}return new GraphQLScalarType({...n,specifiedByURL:r,extensionASTNodes:n.extensionASTNodes.concat(i)})}(e):De(e)?function(e){var t;const n=e.toConfig(),i=null!==(t=u[n.name])&&void 0!==t?t:[];return new GraphQLObjectType({...n,interfaces:()=>[...e.getInterfaces().map(E),...D(i)],fields:()=>({...ne(n.fields,N),...b(i)}),extensionASTNodes:n.extensionASTNodes.concat(i)})}(e):we(e)?function(e){var t;const n=e.toConfig(),i=null!==(t=u[n.name])&&void 0!==t?t:[];return new GraphQLInterfaceType({...n,interfaces:()=>[...e.getInterfaces().map(E),...D(i)],fields:()=>({...ne(n.fields,N),...b(i)}),extensionASTNodes:n.extensionASTNodes.concat(i)})}(e):ke(e)?function(e){var t;const n=e.toConfig(),i=null!==(t=u[n.name])&&void 0!==t?t:[];return new GraphQLUnionType({...n,types:()=>[...e.getTypes().map(E),...w(i)],extensionASTNodes:n.extensionASTNodes.concat(i)})}(e):xe(e)?function(e){var t;const n=e.toConfig(),i=null!==(t=u[e.name])&&void 0!==t?t:[];return new GraphQLEnumType({...n,values:{...n.values,...A(i)},extensionASTNodes:n.extensionASTNodes.concat(i)})}(e):Fe(e)?function(e){var t;const n=e.toConfig(),i=null!==(t=u[n.name])&&void 0!==t?t:[];return new GraphQLInputObjectType({...n,fields:()=>({...ne(n.fields,(e=>({...e,type:y(e.type)}))),...S(i)}),extensionASTNodes:n.extensionASTNodes.concat(i)})}(e):void i(!1,"Unexpected type: "+Y(e))}function N(e){return{...e,type:y(e.type),args:e.args&&ne(e.args,I)}}function I(e){return{...e,type:y(e.type)}}function g(e){const t={};for(const i of e){var n;const e=null!==(n=i.operationTypes)&&void 0!==n?n:[];for(const n of e)t[n.operation]=_(n.type)}return t}function _(e){var t;const n=e.name.value,i=null!==(t=Hn[n])&&void 0!==t?t:f[n];if(void 0===i)throw new Error(`Unknown type: "${n}".`);return i}function O(e){return e.kind===m.LIST_TYPE?new GraphQLList(O(e.type)):e.kind===m.NON_NULL_TYPE?new GraphQLNonNull(O(e.type)):_(e)}function b(e){const t=Object.create(null);for(const r of e){var n;const e=null!==(n=r.fields)&&void 0!==n?n:[];for(const n of e){var i;t[n.name.value]={type:O(n.type),description:null===(i=n.description)||void 0===i?void 0:i.value,args:L(n.arguments),deprecationReason:Wn(n),astNode:n}}}return t}function L(e){const t=null!=e?e:[],n=Object.create(null);for(const e of t){var i;const t=O(e.type);n[e.name.value]={type:t,description:null===(i=e.description)||void 0===i?void 0:i.value,defaultValue:wn(e.defaultValue,t),deprecationReason:Wn(e),astNode:e}}return n}function S(e){const t=Object.create(null);for(const r of e){var n;const e=null!==(n=r.fields)&&void 0!==n?n:[];for(const n of e){var i;const e=O(n.type);t[n.name.value]={type:e,description:null===(i=n.description)||void 0===i?void 0:i.value,defaultValue:wn(n.defaultValue,e),deprecationReason:Wn(n),astNode:n}}}return t}function A(e){const t=Object.create(null);for(const r of e){var n;const e=null!==(n=r.values)&&void 0!==n?n:[];for(const n of e){var i;t[n.name.value]={description:null===(i=n.description)||void 0===i?void 0:i.value,deprecationReason:Wn(n),astNode:n}}}return t}function D(e){return e.flatMap((e=>{var t,n;return null!==(t=null===(n=e.interfaces)||void 0===n?void 0:n.map(_))&&void 0!==t?t:[]}))}function w(e){return e.flatMap((e=>{var t,n;return null!==(t=null===(n=e.types)||void 0===n?void 0:n.map(_))&&void 0!==t?t:[]}))}function k(e){var t;const n=e.name.value,i=null!==(t=u[n])&&void 0!==t?t:[];switch(e.kind){case m.OBJECT_TYPE_DEFINITION:{var r;const t=[e,...i];return new GraphQLObjectType({name:n,description:null===(r=e.description)||void 0===r?void 0:r.value,interfaces:()=>D(t),fields:()=>b(t),astNode:e,extensionASTNodes:i})}case m.INTERFACE_TYPE_DEFINITION:{var o;const t=[e,...i];return new GraphQLInterfaceType({name:n,description:null===(o=e.description)||void 0===o?void 0:o.value,interfaces:()=>D(t),fields:()=>b(t),astNode:e,extensionASTNodes:i})}case m.ENUM_TYPE_DEFINITION:{var s;const t=[e,...i];return new GraphQLEnumType({name:n,description:null===(s=e.description)||void 0===s?void 0:s.value,values:A(t),astNode:e,extensionASTNodes:i})}case m.UNION_TYPE_DEFINITION:{var a;const t=[e,...i];return new GraphQLUnionType({name:n,description:null===(a=e.description)||void 0===a?void 0:a.value,types:()=>w(t),astNode:e,extensionASTNodes:i})}case m.SCALAR_TYPE_DEFINITION:var c;return new GraphQLScalarType({name:n,description:null===(c=e.description)||void 0===c?void 0:c.value,specifiedByURL:Zn(e),astNode:e,extensionASTNodes:i});case m.INPUT_OBJECT_TYPE_DEFINITION:{var l;const t=[e,...i];return new GraphQLInputObjectType({name:n,description:null===(l=e.description)||void 0===l?void 0:l.value,fields:()=>S(t),astNode:e,extensionASTNodes:i})}}}}const Hn=ee([...vt,...jt],(e=>e.name));function Wn(e){const t=xn(_t,e);return null==t?void 0:t.reason}function Zn(e){const t=xn(Ot,e);return null==t?void 0:t.url}function ei(e,n){null!=e&&e.kind===m.DOCUMENT||t(!1,"Must provide valid Document AST."),!0!==(null==n?void 0:n.assumeValid)&&!0!==(null==n?void 0:n.assumeValidSDL)&&function(e){const t=qn(e);if(0!==t.length)throw new Error(t.map((e=>e.message)).join("\n\n"))}(e);const i=zn({description:void 0,types:[],directives:[],extensions:Object.create(null),extensionASTNodes:[],assumeValid:!1},e,n);if(null==i.astNode)for(const e of i.types)switch(e.name){case"Query":i.query=e;break;case"Mutation":i.mutation=e;break;case"Subscription":i.subscription=e}const r=[...i.directives,...bt.filter((e=>i.directives.every((t=>t.name!==e.name))))];return new GraphQLSchema({...i,directives:r})}function ti(e){return function(e,t,n){const r=e.getDirectives().filter(t),o=Object.values(e.getTypeMap()).filter(n);return[ii(e),...r.map((e=>function(e){return li(e)+"directive @"+e.name+ai(e.args)+(e.isRepeatable?" repeatable":"")+" on "+e.locations.join(" | ")}(e))),...o.map((e=>function(e){if(Ae(e))return function(e){return li(e)+`scalar ${e.name}`+function(e){if(null==e.specifiedByURL)return"";return` @specifiedBy(url: ${ye({kind:m.STRING,value:e.specifiedByURL})})`}(e)}(e);if(De(e))return function(e){return li(e)+`type ${e.name}`+ri(e)+oi(e)}(e);if(we(e))return function(e){return li(e)+`interface ${e.name}`+ri(e)+oi(e)}(e);if(ke(e))return function(e){const t=e.getTypes(),n=t.length?" = "+t.join(" | "):"";return li(e)+"union "+e.name+n}(e);if(xe(e))return function(e){const t=e.getValues().map(((e,t)=>li(e," ",!t)+" "+e.name+ui(e.deprecationReason)));return li(e)+`enum ${e.name}`+si(t)}(e);if(Fe(e))return function(e){const t=Object.values(e.getFields()).map(((e,t)=>li(e," ",!t)+" "+ci(e)));return li(e)+`input ${e.name}`+si(t)}(e);i(!1,"Unexpected type: "+Y(e))}(e)))].filter(Boolean).join("\n\n")}(e,(e=>{return t=e,!bt.some((({name:e})=>e===t.name));var t}),ni)}function ni(e){return!yt(e)&&!Vt(e)}function ii(e){if(null==e.description&&function(e){const t=e.getQueryType();if(t&&"Query"!==t.name)return!1;const n=e.getMutationType();if(n&&"Mutation"!==n.name)return!1;const i=e.getSubscriptionType();if(i&&"Subscription"!==i.name)return!1;return!0}(e))return;const t=[],n=e.getQueryType();n&&t.push(` query: ${n.name}`);const i=e.getMutationType();i&&t.push(` mutation: ${i.name}`);const r=e.getSubscriptionType();return r&&t.push(` subscription: ${r.name}`),li(e)+`schema {\n${t.join("\n")}\n}`}function ri(e){const t=e.getInterfaces();return t.length?" implements "+t.map((e=>e.name)).join(" & "):""}function oi(e){return si(Object.values(e.getFields()).map(((e,t)=>li(e," ",!t)+" "+e.name+ai(e.args," ")+": "+String(e.type)+ui(e.deprecationReason))))}function si(e){return 0!==e.length?" {\n"+e.join("\n")+"\n}":""}function ai(e,t=""){return 0===e.length?"":e.every((e=>!e.description))?"("+e.map(ci).join(", ")+")":"(\n"+e.map(((e,n)=>li(e," "+t,!n)+" "+t+ci(e))).join("\n")+"\n"+t+")"}function ci(e){const t=Lt(e.defaultValue,e.type);let n=e.name+": "+String(e.type);return t&&(n+=` = ${ye(t)}`),n+ui(e.deprecationReason)}function ui(e){if(null==e)return"";if(e!==gt){return` @deprecated(reason: ${ye({kind:m.STRING,value:e})})`}return" @deprecated"}function li(e,t="",n=!0){const{description:i}=e;if(null==i)return"";return(t&&!n?"\n"+t:t)+ye({kind:m.STRING,value:i,block:O(i)}).replace(/\n/g,"\n"+t)+"\n"}function pi(e){const t=[];for(const n of e)t.push(...n.definitions);return{kind:m.DOCUMENT,definitions:t}}const di=[hn];function fi(e){var t;const n=function(e){if(e)return function(t){const n=e;return{Field(e){var i;const r=(null!==(i=e.alias)&&void 0!==i?i:e.name).value,o=r.charAt(0).toLowerCase()+r.slice(1);n.includes(o)&&t.reportError(new GraphQLError(`Field name "${r}" is not allowed because it conflicts with generated object APIs. Please use an alias to change the field name.`,{nodes:e}))}}};return}(null===(t=e.disallowedFieldNames)||void 0===t?void 0:t.allFields),i=function(e){if(e)return function(t){const n=e;return{VariableDefinition(e){const i=e.variable.name.value,r=i.charAt(0).toLowerCase()+i.slice(1);n.includes(r)&&t.reportError(new GraphQLError(`Input Parameter name "${i}" is not allowed because it conflicts with generated object APIs.`,{nodes:e}))}}};return}(e.disallowedInputParameterNames);return[hi,mi,...n?[n]:[],...i?[i]:[],...Bn.filter((e=>!di.includes(e)))]}function hi(e){return{OperationDefinition:t=>(t.name||e.reportError(new GraphQLError("Apollo does not support anonymous operations because operation names are used during code generation. Please give this operation a name.",t)),!1)}}function mi(e){return{Field(t){"__typename"==(t.alias&&t.alias.value)&&e.reportError(new GraphQLError("Apollo needs to be able to insert __typename when needed, so using it as an alias is not supported.",t))}}}const vi={kind:m.DIRECTIVE_DEFINITION,description:(yi="A directive used by the Apollo iOS client to annotate operations or fragments that should be used exclusively for generating local cache mutations instead of as standard operations.",{kind:m.STRING,value:yi}),name:Ei("apollo_client_ios_localCacheMutation"),repeatable:!1,locations:[Ei("QUERY"),Ei("MUTATION"),Ei("SUBSCRIPTION"),Ei("FRAGMENT_DEFINITION")]};var yi;function Ei(e){return{kind:m.NAME,value:e}}const Ti={kind:m.DOCUMENT,definitions:[vi]};const Ni={kind:m.FIELD,name:{kind:m.NAME,value:"__typename"}};class GraphQLSchemaValidationError extends Error{constructor(e){super(e.map((e=>e.message)).join("\n\n")),this.validationErrors=e,this.name="GraphQLSchemaValidationError"}}function Ii(e){return e.startsWith("__")}const gi={kind:m.FIELD,name:{kind:m.NAME,value:"__typename"}};function _i(e,t){return t&&(e=function(e){return he(e,{enter:e=>e.kind!==m.SELECTION_SET?void 0:{...e,selections:e.selections.filter((e=>!("Field"===e.kind&&"__typename"===e.name.value)))},leave(e){if((e.kind===m.FIELD||e.kind===m.FRAGMENT_DEFINITION||e.kind===m.INLINE_FRAGMENT)&&e.selectionSet)return{...e,selectionSet:{...e.selectionSet,selections:[Ni,...e.selectionSet.selections]}}}})}(e)),he(e,{SelectionSet:{leave:(e,t,n)=>d(n)&&![m.FIELD,m.FRAGMENT_DEFINITION].includes(n.kind)?e:function(e){const t=e.selections.find((e=>e.kind==gi.kind&&e.name.value==gi.name.value));return t?e:{...e,selections:[gi,...e.selections]}}(e)},Field:{enter:e=>function(e){return e.name.value==gi.name.value?{...e,alias:void 0,directives:void 0}:e}(e)},Directive:{enter:e=>function(e){return e.name.value==vi.name.value?null:e}(e)}})}function Oi(e){return null!=e}function bi(e){switch(e.kind){case m.VARIABLE:return{kind:e.kind,value:e.name.value};case m.LIST:return{kind:e.kind,value:e.values.map(bi)};case m.OBJECT:return{kind:e.kind,value:e.fields.reduce(((e,t)=>(e[t.name.value]=bi(t.value),e)),{})};default:return e}}function Li(e){var t,n;return null===(n=null===(t=e.loc)||void 0===t?void 0:t.source)||void 0===n?void 0:n.name}function Si(e,t,n,i){var r,o,s;const a=new Map;for(const e of t.definitions)e.kind===m.FRAGMENT_DEFINITION&&a.set(e.name.value,e);const c=[],u=new Map,l=new Set,p=e.getQueryType();if(void 0===p)throw new GraphQLError("GraphQL Schema must contain a 'query' root type definition.",{});const d={queryType:p,mutationType:null!==(r=e.getMutationType())&&void 0!==r?r:void 0,subscriptionType:null!==(o=e.getSubscriptionType())&&void 0!==o?o:void 0};for(const e of t.definitions)e.kind===m.OPERATION_DEFINITION&&c.push(h(e));for(const[e,t]of a.entries())u.set(e,v(t));return{rootTypes:d,operations:c,fragments:Array.from(u.values()),referencedTypes:Array.from(l.values()),schemaDocumentation:null!==(s=e.description)&&void 0!==s?s:void 0};function f(t){if(!l.has(t)){if(l.add(t),we(t))for(const n of e.getPossibleTypes(t))f(Je(n));if(ke(t)){const e=t.getTypes();for(t of e)f(Je(t))}if(Fe(t)&&function(e){const t=e.getFields();for(const e in t){f(Je(t[e].type))}}(t),De(t))for(const e of t.getInterfaces())f(Je(e))}}function h(t){var i;if(!t.name)throw new GraphQLError("Operations should be named",{nodes:t});const r=Li(t),o=t.name.value,s=t.operation,a=(t.variableDefinitions||[]).map((t=>{const n=t.variable.name.value,i=t.defaultValue?bi(t.defaultValue):void 0,r=rn(e,t.type);if(!r)throw new GraphQLError(`Couldn't get type from type node "${t.type}"`,{nodes:t});return f(Je(r)),{name:n,type:r,defaultValue:i}})),c=ye(_i(t,n)),u=e.getRootType(s),[l]=null!==(i=T(t.directives))&&void 0!==i?i:[void 0,void 0];return f(u),{name:o,operationType:s,variables:a,rootType:u,selectionSet:y(t.selectionSet,u),directives:l,source:c,filePath:r}}function v(t){var i;const r=t.name.value,o=Li(t),s=ye(_i(t,n)),a=rn(e,t.typeCondition),[c]=null!==(i=T(t.directives))&&void 0!==i?i:[void 0,void 0];return f(Je(a)),{name:r,filePath:o,source:s,typeCondition:a,selectionSet:y(t.selectionSet,a),directives:c}}function y(t,n){return{parentType:n,selections:t.selections.map((t=>function(t,n){var r,o,s,c;const[l,p]=null!==(r=T(t.directives))&&void 0!==r?r:[void 0,void 0];switch(t.kind){case m.FIELD:{const d=t.name.value;if("__typename"==d)return;const h=null===(o=t.alias)||void 0===o?void 0:o.value,N=function(e,t,n){return n===$t.name&&e.getQueryType()===t?$t:n===Qt.name&&e.getQueryType()===t?Qt:n===Ut.name&&(De(t)||we(t)||ke(t))?Ut:De(t)||we(t)?t.getFields()[n]:void 0}(e,n,d);if(!N)throw new GraphQLError(`Cannot query field "${d}" on type "${String(n)}"`,{nodes:t});const I=mn(N.type,t.required),g=Je(I);f(Je(g));const{description:_,deprecationReason:O}=N;let b={kind:"Field",name:d,alias:h,type:I,arguments:E(N,t.arguments),inclusionConditions:p,description:!Ii(d)&&_?_:void 0,deprecationReason:O||void 0,directives:l};function L(e,t,n){var i;if(t&&n){const r=(null!==(i=e.alias)&&void 0!==i?i:e.name).value,o=r.charAt(0).toLowerCase()+r.slice(1);if(null==t?void 0:t.includes(o))throw new GraphQLError(`Schema name "${n}" conflicts with name of a generated object API. Please choose a different schema name. Suggestions: "${n}Schema", "${n}GraphQL", "${n}API"`,{nodes:e})}}if(Re(I)||Ge(I)&&Re(I.ofType)?L(t,null===(s=i.disallowedFieldNames)||void 0===s?void 0:s.entityList,i.schemaNamespace):je(g)&&L(t,null===(c=i.disallowedFieldNames)||void 0===c?void 0:c.entity,i.schemaNamespace),je(g)){const S=t.selectionSet;if(!S)throw new GraphQLError(`Composite field "${d}" on type "${String(n)}" requires selection set`,{nodes:t});b.selectionSet=y(S,g)}return b}case m.INLINE_FRAGMENT:{const A=t.typeCondition,D=A?rn(e,A):n;return f(D),{kind:"InlineFragment",selectionSet:y(t.selectionSet,D),inclusionConditions:p,directives:l}}case m.FRAGMENT_SPREAD:{const w=t.name.value,k=function(e){let t=u.get(e);if(t)return t;const n=a.get(e);return n?(a.delete(e),t=v(n),u.set(e,t),t):void 0}(w);if(!k)throw new GraphQLError(`Unknown fragment "${w}".`,{nodes:t.name});return{kind:"FragmentSpread",fragment:k,inclusionConditions:p,directives:l}}}}(t,n))).filter(Oi)}}function E(...e){const t=e[0].args;return e[1]&&e[1].length>0?e[1].map((e=>{var n;const i=e.name.value,r=t.find((t=>t.name===e.name.value)),o=null==r?void 0:r.type;if(!o)throw new GraphQLError(`Cannot find directive argument type for argument "${i}".`,{nodes:[e]});return{name:i,value:bi(e.value),type:o,deprecationReason:null!==(n=r.deprecationReason)&&void 0!==n?n:void 0}})):void 0}function T(t){if(t&&t.length>0){const n=[],i=[];for(const r of t){const t=r.name.value,o=e.getDirective(t);if(!o)throw new GraphQLError(`Cannot find directive "${t}".`,{nodes:r});n.push({name:t,arguments:E(o,r.arguments)});const s=N(r,o);s&&i.push(s)}return[n,i.length>0?i:void 0]}}function N(e,t){var n;if("include"==t.name||"skip"==t.name){const i=null===(n=e.arguments)||void 0===n?void 0:n[0].value,r="skip"==t.name;switch(null==i?void 0:i.kind){case m.BOOLEAN:return r?i.value?"SKIPPED":"INCLUDED":i.value?"INCLUDED":"SKIPPED";case m.VARIABLE:return{variable:i.name.value,isInverted:r};default:throw new GraphQLError('Conditional inclusion directive has invalid "if" argument.',{nodes:e})}}}}return e.GraphQLEnumType=GraphQLEnumType,e.GraphQLError=GraphQLError,e.GraphQLInputObjectType=GraphQLInputObjectType,e.GraphQLInterfaceType=GraphQLInterfaceType,e.GraphQLObjectType=GraphQLObjectType,e.GraphQLScalarType=GraphQLScalarType,e.GraphQLSchema=GraphQLSchema,e.GraphQLSchemaValidationError=GraphQLSchemaValidationError,e.GraphQLUnionType=GraphQLUnionType,e.Source=Source,e.compileDocument=function(e,t,n,i){return Si(e,t,n,i)},e.loadSchemaFromSources=function(e){var t,n=new Array;for(const i of e)if(i.name.endsWith(".json")){if(t)throw new Error(`Schema search paths can only include one JSON schema definition.\n Found "${t.name} & "${i.name}".`);t=i}else n.push(K(i));var i=function(e){return e.definitions.some((e=>e.kind==m.DIRECTIVE_DEFINITION&&e.name.value==vi.name.value))?e:pi([e,Ti])}(pi(n));t||function(e){const t=qn(e);if(0!==t.length)throw new GraphQLSchemaValidationError(t)}(i);const r=t?Xn(function(e){let t=JSON.parse(e);t.data&&(t=t.data);const n=Kn(t);return n}(t.body),i,{assumeValid:!0,assumeValidSDL:!0}):ei(i,{assumeValid:!0,assumeValidSDL:!0});return function(e){const t=Bt(e);if(0!==t.length)throw new GraphQLSchemaValidationError(t)}(r),r},e.mergeDocuments=function(e){return pi(e)},e.parseOperationDocument=function(e,t){return K(e,{experimentalClientControlledNullability:t})},e.printSchemaToSDL=function(e){return ti(e)},e.validateDocument=function(e,t,n){return Jn(e,t,fi(n))},Object.defineProperty(e,"__esModule",{value:!0}),e}({});"# \ No newline at end of file diff --git a/Sources/ApolloCodegenLib/Frontend/CompilationResult.swift b/Sources/ApolloCodegenLib/Frontend/CompilationResult.swift index 9aa647b56c..360fbbbdff 100644 --- a/Sources/ApolloCodegenLib/Frontend/CompilationResult.swift +++ b/Sources/ApolloCodegenLib/Frontend/CompilationResult.swift @@ -15,23 +15,6 @@ public class CompilationResult: JavaScriptObject { lazy var schemaDocumentation: String? = self["schemaDocumentation"] - required init(_ jsValue: JSValue, bridge: JavaScriptBridge) { - super.init(jsValue, bridge: bridge) - processRootTypes() - } - - private func processRootTypes() { - let typeList = [rootTypes.queryType.name, rootTypes.mutationType?.name, rootTypes.subscriptionType?.name].compactMap { $0 } - - operations.forEach { op in - op.rootType.isRootFieldType = typeList.contains(op.rootType.name) - } - - fragments.forEach { fragment in - fragment.type.isRootFieldType = typeList.contains(fragment.type.name) - } - } - public class RootTypeDefinition: JavaScriptObject { lazy var queryType: GraphQLNamedType = self["queryType"] diff --git a/Sources/ApolloCodegenLib/Frontend/JavaScript/src/compiler/index.ts b/Sources/ApolloCodegenLib/Frontend/JavaScript/src/compiler/index.ts index 76d02ddb84..49d888988f 100644 --- a/Sources/ApolloCodegenLib/Frontend/JavaScript/src/compiler/index.ts +++ b/Sources/ApolloCodegenLib/Frontend/JavaScript/src/compiler/index.ts @@ -72,10 +72,15 @@ export function compileToIR( const fragmentMap = new Map(); const referencedTypes = new Set(); + const queryType = schema.getQueryType() as GraphQLNamedType; + if (queryType === undefined) { + throw new GraphQLError("GraphQL Schema must contain a 'query' root type definition.", { }); + } + const rootTypes: ir.RootTypeDefinition = { - queryType: schema.getQueryType(), - mutationType: schema.getMutationType(), - subscriptionType: schema.getSubscriptionType() + queryType: queryType, + mutationType: schema.getMutationType() ?? undefined, + subscriptionType: schema.getSubscriptionType() ?? undefined }; for (const definitionNode of document.definitions) { diff --git a/Sources/ApolloCodegenLib/Frontend/JavaScript/src/compiler/ir.ts b/Sources/ApolloCodegenLib/Frontend/JavaScript/src/compiler/ir.ts index 27a6cf65ac..a876933a1d 100644 --- a/Sources/ApolloCodegenLib/Frontend/JavaScript/src/compiler/ir.ts +++ b/Sources/ApolloCodegenLib/Frontend/JavaScript/src/compiler/ir.ts @@ -9,9 +9,9 @@ import { import { GraphQLValue } from "./values"; export interface RootTypeDefinition { - queryType: GraphQLNamedType | unknown; - mutationType: GraphQLNamedType | unknown; - subscriptionType: GraphQLNamedType | unknown; + queryType: GraphQLNamedType; + mutationType: GraphQLNamedType | undefined; + subscriptionType: GraphQLNamedType | undefined; } export interface OperationDefinition { diff --git a/Sources/ApolloCodegenLib/IR/IR.swift b/Sources/ApolloCodegenLib/IR/IR.swift index 5e9674e989..c9daa2da8b 100644 --- a/Sources/ApolloCodegenLib/IR/IR.swift +++ b/Sources/ApolloCodegenLib/IR/IR.swift @@ -17,6 +17,20 @@ class IR { referencedTypes: .init(compilationResult.referencedTypes), documentation: compilationResult.schemaDocumentation ) + self.processRootTypes() + } + + private func processRootTypes() { + let rootTypes = compilationResult.rootTypes + let typeList = [rootTypes.queryType.name, rootTypes.mutationType?.name, rootTypes.subscriptionType?.name].compactMap { $0 } + + compilationResult.operations.forEach { op in + op.rootType.isRootFieldType = typeList.contains(op.rootType.name) + } + + compilationResult.fragments.forEach { fragment in + fragment.type.isRootFieldType = typeList.contains(fragment.type.name) + } } /// A top level GraphQL definition, which can be an operation or a named fragment. diff --git a/Tests/ApolloCodegenInternalTestHelpers/MockCompilationResult.swift b/Tests/ApolloCodegenInternalTestHelpers/MockCompilationResult.swift index 768287beca..215b857609 100644 --- a/Tests/ApolloCodegenInternalTestHelpers/MockCompilationResult.swift +++ b/Tests/ApolloCodegenInternalTestHelpers/MockCompilationResult.swift @@ -2,8 +2,11 @@ public extension CompilationResult { - class func mock() -> Self { + class func mock( + rootTypes: RootTypeDefinition = RootTypeDefinition.mock() + ) -> Self { let mock = Self.emptyMockObject() + mock.rootTypes = rootTypes mock.referencedTypes = [] mock.fragments = [] mock.operations = [] @@ -12,6 +15,22 @@ public extension CompilationResult { } +public extension CompilationResult.RootTypeDefinition { + + class func mock( + queryName: String = "Query", + mutationName: String = "Mutation", + subscriptionName: String = "Subscription" + ) -> Self { + let mock = Self.emptyMockObject() + mock.queryType = GraphQLCompositeType.mock(queryName) + mock.mutationType = GraphQLCompositeType.mock(mutationName) + mock.subscriptionType = GraphQLCompositeType.mock(subscriptionName) + return mock + } + +} + public extension CompilationResult.OperationDefinition { class func mock( diff --git a/Tests/ApolloCodegenInternalTestHelpers/MockGraphQLType.swift b/Tests/ApolloCodegenInternalTestHelpers/MockGraphQLType.swift index f67f004873..db100ce335 100644 --- a/Tests/ApolloCodegenInternalTestHelpers/MockGraphQLType.swift +++ b/Tests/ApolloCodegenInternalTestHelpers/MockGraphQLType.swift @@ -12,7 +12,6 @@ public extension GraphQLCompositeType { } } - public extension GraphQLObjectType { class override func mock( _ name: String = "" diff --git a/Tests/ApolloCodegenTests/CodeGeneration/Templates/SelectionSet/SelectionSetTemplateTests.swift b/Tests/ApolloCodegenTests/CodeGeneration/Templates/SelectionSet/SelectionSetTemplateTests.swift index a049adb932..19b3da91b3 100644 --- a/Tests/ApolloCodegenTests/CodeGeneration/Templates/SelectionSet/SelectionSetTemplateTests.swift +++ b/Tests/ApolloCodegenTests/CodeGeneration/Templates/SelectionSet/SelectionSetTemplateTests.swift @@ -367,19 +367,18 @@ class SelectionSetTemplateTests: XCTestCase { """ let expected = """ - public static var __selections: [Apollo.Selection] { [ + public static var __selections: [ApolloAPI.Selection] { [ .field("allAnimals", [AllAnimal]?.self), ] } """ // when - try buildSubjectAndOperation(cocoapodsImportStatements: true) + try buildSubjectAndOperation() let allAnimals = try XCTUnwrap( operation[field: "query"] as? IR.EntityField ) let actual = subject.render(field: allAnimals) - print("Actual Output - \(actual)") // then expect(actual).to(equalLineByLine(expected, atLine: 7, ignoringExtraLines: true))