UNPKG

graphiql

Version:
13 lines 1.09 MB
!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);function s(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var a,l,c={exports:{}},u={};var d,f,p=(l||(l=1,c.exports=function(){if(a)return u;a=1;var t=e,n=Symbol.for("react.element"),r=Symbol.for("react.fragment"),i=Object.prototype.hasOwnProperty,o=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function l(e,t,r){var a,l={},c=null,u=null;for(a in void 0!==r&&(c=""+r),void 0!==t.key&&(c=""+t.key),void 0!==t.ref&&(u=t.ref),t)i.call(t,a)&&!s.hasOwnProperty(a)&&(l[a]=t[a]);if(e&&e.defaultProps)for(a in t=e.defaultProps)void 0===l[a]&&(l[a]=t[a]);return{$$typeof:n,type:e,key:c,ref:u,props:l,_owner:o.current}}return u.Fragment=r,u.jsx=l,u.jsxs=l,u}()),c.exports); /** * 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 */var h=function(){if(f)return d;f=1;var t,n=Object.create,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,s=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,l=(e,t,n,s)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let l of o(t))a.call(e,l)||l===n||r(e,l,{get:()=>t[l],enumerable:!(s=i(t,l))||s.enumerable});return e},c={};((e,t)=>{for(var n in t)r(e,n,{get:t[n],enumerable:!0})})(c,{$dispatcherGuard:()=>S,$makeReadOnly:()=>_,$reset:()=>k,$structuralCheck:()=>O,c:()=>E,clearRenderCounterRegistry:()=>D,renderCounterRegistry:()=>N,useRenderCounter:()=>A}),t=c,d=l(r({},"__esModule",{value:!0}),t);var u,p,h=((e,t,i)=>(i=null!=e?n(s(e)):{},l(e&&e.__esModule?i:r(i,"default",{value:e,enumerable:!0}),e)))(e),{useRef:m,useEffect:g,isValidElement:v}=h,y=null!=(u=h.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE)?u:h.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,b=Symbol.for("react.memo_cache_sentinel"),E="function"==typeof(null==(p=h.__COMPILER_RUNTIME)?void 0:p.c)?h.__COMPILER_RUNTIME.c:function(e){return h.useMemo((()=>{const t=new Array(e);for(let n=0;n<e;n++)t[n]=b;return t[b]=!0,t}),[])},x={};["readContext","useCallback","useContext","useEffect","useImperativeHandle","useInsertionEffect","useLayoutEffect","useMemo","useReducer","useRef","useState","useDebugValue","useDeferredValue","useTransition","useMutableSource","useSyncExternalStore","useId","unstable_isNewReconciler","getCacheSignal","getCacheForType","useCacheRefresh"].forEach((e=>{x[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 w=null;function T(e){return y.ReactCurrentDispatcher.current=e,y.ReactCurrentDispatcher.current}x.useMemoCache=e=>{if(null==w)throw new Error("React Compiler internal invariant violation: unexpected null dispatcher");return w.useMemoCache(e)};var C=[];function S(e){const t=y.ReactCurrentDispatcher.current;if(0===e){if(C.push(t),1===C.length&&(w=t),t===x)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.");T(x)}else if(1===e){const e=C.pop();if(null==e)throw new Error("React Compiler internal error: unexpected null in guard stack");0===C.length&&(w=null),T(e)}else if(2===e)C.push(t),T(w);else{if(3!==e)throw new Error("React Compiler internal error: unreachable block"+e);{const e=C.pop();if(null==e)throw new Error("React Compiler internal error: unexpected null in guard stack");T(e)}}}function k(e){for(let t=0;t<e.length;t++)e[t]=b}function _(){throw new Error("TODO: implement $makeReadOnly in react-compiler-runtime")}var N=new Map;function D(){for(const e of N.values())e.forEach((e=>{e.count=0}))}function A(e){const t=m(null);null!=t.current&&(t.current.count+=1),g((()=>{if(null==t.current){const n={count:0};!function(e,t){let n=N.get(e);null==n&&(n=new Set,N.set(e,n)),n.add(t)}(e,n),t.current=n}return()=>{null!==t.current&&function(e,t){const n=N.get(e);null!=n&&n.delete(t)}(e,t.current)}}))}var I=new Set;function O(e,t,n,r,i,o){function s(e,t,s,a){const l=`${r}:${o} [${i}] ${n}${s} changed from ${e} to ${t} at depth ${a}`;I.has(l)||(I.add(l),console.error(l))}!function e(t,n,r,i){if(!(i>2)&&t!==n)if(typeof t!=typeof n)s("type "+typeof t,"type "+typeof n,r,i);else if("object"==typeof t){const o=Array.isArray(t),a=Array.isArray(n);if(null===t&&null!==n)s("null","type "+typeof n,r,i);else if(null===n)s("type "+typeof t,"null",r,i);else if(t instanceof Map)if(n instanceof Map)if(t.size!==n.size)s(`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):s(`Map instance with key ${l}`,`Map instance without key ${l}`,r,i);else s("Map instance","other value",r,i);else if(n instanceof Map)s("other value","Map instance",r,i);else if(t instanceof Set)if(n instanceof Set)if(t.size!==n.size)s(`Set instance with size ${t.size}`,`Set instance with size ${n.size}`,r,i);else for(const e of n)t.has(e)||s(`Set instance without element ${e}`,`Set instance with element ${e}`,r,i);else s("Set instance","other value",r,i);else if(n instanceof Set)s("other value","Set instance",r,i);else if(o||a)if(o!==a)s("type "+(o?"array":"object"),"type "+(a?"array":"object"),r,i);else if(t.length!==n.length)s(`array with length ${t.length}`,`array with length ${n.length}`,r,i);else for(let s=0;s<t.length;s++)e(t[s],n[s],`${r}[${s}]`,i+1);else if(v(t)||v(n))v(t)!==v(n)?s("type "+(v(t)?"React element":"object"),"type "+(v(n)?"React element":"object"),r,i):t.type!==n.type?s(`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||s(`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):s(`object with key ${o}`,`object without key ${o}`,r,i)}}else{if("function"==typeof t)return;isNaN(t)||isNaN(n)?isNaN(t)!==isNaN(n)&&s(""+(isNaN(t)?"NaN":"non-NaN value"),""+(isNaN(n)?"NaN":"non-NaN value"),r,i):t!==n&&s(t,n,r,i)}}(e,t,"",0)}return d}(),m=Object.defineProperty,g=Object.defineProperties,v=Object.getOwnPropertyDescriptors,y=Object.getOwnPropertySymbols,b=Object.prototype.hasOwnProperty,E=Object.prototype.propertyIsEnumerable,x=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e),w=(e,t,n)=>t in e?m(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,T=(e,t)=>{for(var n in t||(t={}))b.call(t,n)&&w(e,n,t[n]);if(y)for(var n of y(t))E.call(t,n)&&w(e,n,t[n]);return e},C=(e,t)=>g(e,v(t)),S=function(e,t){this[0]=e,this[1]=t};function k(e){return"object"==typeof e&&null!==e&&"function"==typeof e.then}function _(e){return"object"==typeof e&&null!==e&&"subscribe"in e&&"function"==typeof e.subscribe}function N(e){return"object"==typeof e&&null!==e&&("AsyncGenerator"===e[Symbol.toStringTag]||Symbol.asyncIterator in e)}async function D(e){const t=await e;return N(t)?async function(e){var t;const n=null==(t=("return"in e?e:e[Symbol.asyncIterator]()).return)?void 0:t.bind(e),r=await("next"in e?e:e[Symbol.asyncIterator]()).next.bind(e)();return null==n||n(),r.value}(t):_(t)?(n=t,new Promise(((e,t)=>{const r=n.subscribe({next(t){e(t),r.unsubscribe()},error:t,complete(){t(new Error("no value resolved"))}})}))):t;var n}const A=Object.freeze({major:16,minor:11,patch:0,preReleaseTag:null});function I(e,t){if(!Boolean(e))throw new Error(t)}function O(e){return"function"==typeof(null==e?void 0:e.then)}function L(e){return"object"==typeof e&&null!==e}function M(e,t){if(!Boolean(e))throw new Error(null!=t?t:"Unexpected invariant triggered.")}const R=/\r\n|[\n\r]/g;function F(e,t){let n=0,r=1;for(const i of e.body.matchAll(R)){if("number"==typeof i.index||M(!1),i.index>=t)break;n=i.index+i[0].length,r+=1}return{line:r,column:t+1-n}}function P(e){return j(e.source,F(e.source,e.start))}function j(e,t){const n=e.locationOffset.column-1,r="".padStart(n)+e.body,i=t.line-1,o=e.locationOffset.line-1,s=t.line+o,a=1===t.line?n:0,l=t.column+a,c=`${e.name}:${s}:${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+V([[`${s} |`,n[0]],...n.slice(1,e+1).map((e=>["|",e])),["|","^".padStart(t)],["|",n[e+1]]])}return c+V([[s-1+" |",u[i-1]],[`${s} |`,d],["|","^".padStart(l)],[`${s+1} |`,u[i+1]]])}function V(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 B extends Error{constructor(e,...t){var n,r,i;const{nodes:o,source:s,positions:a,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=$(Array.isArray(o)?o:o?[o]:void 0);const d=$(null===(n=this.nodes)||void 0===n?void 0:n.map((e=>e.loc)).filter((e=>null!=e)));this.source=null!=s?s:null==d||null===(r=d[0])||void 0===r?void 0:r.source,this.positions=null!=a?a:null==d?void 0:d.map((e=>e.start)),this.locations=a&&s?a.map((e=>F(s,e))):null==d?void 0:d.map((e=>F(e.source,e.start)));const f=L(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,B):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"+P(t.loc));else if(this.source&&this.locations)for(const t of this.locations)e+="\n\n"+j(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 $(e){return void 0===e||0===e.length?void 0:e}function U(e,t,n){return new B(`Syntax Error: ${n}`,{source:e,positions:[t]})}let H=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}}},q=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 W={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"]},z=new Set(Object.keys(W));function G(e){const t=null==e?void 0:e.kind;return"string"==typeof t&&z.has(t)}var K,Y,Q,X,J,Z,ee,te;function ne(e){return 9===e||32===e}function re(e){return e>=48&&e<=57}function ie(e){return e>=97&&e<=122||e>=65&&e<=90}function oe(e){return ie(e)||95===e}function se(e){return ie(e)||re(e)||95===e}function ae(e){var t;let n=Number.MAX_SAFE_INTEGER,r=null,i=-1;for(let s=0;s<e.length;++s){var o;const t=e[s],a=le(t);a!==t.length&&(r=null!==(o=r)&&void 0!==o?o:s,i=s,0!==s&&a<n&&(n=a))}return e.map(((e,t)=>0===t?e:e.slice(n))).slice(null!==(t=r)&&void 0!==t?t:0,i+1)}function le(e){let t=0;for(;t<e.length&&ne(e.charCodeAt(t));)++t;return t}function ce(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 ue(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||ne(e.charCodeAt(0)))),s=n.endsWith('\\"""'),a=e.endsWith('"')&&!s,l=e.endsWith("\\"),c=a||l,u=!(null!=t&&t.minimize)&&(!i||e.length>70||c||o||s);let d="";const f=i&&ne(e.charCodeAt(0));return(u&&!f||o)&&(d+="\n"),d+=n,(u||c)&&(d+="\n"),'"""'+d+'"""'}(Y=K||(K={})).QUERY="query",Y.MUTATION="mutation",Y.SUBSCRIPTION="subscription",(X=Q||(Q={})).QUERY="QUERY",X.MUTATION="MUTATION",X.SUBSCRIPTION="SUBSCRIPTION",X.FIELD="FIELD",X.FRAGMENT_DEFINITION="FRAGMENT_DEFINITION",X.FRAGMENT_SPREAD="FRAGMENT_SPREAD",X.INLINE_FRAGMENT="INLINE_FRAGMENT",X.VARIABLE_DEFINITION="VARIABLE_DEFINITION",X.SCHEMA="SCHEMA",X.SCALAR="SCALAR",X.OBJECT="OBJECT",X.FIELD_DEFINITION="FIELD_DEFINITION",X.ARGUMENT_DEFINITION="ARGUMENT_DEFINITION",X.INTERFACE="INTERFACE",X.UNION="UNION",X.ENUM="ENUM",X.ENUM_VALUE="ENUM_VALUE",X.INPUT_OBJECT="INPUT_OBJECT",X.INPUT_FIELD_DEFINITION="INPUT_FIELD_DEFINITION",(Z=J||(J={})).NAME="Name",Z.DOCUMENT="Document",Z.OPERATION_DEFINITION="OperationDefinition",Z.VARIABLE_DEFINITION="VariableDefinition",Z.SELECTION_SET="SelectionSet",Z.FIELD="Field",Z.ARGUMENT="Argument",Z.FRAGMENT_SPREAD="FragmentSpread",Z.INLINE_FRAGMENT="InlineFragment",Z.FRAGMENT_DEFINITION="FragmentDefinition",Z.VARIABLE="Variable",Z.INT="IntValue",Z.FLOAT="FloatValue",Z.STRING="StringValue",Z.BOOLEAN="BooleanValue",Z.NULL="NullValue",Z.ENUM="EnumValue",Z.LIST="ListValue",Z.OBJECT="ObjectValue",Z.OBJECT_FIELD="ObjectField",Z.DIRECTIVE="Directive",Z.NAMED_TYPE="NamedType",Z.LIST_TYPE="ListType",Z.NON_NULL_TYPE="NonNullType",Z.SCHEMA_DEFINITION="SchemaDefinition",Z.OPERATION_TYPE_DEFINITION="OperationTypeDefinition",Z.SCALAR_TYPE_DEFINITION="ScalarTypeDefinition",Z.OBJECT_TYPE_DEFINITION="ObjectTypeDefinition",Z.FIELD_DEFINITION="FieldDefinition",Z.INPUT_VALUE_DEFINITION="InputValueDefinition",Z.INTERFACE_TYPE_DEFINITION="InterfaceTypeDefinition",Z.UNION_TYPE_DEFINITION="UnionTypeDefinition",Z.ENUM_TYPE_DEFINITION="EnumTypeDefinition",Z.ENUM_VALUE_DEFINITION="EnumValueDefinition",Z.INPUT_OBJECT_TYPE_DEFINITION="InputObjectTypeDefinition",Z.DIRECTIVE_DEFINITION="DirectiveDefinition",Z.SCHEMA_EXTENSION="SchemaExtension",Z.SCALAR_TYPE_EXTENSION="ScalarTypeExtension",Z.OBJECT_TYPE_EXTENSION="ObjectTypeExtension",Z.INTERFACE_TYPE_EXTENSION="InterfaceTypeExtension",Z.UNION_TYPE_EXTENSION="UnionTypeExtension",Z.ENUM_TYPE_EXTENSION="EnumTypeExtension",Z.INPUT_OBJECT_TYPE_EXTENSION="InputObjectTypeExtension",(te=ee||(ee={})).SOF="<SOF>",te.EOF="<EOF>",te.BANG="!",te.DOLLAR="$",te.AMP="&",te.PAREN_L="(",te.PAREN_R=")",te.SPREAD="...",te.COLON=":",te.EQUALS="=",te.AT="@",te.BRACKET_L="[",te.BRACKET_R="]",te.BRACE_L="{",te.PIPE="|",te.BRACE_R="}",te.NAME="Name",te.INT="Int",te.FLOAT="Float",te.STRING="String",te.BLOCK_STRING="BlockString",te.COMMENT="Comment";class de{constructor(e){const t=new q(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=be(this,e.end);e.next=t,t.prev=e,e=t}}while(e.kind===ee.COMMENT);return e}}function fe(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 pe(e){return e>=0&&e<=55295||e>=57344&&e<=1114111}function he(e,t){return me(e.charCodeAt(t))&&ge(e.charCodeAt(t+1))}function me(e){return e>=55296&&e<=56319}function ge(e){return e>=56320&&e<=57343}function ve(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 ye(e,t,n,r,i){const o=e.line,s=1+n-e.lineStart;return new q(t,n,r,o,s,i)}function be(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 Ee(e,i);case 33:return ye(e,ee.BANG,i,i+1);case 36:return ye(e,ee.DOLLAR,i,i+1);case 38:return ye(e,ee.AMP,i,i+1);case 40:return ye(e,ee.PAREN_L,i,i+1);case 41:return ye(e,ee.PAREN_R,i,i+1);case 46:if(46===n.charCodeAt(i+1)&&46===n.charCodeAt(i+2))return ye(e,ee.SPREAD,i,i+3);break;case 58:return ye(e,ee.COLON,i,i+1);case 61:return ye(e,ee.EQUALS,i,i+1);case 64:return ye(e,ee.AT,i,i+1);case 91:return ye(e,ee.BRACKET_L,i,i+1);case 93:return ye(e,ee.BRACKET_R,i,i+1);case 123:return ye(e,ee.BRACE_L,i,i+1);case 124:return ye(e,ee.PIPE,i,i+1);case 125:return ye(e,ee.BRACE_R,i,i+1);case 34:return 34===n.charCodeAt(i+1)&&34===n.charCodeAt(i+2)?De(e,i):Te(e,i)}if(re(t)||45===t)return xe(e,i,t);if(oe(t))return Ae(e,i);throw U(e.source,i,39===t?"Unexpected single quote character ('), did you mean to use a double quote (\")?":pe(t)||he(n,i)?`Unexpected character: ${ve(e,i)}.`:`Invalid character: ${ve(e,i)}.`)}return ye(e,ee.EOF,r,r)}function Ee(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(pe(e))++i;else{if(!he(n,i))break;i+=2}}return ye(e,ee.COMMENT,t,i,n.slice(t+1,i))}function xe(e,t,n){const r=e.source.body;let i=t,o=n,s=!1;if(45===o&&(o=r.charCodeAt(++i)),48===o){if(o=r.charCodeAt(++i),re(o))throw U(e.source,i,`Invalid number, unexpected digit after 0: ${ve(e,i)}.`)}else i=we(e,i,o),o=r.charCodeAt(i);if(46===o&&(s=!0,o=r.charCodeAt(++i),i=we(e,i,o),o=r.charCodeAt(i)),69!==o&&101!==o||(s=!0,o=r.charCodeAt(++i),43!==o&&45!==o||(o=r.charCodeAt(++i)),i=we(e,i,o),o=r.charCodeAt(i)),46===o||oe(o))throw U(e.source,i,`Invalid number, expected digit but got: ${ve(e,i)}.`);return ye(e,s?ee.FLOAT:ee.INT,t,i,r.slice(t,i))}function we(e,t,n){if(!re(n))throw U(e.source,t,`Invalid number, expected digit but got: ${ve(e,t)}.`);const r=e.source.body;let i=t+1;for(;re(r.charCodeAt(i));)++i;return i}function Te(e,t){const n=e.source.body,r=n.length;let i=t+1,o=i,s="";for(;i<r;){const r=n.charCodeAt(i);if(34===r)return s+=n.slice(o,i),ye(e,ee.STRING,t,i+1,s);if(92!==r){if(10===r||13===r)break;if(pe(r))++i;else{if(!he(n,i))throw U(e.source,i,`Invalid character within String: ${ve(e,i)}.`);i+=2}}else{s+=n.slice(o,i);const t=117===n.charCodeAt(i+1)?123===n.charCodeAt(i+2)?Ce(e,i):Se(e,i):Ne(e,i);s+=t.value,i+=t.size,o=i}}throw U(e.source,i,"Unterminated string.")}function Ce(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||!pe(r))break;return{value:String.fromCodePoint(r),size:i}}if(r=r<<4|_e(e),r<0)break}throw U(e.source,t,`Invalid Unicode escape sequence: "${n.slice(t,t+i)}".`)}function Se(e,t){const n=e.source.body,r=ke(n,t+2);if(pe(r))return{value:String.fromCodePoint(r),size:6};if(me(r)&&92===n.charCodeAt(t+6)&&117===n.charCodeAt(t+7)){const e=ke(n,t+8);if(ge(e))return{value:String.fromCodePoint(r,e),size:12}}throw U(e.source,t,`Invalid Unicode escape sequence: "${n.slice(t,t+6)}".`)}function ke(e,t){return _e(e.charCodeAt(t))<<12|_e(e.charCodeAt(t+1))<<8|_e(e.charCodeAt(t+2))<<4|_e(e.charCodeAt(t+3))}function _e(e){return e>=48&&e<=57?e-48:e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:-1}function Ne(e,t){const n=e.source.body;switch(n.charCodeAt(t+1)){case 34:return{value:'"',size:2};case 92:return{value:"\\",size:2};case 47:return{value:"/",size:2};case 98:return{value:"\b",size:2};case 102:return{value:"\f",size:2};case 110:return{value:"\n",size:2};case 114:return{value:"\r",size:2};case 116:return{value:"\t",size:2}}throw U(e.source,t,`Invalid character escape sequence: "${n.slice(t,t+2)}".`)}function De(e,t){const n=e.source.body,r=n.length;let i=e.lineStart,o=t+3,s=o,a="";const l=[];for(;o<r;){const r=n.charCodeAt(o);if(34===r&&34===n.charCodeAt(o+1)&&34===n.charCodeAt(o+2)){a+=n.slice(s,o),l.push(a);const r=ye(e,ee.BLOCK_STRING,t,o+3,ae(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(pe(r))++o;else{if(!he(n,o))throw U(e.source,o,`Invalid character within String: ${ve(e,o)}.`);o+=2}else a+=n.slice(s,o),l.push(a),13===r&&10===n.charCodeAt(o+1)?o+=2:++o,a="",s=o,i=o;else a+=n.slice(s,o),s=o+1,o+=4}throw U(e.source,o,"Unterminated string.")}function Ae(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 ye(e,ee.NAME,t,i,n.slice(t,i))}const Ie=10,Oe=2;function Le(e){return Me(e,[])}function Me(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:Me(t,n)}else if(Array.isArray(e))return function(e,t){if(0===e.length)return"[]";if(t.length>Oe)return"[Array]";const n=Math.min(Ie,e.length),r=e.length-n,i=[];for(let o=0;o<n;++o)i.push(Me(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>Oe)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+": "+Me(n,t)));return"{ "+r.join(", ")+" }"}(e,n)}(e,t);default:return String(e)}}const Re=function(e,t){return e instanceof t};class Fe{constructor(e,t="GraphQL request",n={line:1,column:1}){"string"==typeof e||I(!1,`Body must be a string. Received: ${Le(e)}.`),this.body=e,this.name=t,this.locationOffset=n,this.locationOffset.line>0||I(!1,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||I(!1,"column in locationOffset is 1-indexed and must be positive.")}get[Symbol.toStringTag](){return"Source"}}function Pe(e){return Re(e,Fe)}function je(e,t){const n=new Be(e,t),r=n.parseDocument();return Object.defineProperty(r,"tokenCount",{enumerable:!1,value:n.tokenCount}),r}function Ve(e,t){const n=new Be(e,t);n.expectToken(ee.SOF);const r=n.parseValueLiteral(!1);return n.expectToken(ee.EOF),r}class Be{constructor(e,t={}){const n=Pe(e)?e:new Fe(e);this._lexer=new de(n),this._options=t,this._tokenCounter=0}get tokenCount(){return this._tokenCounter}parseName(){const e=this.expectToken(ee.NAME);return this.node(e,{kind:J.NAME,value:e.value})}parseDocument(){return this.node(this._lexer.token,{kind:J.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 U(this._lexer.source,this._lexer.token.start,"Unexpected description, descriptions are supported only on type definitions.");switch(t.value){case"query":case"mutation":case"subscription":return this.parseOperationDefinition();case"fragment":return this.parseFragmentDefinition();case"extend":return this.parseTypeSystemExtension()}}throw this.unexpected(t)}parseOperationDefinition(){const e=this._lexer.token;if(this.peek(ee.BRACE_L))return this.node(e,{kind:J.OPERATION_DEFINITION,operation:K.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:J.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 K.QUERY;case"mutation":return K.MUTATION;case"subscription":return K.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:J.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:J.VARIABLE,name:this.parseName()})}parseSelectionSet(){return this.node(this._lexer.token,{kind:J.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:J.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:J.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:J.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1)}):this.node(e,{kind:J.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:J.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:J.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:J.INT,value:t.value});case ee.FLOAT:return this.advanceLexer(),this.node(t,{kind:J.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:J.BOOLEAN,value:!0});case"false":return this.node(t,{kind:J.BOOLEAN,value:!1});case"null":return this.node(t,{kind:J.NULL});default:return this.node(t,{kind:J.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 U(this._lexer.source,t.start,`Unexpected variable "$${e}" in constant value.`)}throw this.unexpected(t)}return this.parseVariable();default:throw this.unexpected()}}parseConstValueLiteral(){return this.parseValueLiteral(!0)}parseStringLiteral(){const e=this._lexer.token;return this.advanceLexer(),this.node(e,{kind:J.STRING,value:e.value,block:e.kind===ee.BLOCK_STRING})}parseList(e){return this.node(this._lexer.token,{kind:J.LIST,values:this.any(ee.BRACKET_L,(()=>this.parseValueLiteral(e)),ee.BRACKET_R)})}parseObject(e){return this.node(this._lexer.token,{kind:J.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:J.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:J.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:J.LIST_TYPE,type:n})}else t=this.parseNamedType();return this.expectOptionalToken(ee.BANG)?this.node(e,{kind:J.NON_NULL_TYPE,type:t}):t}parseNamedType(){return this.node(this._lexer.token,{kind:J.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:J.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:J.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:J.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:J.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:J.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:J.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:J.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:J.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:J.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:J.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 U(this._lexer.source,this._lexer.token.start,`${$e(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:J.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:J.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:J.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:J.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:J.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:J.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:J.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:J.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:J.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(Q,t.value))return t;throw this.unexpected(e)}node(e,t){return!0!==this._options.noLocation&&(t.loc=new H(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 U(this._lexer.source,t.start,`Expected ${Ue(e)}, found ${$e(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 U(this._lexer.source,t.start,`Expected "${e}", found ${$e(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 U(this._lexer.source,t.start,`Unexpected ${$e(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(t.kind!==ee.EOF&&(++this._tokenCounter,void 0!==e&&this._tokenCounter>e))throw U(this._lexer.source,t.start,`Document contains more that ${e} tokens. Parsing aborted.`)}}function $e(e){const t=e.value;return Ue(e.kind)+(null!=t?` "${t}"`:"")}function Ue(e){return fe(e)?`"${e}"`:e}const He=5;function qe(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 s=o.slice(0,He),a=s.pop();return i+s.join(", ")+", or "+a+"?"}function We(e){return e}function ze(e,t){const n=Object.create(null);for(const r of e)n[t(r)]=r;return n}function Ge(e,t,n){const r=Object.create(null);for(const i of e)r[t(i)]=n(i);return r}function Ke(e,t){const n=Object.create(null);for(const r of Object.keys(e))n[r]=t(e[r],r);return n}function Ye(e,t){let n=0,r=0;for(;n<e.length&&r<t.length;){let i=e.charCodeAt(n),o=t.charCodeAt(r);if(Je(i)&&Je(o)){let s=0;do{++n,s=10*s+i-Qe,i=e.charCodeAt(n)}while(Je(i)&&s>0);let a=0;do{++r,a=10*a+o-Qe,o=t.charCodeAt(r)}while(Je(o)&&a>0);if(s<a)return-1;if(s>a)return 1}else{if(i<o)return-1;if(i>o)return 1;++n,++r}}return e.length-t.length}const Qe=48,Xe=57;function Je(e){return!isNaN(e)&&Qe<=e&&e<=Xe}function Ze(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:Ye(e,t)}))}class et{constructor(e){this._input=e,this._inputLowerCase=e.toLowerCase(),this._inputArray=tt(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=tt(n),i=this._inputArray;if(r.length<i.length){const e=r;r=i,i=e}const o=r.length,s=i.length;if(o-s>t)return;const a=this._rows;for(let c=0;c<=s;c++)a[0][c]=c;for(let c=1;c<=o;c++){const e=a[(c-1)%3],n=a[c%3];let o=n[0]=c;for(let t=1;t<=s;t++){const s=r[c-1]===i[t-1]?0:1;let l=Math.min(e[t]+1,n[t-1]+1,e[t-1]+s);if(c>1&&t>1&&r[c-1]===i[t-2]&&r[c-2]===i[t-1]){const e=a[(c-2)%3][t-2];l=Math.min(l,e+1)}l<o&&(o=l),n[t]=l}if(o>t)return}const l=a[o%3][s];return l<=t?l:void 0}}function tt(e){const t=e.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=e.charCodeAt(r);return n}function nt(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 rt=/[\x00-\x1f\x22\x5c\x7f-\x9f]/g;function it(e){return ot[e.charCodeAt(0)]}const ot=["\\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 at(e,t,n=W){const r=new Map;for(const v of Object.values(J))r.set(v,ct(t,v));let i,o,s,a=Array.isArray(e),l=[e],c=-1,u=[],d=e;const f=[],p=[];do{c++;const e=c===l.length,v=e&&0!==u.length;if(e){if(o=0===p.length?void 0:f[f.length-1],d=s,s=p.pop(),v)if(a){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={...d};for(const[e,t]of u)d[e]=t}c=i.index,l=i.keys,u=i.edits,a=i.inArray,i=i.prev}else if(s){if(o=a?c:l[c],d=s[o],null==d)continue;f.push(o)}let y;if(!Array.isArray(d)){var h,m;G(d)||I(!1,`Invalid AST Node: ${Le(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,s,f,p),y===st)break;if(!1===y){if(!e){f.pop();continue}}else if(void 0!==y&&(u.push([o,y]),!e)){if(!G(y)){f.pop();continue}d=y}}var g;if(void 0===y&&v&&u.push([o,d]),e)f.pop();else i={inArray:a,index:c,keys:l,edits:u,prev:i},a=Array.isArray(d),l=a?d:null!==(g=n[d.kind])&&void 0!==g?g:[],c=-1,u=[],s&&p.push(s),s=d}while(void 0!==i);return 0!==u.length?u[u.length-1][1]:e}function lt(e){const t=new Array(e.length).fill(null),n=Object.create(null);for(const r of Object.values(J)){let i=!1;const o=new Array(e.length).fill(void 0),s=new Array(e.length).fill(void 0);for(let t=0;t<e.length;++t){const{enter:n,leave:a}=ct(e[t],r);i||(i=null!=n||null!=a),o[t]=n,s[t]=a}if(!i)continue;const a={enter(...n){const r=n[0];for(let s=0;s<e.length;s++)if(null===t[s]){var i;const a=null===(i=o[s])||void 0===i?void 0:i.apply(e[s],n);if(!1===a)t[s]=r;else if(a===st)t[s]=st;else if(void 0!==a)return a}},leave(...n){const r=n[0];for(let o=0;o<e.length;o++)if(null===t[o]){var i;const r=null===(i=s[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]=a}return n}function ct(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 ut(e){return at(e,dt)}const dt={Name:{leave:e=>e.value},Variable:{leave:e=>"$"+e.name},Document:{leave:e=>ft(e.definitions,"\n\n")},OperationDefinition:{leave(e){const t=ht("(",ft(e.variableDefinitions,", "),")"),n=ft([e.operation,ft([e.name,t]),ft(e.directives," ")]," ");return("query"===n?"":n+" ")+e.selectionSet}},VariableDefinition:{leave:({variable:e,type:t,defaultValue:n,directives:r})=>e+": "+t+ht(" = ",n)+ht(" ",ft(r," "))},SelectionSet:{leave:({selections:e})=>pt(e)},Field:{leave({alias:e,name:t,arguments:n,directives:r,selectionSet:i}){const o=ht("",e,": ")+t;let s=o+ht("(",ft(n,", "),")");return s.length>80&&(s=o+ht("(\n",mt(ft(n,"\n")),"\n)")),ft([s,ft(r," "),i]," ")}},Argument:{leave:({name:e,value:t})=>e+": "+t},FragmentSpread:{leave:({name:e,directives:t})=>"..."+e+ht(" ",ft(t," "))},InlineFragment:{leave:({typeCondition:e,directives:t,selectionSet:n})=>ft(["...",ht("on ",e),ft(t," "),n]," ")},FragmentDefinition:{leave:({name:e,typeCondition:t,variableDefinitions:n,directives:r,selectionSet:i})=>`fragment ${e}${ht("(",ft(n,", "),")")} on ${t} ${ht("",ft(r," ")," ")}`+i},IntValue:{leave:({value:e})=>e},FloatValue:{leave:({value:e})=>e},StringValue:{leave:({value:e,block:t})=>t?ue(e):`"${e.replace(rt,it)}"`},BooleanValue:{leave:({value:e})=>e?"true":"false"},NullValue:{leave:()=>"null"},EnumValue:{leave:({value:e})=>e},ListValue:{leave:({values:e})=>"["+ft(e,", ")+"]"},ObjectValue:{leave:({fields:e})=>"{"+ft(e,", ")+"}"},ObjectField:{leave:({name:e,value:t})=>e+": "+t},Directive:{leave:({name:e,arguments:t})=>"@"+e+ht("(",ft(t,", "),")")},NamedType:{leave:({name:e})=>e},ListType:{leave:({type:e})=>"["+e+"]"},NonNullType:{leave:({type:e})=>e+"!"},SchemaDefinition:{leave:({description:e,directives:t,operationTypes:n})=>ht("",e,"\n")+ft(["schema",ft(t," "),pt(n)]," ")},OperationTypeDefinition:{leave:({operation:e,type:t})=>e+": "+t},ScalarTypeDefinition:{leave:({description:e,name:t,directives:n})=>ht("",e,"\n")+ft(["scalar",t,ft(n," ")]," ")},ObjectTypeDefinition:{leave:({description:e,name:t,interfaces:n,directives:r,fields:i})=>ht("",e,"\n")+ft(["type",t,ht("implements ",ft(n," & ")),ft(r," "),pt(i)]," ")},FieldDefinition:{leave:({description:e,name:t,arguments:n,type:r,directives:i})=>ht("",e,"\n")+t+(gt(n)?ht("(\n",mt(ft(n,"\n")),"\n)"):ht("(",ft(n,", "),")"))+": "+r+ht(" ",ft(i," "))},InputValueDefinition:{leave:({description:e,name:t,type:n,defaultValue:r,directives:i})=>ht("",e,"\n")+ft([t+": "+n,ht("= ",r),ft(i," ")]," ")},InterfaceTypeDefinition:{leave:({description:e,name:t,interfaces:n,directives:r,fields:i})=>ht("",e,"\n")+ft(["interface",t,ht("implements ",