@medplum/fhir-router 2.0.5 → 2.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.cjs +2 -2
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.min.cjs +1 -1
- package/dist/cjs/index.min.cjs.map +1 -1
- package/dist/esm/index.min.mjs +1 -1
- package/dist/esm/index.min.mjs.map +1 -1
- package/dist/esm/index.mjs +3 -3
- package/dist/esm/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/esm/index.min.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{OperationOutcomeError as e,badRequest as t,normalizeOperationOutcome as n,parseSearchUrl as i,getStatus as r,isOk as s,getReferenceString as o,allOk as a,LRUCache as c,forbidden as u,getResourceTypes as l,getResourceTypeSchema as p,isResourceType as d,getElementDefinition as f,buildTypeName as h,capitalize as m,getSearchParameters as y,Operator as v,parseSearchRequest as T,notFound as E,created as N,deepClone as g,matchesSearchRequest as I,globalSchema as b,evalFhirPath as _}from"@medplum/core";import O from"dataloader";import{applyPatch as S}from"rfc6902";function w(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)}function A(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n}var D,x,k,R,F,L,$,C,V,U;class j{constructor(e,t,n){this.router=e,this.repo=t,this.bundle=n,D.add(this),x.set(this,void 0),A(this,x,{},"f")}async processBatch(){const i=this.bundle.type;if(!i)throw new e(t("Missing bundle type"));if("batch"!==i&&"transaction"!==i)throw new e(t("Unrecognized bundle type"));const r=this.bundle.entry;if(!r)throw new e(t("Missing bundle entry"));const s=[];for(const e of r){const t=w(this,D,"m",V).call(this,e);try{s.push(await w(this,D,"m",k).call(this,t))}catch(e){s.push(M(n(e)))}}return{resourceType:"Bundle",type:"batch-response",entry:s}}}function M(e,t){return{response:{outcome:e,status:r(e).toString(),location:s(e)&&t?.id?o(t):void 0},resource:t}}function P(e,t){if(!Boolean(e))throw new Error(t)}function B(e){return"function"==typeof(null==e?void 0:e.then)}function G(e){return"object"==typeof e&&null!==e}function J(e,t){if(!Boolean(e))throw new Error(null!=t?t:"Unexpected invariant triggered.")}x=new WeakMap,D=new WeakSet,k=async function(e){w(this,D,"m",R).call(this,e);const n=e.request;if(e.resource?.resourceType&&n.ifNoneExist){const r=`https://example.com/${e.resource.resourceType}`,s=new URL("?"+n.ifNoneExist,r),o=(await this.repo.search(i(s)))?.entry;if(o.length>1)return M(t("Multiple matches"));if(1===o.length){const t=o[0].resource;return e.fullUrl&&w(this,D,"m",L).call(this,e.fullUrl,t),M(a,t)}}let r=e.resource;"PATCH"===n.method&&(r=w(this,D,"m",F).call(this,e));const s=new URL(n.url,"https://example.com/"),o=await this.router.handleRequest({method:n.method,pathname:s.pathname,params:Object.create(null),query:Object.fromEntries(s.searchParams),body:r},this.repo);return e.fullUrl&&2===o.length&&w(this,D,"m",L).call(this,e.fullUrl,o[1]),M(o[0],o[1])},R=function(n){if(!n.request)throw new e(t("Missing entry.request"));if(!n.request.method)throw new e(t("Missing entry.request.method"));if(!n.request.url)throw new e(t("Missing entry.request.url"))},F=function(n){const i=n.resource;if(!i)throw new e(t("Missing entry.resource"));if("Binary"!==i.resourceType)throw new e(t("Patch resource must be a Binary"));if(!i.data)throw new e(t("Missing entry.resource.data"));return JSON.parse(Buffer.from(i.data,"base64").toString("utf8"))},L=function(e,t){e?.startsWith("urn:uuid:")&&(w(this,x,"f")[e]=t)},$=function(e){return Array.isArray(e)?w(this,D,"m",C).call(this,e):"string"==typeof e?w(this,D,"m",U).call(this,e):"object"==typeof e?w(this,D,"m",V).call(this,e):e},C=function(e){return e.map((e=>w(this,D,"m",$).call(this,e)))},V=function(e){return Object.fromEntries(Object.entries(e).map((([e,t])=>[e,w(this,D,"m",$).call(this,t)])))},U=function(e){const t=e.match(/urn:uuid:\w{8}-\w{4}-\w{4}-\w{4}-\w{12}/);if(t){const n=t[0],i=w(this,x,"f")[n];if(i)return e.replaceAll(n,o(i))}return e};const Y=/\r\n|[\n\r]/g;function Q(e,t){let n=0,i=1;for(const r of e.body.matchAll(Y)){if("number"==typeof r.index||J(!1),r.index>=t)break;n=r.index+r[0].length,i+=1}return{line:i,column:t+1-n}}function q(e,t){const n=e.locationOffset.column-1,i="".padStart(n)+e.body,r=t.line-1,s=e.locationOffset.line-1,o=t.line+s,a=1===t.line?n:0,c=t.column+a,u=`${e.name}:${o}:${c}\n`,l=i.split(/\r\n|[\n\r]/g),p=l[r];if(p.length>120){const e=Math.floor(c/80),t=c%80,n=[];for(let e=0;e<p.length;e+=80)n.push(p.slice(e,e+80));return u+K([[`${o} |`,n[0]],...n.slice(1,e+1).map((e=>["|",e])),["|","^".padStart(t)],["|",n[e+1]]])}return u+K([[o-1+" |",l[r-1]],[`${o} |`,p],["|","^".padStart(c)],[`${o+1} |`,l[r+1]]])}function K(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 z extends Error{constructor(e,...t){var n,i,r;const{nodes:s,source:o,positions:a,path:c,originalError:u,extensions:l}=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!=c?c:void 0,this.originalError=null!=u?u:void 0,this.nodes=X(Array.isArray(s)?s:s?[s]:void 0);const p=X(null===(n=this.nodes)||void 0===n?void 0:n.map((e=>e.loc)).filter((e=>null!=e)));this.source=null!=o?o:null==p||null===(i=p[0])||void 0===i?void 0:i.source,this.positions=null!=a?a:null==p?void 0:p.map((e=>e.start)),this.locations=a&&o?a.map((e=>Q(o,e))):null==p?void 0:p.map((e=>Q(e.source,e.start)));const d=G(null==u?void 0:u.extensions)?null==u?void 0:u.extensions:void 0;this.extensions=null!==(r=null!=l?l:d)&&void 0!==r?r: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!=u&&u.stack?Object.defineProperty(this,"stack",{value:u.stack,writable:!0,configurable:!0}):Error.captureStackTrace?Error.captureStackTrace(this,z):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"+q((t=n.loc).source,Q(t.source,t.start)));else if(this.source&&this.locations)for(const t of this.locations)e+="\n\n"+q(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 X(e){return void 0===e||0===e.length?void 0:e}function H(e,t,n){return new z(`Syntax Error: ${n}`,{source:e,positions:[t]})}class W{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 Z{constructor(e,t,n,i,r,s){this.kind=e,this.start=t,this.end=n,this.line=i,this.column=r,this.value=s,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 ee={Name:[],Document:["definitions"],OperationDefinition:["name","variableDefinitions","directives","selectionSet"],VariableDefinition:["variable","type","defaultValue","directives"],Variable:["name"],SelectionSet:["selections"],Field:["alias","name","arguments","directives","selectionSet"],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"]},te=new Set(Object.keys(ee));function ne(e){const t=null==e?void 0:e.kind;return"string"==typeof t&&te.has(t)}var ie,re,se,oe;function ae(e){return 9===e||32===e}function ce(e){return e>=48&&e<=57}function ue(e){return e>=97&&e<=122||e>=65&&e<=90}function le(e){return ue(e)||95===e}function pe(e){return ue(e)||ce(e)||95===e}function de(e){var t;let n=Number.MAX_SAFE_INTEGER,i=null,r=-1;for(let t=0;t<e.length;++t){var s;const o=e[t],a=fe(o);a!==o.length&&(i=null!==(s=i)&&void 0!==s?s:t,r=t,0!==t&&a<n&&(n=a))}return e.map(((e,t)=>0===t?e:e.slice(n))).slice(null!==(t=i)&&void 0!==t?t:0,r+1)}function fe(e){let t=0;for(;t<e.length&&ae(e.charCodeAt(t));)++t;return t}!function(e){e.QUERY="query",e.MUTATION="mutation",e.SUBSCRIPTION="subscription"}(ie||(ie={})),function(e){e.QUERY="QUERY",e.MUTATION="MUTATION",e.SUBSCRIPTION="SUBSCRIPTION",e.FIELD="FIELD",e.FRAGMENT_DEFINITION="FRAGMENT_DEFINITION",e.FRAGMENT_SPREAD="FRAGMENT_SPREAD",e.INLINE_FRAGMENT="INLINE_FRAGMENT",e.VARIABLE_DEFINITION="VARIABLE_DEFINITION",e.SCHEMA="SCHEMA",e.SCALAR="SCALAR",e.OBJECT="OBJECT",e.FIELD_DEFINITION="FIELD_DEFINITION",e.ARGUMENT_DEFINITION="ARGUMENT_DEFINITION",e.INTERFACE="INTERFACE",e.UNION="UNION",e.ENUM="ENUM",e.ENUM_VALUE="ENUM_VALUE",e.INPUT_OBJECT="INPUT_OBJECT",e.INPUT_FIELD_DEFINITION="INPUT_FIELD_DEFINITION"}(re||(re={})),function(e){e.NAME="Name",e.DOCUMENT="Document",e.OPERATION_DEFINITION="OperationDefinition",e.VARIABLE_DEFINITION="VariableDefinition",e.SELECTION_SET="SelectionSet",e.FIELD="Field",e.ARGUMENT="Argument",e.FRAGMENT_SPREAD="FragmentSpread",e.INLINE_FRAGMENT="InlineFragment",e.FRAGMENT_DEFINITION="FragmentDefinition",e.VARIABLE="Variable",e.INT="IntValue",e.FLOAT="FloatValue",e.STRING="StringValue",e.BOOLEAN="BooleanValue",e.NULL="NullValue",e.ENUM="EnumValue",e.LIST="ListValue",e.OBJECT="ObjectValue",e.OBJECT_FIELD="ObjectField",e.DIRECTIVE="Directive",e.NAMED_TYPE="NamedType",e.LIST_TYPE="ListType",e.NON_NULL_TYPE="NonNullType",e.SCHEMA_DEFINITION="SchemaDefinition",e.OPERATION_TYPE_DEFINITION="OperationTypeDefinition",e.SCALAR_TYPE_DEFINITION="ScalarTypeDefinition",e.OBJECT_TYPE_DEFINITION="ObjectTypeDefinition",e.FIELD_DEFINITION="FieldDefinition",e.INPUT_VALUE_DEFINITION="InputValueDefinition",e.INTERFACE_TYPE_DEFINITION="InterfaceTypeDefinition",e.UNION_TYPE_DEFINITION="UnionTypeDefinition",e.ENUM_TYPE_DEFINITION="EnumTypeDefinition",e.ENUM_VALUE_DEFINITION="EnumValueDefinition",e.INPUT_OBJECT_TYPE_DEFINITION="InputObjectTypeDefinition",e.DIRECTIVE_DEFINITION="DirectiveDefinition",e.SCHEMA_EXTENSION="SchemaExtension",e.SCALAR_TYPE_EXTENSION="ScalarTypeExtension",e.OBJECT_TYPE_EXTENSION="ObjectTypeExtension",e.INTERFACE_TYPE_EXTENSION="InterfaceTypeExtension",e.UNION_TYPE_EXTENSION="UnionTypeExtension",e.ENUM_TYPE_EXTENSION="EnumTypeExtension",e.INPUT_OBJECT_TYPE_EXTENSION="InputObjectTypeExtension"}(se||(se={})),function(e){e.SOF="<SOF>",e.EOF="<EOF>",e.BANG="!",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"}(oe||(oe={}));class he{constructor(e){const t=new Z(oe.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!==oe.EOF)do{if(e.next)e=e.next;else{const t=ge(this,e.end);e.next=t,t.prev=e,e=t}}while(e.kind===oe.COMMENT);return e}}function me(e){return e>=0&&e<=55295||e>=57344&&e<=1114111}function ye(e,t){return ve(e.charCodeAt(t))&&Te(e.charCodeAt(t+1))}function ve(e){return e>=55296&&e<=56319}function Te(e){return e>=56320&&e<=57343}function Ee(e,t){const n=e.source.body.codePointAt(t);if(void 0===n)return oe.EOF;if(n>=32&&n<=126){const e=String.fromCodePoint(n);return'"'===e?"'\"'":`"${e}"`}return"U+"+n.toString(16).toUpperCase().padStart(4,"0")}function Ne(e,t,n,i,r){const s=e.line,o=1+n-e.lineStart;return new Z(t,n,i,s,o,r)}function ge(e,t){const n=e.source.body,i=n.length;let r=t;for(;r<i;){const t=n.charCodeAt(r);switch(t){case 65279:case 9:case 32:case 44:++r;continue;case 10:++r,++e.line,e.lineStart=r;continue;case 13:10===n.charCodeAt(r+1)?r+=2:++r,++e.line,e.lineStart=r;continue;case 35:return Ie(e,r);case 33:return Ne(e,oe.BANG,r,r+1);case 36:return Ne(e,oe.DOLLAR,r,r+1);case 38:return Ne(e,oe.AMP,r,r+1);case 40:return Ne(e,oe.PAREN_L,r,r+1);case 41:return Ne(e,oe.PAREN_R,r,r+1);case 46:if(46===n.charCodeAt(r+1)&&46===n.charCodeAt(r+2))return Ne(e,oe.SPREAD,r,r+3);break;case 58:return Ne(e,oe.COLON,r,r+1);case 61:return Ne(e,oe.EQUALS,r,r+1);case 64:return Ne(e,oe.AT,r,r+1);case 91:return Ne(e,oe.BRACKET_L,r,r+1);case 93:return Ne(e,oe.BRACKET_R,r,r+1);case 123:return Ne(e,oe.BRACE_L,r,r+1);case 124:return Ne(e,oe.PIPE,r,r+1);case 125:return Ne(e,oe.BRACE_R,r,r+1);case 34:return 34===n.charCodeAt(r+1)&&34===n.charCodeAt(r+2)?ke(e,r):Oe(e,r)}if(ce(t)||45===t)return be(e,r,t);if(le(t))return Re(e,r);throw H(e.source,r,39===t?"Unexpected single quote character ('), did you mean to use a double quote (\")?":me(t)||ye(n,r)?`Unexpected character: ${Ee(e,r)}.`:`Invalid character: ${Ee(e,r)}.`)}return Ne(e,oe.EOF,i,i)}function Ie(e,t){const n=e.source.body,i=n.length;let r=t+1;for(;r<i;){const e=n.charCodeAt(r);if(10===e||13===e)break;if(me(e))++r;else{if(!ye(n,r))break;r+=2}}return Ne(e,oe.COMMENT,t,r,n.slice(t+1,r))}function be(e,t,n){const i=e.source.body;let r=t,s=n,o=!1;if(45===s&&(s=i.charCodeAt(++r)),48===s){if(s=i.charCodeAt(++r),ce(s))throw H(e.source,r,`Invalid number, unexpected digit after 0: ${Ee(e,r)}.`)}else r=_e(e,r,s),s=i.charCodeAt(r);if(46===s&&(o=!0,s=i.charCodeAt(++r),r=_e(e,r,s),s=i.charCodeAt(r)),69!==s&&101!==s||(o=!0,s=i.charCodeAt(++r),43!==s&&45!==s||(s=i.charCodeAt(++r)),r=_e(e,r,s),s=i.charCodeAt(r)),46===s||le(s))throw H(e.source,r,`Invalid number, expected digit but got: ${Ee(e,r)}.`);return Ne(e,o?oe.FLOAT:oe.INT,t,r,i.slice(t,r))}function _e(e,t,n){if(!ce(n))throw H(e.source,t,`Invalid number, expected digit but got: ${Ee(e,t)}.`);const i=e.source.body;let r=t+1;for(;ce(i.charCodeAt(r));)++r;return r}function Oe(e,t){const n=e.source.body,i=n.length;let r=t+1,s=r,o="";for(;r<i;){const i=n.charCodeAt(r);if(34===i)return o+=n.slice(s,r),Ne(e,oe.STRING,t,r+1,o);if(92!==i){if(10===i||13===i)break;if(me(i))++r;else{if(!ye(n,r))throw H(e.source,r,`Invalid character within String: ${Ee(e,r)}.`);r+=2}}else{o+=n.slice(s,r);const t=117===n.charCodeAt(r+1)?123===n.charCodeAt(r+2)?Se(e,r):we(e,r):xe(e,r);o+=t.value,r+=t.size,s=r}}throw H(e.source,r,"Unterminated string.")}function Se(e,t){const n=e.source.body;let i=0,r=3;for(;r<12;){const e=n.charCodeAt(t+r++);if(125===e){if(r<5||!me(i))break;return{value:String.fromCodePoint(i),size:r}}if(i=i<<4|De(e),i<0)break}throw H(e.source,t,`Invalid Unicode escape sequence: "${n.slice(t,t+r)}".`)}function we(e,t){const n=e.source.body,i=Ae(n,t+2);if(me(i))return{value:String.fromCodePoint(i),size:6};if(ve(i)&&92===n.charCodeAt(t+6)&&117===n.charCodeAt(t+7)){const e=Ae(n,t+8);if(Te(e))return{value:String.fromCodePoint(i,e),size:12}}throw H(e.source,t,`Invalid Unicode escape sequence: "${n.slice(t,t+6)}".`)}function Ae(e,t){return De(e.charCodeAt(t))<<12|De(e.charCodeAt(t+1))<<8|De(e.charCodeAt(t+2))<<4|De(e.charCodeAt(t+3))}function De(e){return e>=48&&e<=57?e-48:e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:-1}function xe(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 H(e.source,t,`Invalid character escape sequence: "${n.slice(t,t+2)}".`)}function ke(e,t){const n=e.source.body,i=n.length;let r=e.lineStart,s=t+3,o=s,a="";const c=[];for(;s<i;){const i=n.charCodeAt(s);if(34===i&&34===n.charCodeAt(s+1)&&34===n.charCodeAt(s+2)){a+=n.slice(o,s),c.push(a);const i=Ne(e,oe.BLOCK_STRING,t,s+3,de(c).join("\n"));return e.line+=c.length-1,e.lineStart=r,i}if(92!==i||34!==n.charCodeAt(s+1)||34!==n.charCodeAt(s+2)||34!==n.charCodeAt(s+3))if(10!==i&&13!==i)if(me(i))++s;else{if(!ye(n,s))throw H(e.source,s,`Invalid character within String: ${Ee(e,s)}.`);s+=2}else a+=n.slice(o,s),c.push(a),13===i&&10===n.charCodeAt(s+1)?s+=2:++s,a="",o=s,r=s;else a+=n.slice(o,s),o=s+1,s+=4}throw H(e.source,s,"Unterminated string.")}function Re(e,t){const n=e.source.body,i=n.length;let r=t+1;for(;r<i;){if(!pe(n.charCodeAt(r)))break;++r}return Ne(e,oe.NAME,t,r,n.slice(t,r))}const Fe=10,Le=2;function $e(e){return Ce(e,[])}function Ce(e,t){switch(typeof e){case"string":return JSON.stringify(e);case"function":return e.name?`[function ${e.name}]`:"[function]";case"object":return function(e,t){if(null===e)return"null";if(t.includes(e))return"[Circular]";const n=[...t,e];if(function(e){return"function"==typeof e.toJSON}(e)){const t=e.toJSON();if(t!==e)return"string"==typeof t?t:Ce(t,n)}else if(Array.isArray(e))return function(e,t){if(0===e.length)return"[]";if(t.length>Le)return"[Array]";const n=Math.min(Fe,e.length),i=e.length-n,r=[];for(let i=0;i<n;++i)r.push(Ce(e[i],t));1===i?r.push("... 1 more item"):i>1&&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>Le)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+": "+Ce(n,t)));return"{ "+i.join(", ")+" }"}(e,n)}(e,t);default:return String(e)}}const Ve="production"===process.env.NODE_ENV?function(e,t){return e instanceof t}:function(e,t){if(e instanceof t)return!0;if("object"==typeof e&&null!==e){var n;const i=t.prototype[Symbol.toStringTag];if(i===(Symbol.toStringTag in e?e[Symbol.toStringTag]:null===(n=e.constructor)||void 0===n?void 0:n.name)){const t=$e(e);throw new Error(`Cannot use ${i} "${t}" from another module or realm.\n\nEnsure that there is only one instance of "graphql" in the node_modules\ndirectory. If different versions of "graphql" are the dependencies of other\nrelied on modules, use "resolutions" to ensure only one version is installed.\n\nhttps://yarnpkg.com/en/docs/selective-version-resolutions\n\nDuplicate "graphql" modules cannot be used at the same time since different\nversions may have different capabilities and behavior. The data from one\nversion used in the function from another could produce confusing and\nspurious results.`)}}return!1};class Ue{constructor(e,t="GraphQL request",n={line:1,column:1}){"string"==typeof e||P(!1,`Body must be a string. Received: ${$e(e)}.`),this.body=e,this.name=t,this.locationOffset=n,this.locationOffset.line>0||P(!1,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||P(!1,"column in locationOffset is 1-indexed and must be positive.")}get[Symbol.toStringTag](){return"Source"}}class je{constructor(e,t={}){const n=function(e){return Ve(e,Ue)}(e)?e:new Ue(e);this._lexer=new he(n),this._options=t,this._tokenCounter=0}parseName(){const e=this.expectToken(oe.NAME);return this.node(e,{kind:se.NAME,value:e.value})}parseDocument(){return this.node(this._lexer.token,{kind:se.DOCUMENT,definitions:this.many(oe.SOF,this.parseDefinition,oe.EOF)})}parseDefinition(){if(this.peek(oe.BRACE_L))return this.parseOperationDefinition();const e=this.peekDescription(),t=e?this._lexer.lookahead():this._lexer.token;if(t.kind===oe.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 H(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(oe.BRACE_L))return this.node(e,{kind:se.OPERATION_DEFINITION,operation:ie.QUERY,name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet()});const t=this.parseOperationType();let n;return this.peek(oe.NAME)&&(n=this.parseName()),this.node(e,{kind:se.OPERATION_DEFINITION,operation:t,name:n,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseOperationType(){const e=this.expectToken(oe.NAME);switch(e.value){case"query":return ie.QUERY;case"mutation":return ie.MUTATION;case"subscription":return ie.SUBSCRIPTION}throw this.unexpected(e)}parseVariableDefinitions(){return this.optionalMany(oe.PAREN_L,this.parseVariableDefinition,oe.PAREN_R)}parseVariableDefinition(){return this.node(this._lexer.token,{kind:se.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(oe.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(oe.EQUALS)?this.parseConstValueLiteral():void 0,directives:this.parseConstDirectives()})}parseVariable(){const e=this._lexer.token;return this.expectToken(oe.DOLLAR),this.node(e,{kind:se.VARIABLE,name:this.parseName()})}parseSelectionSet(){return this.node(this._lexer.token,{kind:se.SELECTION_SET,selections:this.many(oe.BRACE_L,this.parseSelection,oe.BRACE_R)})}parseSelection(){return this.peek(oe.SPREAD)?this.parseFragment():this.parseField()}parseField(){const e=this._lexer.token,t=this.parseName();let n,i;return this.expectOptionalToken(oe.COLON)?(n=t,i=this.parseName()):i=t,this.node(e,{kind:se.FIELD,alias:n,name:i,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(oe.BRACE_L)?this.parseSelectionSet():void 0})}parseArguments(e){const t=e?this.parseConstArgument:this.parseArgument;return this.optionalMany(oe.PAREN_L,t,oe.PAREN_R)}parseArgument(e=!1){const t=this._lexer.token,n=this.parseName();return this.expectToken(oe.COLON),this.node(t,{kind:se.ARGUMENT,name:n,value:this.parseValueLiteral(e)})}parseConstArgument(){return this.parseArgument(!0)}parseFragment(){const e=this._lexer.token;this.expectToken(oe.SPREAD);const t=this.expectOptionalKeyword("on");return!t&&this.peek(oe.NAME)?this.node(e,{kind:se.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1)}):this.node(e,{kind:se.INLINE_FRAGMENT,typeCondition:t?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentDefinition(){const e=this._lexer.token;return this.expectKeyword("fragment"),!0===this._options.allowLegacyFragmentVariables?this.node(e,{kind:se.FRAGMENT_DEFINITION,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()}):this.node(e,{kind:se.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 oe.BRACKET_L:return this.parseList(e);case oe.BRACE_L:return this.parseObject(e);case oe.INT:return this.advanceLexer(),this.node(t,{kind:se.INT,value:t.value});case oe.FLOAT:return this.advanceLexer(),this.node(t,{kind:se.FLOAT,value:t.value});case oe.STRING:case oe.BLOCK_STRING:return this.parseStringLiteral();case oe.NAME:switch(this.advanceLexer(),t.value){case"true":return this.node(t,{kind:se.BOOLEAN,value:!0});case"false":return this.node(t,{kind:se.BOOLEAN,value:!1});case"null":return this.node(t,{kind:se.NULL});default:return this.node(t,{kind:se.ENUM,value:t.value})}case oe.DOLLAR:if(e){if(this.expectToken(oe.DOLLAR),this._lexer.token.kind===oe.NAME){const e=this._lexer.token.value;throw H(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.advanceLexer(),this.node(e,{kind:se.STRING,value:e.value,block:e.kind===oe.BLOCK_STRING})}parseList(e){return this.node(this._lexer.token,{kind:se.LIST,values:this.any(oe.BRACKET_L,(()=>this.parseValueLiteral(e)),oe.BRACKET_R)})}parseObject(e){return this.node(this._lexer.token,{kind:se.OBJECT,fields:this.any(oe.BRACE_L,(()=>this.parseObjectField(e)),oe.BRACE_R)})}parseObjectField(e){const t=this._lexer.token,n=this.parseName();return this.expectToken(oe.COLON),this.node(t,{kind:se.OBJECT_FIELD,name:n,value:this.parseValueLiteral(e)})}parseDirectives(e){const t=[];for(;this.peek(oe.AT);)t.push(this.parseDirective(e));return t}parseConstDirectives(){return this.parseDirectives(!0)}parseDirective(e){const t=this._lexer.token;return this.expectToken(oe.AT),this.node(t,{kind:se.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(e)})}parseTypeReference(){const e=this._lexer.token;let t;if(this.expectOptionalToken(oe.BRACKET_L)){const n=this.parseTypeReference();this.expectToken(oe.BRACKET_R),t=this.node(e,{kind:se.LIST_TYPE,type:n})}else t=this.parseNamedType();return this.expectOptionalToken(oe.BANG)?this.node(e,{kind:se.NON_NULL_TYPE,type:t}):t}parseNamedType(){return this.node(this._lexer.token,{kind:se.NAMED_TYPE,name:this.parseName()})}peekDescription(){return this.peek(oe.STRING)||this.peek(oe.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(oe.BRACE_L,this.parseOperationTypeDefinition,oe.BRACE_R);return this.node(e,{kind:se.SCHEMA_DEFINITION,description:t,directives:n,operationTypes:i})}parseOperationTypeDefinition(){const e=this._lexer.token,t=this.parseOperationType();this.expectToken(oe.COLON);const n=this.parseNamedType();return this.node(e,{kind:se.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:se.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(),s=this.parseFieldsDefinition();return this.node(e,{kind:se.OBJECT_TYPE_DEFINITION,description:t,name:n,interfaces:i,directives:r,fields:s})}parseImplementsInterfaces(){return this.expectOptionalKeyword("implements")?this.delimitedMany(oe.AMP,this.parseNamedType):[]}parseFieldsDefinition(){return this.optionalMany(oe.BRACE_L,this.parseFieldDefinition,oe.BRACE_R)}parseFieldDefinition(){const e=this._lexer.token,t=this.parseDescription(),n=this.parseName(),i=this.parseArgumentDefs();this.expectToken(oe.COLON);const r=this.parseTypeReference(),s=this.parseConstDirectives();return this.node(e,{kind:se.FIELD_DEFINITION,description:t,name:n,arguments:i,type:r,directives:s})}parseArgumentDefs(){return this.optionalMany(oe.PAREN_L,this.parseInputValueDef,oe.PAREN_R)}parseInputValueDef(){const e=this._lexer.token,t=this.parseDescription(),n=this.parseName();this.expectToken(oe.COLON);const i=this.parseTypeReference();let r;this.expectOptionalToken(oe.EQUALS)&&(r=this.parseConstValueLiteral());const s=this.parseConstDirectives();return this.node(e,{kind:se.INPUT_VALUE_DEFINITION,description:t,name:n,type:i,defaultValue:r,directives:s})}parseInterfaceTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("interface");const n=this.parseName(),i=this.parseImplementsInterfaces(),r=this.parseConstDirectives(),s=this.parseFieldsDefinition();return this.node(e,{kind:se.INTERFACE_TYPE_DEFINITION,description:t,name:n,interfaces:i,directives:r,fields:s})}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:se.UNION_TYPE_DEFINITION,description:t,name:n,directives:i,types:r})}parseUnionMemberTypes(){return this.expectOptionalToken(oe.EQUALS)?this.delimitedMany(oe.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:se.ENUM_TYPE_DEFINITION,description:t,name:n,directives:i,values:r})}parseEnumValuesDefinition(){return this.optionalMany(oe.BRACE_L,this.parseEnumValueDefinition,oe.BRACE_R)}parseEnumValueDefinition(){const e=this._lexer.token,t=this.parseDescription(),n=this.parseEnumValueName(),i=this.parseConstDirectives();return this.node(e,{kind:se.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 H(this._lexer.source,this._lexer.token.start,`${Me(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:se.INPUT_OBJECT_TYPE_DEFINITION,description:t,name:n,directives:i,fields:r})}parseInputFieldsDefinition(){return this.optionalMany(oe.BRACE_L,this.parseInputValueDef,oe.BRACE_R)}parseTypeSystemExtension(){const e=this._lexer.lookahead();if(e.kind===oe.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(oe.BRACE_L,this.parseOperationTypeDefinition,oe.BRACE_R);if(0===t.length&&0===n.length)throw this.unexpected();return this.node(e,{kind:se.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:se.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:se.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:se.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:se.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:se.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:se.INPUT_OBJECT_TYPE_EXTENSION,name:t,directives:n,fields:i})}parseDirectiveDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("directive"),this.expectToken(oe.AT);const n=this.parseName(),i=this.parseArgumentDefs(),r=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");const s=this.parseDirectiveLocations();return this.node(e,{kind:se.DIRECTIVE_DEFINITION,description:t,name:n,arguments:i,repeatable:r,locations:s})}parseDirectiveLocations(){return this.delimitedMany(oe.PIPE,this.parseDirectiveLocation)}parseDirectiveLocation(){const e=this._lexer.token,t=this.parseName();if(Object.prototype.hasOwnProperty.call(re,t.value))return t;throw this.unexpected(e)}node(e,t){return!0!==this._options.noLocation&&(t.loc=new W(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.advanceLexer(),t;throw H(this._lexer.source,t.start,`Expected ${Pe(e)}, found ${Me(t)}.`)}expectOptionalToken(e){return this._lexer.token.kind===e&&(this.advanceLexer(),!0)}expectKeyword(e){const t=this._lexer.token;if(t.kind!==oe.NAME||t.value!==e)throw H(this._lexer.source,t.start,`Expected "${e}", found ${Me(t)}.`);this.advanceLexer()}expectOptionalKeyword(e){const t=this._lexer.token;return t.kind===oe.NAME&&t.value===e&&(this.advanceLexer(),!0)}unexpected(e){const t=null!=e?e:this._lexer.token;return H(this._lexer.source,t.start,`Unexpected ${Me(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}advanceLexer(){const{maxTokens:e}=this._options,t=this._lexer.advance();if(void 0!==e&&t.kind!==oe.EOF&&(++this._tokenCounter,this._tokenCounter>e))throw H(this._lexer.source,t.start,`Document contains more that ${e} tokens. Parsing aborted.`)}}function Me(e){const t=e.value;return Pe(e.kind)+(null!=t?` "${t}"`:"")}function Pe(e){return function(e){return e===oe.BANG||e===oe.DOLLAR||e===oe.AMP||e===oe.PAREN_L||e===oe.PAREN_R||e===oe.SPREAD||e===oe.COLON||e===oe.EQUALS||e===oe.AT||e===oe.BRACKET_L||e===oe.BRACKET_R||e===oe.BRACE_L||e===oe.PIPE||e===oe.BRACE_R}(e)?`"${e}"`:e}const Be=5;function Ge(e,t){const[n,i]=t?[e,t]:[void 0,e];let r=" Did you mean ";n&&(r+=n+" ");const s=i.map((e=>`"${e}"`));switch(s.length){case 0:return"";case 1:return r+s[0]+"?";case 2:return r+s[0]+" or "+s[1]+"?"}const o=s.slice(0,Be),a=o.pop();return r+o.join(", ")+", or "+a+"?"}function Je(e){return e}function Ye(e,t){const n=Object.create(null);for(const i of e)n[t(i)]=i;return n}function Qe(e,t,n){const i=Object.create(null);for(const r of e)i[t(r)]=n(r);return i}function qe(e,t){const n=Object.create(null);for(const i of Object.keys(e))n[i]=t(e[i],i);return n}function Ke(e,t){let n=0,i=0;for(;n<e.length&&i<t.length;){let r=e.charCodeAt(n),s=t.charCodeAt(i);if(He(r)&&He(s)){let o=0;do{++n,o=10*o+r-ze,r=e.charCodeAt(n)}while(He(r)&&o>0);let a=0;do{++i,a=10*a+s-ze,s=t.charCodeAt(i)}while(He(s)&&a>0);if(o<a)return-1;if(o>a)return 1}else{if(r<s)return-1;if(r>s)return 1;++n,++i}}return e.length-t.length}const ze=48,Xe=57;function He(e){return!isNaN(e)&&ze<=e&&e<=Xe}function We(e,t){const n=Object.create(null),i=new Ze(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:Ke(e,t)}))}class Ze{constructor(e){this._input=e,this._inputLowerCase=e.toLowerCase(),this._inputArray=et(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=et(n),r=this._inputArray;if(i.length<r.length){const e=i;i=r,r=e}const s=i.length,o=r.length;if(s-o>t)return;const a=this._rows;for(let e=0;e<=o;e++)a[0][e]=e;for(let e=1;e<=s;e++){const n=a[(e-1)%3],s=a[e%3];let c=s[0]=e;for(let t=1;t<=o;t++){const o=i[e-1]===r[t-1]?0:1;let u=Math.min(n[t]+1,s[t-1]+1,n[t-1]+o);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)}u<c&&(c=u),s[t]=u}if(c>t)return}const c=a[s%3][o];return c<=t?c:void 0}}function et(e){const t=e.length,n=new Array(t);for(let i=0;i<t;++i)n[i]=e.charCodeAt(i);return n}function tt(e){if(null==e)return Object.create(null);if(null===Object.getPrototypeOf(e))return e;const t=Object.create(null);for(const[n,i]of Object.entries(e))t[n]=i;return t}const nt=/[\x00-\x1f\x22\x5c\x7f-\x9f]/g;function it(e){return rt[e.charCodeAt(0)]}const rt=["\\u0000","\\u0001","\\u0002","\\u0003","\\u0004","\\u0005","\\u0006","\\u0007","\\b","\\t","\\n","\\u000B","\\f","\\r","\\u000E","\\u000F","\\u0010","\\u0011","\\u0012","\\u0013","\\u0014","\\u0015","\\u0016","\\u0017","\\u0018","\\u0019","\\u001A","\\u001B","\\u001C","\\u001D","\\u001E","\\u001F","","",'\\"',"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","\\\\","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","\\u007F","\\u0080","\\u0081","\\u0082","\\u0083","\\u0084","\\u0085","\\u0086","\\u0087","\\u0088","\\u0089","\\u008A","\\u008B","\\u008C","\\u008D","\\u008E","\\u008F","\\u0090","\\u0091","\\u0092","\\u0093","\\u0094","\\u0095","\\u0096","\\u0097","\\u0098","\\u0099","\\u009A","\\u009B","\\u009C","\\u009D","\\u009E","\\u009F"],st=Object.freeze({});function ot(e,t,n=ee){const i=new Map;for(const e of Object.values(se))i.set(e,at(t,e));let r,s,o,a=Array.isArray(e),c=[e],u=-1,l=[],p=e;const d=[],f=[];do{u++;const e=u===c.length,v=e&&0!==l.length;if(e){if(s=0===f.length?void 0:d[d.length-1],p=o,o=f.pop(),v)if(a){p=p.slice();let e=0;for(const[t,n]of l){const i=t-e;null===n?(p.splice(i,1),e++):p[i]=n}}else{p=Object.defineProperties({},Object.getOwnPropertyDescriptors(p));for(const[e,t]of l)p[e]=t}u=r.index,c=r.keys,l=r.edits,a=r.inArray,r=r.prev}else if(o){if(s=a?u:c[u],p=o[s],null==p)continue;d.push(s)}let T;if(!Array.isArray(p)){var h,m;ne(p)||P(!1,`Invalid AST Node: ${$e(p)}.`);const n=e?null===(h=i.get(p.kind))||void 0===h?void 0:h.leave:null===(m=i.get(p.kind))||void 0===m?void 0:m.enter;if(T=null==n?void 0:n.call(t,p,s,o,d,f),T===st)break;if(!1===T){if(!e){d.pop();continue}}else if(void 0!==T&&(l.push([s,T]),!e)){if(!ne(T)){d.pop();continue}p=T}}var y;if(void 0===T&&v&&l.push([s,p]),e)d.pop();else r={inArray:a,index:u,keys:c,edits:l,prev:r},a=Array.isArray(p),c=a?p:null!==(y=n[p.kind])&&void 0!==y?y:[],u=-1,l=[],o&&f.push(o),o=p}while(void 0!==r);return 0!==l.length?l[l.length-1][1]:e}function at(e,t){const n=e[t];return"object"==typeof n?n:"function"==typeof n?{enter:n,leave:void 0}:{enter:e.enter,leave:e.leave}}function ct(e){return ot(e,ut)}const ut={Name:{leave:e=>e.value},Variable:{leave:e=>"$"+e.name},Document:{leave:e=>lt(e.definitions,"\n\n")},OperationDefinition:{leave(e){const t=dt("(",lt(e.variableDefinitions,", "),")"),n=lt([e.operation,lt([e.name,t]),lt(e.directives," ")]," ");return("query"===n?"":n+" ")+e.selectionSet}},VariableDefinition:{leave:({variable:e,type:t,defaultValue:n,directives:i})=>e+": "+t+dt(" = ",n)+dt(" ",lt(i," "))},SelectionSet:{leave:({selections:e})=>pt(e)},Field:{leave({alias:e,name:t,arguments:n,directives:i,selectionSet:r}){const s=dt("",e,": ")+t;let o=s+dt("(",lt(n,", "),")");return o.length>80&&(o=s+dt("(\n",ft(lt(n,"\n")),"\n)")),lt([o,lt(i," "),r]," ")}},Argument:{leave:({name:e,value:t})=>e+": "+t},FragmentSpread:{leave:({name:e,directives:t})=>"..."+e+dt(" ",lt(t," "))},InlineFragment:{leave:({typeCondition:e,directives:t,selectionSet:n})=>lt(["...",dt("on ",e),lt(t," "),n]," ")},FragmentDefinition:{leave:({name:e,typeCondition:t,variableDefinitions:n,directives:i,selectionSet:r})=>`fragment ${e}${dt("(",lt(n,", "),")")} on ${t} ${dt("",lt(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,s=i.length>1&&i.slice(1).every((e=>0===e.length||ae(e.charCodeAt(0)))),o=n.endsWith('\\"""'),a=e.endsWith('"')&&!o,c=e.endsWith("\\"),u=a||c,l=!(null!=t&&t.minimize)&&(!r||e.length>70||u||s||o);let p="";const d=r&&ae(e.charCodeAt(0));return(l&&!d||s)&&(p+="\n"),p+=n,(l||u)&&(p+="\n"),'"""'+p+'"""'}(e):`"${e.replace(nt,it)}"`},BooleanValue:{leave:({value:e})=>e?"true":"false"},NullValue:{leave:()=>"null"},EnumValue:{leave:({value:e})=>e},ListValue:{leave:({values:e})=>"["+lt(e,", ")+"]"},ObjectValue:{leave:({fields:e})=>"{"+lt(e,", ")+"}"},ObjectField:{leave:({name:e,value:t})=>e+": "+t},Directive:{leave:({name:e,arguments:t})=>"@"+e+dt("(",lt(t,", "),")")},NamedType:{leave:({name:e})=>e},ListType:{leave:({type:e})=>"["+e+"]"},NonNullType:{leave:({type:e})=>e+"!"},SchemaDefinition:{leave:({description:e,directives:t,operationTypes:n})=>dt("",e,"\n")+lt(["schema",lt(t," "),pt(n)]," ")},OperationTypeDefinition:{leave:({operation:e,type:t})=>e+": "+t},ScalarTypeDefinition:{leave:({description:e,name:t,directives:n})=>dt("",e,"\n")+lt(["scalar",t,lt(n," ")]," ")},ObjectTypeDefinition:{leave:({description:e,name:t,interfaces:n,directives:i,fields:r})=>dt("",e,"\n")+lt(["type",t,dt("implements ",lt(n," & ")),lt(i," "),pt(r)]," ")},FieldDefinition:{leave:({description:e,name:t,arguments:n,type:i,directives:r})=>dt("",e,"\n")+t+(ht(n)?dt("(\n",ft(lt(n,"\n")),"\n)"):dt("(",lt(n,", "),")"))+": "+i+dt(" ",lt(r," "))},InputValueDefinition:{leave:({description:e,name:t,type:n,defaultValue:i,directives:r})=>dt("",e,"\n")+lt([t+": "+n,dt("= ",i),lt(r," ")]," ")},InterfaceTypeDefinition:{leave:({description:e,name:t,interfaces:n,directives:i,fields:r})=>dt("",e,"\n")+lt(["interface",t,dt("implements ",lt(n," & ")),lt(i," "),pt(r)]," ")},UnionTypeDefinition:{leave:({description:e,name:t,directives:n,types:i})=>dt("",e,"\n")+lt(["union",t,lt(n," "),dt("= ",lt(i," | "))]," ")},EnumTypeDefinition:{leave:({description:e,name:t,directives:n,values:i})=>dt("",e,"\n")+lt(["enum",t,lt(n," "),pt(i)]," ")},EnumValueDefinition:{leave:({description:e,name:t,directives:n})=>dt("",e,"\n")+lt([t,lt(n," ")]," ")},InputObjectTypeDefinition:{leave:({description:e,name:t,directives:n,fields:i})=>dt("",e,"\n")+lt(["input",t,lt(n," "),pt(i)]," ")},DirectiveDefinition:{leave:({description:e,name:t,arguments:n,repeatable:i,locations:r})=>dt("",e,"\n")+"directive @"+t+(ht(n)?dt("(\n",ft(lt(n,"\n")),"\n)"):dt("(",lt(n,", "),")"))+(i?" repeatable":"")+" on "+lt(r," | ")},SchemaExtension:{leave:({directives:e,operationTypes:t})=>lt(["extend schema",lt(e," "),pt(t)]," ")},ScalarTypeExtension:{leave:({name:e,directives:t})=>lt(["extend scalar",e,lt(t," ")]," ")},ObjectTypeExtension:{leave:({name:e,interfaces:t,directives:n,fields:i})=>lt(["extend type",e,dt("implements ",lt(t," & ")),lt(n," "),pt(i)]," ")},InterfaceTypeExtension:{leave:({name:e,interfaces:t,directives:n,fields:i})=>lt(["extend interface",e,dt("implements ",lt(t," & ")),lt(n," "),pt(i)]," ")},UnionTypeExtension:{leave:({name:e,directives:t,types:n})=>lt(["extend union",e,lt(t," "),dt("= ",lt(n," | "))]," ")},EnumTypeExtension:{leave:({name:e,directives:t,values:n})=>lt(["extend enum",e,lt(t," "),pt(n)]," ")},InputObjectTypeExtension:{leave:({name:e,directives:t,fields:n})=>lt(["extend input",e,lt(t," "),pt(n)]," ")}};function lt(e,t=""){var n;return null!==(n=null==e?void 0:e.filter((e=>e)).join(t))&&void 0!==n?n:""}function pt(e){return dt("{\n",ft(lt(e,"\n")),"\n}")}function dt(e,t,n=""){return null!=t&&""!==t?e+t+n:""}function ft(e){return dt(" ",e.replace(/\n/g,"\n "))}function ht(e){var t;return null!==(t=null==e?void 0:e.some((e=>e.includes("\n"))))&&void 0!==t&&t}function mt(e,t){switch(e.kind){case se.NULL:return null;case se.INT:return parseInt(e.value,10);case se.FLOAT:return parseFloat(e.value);case se.STRING:case se.ENUM:case se.BOOLEAN:return e.value;case se.LIST:return e.values.map((e=>mt(e,t)));case se.OBJECT:return Qe(e.fields,(e=>e.name.value),(e=>mt(e.value,t)));case se.VARIABLE:return null==t?void 0:t[e.name.value]}}function yt(e){if(null!=e||P(!1,"Must provide name."),"string"==typeof e||P(!1,"Expected name to be a string."),0===e.length)throw new z("Expected name to be a non-empty string.");for(let t=1;t<e.length;++t)if(!pe(e.charCodeAt(t)))throw new z(`Names must only contain [_a-zA-Z0-9] but "${e}" does not.`);if(!le(e.charCodeAt(0)))throw new z(`Names must start with [_a-zA-Z] but "${e}" does not.`);return e}function vt(e){if("true"===e||"false"===e||"null"===e)throw new z(`Enum values cannot be named: ${e}`);return yt(e)}function Tt(e){return Et(e)||Nt(e)||gt(e)||It(e)||bt(e)||_t(e)||Ot(e)||St(e)}function Et(e){return Ve(e,Mt)}function Nt(e){return Ve(e,Pt)}function gt(e){return Ve(e,zt)}function It(e){return Ve(e,Xt)}function bt(e){return Ve(e,Wt)}function _t(e){return Ve(e,en)}function Ot(e){return Ve(e,Rt)}function St(e){return Ve(e,Ft)}function wt(e){return Et(e)||bt(e)||_t(e)||Lt(e)&&wt(e.ofType)}function At(e){return Et(e)||Nt(e)||gt(e)||It(e)||bt(e)||Lt(e)&&At(e.ofType)}function Dt(e){return Et(e)||bt(e)}function xt(e){return Nt(e)||gt(e)||It(e)}function kt(e){return gt(e)||It(e)}class Rt{constructor(e){Tt(e)||P(!1,`Expected ${$e(e)} to be a GraphQL type.`),this.ofType=e}get[Symbol.toStringTag](){return"GraphQLList"}toString(){return"["+String(this.ofType)+"]"}toJSON(){return this.toString()}}class Ft{constructor(e){var t;Tt(t=e)&&!St(t)||P(!1,`Expected ${$e(e)} to be a GraphQL nullable type.`),this.ofType=e}get[Symbol.toStringTag](){return"GraphQLNonNull"}toString(){return String(this.ofType)+"!"}toJSON(){return this.toString()}}function Lt(e){return Ot(e)||St(e)}function $t(e){if(e)return St(e)?e.ofType:e}function Ct(e){return Et(e)||Nt(e)||gt(e)||It(e)||bt(e)||_t(e)}function Vt(e){if(e){let t=e;for(;Lt(t);)t=t.ofType;return t}}function Ut(e){return"function"==typeof e?e():e}function jt(e){return"function"==typeof e?e():e}class Mt{constructor(e){var t,n,i,r;const s=null!==(t=e.parseValue)&&void 0!==t?t:Je;this.name=yt(e.name),this.description=e.description,this.specifiedByURL=e.specifiedByURL,this.serialize=null!==(n=e.serialize)&&void 0!==n?n:Je,this.parseValue=s,this.parseLiteral=null!==(i=e.parseLiteral)&&void 0!==i?i:(e,t)=>s(mt(e,t)),this.extensions=tt(e.extensions),this.astNode=e.astNode,this.extensionASTNodes=null!==(r=e.extensionASTNodes)&&void 0!==r?r:[],null==e.specifiedByURL||"string"==typeof e.specifiedByURL||P(!1,`${this.name} must provide "specifiedByURL" as a string, but got: ${$e(e.specifiedByURL)}.`),null==e.serialize||"function"==typeof e.serialize||P(!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||P(!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 Pt{constructor(e){var t;this.name=yt(e.name),this.description=e.description,this.isTypeOf=e.isTypeOf,this.extensions=tt(e.extensions),this.astNode=e.astNode,this.extensionASTNodes=null!==(t=e.extensionASTNodes)&&void 0!==t?t:[],this._fields=()=>Gt(e),this._interfaces=()=>Bt(e),null==e.isTypeOf||"function"==typeof e.isTypeOf||P(!1,`${this.name} must provide "isTypeOf" as a function, but got: ${$e(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:Qt(this.getFields()),isTypeOf:this.isTypeOf,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}function Bt(e){var t;const n=Ut(null!==(t=e.interfaces)&&void 0!==t?t:[]);return Array.isArray(n)||P(!1,`${e.name} interfaces must be an Array or a function which returns an Array.`),n}function Gt(e){const t=jt(e.fields);return Yt(t)||P(!1,`${e.name} fields must be an object with field names as keys or a function which returns such an object.`),qe(t,((t,n)=>{var i;Yt(t)||P(!1,`${e.name}.${n} field config must be an object.`),null==t.resolve||"function"==typeof t.resolve||P(!1,`${e.name}.${n} field resolver must be a function if provided, but got: ${$e(t.resolve)}.`);const r=null!==(i=t.args)&&void 0!==i?i:{};return Yt(r)||P(!1,`${e.name}.${n} args must be an object with argument names as keys.`),{name:yt(n),description:t.description,type:t.type,args:Jt(r),resolve:t.resolve,subscribe:t.subscribe,deprecationReason:t.deprecationReason,extensions:tt(t.extensions),astNode:t.astNode}}))}function Jt(e){return Object.entries(e).map((([e,t])=>({name:yt(e),description:t.description,type:t.type,defaultValue:t.defaultValue,deprecationReason:t.deprecationReason,extensions:tt(t.extensions),astNode:t.astNode})))}function Yt(e){return G(e)&&!Array.isArray(e)}function Qt(e){return qe(e,(e=>({description:e.description,type:e.type,args:qt(e.args),resolve:e.resolve,subscribe:e.subscribe,deprecationReason:e.deprecationReason,extensions:e.extensions,astNode:e.astNode})))}function qt(e){return Qe(e,(e=>e.name),(e=>({description:e.description,type:e.type,defaultValue:e.defaultValue,deprecationReason:e.deprecationReason,extensions:e.extensions,astNode:e.astNode})))}function Kt(e){return St(e.type)&&void 0===e.defaultValue}class zt{constructor(e){var t;this.name=yt(e.name),this.description=e.description,this.resolveType=e.resolveType,this.extensions=tt(e.extensions),this.astNode=e.astNode,this.extensionASTNodes=null!==(t=e.extensionASTNodes)&&void 0!==t?t:[],this._fields=Gt.bind(void 0,e),this._interfaces=Bt.bind(void 0,e),null==e.resolveType||"function"==typeof e.resolveType||P(!1,`${this.name} must provide "resolveType" as a function, but got: ${$e(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:Qt(this.getFields()),resolveType:this.resolveType,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}class Xt{constructor(e){var t;this.name=yt(e.name),this.description=e.description,this.resolveType=e.resolveType,this.extensions=tt(e.extensions),this.astNode=e.astNode,this.extensionASTNodes=null!==(t=e.extensionASTNodes)&&void 0!==t?t:[],this._types=Ht.bind(void 0,e),null==e.resolveType||"function"==typeof e.resolveType||P(!1,`${this.name} must provide "resolveType" as a function, but got: ${$e(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 Ht(e){const t=Ut(e.types);return Array.isArray(t)||P(!1,`Must provide Array of types or a function which returns such an array for Union ${e.name}.`),t}class Wt{constructor(e){var t,n,i;this.name=yt(e.name),this.description=e.description,this.extensions=tt(e.extensions),this.astNode=e.astNode,this.extensionASTNodes=null!==(t=e.extensionASTNodes)&&void 0!==t?t:[],this._values=(n=this.name,Yt(i=e.values)||P(!1,`${n} values must be an object with value names as keys.`),Object.entries(i).map((([e,t])=>(Yt(t)||P(!1,`${n}.${e} must refer to an object with a "value" key representing an internal value but got: ${$e(t)}.`),{name:vt(e),description:t.description,value:void 0!==t.value?t.value:e,deprecationReason:t.deprecationReason,extensions:tt(t.extensions),astNode:t.astNode})))),this._valueLookup=new Map(this._values.map((e=>[e.value,e]))),this._nameLookup=Ye(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 z(`Enum "${this.name}" cannot represent value: ${$e(e)}`);return t.name}parseValue(e){if("string"!=typeof e){const t=$e(e);throw new z(`Enum "${this.name}" cannot represent non-string value: ${t}.`+Zt(this,t))}const t=this.getValue(e);if(null==t)throw new z(`Value "${e}" does not exist in "${this.name}" enum.`+Zt(this,e));return t.value}parseLiteral(e,t){if(e.kind!==se.ENUM){const t=ct(e);throw new z(`Enum "${this.name}" cannot represent non-enum value: ${t}.`+Zt(this,t),{nodes:e})}const n=this.getValue(e.value);if(null==n){const t=ct(e);throw new z(`Value "${t}" does not exist in "${this.name}" enum.`+Zt(this,t),{nodes:e})}return n.value}toConfig(){const e=Qe(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 Zt(e,t){return Ge("the enum value",We(t,e.getValues().map((e=>e.name))))}class en{constructor(e){var t;this.name=yt(e.name),this.description=e.description,this.extensions=tt(e.extensions),this.astNode=e.astNode,this.extensionASTNodes=null!==(t=e.extensionASTNodes)&&void 0!==t?t:[],this._fields=tn.bind(void 0,e)}get[Symbol.toStringTag](){return"GraphQLInputObjectType"}getFields(){return"function"==typeof this._fields&&(this._fields=this._fields()),this._fields}toConfig(){const e=qe(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 tn(e){const t=jt(e.fields);return Yt(t)||P(!1,`${e.name} fields must be an object with field names as keys or a function which returns such an object.`),qe(t,((t,n)=>(!("resolve"in t)||P(!1,`${e.name}.${n} field has a resolve property, but Input Types cannot define resolvers.`),{name:yt(n),description:t.description,type:t.type,defaultValue:t.defaultValue,deprecationReason:t.deprecationReason,extensions:tt(t.extensions),astNode:t.astNode})))}function nn(e){return St(e.type)&&void 0===e.defaultValue}function rn(e,t){return e===t||(St(e)&&St(t)||!(!Ot(e)||!Ot(t)))&&rn(e.ofType,t.ofType)}function sn(e,t,n){return t===n||(St(n)?!!St(t)&&sn(e,t.ofType,n.ofType):St(t)?sn(e,t.ofType,n):Ot(n)?!!Ot(t)&&sn(e,t.ofType,n.ofType):!Ot(t)&&(kt(n)&&(gt(t)||Nt(t))&&e.isSubType(n,t)))}function on(e,t,n){return t===n||(kt(t)?kt(n)?e.getPossibleTypes(t).some((t=>e.isSubType(n,t))):e.isSubType(t,n):!!kt(n)&&e.isSubType(n,t))}const an=2147483647,cn=-2147483648,un=new Mt({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=mn(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 z(`Int cannot represent non-integer value: ${$e(t)}`);if(n>an||n<cn)throw new z("Int cannot represent non 32-bit signed integer value: "+$e(t));return n},parseValue(e){if("number"!=typeof e||!Number.isInteger(e))throw new z(`Int cannot represent non-integer value: ${$e(e)}`);if(e>an||e<cn)throw new z(`Int cannot represent non 32-bit signed integer value: ${e}`);return e},parseLiteral(e){if(e.kind!==se.INT)throw new z(`Int cannot represent non-integer value: ${ct(e)}`,{nodes:e});const t=parseInt(e.value,10);if(t>an||t<cn)throw new z(`Int cannot represent non 32-bit signed integer value: ${e.value}`,{nodes:e});return t}}),ln=new Mt({name:"Float",description:"The `Float` scalar type represents signed double-precision fractional values as specified by [IEEE 754](https://en.wikipedia.org/wiki/IEEE_floating_point).",serialize(e){const t=mn(e);if("boolean"==typeof t)return t?1:0;let n=t;if("string"==typeof t&&""!==t&&(n=Number(t)),"number"!=typeof n||!Number.isFinite(n))throw new z(`Float cannot represent non numeric value: ${$e(t)}`);return n},parseValue(e){if("number"!=typeof e||!Number.isFinite(e))throw new z(`Float cannot represent non numeric value: ${$e(e)}`);return e},parseLiteral(e){if(e.kind!==se.FLOAT&&e.kind!==se.INT)throw new z(`Float cannot represent non numeric value: ${ct(e)}`,e);return parseFloat(e.value)}}),pn=new Mt({name:"String",description:"The `String` scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.",serialize(e){const t=mn(e);if("string"==typeof t)return t;if("boolean"==typeof t)return t?"true":"false";if("number"==typeof t&&Number.isFinite(t))return t.toString();throw new z(`String cannot represent value: ${$e(e)}`)},parseValue(e){if("string"!=typeof e)throw new z(`String cannot represent a non string value: ${$e(e)}`);return e},parseLiteral(e){if(e.kind!==se.STRING)throw new z(`String cannot represent a non string value: ${ct(e)}`,{nodes:e});return e.value}}),dn=new Mt({name:"Boolean",description:"The `Boolean` scalar type represents `true` or `false`.",serialize(e){const t=mn(e);if("boolean"==typeof t)return t;if(Number.isFinite(t))return 0!==t;throw new z(`Boolean cannot represent a non boolean value: ${$e(t)}`)},parseValue(e){if("boolean"!=typeof e)throw new z(`Boolean cannot represent a non boolean value: ${$e(e)}`);return e},parseLiteral(e){if(e.kind!==se.BOOLEAN)throw new z(`Boolean cannot represent a non boolean value: ${ct(e)}`,{nodes:e});return e.value}}),fn=new Mt({name:"ID",description:'The `ID` scalar type represents a unique identifier, often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as `"4"`) or integer (such as `4`) input value will be accepted as an ID.',serialize(e){const t=mn(e);if("string"==typeof t)return t;if(Number.isInteger(t))return String(t);throw new z(`ID cannot represent value: ${$e(e)}`)},parseValue(e){if("string"==typeof e)return e;if("number"==typeof e&&Number.isInteger(e))return e.toString();throw new z(`ID cannot represent value: ${$e(e)}`)},parseLiteral(e){if(e.kind!==se.STRING&&e.kind!==se.INT)throw new z("ID cannot represent a non-string and non-integer value: "+ct(e),{nodes:e});return e.value}}),hn=Object.freeze([pn,un,ln,dn,fn]);function mn(e){if(G(e)){if("function"==typeof e.valueOf){const t=e.valueOf();if(!G(t))return t}if("function"==typeof e.toJSON)return e.toJSON()}return e}function yn(e){return Ve(e,vn)}class vn{constructor(e){var t,n;this.name=yt(e.name),this.description=e.description,this.locations=e.locations,this.isRepeatable=null!==(t=e.isRepeatable)&&void 0!==t&&t,this.extensions=tt(e.extensions),this.astNode=e.astNode,Array.isArray(e.locations)||P(!1,`@${e.name} locations must be an Array.`);const i=null!==(n=e.args)&&void 0!==n?n:{};G(i)&&!Array.isArray(i)||P(!1,`@${e.name} args must be an object with argument names as keys.`),this.args=Jt(i)}get[Symbol.toStringTag](){return"GraphQLDirective"}toConfig(){return{name:this.name,description:this.description,locations:this.locations,args:qt(this.args),isRepeatable:this.isRepeatable,extensions:this.extensions,astNode:this.astNode}}toString(){return"@"+this.name}toJSON(){return this.toString()}}const Tn=new vn({name:"include",description:"Directs the executor to include this field or fragment only when the `if` argument is true.",locations:[re.FIELD,re.FRAGMENT_SPREAD,re.INLINE_FRAGMENT],args:{if:{type:new Ft(dn),description:"Included when true."}}}),En=new vn({name:"skip",description:"Directs the executor to skip this field or fragment when the `if` argument is true.",locations:[re.FIELD,re.FRAGMENT_SPREAD,re.INLINE_FRAGMENT],args:{if:{type:new Ft(dn),description:"Skipped when true."}}}),Nn=new vn({name:"deprecated",description:"Marks an element of a GraphQL schema as no longer supported.",locations:[re.FIELD_DEFINITION,re.ARGUMENT_DEFINITION,re.INPUT_FIELD_DEFINITION,re.ENUM_VALUE],args:{reason:{type:pn,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:"No longer supported"}}}),gn=new vn({name:"specifiedBy",description:"Exposes a URL that specifies the behavior of this scalar.",locations:[re.SCALAR],args:{url:{type:new Ft(pn),description:"The URL that specifies the behavior of this scalar."}}}),In=Object.freeze([Tn,En,Nn,gn]);function bn(e){return"object"==typeof e&&"function"==typeof(null==e?void 0:e[Symbol.iterator])}function _n(e,t){if(St(t)){const n=_n(e,t.ofType);return(null==n?void 0:n.kind)===se.NULL?null:n}if(null===e)return{kind:se.NULL};if(void 0===e)return null;if(Ot(t)){const n=t.ofType;if(bn(e)){const t=[];for(const i of e){const e=_n(i,n);null!=e&&t.push(e)}return{kind:se.LIST,values:t}}return _n(e,n)}if(_t(t)){if(!G(e))return null;const n=[];for(const i of Object.values(t.getFields())){const t=_n(e[i.name],i.type);t&&n.push({kind:se.OBJECT_FIELD,name:{kind:se.NAME,value:i.name},value:t})}return{kind:se.OBJECT,fields:n}}if(Dt(t)){const n=t.serialize(e);if(null==n)return null;if("boolean"==typeof n)return{kind:se.BOOLEAN,value:n};if("number"==typeof n&&Number.isFinite(n)){const e=String(n);return On.test(e)?{kind:se.INT,value:e}:{kind:se.FLOAT,value:e}}if("string"==typeof n)return bt(t)?{kind:se.ENUM,value:n}:t===fn&&On.test(n)?{kind:se.INT,value:n}:{kind:se.STRING,value:n};throw new TypeError(`Cannot convert value to AST: ${$e(n)}.`)}J(!1,"Unexpected input type: "+$e(t))}const On=/^-?(?:0|[1-9][0-9]*)$/,Sn=new Pt({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:pn,resolve:e=>e.description},types:{description:"A list of all types supported by this server.",type:new Ft(new Rt(new Ft(Dn))),resolve:e=>Object.values(e.getTypeMap())},queryType:{description:"The type that query operations will be rooted at.",type:new Ft(Dn),resolve:e=>e.getQueryType()},mutationType:{description:"If this server supports mutation, the type that mutation operations will be rooted at.",type:Dn,resolve:e=>e.getMutationType()},subscriptionType:{description:"If this server support subscription, the type that subscription operations will be rooted at.",type:Dn,resolve:e=>e.getSubscriptionType()},directives:{description:"A list of all directives supported by this server.",type:new Ft(new Rt(new Ft(wn))),resolve:e=>e.getDirectives()}})}),wn=new Pt({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 Ft(pn),resolve:e=>e.name},description:{type:pn,resolve:e=>e.description},isRepeatable:{type:new Ft(dn),resolve:e=>e.isRepeatable},locations:{type:new Ft(new Rt(new Ft(An))),resolve:e=>e.locations},args:{type:new Ft(new Rt(new Ft(kn))),args:{includeDeprecated:{type:dn,defaultValue:!1}},resolve:(e,{includeDeprecated:t})=>t?e.args:e.args.filter((e=>null==e.deprecationReason))}})}),An=new Wt({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:re.QUERY,description:"Location adjacent to a query operation."},MUTATION:{value:re.MUTATION,description:"Location adjacent to a mutation operation."},SUBSCRIPTION:{value:re.SUBSCRIPTION,description:"Location adjacent to a subscription operation."},FIELD:{value:re.FIELD,description:"Location adjacent to a field."},FRAGMENT_DEFINITION:{value:re.FRAGMENT_DEFINITION,description:"Location adjacent to a fragment definition."},FRAGMENT_SPREAD:{value:re.FRAGMENT_SPREAD,description:"Location adjacent to a fragment spread."},INLINE_FRAGMENT:{value:re.INLINE_FRAGMENT,description:"Location adjacent to an inline fragment."},VARIABLE_DEFINITION:{value:re.VARIABLE_DEFINITION,description:"Location adjacent to a variable definition."},SCHEMA:{value:re.SCHEMA,description:"Location adjacent to a schema definition."},SCALAR:{value:re.SCALAR,description:"Location adjacent to a scalar definition."},OBJECT:{value:re.OBJECT,description:"Location adjacent to an object type definition."},FIELD_DEFINITION:{value:re.FIELD_DEFINITION,description:"Location adjacent to a field definition."},ARGUMENT_DEFINITION:{value:re.ARGUMENT_DEFINITION,description:"Location adjacent to an argument definition."},INTERFACE:{value:re.INTERFACE,description:"Location adjacent to an interface definition."},UNION:{value:re.UNION,description:"Location adjacent to a union definition."},ENUM:{value:re.ENUM,description:"Location adjacent to an enum definition."},ENUM_VALUE:{value:re.ENUM_VALUE,description:"Location adjacent to an enum value definition."},INPUT_OBJECT:{value:re.INPUT_OBJECT,description:"Location adjacent to an input object type definition."},INPUT_FIELD_DEFINITION:{value:re.INPUT_FIELD_DEFINITION,description:"Location adjacent to an input object field definition."}}}),Dn=new Pt({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 Ft(Ln),resolve:e=>Et(e)?Fn.SCALAR:Nt(e)?Fn.OBJECT:gt(e)?Fn.INTERFACE:It(e)?Fn.UNION:bt(e)?Fn.ENUM:_t(e)?Fn.INPUT_OBJECT:Ot(e)?Fn.LIST:St(e)?Fn.NON_NULL:void J(!1,`Unexpected type: "${$e(e)}".`)},name:{type:pn,resolve:e=>"name"in e?e.name:void 0},description:{type:pn,resolve:e=>"description"in e?e.description:void 0},specifiedByURL:{type:pn,resolve:e=>"specifiedByURL"in e?e.specifiedByURL:void 0},fields:{type:new Rt(new Ft(xn)),args:{includeDeprecated:{type:dn,defaultValue:!1}},resolve(e,{includeDeprecated:t}){if(Nt(e)||gt(e)){const n=Object.values(e.getFields());return t?n:n.filter((e=>null==e.deprecationReason))}}},interfaces:{type:new Rt(new Ft(Dn)),resolve(e){if(Nt(e)||gt(e))return e.getInterfaces()}},possibleTypes:{type:new Rt(new Ft(Dn)),resolve(e,t,n,{schema:i}){if(kt(e))return i.getPossibleTypes(e)}},enumValues:{type:new Rt(new Ft(Rn)),args:{includeDeprecated:{type:dn,defaultValue:!1}},resolve(e,{includeDeprecated:t}){if(bt(e)){const n=e.getValues();return t?n:n.filter((e=>null==e.deprecationReason))}}},inputFields:{type:new Rt(new Ft(kn)),args:{includeDeprecated:{type:dn,defaultValue:!1}},resolve(e,{includeDeprecated:t}){if(_t(e)){const n=Object.values(e.getFields());return t?n:n.filter((e=>null==e.deprecationReason))}}},ofType:{type:Dn,resolve:e=>"ofType"in e?e.ofType:void 0}})}),xn=new Pt({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 Ft(pn),resolve:e=>e.name},description:{type:pn,resolve:e=>e.description},args:{type:new Ft(new Rt(new Ft(kn))),args:{includeDeprecated:{type:dn,defaultValue:!1}},resolve:(e,{includeDeprecated:t})=>t?e.args:e.args.filter((e=>null==e.deprecationReason))},type:{type:new Ft(Dn),resolve:e=>e.type},isDeprecated:{type:new Ft(dn),resolve:e=>null!=e.deprecationReason},deprecationReason:{type:pn,resolve:e=>e.deprecationReason}})}),kn=new Pt({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 Ft(pn),resolve:e=>e.name},description:{type:pn,resolve:e=>e.description},type:{type:new Ft(Dn),resolve:e=>e.type},defaultValue:{type:pn,description:"A GraphQL-formatted string representing the default value for this input value.",resolve(e){const{type:t,defaultValue:n}=e,i=_n(n,t);return i?ct(i):null}},isDeprecated:{type:new Ft(dn),resolve:e=>null!=e.deprecationReason},deprecationReason:{type:pn,resolve:e=>e.deprecationReason}})}),Rn=new Pt({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 Ft(pn),resolve:e=>e.name},description:{type:pn,resolve:e=>e.description},isDeprecated:{type:new Ft(dn),resolve:e=>null!=e.deprecationReason},deprecationReason:{type:pn,resolve:e=>e.deprecationReason}})});var Fn;!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"}(Fn||(Fn={}));const Ln=new Wt({name:"__TypeKind",description:"An enum describing what kind of type a given `__Type` is.",values:{SCALAR:{value:Fn.SCALAR,description:"Indicates this type is a scalar."},OBJECT:{value:Fn.OBJECT,description:"Indicates this type is an object. `fields` and `interfaces` are valid fields."},INTERFACE:{value:Fn.INTERFACE,description:"Indicates this type is an interface. `fields`, `interfaces`, and `possibleTypes` are valid fields."},UNION:{value:Fn.UNION,description:"Indicates this type is a union. `possibleTypes` is a valid field."},ENUM:{value:Fn.ENUM,description:"Indicates this type is an enum. `enumValues` is a valid field."},INPUT_OBJECT:{value:Fn.INPUT_OBJECT,description:"Indicates this type is an input object. `inputFields` is a valid field."},LIST:{value:Fn.LIST,description:"Indicates this type is a list. `ofType` is a valid field."},NON_NULL:{value:Fn.NON_NULL,description:"Indicates this type is a non-null. `ofType` is a valid field."}}}),$n={name:"__schema",type:new Ft(Sn),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},Cn={name:"__type",type:Dn,description:"Request the type information of a single type.",args:[{name:"name",description:void 0,type:new Ft(pn),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},Vn={name:"__typename",type:new Ft(pn),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},Un=Object.freeze([Sn,wn,An,Dn,xn,kn,Rn,Ln]);function jn(e){return Un.some((({name:t})=>e.name===t))}function Mn(e){if(!function(e){return Ve(e,Pn)}(e))throw new Error(`Expected ${$e(e)} to be a GraphQL schema.`);return e}class Pn{constructor(e){var t,n;this.__validationErrors=!0===e.assumeValid?[]:void 0,G(e)||P(!1,"Must provide configuration object."),!e.types||Array.isArray(e.types)||P(!1,`"types" must be Array if provided but got: ${$e(e.types)}.`),!e.directives||Array.isArray(e.directives)||P(!1,`"directives" must be Array if provided but got: ${$e(e.directives)}.`),this.description=e.description,this.extensions=tt(e.extensions),this.astNode=e.astNode,this.extensionASTNodes=null!==(t=e.extensionASTNodes)&&void 0!==t?t:[],this._queryType=e.query,this._mutationType=e.mutation,this._subscriptionType=e.subscription,this._directives=null!==(n=e.directives)&&void 0!==n?n:In;const i=new Set(e.types);if(null!=e.types)for(const t of e.types)i.delete(t),Bn(t,i);null!=this._queryType&&Bn(this._queryType,i),null!=this._mutationType&&Bn(this._mutationType,i),null!=this._subscriptionType&&Bn(this._subscriptionType,i);for(const e of this._directives)if(yn(e))for(const t of e.args)Bn(t.type,i);Bn(Sn,i),this._typeMap=Object.create(null),this._subTypeMap=Object.create(null),this._implementationsMap=Object.create(null);for(const e of i){if(null==e)continue;const t=e.name;if(t||P(!1,"One of the provided types for building the Schema is missing a name."),void 0!==this._typeMap[t])throw new Error(`Schema must contain uniquely named types but contains multiple types named "${t}".`);if(this._typeMap[t]=e,gt(e)){for(const t of e.getInterfaces())if(gt(t)){let n=this._implementationsMap[t.name];void 0===n&&(n=this._implementationsMap[t.name]={objects:[],interfaces:[]}),n.interfaces.push(e)}}else if(Nt(e))for(const t of e.getInterfaces())if(gt(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 ie.QUERY:return this.getQueryType();case ie.MUTATION:return this.getMutationType();case ie.SUBSCRIPTION:return this.getSubscriptionType()}}getTypeMap(){return this._typeMap}getType(e){return this.getTypeMap()[e]}getPossibleTypes(e){return It(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),It(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 Bn(e,t){const n=Vt(e);if(!t.has(n))if(t.add(n),It(n))for(const e of n.getTypes())Bn(e,t);else if(Nt(n)||gt(n)){for(const e of n.getInterfaces())Bn(e,t);for(const e of Object.values(n.getFields())){Bn(e.type,t);for(const n of e.args)Bn(n.type,t)}}else if(_t(n))for(const e of Object.values(n.getFields()))Bn(e.type,t);return t}function Gn(e){if(Mn(e),e.__validationErrors)return e.__validationErrors;const t=new Yn(e);!function(e){const t=e.schema,n=t.getQueryType();if(n){if(!Nt(n)){var i;e.reportError(`Query root type must be Object type, it cannot be ${$e(n)}.`,null!==(i=Qn(t,ie.QUERY))&&void 0!==i?i:n.astNode)}}else e.reportError("Query root type must be provided.",t.astNode);const r=t.getMutationType();var s;r&&!Nt(r)&&e.reportError(`Mutation root type must be Object type if provided, it cannot be ${$e(r)}.`,null!==(s=Qn(t,ie.MUTATION))&&void 0!==s?s:r.astNode);const o=t.getSubscriptionType();var a;o&&!Nt(o)&&e.reportError(`Subscription root type must be Object type if provided, it cannot be ${$e(o)}.`,null!==(a=Qn(t,ie.SUBSCRIPTION))&&void 0!==a?a:o.astNode)}(t),function(e){for(const n of e.schema.getDirectives())if(yn(n)){qn(e,n);for(const i of n.args){var t;if(qn(e,i),wt(i.type)||e.reportError(`The type of @${n.name}(${i.name}:) must be Input Type but got: ${$e(i.type)}.`,i.astNode),Kt(i)&&null!=i.deprecationReason)e.reportError(`Required argument @${n.name}(${i.name}:) cannot be deprecated.`,[ii(i.astNode),null===(t=i.astNode)||void 0===t?void 0:t.type])}}else e.reportError(`Expected directive but got: ${$e(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(s){if(t[s.name])return;t[s.name]=!0,i[s.name]=n.length;const o=Object.values(s.getFields());for(const t of o)if(St(t.type)&&_t(t.type.ofType)){const s=t.type.ofType,o=i[s.name];if(n.push(t),void 0===o)r(s);else{const t=n.slice(o),i=t.map((e=>e.name)).join(".");e.reportError(`Cannot reference Input Object "${s.name}" within itself through a series of non-null fields: "${i}".`,t.map((e=>e.astNode)))}n.pop()}i[s.name]=void 0}}(e),n=e.schema.getTypeMap();for(const i of Object.values(n))Ct(i)?(jn(i)||qn(e,i),Nt(i)||gt(i)?(Kn(e,i),zn(e,i)):It(i)?Wn(e,i):bt(i)?Zn(e,i):_t(i)&&(ei(e,i),t(i))):e.reportError(`Expected GraphQL named type but got: ${$e(i)}.`,i.astNode)}(t);const n=t.getErrors();return e.__validationErrors=n,n}function Jn(e){const t=Gn(e);if(0!==t.length)throw new Error(t.map((e=>e.message)).join("\n\n"))}class Yn{constructor(e){this._errors=[],this.schema=e}reportError(e,t){const n=Array.isArray(t)?t.filter(Boolean):t;this._errors.push(new z(e,{nodes:n}))}getErrors(){return this._errors}}function Qn(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 qn(e,t){t.name.startsWith("__")&&e.reportError(`Name "${t.name}" must not begin with "__", which is reserved by GraphQL introspection.`,t.astNode)}function Kn(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 o of n){var i;if(qn(e,o),!At(o.type))e.reportError(`The type of ${t.name}.${o.name} must be Output Type but got: ${$e(o.type)}.`,null===(i=o.astNode)||void 0===i?void 0:i.type);for(const n of o.args){const i=n.name;var r,s;if(qn(e,n),!wt(n.type))e.reportError(`The type of ${t.name}.${o.name}(${i}:) must be Input Type but got: ${$e(n.type)}.`,null===(r=n.astNode)||void 0===r?void 0:r.type);if(Kt(n)&&null!=n.deprecationReason)e.reportError(`Required argument ${t.name}.${o.name}(${i}:) cannot be deprecated.`,[ii(n.astNode),null===(s=n.astNode)||void 0===s?void 0:s.type])}}}function zn(e,t){const n=Object.create(null);for(const i of t.getInterfaces())gt(i)?t!==i?n[i.name]?e.reportError(`Type ${t.name} can only implement ${i.name} once.`,ti(t,i)):(n[i.name]=!0,Hn(e,t,i),Xn(e,t,i)):e.reportError(`Type ${t.name} cannot implement itself because it would create a circular reference.`,ti(t,i)):e.reportError(`Type ${$e(t)} must only implement Interface types, it cannot implement ${$e(i)}.`,ti(t,i))}function Xn(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,s;if(!sn(e.schema,l.type,c.type))e.reportError(`Interface field ${n.name}.${u} expects type ${$e(c.type)} but ${t.name}.${u} is type ${$e(l.type)}.`,[null===(r=c.astNode)||void 0===r?void 0:r.type,null===(s=l.astNode)||void 0===s?void 0:s.type]);for(const i of c.args){const r=i.name,s=l.args.find((e=>e.name===r));var o,a;if(s){if(!rn(i.type,s.type))e.reportError(`Interface field argument ${n.name}.${u}(${r}:) expects type ${$e(i.type)} but ${t.name}.${u}(${r}:) is type ${$e(s.type)}.`,[null===(o=i.astNode)||void 0===o?void 0:o.type,null===(a=s.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))&&Kt(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 Hn(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}.`,[...ti(n,r),...ti(t,n)])}function Wn(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.`,ni(t,r.name)):(i[r.name]=!0,Nt(r)||e.reportError(`Union type ${t.name} can only include Object types, it cannot include ${$e(r)}.`,ni(t,String(r))))}function Zn(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)qn(e,t)}function ei(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 s of n){var i,r;if(qn(e,s),!wt(s.type))e.reportError(`The type of ${t.name}.${s.name} must be Input Type but got: ${$e(s.type)}.`,null===(i=s.astNode)||void 0===i?void 0:i.type);if(nn(s)&&null!=s.deprecationReason)e.reportError(`Required input field ${t.name}.${s.name} cannot be deprecated.`,[ii(s.astNode),null===(r=s.astNode)||void 0===r?void 0:r.type])}}function ti(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 ni(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 ii(e){var t;return null==e||null===(t=e.directives)||void 0===t?void 0:t.find((e=>e.name.value===Nn.name))}function ri(e,t){switch(t.kind){case se.LIST_TYPE:{const n=ri(e,t.type);return n&&new Rt(n)}case se.NON_NULL_TYPE:{const n=ri(e,t.type);return n&&new Ft(n)}case se.NAMED_TYPE:return e.getType(t.name.value)}}class si{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:oi,t&&(wt(t)&&this._inputTypeStack.push(t),xt(t)&&this._parentTypeStack.push(t),At(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 se.SELECTION_SET:{const e=Vt(this.getType());this._parentTypeStack.push(xt(e)?e:void 0);break}case se.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(At(r)?r:void 0);break}case se.DIRECTIVE:this._directive=t.getDirective(e.name.value);break;case se.OPERATION_DEFINITION:{const n=t.getRootType(e.operation);this._typeStack.push(Nt(n)?n:void 0);break}case se.INLINE_FRAGMENT:case se.FRAGMENT_DEFINITION:{const n=e.typeCondition,i=n?ri(t,n):Vt(this.getType());this._typeStack.push(At(i)?i:void 0);break}case se.VARIABLE_DEFINITION:{const n=ri(t,e.type);this._inputTypeStack.push(wt(n)?n:void 0);break}case se.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(wt(i)?i:void 0);break}case se.LIST:{const e=$t(this.getInputType()),t=Ot(e)?e.ofType:e;this._defaultValueStack.push(void 0),this._inputTypeStack.push(wt(t)?t:void 0);break}case se.OBJECT_FIELD:{const t=Vt(this.getInputType());let n,i;_t(t)&&(i=t.getFields()[e.name.value],i&&(n=i.type)),this._defaultValueStack.push(i?i.defaultValue:void 0),this._inputTypeStack.push(wt(n)?n:void 0);break}case se.ENUM:{const t=Vt(this.getInputType());let n;bt(t)&&(n=t.getValue(e.value)),this._enumValue=n;break}}}leave(e){switch(e.kind){case se.SELECTION_SET:this._parentTypeStack.pop();break;case se.FIELD:this._fieldDefStack.pop(),this._typeStack.pop();break;case se.DIRECTIVE:this._directive=null;break;case se.OPERATION_DEFINITION:case se.INLINE_FRAGMENT:case se.FRAGMENT_DEFINITION:this._typeStack.pop();break;case se.VARIABLE_DEFINITION:this._inputTypeStack.pop();break;case se.ARGUMENT:this._argument=null,this._defaultValueStack.pop(),this._inputTypeStack.pop();break;case se.LIST:case se.OBJECT_FIELD:this._defaultValueStack.pop(),this._inputTypeStack.pop();break;case se.ENUM:this._enumValue=null}}}function oi(e,t,n){const i=n.name.value;return i===$n.name&&e.getQueryType()===t?$n:i===Cn.name&&e.getQueryType()===t?Cn:i===Vn.name&&xt(t)?Vn:Nt(t)||gt(t)?t.getFields()[i]:void 0}function ai(e,t){return{enter(...n){const i=n[0];e.enter(i);const r=at(t,i.kind).enter;if(r){const s=r.apply(t,n);return void 0!==s&&(e.leave(i),ne(s)&&e.enter(s)),s}},leave(...n){const i=n[0],r=at(t,i.kind).leave;let s;return r&&(s=r.apply(t,n)),e.leave(i),s}}}function ci(e){return e.kind===se.OPERATION_DEFINITION||e.kind===se.FRAGMENT_DEFINITION}function ui(e){return e.kind===se.SCALAR_TYPE_DEFINITION||e.kind===se.OBJECT_TYPE_DEFINITION||e.kind===se.INTERFACE_TYPE_DEFINITION||e.kind===se.UNION_TYPE_DEFINITION||e.kind===se.ENUM_TYPE_DEFINITION||e.kind===se.INPUT_OBJECT_TYPE_DEFINITION}function li(e){return e.kind===se.SCALAR_TYPE_EXTENSION||e.kind===se.OBJECT_TYPE_EXTENSION||e.kind===se.INTERFACE_TYPE_EXTENSION||e.kind===se.UNION_TYPE_EXTENSION||e.kind===se.ENUM_TYPE_EXTENSION||e.kind===se.INPUT_OBJECT_TYPE_EXTENSION}function pi(e){const t=Object.create(null),n=e.getSchema(),i=n?n.getDirectives():In;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===se.DIRECTIVE_DEFINITION){var s;const n=null!==(s=e.arguments)&&void 0!==s?s:[];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 s=We(n,r);e.reportError(new z(`Unknown argument "${n}" on directive "@${i}".`+Ge(s),{nodes:t}))}}return!1}}}const di=[...hn,...Un].map((e=>e.name));function fi(e){switch(e.kind){case se.OBJECT:return{...e,fields:(t=e.fields,t.map((e=>({...e,value:fi(e.value)}))).sort(((e,t)=>Ke(e.name.value,t.name.value))))};case se.LIST:return{...e,values:e.values.map(fi)};case se.INT:case se.FLOAT:case se.STRING:case se.BOOLEAN:case se.NULL:case se.ENUM:case se.VARIABLE:return e}var t}function hi(e){return Array.isArray(e)?e.map((([e,t])=>`subfields "${e}" conflict because `+hi(t))).join(" and "):e}function mi(e,t,n,i,r,s,o){const a=e.getFragment(o);if(!a)return;const[c,u]=Ii(e,n,a);if(s!==c){vi(e,t,n,i,r,s,c);for(const a of u)i.has(a,o,r)||(i.add(a,o,r),mi(e,t,n,i,r,s,a))}}function yi(e,t,n,i,r,s,o){if(s===o)return;if(i.has(s,o,r))return;i.add(s,o,r);const a=e.getFragment(s),c=e.getFragment(o);if(!a||!c)return;const[u,l]=Ii(e,n,a),[p,d]=Ii(e,n,c);vi(e,t,n,i,r,u,p);for(const o of d)yi(e,t,n,i,r,s,o);for(const s of l)yi(e,t,n,i,r,s,o)}function vi(e,t,n,i,r,s,o){for(const[a,c]of Object.entries(s)){const s=o[a];if(s)for(const o of c)for(const c of s){const s=Ti(e,n,i,r,a,o,c);s&&t.push(s)}}}function Ti(e,t,n,i,r,s,o){const[a,c,u]=s,[l,p,d]=o,f=i||a!==l&&Nt(a)&&Nt(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(Ei(c)!==Ei(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&&Ni(h,m))return[[r,`they return conflicting types "${$e(h)}" and "${$e(m)}"`],[c],[p]];const y=c.selectionSet,v=p.selectionSet;if(y&&v){const i=function(e,t,n,i,r,s,o,a){const c=[],[u,l]=gi(e,t,r,s),[p,d]=gi(e,t,o,a);vi(e,c,t,n,i,u,p);for(const r of d)mi(e,c,t,n,i,u,r);for(const r of l)mi(e,c,t,n,i,p,r);for(const r of l)for(const s of d)yi(e,c,t,n,i,r,s);return c}(e,t,n,f,Vt(h),y,Vt(m),v);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 Ei(e){var t;const n=null!==(t=e.arguments)&&void 0!==t?t:[];return ct(fi({kind:se.OBJECT,fields:n.map((e=>({kind:se.OBJECT_FIELD,name:e.name,value:e.value})))}))}function Ni(e,t){return Ot(e)?!Ot(t)||Ni(e.ofType,t.ofType):!!Ot(t)||(St(e)?!St(t)||Ni(e.ofType,t.ofType):!!St(t)||!(!Dt(e)&&!Dt(t))&&e!==t)}function gi(e,t,n,i){const r=t.get(i);if(r)return r;const s=Object.create(null),o=Object.create(null);bi(e,n,i,s,o);const a=[s,Object.keys(o)];return t.set(i,a),a}function Ii(e,t,n){const i=t.get(n.selectionSet);if(i)return i;const r=ri(e.getSchema(),n.typeCondition);return gi(e,t,r,n.selectionSet)}function bi(e,t,n,i,r){for(const s of n.selections)switch(s.kind){case se.FIELD:{const e=s.name.value;let n;(Nt(t)||gt(t))&&(n=t.getFields()[e]);const r=s.alias?s.alias.value:e;i[r]||(i[r]=[]),i[r].push([t,s,n]);break}case se.FRAGMENT_SPREAD:r[s.name.value]=!0;break;case se.INLINE_FRAGMENT:{const n=s.typeCondition,o=n?ri(e.getSchema(),n):t;bi(e,o,s.selectionSet,i,r);break}}}class _i{constructor(){this._data=new Map}has(e,t,n){var i;const[r,s]=e<t?[e,t]:[t,e],o=null===(i=this._data.get(r))||void 0===i?void 0:i.get(s);return void 0!==o&&(!!n||n===o)}add(e,t,n){const[i,r]=e<t?[e,t]:[t,e],s=this._data.get(i);void 0===s?this._data.set(i,new Map([[r,n]])):s.set(r,n)}}function Oi(e){var t;const n=Object.create(null),i=e.getSchema(),r=null!==(t=null==i?void 0:i.getDirectives())&&void 0!==t?t:In;for(const e of r)n[e.name]=Ye(e.args.filter(Kt),(e=>e.name));const s=e.getDocument().definitions;for(const e of s)if(e.kind===se.DIRECTIVE_DEFINITION){var o;const t=null!==(o=e.arguments)&&void 0!==o?o:[];n[e.name.value]=Ye(t.filter(Si),(e=>e.name.value))}return{Directive:{leave(t){const i=t.name.value,r=n[i];if(r){var s;const n=null!==(s=t.arguments)&&void 0!==s?s:[],o=new Set(n.map((e=>e.name.value)));for(const[n,s]of Object.entries(r))if(!o.has(n)){const r=Tt(s.type)?$e(s.type):ct(s.type);e.reportError(new z(`Directive "@${i}" argument "${n}" of type "${r}" is required, but it was not provided.`,{nodes:t}))}}}}}}function Si(e){return e.type.kind===se.NON_NULL_TYPE&&null==e.defaultValue}function wi(e){return e.map((e=>"number"==typeof e?"["+e.toString()+"]":"."+e)).join("")}function Ai(e,t,n){return{prev:e,key:t,typename:n}}function Di(e){const t=[];let n=e;for(;n;)t.push(n.key),n=n.prev;return t.reverse()}function xi(e,t,n=ki){return Ri(e,t,n,void 0)}function ki(e,t,n){let i="Invalid value "+$e(t);throw e.length>0&&(i+=` at "value${wi(e)}"`),n.message=i+": "+n.message,n}function Ri(e,t,n,i){if(St(t))return null!=e?Ri(e,t.ofType,n,i):void n(Di(i),e,new z(`Expected non-nullable type "${$e(t)}" not to be null.`));if(null==e)return null;if(Ot(t)){const r=t.ofType;return bn(e)?Array.from(e,((e,t)=>{const s=Ai(i,t,void 0);return Ri(e,r,n,s)})):[Ri(e,r,n,i)]}if(_t(t)){if(!G(e))return void n(Di(i),e,new z(`Expected type "${t.name}" to be an object.`));const r={},s=t.getFields();for(const o of Object.values(s)){const s=e[o.name];if(void 0!==s)r[o.name]=Ri(s,o.type,n,Ai(i,o.name,t.name));else if(void 0!==o.defaultValue)r[o.name]=o.defaultValue;else if(St(o.type)){const t=$e(o.type);n(Di(i),e,new z(`Field "${o.name}" of required type "${t}" was not provided.`))}}for(const r of Object.keys(e))if(!s[r]){const s=We(r,Object.keys(t.getFields()));n(Di(i),e,new z(`Field "${r}" is not defined by type "${t.name}".`+Ge(s)))}return r}if(Dt(t)){let r;try{r=t.parseValue(e)}catch(r){return void n(Di(i),e,r instanceof z?r:new z(`Expected type "${t.name}". `+r.message,{originalError:r}))}return void 0===r&&n(Di(i),e,new z(`Expected type "${t.name}".`)),r}J(!1,"Unexpected input type: "+$e(t))}function Fi(e,t,n){if(e){if(e.kind===se.VARIABLE){const i=e.name.value;if(null==n||void 0===n[i])return;const r=n[i];if(null===r&&St(t))return;return r}if(St(t)){if(e.kind===se.NULL)return;return Fi(e,t.ofType,n)}if(e.kind===se.NULL)return null;if(Ot(t)){const i=t.ofType;if(e.kind===se.LIST){const t=[];for(const r of e.values)if(Li(r,n)){if(St(i))return;t.push(null)}else{const e=Fi(r,i,n);if(void 0===e)return;t.push(e)}return t}const r=Fi(e,i,n);if(void 0===r)return;return[r]}if(_t(t)){if(e.kind!==se.OBJECT)return;const i=Object.create(null),r=Ye(e.fields,(e=>e.name.value));for(const e of Object.values(t.getFields())){const t=r[e.name];if(!t||Li(t.value,n)){if(void 0!==e.defaultValue)i[e.name]=e.defaultValue;else if(St(e.type))return;continue}const s=Fi(t.value,e.type,n);if(void 0===s)return;i[e.name]=s}return i}if(Dt(t)){let i;try{i=t.parseLiteral(e,n)}catch(e){return}if(void 0===i)return;return i}J(!1,"Unexpected input type: "+$e(t))}}function Li(e,t){return e.kind===se.VARIABLE&&(null==t||void 0===t[e.name.value])}function $i(e,t,n,i){const r=[],s=null==i?void 0:i.maxErrors;try{const i=function(e,t,n,i){const r={};for(const s of t){const t=s.variable.name.value,o=ri(e,s.type);if(!wt(o)){const e=ct(s.type);i(new z(`Variable "$${t}" expected value of type "${e}" which cannot be used as an input type.`,{nodes:s.type}));continue}if(!Ui(n,t)){if(s.defaultValue)r[t]=Fi(s.defaultValue,o);else if(St(o)){const e=$e(o);i(new z(`Variable "$${t}" of required type "${e}" was not provided.`,{nodes:s}))}continue}const a=n[t];if(null===a&&St(o)){const e=$e(o);i(new z(`Variable "$${t}" of non-null type "${e}" must not be null.`,{nodes:s}))}else r[t]=xi(a,o,((e,n,r)=>{let o=`Variable "$${t}" got invalid value `+$e(n);e.length>0&&(o+=` at "${t}${wi(e)}"`),i(new z(o+"; "+r.message,{nodes:s,originalError:r.originalError}))}))}return r}(e,t,n,(e=>{if(null!=s&&r.length>=s)throw new z("Too many errors processing variables, error limit reached. Execution aborted.");r.push(e)}));if(0===r.length)return{coerced:i}}catch(e){r.push(e)}return{errors:r}}function Ci(e,t,n){var i;const r={},s=Ye(null!==(i=t.arguments)&&void 0!==i?i:[],(e=>e.name.value));for(const i of e.args){const e=i.name,o=i.type,a=s[e];if(!a){if(void 0!==i.defaultValue)r[e]=i.defaultValue;else if(St(o))throw new z(`Argument "${e}" of required type "${$e(o)}" was not provided.`,{nodes:t});continue}const c=a.value;let u=c.kind===se.NULL;if(c.kind===se.VARIABLE){const t=c.name.value;if(null==n||!Ui(n,t)){if(void 0!==i.defaultValue)r[e]=i.defaultValue;else if(St(o))throw new z(`Argument "${e}" of required type "${$e(o)}" was provided the variable "$${t}" which was not provided a runtime value.`,{nodes:c});continue}u=null==n[t]}if(u&&St(o))throw new z(`Argument "${e}" of non-null type "${$e(o)}" must not be null.`,{nodes:c});const l=Fi(c,o,n);if(void 0===l)throw new z(`Argument "${e}" has invalid value ${ct(c)}.`,{nodes:c});r[e]=l}return r}function Vi(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 Ci(e,r,n)}function Ui(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function ji(e,t,n,i,r){const s=new Map;return Mi(e,t,n,i,r,s,new Set),s}function Mi(e,t,n,i,r,s,o){for(const c of r.selections)switch(c.kind){case se.FIELD:{if(!Pi(n,c))continue;const e=(a=c).alias?a.alias.value:a.name.value,t=s.get(e);void 0!==t?t.push(c):s.set(e,[c]);break}case se.INLINE_FRAGMENT:if(!Pi(n,c)||!Bi(e,c,i))continue;Mi(e,t,n,i,c.selectionSet,s,o);break;case se.FRAGMENT_SPREAD:{const r=c.name.value;if(o.has(r)||!Pi(n,c))continue;o.add(r);const a=t[r];if(!a||!Bi(e,a,i))continue;Mi(e,t,n,i,a.selectionSet,s,o);break}}var a}function Pi(e,t){const n=Vi(En,t,e);if(!0===(null==n?void 0:n.if))return!1;const i=Vi(Tn,t,e);return!1!==(null==i?void 0:i.if)}function Bi(e,t,n){const i=t.typeCondition;if(!i)return!0;const r=ri(e,i);return r===n||!!kt(r)&&e.isSubType(r,n)}function Gi(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 Ji(e,t){const n=e.getInputType();if(!n)return;const i=Vt(n);if(Dt(i))try{if(void 0===i.parseLiteral(t,void 0)){const i=$e(n);e.reportError(new z(`Expected value of type "${i}", found ${ct(t)}.`,{nodes:t}))}}catch(i){const r=$e(n);i instanceof z?e.reportError(i):e.reportError(new z(`Expected value of type "${r}", found ${ct(t)}; `+i.message,{nodes:t,originalError:i}))}else{const i=$e(n);e.reportError(new z(`Expected value of type "${i}", found ${ct(t)}.`,{nodes:t}))}}function Yi(e,t,n,i,r){if(St(i)&&!St(t)){if(!(null!=n&&n.kind!==se.NULL)&&!(void 0!==r))return!1;return sn(e,t,i.ofType)}return sn(e,t,i)}const Qi=Object.freeze([function(e){return{Document(t){for(const n of t.definitions)if(!ci(n)){const t=n.kind===se.SCHEMA_DEFINITION||n.kind===se.SCHEMA_EXTENSION?"schema":'"'+n.name.value+'"';e.reportError(new z(`The ${t} definition is not executable.`,{nodes: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 z(`There can be only one operation named "${i.value}".`,{nodes:[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===se.OPERATION_DEFINITION)).length},OperationDefinition(n){!n.name&&t>1&&e.reportError(new z("This anonymous operation must be the only defined operation.",{nodes: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,s=Object.create(null),o=e.getDocument(),a=Object.create(null);for(const e of o.definitions)e.kind===se.FRAGMENT_DEFINITION&&(a[e.name.value]=e);const c=ji(n,a,s,i,t.selectionSet);if(c.size>1){const t=[...c.values()].slice(1).flat();e.reportError(new z(null!=r?`Subscription "${r}" must select only one top level field.`:"Anonymous Subscription must select only one top level field.",{nodes:t}))}for(const t of c.values()){t[0].name.value.startsWith("__")&&e.reportError(new z(null!=r?`Subscription "${r}" must not select an introspection top level field.`:"Anonymous Subscription must not select an introspection top level field.",{nodes:t}))}}}}}},function(e){const t=e.getSchema(),n=t?t.getTypeMap():Object.create(null),i=Object.create(null);for(const t of e.getDocument().definitions)ui(t)&&(i[t.name.value]=!0);const r=[...Object.keys(n),...Object.keys(i)];return{NamedType(t,s,o,a,c){const u=t.name.value;if(!n[u]&&!i[u]){var l;const n=null!==(l=c[2])&&void 0!==l?l:o,i=null!=n&&("kind"in(p=n)&&(function(e){return e.kind===se.SCHEMA_DEFINITION||ui(e)||e.kind===se.DIRECTIVE_DEFINITION}(p)||function(e){return e.kind===se.SCHEMA_EXTENSION||li(e)}(p)));if(i&&di.includes(u))return;const s=We(u,i?di.concat(r):r);e.reportError(new z(`Unknown type "${u}".`+Ge(s),{nodes:t}))}var p}}},function(e){return{InlineFragment(t){const n=t.typeCondition;if(n){const t=ri(e.getSchema(),n);if(t&&!xt(t)){const t=ct(n);e.reportError(new z(`Fragment cannot condition on non composite type "${t}".`,{nodes:n}))}}},FragmentDefinition(t){const n=ri(e.getSchema(),t.typeCondition);if(n&&!xt(n)){const n=ct(t.typeCondition);e.reportError(new z(`Fragment "${t.name.value}" cannot condition on non composite type "${n}".`,{nodes:t.typeCondition}))}}}},function(e){return{VariableDefinition(t){const n=ri(e.getSchema(),t.type);if(void 0!==n&&!wt(n)){const n=t.variable.name.value,i=ct(t.type);e.reportError(new z(`Variable "$${n}" cannot be non-input type "${i}".`,{nodes:t.type}))}}}},function(e){return{Field(t){const n=e.getType(),i=t.selectionSet;if(n)if(Dt(Vt(n))){if(i){const r=t.name.value,s=$e(n);e.reportError(new z(`Field "${r}" must not have a selection since type "${s}" has no subfields.`,{nodes:i}))}}else if(!i){const i=t.name.value,r=$e(n);e.reportError(new z(`Field "${i}" of type "${r}" must have a selection of subfields. Did you mean "${i} { ... }"?`,{nodes:t}))}}}},function(e){return{Field(t){const n=e.getParentType();if(n){if(!e.getFieldDef()){const i=e.getSchema(),r=t.name.value;let s=Ge("to use an inline fragment on",function(e,t,n){if(!kt(t))return[];const i=new Set,r=Object.create(null);for(const o of e.getPossibleTypes(t))if(o.getFields()[n]){i.add(o),r[o.name]=1;for(const e of o.getInterfaces()){var s;e.getFields()[n]&&(i.add(e),r[e.name]=(null!==(s=r[e.name])&&void 0!==s?s:0)+1)}}return[...i].sort(((t,n)=>{const i=r[n.name]-r[t.name];return 0!==i?i:gt(t)&&e.isSubType(t,n)?-1:gt(n)&&e.isSubType(n,t)?1:Ke(t.name,n.name)})).map((e=>e.name))}(i,n,r));""===s&&(s=Ge(function(e,t){if(Nt(e)||gt(e)){return We(t,Object.keys(e.getFields()))}return[]}(n,r))),e.reportError(new z(`Cannot query field "${r}" on type "${n.name}".`+s,{nodes:t}))}}}}},function(e){const t=Object.create(null);return{OperationDefinition:()=>!1,FragmentDefinition(n){const i=n.name.value;return t[i]?e.reportError(new z(`There can be only one fragment named "${i}".`,{nodes:[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 z(`Unknown fragment "${n}".`,{nodes:t.name}))}}},function(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 z(`Fragment "${n}" is never used.`,{nodes:t}))}}}}},function(e){return{InlineFragment(t){const n=e.getType(),i=e.getParentType();if(xt(n)&&xt(i)&&!on(e.getSchema(),n,i)){const r=$e(i),s=$e(n);e.reportError(new z(`Fragment cannot be spread here as objects of type "${r}" can never be of type "${s}".`,{nodes:t}))}},FragmentSpread(t){const n=t.name.value,i=function(e,t){const n=e.getFragment(t);if(n){const t=ri(e.getSchema(),n.typeCondition);if(xt(t))return t}}(e,n),r=e.getParentType();if(i&&r&&!on(e.getSchema(),i,r)){const s=$e(r),o=$e(i);e.reportError(new z(`Fragment "${n}" cannot be spread here as objects of type "${s}" can never be of type "${o}".`,{nodes:t}))}}}},function(e){const t=Object.create(null),n=[],i=Object.create(null);return{OperationDefinition:()=>!1,FragmentDefinition:e=>(r(e),!1)};function r(s){if(t[s.name.value])return;const o=s.name.value;t[o]=!0;const a=e.getFragmentSpreads(s.selectionSet);if(0!==a.length){i[o]=n.length;for(const t of a){const s=t.name.value,o=i[s];if(n.push(t),void 0===o){const t=e.getFragment(s);t&&r(t)}else{const t=n.slice(o),i=t.slice(0,-1).map((e=>'"'+e.name.value+'"')).join(", ");e.reportError(new z(`Cannot spread fragment "${s}" within itself`+(""!==i?` via ${i}.`:"."),{nodes:t}))}n.pop()}i[o]=void 0}}},function(e){return{OperationDefinition(t){var n;const i=Gi(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 z(`There can be only one variable named "$${t}".`,{nodes: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 z(n.name?`Variable "$${i}" is not defined by operation "${n.name.value}".`:`Variable "$${i}" is not defined.`,{nodes:[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 z(n.name?`Variable "$${t}" is never used in operation "${n.name.value}".`:`Variable "$${t}" is never used.`,{nodes:r}))}}},VariableDefinition(e){t.push(e)}}},function(e){const t=Object.create(null),n=e.getSchema(),i=n?n.getDirectives():In;for(const e of i)t[e.name]=e.locations;const r=e.getDocument().definitions;for(const e of r)e.kind===se.DIRECTIVE_DEFINITION&&(t[e.name.value]=e.locations.map((e=>e.value)));return{Directive(n,i,r,s,o){const a=n.name.value,c=t[a];if(!c)return void e.reportError(new z(`Unknown directive "@${a}".`,{nodes:n}));const u=function(e){const t=e[e.length-1];switch("kind"in t||J(!1),t.kind){case se.OPERATION_DEFINITION:return function(e){switch(e){case ie.QUERY:return re.QUERY;case ie.MUTATION:return re.MUTATION;case ie.SUBSCRIPTION:return re.SUBSCRIPTION}}(t.operation);case se.FIELD:return re.FIELD;case se.FRAGMENT_SPREAD:return re.FRAGMENT_SPREAD;case se.INLINE_FRAGMENT:return re.INLINE_FRAGMENT;case se.FRAGMENT_DEFINITION:return re.FRAGMENT_DEFINITION;case se.VARIABLE_DEFINITION:return re.VARIABLE_DEFINITION;case se.SCHEMA_DEFINITION:case se.SCHEMA_EXTENSION:return re.SCHEMA;case se.SCALAR_TYPE_DEFINITION:case se.SCALAR_TYPE_EXTENSION:return re.SCALAR;case se.OBJECT_TYPE_DEFINITION:case se.OBJECT_TYPE_EXTENSION:return re.OBJECT;case se.FIELD_DEFINITION:return re.FIELD_DEFINITION;case se.INTERFACE_TYPE_DEFINITION:case se.INTERFACE_TYPE_EXTENSION:return re.INTERFACE;case se.UNION_TYPE_DEFINITION:case se.UNION_TYPE_EXTENSION:return re.UNION;case se.ENUM_TYPE_DEFINITION:case se.ENUM_TYPE_EXTENSION:return re.ENUM;case se.ENUM_VALUE_DEFINITION:return re.ENUM_VALUE;case se.INPUT_OBJECT_TYPE_DEFINITION:case se.INPUT_OBJECT_TYPE_EXTENSION:return re.INPUT_OBJECT;case se.INPUT_VALUE_DEFINITION:{const t=e[e.length-3];return"kind"in t||J(!1),t.kind===se.INPUT_OBJECT_TYPE_DEFINITION?re.INPUT_FIELD_DEFINITION:re.ARGUMENT_DEFINITION}default:J(!1,"Unexpected kind: "+$e(t.kind))}}(o);u&&!c.includes(u)&&e.reportError(new z(`Directive "@${a}" may not be used on ${u}.`,{nodes:n}))}}},function(e){const t=Object.create(null),n=e.getSchema(),i=n?n.getDirectives():In;for(const e of i)t[e.name]=!e.isRepeatable;const r=e.getDocument().definitions;for(const e of r)e.kind===se.DIRECTIVE_DEFINITION&&(t[e.name.value]=!e.repeatable);const s=Object.create(null),o=Object.create(null);return{enter(n){if(!("directives"in n)||!n.directives)return;let i;if(n.kind===se.SCHEMA_DEFINITION||n.kind===se.SCHEMA_EXTENSION)i=s;else if(ui(n)||li(n)){const e=n.name.value;i=o[e],void 0===i&&(o[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 z(`The directive "@${n}" can only be used once at this location.`,{nodes:[i[n],r]})):i[n]=r)}}}},function(e){return{...pi(e),Argument(t){const n=e.getArgument(),i=e.getFieldDef(),r=e.getParentType();if(!n&&i&&r){const n=t.name.value,s=We(n,i.args.map((e=>e.name)));e.reportError(new z(`Unknown argument "${n}" on field "${r.name}.${i.name}".`+Ge(s),{nodes:t}))}}}},function(e){return{Field:t,Directive:t};function t(t){var n;const i=Gi(null!==(n=t.arguments)&&void 0!==n?n:[],(e=>e.name.value));for(const[t,n]of i)n.length>1&&e.reportError(new z(`There can be only one argument named "${t}".`,{nodes:n.map((e=>e.name))}))}},function(e){return{ListValue(t){if(!Ot($t(e.getParentInputType())))return Ji(e,t),!1},ObjectValue(t){const n=Vt(e.getInputType());if(!_t(n))return Ji(e,t),!1;const i=Ye(t.fields,(e=>e.name.value));for(const r of Object.values(n.getFields())){if(!i[r.name]&&nn(r)){const i=$e(r.type);e.reportError(new z(`Field "${n.name}.${r.name}" of required type "${i}" was not provided.`,{nodes:t}))}}},ObjectField(t){const n=Vt(e.getParentInputType());if(!e.getInputType()&&_t(n)){const i=We(t.name.value,Object.keys(n.getFields()));e.reportError(new z(`Field "${t.name.value}" is not defined by type "${n.name}".`+Ge(i),{nodes:t}))}},NullValue(t){const n=e.getInputType();St(n)&&e.reportError(new z(`Expected value of type "${$e(n)}", found ${ct(t)}.`,{nodes:t}))},EnumValue:t=>Ji(e,t),IntValue:t=>Ji(e,t),FloatValue:t=>Ji(e,t),StringValue:t=>Ji(e,t),BooleanValue:t=>Ji(e,t)}},function(e){return{...Oi(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)&&Kt(n)){const r=$e(n.type);e.reportError(new z(`Field "${i.name}" argument "${n.name}" of type "${r}" is required, but it was not provided.`,{nodes: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:s}of i){const i=n.name.value,o=t[i];if(o&&r){const t=e.getSchema(),a=ri(t,o.type);if(a&&!Yi(t,a,o.defaultValue,r,s)){const t=$e(a),s=$e(r);e.reportError(new z(`Variable "$${i}" of type "${t}" used in position expecting type "${s}".`,{nodes:[o,n]}))}}}}},VariableDefinition(e){t[e.variable.name.value]=e}}},function(e){const t=new _i,n=new Map;return{SelectionSet(i){const r=function(e,t,n,i,r){const s=[],[o,a]=gi(e,t,i,r);if(function(e,t,n,i,r){for(const[s,o]of Object.entries(r))if(o.length>1)for(let r=0;r<o.length;r++)for(let a=r+1;a<o.length;a++){const c=Ti(e,n,i,!1,s,o[r],o[a]);c&&t.push(c)}}(e,s,t,n,o),0!==a.length)for(let i=0;i<a.length;i++){mi(e,s,t,n,!1,o,a[i]);for(let r=i+1;r<a.length;r++)yi(e,s,t,n,!1,a[i],a[r])}return s}(e,n,t,e.getParentType(),i);for(const[[t,n],i,s]of r){const r=hi(n);e.reportError(new z(`Fields "${t}" conflict because ${r}. Use different aliases on the fields to fetch both if this was intentional.`,{nodes:i.concat(s)}))}}}},function(e){const t=[];let n=Object.create(null);return{ObjectValue:{enter(){t.push(n),n=Object.create(null)},leave(){const e=t.pop();e||J(!1),n=e}},ObjectField(t){const i=t.name.value;n[i]?e.reportError(new z(`There can be only one input field named "${i}".`,{nodes:[n[i],t.name]})):n[i]=t.name}}}]);class qi{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===se.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===se.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 Ki extends qi{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 si(this._schema);ot(e,ai(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 zi(e,t,n=Qi,i,r=new si(e)){var s;const o=null!==(s=null==i?void 0:i.maxErrors)&&void 0!==s?s:100;t||P(!1,"Must provide document."),Jn(e);const a=Object.freeze({}),c=[],u=new Ki(e,t,r,(e=>{if(c.length>=o)throw c.push(new z("Too many validation errors, error limit reached. Validation aborted.")),a;c.push(e)})),l=function(e){const t=new Array(e.length).fill(null),n=Object.create(null);for(const i of Object.values(se)){let r=!1;const s=new Array(e.length).fill(void 0),o=new Array(e.length).fill(void 0);for(let t=0;t<e.length;++t){const{enter:n,leave:a}=at(e[t],i);r||(r=null!=n||null!=a),s[t]=n,o[t]=a}if(!r)continue;const a={enter(...n){const i=n[0];for(let o=0;o<e.length;o++)if(null===t[o]){var r;const a=null===(r=s[o])||void 0===r?void 0:r.apply(e[o],n);if(!1===a)t[o]=i;else if(a===st)t[o]=st;else if(void 0!==a)return a}},leave(...n){const i=n[0];for(let s=0;s<e.length;s++)if(null===t[s]){var r;const i=null===(r=o[s])||void 0===r?void 0:r.apply(e[s],n);if(i===st)t[s]=st;else if(void 0!==i&&!1!==i)return i}else t[s]===i&&(t[s]=null)}};n[i]=a}return n}(n.map((e=>e(u))));try{ot(t,ai(r,l))}catch(e){if(e!==a)throw e}return c}class Xi extends Error{constructor(e){super("Unexpected error value: "+$e(e)),this.name="NonErrorThrown",this.thrownValue=e}}function Hi(e,t,n){var i;const r=(s=e)instanceof Error?s:new Xi(s);var s,o;return o=r,Array.isArray(o.path)?r:new z(r.message,{nodes:null!==(i=r.nodes)&&void 0!==i?i:t,source:r.source,positions:r.positions,path:n,originalError:r})}const Wi=function(e){let t;return function(n,i,r){void 0===t&&(t=new WeakMap);let s=t.get(n);void 0===s&&(s=new WeakMap,t.set(n,s));let o=s.get(i);void 0===o&&(o=new WeakMap,s.set(i,o));let a=o.get(r);return void 0===a&&(a=e(n,i,r),o.set(r,a)),a}}(((e,t,n)=>function(e,t,n,i,r){const s=new Map,o=new Set;for(const a of r)a.selectionSet&&Mi(e,t,n,i,a.selectionSet,s,o);return s}(e.schema,e.fragments,e.variableValues,t,n)));function Zi(e){arguments.length<2||P(!1,"graphql@16 dropped long-deprecated support for positional arguments, please pass an object instead.");const{schema:t,document:n,variableValues:i,rootValue:r}=e;!function(e,t,n){t||P(!1,"Must provide document."),Jn(e),null==n||G(n)||P(!1,"Variables must be provided as an Object where each property is a variable value. Perhaps look to see if an unparsed JSON string was provided.")}(t,n,i);const s=function(e){var t,n;const{schema:i,document:r,rootValue:s,contextValue:o,variableValues:a,operationName:c,fieldResolver:u,typeResolver:l,subscribeFieldResolver:p}=e;let d;const f=Object.create(null);for(const e of r.definitions)switch(e.kind){case se.OPERATION_DEFINITION:if(null==c){if(void 0!==d)return[new z("Must provide operation name if query contains multiple operations.")];d=e}else(null===(t=e.name)||void 0===t?void 0:t.value)===c&&(d=e);break;case se.FRAGMENT_DEFINITION:f[e.name.value]=e}if(!d)return null!=c?[new z(`Unknown operation named "${c}".`)]:[new z("Must provide an operation.")];const h=null!==(n=d.variableDefinitions)&&void 0!==n?n:[],m=$i(i,h,null!=a?a:{},{maxErrors:50});if(m.errors)return m.errors;return{schema:i,fragments:f,rootValue:s,contextValue:o,operation:d,variableValues:m.coerced,fieldResolver:null!=u?u:ur,typeResolver:null!=l?l:cr,subscribeFieldResolver:null!=p?p:ur,errors:[]}}(e);if(!("schema"in s))return{errors:s};try{const{operation:e}=s,t=function(e,t,n){const i=e.schema.getRootType(t.operation);if(null==i)throw new z(`Schema is not configured to execute ${t.operation} operation.`,{nodes:t});const r=ji(e.schema,e.fragments,e.variableValues,i,t.selectionSet),s=void 0;switch(t.operation){case ie.QUERY:return tr(e,i,n,s,r);case ie.MUTATION:return function(e,t,n,i,r){return function(e,t,n){let i=n;for(const n of e)i=B(i)?i.then((e=>t(e,n))):t(i,n);return i}(r.entries(),((r,[s,o])=>{const a=Ai(i,s,t.name),c=nr(e,t,n,o,a);return void 0===c?r:B(c)?c.then((e=>(r[s]=e,r))):(r[s]=c,r)}),Object.create(null))}(e,i,n,s,r);case ie.SUBSCRIPTION:return tr(e,i,n,s,r)}}(s,e,r);return B(t)?t.then((e=>er(e,s.errors)),(e=>(s.errors.push(e),er(null,s.errors)))):er(t,s.errors)}catch(e){return s.errors.push(e),er(null,s.errors)}}function er(e,t){return 0===t.length?{data:e}:{errors:t,data:e}}function tr(e,t,n,i,r){const s=Object.create(null);let o=!1;for(const[a,c]of r.entries()){const r=nr(e,t,n,c,Ai(i,a,t.name));void 0!==r&&(s[a]=r,B(r)&&(o=!0))}return o?(a=s,Promise.all(Object.values(a)).then((e=>{const t=Object.create(null);for(const[n,i]of Object.keys(a).entries())t[i]=e[n];return t}))):s;var a}function nr(e,t,n,i,r){var s;const o=function(e,t,n){const i=n.name.value;if(i===$n.name&&e.getQueryType()===t)return $n;if(i===Cn.name&&e.getQueryType()===t)return Cn;if(i===Vn.name)return Vn;return t.getFields()[i]}(e.schema,t,i[0]);if(!o)return;const a=o.type,c=null!==(s=o.resolve)&&void 0!==s?s:e.fieldResolver,u=function(e,t,n,i,r){return{fieldName:t.name,fieldNodes:n,returnType:t.type,parentType:i,path:r,schema:e.schema,fragments:e.fragments,rootValue:e.rootValue,operation:e.operation,variableValues:e.variableValues}}(e,o,i,t,r);try{const t=Ci(o,i[0],e.variableValues),s=c(n,t,e.contextValue,u);let l;return l=B(s)?s.then((t=>rr(e,a,i,u,r,t))):rr(e,a,i,u,r,s),B(l)?l.then(void 0,(t=>ir(Hi(t,i,Di(r)),a,e))):l}catch(t){return ir(Hi(t,i,Di(r)),a,e)}}function ir(e,t,n){if(St(t))throw e;return n.errors.push(e),null}function rr(e,t,n,i,r,s){if(s instanceof Error)throw s;if(St(t)){const o=rr(e,t.ofType,n,i,r,s);if(null===o)throw new Error(`Cannot return null for non-nullable field ${i.parentType.name}.${i.fieldName}.`);return o}return null==s?null:Ot(t)?function(e,t,n,i,r,s){if(!bn(s))throw new z(`Expected Iterable, but did not find one for field "${i.parentType.name}.${i.fieldName}".`);const o=t.ofType;let a=!1;const c=Array.from(s,((t,s)=>{const c=Ai(r,s,void 0);try{let r;return r=B(t)?t.then((t=>rr(e,o,n,i,c,t))):rr(e,o,n,i,c,t),B(r)?(a=!0,r.then(void 0,(t=>ir(Hi(t,n,Di(c)),o,e)))):r}catch(t){return ir(Hi(t,n,Di(c)),o,e)}}));return a?Promise.all(c):c}(e,t,n,i,r,s):Dt(t)?function(e,t){const n=e.serialize(t);if(null==n)throw new Error(`Expected \`${$e(e)}.serialize(${$e(t)})\` to return non-nullable value, returned: ${$e(n)}`);return n}(t,s):kt(t)?function(e,t,n,i,r,s){var o;const a=null!==(o=t.resolveType)&&void 0!==o?o:e.typeResolver,c=e.contextValue,u=a(s,c,i,t);if(B(u))return u.then((o=>or(e,sr(o,e,t,n,i,s),n,i,r,s)));return or(e,sr(u,e,t,n,i,s),n,i,r,s)}(e,t,n,i,r,s):Nt(t)?or(e,t,n,i,r,s):void J(!1,"Cannot complete value of unexpected output type: "+$e(t))}function sr(e,t,n,i,r,s){if(null==e)throw new z(`Abstract type "${n.name}" must resolve to an Object type at runtime for field "${r.parentType.name}.${r.fieldName}". Either the "${n.name}" type should provide a "resolveType" function or each possible type should provide an "isTypeOf" function.`,i);if(Nt(e))throw new z("Support for returning GraphQLObjectType from resolveType was removed in graphql-js@16.0.0 please return type name instead.");if("string"!=typeof e)throw new z(`Abstract type "${n.name}" must resolve to an Object type at runtime for field "${r.parentType.name}.${r.fieldName}" with value ${$e(s)}, received "${$e(e)}".`);const o=t.schema.getType(e);if(null==o)throw new z(`Abstract type "${n.name}" was resolved to a type "${e}" that does not exist inside the schema.`,{nodes:i});if(!Nt(o))throw new z(`Abstract type "${n.name}" was resolved to a non-object type "${e}".`,{nodes:i});if(!t.schema.isSubType(n,o))throw new z(`Runtime Object type "${o.name}" is not a possible type for "${n.name}".`,{nodes:i});return o}function or(e,t,n,i,r,s){const o=Wi(e,t,n);if(t.isTypeOf){const a=t.isTypeOf(s,e.contextValue,i);if(B(a))return a.then((i=>{if(!i)throw ar(t,s,n);return tr(e,t,s,r,o)}));if(!a)throw ar(t,s,n)}return tr(e,t,s,r,o)}function ar(e,t,n){return new z(`Expected value of type "${e.name}" but got: ${$e(t)}.`,{nodes:n})}const cr=function(e,t,n,i){if(G(e)&&"string"==typeof e.__typename)return e.__typename;const r=n.schema.getPossibleTypes(i),s=[];for(let i=0;i<r.length;i++){const o=r[i];if(o.isTypeOf){const r=o.isTypeOf(e,t,n);if(B(r))s[i]=r;else if(r)return o.name}}return s.length?Promise.all(s).then((e=>{for(let t=0;t<e.length;t++)if(e[t])return r[t].name})):void 0},ur=function(e,t,n,i){if(G(e)||"function"==typeof e){const r=e[i.fieldName];return"function"==typeof r?e[i.fieldName](t,n,i):r}};const lr={base64Binary:pn,boolean:dn,canonical:pn,code:pn,date:pn,dateTime:pn,decimal:ln,id:fn,instant:pn,integer:ln,markdown:pn,number:ln,positiveInt:ln,string:pn,time:pn,unsignedInt:ln,uri:pn,url:pn,xhtml:pn,"http://hl7.org/fhirpath/System.Boolean":dn,"http://hl7.org/fhirpath/System.Date":pn,"http://hl7.org/fhirpath/System.DateTime":pn,"http://hl7.org/fhirpath/System.Decimal":ln,"http://hl7.org/fhirpath/System.Integer":ln,"http://hl7.org/fhirpath/System.String":pn,"http://hl7.org/fhirpath/System.Time":pn},pr=new c;let dr;async function fr(e,n){const{query:i,operationName:r,variables:s}=e.body;if(!i)return[t("Must provide query.")];let o;try{o=new je(i,c).parseDocument()}catch(e){return[t("GraphQL syntax error.")]}var c;const p=function(){dr||(dr=function(){for(const e of l())lr[e]=mr(e);const e={};for(const t of l()){const n=hr(t);e[t]={type:n,args:{id:{type:new Ft(fn),description:t+" ID"}},resolve:Er},e[t+"List"]={type:new Rt(n),args:yr(t),resolve:Tr}}return new Pn({query:new Pt({name:"QueryType",fields:e})})}());return dr}(),d=zi(p,o,[...Qi,_r]);if(d.length>0)return[(f=d,{resourceType:"OperationOutcome",issue:f.map((e=>({severity:"error",code:"invalid",details:{text:e.message}})))})];var f;const h=function(e){return e.includes("query IntrospectionQuery")||e.includes("__schema")||e.includes("__type")}(i);if(h)return[u];const m=new O((e=>n.readReferences(e)));let y=h&&pr.get(i);return y||(y=await Zi({schema:p,document:o,contextValue:{repo:n,dataLoader:m},operationName:r,variableValues:s})),[a,y]}function hr(e){let t=lr[e];return t||(t=mr(e),lr[e]=t),t}function mr(e){if("ResourceList"===e)return new Xt({name:"ResourceList",types:()=>l().map(hr).filter((e=>!!e)),resolveType:gr});const t=p(e);return new Pt({name:e,description:t.description,fields:()=>function(e){const t={};return function(e,t){const n=p(e),i=n.properties;d(n)&&(t.resourceType={type:new Ft(pn),description:"Resource Type"});"Reference"===e&&(t.resource={description:"Reference",type:hr("ResourceList"),resolve:Nr});for(const n of Object.keys(i)){const i=f(e,n);for(const e of i.type){let r=e.code;"Element"!==r&&"BackboneElement"!==r||(r=h(i.path?.split(".")));const s={description:i.short,type:vr(i,r)};t[n.replace("[x]",m(e.code))]=s}}}(e,t),function(e,t){for(const n of l()){const i=hr(n),r=y(n),s={};let o=0;if(r)for(const[t,n]of Object.entries(r))n.target&&n.target.includes(e)&&(s[Ir(t)]={value:t},o++);if(o>0){const r=new Wt({name:e+"_"+n+"_reference",values:s}),o=yr(n);o._reference={type:new Ft(r),description:`Specify which property to use for reverse lookup for ${n}`},t[n+"List"]={type:new Rt(i),args:o,resolve:Tr}}}}(e,t),t}(e)})}function yr(e){const t={_count:{type:un,description:"Specify how many elements to return from a repeating list."},_offset:{type:un,description:"Specify the offset to start at for a repeating element."},_sort:{type:pn,description:"Specify the sort order by comma-separated list of sort rules in priority order."},_id:{type:pn,description:"Select resources based on the logical id of the resource."},_lastUpdated:{type:pn,description:"Select resources based on the last time they were changed."}},n=y(e);if(n)for(const[e,i]of Object.entries(n))t[Ir(e)]={type:pn,description:i.description};return t}function vr(e,t){const n=hr(t);return"*"===e.max?new Rt(n):n}async function Tr(e,t,n,i){const r=i.fieldName,s=function(e,t,n){let i;if(t){const e=n._reference;delete n._reference,i={code:e,operator:v.EQUALS,value:o(t)}}n=Object.fromEntries(Object.entries(n).map((([e,t])=>[br(e),t])));const r=T(e,n);if(i){const e=r.filters||[];r.filters=[i,...e]}return r}(r.substring(0,r.length-4),e,t);return(await n.repo.search(s)).entry?.map((e=>e.resource))}async function Er(t,i,r,s){try{return await r.dataLoader.load({reference:`${s.fieldName}/${i.id}`})}catch(t){throw new e(n(t),t)}}async function Nr(t,i,r){try{return await r.dataLoader.load(t)}catch(t){throw new e(n(t),t)}}function gr(e){const t=e?.resourceType;if(t)return hr(t).name}function Ir(e){return e.replaceAll("-","_")}function br(e){return e.startsWith("_")?e:e.replaceAll("_","-")}const _r=e=>({Field(t,n,i,r){const s=function(e){return e.filter((e=>"selections"===e)).length}(r);if(s>8){const n=t.name.value;e.reportError(new z(`Field "${n}" exceeds max depth (depth=${s}, max=8)`,{nodes:t}))}}});class Or{constructor(){this.routes=[]}add(e,t,n){const i=t.split("/").filter((e=>!!e)).map((e=>e.startsWith(":")?{value:e.substring(1),param:!0}:{value:e}));this.routes.push({method:e,path:i,handler:n})}find(e,t){const n=t.split("/").filter((e=>!!e));let i,r=-1;for(const t of this.routes){const s=Sr(t,e,n);s>r&&(i=t,r=s)}if(i)return{handler:i.handler,params:wr(i,n)}}}function Sr(e,t,n){if(t!==e.method||n.length!==e.path.length)return-1;let i=0;for(let t=0;t<n.length;t++)if(!e.path[t].param){if(n[t]!==e.path[t].value)return-1;i++}return i}function wr(e,t){const n=Object.create(null);for(let i=0;i<t.length;i++)e.path[i].param&&(n[e.path[i].value]=t[i]);return n}async function Ar(e,n,i){const r=e.body;if("Bundle"!==r.resourceType)return[t("Not a bundle")];const s=await async function(e,t,n){return new j(e,t,n).processBatch()}(i,n,r);return[a,s]}async function Dr(e,t){const{resourceType:n}=e.params,i=e.query,r=await t.search(T(n,i));return[a,r]}async function xr(e,t){const{resourceType:n}=e.params,i=e.body,r=await t.search(T(n,i));return[a,r]}async function kr(e,n){const{resourceType:i}=e.params,r=e.body;if(r.resourceType!==i)return[t("Incorrect resource type")];const s=await n.createResource(r);return[N,s]}async function Rr(e,t){const{resourceType:n,id:i}=e.params,r=await t.readResource(n,i);return[a,r]}async function Fr(e,t){const{resourceType:n,id:i}=e.params,r=await t.readHistory(n,i);return[a,r]}async function Lr(e,t){const{resourceType:n,id:i,vid:r}=e.params,s=await t.readVersion(n,i,r);return[a,s]}async function $r(e,n){const{resourceType:i,id:r}=e.params,s=e.body;if(s.resourceType!==i)return[t("Incorrect resource type")];if(s.id!==r)return[t("Incorrect ID")];const o=await n.updateResource(s);return[a,o]}async function Cr(e,t){const{resourceType:n,id:i}=e.params;return await t.deleteResource(n,i),[a]}async function Vr(e,t){const{resourceType:n,id:i}=e.params,r=e.body,s=await t.patchResource(n,i,r);return[a,s]}class Ur{constructor(){this.router=new Or,this.router.add("POST","",Ar),this.router.add("GET",":resourceType",Dr),this.router.add("POST",":resourceType/_search",xr),this.router.add("POST",":resourceType",kr),this.router.add("GET",":resourceType/:id",Rr),this.router.add("GET",":resourceType/:id/_history",Fr),this.router.add("GET",":resourceType/:id/_history/:vid",Lr),this.router.add("PUT",":resourceType/:id",$r),this.router.add("DELETE",":resourceType/:id",Cr),this.router.add("PATCH",":resourceType/:id",Vr),this.router.add("POST","$graphql",fr)}async handleRequest(e,t){const n=this.router.find(e.method,e.pathname);if(!n)return[E];const{handler:i,params:r}=n;return e.params=r,i(e,t,this)}}var jr,Mr;class Pr{constructor(){jr.set(this,void 0),Mr.set(this,void 0),A(this,jr,{},"f"),A(this,Mr,{},"f")}async createResource(e){const t=g(e);t.id||(t.id=Gr()),t.meta||(t.meta={}),t.meta?.versionId||(t.meta.versionId=Gr()),t.meta?.lastUpdated||(t.meta.lastUpdated=(new Date).toISOString());const{resourceType:n,id:i}=t;return n in w(this,jr,"f")||(w(this,jr,"f")[n]={}),n in w(this,Mr,"f")||(w(this,Mr,"f")[n]={}),i in w(this,Mr,"f")[n]||(w(this,Mr,"f")[n][i]=[]),w(this,jr,"f")[n][i]=t,w(this,Mr,"f")[n][i].push(t),g(t)}updateResource(e){const t=g(e);return t.meta&&(t.meta.versionId&&delete t.meta.versionId,t.meta.lastUpdated&&delete t.meta.lastUpdated),this.createResource(t)}async patchResource(i,r,s){const o=await this.readResource(i,r);try{const n=S(o,s).filter(Boolean);if(n.length>0)throw new e(t(n.map((e=>e.message)).join("\n")))}catch(t){throw new e(n(t))}return this.updateResource(o)}async readResource(t,n){const i=w(this,jr,"f")?.[t]?.[n];if(!i)throw new e(E);return g(i)}async readReference(n){const i=n.reference?.split("/");if(!i||2!==i.length)throw new e(t("Invalid reference"));return this.readResource(i[0],i[1])}async readReferences(e){return Promise.all(e.map((e=>this.readReference(e))))}async readHistory(e,t){return await this.readResource(e,t),{resourceType:"Bundle",type:"history",entry:(w(this,Mr,"f")?.[e]?.[t]??[]).reverse().map((e=>({resource:g(e)})))}}async readVersion(t,n,i){await this.readResource(t,n);const r=w(this,Mr,"f")?.[t]?.[n]?.find((e=>e.meta?.versionId===i));if(!r)throw new e(E);return g(r)}async search(e){const{resourceType:t}=e,n=w(this,jr,"f")[t]??{},i=Object.values(n).filter((t=>I(t,e)));let r=i.map((e=>({resource:g(e)})));if(e.sortRules)for(const t of e.sortRules)r=r.sort(((e,n)=>Br(e.resource,n.resource,t)));return void 0!==e.offset&&(r=r.slice(e.offset)),void 0!==e.count&&(r=r.slice(0,e.count)),{resourceType:"Bundle",type:"searchset",entry:r,total:i.length}}async deleteResource(t,n){if(!w(this,jr,"f")?.[t]?.[n])throw new e(E);delete w(this,jr,"f")[t][n]}}jr=new WeakMap,Mr=new WeakMap;const Br=(e,t,n)=>{const i=b.types[e.resourceType]?.searchParams?.[n.code],r=i?.expression;if(!r)return 0;const s=JSON.stringify(_(r,e)),o=JSON.stringify(_(r,t));return s.localeCompare(o)*(n.descending?-1:1)},Gr=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(e=>{const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}));export{Ur as FhirRouter,Pr as MemoryRepository,Or as Router};
|
|
1
|
+
import{OperationOutcomeError as e,badRequest as t,normalizeOperationOutcome as n,parseSearchUrl as i,getStatus as r,isOk as s,getReferenceString as o,allOk as a,LRUCache as c,forbidden as u,getResourceTypes as l,getResourceTypeSchema as p,isResourceTypeSchema as d,getElementDefinition as f,buildTypeName as h,capitalize as m,getSearchParameters as y,Operator as v,parseSearchRequest as T,notFound as E,created as N,deepClone as g,matchesSearchRequest as I,globalSchema as b,evalFhirPath as _}from"@medplum/core";import O from"dataloader";import{applyPatch as S}from"rfc6902";function w(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)}function A(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n}var D,x,k,R,F,L,$,C,V,U;class j{constructor(e,t,n){this.router=e,this.repo=t,this.bundle=n,D.add(this),x.set(this,void 0),A(this,x,{},"f")}async processBatch(){const i=this.bundle.type;if(!i)throw new e(t("Missing bundle type"));if("batch"!==i&&"transaction"!==i)throw new e(t("Unrecognized bundle type"));const r=this.bundle.entry;if(!r)throw new e(t("Missing bundle entry"));const s=[];for(const e of r){const t=w(this,D,"m",V).call(this,e);try{s.push(await w(this,D,"m",k).call(this,t))}catch(e){s.push(M(n(e)))}}return{resourceType:"Bundle",type:i+"-response",entry:s}}}function M(e,t){return{response:{outcome:e,status:r(e).toString(),location:s(e)&&t?.id?o(t):void 0},resource:t}}function P(e,t){if(!Boolean(e))throw new Error(t)}function B(e){return"function"==typeof(null==e?void 0:e.then)}function G(e){return"object"==typeof e&&null!==e}function J(e,t){if(!Boolean(e))throw new Error(null!=t?t:"Unexpected invariant triggered.")}x=new WeakMap,D=new WeakSet,k=async function(e){w(this,D,"m",R).call(this,e);const n=e.request;if(e.resource?.resourceType&&n.ifNoneExist){const r=`https://example.com/${e.resource.resourceType}`,s=new URL("?"+n.ifNoneExist,r),o=await this.repo.search(i(s)),c=o?.entry;if(c.length>1)return M(t("Multiple matches"));if(1===c.length){const t=c[0].resource;return e.fullUrl&&w(this,D,"m",L).call(this,e.fullUrl,t),M(a,t)}}let r=e.resource;"PATCH"===n.method&&(r=w(this,D,"m",F).call(this,e));const s=new URL(n.url,"https://example.com/"),o=await this.router.handleRequest({method:n.method,pathname:s.pathname,params:Object.create(null),query:Object.fromEntries(s.searchParams),body:r},this.repo);return e.fullUrl&&2===o.length&&w(this,D,"m",L).call(this,e.fullUrl,o[1]),M(o[0],o[1])},R=function(n){if(!n.request)throw new e(t("Missing entry.request"));if(!n.request.method)throw new e(t("Missing entry.request.method"));if(!n.request.url)throw new e(t("Missing entry.request.url"))},F=function(n){const i=n.resource;if(!i)throw new e(t("Missing entry.resource"));if("Binary"!==i.resourceType)throw new e(t("Patch resource must be a Binary"));if(!i.data)throw new e(t("Missing entry.resource.data"));return JSON.parse(Buffer.from(i.data,"base64").toString("utf8"))},L=function(e,t){e?.startsWith("urn:uuid:")&&(w(this,x,"f")[e]=t)},$=function(e){return Array.isArray(e)?w(this,D,"m",C).call(this,e):"string"==typeof e?w(this,D,"m",U).call(this,e):"object"==typeof e?w(this,D,"m",V).call(this,e):e},C=function(e){return e.map((e=>w(this,D,"m",$).call(this,e)))},V=function(e){return Object.fromEntries(Object.entries(e).map((([e,t])=>[e,w(this,D,"m",$).call(this,t)])))},U=function(e){const t=e.match(/urn:uuid:\w{8}-\w{4}-\w{4}-\w{4}-\w{12}/);if(t){const n=t[0],i=w(this,x,"f")[n];if(i)return e.replaceAll(n,o(i))}return e};const Y=/\r\n|[\n\r]/g;function Q(e,t){let n=0,i=1;for(const r of e.body.matchAll(Y)){if("number"==typeof r.index||J(!1),r.index>=t)break;n=r.index+r[0].length,i+=1}return{line:i,column:t+1-n}}function q(e,t){const n=e.locationOffset.column-1,i="".padStart(n)+e.body,r=t.line-1,s=e.locationOffset.line-1,o=t.line+s,a=1===t.line?n:0,c=t.column+a,u=`${e.name}:${o}:${c}\n`,l=i.split(/\r\n|[\n\r]/g),p=l[r];if(p.length>120){const e=Math.floor(c/80),t=c%80,n=[];for(let e=0;e<p.length;e+=80)n.push(p.slice(e,e+80));return u+K([[`${o} |`,n[0]],...n.slice(1,e+1).map((e=>["|",e])),["|","^".padStart(t)],["|",n[e+1]]])}return u+K([[o-1+" |",l[r-1]],[`${o} |`,p],["|","^".padStart(c)],[`${o+1} |`,l[r+1]]])}function K(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 z extends Error{constructor(e,...t){var n,i,r;const{nodes:s,source:o,positions:a,path:c,originalError:u,extensions:l}=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!=c?c:void 0,this.originalError=null!=u?u:void 0,this.nodes=X(Array.isArray(s)?s:s?[s]:void 0);const p=X(null===(n=this.nodes)||void 0===n?void 0:n.map((e=>e.loc)).filter((e=>null!=e)));this.source=null!=o?o:null==p||null===(i=p[0])||void 0===i?void 0:i.source,this.positions=null!=a?a:null==p?void 0:p.map((e=>e.start)),this.locations=a&&o?a.map((e=>Q(o,e))):null==p?void 0:p.map((e=>Q(e.source,e.start)));const d=G(null==u?void 0:u.extensions)?null==u?void 0:u.extensions:void 0;this.extensions=null!==(r=null!=l?l:d)&&void 0!==r?r: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!=u&&u.stack?Object.defineProperty(this,"stack",{value:u.stack,writable:!0,configurable:!0}):Error.captureStackTrace?Error.captureStackTrace(this,z):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"+q((t=n.loc).source,Q(t.source,t.start)));else if(this.source&&this.locations)for(const t of this.locations)e+="\n\n"+q(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 X(e){return void 0===e||0===e.length?void 0:e}function H(e,t,n){return new z(`Syntax Error: ${n}`,{source:e,positions:[t]})}class W{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 Z{constructor(e,t,n,i,r,s){this.kind=e,this.start=t,this.end=n,this.line=i,this.column=r,this.value=s,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 ee={Name:[],Document:["definitions"],OperationDefinition:["name","variableDefinitions","directives","selectionSet"],VariableDefinition:["variable","type","defaultValue","directives"],Variable:["name"],SelectionSet:["selections"],Field:["alias","name","arguments","directives","selectionSet"],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"]},te=new Set(Object.keys(ee));function ne(e){const t=null==e?void 0:e.kind;return"string"==typeof t&&te.has(t)}var ie,re,se,oe;function ae(e){return 9===e||32===e}function ce(e){return e>=48&&e<=57}function ue(e){return e>=97&&e<=122||e>=65&&e<=90}function le(e){return ue(e)||95===e}function pe(e){return ue(e)||ce(e)||95===e}function de(e){var t;let n=Number.MAX_SAFE_INTEGER,i=null,r=-1;for(let t=0;t<e.length;++t){var s;const o=e[t],a=fe(o);a!==o.length&&(i=null!==(s=i)&&void 0!==s?s:t,r=t,0!==t&&a<n&&(n=a))}return e.map(((e,t)=>0===t?e:e.slice(n))).slice(null!==(t=i)&&void 0!==t?t:0,r+1)}function fe(e){let t=0;for(;t<e.length&&ae(e.charCodeAt(t));)++t;return t}!function(e){e.QUERY="query",e.MUTATION="mutation",e.SUBSCRIPTION="subscription"}(ie||(ie={})),function(e){e.QUERY="QUERY",e.MUTATION="MUTATION",e.SUBSCRIPTION="SUBSCRIPTION",e.FIELD="FIELD",e.FRAGMENT_DEFINITION="FRAGMENT_DEFINITION",e.FRAGMENT_SPREAD="FRAGMENT_SPREAD",e.INLINE_FRAGMENT="INLINE_FRAGMENT",e.VARIABLE_DEFINITION="VARIABLE_DEFINITION",e.SCHEMA="SCHEMA",e.SCALAR="SCALAR",e.OBJECT="OBJECT",e.FIELD_DEFINITION="FIELD_DEFINITION",e.ARGUMENT_DEFINITION="ARGUMENT_DEFINITION",e.INTERFACE="INTERFACE",e.UNION="UNION",e.ENUM="ENUM",e.ENUM_VALUE="ENUM_VALUE",e.INPUT_OBJECT="INPUT_OBJECT",e.INPUT_FIELD_DEFINITION="INPUT_FIELD_DEFINITION"}(re||(re={})),function(e){e.NAME="Name",e.DOCUMENT="Document",e.OPERATION_DEFINITION="OperationDefinition",e.VARIABLE_DEFINITION="VariableDefinition",e.SELECTION_SET="SelectionSet",e.FIELD="Field",e.ARGUMENT="Argument",e.FRAGMENT_SPREAD="FragmentSpread",e.INLINE_FRAGMENT="InlineFragment",e.FRAGMENT_DEFINITION="FragmentDefinition",e.VARIABLE="Variable",e.INT="IntValue",e.FLOAT="FloatValue",e.STRING="StringValue",e.BOOLEAN="BooleanValue",e.NULL="NullValue",e.ENUM="EnumValue",e.LIST="ListValue",e.OBJECT="ObjectValue",e.OBJECT_FIELD="ObjectField",e.DIRECTIVE="Directive",e.NAMED_TYPE="NamedType",e.LIST_TYPE="ListType",e.NON_NULL_TYPE="NonNullType",e.SCHEMA_DEFINITION="SchemaDefinition",e.OPERATION_TYPE_DEFINITION="OperationTypeDefinition",e.SCALAR_TYPE_DEFINITION="ScalarTypeDefinition",e.OBJECT_TYPE_DEFINITION="ObjectTypeDefinition",e.FIELD_DEFINITION="FieldDefinition",e.INPUT_VALUE_DEFINITION="InputValueDefinition",e.INTERFACE_TYPE_DEFINITION="InterfaceTypeDefinition",e.UNION_TYPE_DEFINITION="UnionTypeDefinition",e.ENUM_TYPE_DEFINITION="EnumTypeDefinition",e.ENUM_VALUE_DEFINITION="EnumValueDefinition",e.INPUT_OBJECT_TYPE_DEFINITION="InputObjectTypeDefinition",e.DIRECTIVE_DEFINITION="DirectiveDefinition",e.SCHEMA_EXTENSION="SchemaExtension",e.SCALAR_TYPE_EXTENSION="ScalarTypeExtension",e.OBJECT_TYPE_EXTENSION="ObjectTypeExtension",e.INTERFACE_TYPE_EXTENSION="InterfaceTypeExtension",e.UNION_TYPE_EXTENSION="UnionTypeExtension",e.ENUM_TYPE_EXTENSION="EnumTypeExtension",e.INPUT_OBJECT_TYPE_EXTENSION="InputObjectTypeExtension"}(se||(se={})),function(e){e.SOF="<SOF>",e.EOF="<EOF>",e.BANG="!",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"}(oe||(oe={}));class he{constructor(e){const t=new Z(oe.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!==oe.EOF)do{if(e.next)e=e.next;else{const t=ge(this,e.end);e.next=t,t.prev=e,e=t}}while(e.kind===oe.COMMENT);return e}}function me(e){return e>=0&&e<=55295||e>=57344&&e<=1114111}function ye(e,t){return ve(e.charCodeAt(t))&&Te(e.charCodeAt(t+1))}function ve(e){return e>=55296&&e<=56319}function Te(e){return e>=56320&&e<=57343}function Ee(e,t){const n=e.source.body.codePointAt(t);if(void 0===n)return oe.EOF;if(n>=32&&n<=126){const e=String.fromCodePoint(n);return'"'===e?"'\"'":`"${e}"`}return"U+"+n.toString(16).toUpperCase().padStart(4,"0")}function Ne(e,t,n,i,r){const s=e.line,o=1+n-e.lineStart;return new Z(t,n,i,s,o,r)}function ge(e,t){const n=e.source.body,i=n.length;let r=t;for(;r<i;){const t=n.charCodeAt(r);switch(t){case 65279:case 9:case 32:case 44:++r;continue;case 10:++r,++e.line,e.lineStart=r;continue;case 13:10===n.charCodeAt(r+1)?r+=2:++r,++e.line,e.lineStart=r;continue;case 35:return Ie(e,r);case 33:return Ne(e,oe.BANG,r,r+1);case 36:return Ne(e,oe.DOLLAR,r,r+1);case 38:return Ne(e,oe.AMP,r,r+1);case 40:return Ne(e,oe.PAREN_L,r,r+1);case 41:return Ne(e,oe.PAREN_R,r,r+1);case 46:if(46===n.charCodeAt(r+1)&&46===n.charCodeAt(r+2))return Ne(e,oe.SPREAD,r,r+3);break;case 58:return Ne(e,oe.COLON,r,r+1);case 61:return Ne(e,oe.EQUALS,r,r+1);case 64:return Ne(e,oe.AT,r,r+1);case 91:return Ne(e,oe.BRACKET_L,r,r+1);case 93:return Ne(e,oe.BRACKET_R,r,r+1);case 123:return Ne(e,oe.BRACE_L,r,r+1);case 124:return Ne(e,oe.PIPE,r,r+1);case 125:return Ne(e,oe.BRACE_R,r,r+1);case 34:return 34===n.charCodeAt(r+1)&&34===n.charCodeAt(r+2)?ke(e,r):Oe(e,r)}if(ce(t)||45===t)return be(e,r,t);if(le(t))return Re(e,r);throw H(e.source,r,39===t?"Unexpected single quote character ('), did you mean to use a double quote (\")?":me(t)||ye(n,r)?`Unexpected character: ${Ee(e,r)}.`:`Invalid character: ${Ee(e,r)}.`)}return Ne(e,oe.EOF,i,i)}function Ie(e,t){const n=e.source.body,i=n.length;let r=t+1;for(;r<i;){const e=n.charCodeAt(r);if(10===e||13===e)break;if(me(e))++r;else{if(!ye(n,r))break;r+=2}}return Ne(e,oe.COMMENT,t,r,n.slice(t+1,r))}function be(e,t,n){const i=e.source.body;let r=t,s=n,o=!1;if(45===s&&(s=i.charCodeAt(++r)),48===s){if(s=i.charCodeAt(++r),ce(s))throw H(e.source,r,`Invalid number, unexpected digit after 0: ${Ee(e,r)}.`)}else r=_e(e,r,s),s=i.charCodeAt(r);if(46===s&&(o=!0,s=i.charCodeAt(++r),r=_e(e,r,s),s=i.charCodeAt(r)),69!==s&&101!==s||(o=!0,s=i.charCodeAt(++r),43!==s&&45!==s||(s=i.charCodeAt(++r)),r=_e(e,r,s),s=i.charCodeAt(r)),46===s||le(s))throw H(e.source,r,`Invalid number, expected digit but got: ${Ee(e,r)}.`);return Ne(e,o?oe.FLOAT:oe.INT,t,r,i.slice(t,r))}function _e(e,t,n){if(!ce(n))throw H(e.source,t,`Invalid number, expected digit but got: ${Ee(e,t)}.`);const i=e.source.body;let r=t+1;for(;ce(i.charCodeAt(r));)++r;return r}function Oe(e,t){const n=e.source.body,i=n.length;let r=t+1,s=r,o="";for(;r<i;){const i=n.charCodeAt(r);if(34===i)return o+=n.slice(s,r),Ne(e,oe.STRING,t,r+1,o);if(92!==i){if(10===i||13===i)break;if(me(i))++r;else{if(!ye(n,r))throw H(e.source,r,`Invalid character within String: ${Ee(e,r)}.`);r+=2}}else{o+=n.slice(s,r);const t=117===n.charCodeAt(r+1)?123===n.charCodeAt(r+2)?Se(e,r):we(e,r):xe(e,r);o+=t.value,r+=t.size,s=r}}throw H(e.source,r,"Unterminated string.")}function Se(e,t){const n=e.source.body;let i=0,r=3;for(;r<12;){const e=n.charCodeAt(t+r++);if(125===e){if(r<5||!me(i))break;return{value:String.fromCodePoint(i),size:r}}if(i=i<<4|De(e),i<0)break}throw H(e.source,t,`Invalid Unicode escape sequence: "${n.slice(t,t+r)}".`)}function we(e,t){const n=e.source.body,i=Ae(n,t+2);if(me(i))return{value:String.fromCodePoint(i),size:6};if(ve(i)&&92===n.charCodeAt(t+6)&&117===n.charCodeAt(t+7)){const e=Ae(n,t+8);if(Te(e))return{value:String.fromCodePoint(i,e),size:12}}throw H(e.source,t,`Invalid Unicode escape sequence: "${n.slice(t,t+6)}".`)}function Ae(e,t){return De(e.charCodeAt(t))<<12|De(e.charCodeAt(t+1))<<8|De(e.charCodeAt(t+2))<<4|De(e.charCodeAt(t+3))}function De(e){return e>=48&&e<=57?e-48:e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:-1}function xe(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 H(e.source,t,`Invalid character escape sequence: "${n.slice(t,t+2)}".`)}function ke(e,t){const n=e.source.body,i=n.length;let r=e.lineStart,s=t+3,o=s,a="";const c=[];for(;s<i;){const i=n.charCodeAt(s);if(34===i&&34===n.charCodeAt(s+1)&&34===n.charCodeAt(s+2)){a+=n.slice(o,s),c.push(a);const i=Ne(e,oe.BLOCK_STRING,t,s+3,de(c).join("\n"));return e.line+=c.length-1,e.lineStart=r,i}if(92!==i||34!==n.charCodeAt(s+1)||34!==n.charCodeAt(s+2)||34!==n.charCodeAt(s+3))if(10!==i&&13!==i)if(me(i))++s;else{if(!ye(n,s))throw H(e.source,s,`Invalid character within String: ${Ee(e,s)}.`);s+=2}else a+=n.slice(o,s),c.push(a),13===i&&10===n.charCodeAt(s+1)?s+=2:++s,a="",o=s,r=s;else a+=n.slice(o,s),o=s+1,s+=4}throw H(e.source,s,"Unterminated string.")}function Re(e,t){const n=e.source.body,i=n.length;let r=t+1;for(;r<i;){if(!pe(n.charCodeAt(r)))break;++r}return Ne(e,oe.NAME,t,r,n.slice(t,r))}const Fe=10,Le=2;function $e(e){return Ce(e,[])}function Ce(e,t){switch(typeof e){case"string":return JSON.stringify(e);case"function":return e.name?`[function ${e.name}]`:"[function]";case"object":return function(e,t){if(null===e)return"null";if(t.includes(e))return"[Circular]";const n=[...t,e];if(function(e){return"function"==typeof e.toJSON}(e)){const t=e.toJSON();if(t!==e)return"string"==typeof t?t:Ce(t,n)}else if(Array.isArray(e))return function(e,t){if(0===e.length)return"[]";if(t.length>Le)return"[Array]";const n=Math.min(Fe,e.length),i=e.length-n,r=[];for(let i=0;i<n;++i)r.push(Ce(e[i],t));1===i?r.push("... 1 more item"):i>1&&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>Le)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+": "+Ce(n,t)));return"{ "+i.join(", ")+" }"}(e,n)}(e,t);default:return String(e)}}const Ve="production"===process.env.NODE_ENV?function(e,t){return e instanceof t}:function(e,t){if(e instanceof t)return!0;if("object"==typeof e&&null!==e){var n;const i=t.prototype[Symbol.toStringTag];if(i===(Symbol.toStringTag in e?e[Symbol.toStringTag]:null===(n=e.constructor)||void 0===n?void 0:n.name)){const t=$e(e);throw new Error(`Cannot use ${i} "${t}" from another module or realm.\n\nEnsure that there is only one instance of "graphql" in the node_modules\ndirectory. If different versions of "graphql" are the dependencies of other\nrelied on modules, use "resolutions" to ensure only one version is installed.\n\nhttps://yarnpkg.com/en/docs/selective-version-resolutions\n\nDuplicate "graphql" modules cannot be used at the same time since different\nversions may have different capabilities and behavior. The data from one\nversion used in the function from another could produce confusing and\nspurious results.`)}}return!1};class Ue{constructor(e,t="GraphQL request",n={line:1,column:1}){"string"==typeof e||P(!1,`Body must be a string. Received: ${$e(e)}.`),this.body=e,this.name=t,this.locationOffset=n,this.locationOffset.line>0||P(!1,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||P(!1,"column in locationOffset is 1-indexed and must be positive.")}get[Symbol.toStringTag](){return"Source"}}class je{constructor(e,t={}){const n=function(e){return Ve(e,Ue)}(e)?e:new Ue(e);this._lexer=new he(n),this._options=t,this._tokenCounter=0}parseName(){const e=this.expectToken(oe.NAME);return this.node(e,{kind:se.NAME,value:e.value})}parseDocument(){return this.node(this._lexer.token,{kind:se.DOCUMENT,definitions:this.many(oe.SOF,this.parseDefinition,oe.EOF)})}parseDefinition(){if(this.peek(oe.BRACE_L))return this.parseOperationDefinition();const e=this.peekDescription(),t=e?this._lexer.lookahead():this._lexer.token;if(t.kind===oe.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 H(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(oe.BRACE_L))return this.node(e,{kind:se.OPERATION_DEFINITION,operation:ie.QUERY,name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet()});const t=this.parseOperationType();let n;return this.peek(oe.NAME)&&(n=this.parseName()),this.node(e,{kind:se.OPERATION_DEFINITION,operation:t,name:n,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseOperationType(){const e=this.expectToken(oe.NAME);switch(e.value){case"query":return ie.QUERY;case"mutation":return ie.MUTATION;case"subscription":return ie.SUBSCRIPTION}throw this.unexpected(e)}parseVariableDefinitions(){return this.optionalMany(oe.PAREN_L,this.parseVariableDefinition,oe.PAREN_R)}parseVariableDefinition(){return this.node(this._lexer.token,{kind:se.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(oe.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(oe.EQUALS)?this.parseConstValueLiteral():void 0,directives:this.parseConstDirectives()})}parseVariable(){const e=this._lexer.token;return this.expectToken(oe.DOLLAR),this.node(e,{kind:se.VARIABLE,name:this.parseName()})}parseSelectionSet(){return this.node(this._lexer.token,{kind:se.SELECTION_SET,selections:this.many(oe.BRACE_L,this.parseSelection,oe.BRACE_R)})}parseSelection(){return this.peek(oe.SPREAD)?this.parseFragment():this.parseField()}parseField(){const e=this._lexer.token,t=this.parseName();let n,i;return this.expectOptionalToken(oe.COLON)?(n=t,i=this.parseName()):i=t,this.node(e,{kind:se.FIELD,alias:n,name:i,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(oe.BRACE_L)?this.parseSelectionSet():void 0})}parseArguments(e){const t=e?this.parseConstArgument:this.parseArgument;return this.optionalMany(oe.PAREN_L,t,oe.PAREN_R)}parseArgument(e=!1){const t=this._lexer.token,n=this.parseName();return this.expectToken(oe.COLON),this.node(t,{kind:se.ARGUMENT,name:n,value:this.parseValueLiteral(e)})}parseConstArgument(){return this.parseArgument(!0)}parseFragment(){const e=this._lexer.token;this.expectToken(oe.SPREAD);const t=this.expectOptionalKeyword("on");return!t&&this.peek(oe.NAME)?this.node(e,{kind:se.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1)}):this.node(e,{kind:se.INLINE_FRAGMENT,typeCondition:t?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentDefinition(){const e=this._lexer.token;return this.expectKeyword("fragment"),!0===this._options.allowLegacyFragmentVariables?this.node(e,{kind:se.FRAGMENT_DEFINITION,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()}):this.node(e,{kind:se.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 oe.BRACKET_L:return this.parseList(e);case oe.BRACE_L:return this.parseObject(e);case oe.INT:return this.advanceLexer(),this.node(t,{kind:se.INT,value:t.value});case oe.FLOAT:return this.advanceLexer(),this.node(t,{kind:se.FLOAT,value:t.value});case oe.STRING:case oe.BLOCK_STRING:return this.parseStringLiteral();case oe.NAME:switch(this.advanceLexer(),t.value){case"true":return this.node(t,{kind:se.BOOLEAN,value:!0});case"false":return this.node(t,{kind:se.BOOLEAN,value:!1});case"null":return this.node(t,{kind:se.NULL});default:return this.node(t,{kind:se.ENUM,value:t.value})}case oe.DOLLAR:if(e){if(this.expectToken(oe.DOLLAR),this._lexer.token.kind===oe.NAME){const e=this._lexer.token.value;throw H(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.advanceLexer(),this.node(e,{kind:se.STRING,value:e.value,block:e.kind===oe.BLOCK_STRING})}parseList(e){return this.node(this._lexer.token,{kind:se.LIST,values:this.any(oe.BRACKET_L,(()=>this.parseValueLiteral(e)),oe.BRACKET_R)})}parseObject(e){return this.node(this._lexer.token,{kind:se.OBJECT,fields:this.any(oe.BRACE_L,(()=>this.parseObjectField(e)),oe.BRACE_R)})}parseObjectField(e){const t=this._lexer.token,n=this.parseName();return this.expectToken(oe.COLON),this.node(t,{kind:se.OBJECT_FIELD,name:n,value:this.parseValueLiteral(e)})}parseDirectives(e){const t=[];for(;this.peek(oe.AT);)t.push(this.parseDirective(e));return t}parseConstDirectives(){return this.parseDirectives(!0)}parseDirective(e){const t=this._lexer.token;return this.expectToken(oe.AT),this.node(t,{kind:se.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(e)})}parseTypeReference(){const e=this._lexer.token;let t;if(this.expectOptionalToken(oe.BRACKET_L)){const n=this.parseTypeReference();this.expectToken(oe.BRACKET_R),t=this.node(e,{kind:se.LIST_TYPE,type:n})}else t=this.parseNamedType();return this.expectOptionalToken(oe.BANG)?this.node(e,{kind:se.NON_NULL_TYPE,type:t}):t}parseNamedType(){return this.node(this._lexer.token,{kind:se.NAMED_TYPE,name:this.parseName()})}peekDescription(){return this.peek(oe.STRING)||this.peek(oe.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(oe.BRACE_L,this.parseOperationTypeDefinition,oe.BRACE_R);return this.node(e,{kind:se.SCHEMA_DEFINITION,description:t,directives:n,operationTypes:i})}parseOperationTypeDefinition(){const e=this._lexer.token,t=this.parseOperationType();this.expectToken(oe.COLON);const n=this.parseNamedType();return this.node(e,{kind:se.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:se.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(),s=this.parseFieldsDefinition();return this.node(e,{kind:se.OBJECT_TYPE_DEFINITION,description:t,name:n,interfaces:i,directives:r,fields:s})}parseImplementsInterfaces(){return this.expectOptionalKeyword("implements")?this.delimitedMany(oe.AMP,this.parseNamedType):[]}parseFieldsDefinition(){return this.optionalMany(oe.BRACE_L,this.parseFieldDefinition,oe.BRACE_R)}parseFieldDefinition(){const e=this._lexer.token,t=this.parseDescription(),n=this.parseName(),i=this.parseArgumentDefs();this.expectToken(oe.COLON);const r=this.parseTypeReference(),s=this.parseConstDirectives();return this.node(e,{kind:se.FIELD_DEFINITION,description:t,name:n,arguments:i,type:r,directives:s})}parseArgumentDefs(){return this.optionalMany(oe.PAREN_L,this.parseInputValueDef,oe.PAREN_R)}parseInputValueDef(){const e=this._lexer.token,t=this.parseDescription(),n=this.parseName();this.expectToken(oe.COLON);const i=this.parseTypeReference();let r;this.expectOptionalToken(oe.EQUALS)&&(r=this.parseConstValueLiteral());const s=this.parseConstDirectives();return this.node(e,{kind:se.INPUT_VALUE_DEFINITION,description:t,name:n,type:i,defaultValue:r,directives:s})}parseInterfaceTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("interface");const n=this.parseName(),i=this.parseImplementsInterfaces(),r=this.parseConstDirectives(),s=this.parseFieldsDefinition();return this.node(e,{kind:se.INTERFACE_TYPE_DEFINITION,description:t,name:n,interfaces:i,directives:r,fields:s})}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:se.UNION_TYPE_DEFINITION,description:t,name:n,directives:i,types:r})}parseUnionMemberTypes(){return this.expectOptionalToken(oe.EQUALS)?this.delimitedMany(oe.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:se.ENUM_TYPE_DEFINITION,description:t,name:n,directives:i,values:r})}parseEnumValuesDefinition(){return this.optionalMany(oe.BRACE_L,this.parseEnumValueDefinition,oe.BRACE_R)}parseEnumValueDefinition(){const e=this._lexer.token,t=this.parseDescription(),n=this.parseEnumValueName(),i=this.parseConstDirectives();return this.node(e,{kind:se.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 H(this._lexer.source,this._lexer.token.start,`${Me(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:se.INPUT_OBJECT_TYPE_DEFINITION,description:t,name:n,directives:i,fields:r})}parseInputFieldsDefinition(){return this.optionalMany(oe.BRACE_L,this.parseInputValueDef,oe.BRACE_R)}parseTypeSystemExtension(){const e=this._lexer.lookahead();if(e.kind===oe.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(oe.BRACE_L,this.parseOperationTypeDefinition,oe.BRACE_R);if(0===t.length&&0===n.length)throw this.unexpected();return this.node(e,{kind:se.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:se.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:se.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:se.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:se.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:se.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:se.INPUT_OBJECT_TYPE_EXTENSION,name:t,directives:n,fields:i})}parseDirectiveDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("directive"),this.expectToken(oe.AT);const n=this.parseName(),i=this.parseArgumentDefs(),r=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");const s=this.parseDirectiveLocations();return this.node(e,{kind:se.DIRECTIVE_DEFINITION,description:t,name:n,arguments:i,repeatable:r,locations:s})}parseDirectiveLocations(){return this.delimitedMany(oe.PIPE,this.parseDirectiveLocation)}parseDirectiveLocation(){const e=this._lexer.token,t=this.parseName();if(Object.prototype.hasOwnProperty.call(re,t.value))return t;throw this.unexpected(e)}node(e,t){return!0!==this._options.noLocation&&(t.loc=new W(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.advanceLexer(),t;throw H(this._lexer.source,t.start,`Expected ${Pe(e)}, found ${Me(t)}.`)}expectOptionalToken(e){return this._lexer.token.kind===e&&(this.advanceLexer(),!0)}expectKeyword(e){const t=this._lexer.token;if(t.kind!==oe.NAME||t.value!==e)throw H(this._lexer.source,t.start,`Expected "${e}", found ${Me(t)}.`);this.advanceLexer()}expectOptionalKeyword(e){const t=this._lexer.token;return t.kind===oe.NAME&&t.value===e&&(this.advanceLexer(),!0)}unexpected(e){const t=null!=e?e:this._lexer.token;return H(this._lexer.source,t.start,`Unexpected ${Me(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}advanceLexer(){const{maxTokens:e}=this._options,t=this._lexer.advance();if(void 0!==e&&t.kind!==oe.EOF&&(++this._tokenCounter,this._tokenCounter>e))throw H(this._lexer.source,t.start,`Document contains more that ${e} tokens. Parsing aborted.`)}}function Me(e){const t=e.value;return Pe(e.kind)+(null!=t?` "${t}"`:"")}function Pe(e){return function(e){return e===oe.BANG||e===oe.DOLLAR||e===oe.AMP||e===oe.PAREN_L||e===oe.PAREN_R||e===oe.SPREAD||e===oe.COLON||e===oe.EQUALS||e===oe.AT||e===oe.BRACKET_L||e===oe.BRACKET_R||e===oe.BRACE_L||e===oe.PIPE||e===oe.BRACE_R}(e)?`"${e}"`:e}const Be=5;function Ge(e,t){const[n,i]=t?[e,t]:[void 0,e];let r=" Did you mean ";n&&(r+=n+" ");const s=i.map((e=>`"${e}"`));switch(s.length){case 0:return"";case 1:return r+s[0]+"?";case 2:return r+s[0]+" or "+s[1]+"?"}const o=s.slice(0,Be),a=o.pop();return r+o.join(", ")+", or "+a+"?"}function Je(e){return e}function Ye(e,t){const n=Object.create(null);for(const i of e)n[t(i)]=i;return n}function Qe(e,t,n){const i=Object.create(null);for(const r of e)i[t(r)]=n(r);return i}function qe(e,t){const n=Object.create(null);for(const i of Object.keys(e))n[i]=t(e[i],i);return n}function Ke(e,t){let n=0,i=0;for(;n<e.length&&i<t.length;){let r=e.charCodeAt(n),s=t.charCodeAt(i);if(He(r)&&He(s)){let o=0;do{++n,o=10*o+r-ze,r=e.charCodeAt(n)}while(He(r)&&o>0);let a=0;do{++i,a=10*a+s-ze,s=t.charCodeAt(i)}while(He(s)&&a>0);if(o<a)return-1;if(o>a)return 1}else{if(r<s)return-1;if(r>s)return 1;++n,++i}}return e.length-t.length}const ze=48,Xe=57;function He(e){return!isNaN(e)&&ze<=e&&e<=Xe}function We(e,t){const n=Object.create(null),i=new Ze(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:Ke(e,t)}))}class Ze{constructor(e){this._input=e,this._inputLowerCase=e.toLowerCase(),this._inputArray=et(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=et(n),r=this._inputArray;if(i.length<r.length){const e=i;i=r,r=e}const s=i.length,o=r.length;if(s-o>t)return;const a=this._rows;for(let e=0;e<=o;e++)a[0][e]=e;for(let e=1;e<=s;e++){const n=a[(e-1)%3],s=a[e%3];let c=s[0]=e;for(let t=1;t<=o;t++){const o=i[e-1]===r[t-1]?0:1;let u=Math.min(n[t]+1,s[t-1]+1,n[t-1]+o);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)}u<c&&(c=u),s[t]=u}if(c>t)return}const c=a[s%3][o];return c<=t?c:void 0}}function et(e){const t=e.length,n=new Array(t);for(let i=0;i<t;++i)n[i]=e.charCodeAt(i);return n}function tt(e){if(null==e)return Object.create(null);if(null===Object.getPrototypeOf(e))return e;const t=Object.create(null);for(const[n,i]of Object.entries(e))t[n]=i;return t}const nt=/[\x00-\x1f\x22\x5c\x7f-\x9f]/g;function it(e){return rt[e.charCodeAt(0)]}const rt=["\\u0000","\\u0001","\\u0002","\\u0003","\\u0004","\\u0005","\\u0006","\\u0007","\\b","\\t","\\n","\\u000B","\\f","\\r","\\u000E","\\u000F","\\u0010","\\u0011","\\u0012","\\u0013","\\u0014","\\u0015","\\u0016","\\u0017","\\u0018","\\u0019","\\u001A","\\u001B","\\u001C","\\u001D","\\u001E","\\u001F","","",'\\"',"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","\\\\","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","\\u007F","\\u0080","\\u0081","\\u0082","\\u0083","\\u0084","\\u0085","\\u0086","\\u0087","\\u0088","\\u0089","\\u008A","\\u008B","\\u008C","\\u008D","\\u008E","\\u008F","\\u0090","\\u0091","\\u0092","\\u0093","\\u0094","\\u0095","\\u0096","\\u0097","\\u0098","\\u0099","\\u009A","\\u009B","\\u009C","\\u009D","\\u009E","\\u009F"],st=Object.freeze({});function ot(e,t,n=ee){const i=new Map;for(const e of Object.values(se))i.set(e,at(t,e));let r,s,o,a=Array.isArray(e),c=[e],u=-1,l=[],p=e;const d=[],f=[];do{u++;const e=u===c.length,v=e&&0!==l.length;if(e){if(s=0===f.length?void 0:d[d.length-1],p=o,o=f.pop(),v)if(a){p=p.slice();let e=0;for(const[t,n]of l){const i=t-e;null===n?(p.splice(i,1),e++):p[i]=n}}else{p=Object.defineProperties({},Object.getOwnPropertyDescriptors(p));for(const[e,t]of l)p[e]=t}u=r.index,c=r.keys,l=r.edits,a=r.inArray,r=r.prev}else if(o){if(s=a?u:c[u],p=o[s],null==p)continue;d.push(s)}let T;if(!Array.isArray(p)){var h,m;ne(p)||P(!1,`Invalid AST Node: ${$e(p)}.`);const n=e?null===(h=i.get(p.kind))||void 0===h?void 0:h.leave:null===(m=i.get(p.kind))||void 0===m?void 0:m.enter;if(T=null==n?void 0:n.call(t,p,s,o,d,f),T===st)break;if(!1===T){if(!e){d.pop();continue}}else if(void 0!==T&&(l.push([s,T]),!e)){if(!ne(T)){d.pop();continue}p=T}}var y;if(void 0===T&&v&&l.push([s,p]),e)d.pop();else r={inArray:a,index:u,keys:c,edits:l,prev:r},a=Array.isArray(p),c=a?p:null!==(y=n[p.kind])&&void 0!==y?y:[],u=-1,l=[],o&&f.push(o),o=p}while(void 0!==r);return 0!==l.length?l[l.length-1][1]:e}function at(e,t){const n=e[t];return"object"==typeof n?n:"function"==typeof n?{enter:n,leave:void 0}:{enter:e.enter,leave:e.leave}}function ct(e){return ot(e,ut)}const ut={Name:{leave:e=>e.value},Variable:{leave:e=>"$"+e.name},Document:{leave:e=>lt(e.definitions,"\n\n")},OperationDefinition:{leave(e){const t=dt("(",lt(e.variableDefinitions,", "),")"),n=lt([e.operation,lt([e.name,t]),lt(e.directives," ")]," ");return("query"===n?"":n+" ")+e.selectionSet}},VariableDefinition:{leave:({variable:e,type:t,defaultValue:n,directives:i})=>e+": "+t+dt(" = ",n)+dt(" ",lt(i," "))},SelectionSet:{leave:({selections:e})=>pt(e)},Field:{leave({alias:e,name:t,arguments:n,directives:i,selectionSet:r}){const s=dt("",e,": ")+t;let o=s+dt("(",lt(n,", "),")");return o.length>80&&(o=s+dt("(\n",ft(lt(n,"\n")),"\n)")),lt([o,lt(i," "),r]," ")}},Argument:{leave:({name:e,value:t})=>e+": "+t},FragmentSpread:{leave:({name:e,directives:t})=>"..."+e+dt(" ",lt(t," "))},InlineFragment:{leave:({typeCondition:e,directives:t,selectionSet:n})=>lt(["...",dt("on ",e),lt(t," "),n]," ")},FragmentDefinition:{leave:({name:e,typeCondition:t,variableDefinitions:n,directives:i,selectionSet:r})=>`fragment ${e}${dt("(",lt(n,", "),")")} on ${t} ${dt("",lt(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,s=i.length>1&&i.slice(1).every((e=>0===e.length||ae(e.charCodeAt(0)))),o=n.endsWith('\\"""'),a=e.endsWith('"')&&!o,c=e.endsWith("\\"),u=a||c,l=!(null!=t&&t.minimize)&&(!r||e.length>70||u||s||o);let p="";const d=r&&ae(e.charCodeAt(0));return(l&&!d||s)&&(p+="\n"),p+=n,(l||u)&&(p+="\n"),'"""'+p+'"""'}(e):`"${e.replace(nt,it)}"`},BooleanValue:{leave:({value:e})=>e?"true":"false"},NullValue:{leave:()=>"null"},EnumValue:{leave:({value:e})=>e},ListValue:{leave:({values:e})=>"["+lt(e,", ")+"]"},ObjectValue:{leave:({fields:e})=>"{"+lt(e,", ")+"}"},ObjectField:{leave:({name:e,value:t})=>e+": "+t},Directive:{leave:({name:e,arguments:t})=>"@"+e+dt("(",lt(t,", "),")")},NamedType:{leave:({name:e})=>e},ListType:{leave:({type:e})=>"["+e+"]"},NonNullType:{leave:({type:e})=>e+"!"},SchemaDefinition:{leave:({description:e,directives:t,operationTypes:n})=>dt("",e,"\n")+lt(["schema",lt(t," "),pt(n)]," ")},OperationTypeDefinition:{leave:({operation:e,type:t})=>e+": "+t},ScalarTypeDefinition:{leave:({description:e,name:t,directives:n})=>dt("",e,"\n")+lt(["scalar",t,lt(n," ")]," ")},ObjectTypeDefinition:{leave:({description:e,name:t,interfaces:n,directives:i,fields:r})=>dt("",e,"\n")+lt(["type",t,dt("implements ",lt(n," & ")),lt(i," "),pt(r)]," ")},FieldDefinition:{leave:({description:e,name:t,arguments:n,type:i,directives:r})=>dt("",e,"\n")+t+(ht(n)?dt("(\n",ft(lt(n,"\n")),"\n)"):dt("(",lt(n,", "),")"))+": "+i+dt(" ",lt(r," "))},InputValueDefinition:{leave:({description:e,name:t,type:n,defaultValue:i,directives:r})=>dt("",e,"\n")+lt([t+": "+n,dt("= ",i),lt(r," ")]," ")},InterfaceTypeDefinition:{leave:({description:e,name:t,interfaces:n,directives:i,fields:r})=>dt("",e,"\n")+lt(["interface",t,dt("implements ",lt(n," & ")),lt(i," "),pt(r)]," ")},UnionTypeDefinition:{leave:({description:e,name:t,directives:n,types:i})=>dt("",e,"\n")+lt(["union",t,lt(n," "),dt("= ",lt(i," | "))]," ")},EnumTypeDefinition:{leave:({description:e,name:t,directives:n,values:i})=>dt("",e,"\n")+lt(["enum",t,lt(n," "),pt(i)]," ")},EnumValueDefinition:{leave:({description:e,name:t,directives:n})=>dt("",e,"\n")+lt([t,lt(n," ")]," ")},InputObjectTypeDefinition:{leave:({description:e,name:t,directives:n,fields:i})=>dt("",e,"\n")+lt(["input",t,lt(n," "),pt(i)]," ")},DirectiveDefinition:{leave:({description:e,name:t,arguments:n,repeatable:i,locations:r})=>dt("",e,"\n")+"directive @"+t+(ht(n)?dt("(\n",ft(lt(n,"\n")),"\n)"):dt("(",lt(n,", "),")"))+(i?" repeatable":"")+" on "+lt(r," | ")},SchemaExtension:{leave:({directives:e,operationTypes:t})=>lt(["extend schema",lt(e," "),pt(t)]," ")},ScalarTypeExtension:{leave:({name:e,directives:t})=>lt(["extend scalar",e,lt(t," ")]," ")},ObjectTypeExtension:{leave:({name:e,interfaces:t,directives:n,fields:i})=>lt(["extend type",e,dt("implements ",lt(t," & ")),lt(n," "),pt(i)]," ")},InterfaceTypeExtension:{leave:({name:e,interfaces:t,directives:n,fields:i})=>lt(["extend interface",e,dt("implements ",lt(t," & ")),lt(n," "),pt(i)]," ")},UnionTypeExtension:{leave:({name:e,directives:t,types:n})=>lt(["extend union",e,lt(t," "),dt("= ",lt(n," | "))]," ")},EnumTypeExtension:{leave:({name:e,directives:t,values:n})=>lt(["extend enum",e,lt(t," "),pt(n)]," ")},InputObjectTypeExtension:{leave:({name:e,directives:t,fields:n})=>lt(["extend input",e,lt(t," "),pt(n)]," ")}};function lt(e,t=""){var n;return null!==(n=null==e?void 0:e.filter((e=>e)).join(t))&&void 0!==n?n:""}function pt(e){return dt("{\n",ft(lt(e,"\n")),"\n}")}function dt(e,t,n=""){return null!=t&&""!==t?e+t+n:""}function ft(e){return dt(" ",e.replace(/\n/g,"\n "))}function ht(e){var t;return null!==(t=null==e?void 0:e.some((e=>e.includes("\n"))))&&void 0!==t&&t}function mt(e,t){switch(e.kind){case se.NULL:return null;case se.INT:return parseInt(e.value,10);case se.FLOAT:return parseFloat(e.value);case se.STRING:case se.ENUM:case se.BOOLEAN:return e.value;case se.LIST:return e.values.map((e=>mt(e,t)));case se.OBJECT:return Qe(e.fields,(e=>e.name.value),(e=>mt(e.value,t)));case se.VARIABLE:return null==t?void 0:t[e.name.value]}}function yt(e){if(null!=e||P(!1,"Must provide name."),"string"==typeof e||P(!1,"Expected name to be a string."),0===e.length)throw new z("Expected name to be a non-empty string.");for(let t=1;t<e.length;++t)if(!pe(e.charCodeAt(t)))throw new z(`Names must only contain [_a-zA-Z0-9] but "${e}" does not.`);if(!le(e.charCodeAt(0)))throw new z(`Names must start with [_a-zA-Z] but "${e}" does not.`);return e}function vt(e){if("true"===e||"false"===e||"null"===e)throw new z(`Enum values cannot be named: ${e}`);return yt(e)}function Tt(e){return Et(e)||Nt(e)||gt(e)||It(e)||bt(e)||_t(e)||Ot(e)||St(e)}function Et(e){return Ve(e,Mt)}function Nt(e){return Ve(e,Pt)}function gt(e){return Ve(e,zt)}function It(e){return Ve(e,Xt)}function bt(e){return Ve(e,Wt)}function _t(e){return Ve(e,en)}function Ot(e){return Ve(e,Rt)}function St(e){return Ve(e,Ft)}function wt(e){return Et(e)||bt(e)||_t(e)||Lt(e)&&wt(e.ofType)}function At(e){return Et(e)||Nt(e)||gt(e)||It(e)||bt(e)||Lt(e)&&At(e.ofType)}function Dt(e){return Et(e)||bt(e)}function xt(e){return Nt(e)||gt(e)||It(e)}function kt(e){return gt(e)||It(e)}class Rt{constructor(e){Tt(e)||P(!1,`Expected ${$e(e)} to be a GraphQL type.`),this.ofType=e}get[Symbol.toStringTag](){return"GraphQLList"}toString(){return"["+String(this.ofType)+"]"}toJSON(){return this.toString()}}class Ft{constructor(e){var t;Tt(t=e)&&!St(t)||P(!1,`Expected ${$e(e)} to be a GraphQL nullable type.`),this.ofType=e}get[Symbol.toStringTag](){return"GraphQLNonNull"}toString(){return String(this.ofType)+"!"}toJSON(){return this.toString()}}function Lt(e){return Ot(e)||St(e)}function $t(e){if(e)return St(e)?e.ofType:e}function Ct(e){return Et(e)||Nt(e)||gt(e)||It(e)||bt(e)||_t(e)}function Vt(e){if(e){let t=e;for(;Lt(t);)t=t.ofType;return t}}function Ut(e){return"function"==typeof e?e():e}function jt(e){return"function"==typeof e?e():e}class Mt{constructor(e){var t,n,i,r;const s=null!==(t=e.parseValue)&&void 0!==t?t:Je;this.name=yt(e.name),this.description=e.description,this.specifiedByURL=e.specifiedByURL,this.serialize=null!==(n=e.serialize)&&void 0!==n?n:Je,this.parseValue=s,this.parseLiteral=null!==(i=e.parseLiteral)&&void 0!==i?i:(e,t)=>s(mt(e,t)),this.extensions=tt(e.extensions),this.astNode=e.astNode,this.extensionASTNodes=null!==(r=e.extensionASTNodes)&&void 0!==r?r:[],null==e.specifiedByURL||"string"==typeof e.specifiedByURL||P(!1,`${this.name} must provide "specifiedByURL" as a string, but got: ${$e(e.specifiedByURL)}.`),null==e.serialize||"function"==typeof e.serialize||P(!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||P(!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 Pt{constructor(e){var t;this.name=yt(e.name),this.description=e.description,this.isTypeOf=e.isTypeOf,this.extensions=tt(e.extensions),this.astNode=e.astNode,this.extensionASTNodes=null!==(t=e.extensionASTNodes)&&void 0!==t?t:[],this._fields=()=>Gt(e),this._interfaces=()=>Bt(e),null==e.isTypeOf||"function"==typeof e.isTypeOf||P(!1,`${this.name} must provide "isTypeOf" as a function, but got: ${$e(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:Qt(this.getFields()),isTypeOf:this.isTypeOf,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}function Bt(e){var t;const n=Ut(null!==(t=e.interfaces)&&void 0!==t?t:[]);return Array.isArray(n)||P(!1,`${e.name} interfaces must be an Array or a function which returns an Array.`),n}function Gt(e){const t=jt(e.fields);return Yt(t)||P(!1,`${e.name} fields must be an object with field names as keys or a function which returns such an object.`),qe(t,((t,n)=>{var i;Yt(t)||P(!1,`${e.name}.${n} field config must be an object.`),null==t.resolve||"function"==typeof t.resolve||P(!1,`${e.name}.${n} field resolver must be a function if provided, but got: ${$e(t.resolve)}.`);const r=null!==(i=t.args)&&void 0!==i?i:{};return Yt(r)||P(!1,`${e.name}.${n} args must be an object with argument names as keys.`),{name:yt(n),description:t.description,type:t.type,args:Jt(r),resolve:t.resolve,subscribe:t.subscribe,deprecationReason:t.deprecationReason,extensions:tt(t.extensions),astNode:t.astNode}}))}function Jt(e){return Object.entries(e).map((([e,t])=>({name:yt(e),description:t.description,type:t.type,defaultValue:t.defaultValue,deprecationReason:t.deprecationReason,extensions:tt(t.extensions),astNode:t.astNode})))}function Yt(e){return G(e)&&!Array.isArray(e)}function Qt(e){return qe(e,(e=>({description:e.description,type:e.type,args:qt(e.args),resolve:e.resolve,subscribe:e.subscribe,deprecationReason:e.deprecationReason,extensions:e.extensions,astNode:e.astNode})))}function qt(e){return Qe(e,(e=>e.name),(e=>({description:e.description,type:e.type,defaultValue:e.defaultValue,deprecationReason:e.deprecationReason,extensions:e.extensions,astNode:e.astNode})))}function Kt(e){return St(e.type)&&void 0===e.defaultValue}class zt{constructor(e){var t;this.name=yt(e.name),this.description=e.description,this.resolveType=e.resolveType,this.extensions=tt(e.extensions),this.astNode=e.astNode,this.extensionASTNodes=null!==(t=e.extensionASTNodes)&&void 0!==t?t:[],this._fields=Gt.bind(void 0,e),this._interfaces=Bt.bind(void 0,e),null==e.resolveType||"function"==typeof e.resolveType||P(!1,`${this.name} must provide "resolveType" as a function, but got: ${$e(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:Qt(this.getFields()),resolveType:this.resolveType,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}}class Xt{constructor(e){var t;this.name=yt(e.name),this.description=e.description,this.resolveType=e.resolveType,this.extensions=tt(e.extensions),this.astNode=e.astNode,this.extensionASTNodes=null!==(t=e.extensionASTNodes)&&void 0!==t?t:[],this._types=Ht.bind(void 0,e),null==e.resolveType||"function"==typeof e.resolveType||P(!1,`${this.name} must provide "resolveType" as a function, but got: ${$e(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 Ht(e){const t=Ut(e.types);return Array.isArray(t)||P(!1,`Must provide Array of types or a function which returns such an array for Union ${e.name}.`),t}class Wt{constructor(e){var t,n,i;this.name=yt(e.name),this.description=e.description,this.extensions=tt(e.extensions),this.astNode=e.astNode,this.extensionASTNodes=null!==(t=e.extensionASTNodes)&&void 0!==t?t:[],this._values=(n=this.name,Yt(i=e.values)||P(!1,`${n} values must be an object with value names as keys.`),Object.entries(i).map((([e,t])=>(Yt(t)||P(!1,`${n}.${e} must refer to an object with a "value" key representing an internal value but got: ${$e(t)}.`),{name:vt(e),description:t.description,value:void 0!==t.value?t.value:e,deprecationReason:t.deprecationReason,extensions:tt(t.extensions),astNode:t.astNode})))),this._valueLookup=new Map(this._values.map((e=>[e.value,e]))),this._nameLookup=Ye(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 z(`Enum "${this.name}" cannot represent value: ${$e(e)}`);return t.name}parseValue(e){if("string"!=typeof e){const t=$e(e);throw new z(`Enum "${this.name}" cannot represent non-string value: ${t}.`+Zt(this,t))}const t=this.getValue(e);if(null==t)throw new z(`Value "${e}" does not exist in "${this.name}" enum.`+Zt(this,e));return t.value}parseLiteral(e,t){if(e.kind!==se.ENUM){const t=ct(e);throw new z(`Enum "${this.name}" cannot represent non-enum value: ${t}.`+Zt(this,t),{nodes:e})}const n=this.getValue(e.value);if(null==n){const t=ct(e);throw new z(`Value "${t}" does not exist in "${this.name}" enum.`+Zt(this,t),{nodes:e})}return n.value}toConfig(){const e=Qe(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 Zt(e,t){return Ge("the enum value",We(t,e.getValues().map((e=>e.name))))}class en{constructor(e){var t;this.name=yt(e.name),this.description=e.description,this.extensions=tt(e.extensions),this.astNode=e.astNode,this.extensionASTNodes=null!==(t=e.extensionASTNodes)&&void 0!==t?t:[],this._fields=tn.bind(void 0,e)}get[Symbol.toStringTag](){return"GraphQLInputObjectType"}getFields(){return"function"==typeof this._fields&&(this._fields=this._fields()),this._fields}toConfig(){const e=qe(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 tn(e){const t=jt(e.fields);return Yt(t)||P(!1,`${e.name} fields must be an object with field names as keys or a function which returns such an object.`),qe(t,((t,n)=>(!("resolve"in t)||P(!1,`${e.name}.${n} field has a resolve property, but Input Types cannot define resolvers.`),{name:yt(n),description:t.description,type:t.type,defaultValue:t.defaultValue,deprecationReason:t.deprecationReason,extensions:tt(t.extensions),astNode:t.astNode})))}function nn(e){return St(e.type)&&void 0===e.defaultValue}function rn(e,t){return e===t||(St(e)&&St(t)||!(!Ot(e)||!Ot(t)))&&rn(e.ofType,t.ofType)}function sn(e,t,n){return t===n||(St(n)?!!St(t)&&sn(e,t.ofType,n.ofType):St(t)?sn(e,t.ofType,n):Ot(n)?!!Ot(t)&&sn(e,t.ofType,n.ofType):!Ot(t)&&(kt(n)&&(gt(t)||Nt(t))&&e.isSubType(n,t)))}function on(e,t,n){return t===n||(kt(t)?kt(n)?e.getPossibleTypes(t).some((t=>e.isSubType(n,t))):e.isSubType(t,n):!!kt(n)&&e.isSubType(n,t))}const an=2147483647,cn=-2147483648,un=new Mt({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=mn(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 z(`Int cannot represent non-integer value: ${$e(t)}`);if(n>an||n<cn)throw new z("Int cannot represent non 32-bit signed integer value: "+$e(t));return n},parseValue(e){if("number"!=typeof e||!Number.isInteger(e))throw new z(`Int cannot represent non-integer value: ${$e(e)}`);if(e>an||e<cn)throw new z(`Int cannot represent non 32-bit signed integer value: ${e}`);return e},parseLiteral(e){if(e.kind!==se.INT)throw new z(`Int cannot represent non-integer value: ${ct(e)}`,{nodes:e});const t=parseInt(e.value,10);if(t>an||t<cn)throw new z(`Int cannot represent non 32-bit signed integer value: ${e.value}`,{nodes:e});return t}}),ln=new Mt({name:"Float",description:"The `Float` scalar type represents signed double-precision fractional values as specified by [IEEE 754](https://en.wikipedia.org/wiki/IEEE_floating_point).",serialize(e){const t=mn(e);if("boolean"==typeof t)return t?1:0;let n=t;if("string"==typeof t&&""!==t&&(n=Number(t)),"number"!=typeof n||!Number.isFinite(n))throw new z(`Float cannot represent non numeric value: ${$e(t)}`);return n},parseValue(e){if("number"!=typeof e||!Number.isFinite(e))throw new z(`Float cannot represent non numeric value: ${$e(e)}`);return e},parseLiteral(e){if(e.kind!==se.FLOAT&&e.kind!==se.INT)throw new z(`Float cannot represent non numeric value: ${ct(e)}`,e);return parseFloat(e.value)}}),pn=new Mt({name:"String",description:"The `String` scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.",serialize(e){const t=mn(e);if("string"==typeof t)return t;if("boolean"==typeof t)return t?"true":"false";if("number"==typeof t&&Number.isFinite(t))return t.toString();throw new z(`String cannot represent value: ${$e(e)}`)},parseValue(e){if("string"!=typeof e)throw new z(`String cannot represent a non string value: ${$e(e)}`);return e},parseLiteral(e){if(e.kind!==se.STRING)throw new z(`String cannot represent a non string value: ${ct(e)}`,{nodes:e});return e.value}}),dn=new Mt({name:"Boolean",description:"The `Boolean` scalar type represents `true` or `false`.",serialize(e){const t=mn(e);if("boolean"==typeof t)return t;if(Number.isFinite(t))return 0!==t;throw new z(`Boolean cannot represent a non boolean value: ${$e(t)}`)},parseValue(e){if("boolean"!=typeof e)throw new z(`Boolean cannot represent a non boolean value: ${$e(e)}`);return e},parseLiteral(e){if(e.kind!==se.BOOLEAN)throw new z(`Boolean cannot represent a non boolean value: ${ct(e)}`,{nodes:e});return e.value}}),fn=new Mt({name:"ID",description:'The `ID` scalar type represents a unique identifier, often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as `"4"`) or integer (such as `4`) input value will be accepted as an ID.',serialize(e){const t=mn(e);if("string"==typeof t)return t;if(Number.isInteger(t))return String(t);throw new z(`ID cannot represent value: ${$e(e)}`)},parseValue(e){if("string"==typeof e)return e;if("number"==typeof e&&Number.isInteger(e))return e.toString();throw new z(`ID cannot represent value: ${$e(e)}`)},parseLiteral(e){if(e.kind!==se.STRING&&e.kind!==se.INT)throw new z("ID cannot represent a non-string and non-integer value: "+ct(e),{nodes:e});return e.value}}),hn=Object.freeze([pn,un,ln,dn,fn]);function mn(e){if(G(e)){if("function"==typeof e.valueOf){const t=e.valueOf();if(!G(t))return t}if("function"==typeof e.toJSON)return e.toJSON()}return e}function yn(e){return Ve(e,vn)}class vn{constructor(e){var t,n;this.name=yt(e.name),this.description=e.description,this.locations=e.locations,this.isRepeatable=null!==(t=e.isRepeatable)&&void 0!==t&&t,this.extensions=tt(e.extensions),this.astNode=e.astNode,Array.isArray(e.locations)||P(!1,`@${e.name} locations must be an Array.`);const i=null!==(n=e.args)&&void 0!==n?n:{};G(i)&&!Array.isArray(i)||P(!1,`@${e.name} args must be an object with argument names as keys.`),this.args=Jt(i)}get[Symbol.toStringTag](){return"GraphQLDirective"}toConfig(){return{name:this.name,description:this.description,locations:this.locations,args:qt(this.args),isRepeatable:this.isRepeatable,extensions:this.extensions,astNode:this.astNode}}toString(){return"@"+this.name}toJSON(){return this.toString()}}const Tn=new vn({name:"include",description:"Directs the executor to include this field or fragment only when the `if` argument is true.",locations:[re.FIELD,re.FRAGMENT_SPREAD,re.INLINE_FRAGMENT],args:{if:{type:new Ft(dn),description:"Included when true."}}}),En=new vn({name:"skip",description:"Directs the executor to skip this field or fragment when the `if` argument is true.",locations:[re.FIELD,re.FRAGMENT_SPREAD,re.INLINE_FRAGMENT],args:{if:{type:new Ft(dn),description:"Skipped when true."}}}),Nn=new vn({name:"deprecated",description:"Marks an element of a GraphQL schema as no longer supported.",locations:[re.FIELD_DEFINITION,re.ARGUMENT_DEFINITION,re.INPUT_FIELD_DEFINITION,re.ENUM_VALUE],args:{reason:{type:pn,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:"No longer supported"}}}),gn=new vn({name:"specifiedBy",description:"Exposes a URL that specifies the behavior of this scalar.",locations:[re.SCALAR],args:{url:{type:new Ft(pn),description:"The URL that specifies the behavior of this scalar."}}}),In=Object.freeze([Tn,En,Nn,gn]);function bn(e){return"object"==typeof e&&"function"==typeof(null==e?void 0:e[Symbol.iterator])}function _n(e,t){if(St(t)){const n=_n(e,t.ofType);return(null==n?void 0:n.kind)===se.NULL?null:n}if(null===e)return{kind:se.NULL};if(void 0===e)return null;if(Ot(t)){const n=t.ofType;if(bn(e)){const t=[];for(const i of e){const e=_n(i,n);null!=e&&t.push(e)}return{kind:se.LIST,values:t}}return _n(e,n)}if(_t(t)){if(!G(e))return null;const n=[];for(const i of Object.values(t.getFields())){const t=_n(e[i.name],i.type);t&&n.push({kind:se.OBJECT_FIELD,name:{kind:se.NAME,value:i.name},value:t})}return{kind:se.OBJECT,fields:n}}if(Dt(t)){const n=t.serialize(e);if(null==n)return null;if("boolean"==typeof n)return{kind:se.BOOLEAN,value:n};if("number"==typeof n&&Number.isFinite(n)){const e=String(n);return On.test(e)?{kind:se.INT,value:e}:{kind:se.FLOAT,value:e}}if("string"==typeof n)return bt(t)?{kind:se.ENUM,value:n}:t===fn&&On.test(n)?{kind:se.INT,value:n}:{kind:se.STRING,value:n};throw new TypeError(`Cannot convert value to AST: ${$e(n)}.`)}J(!1,"Unexpected input type: "+$e(t))}const On=/^-?(?:0|[1-9][0-9]*)$/,Sn=new Pt({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:pn,resolve:e=>e.description},types:{description:"A list of all types supported by this server.",type:new Ft(new Rt(new Ft(Dn))),resolve:e=>Object.values(e.getTypeMap())},queryType:{description:"The type that query operations will be rooted at.",type:new Ft(Dn),resolve:e=>e.getQueryType()},mutationType:{description:"If this server supports mutation, the type that mutation operations will be rooted at.",type:Dn,resolve:e=>e.getMutationType()},subscriptionType:{description:"If this server support subscription, the type that subscription operations will be rooted at.",type:Dn,resolve:e=>e.getSubscriptionType()},directives:{description:"A list of all directives supported by this server.",type:new Ft(new Rt(new Ft(wn))),resolve:e=>e.getDirectives()}})}),wn=new Pt({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 Ft(pn),resolve:e=>e.name},description:{type:pn,resolve:e=>e.description},isRepeatable:{type:new Ft(dn),resolve:e=>e.isRepeatable},locations:{type:new Ft(new Rt(new Ft(An))),resolve:e=>e.locations},args:{type:new Ft(new Rt(new Ft(kn))),args:{includeDeprecated:{type:dn,defaultValue:!1}},resolve:(e,{includeDeprecated:t})=>t?e.args:e.args.filter((e=>null==e.deprecationReason))}})}),An=new Wt({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:re.QUERY,description:"Location adjacent to a query operation."},MUTATION:{value:re.MUTATION,description:"Location adjacent to a mutation operation."},SUBSCRIPTION:{value:re.SUBSCRIPTION,description:"Location adjacent to a subscription operation."},FIELD:{value:re.FIELD,description:"Location adjacent to a field."},FRAGMENT_DEFINITION:{value:re.FRAGMENT_DEFINITION,description:"Location adjacent to a fragment definition."},FRAGMENT_SPREAD:{value:re.FRAGMENT_SPREAD,description:"Location adjacent to a fragment spread."},INLINE_FRAGMENT:{value:re.INLINE_FRAGMENT,description:"Location adjacent to an inline fragment."},VARIABLE_DEFINITION:{value:re.VARIABLE_DEFINITION,description:"Location adjacent to a variable definition."},SCHEMA:{value:re.SCHEMA,description:"Location adjacent to a schema definition."},SCALAR:{value:re.SCALAR,description:"Location adjacent to a scalar definition."},OBJECT:{value:re.OBJECT,description:"Location adjacent to an object type definition."},FIELD_DEFINITION:{value:re.FIELD_DEFINITION,description:"Location adjacent to a field definition."},ARGUMENT_DEFINITION:{value:re.ARGUMENT_DEFINITION,description:"Location adjacent to an argument definition."},INTERFACE:{value:re.INTERFACE,description:"Location adjacent to an interface definition."},UNION:{value:re.UNION,description:"Location adjacent to a union definition."},ENUM:{value:re.ENUM,description:"Location adjacent to an enum definition."},ENUM_VALUE:{value:re.ENUM_VALUE,description:"Location adjacent to an enum value definition."},INPUT_OBJECT:{value:re.INPUT_OBJECT,description:"Location adjacent to an input object type definition."},INPUT_FIELD_DEFINITION:{value:re.INPUT_FIELD_DEFINITION,description:"Location adjacent to an input object field definition."}}}),Dn=new Pt({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 Ft(Ln),resolve:e=>Et(e)?Fn.SCALAR:Nt(e)?Fn.OBJECT:gt(e)?Fn.INTERFACE:It(e)?Fn.UNION:bt(e)?Fn.ENUM:_t(e)?Fn.INPUT_OBJECT:Ot(e)?Fn.LIST:St(e)?Fn.NON_NULL:void J(!1,`Unexpected type: "${$e(e)}".`)},name:{type:pn,resolve:e=>"name"in e?e.name:void 0},description:{type:pn,resolve:e=>"description"in e?e.description:void 0},specifiedByURL:{type:pn,resolve:e=>"specifiedByURL"in e?e.specifiedByURL:void 0},fields:{type:new Rt(new Ft(xn)),args:{includeDeprecated:{type:dn,defaultValue:!1}},resolve(e,{includeDeprecated:t}){if(Nt(e)||gt(e)){const n=Object.values(e.getFields());return t?n:n.filter((e=>null==e.deprecationReason))}}},interfaces:{type:new Rt(new Ft(Dn)),resolve(e){if(Nt(e)||gt(e))return e.getInterfaces()}},possibleTypes:{type:new Rt(new Ft(Dn)),resolve(e,t,n,{schema:i}){if(kt(e))return i.getPossibleTypes(e)}},enumValues:{type:new Rt(new Ft(Rn)),args:{includeDeprecated:{type:dn,defaultValue:!1}},resolve(e,{includeDeprecated:t}){if(bt(e)){const n=e.getValues();return t?n:n.filter((e=>null==e.deprecationReason))}}},inputFields:{type:new Rt(new Ft(kn)),args:{includeDeprecated:{type:dn,defaultValue:!1}},resolve(e,{includeDeprecated:t}){if(_t(e)){const n=Object.values(e.getFields());return t?n:n.filter((e=>null==e.deprecationReason))}}},ofType:{type:Dn,resolve:e=>"ofType"in e?e.ofType:void 0}})}),xn=new Pt({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 Ft(pn),resolve:e=>e.name},description:{type:pn,resolve:e=>e.description},args:{type:new Ft(new Rt(new Ft(kn))),args:{includeDeprecated:{type:dn,defaultValue:!1}},resolve:(e,{includeDeprecated:t})=>t?e.args:e.args.filter((e=>null==e.deprecationReason))},type:{type:new Ft(Dn),resolve:e=>e.type},isDeprecated:{type:new Ft(dn),resolve:e=>null!=e.deprecationReason},deprecationReason:{type:pn,resolve:e=>e.deprecationReason}})}),kn=new Pt({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 Ft(pn),resolve:e=>e.name},description:{type:pn,resolve:e=>e.description},type:{type:new Ft(Dn),resolve:e=>e.type},defaultValue:{type:pn,description:"A GraphQL-formatted string representing the default value for this input value.",resolve(e){const{type:t,defaultValue:n}=e,i=_n(n,t);return i?ct(i):null}},isDeprecated:{type:new Ft(dn),resolve:e=>null!=e.deprecationReason},deprecationReason:{type:pn,resolve:e=>e.deprecationReason}})}),Rn=new Pt({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 Ft(pn),resolve:e=>e.name},description:{type:pn,resolve:e=>e.description},isDeprecated:{type:new Ft(dn),resolve:e=>null!=e.deprecationReason},deprecationReason:{type:pn,resolve:e=>e.deprecationReason}})});var Fn;!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"}(Fn||(Fn={}));const Ln=new Wt({name:"__TypeKind",description:"An enum describing what kind of type a given `__Type` is.",values:{SCALAR:{value:Fn.SCALAR,description:"Indicates this type is a scalar."},OBJECT:{value:Fn.OBJECT,description:"Indicates this type is an object. `fields` and `interfaces` are valid fields."},INTERFACE:{value:Fn.INTERFACE,description:"Indicates this type is an interface. `fields`, `interfaces`, and `possibleTypes` are valid fields."},UNION:{value:Fn.UNION,description:"Indicates this type is a union. `possibleTypes` is a valid field."},ENUM:{value:Fn.ENUM,description:"Indicates this type is an enum. `enumValues` is a valid field."},INPUT_OBJECT:{value:Fn.INPUT_OBJECT,description:"Indicates this type is an input object. `inputFields` is a valid field."},LIST:{value:Fn.LIST,description:"Indicates this type is a list. `ofType` is a valid field."},NON_NULL:{value:Fn.NON_NULL,description:"Indicates this type is a non-null. `ofType` is a valid field."}}}),$n={name:"__schema",type:new Ft(Sn),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},Cn={name:"__type",type:Dn,description:"Request the type information of a single type.",args:[{name:"name",description:void 0,type:new Ft(pn),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},Vn={name:"__typename",type:new Ft(pn),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},Un=Object.freeze([Sn,wn,An,Dn,xn,kn,Rn,Ln]);function jn(e){return Un.some((({name:t})=>e.name===t))}function Mn(e){if(!function(e){return Ve(e,Pn)}(e))throw new Error(`Expected ${$e(e)} to be a GraphQL schema.`);return e}class Pn{constructor(e){var t,n;this.__validationErrors=!0===e.assumeValid?[]:void 0,G(e)||P(!1,"Must provide configuration object."),!e.types||Array.isArray(e.types)||P(!1,`"types" must be Array if provided but got: ${$e(e.types)}.`),!e.directives||Array.isArray(e.directives)||P(!1,`"directives" must be Array if provided but got: ${$e(e.directives)}.`),this.description=e.description,this.extensions=tt(e.extensions),this.astNode=e.astNode,this.extensionASTNodes=null!==(t=e.extensionASTNodes)&&void 0!==t?t:[],this._queryType=e.query,this._mutationType=e.mutation,this._subscriptionType=e.subscription,this._directives=null!==(n=e.directives)&&void 0!==n?n:In;const i=new Set(e.types);if(null!=e.types)for(const t of e.types)i.delete(t),Bn(t,i);null!=this._queryType&&Bn(this._queryType,i),null!=this._mutationType&&Bn(this._mutationType,i),null!=this._subscriptionType&&Bn(this._subscriptionType,i);for(const e of this._directives)if(yn(e))for(const t of e.args)Bn(t.type,i);Bn(Sn,i),this._typeMap=Object.create(null),this._subTypeMap=Object.create(null),this._implementationsMap=Object.create(null);for(const e of i){if(null==e)continue;const t=e.name;if(t||P(!1,"One of the provided types for building the Schema is missing a name."),void 0!==this._typeMap[t])throw new Error(`Schema must contain uniquely named types but contains multiple types named "${t}".`);if(this._typeMap[t]=e,gt(e)){for(const t of e.getInterfaces())if(gt(t)){let n=this._implementationsMap[t.name];void 0===n&&(n=this._implementationsMap[t.name]={objects:[],interfaces:[]}),n.interfaces.push(e)}}else if(Nt(e))for(const t of e.getInterfaces())if(gt(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 ie.QUERY:return this.getQueryType();case ie.MUTATION:return this.getMutationType();case ie.SUBSCRIPTION:return this.getSubscriptionType()}}getTypeMap(){return this._typeMap}getType(e){return this.getTypeMap()[e]}getPossibleTypes(e){return It(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),It(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 Bn(e,t){const n=Vt(e);if(!t.has(n))if(t.add(n),It(n))for(const e of n.getTypes())Bn(e,t);else if(Nt(n)||gt(n)){for(const e of n.getInterfaces())Bn(e,t);for(const e of Object.values(n.getFields())){Bn(e.type,t);for(const n of e.args)Bn(n.type,t)}}else if(_t(n))for(const e of Object.values(n.getFields()))Bn(e.type,t);return t}function Gn(e){if(Mn(e),e.__validationErrors)return e.__validationErrors;const t=new Yn(e);!function(e){const t=e.schema,n=t.getQueryType();if(n){if(!Nt(n)){var i;e.reportError(`Query root type must be Object type, it cannot be ${$e(n)}.`,null!==(i=Qn(t,ie.QUERY))&&void 0!==i?i:n.astNode)}}else e.reportError("Query root type must be provided.",t.astNode);const r=t.getMutationType();var s;r&&!Nt(r)&&e.reportError(`Mutation root type must be Object type if provided, it cannot be ${$e(r)}.`,null!==(s=Qn(t,ie.MUTATION))&&void 0!==s?s:r.astNode);const o=t.getSubscriptionType();var a;o&&!Nt(o)&&e.reportError(`Subscription root type must be Object type if provided, it cannot be ${$e(o)}.`,null!==(a=Qn(t,ie.SUBSCRIPTION))&&void 0!==a?a:o.astNode)}(t),function(e){for(const n of e.schema.getDirectives())if(yn(n)){qn(e,n);for(const i of n.args){var t;if(qn(e,i),wt(i.type)||e.reportError(`The type of @${n.name}(${i.name}:) must be Input Type but got: ${$e(i.type)}.`,i.astNode),Kt(i)&&null!=i.deprecationReason)e.reportError(`Required argument @${n.name}(${i.name}:) cannot be deprecated.`,[ii(i.astNode),null===(t=i.astNode)||void 0===t?void 0:t.type])}}else e.reportError(`Expected directive but got: ${$e(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(s){if(t[s.name])return;t[s.name]=!0,i[s.name]=n.length;const o=Object.values(s.getFields());for(const t of o)if(St(t.type)&&_t(t.type.ofType)){const s=t.type.ofType,o=i[s.name];if(n.push(t),void 0===o)r(s);else{const t=n.slice(o),i=t.map((e=>e.name)).join(".");e.reportError(`Cannot reference Input Object "${s.name}" within itself through a series of non-null fields: "${i}".`,t.map((e=>e.astNode)))}n.pop()}i[s.name]=void 0}}(e),n=e.schema.getTypeMap();for(const i of Object.values(n))Ct(i)?(jn(i)||qn(e,i),Nt(i)||gt(i)?(Kn(e,i),zn(e,i)):It(i)?Wn(e,i):bt(i)?Zn(e,i):_t(i)&&(ei(e,i),t(i))):e.reportError(`Expected GraphQL named type but got: ${$e(i)}.`,i.astNode)}(t);const n=t.getErrors();return e.__validationErrors=n,n}function Jn(e){const t=Gn(e);if(0!==t.length)throw new Error(t.map((e=>e.message)).join("\n\n"))}class Yn{constructor(e){this._errors=[],this.schema=e}reportError(e,t){const n=Array.isArray(t)?t.filter(Boolean):t;this._errors.push(new z(e,{nodes:n}))}getErrors(){return this._errors}}function Qn(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 qn(e,t){t.name.startsWith("__")&&e.reportError(`Name "${t.name}" must not begin with "__", which is reserved by GraphQL introspection.`,t.astNode)}function Kn(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 o of n){var i;if(qn(e,o),!At(o.type))e.reportError(`The type of ${t.name}.${o.name} must be Output Type but got: ${$e(o.type)}.`,null===(i=o.astNode)||void 0===i?void 0:i.type);for(const n of o.args){const i=n.name;var r,s;if(qn(e,n),!wt(n.type))e.reportError(`The type of ${t.name}.${o.name}(${i}:) must be Input Type but got: ${$e(n.type)}.`,null===(r=n.astNode)||void 0===r?void 0:r.type);if(Kt(n)&&null!=n.deprecationReason)e.reportError(`Required argument ${t.name}.${o.name}(${i}:) cannot be deprecated.`,[ii(n.astNode),null===(s=n.astNode)||void 0===s?void 0:s.type])}}}function zn(e,t){const n=Object.create(null);for(const i of t.getInterfaces())gt(i)?t!==i?n[i.name]?e.reportError(`Type ${t.name} can only implement ${i.name} once.`,ti(t,i)):(n[i.name]=!0,Hn(e,t,i),Xn(e,t,i)):e.reportError(`Type ${t.name} cannot implement itself because it would create a circular reference.`,ti(t,i)):e.reportError(`Type ${$e(t)} must only implement Interface types, it cannot implement ${$e(i)}.`,ti(t,i))}function Xn(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,s;if(!sn(e.schema,l.type,c.type))e.reportError(`Interface field ${n.name}.${u} expects type ${$e(c.type)} but ${t.name}.${u} is type ${$e(l.type)}.`,[null===(r=c.astNode)||void 0===r?void 0:r.type,null===(s=l.astNode)||void 0===s?void 0:s.type]);for(const i of c.args){const r=i.name,s=l.args.find((e=>e.name===r));var o,a;if(s){if(!rn(i.type,s.type))e.reportError(`Interface field argument ${n.name}.${u}(${r}:) expects type ${$e(i.type)} but ${t.name}.${u}(${r}:) is type ${$e(s.type)}.`,[null===(o=i.astNode)||void 0===o?void 0:o.type,null===(a=s.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))&&Kt(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 Hn(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}.`,[...ti(n,r),...ti(t,n)])}function Wn(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.`,ni(t,r.name)):(i[r.name]=!0,Nt(r)||e.reportError(`Union type ${t.name} can only include Object types, it cannot include ${$e(r)}.`,ni(t,String(r))))}function Zn(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)qn(e,t)}function ei(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 s of n){var i,r;if(qn(e,s),!wt(s.type))e.reportError(`The type of ${t.name}.${s.name} must be Input Type but got: ${$e(s.type)}.`,null===(i=s.astNode)||void 0===i?void 0:i.type);if(nn(s)&&null!=s.deprecationReason)e.reportError(`Required input field ${t.name}.${s.name} cannot be deprecated.`,[ii(s.astNode),null===(r=s.astNode)||void 0===r?void 0:r.type])}}function ti(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 ni(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 ii(e){var t;return null==e||null===(t=e.directives)||void 0===t?void 0:t.find((e=>e.name.value===Nn.name))}function ri(e,t){switch(t.kind){case se.LIST_TYPE:{const n=ri(e,t.type);return n&&new Rt(n)}case se.NON_NULL_TYPE:{const n=ri(e,t.type);return n&&new Ft(n)}case se.NAMED_TYPE:return e.getType(t.name.value)}}class si{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:oi,t&&(wt(t)&&this._inputTypeStack.push(t),xt(t)&&this._parentTypeStack.push(t),At(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 se.SELECTION_SET:{const e=Vt(this.getType());this._parentTypeStack.push(xt(e)?e:void 0);break}case se.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(At(r)?r:void 0);break}case se.DIRECTIVE:this._directive=t.getDirective(e.name.value);break;case se.OPERATION_DEFINITION:{const n=t.getRootType(e.operation);this._typeStack.push(Nt(n)?n:void 0);break}case se.INLINE_FRAGMENT:case se.FRAGMENT_DEFINITION:{const n=e.typeCondition,i=n?ri(t,n):Vt(this.getType());this._typeStack.push(At(i)?i:void 0);break}case se.VARIABLE_DEFINITION:{const n=ri(t,e.type);this._inputTypeStack.push(wt(n)?n:void 0);break}case se.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(wt(i)?i:void 0);break}case se.LIST:{const e=$t(this.getInputType()),t=Ot(e)?e.ofType:e;this._defaultValueStack.push(void 0),this._inputTypeStack.push(wt(t)?t:void 0);break}case se.OBJECT_FIELD:{const t=Vt(this.getInputType());let n,i;_t(t)&&(i=t.getFields()[e.name.value],i&&(n=i.type)),this._defaultValueStack.push(i?i.defaultValue:void 0),this._inputTypeStack.push(wt(n)?n:void 0);break}case se.ENUM:{const t=Vt(this.getInputType());let n;bt(t)&&(n=t.getValue(e.value)),this._enumValue=n;break}}}leave(e){switch(e.kind){case se.SELECTION_SET:this._parentTypeStack.pop();break;case se.FIELD:this._fieldDefStack.pop(),this._typeStack.pop();break;case se.DIRECTIVE:this._directive=null;break;case se.OPERATION_DEFINITION:case se.INLINE_FRAGMENT:case se.FRAGMENT_DEFINITION:this._typeStack.pop();break;case se.VARIABLE_DEFINITION:this._inputTypeStack.pop();break;case se.ARGUMENT:this._argument=null,this._defaultValueStack.pop(),this._inputTypeStack.pop();break;case se.LIST:case se.OBJECT_FIELD:this._defaultValueStack.pop(),this._inputTypeStack.pop();break;case se.ENUM:this._enumValue=null}}}function oi(e,t,n){const i=n.name.value;return i===$n.name&&e.getQueryType()===t?$n:i===Cn.name&&e.getQueryType()===t?Cn:i===Vn.name&&xt(t)?Vn:Nt(t)||gt(t)?t.getFields()[i]:void 0}function ai(e,t){return{enter(...n){const i=n[0];e.enter(i);const r=at(t,i.kind).enter;if(r){const s=r.apply(t,n);return void 0!==s&&(e.leave(i),ne(s)&&e.enter(s)),s}},leave(...n){const i=n[0],r=at(t,i.kind).leave;let s;return r&&(s=r.apply(t,n)),e.leave(i),s}}}function ci(e){return e.kind===se.OPERATION_DEFINITION||e.kind===se.FRAGMENT_DEFINITION}function ui(e){return e.kind===se.SCALAR_TYPE_DEFINITION||e.kind===se.OBJECT_TYPE_DEFINITION||e.kind===se.INTERFACE_TYPE_DEFINITION||e.kind===se.UNION_TYPE_DEFINITION||e.kind===se.ENUM_TYPE_DEFINITION||e.kind===se.INPUT_OBJECT_TYPE_DEFINITION}function li(e){return e.kind===se.SCALAR_TYPE_EXTENSION||e.kind===se.OBJECT_TYPE_EXTENSION||e.kind===se.INTERFACE_TYPE_EXTENSION||e.kind===se.UNION_TYPE_EXTENSION||e.kind===se.ENUM_TYPE_EXTENSION||e.kind===se.INPUT_OBJECT_TYPE_EXTENSION}function pi(e){const t=Object.create(null),n=e.getSchema(),i=n?n.getDirectives():In;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===se.DIRECTIVE_DEFINITION){var s;const n=null!==(s=e.arguments)&&void 0!==s?s:[];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 s=We(n,r);e.reportError(new z(`Unknown argument "${n}" on directive "@${i}".`+Ge(s),{nodes:t}))}}return!1}}}const di=[...hn,...Un].map((e=>e.name));function fi(e){switch(e.kind){case se.OBJECT:return{...e,fields:(t=e.fields,t.map((e=>({...e,value:fi(e.value)}))).sort(((e,t)=>Ke(e.name.value,t.name.value))))};case se.LIST:return{...e,values:e.values.map(fi)};case se.INT:case se.FLOAT:case se.STRING:case se.BOOLEAN:case se.NULL:case se.ENUM:case se.VARIABLE:return e}var t}function hi(e){return Array.isArray(e)?e.map((([e,t])=>`subfields "${e}" conflict because `+hi(t))).join(" and "):e}function mi(e,t,n,i,r,s,o){const a=e.getFragment(o);if(!a)return;const[c,u]=Ii(e,n,a);if(s!==c){vi(e,t,n,i,r,s,c);for(const a of u)i.has(a,o,r)||(i.add(a,o,r),mi(e,t,n,i,r,s,a))}}function yi(e,t,n,i,r,s,o){if(s===o)return;if(i.has(s,o,r))return;i.add(s,o,r);const a=e.getFragment(s),c=e.getFragment(o);if(!a||!c)return;const[u,l]=Ii(e,n,a),[p,d]=Ii(e,n,c);vi(e,t,n,i,r,u,p);for(const o of d)yi(e,t,n,i,r,s,o);for(const s of l)yi(e,t,n,i,r,s,o)}function vi(e,t,n,i,r,s,o){for(const[a,c]of Object.entries(s)){const s=o[a];if(s)for(const o of c)for(const c of s){const s=Ti(e,n,i,r,a,o,c);s&&t.push(s)}}}function Ti(e,t,n,i,r,s,o){const[a,c,u]=s,[l,p,d]=o,f=i||a!==l&&Nt(a)&&Nt(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(Ei(c)!==Ei(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&&Ni(h,m))return[[r,`they return conflicting types "${$e(h)}" and "${$e(m)}"`],[c],[p]];const y=c.selectionSet,v=p.selectionSet;if(y&&v){const i=function(e,t,n,i,r,s,o,a){const c=[],[u,l]=gi(e,t,r,s),[p,d]=gi(e,t,o,a);vi(e,c,t,n,i,u,p);for(const r of d)mi(e,c,t,n,i,u,r);for(const r of l)mi(e,c,t,n,i,p,r);for(const r of l)for(const s of d)yi(e,c,t,n,i,r,s);return c}(e,t,n,f,Vt(h),y,Vt(m),v);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 Ei(e){var t;const n=null!==(t=e.arguments)&&void 0!==t?t:[];return ct(fi({kind:se.OBJECT,fields:n.map((e=>({kind:se.OBJECT_FIELD,name:e.name,value:e.value})))}))}function Ni(e,t){return Ot(e)?!Ot(t)||Ni(e.ofType,t.ofType):!!Ot(t)||(St(e)?!St(t)||Ni(e.ofType,t.ofType):!!St(t)||!(!Dt(e)&&!Dt(t))&&e!==t)}function gi(e,t,n,i){const r=t.get(i);if(r)return r;const s=Object.create(null),o=Object.create(null);bi(e,n,i,s,o);const a=[s,Object.keys(o)];return t.set(i,a),a}function Ii(e,t,n){const i=t.get(n.selectionSet);if(i)return i;const r=ri(e.getSchema(),n.typeCondition);return gi(e,t,r,n.selectionSet)}function bi(e,t,n,i,r){for(const s of n.selections)switch(s.kind){case se.FIELD:{const e=s.name.value;let n;(Nt(t)||gt(t))&&(n=t.getFields()[e]);const r=s.alias?s.alias.value:e;i[r]||(i[r]=[]),i[r].push([t,s,n]);break}case se.FRAGMENT_SPREAD:r[s.name.value]=!0;break;case se.INLINE_FRAGMENT:{const n=s.typeCondition,o=n?ri(e.getSchema(),n):t;bi(e,o,s.selectionSet,i,r);break}}}class _i{constructor(){this._data=new Map}has(e,t,n){var i;const[r,s]=e<t?[e,t]:[t,e],o=null===(i=this._data.get(r))||void 0===i?void 0:i.get(s);return void 0!==o&&(!!n||n===o)}add(e,t,n){const[i,r]=e<t?[e,t]:[t,e],s=this._data.get(i);void 0===s?this._data.set(i,new Map([[r,n]])):s.set(r,n)}}function Oi(e){var t;const n=Object.create(null),i=e.getSchema(),r=null!==(t=null==i?void 0:i.getDirectives())&&void 0!==t?t:In;for(const e of r)n[e.name]=Ye(e.args.filter(Kt),(e=>e.name));const s=e.getDocument().definitions;for(const e of s)if(e.kind===se.DIRECTIVE_DEFINITION){var o;const t=null!==(o=e.arguments)&&void 0!==o?o:[];n[e.name.value]=Ye(t.filter(Si),(e=>e.name.value))}return{Directive:{leave(t){const i=t.name.value,r=n[i];if(r){var s;const n=null!==(s=t.arguments)&&void 0!==s?s:[],o=new Set(n.map((e=>e.name.value)));for(const[n,s]of Object.entries(r))if(!o.has(n)){const r=Tt(s.type)?$e(s.type):ct(s.type);e.reportError(new z(`Directive "@${i}" argument "${n}" of type "${r}" is required, but it was not provided.`,{nodes:t}))}}}}}}function Si(e){return e.type.kind===se.NON_NULL_TYPE&&null==e.defaultValue}function wi(e){return e.map((e=>"number"==typeof e?"["+e.toString()+"]":"."+e)).join("")}function Ai(e,t,n){return{prev:e,key:t,typename:n}}function Di(e){const t=[];let n=e;for(;n;)t.push(n.key),n=n.prev;return t.reverse()}function xi(e,t,n=ki){return Ri(e,t,n,void 0)}function ki(e,t,n){let i="Invalid value "+$e(t);throw e.length>0&&(i+=` at "value${wi(e)}"`),n.message=i+": "+n.message,n}function Ri(e,t,n,i){if(St(t))return null!=e?Ri(e,t.ofType,n,i):void n(Di(i),e,new z(`Expected non-nullable type "${$e(t)}" not to be null.`));if(null==e)return null;if(Ot(t)){const r=t.ofType;return bn(e)?Array.from(e,((e,t)=>{const s=Ai(i,t,void 0);return Ri(e,r,n,s)})):[Ri(e,r,n,i)]}if(_t(t)){if(!G(e))return void n(Di(i),e,new z(`Expected type "${t.name}" to be an object.`));const r={},s=t.getFields();for(const o of Object.values(s)){const s=e[o.name];if(void 0!==s)r[o.name]=Ri(s,o.type,n,Ai(i,o.name,t.name));else if(void 0!==o.defaultValue)r[o.name]=o.defaultValue;else if(St(o.type)){const t=$e(o.type);n(Di(i),e,new z(`Field "${o.name}" of required type "${t}" was not provided.`))}}for(const r of Object.keys(e))if(!s[r]){const s=We(r,Object.keys(t.getFields()));n(Di(i),e,new z(`Field "${r}" is not defined by type "${t.name}".`+Ge(s)))}return r}if(Dt(t)){let r;try{r=t.parseValue(e)}catch(r){return void n(Di(i),e,r instanceof z?r:new z(`Expected type "${t.name}". `+r.message,{originalError:r}))}return void 0===r&&n(Di(i),e,new z(`Expected type "${t.name}".`)),r}J(!1,"Unexpected input type: "+$e(t))}function Fi(e,t,n){if(e){if(e.kind===se.VARIABLE){const i=e.name.value;if(null==n||void 0===n[i])return;const r=n[i];if(null===r&&St(t))return;return r}if(St(t)){if(e.kind===se.NULL)return;return Fi(e,t.ofType,n)}if(e.kind===se.NULL)return null;if(Ot(t)){const i=t.ofType;if(e.kind===se.LIST){const t=[];for(const r of e.values)if(Li(r,n)){if(St(i))return;t.push(null)}else{const e=Fi(r,i,n);if(void 0===e)return;t.push(e)}return t}const r=Fi(e,i,n);if(void 0===r)return;return[r]}if(_t(t)){if(e.kind!==se.OBJECT)return;const i=Object.create(null),r=Ye(e.fields,(e=>e.name.value));for(const e of Object.values(t.getFields())){const t=r[e.name];if(!t||Li(t.value,n)){if(void 0!==e.defaultValue)i[e.name]=e.defaultValue;else if(St(e.type))return;continue}const s=Fi(t.value,e.type,n);if(void 0===s)return;i[e.name]=s}return i}if(Dt(t)){let i;try{i=t.parseLiteral(e,n)}catch(e){return}if(void 0===i)return;return i}J(!1,"Unexpected input type: "+$e(t))}}function Li(e,t){return e.kind===se.VARIABLE&&(null==t||void 0===t[e.name.value])}function $i(e,t,n,i){const r=[],s=null==i?void 0:i.maxErrors;try{const i=function(e,t,n,i){const r={};for(const s of t){const t=s.variable.name.value,o=ri(e,s.type);if(!wt(o)){const e=ct(s.type);i(new z(`Variable "$${t}" expected value of type "${e}" which cannot be used as an input type.`,{nodes:s.type}));continue}if(!Ui(n,t)){if(s.defaultValue)r[t]=Fi(s.defaultValue,o);else if(St(o)){const e=$e(o);i(new z(`Variable "$${t}" of required type "${e}" was not provided.`,{nodes:s}))}continue}const a=n[t];if(null===a&&St(o)){const e=$e(o);i(new z(`Variable "$${t}" of non-null type "${e}" must not be null.`,{nodes:s}))}else r[t]=xi(a,o,((e,n,r)=>{let o=`Variable "$${t}" got invalid value `+$e(n);e.length>0&&(o+=` at "${t}${wi(e)}"`),i(new z(o+"; "+r.message,{nodes:s,originalError:r.originalError}))}))}return r}(e,t,n,(e=>{if(null!=s&&r.length>=s)throw new z("Too many errors processing variables, error limit reached. Execution aborted.");r.push(e)}));if(0===r.length)return{coerced:i}}catch(e){r.push(e)}return{errors:r}}function Ci(e,t,n){var i;const r={},s=Ye(null!==(i=t.arguments)&&void 0!==i?i:[],(e=>e.name.value));for(const i of e.args){const e=i.name,o=i.type,a=s[e];if(!a){if(void 0!==i.defaultValue)r[e]=i.defaultValue;else if(St(o))throw new z(`Argument "${e}" of required type "${$e(o)}" was not provided.`,{nodes:t});continue}const c=a.value;let u=c.kind===se.NULL;if(c.kind===se.VARIABLE){const t=c.name.value;if(null==n||!Ui(n,t)){if(void 0!==i.defaultValue)r[e]=i.defaultValue;else if(St(o))throw new z(`Argument "${e}" of required type "${$e(o)}" was provided the variable "$${t}" which was not provided a runtime value.`,{nodes:c});continue}u=null==n[t]}if(u&&St(o))throw new z(`Argument "${e}" of non-null type "${$e(o)}" must not be null.`,{nodes:c});const l=Fi(c,o,n);if(void 0===l)throw new z(`Argument "${e}" has invalid value ${ct(c)}.`,{nodes:c});r[e]=l}return r}function Vi(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 Ci(e,r,n)}function Ui(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function ji(e,t,n,i,r){const s=new Map;return Mi(e,t,n,i,r,s,new Set),s}function Mi(e,t,n,i,r,s,o){for(const c of r.selections)switch(c.kind){case se.FIELD:{if(!Pi(n,c))continue;const e=(a=c).alias?a.alias.value:a.name.value,t=s.get(e);void 0!==t?t.push(c):s.set(e,[c]);break}case se.INLINE_FRAGMENT:if(!Pi(n,c)||!Bi(e,c,i))continue;Mi(e,t,n,i,c.selectionSet,s,o);break;case se.FRAGMENT_SPREAD:{const r=c.name.value;if(o.has(r)||!Pi(n,c))continue;o.add(r);const a=t[r];if(!a||!Bi(e,a,i))continue;Mi(e,t,n,i,a.selectionSet,s,o);break}}var a}function Pi(e,t){const n=Vi(En,t,e);if(!0===(null==n?void 0:n.if))return!1;const i=Vi(Tn,t,e);return!1!==(null==i?void 0:i.if)}function Bi(e,t,n){const i=t.typeCondition;if(!i)return!0;const r=ri(e,i);return r===n||!!kt(r)&&e.isSubType(r,n)}function Gi(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 Ji(e,t){const n=e.getInputType();if(!n)return;const i=Vt(n);if(Dt(i))try{if(void 0===i.parseLiteral(t,void 0)){const i=$e(n);e.reportError(new z(`Expected value of type "${i}", found ${ct(t)}.`,{nodes:t}))}}catch(i){const r=$e(n);i instanceof z?e.reportError(i):e.reportError(new z(`Expected value of type "${r}", found ${ct(t)}; `+i.message,{nodes:t,originalError:i}))}else{const i=$e(n);e.reportError(new z(`Expected value of type "${i}", found ${ct(t)}.`,{nodes:t}))}}function Yi(e,t,n,i,r){if(St(i)&&!St(t)){if(!(null!=n&&n.kind!==se.NULL)&&!(void 0!==r))return!1;return sn(e,t,i.ofType)}return sn(e,t,i)}const Qi=Object.freeze([function(e){return{Document(t){for(const n of t.definitions)if(!ci(n)){const t=n.kind===se.SCHEMA_DEFINITION||n.kind===se.SCHEMA_EXTENSION?"schema":'"'+n.name.value+'"';e.reportError(new z(`The ${t} definition is not executable.`,{nodes: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 z(`There can be only one operation named "${i.value}".`,{nodes:[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===se.OPERATION_DEFINITION)).length},OperationDefinition(n){!n.name&&t>1&&e.reportError(new z("This anonymous operation must be the only defined operation.",{nodes: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,s=Object.create(null),o=e.getDocument(),a=Object.create(null);for(const e of o.definitions)e.kind===se.FRAGMENT_DEFINITION&&(a[e.name.value]=e);const c=ji(n,a,s,i,t.selectionSet);if(c.size>1){const t=[...c.values()].slice(1).flat();e.reportError(new z(null!=r?`Subscription "${r}" must select only one top level field.`:"Anonymous Subscription must select only one top level field.",{nodes:t}))}for(const t of c.values()){t[0].name.value.startsWith("__")&&e.reportError(new z(null!=r?`Subscription "${r}" must not select an introspection top level field.`:"Anonymous Subscription must not select an introspection top level field.",{nodes:t}))}}}}}},function(e){const t=e.getSchema(),n=t?t.getTypeMap():Object.create(null),i=Object.create(null);for(const t of e.getDocument().definitions)ui(t)&&(i[t.name.value]=!0);const r=[...Object.keys(n),...Object.keys(i)];return{NamedType(t,s,o,a,c){const u=t.name.value;if(!n[u]&&!i[u]){var l;const n=null!==(l=c[2])&&void 0!==l?l:o,i=null!=n&&("kind"in(p=n)&&(function(e){return e.kind===se.SCHEMA_DEFINITION||ui(e)||e.kind===se.DIRECTIVE_DEFINITION}(p)||function(e){return e.kind===se.SCHEMA_EXTENSION||li(e)}(p)));if(i&&di.includes(u))return;const s=We(u,i?di.concat(r):r);e.reportError(new z(`Unknown type "${u}".`+Ge(s),{nodes:t}))}var p}}},function(e){return{InlineFragment(t){const n=t.typeCondition;if(n){const t=ri(e.getSchema(),n);if(t&&!xt(t)){const t=ct(n);e.reportError(new z(`Fragment cannot condition on non composite type "${t}".`,{nodes:n}))}}},FragmentDefinition(t){const n=ri(e.getSchema(),t.typeCondition);if(n&&!xt(n)){const n=ct(t.typeCondition);e.reportError(new z(`Fragment "${t.name.value}" cannot condition on non composite type "${n}".`,{nodes:t.typeCondition}))}}}},function(e){return{VariableDefinition(t){const n=ri(e.getSchema(),t.type);if(void 0!==n&&!wt(n)){const n=t.variable.name.value,i=ct(t.type);e.reportError(new z(`Variable "$${n}" cannot be non-input type "${i}".`,{nodes:t.type}))}}}},function(e){return{Field(t){const n=e.getType(),i=t.selectionSet;if(n)if(Dt(Vt(n))){if(i){const r=t.name.value,s=$e(n);e.reportError(new z(`Field "${r}" must not have a selection since type "${s}" has no subfields.`,{nodes:i}))}}else if(!i){const i=t.name.value,r=$e(n);e.reportError(new z(`Field "${i}" of type "${r}" must have a selection of subfields. Did you mean "${i} { ... }"?`,{nodes:t}))}}}},function(e){return{Field(t){const n=e.getParentType();if(n){if(!e.getFieldDef()){const i=e.getSchema(),r=t.name.value;let s=Ge("to use an inline fragment on",function(e,t,n){if(!kt(t))return[];const i=new Set,r=Object.create(null);for(const o of e.getPossibleTypes(t))if(o.getFields()[n]){i.add(o),r[o.name]=1;for(const e of o.getInterfaces()){var s;e.getFields()[n]&&(i.add(e),r[e.name]=(null!==(s=r[e.name])&&void 0!==s?s:0)+1)}}return[...i].sort(((t,n)=>{const i=r[n.name]-r[t.name];return 0!==i?i:gt(t)&&e.isSubType(t,n)?-1:gt(n)&&e.isSubType(n,t)?1:Ke(t.name,n.name)})).map((e=>e.name))}(i,n,r));""===s&&(s=Ge(function(e,t){if(Nt(e)||gt(e)){return We(t,Object.keys(e.getFields()))}return[]}(n,r))),e.reportError(new z(`Cannot query field "${r}" on type "${n.name}".`+s,{nodes:t}))}}}}},function(e){const t=Object.create(null);return{OperationDefinition:()=>!1,FragmentDefinition(n){const i=n.name.value;return t[i]?e.reportError(new z(`There can be only one fragment named "${i}".`,{nodes:[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 z(`Unknown fragment "${n}".`,{nodes:t.name}))}}},function(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 z(`Fragment "${n}" is never used.`,{nodes:t}))}}}}},function(e){return{InlineFragment(t){const n=e.getType(),i=e.getParentType();if(xt(n)&&xt(i)&&!on(e.getSchema(),n,i)){const r=$e(i),s=$e(n);e.reportError(new z(`Fragment cannot be spread here as objects of type "${r}" can never be of type "${s}".`,{nodes:t}))}},FragmentSpread(t){const n=t.name.value,i=function(e,t){const n=e.getFragment(t);if(n){const t=ri(e.getSchema(),n.typeCondition);if(xt(t))return t}}(e,n),r=e.getParentType();if(i&&r&&!on(e.getSchema(),i,r)){const s=$e(r),o=$e(i);e.reportError(new z(`Fragment "${n}" cannot be spread here as objects of type "${s}" can never be of type "${o}".`,{nodes:t}))}}}},function(e){const t=Object.create(null),n=[],i=Object.create(null);return{OperationDefinition:()=>!1,FragmentDefinition:e=>(r(e),!1)};function r(s){if(t[s.name.value])return;const o=s.name.value;t[o]=!0;const a=e.getFragmentSpreads(s.selectionSet);if(0!==a.length){i[o]=n.length;for(const t of a){const s=t.name.value,o=i[s];if(n.push(t),void 0===o){const t=e.getFragment(s);t&&r(t)}else{const t=n.slice(o),i=t.slice(0,-1).map((e=>'"'+e.name.value+'"')).join(", ");e.reportError(new z(`Cannot spread fragment "${s}" within itself`+(""!==i?` via ${i}.`:"."),{nodes:t}))}n.pop()}i[o]=void 0}}},function(e){return{OperationDefinition(t){var n;const i=Gi(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 z(`There can be only one variable named "$${t}".`,{nodes: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 z(n.name?`Variable "$${i}" is not defined by operation "${n.name.value}".`:`Variable "$${i}" is not defined.`,{nodes:[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 z(n.name?`Variable "$${t}" is never used in operation "${n.name.value}".`:`Variable "$${t}" is never used.`,{nodes:r}))}}},VariableDefinition(e){t.push(e)}}},function(e){const t=Object.create(null),n=e.getSchema(),i=n?n.getDirectives():In;for(const e of i)t[e.name]=e.locations;const r=e.getDocument().definitions;for(const e of r)e.kind===se.DIRECTIVE_DEFINITION&&(t[e.name.value]=e.locations.map((e=>e.value)));return{Directive(n,i,r,s,o){const a=n.name.value,c=t[a];if(!c)return void e.reportError(new z(`Unknown directive "@${a}".`,{nodes:n}));const u=function(e){const t=e[e.length-1];switch("kind"in t||J(!1),t.kind){case se.OPERATION_DEFINITION:return function(e){switch(e){case ie.QUERY:return re.QUERY;case ie.MUTATION:return re.MUTATION;case ie.SUBSCRIPTION:return re.SUBSCRIPTION}}(t.operation);case se.FIELD:return re.FIELD;case se.FRAGMENT_SPREAD:return re.FRAGMENT_SPREAD;case se.INLINE_FRAGMENT:return re.INLINE_FRAGMENT;case se.FRAGMENT_DEFINITION:return re.FRAGMENT_DEFINITION;case se.VARIABLE_DEFINITION:return re.VARIABLE_DEFINITION;case se.SCHEMA_DEFINITION:case se.SCHEMA_EXTENSION:return re.SCHEMA;case se.SCALAR_TYPE_DEFINITION:case se.SCALAR_TYPE_EXTENSION:return re.SCALAR;case se.OBJECT_TYPE_DEFINITION:case se.OBJECT_TYPE_EXTENSION:return re.OBJECT;case se.FIELD_DEFINITION:return re.FIELD_DEFINITION;case se.INTERFACE_TYPE_DEFINITION:case se.INTERFACE_TYPE_EXTENSION:return re.INTERFACE;case se.UNION_TYPE_DEFINITION:case se.UNION_TYPE_EXTENSION:return re.UNION;case se.ENUM_TYPE_DEFINITION:case se.ENUM_TYPE_EXTENSION:return re.ENUM;case se.ENUM_VALUE_DEFINITION:return re.ENUM_VALUE;case se.INPUT_OBJECT_TYPE_DEFINITION:case se.INPUT_OBJECT_TYPE_EXTENSION:return re.INPUT_OBJECT;case se.INPUT_VALUE_DEFINITION:{const t=e[e.length-3];return"kind"in t||J(!1),t.kind===se.INPUT_OBJECT_TYPE_DEFINITION?re.INPUT_FIELD_DEFINITION:re.ARGUMENT_DEFINITION}default:J(!1,"Unexpected kind: "+$e(t.kind))}}(o);u&&!c.includes(u)&&e.reportError(new z(`Directive "@${a}" may not be used on ${u}.`,{nodes:n}))}}},function(e){const t=Object.create(null),n=e.getSchema(),i=n?n.getDirectives():In;for(const e of i)t[e.name]=!e.isRepeatable;const r=e.getDocument().definitions;for(const e of r)e.kind===se.DIRECTIVE_DEFINITION&&(t[e.name.value]=!e.repeatable);const s=Object.create(null),o=Object.create(null);return{enter(n){if(!("directives"in n)||!n.directives)return;let i;if(n.kind===se.SCHEMA_DEFINITION||n.kind===se.SCHEMA_EXTENSION)i=s;else if(ui(n)||li(n)){const e=n.name.value;i=o[e],void 0===i&&(o[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 z(`The directive "@${n}" can only be used once at this location.`,{nodes:[i[n],r]})):i[n]=r)}}}},function(e){return{...pi(e),Argument(t){const n=e.getArgument(),i=e.getFieldDef(),r=e.getParentType();if(!n&&i&&r){const n=t.name.value,s=We(n,i.args.map((e=>e.name)));e.reportError(new z(`Unknown argument "${n}" on field "${r.name}.${i.name}".`+Ge(s),{nodes:t}))}}}},function(e){return{Field:t,Directive:t};function t(t){var n;const i=Gi(null!==(n=t.arguments)&&void 0!==n?n:[],(e=>e.name.value));for(const[t,n]of i)n.length>1&&e.reportError(new z(`There can be only one argument named "${t}".`,{nodes:n.map((e=>e.name))}))}},function(e){return{ListValue(t){if(!Ot($t(e.getParentInputType())))return Ji(e,t),!1},ObjectValue(t){const n=Vt(e.getInputType());if(!_t(n))return Ji(e,t),!1;const i=Ye(t.fields,(e=>e.name.value));for(const r of Object.values(n.getFields())){if(!i[r.name]&&nn(r)){const i=$e(r.type);e.reportError(new z(`Field "${n.name}.${r.name}" of required type "${i}" was not provided.`,{nodes:t}))}}},ObjectField(t){const n=Vt(e.getParentInputType());if(!e.getInputType()&&_t(n)){const i=We(t.name.value,Object.keys(n.getFields()));e.reportError(new z(`Field "${t.name.value}" is not defined by type "${n.name}".`+Ge(i),{nodes:t}))}},NullValue(t){const n=e.getInputType();St(n)&&e.reportError(new z(`Expected value of type "${$e(n)}", found ${ct(t)}.`,{nodes:t}))},EnumValue:t=>Ji(e,t),IntValue:t=>Ji(e,t),FloatValue:t=>Ji(e,t),StringValue:t=>Ji(e,t),BooleanValue:t=>Ji(e,t)}},function(e){return{...Oi(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)&&Kt(n)){const r=$e(n.type);e.reportError(new z(`Field "${i.name}" argument "${n.name}" of type "${r}" is required, but it was not provided.`,{nodes: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:s}of i){const i=n.name.value,o=t[i];if(o&&r){const t=e.getSchema(),a=ri(t,o.type);if(a&&!Yi(t,a,o.defaultValue,r,s)){const t=$e(a),s=$e(r);e.reportError(new z(`Variable "$${i}" of type "${t}" used in position expecting type "${s}".`,{nodes:[o,n]}))}}}}},VariableDefinition(e){t[e.variable.name.value]=e}}},function(e){const t=new _i,n=new Map;return{SelectionSet(i){const r=function(e,t,n,i,r){const s=[],[o,a]=gi(e,t,i,r);if(function(e,t,n,i,r){for(const[s,o]of Object.entries(r))if(o.length>1)for(let r=0;r<o.length;r++)for(let a=r+1;a<o.length;a++){const c=Ti(e,n,i,!1,s,o[r],o[a]);c&&t.push(c)}}(e,s,t,n,o),0!==a.length)for(let i=0;i<a.length;i++){mi(e,s,t,n,!1,o,a[i]);for(let r=i+1;r<a.length;r++)yi(e,s,t,n,!1,a[i],a[r])}return s}(e,n,t,e.getParentType(),i);for(const[[t,n],i,s]of r){const r=hi(n);e.reportError(new z(`Fields "${t}" conflict because ${r}. Use different aliases on the fields to fetch both if this was intentional.`,{nodes:i.concat(s)}))}}}},function(e){const t=[];let n=Object.create(null);return{ObjectValue:{enter(){t.push(n),n=Object.create(null)},leave(){const e=t.pop();e||J(!1),n=e}},ObjectField(t){const i=t.name.value;n[i]?e.reportError(new z(`There can be only one input field named "${i}".`,{nodes:[n[i],t.name]})):n[i]=t.name}}}]);class qi{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===se.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===se.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 Ki extends qi{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 si(this._schema);ot(e,ai(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 zi(e,t,n=Qi,i,r=new si(e)){var s;const o=null!==(s=null==i?void 0:i.maxErrors)&&void 0!==s?s:100;t||P(!1,"Must provide document."),Jn(e);const a=Object.freeze({}),c=[],u=new Ki(e,t,r,(e=>{if(c.length>=o)throw c.push(new z("Too many validation errors, error limit reached. Validation aborted.")),a;c.push(e)})),l=function(e){const t=new Array(e.length).fill(null),n=Object.create(null);for(const i of Object.values(se)){let r=!1;const s=new Array(e.length).fill(void 0),o=new Array(e.length).fill(void 0);for(let t=0;t<e.length;++t){const{enter:n,leave:a}=at(e[t],i);r||(r=null!=n||null!=a),s[t]=n,o[t]=a}if(!r)continue;const a={enter(...n){const i=n[0];for(let o=0;o<e.length;o++)if(null===t[o]){var r;const a=null===(r=s[o])||void 0===r?void 0:r.apply(e[o],n);if(!1===a)t[o]=i;else if(a===st)t[o]=st;else if(void 0!==a)return a}},leave(...n){const i=n[0];for(let s=0;s<e.length;s++)if(null===t[s]){var r;const i=null===(r=o[s])||void 0===r?void 0:r.apply(e[s],n);if(i===st)t[s]=st;else if(void 0!==i&&!1!==i)return i}else t[s]===i&&(t[s]=null)}};n[i]=a}return n}(n.map((e=>e(u))));try{ot(t,ai(r,l))}catch(e){if(e!==a)throw e}return c}class Xi extends Error{constructor(e){super("Unexpected error value: "+$e(e)),this.name="NonErrorThrown",this.thrownValue=e}}function Hi(e,t,n){var i;const r=(s=e)instanceof Error?s:new Xi(s);var s,o;return o=r,Array.isArray(o.path)?r:new z(r.message,{nodes:null!==(i=r.nodes)&&void 0!==i?i:t,source:r.source,positions:r.positions,path:n,originalError:r})}const Wi=function(e){let t;return function(n,i,r){void 0===t&&(t=new WeakMap);let s=t.get(n);void 0===s&&(s=new WeakMap,t.set(n,s));let o=s.get(i);void 0===o&&(o=new WeakMap,s.set(i,o));let a=o.get(r);return void 0===a&&(a=e(n,i,r),o.set(r,a)),a}}(((e,t,n)=>function(e,t,n,i,r){const s=new Map,o=new Set;for(const a of r)a.selectionSet&&Mi(e,t,n,i,a.selectionSet,s,o);return s}(e.schema,e.fragments,e.variableValues,t,n)));function Zi(e){arguments.length<2||P(!1,"graphql@16 dropped long-deprecated support for positional arguments, please pass an object instead.");const{schema:t,document:n,variableValues:i,rootValue:r}=e;!function(e,t,n){t||P(!1,"Must provide document."),Jn(e),null==n||G(n)||P(!1,"Variables must be provided as an Object where each property is a variable value. Perhaps look to see if an unparsed JSON string was provided.")}(t,n,i);const s=function(e){var t,n;const{schema:i,document:r,rootValue:s,contextValue:o,variableValues:a,operationName:c,fieldResolver:u,typeResolver:l,subscribeFieldResolver:p}=e;let d;const f=Object.create(null);for(const e of r.definitions)switch(e.kind){case se.OPERATION_DEFINITION:if(null==c){if(void 0!==d)return[new z("Must provide operation name if query contains multiple operations.")];d=e}else(null===(t=e.name)||void 0===t?void 0:t.value)===c&&(d=e);break;case se.FRAGMENT_DEFINITION:f[e.name.value]=e}if(!d)return null!=c?[new z(`Unknown operation named "${c}".`)]:[new z("Must provide an operation.")];const h=null!==(n=d.variableDefinitions)&&void 0!==n?n:[],m=$i(i,h,null!=a?a:{},{maxErrors:50});if(m.errors)return m.errors;return{schema:i,fragments:f,rootValue:s,contextValue:o,operation:d,variableValues:m.coerced,fieldResolver:null!=u?u:ur,typeResolver:null!=l?l:cr,subscribeFieldResolver:null!=p?p:ur,errors:[]}}(e);if(!("schema"in s))return{errors:s};try{const{operation:e}=s,t=function(e,t,n){const i=e.schema.getRootType(t.operation);if(null==i)throw new z(`Schema is not configured to execute ${t.operation} operation.`,{nodes:t});const r=ji(e.schema,e.fragments,e.variableValues,i,t.selectionSet),s=void 0;switch(t.operation){case ie.QUERY:return tr(e,i,n,s,r);case ie.MUTATION:return function(e,t,n,i,r){return function(e,t,n){let i=n;for(const n of e)i=B(i)?i.then((e=>t(e,n))):t(i,n);return i}(r.entries(),((r,[s,o])=>{const a=Ai(i,s,t.name),c=nr(e,t,n,o,a);return void 0===c?r:B(c)?c.then((e=>(r[s]=e,r))):(r[s]=c,r)}),Object.create(null))}(e,i,n,s,r);case ie.SUBSCRIPTION:return tr(e,i,n,s,r)}}(s,e,r);return B(t)?t.then((e=>er(e,s.errors)),(e=>(s.errors.push(e),er(null,s.errors)))):er(t,s.errors)}catch(e){return s.errors.push(e),er(null,s.errors)}}function er(e,t){return 0===t.length?{data:e}:{errors:t,data:e}}function tr(e,t,n,i,r){const s=Object.create(null);let o=!1;for(const[a,c]of r.entries()){const r=nr(e,t,n,c,Ai(i,a,t.name));void 0!==r&&(s[a]=r,B(r)&&(o=!0))}return o?(a=s,Promise.all(Object.values(a)).then((e=>{const t=Object.create(null);for(const[n,i]of Object.keys(a).entries())t[i]=e[n];return t}))):s;var a}function nr(e,t,n,i,r){var s;const o=function(e,t,n){const i=n.name.value;if(i===$n.name&&e.getQueryType()===t)return $n;if(i===Cn.name&&e.getQueryType()===t)return Cn;if(i===Vn.name)return Vn;return t.getFields()[i]}(e.schema,t,i[0]);if(!o)return;const a=o.type,c=null!==(s=o.resolve)&&void 0!==s?s:e.fieldResolver,u=function(e,t,n,i,r){return{fieldName:t.name,fieldNodes:n,returnType:t.type,parentType:i,path:r,schema:e.schema,fragments:e.fragments,rootValue:e.rootValue,operation:e.operation,variableValues:e.variableValues}}(e,o,i,t,r);try{const t=Ci(o,i[0],e.variableValues),s=c(n,t,e.contextValue,u);let l;return l=B(s)?s.then((t=>rr(e,a,i,u,r,t))):rr(e,a,i,u,r,s),B(l)?l.then(void 0,(t=>ir(Hi(t,i,Di(r)),a,e))):l}catch(t){return ir(Hi(t,i,Di(r)),a,e)}}function ir(e,t,n){if(St(t))throw e;return n.errors.push(e),null}function rr(e,t,n,i,r,s){if(s instanceof Error)throw s;if(St(t)){const o=rr(e,t.ofType,n,i,r,s);if(null===o)throw new Error(`Cannot return null for non-nullable field ${i.parentType.name}.${i.fieldName}.`);return o}return null==s?null:Ot(t)?function(e,t,n,i,r,s){if(!bn(s))throw new z(`Expected Iterable, but did not find one for field "${i.parentType.name}.${i.fieldName}".`);const o=t.ofType;let a=!1;const c=Array.from(s,((t,s)=>{const c=Ai(r,s,void 0);try{let r;return r=B(t)?t.then((t=>rr(e,o,n,i,c,t))):rr(e,o,n,i,c,t),B(r)?(a=!0,r.then(void 0,(t=>ir(Hi(t,n,Di(c)),o,e)))):r}catch(t){return ir(Hi(t,n,Di(c)),o,e)}}));return a?Promise.all(c):c}(e,t,n,i,r,s):Dt(t)?function(e,t){const n=e.serialize(t);if(null==n)throw new Error(`Expected \`${$e(e)}.serialize(${$e(t)})\` to return non-nullable value, returned: ${$e(n)}`);return n}(t,s):kt(t)?function(e,t,n,i,r,s){var o;const a=null!==(o=t.resolveType)&&void 0!==o?o:e.typeResolver,c=e.contextValue,u=a(s,c,i,t);if(B(u))return u.then((o=>or(e,sr(o,e,t,n,i,s),n,i,r,s)));return or(e,sr(u,e,t,n,i,s),n,i,r,s)}(e,t,n,i,r,s):Nt(t)?or(e,t,n,i,r,s):void J(!1,"Cannot complete value of unexpected output type: "+$e(t))}function sr(e,t,n,i,r,s){if(null==e)throw new z(`Abstract type "${n.name}" must resolve to an Object type at runtime for field "${r.parentType.name}.${r.fieldName}". Either the "${n.name}" type should provide a "resolveType" function or each possible type should provide an "isTypeOf" function.`,i);if(Nt(e))throw new z("Support for returning GraphQLObjectType from resolveType was removed in graphql-js@16.0.0 please return type name instead.");if("string"!=typeof e)throw new z(`Abstract type "${n.name}" must resolve to an Object type at runtime for field "${r.parentType.name}.${r.fieldName}" with value ${$e(s)}, received "${$e(e)}".`);const o=t.schema.getType(e);if(null==o)throw new z(`Abstract type "${n.name}" was resolved to a type "${e}" that does not exist inside the schema.`,{nodes:i});if(!Nt(o))throw new z(`Abstract type "${n.name}" was resolved to a non-object type "${e}".`,{nodes:i});if(!t.schema.isSubType(n,o))throw new z(`Runtime Object type "${o.name}" is not a possible type for "${n.name}".`,{nodes:i});return o}function or(e,t,n,i,r,s){const o=Wi(e,t,n);if(t.isTypeOf){const a=t.isTypeOf(s,e.contextValue,i);if(B(a))return a.then((i=>{if(!i)throw ar(t,s,n);return tr(e,t,s,r,o)}));if(!a)throw ar(t,s,n)}return tr(e,t,s,r,o)}function ar(e,t,n){return new z(`Expected value of type "${e.name}" but got: ${$e(t)}.`,{nodes:n})}const cr=function(e,t,n,i){if(G(e)&&"string"==typeof e.__typename)return e.__typename;const r=n.schema.getPossibleTypes(i),s=[];for(let i=0;i<r.length;i++){const o=r[i];if(o.isTypeOf){const r=o.isTypeOf(e,t,n);if(B(r))s[i]=r;else if(r)return o.name}}return s.length?Promise.all(s).then((e=>{for(let t=0;t<e.length;t++)if(e[t])return r[t].name})):void 0},ur=function(e,t,n,i){if(G(e)||"function"==typeof e){const r=e[i.fieldName];return"function"==typeof r?e[i.fieldName](t,n,i):r}};const lr={base64Binary:pn,boolean:dn,canonical:pn,code:pn,date:pn,dateTime:pn,decimal:ln,id:fn,instant:pn,integer:ln,markdown:pn,number:ln,positiveInt:ln,string:pn,time:pn,unsignedInt:ln,uri:pn,url:pn,xhtml:pn,"http://hl7.org/fhirpath/System.Boolean":dn,"http://hl7.org/fhirpath/System.Date":pn,"http://hl7.org/fhirpath/System.DateTime":pn,"http://hl7.org/fhirpath/System.Decimal":ln,"http://hl7.org/fhirpath/System.Integer":ln,"http://hl7.org/fhirpath/System.String":pn,"http://hl7.org/fhirpath/System.Time":pn},pr=new c;let dr;async function fr(e,n){const{query:i,operationName:r,variables:s}=e.body;if(!i)return[t("Must provide query.")];let o;try{o=new je(i,c).parseDocument()}catch(e){return[t("GraphQL syntax error.")]}var c;const p=function(){dr||(dr=function(){for(const e of l())lr[e]=mr(e);const e={};for(const t of l()){const n=hr(t);e[t]={type:n,args:{id:{type:new Ft(fn),description:t+" ID"}},resolve:Er},e[t+"List"]={type:new Rt(n),args:yr(t),resolve:Tr}}return new Pn({query:new Pt({name:"QueryType",fields:e})})}());return dr}(),d=zi(p,o,[...Qi,_r]);if(d.length>0)return[(f=d,{resourceType:"OperationOutcome",issue:f.map((e=>({severity:"error",code:"invalid",details:{text:e.message}})))})];var f;const h=function(e){return e.includes("query IntrospectionQuery")||e.includes("__schema")||e.includes("__type")}(i);if(h)return[u];const m=new O((e=>n.readReferences(e)));let y=h&&pr.get(i);return y||(y=await Zi({schema:p,document:o,contextValue:{repo:n,dataLoader:m},operationName:r,variableValues:s})),[a,y]}function hr(e){let t=lr[e];return t||(t=mr(e),lr[e]=t),t}function mr(e){if("ResourceList"===e)return new Xt({name:"ResourceList",types:()=>l().map(hr).filter((e=>!!e)),resolveType:gr});const t=p(e);return new Pt({name:e,description:t.description,fields:()=>function(e){const t={};return function(e,t){const n=p(e),i=n.properties;d(n)&&(t.resourceType={type:new Ft(pn),description:"Resource Type"});"Reference"===e&&(t.resource={description:"Reference",type:hr("ResourceList"),resolve:Nr});for(const n of Object.keys(i)){const i=f(e,n);for(const e of i.type){let r=e.code;"Element"!==r&&"BackboneElement"!==r||(r=h(i.path?.split(".")));const s={description:i.short,type:vr(i,r)};t[n.replace("[x]",m(e.code))]=s}}}(e,t),function(e,t){for(const n of l()){const i=hr(n),r=y(n),s={};let o=0;if(r)for(const[t,n]of Object.entries(r))n.target&&n.target.includes(e)&&(s[Ir(t)]={value:t},o++);if(o>0){const r=new Wt({name:e+"_"+n+"_reference",values:s}),o=yr(n);o._reference={type:new Ft(r),description:`Specify which property to use for reverse lookup for ${n}`},t[n+"List"]={type:new Rt(i),args:o,resolve:Tr}}}}(e,t),t}(e)})}function yr(e){const t={_count:{type:un,description:"Specify how many elements to return from a repeating list."},_offset:{type:un,description:"Specify the offset to start at for a repeating element."},_sort:{type:pn,description:"Specify the sort order by comma-separated list of sort rules in priority order."},_id:{type:pn,description:"Select resources based on the logical id of the resource."},_lastUpdated:{type:pn,description:"Select resources based on the last time they were changed."}},n=y(e);if(n)for(const[e,i]of Object.entries(n))t[Ir(e)]={type:pn,description:i.description};return t}function vr(e,t){const n=hr(t);return"*"===e.max?new Rt(n):n}async function Tr(e,t,n,i){const r=i.fieldName,s=function(e,t,n){let i;if(t){const e=n._reference;delete n._reference,i={code:e,operator:v.EQUALS,value:o(t)}}n=Object.fromEntries(Object.entries(n).map((([e,t])=>[br(e),t])));const r=T(e,n);if(i){const e=r.filters||[];r.filters=[i,...e]}return r}(r.substring(0,r.length-4),e,t),a=await n.repo.search(s);return a.entry?.map((e=>e.resource))}async function Er(t,i,r,s){try{return await r.dataLoader.load({reference:`${s.fieldName}/${i.id}`})}catch(t){throw new e(n(t),t)}}async function Nr(t,i,r){try{return await r.dataLoader.load(t)}catch(t){throw new e(n(t),t)}}function gr(e){const t=e?.resourceType;if(t)return hr(t).name}function Ir(e){return e.replaceAll("-","_")}function br(e){return e.startsWith("_")?e:e.replaceAll("_","-")}const _r=e=>({Field(t,n,i,r){const s=function(e){return e.filter((e=>"selections"===e)).length}(r);if(s>8){const n=t.name.value;e.reportError(new z(`Field "${n}" exceeds max depth (depth=${s}, max=8)`,{nodes:t}))}}});class Or{constructor(){this.routes=[]}add(e,t,n){const i=t.split("/").filter((e=>!!e)).map((e=>e.startsWith(":")?{value:e.substring(1),param:!0}:{value:e}));this.routes.push({method:e,path:i,handler:n})}find(e,t){const n=t.split("/").filter((e=>!!e));let i,r=-1;for(const t of this.routes){const s=Sr(t,e,n);s>r&&(i=t,r=s)}if(i)return{handler:i.handler,params:wr(i,n)}}}function Sr(e,t,n){if(t!==e.method||n.length!==e.path.length)return-1;let i=0;for(let t=0;t<n.length;t++)if(!e.path[t].param){if(n[t]!==e.path[t].value)return-1;i++}return i}function wr(e,t){const n=Object.create(null);for(let i=0;i<t.length;i++)e.path[i].param&&(n[e.path[i].value]=t[i]);return n}async function Ar(e,n,i){const r=e.body;if("Bundle"!==r.resourceType)return[t("Not a bundle")];const s=await async function(e,t,n){return new j(e,t,n).processBatch()}(i,n,r);return[a,s]}async function Dr(e,t){const{resourceType:n}=e.params,i=e.query,r=await t.search(T(n,i));return[a,r]}async function xr(e,t){const{resourceType:n}=e.params,i=e.body,r=await t.search(T(n,i));return[a,r]}async function kr(e,n){const{resourceType:i}=e.params,r=e.body;if(r.resourceType!==i)return[t("Incorrect resource type")];const s=await n.createResource(r);return[N,s]}async function Rr(e,t){const{resourceType:n,id:i}=e.params,r=await t.readResource(n,i);return[a,r]}async function Fr(e,t){const{resourceType:n,id:i}=e.params,r=await t.readHistory(n,i);return[a,r]}async function Lr(e,t){const{resourceType:n,id:i,vid:r}=e.params,s=await t.readVersion(n,i,r);return[a,s]}async function $r(e,n){const{resourceType:i,id:r}=e.params,s=e.body;if(s.resourceType!==i)return[t("Incorrect resource type")];if(s.id!==r)return[t("Incorrect ID")];const o=await n.updateResource(s);return[a,o]}async function Cr(e,t){const{resourceType:n,id:i}=e.params;return await t.deleteResource(n,i),[a]}async function Vr(e,t){const{resourceType:n,id:i}=e.params,r=e.body,s=await t.patchResource(n,i,r);return[a,s]}class Ur{constructor(){this.router=new Or,this.router.add("POST","",Ar),this.router.add("GET",":resourceType",Dr),this.router.add("POST",":resourceType/_search",xr),this.router.add("POST",":resourceType",kr),this.router.add("GET",":resourceType/:id",Rr),this.router.add("GET",":resourceType/:id/_history",Fr),this.router.add("GET",":resourceType/:id/_history/:vid",Lr),this.router.add("PUT",":resourceType/:id",$r),this.router.add("DELETE",":resourceType/:id",Cr),this.router.add("PATCH",":resourceType/:id",Vr),this.router.add("POST","$graphql",fr)}async handleRequest(e,t){const n=this.router.find(e.method,e.pathname);if(!n)return[E];const{handler:i,params:r}=n;return e.params=r,i(e,t,this)}}var jr,Mr;class Pr{constructor(){jr.set(this,void 0),Mr.set(this,void 0),A(this,jr,{},"f"),A(this,Mr,{},"f")}async createResource(e){const t=g(e);t.id||(t.id=Gr()),t.meta||(t.meta={}),t.meta?.versionId||(t.meta.versionId=Gr()),t.meta?.lastUpdated||(t.meta.lastUpdated=(new Date).toISOString());const{resourceType:n,id:i}=t;return n in w(this,jr,"f")||(w(this,jr,"f")[n]={}),n in w(this,Mr,"f")||(w(this,Mr,"f")[n]={}),i in w(this,Mr,"f")[n]||(w(this,Mr,"f")[n][i]=[]),w(this,jr,"f")[n][i]=t,w(this,Mr,"f")[n][i].push(t),g(t)}updateResource(e){const t=g(e);return t.meta&&(t.meta.versionId&&delete t.meta.versionId,t.meta.lastUpdated&&delete t.meta.lastUpdated),this.createResource(t)}async patchResource(i,r,s){const o=await this.readResource(i,r);try{const n=S(o,s).filter(Boolean);if(n.length>0)throw new e(t(n.map((e=>e.message)).join("\n")))}catch(t){throw new e(n(t))}return this.updateResource(o)}async readResource(t,n){const i=w(this,jr,"f")?.[t]?.[n];if(!i)throw new e(E);return g(i)}async readReference(n){const i=n.reference?.split("/");if(!i||2!==i.length)throw new e(t("Invalid reference"));return this.readResource(i[0],i[1])}async readReferences(e){return Promise.all(e.map((e=>this.readReference(e))))}async readHistory(e,t){return await this.readResource(e,t),{resourceType:"Bundle",type:"history",entry:(w(this,Mr,"f")?.[e]?.[t]??[]).reverse().map((e=>({resource:g(e)})))}}async readVersion(t,n,i){await this.readResource(t,n);const r=w(this,Mr,"f")?.[t]?.[n]?.find((e=>e.meta?.versionId===i));if(!r)throw new e(E);return g(r)}async search(e){const{resourceType:t}=e,n=w(this,jr,"f")[t]??{},i=Object.values(n).filter((t=>I(t,e)));let r=i.map((e=>({resource:g(e)})));if(e.sortRules)for(const t of e.sortRules)r=r.sort(((e,n)=>Br(e.resource,n.resource,t)));return void 0!==e.offset&&(r=r.slice(e.offset)),void 0!==e.count&&(r=r.slice(0,e.count)),{resourceType:"Bundle",type:"searchset",entry:r,total:i.length}}async deleteResource(t,n){if(!w(this,jr,"f")?.[t]?.[n])throw new e(E);delete w(this,jr,"f")[t][n]}}jr=new WeakMap,Mr=new WeakMap;const Br=(e,t,n)=>{const i=b.types[e.resourceType]?.searchParams?.[n.code],r=i?.expression;if(!r)return 0;const s=JSON.stringify(_(r,e)),o=JSON.stringify(_(r,t));return s.localeCompare(o)*(n.descending?-1:1)},Gr=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(e=>{const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}));export{Ur as FhirRouter,Pr as MemoryRepository,Or as Router};
|
|
2
2
|
//# sourceMappingURL=index.min.mjs.map
|