UNPKG

@foal/graphiql

Version:

GraphiQL integration for FoalTS

13 lines 978 kB
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["react","react-dom"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).GraphiQL=t(e.React,e.ReactDOM)}(this,(function(e,t){"use strict";function n(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e)for(const n in e)if("default"!==n){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}return t.default=e,Object.freeze(t)}function r(e,t){for(var n=0;n<t.length;n++){const r=t[n];if("string"!=typeof r&&!Array.isArray(r))for(const t in r)if("default"!==t&&!(t in e)){const n=Object.getOwnPropertyDescriptor(r,t);n&&Object.defineProperty(e,t,n.get?n:{enumerable:!0,get:()=>r[t]})}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}const i=n(e),o=n(t);"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function a(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var s={exports:{}},l={},c=e,u=Symbol.for("react.element"),d=Symbol.for("react.fragment"),f=Object.prototype.hasOwnProperty,p=c.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,h={key:!0,ref:!0,__self:!0,__source:!0};function m(e,t,n){var r,i={},o=null,a=null;for(r in void 0!==n&&(o=""+n),void 0!==t.key&&(o=""+t.key),void 0!==t.ref&&(a=t.ref),t)f.call(t,r)&&!h.hasOwnProperty(r)&&(i[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps)void 0===i[r]&&(i[r]=t[r]);return{$$typeof:u,type:e,key:o,ref:a,props:i,_owner:p.current}}l.Fragment=d,l.jsx=m,l.jsxs=m,s.exports=l;var v=s.exports,g=Object.create,y=Object.defineProperty,b=Object.getOwnPropertyDescriptor,E=Object.getOwnPropertyNames,x=Object.getPrototypeOf,w=Object.prototype.hasOwnProperty,T=(e,t,n,r)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let i of E(t))w.call(e,i)||i===n||y(e,i,{get:()=>t[i],enumerable:!(r=b(t,i))||r.enumerable});return e},C={}; /** * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * * @lightSyntaxTransform * @noflow * @nolint * @preventMunge * @preserve-invariant-messages */((e,t)=>{for(var n in t)y(e,n,{get:t[n],enumerable:!0})})(C,{$dispatcherGuard:()=>B,$makeReadOnly:()=>U,$reset:()=>$,$structuralCheck:()=>G,c:()=>R,clearRenderCounterRegistry:()=>q,renderCounterRegistry:()=>H,useRenderCounter:()=>z});var k,S,_,N=(k=C,T(y({},"__esModule",{value:!0}),k)),A=((e,t,n)=>(n=null!=e?g(x(e)):{},T(e&&e.__esModule?n:y(n,"default",{value:e,enumerable:!0}),e)))(e),{useRef:D,useEffect:I,isValidElement:O}=A,L=null!=(S=A.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE)?S:A.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,F=Symbol.for("react.memo_cache_sentinel"),R="function"==typeof(null==(_=A.__COMPILER_RUNTIME)?void 0:_.c)?A.__COMPILER_RUNTIME.c:function(e){return A.useMemo((()=>{const t=new Array(e);for(let n=0;n<e;n++)t[n]=F;return t[F]=!0,t}),[])},M={};["readContext","useCallback","useContext","useEffect","useImperativeHandle","useInsertionEffect","useLayoutEffect","useMemo","useReducer","useRef","useState","useDebugValue","useDeferredValue","useTransition","useMutableSource","useSyncExternalStore","useId","unstable_isNewReconciler","getCacheSignal","getCacheForType","useCacheRefresh"].forEach((e=>{M[e]=()=>{throw new Error(`[React] Unexpected React hook call (${e}) from a React compiled function. Check that all hooks are called directly and named according to convention ('use[A-Z]') `)}}));var P=null;function j(e){return L.ReactCurrentDispatcher.current=e,L.ReactCurrentDispatcher.current}M.useMemoCache=e=>{if(null==P)throw new Error("React Compiler internal invariant violation: unexpected null dispatcher");return P.useMemoCache(e)};var V=[];function B(e){const t=L.ReactCurrentDispatcher.current;if(0===e){if(V.push(t),1===V.length&&(P=t),t===M)throw new Error("[React] Unexpected call to custom hook or component from a React compiled function. Check that (1) all hooks are called directly and named according to convention ('use[A-Z]') and (2) components are returned as JSX instead of being directly invoked.");j(M)}else if(1===e){const e=V.pop();if(null==e)throw new Error("React Compiler internal error: unexpected null in guard stack");0===V.length&&(P=null),j(e)}else if(2===e)V.push(t),j(P);else{if(3!==e)throw new Error("React Compiler internal error: unreachable block"+e);{const e=V.pop();if(null==e)throw new Error("React Compiler internal error: unexpected null in guard stack");j(e)}}}function $(e){for(let t=0;t<e.length;t++)e[t]=F}function U(){throw new Error("TODO: implement $makeReadOnly in react-compiler-runtime")}var H=new Map;function q(){for(const e of H.values())e.forEach((e=>{e.count=0}))}function z(e){const t=D(null);null!=t.current&&(t.current.count+=1),I((()=>{if(null==t.current){const n={count:0};!function(e,t){let n=H.get(e);null==n&&(n=new Set,H.set(e,n)),n.add(t)}(e,n),t.current=n}return()=>{null!==t.current&&function(e,t){const n=H.get(e);null!=n&&n.delete(t)}(e,t.current)}}))}var W=new Set;function G(e,t,n,r,i,o){function a(e,t,a,s){const l=`${r}:${o} [${i}] ${n}${a} changed from ${e} to ${t} at depth ${s}`;W.has(l)||(W.add(l),console.error(l))}!function e(t,n,r,i){if(!(i>2)&&t!==n)if(typeof t!=typeof n)a("type "+typeof t,"type "+typeof n,r,i);else if("object"==typeof t){const o=Array.isArray(t),s=Array.isArray(n);if(null===t&&null!==n)a("null","type "+typeof n,r,i);else if(null===n)a("type "+typeof t,"null",r,i);else if(t instanceof Map)if(n instanceof Map)if(t.size!==n.size)a(`Map instance with size ${t.size}`,`Map instance with size ${n.size}`,r,i);else for(const[l,c]of t)n.has(l)?e(c,n.get(l),`${r}.get(${l})`,i+1):a(`Map instance with key ${l}`,`Map instance without key ${l}`,r,i);else a("Map instance","other value",r,i);else if(n instanceof Map)a("other value","Map instance",r,i);else if(t instanceof Set)if(n instanceof Set)if(t.size!==n.size)a(`Set instance with size ${t.size}`,`Set instance with size ${n.size}`,r,i);else for(const e of n)t.has(e)||a(`Set instance without element ${e}`,`Set instance with element ${e}`,r,i);else a("Set instance","other value",r,i);else if(n instanceof Set)a("other value","Set instance",r,i);else if(o||s)if(o!==s)a("type "+(o?"array":"object"),"type "+(s?"array":"object"),r,i);else if(t.length!==n.length)a(`array with length ${t.length}`,`array with length ${n.length}`,r,i);else for(let a=0;a<t.length;a++)e(t[a],n[a],`${r}[${a}]`,i+1);else if(O(t)||O(n))O(t)!==O(n)?a("type "+(O(t)?"React element":"object"),"type "+(O(n)?"React element":"object"),r,i):t.type!==n.type?a(`React element of type ${t.type}`,`React element of type ${n.type}`,r,i):e(t.props,n.props,`[props of ${r}]`,i+1);else{for(const e in n)e in t||a(`object without key ${e}`,`object with key ${e}`,r,i);for(const o in t)o in n?e(t[o],n[o],`${r}.${o}`,i+1):a(`object with key ${o}`,`object without key ${o}`,r,i)}}else{if("function"==typeof t)return;isNaN(t)||isNaN(n)?isNaN(t)!==isNaN(n)&&a(""+(isNaN(t)?"NaN":"non-NaN value"),""+(isNaN(n)?"NaN":"non-NaN value"),r,i):t!==n&&a(t,n,r,i)}}(e,t,"",0)}function Y(e){var t,n,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(n=Y(e[t]))&&(r&&(r+=" "),r+=n);else for(t in e)e[t]&&(r&&(r+=" "),r+=t);return r}function K(){for(var e,t,n=0,r="";n<arguments.length;)(e=arguments[n++])&&(t=Y(e))&&(r&&(r+=" "),r+=t);return r}const Q=Object.freeze({major:16,minor:9,patch:0,preReleaseTag:null});function X(e,t){if(!Boolean(e))throw new Error(t)}function J(e){return"function"==typeof(null==e?void 0:e.then)}function Z(e){return"object"==typeof e&&null!==e}function ee(e,t){if(!Boolean(e))throw new Error(null!=t?t:"Unexpected invariant triggered.")}const te=/\r\n|[\n\r]/g;function ne(e,t){let n=0,r=1;for(const i of e.body.matchAll(te)){if("number"==typeof i.index||ee(!1),i.index>=t)break;n=i.index+i[0].length,r+=1}return{line:r,column:t+1-n}}function re(e){return ie(e.source,ne(e.source,e.start))}function ie(e,t){const n=e.locationOffset.column-1,r="".padStart(n)+e.body,i=t.line-1,o=e.locationOffset.line-1,a=t.line+o,s=1===t.line?n:0,l=t.column+s,c=`${e.name}:${a}:${l}\n`,u=r.split(/\r\n|[\n\r]/g),d=u[i];if(d.length>120){const e=Math.floor(l/80),t=l%80,n=[];for(let r=0;r<d.length;r+=80)n.push(d.slice(r,r+80));return c+oe([[`${a} |`,n[0]],...n.slice(1,e+1).map((e=>["|",e])),["|","^".padStart(t)],["|",n[e+1]]])}return c+oe([[a-1+" |",u[i-1]],[`${a} |`,d],["|","^".padStart(l)],[`${a+1} |`,u[i+1]]])}function oe(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 ae extends Error{constructor(e,...t){var n,r,i;const{nodes:o,source:a,positions:s,path:l,originalError:c,extensions:u}=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!=l?l:void 0,this.originalError=null!=c?c:void 0,this.nodes=se(Array.isArray(o)?o:o?[o]:void 0);const d=se(null===(n=this.nodes)||void 0===n?void 0:n.map((e=>e.loc)).filter((e=>null!=e)));this.source=null!=a?a:null==d||null===(r=d[0])||void 0===r?void 0:r.source,this.positions=null!=s?s:null==d?void 0:d.map((e=>e.start)),this.locations=s&&a?s.map((e=>ne(a,e))):null==d?void 0:d.map((e=>ne(e.source,e.start)));const f=Z(null==c?void 0:c.extensions)?null==c?void 0:c.extensions:void 0;this.extensions=null!==(i=null!=u?u:f)&&void 0!==i?i: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!=c&&c.stack?Object.defineProperty(this,"stack",{value:c.stack,writable:!0,configurable:!0}):Error.captureStackTrace?Error.captureStackTrace(this,ae):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 t of this.nodes)t.loc&&(e+="\n\n"+re(t.loc));else if(this.source&&this.locations)for(const t of this.locations)e+="\n\n"+ie(this.source,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 se(e){return void 0===e||0===e.length?void 0:e}function le(e,t,n){return new ae(`Syntax Error: ${n}`,{source:e,positions:[t]})}let ce=class{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}}},ue=class{constructor(e,t,n,r,i,o){this.kind=e,this.start=t,this.end=n,this.line=r,this.column=i,this.value=o,this.prev=null,this.next=null}get[Symbol.toStringTag](){return"Token"}toJSON(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}}};const de={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"]},fe=new Set(Object.keys(de));function pe(e){const t=null==e?void 0:e.kind;return"string"==typeof t&&fe.has(t)}var he,me,ve,ge,ye,be,Ee,xe;function we(e){return 9===e||32===e}function Te(e){return e>=48&&e<=57}function Ce(e){return e>=97&&e<=122||e>=65&&e<=90}function ke(e){return Ce(e)||95===e}function Se(e){return Ce(e)||Te(e)||95===e}function _e(e){var t;let n=Number.MAX_SAFE_INTEGER,r=null,i=-1;for(let a=0;a<e.length;++a){var o;const t=e[a],s=Ne(t);s!==t.length&&(r=null!==(o=r)&&void 0!==o?o:a,i=a,0!==a&&s<n&&(n=s))}return e.map(((e,t)=>0===t?e:e.slice(n))).slice(null!==(t=r)&&void 0!==t?t:0,i+1)}function Ne(e){let t=0;for(;t<e.length&&we(e.charCodeAt(t));)++t;return t}function Ae(e){if(""===e)return!0;let t=!0,n=!1,r=!0,i=!1;for(let o=0;o<e.length;++o)switch(e.codePointAt(o)){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 11:case 12:case 14:case 15:case 13:return!1;case 10:if(t&&!i)return!1;i=!0,t=!0,n=!1;break;case 9:case 32:n||(n=t);break;default:r&&(r=n),t=!1}return!t&&(!r||!i)}function De(e,t){const n=e.replace(/"""/g,'\\"""'),r=n.split(/\r\n|[\n\r]/g),i=1===r.length,o=r.length>1&&r.slice(1).every((e=>0===e.length||we(e.charCodeAt(0)))),a=n.endsWith('\\"""'),s=e.endsWith('"')&&!a,l=e.endsWith("\\"),c=s||l,u=!(null!=t&&t.minimize)&&(!i||e.length>70||c||o||a);let d="";const f=i&&we(e.charCodeAt(0));return(u&&!f||o)&&(d+="\n"),d+=n,(u||c)&&(d+="\n"),'"""'+d+'"""'}(me=he||(he={})).QUERY="query",me.MUTATION="mutation",me.SUBSCRIPTION="subscription",(ge=ve||(ve={})).QUERY="QUERY",ge.MUTATION="MUTATION",ge.SUBSCRIPTION="SUBSCRIPTION",ge.FIELD="FIELD",ge.FRAGMENT_DEFINITION="FRAGMENT_DEFINITION",ge.FRAGMENT_SPREAD="FRAGMENT_SPREAD",ge.INLINE_FRAGMENT="INLINE_FRAGMENT",ge.VARIABLE_DEFINITION="VARIABLE_DEFINITION",ge.SCHEMA="SCHEMA",ge.SCALAR="SCALAR",ge.OBJECT="OBJECT",ge.FIELD_DEFINITION="FIELD_DEFINITION",ge.ARGUMENT_DEFINITION="ARGUMENT_DEFINITION",ge.INTERFACE="INTERFACE",ge.UNION="UNION",ge.ENUM="ENUM",ge.ENUM_VALUE="ENUM_VALUE",ge.INPUT_OBJECT="INPUT_OBJECT",ge.INPUT_FIELD_DEFINITION="INPUT_FIELD_DEFINITION",(be=ye||(ye={})).NAME="Name",be.DOCUMENT="Document",be.OPERATION_DEFINITION="OperationDefinition",be.VARIABLE_DEFINITION="VariableDefinition",be.SELECTION_SET="SelectionSet",be.FIELD="Field",be.ARGUMENT="Argument",be.FRAGMENT_SPREAD="FragmentSpread",be.INLINE_FRAGMENT="InlineFragment",be.FRAGMENT_DEFINITION="FragmentDefinition",be.VARIABLE="Variable",be.INT="IntValue",be.FLOAT="FloatValue",be.STRING="StringValue",be.BOOLEAN="BooleanValue",be.NULL="NullValue",be.ENUM="EnumValue",be.LIST="ListValue",be.OBJECT="ObjectValue",be.OBJECT_FIELD="ObjectField",be.DIRECTIVE="Directive",be.NAMED_TYPE="NamedType",be.LIST_TYPE="ListType",be.NON_NULL_TYPE="NonNullType",be.SCHEMA_DEFINITION="SchemaDefinition",be.OPERATION_TYPE_DEFINITION="OperationTypeDefinition",be.SCALAR_TYPE_DEFINITION="ScalarTypeDefinition",be.OBJECT_TYPE_DEFINITION="ObjectTypeDefinition",be.FIELD_DEFINITION="FieldDefinition",be.INPUT_VALUE_DEFINITION="InputValueDefinition",be.INTERFACE_TYPE_DEFINITION="InterfaceTypeDefinition",be.UNION_TYPE_DEFINITION="UnionTypeDefinition",be.ENUM_TYPE_DEFINITION="EnumTypeDefinition",be.ENUM_VALUE_DEFINITION="EnumValueDefinition",be.INPUT_OBJECT_TYPE_DEFINITION="InputObjectTypeDefinition",be.DIRECTIVE_DEFINITION="DirectiveDefinition",be.SCHEMA_EXTENSION="SchemaExtension",be.SCALAR_TYPE_EXTENSION="ScalarTypeExtension",be.OBJECT_TYPE_EXTENSION="ObjectTypeExtension",be.INTERFACE_TYPE_EXTENSION="InterfaceTypeExtension",be.UNION_TYPE_EXTENSION="UnionTypeExtension",be.ENUM_TYPE_EXTENSION="EnumTypeExtension",be.INPUT_OBJECT_TYPE_EXTENSION="InputObjectTypeExtension",(xe=Ee||(Ee={})).SOF="<SOF>",xe.EOF="<EOF>",xe.BANG="!",xe.DOLLAR="$",xe.AMP="&",xe.PAREN_L="(",xe.PAREN_R=")",xe.SPREAD="...",xe.COLON=":",xe.EQUALS="=",xe.AT="@",xe.BRACKET_L="[",xe.BRACKET_R="]",xe.BRACE_L="{",xe.PIPE="|",xe.BRACE_R="}",xe.NAME="Name",xe.INT="Int",xe.FLOAT="Float",xe.STRING="String",xe.BLOCK_STRING="BlockString",xe.COMMENT="Comment";class Ie{constructor(e){const t=new ue(Ee.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!==Ee.EOF)do{if(e.next)e=e.next;else{const t=Ve(this,e.end);e.next=t,t.prev=e,e=t}}while(e.kind===Ee.COMMENT);return e}}function Oe(e){return e===Ee.BANG||e===Ee.DOLLAR||e===Ee.AMP||e===Ee.PAREN_L||e===Ee.PAREN_R||e===Ee.SPREAD||e===Ee.COLON||e===Ee.EQUALS||e===Ee.AT||e===Ee.BRACKET_L||e===Ee.BRACKET_R||e===Ee.BRACE_L||e===Ee.PIPE||e===Ee.BRACE_R}function Le(e){return e>=0&&e<=55295||e>=57344&&e<=1114111}function Fe(e,t){return Re(e.charCodeAt(t))&&Me(e.charCodeAt(t+1))}function Re(e){return e>=55296&&e<=56319}function Me(e){return e>=56320&&e<=57343}function Pe(e,t){const n=e.source.body.codePointAt(t);if(void 0===n)return Ee.EOF;if(n>=32&&n<=126){const e=String.fromCodePoint(n);return'"'===e?"'\"'":`"${e}"`}return"U+"+n.toString(16).toUpperCase().padStart(4,"0")}function je(e,t,n,r,i){const o=e.line,a=1+n-e.lineStart;return new ue(t,n,r,o,a,i)}function Ve(e,t){const n=e.source.body,r=n.length;let i=t;for(;i<r;){const t=n.charCodeAt(i);switch(t){case 65279:case 9:case 32:case 44:++i;continue;case 10:++i,++e.line,e.lineStart=i;continue;case 13:10===n.charCodeAt(i+1)?i+=2:++i,++e.line,e.lineStart=i;continue;case 35:return Be(e,i);case 33:return je(e,Ee.BANG,i,i+1);case 36:return je(e,Ee.DOLLAR,i,i+1);case 38:return je(e,Ee.AMP,i,i+1);case 40:return je(e,Ee.PAREN_L,i,i+1);case 41:return je(e,Ee.PAREN_R,i,i+1);case 46:if(46===n.charCodeAt(i+1)&&46===n.charCodeAt(i+2))return je(e,Ee.SPREAD,i,i+3);break;case 58:return je(e,Ee.COLON,i,i+1);case 61:return je(e,Ee.EQUALS,i,i+1);case 64:return je(e,Ee.AT,i,i+1);case 91:return je(e,Ee.BRACKET_L,i,i+1);case 93:return je(e,Ee.BRACKET_R,i,i+1);case 123:return je(e,Ee.BRACE_L,i,i+1);case 124:return je(e,Ee.PIPE,i,i+1);case 125:return je(e,Ee.BRACE_R,i,i+1);case 34:return 34===n.charCodeAt(i+1)&&34===n.charCodeAt(i+2)?Ke(e,i):He(e,i)}if(Te(t)||45===t)return $e(e,i,t);if(ke(t))return Qe(e,i);throw le(e.source,i,39===t?"Unexpected single quote character ('), did you mean to use a double quote (\")?":Le(t)||Fe(n,i)?`Unexpected character: ${Pe(e,i)}.`:`Invalid character: ${Pe(e,i)}.`)}return je(e,Ee.EOF,r,r)}function Be(e,t){const n=e.source.body,r=n.length;let i=t+1;for(;i<r;){const e=n.charCodeAt(i);if(10===e||13===e)break;if(Le(e))++i;else{if(!Fe(n,i))break;i+=2}}return je(e,Ee.COMMENT,t,i,n.slice(t+1,i))}function $e(e,t,n){const r=e.source.body;let i=t,o=n,a=!1;if(45===o&&(o=r.charCodeAt(++i)),48===o){if(o=r.charCodeAt(++i),Te(o))throw le(e.source,i,`Invalid number, unexpected digit after 0: ${Pe(e,i)}.`)}else i=Ue(e,i,o),o=r.charCodeAt(i);if(46===o&&(a=!0,o=r.charCodeAt(++i),i=Ue(e,i,o),o=r.charCodeAt(i)),69!==o&&101!==o||(a=!0,o=r.charCodeAt(++i),43!==o&&45!==o||(o=r.charCodeAt(++i)),i=Ue(e,i,o),o=r.charCodeAt(i)),46===o||ke(o))throw le(e.source,i,`Invalid number, expected digit but got: ${Pe(e,i)}.`);return je(e,a?Ee.FLOAT:Ee.INT,t,i,r.slice(t,i))}function Ue(e,t,n){if(!Te(n))throw le(e.source,t,`Invalid number, expected digit but got: ${Pe(e,t)}.`);const r=e.source.body;let i=t+1;for(;Te(r.charCodeAt(i));)++i;return i}function He(e,t){const n=e.source.body,r=n.length;let i=t+1,o=i,a="";for(;i<r;){const r=n.charCodeAt(i);if(34===r)return a+=n.slice(o,i),je(e,Ee.STRING,t,i+1,a);if(92!==r){if(10===r||13===r)break;if(Le(r))++i;else{if(!Fe(n,i))throw le(e.source,i,`Invalid character within String: ${Pe(e,i)}.`);i+=2}}else{a+=n.slice(o,i);const t=117===n.charCodeAt(i+1)?123===n.charCodeAt(i+2)?qe(e,i):ze(e,i):Ye(e,i);a+=t.value,i+=t.size,o=i}}throw le(e.source,i,"Unterminated string.")}function qe(e,t){const n=e.source.body;let r=0,i=3;for(;i<12;){const e=n.charCodeAt(t+i++);if(125===e){if(i<5||!Le(r))break;return{value:String.fromCodePoint(r),size:i}}if(r=r<<4|Ge(e),r<0)break}throw le(e.source,t,`Invalid Unicode escape sequence: "${n.slice(t,t+i)}".`)}function ze(e,t){const n=e.source.body,r=We(n,t+2);if(Le(r))return{value:String.fromCodePoint(r),size:6};if(Re(r)&&92===n.charCodeAt(t+6)&&117===n.charCodeAt(t+7)){const e=We(n,t+8);if(Me(e))return{value:String.fromCodePoint(r,e),size:12}}throw le(e.source,t,`Invalid Unicode escape sequence: "${n.slice(t,t+6)}".`)}function We(e,t){return Ge(e.charCodeAt(t))<<12|Ge(e.charCodeAt(t+1))<<8|Ge(e.charCodeAt(t+2))<<4|Ge(e.charCodeAt(t+3))}function Ge(e){return e>=48&&e<=57?e-48:e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:-1}function Ye(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 le(e.source,t,`Invalid character escape sequence: "${n.slice(t,t+2)}".`)}function Ke(e,t){const n=e.source.body,r=n.length;let i=e.lineStart,o=t+3,a=o,s="";const l=[];for(;o<r;){const r=n.charCodeAt(o);if(34===r&&34===n.charCodeAt(o+1)&&34===n.charCodeAt(o+2)){s+=n.slice(a,o),l.push(s);const r=je(e,Ee.BLOCK_STRING,t,o+3,_e(l).join("\n"));return e.line+=l.length-1,e.lineStart=i,r}if(92!==r||34!==n.charCodeAt(o+1)||34!==n.charCodeAt(o+2)||34!==n.charCodeAt(o+3))if(10!==r&&13!==r)if(Le(r))++o;else{if(!Fe(n,o))throw le(e.source,o,`Invalid character within String: ${Pe(e,o)}.`);o+=2}else s+=n.slice(a,o),l.push(s),13===r&&10===n.charCodeAt(o+1)?o+=2:++o,s="",a=o,i=o;else s+=n.slice(a,o),a=o+1,o+=4}throw le(e.source,o,"Unterminated string.")}function Qe(e,t){const n=e.source.body,r=n.length;let i=t+1;for(;i<r;){if(!Se(n.charCodeAt(i)))break;++i}return je(e,Ee.NAME,t,i,n.slice(t,i))}const Xe=10,Je=2;function Ze(e){return et(e,[])}function et(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:et(t,n)}else if(Array.isArray(e))return function(e,t){if(0===e.length)return"[]";if(t.length>Je)return"[Array]";const n=Math.min(Xe,e.length),r=e.length-n,i=[];for(let o=0;o<n;++o)i.push(et(e[o],t));1===r?i.push("... 1 more item"):r>1&&i.push(`... ${r} more items`);return"["+i.join(", ")+"]"}(e,n);return function(e,t){const n=Object.entries(e);if(0===n.length)return"{}";if(t.length>Je)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 r=n.map((([e,n])=>e+": "+et(n,t)));return"{ "+r.join(", ")+" }"}(e,n)}(e,t);default:return String(e)}}const tt=function(e,t){return e instanceof t};class nt{constructor(e,t="GraphQL request",n={line:1,column:1}){"string"==typeof e||X(!1,`Body must be a string. Received: ${Ze(e)}.`),this.body=e,this.name=t,this.locationOffset=n,this.locationOffset.line>0||X(!1,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||X(!1,"column in locationOffset is 1-indexed and must be positive.")}get[Symbol.toStringTag](){return"Source"}}function rt(e){return tt(e,nt)}function it(e,t){return new at(e,t).parseDocument()}function ot(e,t){const n=new at(e,t);n.expectToken(Ee.SOF);const r=n.parseValueLiteral(!1);return n.expectToken(Ee.EOF),r}class at{constructor(e,t={}){const n=rt(e)?e:new nt(e);this._lexer=new Ie(n),this._options=t,this._tokenCounter=0}parseName(){const e=this.expectToken(Ee.NAME);return this.node(e,{kind:ye.NAME,value:e.value})}parseDocument(){return this.node(this._lexer.token,{kind:ye.DOCUMENT,definitions:this.many(Ee.SOF,this.parseDefinition,Ee.EOF)})}parseDefinition(){if(this.peek(Ee.BRACE_L))return this.parseOperationDefinition();const e=this.peekDescription(),t=e?this._lexer.lookahead():this._lexer.token;if(t.kind===Ee.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 le(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(Ee.BRACE_L))return this.node(e,{kind:ye.OPERATION_DEFINITION,operation:he.QUERY,name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet()});const t=this.parseOperationType();let n;return this.peek(Ee.NAME)&&(n=this.parseName()),this.node(e,{kind:ye.OPERATION_DEFINITION,operation:t,name:n,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseOperationType(){const e=this.expectToken(Ee.NAME);switch(e.value){case"query":return he.QUERY;case"mutation":return he.MUTATION;case"subscription":return he.SUBSCRIPTION}throw this.unexpected(e)}parseVariableDefinitions(){return this.optionalMany(Ee.PAREN_L,this.parseVariableDefinition,Ee.PAREN_R)}parseVariableDefinition(){return this.node(this._lexer.token,{kind:ye.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(Ee.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(Ee.EQUALS)?this.parseConstValueLiteral():void 0,directives:this.parseConstDirectives()})}parseVariable(){const e=this._lexer.token;return this.expectToken(Ee.DOLLAR),this.node(e,{kind:ye.VARIABLE,name:this.parseName()})}parseSelectionSet(){return this.node(this._lexer.token,{kind:ye.SELECTION_SET,selections:this.many(Ee.BRACE_L,this.parseSelection,Ee.BRACE_R)})}parseSelection(){return this.peek(Ee.SPREAD)?this.parseFragment():this.parseField()}parseField(){const e=this._lexer.token,t=this.parseName();let n,r;return this.expectOptionalToken(Ee.COLON)?(n=t,r=this.parseName()):r=t,this.node(e,{kind:ye.FIELD,alias:n,name:r,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(Ee.BRACE_L)?this.parseSelectionSet():void 0})}parseArguments(e){const t=e?this.parseConstArgument:this.parseArgument;return this.optionalMany(Ee.PAREN_L,t,Ee.PAREN_R)}parseArgument(e=!1){const t=this._lexer.token,n=this.parseName();return this.expectToken(Ee.COLON),this.node(t,{kind:ye.ARGUMENT,name:n,value:this.parseValueLiteral(e)})}parseConstArgument(){return this.parseArgument(!0)}parseFragment(){const e=this._lexer.token;this.expectToken(Ee.SPREAD);const t=this.expectOptionalKeyword("on");return!t&&this.peek(Ee.NAME)?this.node(e,{kind:ye.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1)}):this.node(e,{kind:ye.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:ye.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:ye.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 Ee.BRACKET_L:return this.parseList(e);case Ee.BRACE_L:return this.parseObject(e);case Ee.INT:return this.advanceLexer(),this.node(t,{kind:ye.INT,value:t.value});case Ee.FLOAT:return this.advanceLexer(),this.node(t,{kind:ye.FLOAT,value:t.value});case Ee.STRING:case Ee.BLOCK_STRING:return this.parseStringLiteral();case Ee.NAME:switch(this.advanceLexer(),t.value){case"true":return this.node(t,{kind:ye.BOOLEAN,value:!0});case"false":return this.node(t,{kind:ye.BOOLEAN,value:!1});case"null":return this.node(t,{kind:ye.NULL});default:return this.node(t,{kind:ye.ENUM,value:t.value})}case Ee.DOLLAR:if(e){if(this.expectToken(Ee.DOLLAR),this._lexer.token.kind===Ee.NAME){const e=this._lexer.token.value;throw le(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:ye.STRING,value:e.value,block:e.kind===Ee.BLOCK_STRING})}parseList(e){return this.node(this._lexer.token,{kind:ye.LIST,values:this.any(Ee.BRACKET_L,(()=>this.parseValueLiteral(e)),Ee.BRACKET_R)})}parseObject(e){return this.node(this._lexer.token,{kind:ye.OBJECT,fields:this.any(Ee.BRACE_L,(()=>this.parseObjectField(e)),Ee.BRACE_R)})}parseObjectField(e){const t=this._lexer.token,n=this.parseName();return this.expectToken(Ee.COLON),this.node(t,{kind:ye.OBJECT_FIELD,name:n,value:this.parseValueLiteral(e)})}parseDirectives(e){const t=[];for(;this.peek(Ee.AT);)t.push(this.parseDirective(e));return t}parseConstDirectives(){return this.parseDirectives(!0)}parseDirective(e){const t=this._lexer.token;return this.expectToken(Ee.AT),this.node(t,{kind:ye.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(e)})}parseTypeReference(){const e=this._lexer.token;let t;if(this.expectOptionalToken(Ee.BRACKET_L)){const n=this.parseTypeReference();this.expectToken(Ee.BRACKET_R),t=this.node(e,{kind:ye.LIST_TYPE,type:n})}else t=this.parseNamedType();return this.expectOptionalToken(Ee.BANG)?this.node(e,{kind:ye.NON_NULL_TYPE,type:t}):t}parseNamedType(){return this.node(this._lexer.token,{kind:ye.NAMED_TYPE,name:this.parseName()})}peekDescription(){return this.peek(Ee.STRING)||this.peek(Ee.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(),r=this.many(Ee.BRACE_L,this.parseOperationTypeDefinition,Ee.BRACE_R);return this.node(e,{kind:ye.SCHEMA_DEFINITION,description:t,directives:n,operationTypes:r})}parseOperationTypeDefinition(){const e=this._lexer.token,t=this.parseOperationType();this.expectToken(Ee.COLON);const n=this.parseNamedType();return this.node(e,{kind:ye.OPERATION_TYPE_DEFINITION,operation:t,type:n})}parseScalarTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("scalar");const n=this.parseName(),r=this.parseConstDirectives();return this.node(e,{kind:ye.SCALAR_TYPE_DEFINITION,description:t,name:n,directives:r})}parseObjectTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("type");const n=this.parseName(),r=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),o=this.parseFieldsDefinition();return this.node(e,{kind:ye.OBJECT_TYPE_DEFINITION,description:t,name:n,interfaces:r,directives:i,fields:o})}parseImplementsInterfaces(){return this.expectOptionalKeyword("implements")?this.delimitedMany(Ee.AMP,this.parseNamedType):[]}parseFieldsDefinition(){return this.optionalMany(Ee.BRACE_L,this.parseFieldDefinition,Ee.BRACE_R)}parseFieldDefinition(){const e=this._lexer.token,t=this.parseDescription(),n=this.parseName(),r=this.parseArgumentDefs();this.expectToken(Ee.COLON);const i=this.parseTypeReference(),o=this.parseConstDirectives();return this.node(e,{kind:ye.FIELD_DEFINITION,description:t,name:n,arguments:r,type:i,directives:o})}parseArgumentDefs(){return this.optionalMany(Ee.PAREN_L,this.parseInputValueDef,Ee.PAREN_R)}parseInputValueDef(){const e=this._lexer.token,t=this.parseDescription(),n=this.parseName();this.expectToken(Ee.COLON);const r=this.parseTypeReference();let i;this.expectOptionalToken(Ee.EQUALS)&&(i=this.parseConstValueLiteral());const o=this.parseConstDirectives();return this.node(e,{kind:ye.INPUT_VALUE_DEFINITION,description:t,name:n,type:r,defaultValue:i,directives:o})}parseInterfaceTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("interface");const n=this.parseName(),r=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),o=this.parseFieldsDefinition();return this.node(e,{kind:ye.INTERFACE_TYPE_DEFINITION,description:t,name:n,interfaces:r,directives:i,fields:o})}parseUnionTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("union");const n=this.parseName(),r=this.parseConstDirectives(),i=this.parseUnionMemberTypes();return this.node(e,{kind:ye.UNION_TYPE_DEFINITION,description:t,name:n,directives:r,types:i})}parseUnionMemberTypes(){return this.expectOptionalToken(Ee.EQUALS)?this.delimitedMany(Ee.PIPE,this.parseNamedType):[]}parseEnumTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("enum");const n=this.parseName(),r=this.parseConstDirectives(),i=this.parseEnumValuesDefinition();return this.node(e,{kind:ye.ENUM_TYPE_DEFINITION,description:t,name:n,directives:r,values:i})}parseEnumValuesDefinition(){return this.optionalMany(Ee.BRACE_L,this.parseEnumValueDefinition,Ee.BRACE_R)}parseEnumValueDefinition(){const e=this._lexer.token,t=this.parseDescription(),n=this.parseEnumValueName(),r=this.parseConstDirectives();return this.node(e,{kind:ye.ENUM_VALUE_DEFINITION,description:t,name:n,directives:r})}parseEnumValueName(){if("true"===this._lexer.token.value||"false"===this._lexer.token.value||"null"===this._lexer.token.value)throw le(this._lexer.source,this._lexer.token.start,`${st(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(),r=this.parseConstDirectives(),i=this.parseInputFieldsDefinition();return this.node(e,{kind:ye.INPUT_OBJECT_TYPE_DEFINITION,description:t,name:n,directives:r,fields:i})}parseInputFieldsDefinition(){return this.optionalMany(Ee.BRACE_L,this.parseInputValueDef,Ee.BRACE_R)}parseTypeSystemExtension(){const e=this._lexer.lookahead();if(e.kind===Ee.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(Ee.BRACE_L,this.parseOperationTypeDefinition,Ee.BRACE_R);if(0===t.length&&0===n.length)throw this.unexpected();return this.node(e,{kind:ye.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:ye.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(),r=this.parseConstDirectives(),i=this.parseFieldsDefinition();if(0===n.length&&0===r.length&&0===i.length)throw this.unexpected();return this.node(e,{kind:ye.OBJECT_TYPE_EXTENSION,name:t,interfaces:n,directives:r,fields:i})}parseInterfaceTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");const t=this.parseName(),n=this.parseImplementsInterfaces(),r=this.parseConstDirectives(),i=this.parseFieldsDefinition();if(0===n.length&&0===r.length&&0===i.length)throw this.unexpected();return this.node(e,{kind:ye.INTERFACE_TYPE_EXTENSION,name:t,interfaces:n,directives:r,fields:i})}parseUnionTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");const t=this.parseName(),n=this.parseConstDirectives(),r=this.parseUnionMemberTypes();if(0===n.length&&0===r.length)throw this.unexpected();return this.node(e,{kind:ye.UNION_TYPE_EXTENSION,name:t,directives:n,types:r})}parseEnumTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");const t=this.parseName(),n=this.parseConstDirectives(),r=this.parseEnumValuesDefinition();if(0===n.length&&0===r.length)throw this.unexpected();return this.node(e,{kind:ye.ENUM_TYPE_EXTENSION,name:t,directives:n,values:r})}parseInputObjectTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");const t=this.parseName(),n=this.parseConstDirectives(),r=this.parseInputFieldsDefinition();if(0===n.length&&0===r.length)throw this.unexpected();return this.node(e,{kind:ye.INPUT_OBJECT_TYPE_EXTENSION,name:t,directives:n,fields:r})}parseDirectiveDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("directive"),this.expectToken(Ee.AT);const n=this.parseName(),r=this.parseArgumentDefs(),i=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");const o=this.parseDirectiveLocations();return this.node(e,{kind:ye.DIRECTIVE_DEFINITION,description:t,name:n,arguments:r,repeatable:i,locations:o})}parseDirectiveLocations(){return this.delimitedMany(Ee.PIPE,this.parseDirectiveLocation)}parseDirectiveLocation(){const e=this._lexer.token,t=this.parseName();if(Object.prototype.hasOwnProperty.call(ve,t.value))return t;throw this.unexpected(e)}node(e,t){return!0!==this._options.noLocation&&(t.loc=new ce(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 le(this._lexer.source,t.start,`Expected ${lt(e)}, found ${st(t)}.`)}expectOptionalToken(e){return this._lexer.token.kind===e&&(this.advanceLexer(),!0)}expectKeyword(e){const t=this._lexer.token;if(t.kind!==Ee.NAME||t.value!==e)throw le(this._lexer.source,t.start,`Expected "${e}", found ${st(t)}.`);this.advanceLexer()}expectOptionalKeyword(e){const t=this._lexer.token;return t.kind===Ee.NAME&&t.value===e&&(this.advanceLexer(),!0)}unexpected(e){const t=null!=e?e:this._lexer.token;return le(this._lexer.source,t.start,`Unexpected ${st(t)}.`)}any(e,t,n){this.expectToken(e);const r=[];for(;!this.expectOptionalToken(n);)r.push(t.call(this));return r}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 r=[];do{r.push(t.call(this))}while(!this.expectOptionalToken(n));return r}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!==Ee.EOF&&(++this._tokenCounter,this._tokenCounter>e))throw le(this._lexer.source,t.start,`Document contains more that ${e} tokens. Parsing aborted.`)}}function st(e){const t=e.value;return lt(e.kind)+(null!=t?` "${t}"`:"")}function lt(e){return Oe(e)?`"${e}"`:e}const ct=5;function ut(e,t){const[n,r]=t?[e,t]:[void 0,e];let i=" Did you mean ";n&&(i+=n+" ");const o=r.map((e=>`"${e}"`));switch(o.length){case 0:return"";case 1:return i+o[0]+"?";case 2:return i+o[0]+" or "+o[1]+"?"}const a=o.slice(0,ct),s=a.pop();return i+a.join(", ")+", or "+s+"?"}function dt(e){return e}function ft(e,t){const n=Object.create(null);for(const r of e)n[t(r)]=r;return n}function pt(e,t,n){const r=Object.create(null);for(const i of e)r[t(i)]=n(i);return r}function ht(e,t){const n=Object.create(null);for(const r of Object.keys(e))n[r]=t(e[r],r);return n}function mt(e,t){let n=0,r=0;for(;n<e.length&&r<t.length;){let i=e.charCodeAt(n),o=t.charCodeAt(r);if(yt(i)&&yt(o)){let a=0;do{++n,a=10*a+i-vt,i=e.charCodeAt(n)}while(yt(i)&&a>0);let s=0;do{++r,s=10*s+o-vt,o=t.charCodeAt(r)}while(yt(o)&&s>0);if(a<s)return-1;if(a>s)return 1}else{if(i<o)return-1;if(i>o)return 1;++n,++r}}return e.length-t.length}const vt=48,gt=57;function yt(e){return!isNaN(e)&&vt<=e&&e<=gt}function bt(e,t){const n=Object.create(null),r=new Et(e),i=Math.floor(.4*e.length)+1;for(const o of t){const e=r.measure(o,i);void 0!==e&&(n[o]=e)}return Object.keys(n).sort(((e,t)=>{const r=n[e]-n[t];return 0!==r?r:mt(e,t)}))}class Et{constructor(e){this._input=e,this._inputLowerCase=e.toLowerCase(),this._inputArray=xt(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 r=xt(n),i=this._inputArray;if(r.length<i.length){const e=r;r=i,i=e}const o=r.length,a=i.length;if(o-a>t)return;const s=this._rows;for(let c=0;c<=a;c++)s[0][c]=c;for(let c=1;c<=o;c++){const e=s[(c-1)%3],n=s[c%3];let o=n[0]=c;for(let t=1;t<=a;t++){const a=r[c-1]===i[t-1]?0:1;let l=Math.min(e[t]+1,n[t-1]+1,e[t-1]+a);if(c>1&&t>1&&r[c-1]===i[t-2]&&r[c-2]===i[t-1]){const e=s[(c-2)%3][t-2];l=Math.min(l,e+1)}l<o&&(o=l),n[t]=l}if(o>t)return}const l=s[o%3][a];return l<=t?l:void 0}}function xt(e){const t=e.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=e.charCodeAt(r);return n}function wt(e){if(null==e)return Object.create(null);if(null===Object.getPrototypeOf(e))return e;const t=Object.create(null);for(const[n,r]of Object.entries(e))t[n]=r;return t}const Tt=/[\x00-\x1f\x22\x5c\x7f-\x9f]/g;function Ct(e){return kt[e.charCodeAt(0)]}const kt=["\\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 _t(e,t,n=de){const r=new Map;for(const g of Object.values(ye))r.set(g,At(t,g));let i,o,a,s=Array.isArray(e),l=[e],c=-1,u=[],d=e;const f=[],p=[];do{c++;const e=c===l.length,g=e&&0!==u.length;if(e){if(o=0===p.length?void 0:f[f.length-1],d=a,a=p.pop(),g)if(s){d=d.slice();let e=0;for(const[t,n]of u){const r=t-e;null===n?(d.splice(r,1),e++):d[r]=n}}else{d=Object.defineProperties({},Object.getOwnPropertyDescriptors(d));for(const[e,t]of u)d[e]=t}c=i.index,l=i.keys,u=i.edits,s=i.inArray,i=i.prev}else if(a){if(o=s?c:l[c],d=a[o],null==d)continue;f.push(o)}let y;if(!Array.isArray(d)){var h,m;pe(d)||X(!1,`Invalid AST Node: ${Ze(d)}.`);const n=e?null===(h=r.get(d.kind))||void 0===h?void 0:h.leave:null===(m=r.get(d.kind))||void 0===m?void 0:m.enter;if(y=null==n?void 0:n.call(t,d,o,a,f,p),y===St)break;if(!1===y){if(!e){f.pop();continue}}else if(void 0!==y&&(u.push([o,y]),!e)){if(!pe(y)){f.pop();continue}d=y}}var v;if(void 0===y&&g&&u.push([o,d]),e)f.pop();else i={inArray:s,index:c,keys:l,edits:u,prev:i},s=Array.isArray(d),l=s?d:null!==(v=n[d.kind])&&void 0!==v?v:[],c=-1,u=[],a&&p.push(a),a=d}while(void 0!==i);return 0!==u.length?u[u.length-1][1]:e}function Nt(e){const t=new Array(e.length).fill(null),n=Object.create(null);for(const r of Object.values(ye)){let i=!1;const o=new Array(e.length).fill(void 0),a=new Array(e.length).fill(void 0);for(let t=0;t<e.length;++t){const{enter:n,leave:s}=At(e[t],r);i||(i=null!=n||null!=s),o[t]=n,a[t]=s}if(!i)continue;const s={enter(...n){const r=n[0];for(let a=0;a<e.length;a++)if(null===t[a]){var i;const s=null===(i=o[a])||void 0===i?void 0:i.apply(e[a],n);if(!1===s)t[a]=r;else if(s===St)t[a]=St;else if(void 0!==s)return s}},leave(...n){const r=n[0];for(let o=0;o<e.length;o++)if(null===t[o]){var i;const r=null===(i=a[o])||void 0===i?void 0:i.apply(e[o],n);if(r===St)t[o]=St;else if(void 0!==r&&!1!==r)return r}else t[o]===r&&(t[o]=null)}};n[r]=s}return n}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 Dt(e){return _t(e,It)}const It={Name:{leave:e=>e.value},Variable:{leave:e=>"$"+e.name},Document:{leave:e=>Ot(e.definitions,"\n\n")},OperationDefinition:{leave(e){const t=Ft("(",Ot(e.variableDefinitions,", "),")"),n=Ot([e.operation,Ot([e.name,t]),Ot(e.directives," ")]," ");return("query"===n?"":n+" ")+e.selectionSet}},VariableDefinition:{leave:({variable:e,type:t,defaultValue:n,directives:r})=>e+": "+t+Ft(" = ",n)+Ft(" ",Ot(r," "))},SelectionSet:{leave:({selections:e})=>Lt(e)},Field:{leave({alias:e,name:t,arguments:n,directives:r,selectionSet:i}){const o=Ft("",e,": ")+t;let a=o+Ft("(",Ot(n,", "),")");return a.length>80&&(a=o+Ft("(\n",Rt(Ot(n,"\n")),"\n)")),Ot([a,Ot(r," "),i]," ")}},Argument:{leave:({name:e,value:t})=>e+": "+t},FragmentSpread:{leave:({name:e,directives:t})=>"..."+e+Ft(" ",Ot(t," "))},InlineFragment:{leave:({typeCondition:e,directives:t,selectionSet:n})=>Ot(["...",Ft("on ",e),Ot(t," "),n]," ")},FragmentDefinition:{leave:({name:e,typeCondition:t,variableDefinitions:n,directives:r,selectionSet:i})=>`fragment ${e}${Ft("(",Ot(n,", "),")")} on ${t} ${Ft("",Ot(r," ")," ")}`+i},IntValue:{leave:({value:e})=>e},FloatValue:{leave:({value:e})=>e},StringValue:{leave:({value:e,block:t})=>t?De(e):`"${e.replace(Tt,Ct)}"`},BooleanValue:{leave:({value:e})=>e?"true":"false"},NullValue:{leave:()=>"null"},EnumValue:{leave:({value:e})=>e},ListValue:{leave:({values:e})=>"["+Ot(e,", ")+"]"},ObjectValue:{leave:({fields:e})=>"{"+Ot(e,", ")+"}"},ObjectField:{leave:({name:e,value:t})=>e+": "+t},Directive:{leave:({name:e,arguments:t})=>"@"+e+Ft("(",Ot(t,", "),")")},NamedType:{leave:({name:e})=>e},ListType:{leave:({type:e})=>"["+e+"]"},NonNullType:{leave:({type:e})=>e+"!"},SchemaDefinition:{leave:({description:e,directives:t,operationTypes:n})=>Ft("",e,"\n")+Ot(["schema",Ot(t," "),Lt(n)]," ")},OperationTypeDefinition:{leave:({operation:e,type:t})=>e+": "+t},ScalarTypeDefinition:{leave:({description:e,name:t,directives:n})=>Ft("",e,"\n")+Ot(["scalar",t,Ot(n," ")]," ")},ObjectTypeDefinition:{leave:({description:e,name:t,interfaces:n,directives:r,fields:i})=>Ft("",e,"\n")+Ot(["type",t,Ft("implements ",Ot(n," & ")),Ot(r," "),Lt(i)]," ")},FieldDefinition:{leave:({description:e,name:t,arguments:n,type:r,directives:i})=>Ft("",e,"\n")+t+(Mt(n)?Ft("(\n",Rt(Ot(n,"\n")),"\n)"):Ft("(",Ot(n,", "),")"))+": "+r+Ft(" ",Ot(i," "))},InputValueDefinition:{leave:({description:e,name:t,type:n,defaultValue:r,directives:i})=>Ft("",e,"\n")+Ot([t+": "+n,Ft("= ",r),Ot(i," ")]," ")},InterfaceTypeDefinition:{leave:({description:e,name:t,interfaces:n,directives:r,fields:i})=>Ft("",e,"\n")+Ot(["interface",t,Ft("implements ",Ot(n," & ")),Ot(r," "),Lt(i)]," ")},UnionTypeDefinition:{leave:({description:e,name:t,directives:n,types:r})=>Ft("",e,"\n")+Ot(["union",t,Ot(n," "),Ft("= ",Ot(r," | "))]," ")},EnumTypeDefinition:{leave:({description:e,name:t,directives:n,values:r})=>Ft("",e,"\n")+Ot(["enum",t,Ot(n," "),Lt(r)]," ")},EnumValueDefinition:{leave:({description:e,name:t,directives:n})=>Ft("",e,"\n")+Ot([t,Ot(n," ")]," ")},InputObjectTypeDefinition:{leave:({description:e,name:t,directives:n,fields:r})=>Ft("",e,"\n")+Ot(["input",t,Ot(n," "),Lt(r)]," ")},DirectiveDefinition:{leave:({description:e,name:t,arguments:n,repeatable:r,locations:i})=>Ft("",e,"\n")+"directive @"+t+(Mt(n)?Ft("(\n",Rt(Ot(n,"\n")),"\n)"):Ft("(",Ot(n,",