UNPKG

@spiffcommerce/core

Version:

Core client API for interacting with the Spiff Commerce backend.

55 lines (49 loc) • 1.65 MB
"use strict";var QD=Object.create;var Jb=Object.defineProperty;var YD=Object.getOwnPropertyDescriptor;var XD=Object.getOwnPropertyNames;var JD=Object.getPrototypeOf,KD=Object.prototype.hasOwnProperty;var ZD=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of XD(e))!KD.call(r,i)&&i!==t&&Jb(r,i,{get:()=>e[i],enumerable:!(n=YD(e,i))||n.enumerable});return r};var eP=(r,e,t)=>(t=r!=null?QD(JD(r)):{},ZD(e||!r||!r.__esModule?Jb(t,"default",{value:r,enumerable:!0}):t,r));var ny=function(r,e){return ny=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])},ny(r,e)};function va(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");ny(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var me=function(){return me=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++){t=arguments[n];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},me.apply(this,arguments)};function ss(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(t[n[i]]=r[n[i]]);return t}function rs(r,e,t,n){function i(a){return a instanceof t?a:new t(function(s){s(a)})}return new(t||(t=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,e||[])).next())})}function ns(r,e){var t={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},n,i,a,s=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return s.next=o(0),s.throw=o(1),s.return=o(2),typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function o(u){return function(c){return l([u,c])}}function l(u){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,u[0]&&(t=0)),t;)try{if(n=1,i&&(a=u[0]&2?i.return:u[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,u[1])).done)return a;switch(i=0,a&&(u=[u[0]&2,a.value]),u[0]){case 0:case 1:a=u;break;case 4:return t.label++,{value:u[1],done:!1};case 5:t.label++,i=u[1],u=[0];continue;case 7:u=t.ops.pop(),t.trys.pop();continue;default:if(a=t.trys,!(a=a.length>0&&a[a.length-1])&&(u[0]===6||u[0]===2)){t=0;continue}if(u[0]===3&&(!a||u[1]>a[0]&&u[1]<a[3])){t.label=u[1];break}if(u[0]===6&&t.label<a[1]){t.label=a[1],a=u;break}if(a&&t.label<a[2]){t.label=a[2],t.ops.push(u);break}a[2]&&t.ops.pop(),t.trys.pop();continue}u=e.call(r,t)}catch(c){u=[6,c],i=0}finally{n=a=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}function na(r,e,t){if(t||arguments.length===2)for(var n=0,i=e.length,a;n<i;n++)(a||!(n in e))&&(a||(a=Array.prototype.slice.call(e,0,n)),a[n]=e[n]);return r.concat(a||Array.prototype.slice.call(e))}var e0="Invariant Violation",Kb=Object.setPrototypeOf,tP=Kb===void 0?function(r,e){return r.__proto__=e,r}:Kb,x2=(function(r){va(e,r);function e(t){t===void 0&&(t=e0);var n=r.call(this,typeof t=="number"?e0+": "+t+" (see https://github.com/apollographql/invariant-packages)":t)||this;return n.framesToPop=1,n.name=e0,tP(n,e.prototype),n}return e})(Error);function ml(r,e){if(!r)throw new x2(e)}var S2=["debug","log","warn","error","silent"],rP=S2.indexOf("log");function qh(r){return function(){if(S2.indexOf(r)>=rP){var e=console[r]||console.log;return e.apply(console,arguments)}}}(function(r){r.debug=qh("debug"),r.log=qh("log"),r.warn=qh("warn"),r.error=qh("error")})(ml||(ml={}));var bA="3.14.1";function Da(r){try{return r()}catch{}}const sg=Da(function(){return globalThis})||Da(function(){return window})||Da(function(){return self})||Da(function(){return global})||Da(function(){return Da.constructor("return this")()});var Zb=new Map;function iy(r){var e=Zb.get(r)||1;return Zb.set(r,e+1),"".concat(r,":").concat(e,":").concat(Math.random().toString(36).slice(2))}function nP(r,e){var t=iy("stringifyForDisplay");return JSON.stringify(r,function(n,i){return i===void 0?t:i},e).split(JSON.stringify(t)).join("<undefined>")}function Wh(r){return function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];if(typeof e=="number"){var i=e;e=wA(i),e||(e=CA(i,t),t=[])}r.apply(void 0,[e].concat(t))}}var Mr=Object.assign(function(e,t){for(var n=[],i=2;i<arguments.length;i++)n[i-2]=arguments[i];e||ml(e,wA(t,n)||CA(t,n))},{debug:Wh(ml.debug),log:Wh(ml.log),warn:Wh(ml.warn),error:Wh(ml.error)});function qi(r){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];return new x2(wA(r,e)||CA(r,e))}var ew=Symbol.for("ApolloErrorMessageHandler_"+bA);function E2(r){if(typeof r=="string")return r;try{return nP(r,2).slice(0,1e3)}catch{return"<non-serializable>"}}function wA(r,e){if(e===void 0&&(e=[]),!!r)return sg[ew]&&sg[ew](r,e.map(E2))}function CA(r,e){if(e===void 0&&(e=[]),!!r)return"An error occurred! For more details, see the full error text at https://go.apollo.dev/c/err#".concat(encodeURIComponent(JSON.stringify({version:bA,message:r,args:e.map(E2)})))}function Vp(r,e){if(!!!r)throw new Error(e)}function iP(r){return typeof r=="object"&&r!==null}function aP(r,e){if(!!!r)throw new Error("Unexpected invariant triggered.")}const sP=/\r\n|[\n\r]/g;function ay(r,e){let t=0,n=1;for(const i of r.body.matchAll(sP)){if(typeof i.index=="number"||aP(!1),i.index>=e)break;t=i.index+i[0].length,n+=1}return{line:n,column:e+1-t}}function oP(r){return k2(r.source,ay(r.source,r.start))}function k2(r,e){const t=r.locationOffset.column-1,n="".padStart(t)+r.body,i=e.line-1,a=r.locationOffset.line-1,s=e.line+a,o=e.line===1?t:0,l=e.column+o,u=`${r.name}:${s}:${l} `,c=n.split(/\r\n|[\n\r]/g),h=c[i];if(h.length>120){const f=Math.floor(l/80),d=l%80,g=[];for(let v=0;v<h.length;v+=80)g.push(h.slice(v,v+80));return u+tw([[`${s} |`,g[0]],...g.slice(1,f+1).map(v=>["|",v]),["|","^".padStart(d)],["|",g[f+1]]])}return u+tw([[`${s-1} |`,c[i-1]],[`${s} |`,h],["|","^".padStart(l)],[`${s+1} |`,c[i+1]]])}function tw(r){const e=r.filter(([n,i])=>i!==void 0),t=Math.max(...e.map(([n])=>n.length));return e.map(([n,i])=>n.padStart(t)+(i?" "+i:"")).join(` `)}function lP(r){const e=r[0];return e==null||"kind"in e||"length"in e?{nodes:e,source:r[1],positions:r[2],path:r[3],originalError:r[4],extensions:r[5]}:e}class xA extends Error{constructor(e,...t){var n,i,a;const{nodes:s,source:o,positions:l,path:u,originalError:c,extensions:h}=lP(t);super(e),this.name="GraphQLError",this.path=u??void 0,this.originalError=c??void 0,this.nodes=rw(Array.isArray(s)?s:s?[s]:void 0);const f=rw((n=this.nodes)===null||n===void 0?void 0:n.map(g=>g.loc).filter(g=>g!=null));this.source=o??(f==null||(i=f[0])===null||i===void 0?void 0:i.source),this.positions=l??f?.map(g=>g.start),this.locations=l&&o?l.map(g=>ay(o,g)):f?.map(g=>ay(g.source,g.start));const d=iP(c?.extensions)?c?.extensions:void 0;this.extensions=(a=h??d)!==null&&a!==void 0?a: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}}),c!=null&&c.stack?Object.defineProperty(this,"stack",{value:c.stack,writable:!0,configurable:!0}):Error.captureStackTrace?Error.captureStackTrace(this,xA):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+=` `+oP(t.loc));else if(this.source&&this.locations)for(const t of this.locations)e+=` `+k2(this.source,t);return e}toJSON(){const e={message:this.message};return this.locations!=null&&(e.locations=this.locations),this.path!=null&&(e.path=this.path),this.extensions!=null&&Object.keys(this.extensions).length>0&&(e.extensions=this.extensions),e}}function rw(r){return r===void 0||r.length===0?void 0:r}function ci(r,e,t){return new xA(`Syntax Error: ${t}`,{source:r,positions:[e]})}class uP{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}}}let F2=class{constructor(e,t,n,i,a,s){this.kind=e,this.start=t,this.end=n,this.line=i,this.column=a,this.value=s,this.prev=null,this.next=null}get[Symbol.toStringTag](){return"Token"}toJSON(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}}};const T2={Name:[],Document:["definitions"],OperationDefinition:["description","name","variableDefinitions","directives","selectionSet"],VariableDefinition:["description","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:["description","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"],TypeCoordinate:["name"],MemberCoordinate:["name","memberName"],ArgumentCoordinate:["name","fieldName","argumentName"],DirectiveCoordinate:["name"],DirectiveArgumentCoordinate:["name","argumentName"]},cP=new Set(Object.keys(T2));function nw(r){const e=r?.kind;return typeof e=="string"&&cP.has(e)}var Bu;(function(r){r.QUERY="query",r.MUTATION="mutation",r.SUBSCRIPTION="subscription"})(Bu||(Bu={}));var sy;(function(r){r.QUERY="QUERY",r.MUTATION="MUTATION",r.SUBSCRIPTION="SUBSCRIPTION",r.FIELD="FIELD",r.FRAGMENT_DEFINITION="FRAGMENT_DEFINITION",r.FRAGMENT_SPREAD="FRAGMENT_SPREAD",r.INLINE_FRAGMENT="INLINE_FRAGMENT",r.VARIABLE_DEFINITION="VARIABLE_DEFINITION",r.SCHEMA="SCHEMA",r.SCALAR="SCALAR",r.OBJECT="OBJECT",r.FIELD_DEFINITION="FIELD_DEFINITION",r.ARGUMENT_DEFINITION="ARGUMENT_DEFINITION",r.INTERFACE="INTERFACE",r.UNION="UNION",r.ENUM="ENUM",r.ENUM_VALUE="ENUM_VALUE",r.INPUT_OBJECT="INPUT_OBJECT",r.INPUT_FIELD_DEFINITION="INPUT_FIELD_DEFINITION"})(sy||(sy={}));var et;(function(r){r.NAME="Name",r.DOCUMENT="Document",r.OPERATION_DEFINITION="OperationDefinition",r.VARIABLE_DEFINITION="VariableDefinition",r.SELECTION_SET="SelectionSet",r.FIELD="Field",r.ARGUMENT="Argument",r.FRAGMENT_SPREAD="FragmentSpread",r.INLINE_FRAGMENT="InlineFragment",r.FRAGMENT_DEFINITION="FragmentDefinition",r.VARIABLE="Variable",r.INT="IntValue",r.FLOAT="FloatValue",r.STRING="StringValue",r.BOOLEAN="BooleanValue",r.NULL="NullValue",r.ENUM="EnumValue",r.LIST="ListValue",r.OBJECT="ObjectValue",r.OBJECT_FIELD="ObjectField",r.DIRECTIVE="Directive",r.NAMED_TYPE="NamedType",r.LIST_TYPE="ListType",r.NON_NULL_TYPE="NonNullType",r.SCHEMA_DEFINITION="SchemaDefinition",r.OPERATION_TYPE_DEFINITION="OperationTypeDefinition",r.SCALAR_TYPE_DEFINITION="ScalarTypeDefinition",r.OBJECT_TYPE_DEFINITION="ObjectTypeDefinition",r.FIELD_DEFINITION="FieldDefinition",r.INPUT_VALUE_DEFINITION="InputValueDefinition",r.INTERFACE_TYPE_DEFINITION="InterfaceTypeDefinition",r.UNION_TYPE_DEFINITION="UnionTypeDefinition",r.ENUM_TYPE_DEFINITION="EnumTypeDefinition",r.ENUM_VALUE_DEFINITION="EnumValueDefinition",r.INPUT_OBJECT_TYPE_DEFINITION="InputObjectTypeDefinition",r.DIRECTIVE_DEFINITION="DirectiveDefinition",r.SCHEMA_EXTENSION="SchemaExtension",r.SCALAR_TYPE_EXTENSION="ScalarTypeExtension",r.OBJECT_TYPE_EXTENSION="ObjectTypeExtension",r.INTERFACE_TYPE_EXTENSION="InterfaceTypeExtension",r.UNION_TYPE_EXTENSION="UnionTypeExtension",r.ENUM_TYPE_EXTENSION="EnumTypeExtension",r.INPUT_OBJECT_TYPE_EXTENSION="InputObjectTypeExtension",r.TYPE_COORDINATE="TypeCoordinate",r.MEMBER_COORDINATE="MemberCoordinate",r.ARGUMENT_COORDINATE="ArgumentCoordinate",r.DIRECTIVE_COORDINATE="DirectiveCoordinate",r.DIRECTIVE_ARGUMENT_COORDINATE="DirectiveArgumentCoordinate"})(et||(et={}));function oy(r){return r===9||r===32}function gd(r){return r>=48&&r<=57}function I2(r){return r>=97&&r<=122||r>=65&&r<=90}function D2(r){return I2(r)||r===95}function fP(r){return I2(r)||gd(r)||r===95}function dP(r){var e;let t=Number.MAX_SAFE_INTEGER,n=null,i=-1;for(let s=0;s<r.length;++s){var a;const o=r[s],l=hP(o);l!==o.length&&(n=(a=n)!==null&&a!==void 0?a:s,i=s,s!==0&&l<t&&(t=l))}return r.map((s,o)=>o===0?s:s.slice(t)).slice((e=n)!==null&&e!==void 0?e:0,i+1)}function hP(r){let e=0;for(;e<r.length&&oy(r.charCodeAt(e));)++e;return e}function pP(r,e){const t=r.replace(/"""/g,'\\"""'),n=t.split(/\r\n|[\n\r]/g),i=n.length===1,a=n.length>1&&n.slice(1).every(d=>d.length===0||oy(d.charCodeAt(0))),s=t.endsWith('\\"""'),o=r.endsWith('"')&&!s,l=r.endsWith("\\"),u=o||l,c=!i||r.length>70||u||a||s;let h="";const f=i&&oy(r.charCodeAt(0));return(c&&!f||a)&&(h+=` `),h+=t,(c||u)&&(h+=` `),'"""'+h+'"""'}var Re;(function(r){r.SOF="<SOF>",r.EOF="<EOF>",r.BANG="!",r.DOLLAR="$",r.AMP="&",r.PAREN_L="(",r.PAREN_R=")",r.DOT=".",r.SPREAD="...",r.COLON=":",r.EQUALS="=",r.AT="@",r.BRACKET_L="[",r.BRACKET_R="]",r.BRACE_L="{",r.PIPE="|",r.BRACE_R="}",r.NAME="Name",r.INT="Int",r.FLOAT="Float",r.STRING="String",r.BLOCK_STRING="BlockString",r.COMMENT="Comment"})(Re||(Re={}));class gP{constructor(e){const t=new F2(Re.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(){return this.lastToken=this.token,this.token=this.lookahead()}lookahead(){let e=this.token;if(e.kind!==Re.EOF)do if(e.next)e=e.next;else{const t=vP(this,e.end);e.next=t,t.prev=e,e=t}while(e.kind===Re.COMMENT);return e}}function mP(r){return r===Re.BANG||r===Re.DOLLAR||r===Re.AMP||r===Re.PAREN_L||r===Re.PAREN_R||r===Re.DOT||r===Re.SPREAD||r===Re.COLON||r===Re.EQUALS||r===Re.AT||r===Re.BRACKET_L||r===Re.BRACKET_R||r===Re.BRACE_L||r===Re.PIPE||r===Re.BRACE_R}function pc(r){return r>=0&&r<=55295||r>=57344&&r<=1114111}function Dg(r,e){return P2(r.charCodeAt(e))&&R2(r.charCodeAt(e+1))}function P2(r){return r>=55296&&r<=56319}function R2(r){return r>=56320&&r<=57343}function Fl(r,e){const t=r.source.body.codePointAt(e);if(t===void 0)return Re.EOF;if(t>=32&&t<=126){const n=String.fromCodePoint(t);return n==='"'?`'"'`:`"${n}"`}return"U+"+t.toString(16).toUpperCase().padStart(4,"0")}function ni(r,e,t,n,i){const a=r.line,s=1+t-r.lineStart;return new F2(e,t,n,a,s,i)}function vP(r,e){const t=r.source.body,n=t.length;let i=e;for(;i<n;){const a=t.charCodeAt(i);switch(a){case 65279:case 9:case 32:case 44:++i;continue;case 10:++i,++r.line,r.lineStart=i;continue;case 13:t.charCodeAt(i+1)===10?i+=2:++i,++r.line,r.lineStart=i;continue;case 35:return yP(r,i);case 33:return ni(r,Re.BANG,i,i+1);case 36:return ni(r,Re.DOLLAR,i,i+1);case 38:return ni(r,Re.AMP,i,i+1);case 40:return ni(r,Re.PAREN_L,i,i+1);case 41:return ni(r,Re.PAREN_R,i,i+1);case 46:if(t.charCodeAt(i+1)===46&&t.charCodeAt(i+2)===46)return ni(r,Re.SPREAD,i,i+3);break;case 58:return ni(r,Re.COLON,i,i+1);case 61:return ni(r,Re.EQUALS,i,i+1);case 64:return ni(r,Re.AT,i,i+1);case 91:return ni(r,Re.BRACKET_L,i,i+1);case 93:return ni(r,Re.BRACKET_R,i,i+1);case 123:return ni(r,Re.BRACE_L,i,i+1);case 124:return ni(r,Re.PIPE,i,i+1);case 125:return ni(r,Re.BRACE_R,i,i+1);case 34:return t.charCodeAt(i+1)===34&&t.charCodeAt(i+2)===34?SP(r,i):bP(r,i)}if(gd(a)||a===45)return AP(r,i,a);if(D2(a))return EP(r,i);throw ci(r.source,i,a===39?`Unexpected single quote character ('), did you mean to use a double quote (")?`:pc(a)||Dg(t,i)?`Unexpected character: ${Fl(r,i)}.`:`Invalid character: ${Fl(r,i)}.`)}return ni(r,Re.EOF,n,n)}function yP(r,e){const t=r.source.body,n=t.length;let i=e+1;for(;i<n;){const a=t.charCodeAt(i);if(a===10||a===13)break;if(pc(a))++i;else if(Dg(t,i))i+=2;else break}return ni(r,Re.COMMENT,e,i,t.slice(e+1,i))}function AP(r,e,t){const n=r.source.body;let i=e,a=t,s=!1;if(a===45&&(a=n.charCodeAt(++i)),a===48){if(a=n.charCodeAt(++i),gd(a))throw ci(r.source,i,`Invalid number, unexpected digit after 0: ${Fl(r,i)}.`)}else i=t0(r,i,a),a=n.charCodeAt(i);if(a===46&&(s=!0,a=n.charCodeAt(++i),i=t0(r,i,a),a=n.charCodeAt(i)),(a===69||a===101)&&(s=!0,a=n.charCodeAt(++i),(a===43||a===45)&&(a=n.charCodeAt(++i)),i=t0(r,i,a),a=n.charCodeAt(i)),a===46||D2(a))throw ci(r.source,i,`Invalid number, expected digit but got: ${Fl(r,i)}.`);return ni(r,s?Re.FLOAT:Re.INT,e,i,n.slice(e,i))}function t0(r,e,t){if(!gd(t))throw ci(r.source,e,`Invalid number, expected digit but got: ${Fl(r,e)}.`);const n=r.source.body;let i=e+1;for(;gd(n.charCodeAt(i));)++i;return i}function bP(r,e){const t=r.source.body,n=t.length;let i=e+1,a=i,s="";for(;i<n;){const o=t.charCodeAt(i);if(o===34)return s+=t.slice(a,i),ni(r,Re.STRING,e,i+1,s);if(o===92){s+=t.slice(a,i);const l=t.charCodeAt(i+1)===117?t.charCodeAt(i+2)===123?wP(r,i):CP(r,i):xP(r,i);s+=l.value,i+=l.size,a=i;continue}if(o===10||o===13)break;if(pc(o))++i;else if(Dg(t,i))i+=2;else throw ci(r.source,i,`Invalid character within String: ${Fl(r,i)}.`)}throw ci(r.source,i,"Unterminated string.")}function wP(r,e){const t=r.source.body;let n=0,i=3;for(;i<12;){const a=t.charCodeAt(e+i++);if(a===125){if(i<5||!pc(n))break;return{value:String.fromCodePoint(n),size:i}}if(n=n<<4|Vf(a),n<0)break}throw ci(r.source,e,`Invalid Unicode escape sequence: "${t.slice(e,e+i)}".`)}function CP(r,e){const t=r.source.body,n=iw(t,e+2);if(pc(n))return{value:String.fromCodePoint(n),size:6};if(P2(n)&&t.charCodeAt(e+6)===92&&t.charCodeAt(e+7)===117){const i=iw(t,e+8);if(R2(i))return{value:String.fromCodePoint(n,i),size:12}}throw ci(r.source,e,`Invalid Unicode escape sequence: "${t.slice(e,e+6)}".`)}function iw(r,e){return Vf(r.charCodeAt(e))<<12|Vf(r.charCodeAt(e+1))<<8|Vf(r.charCodeAt(e+2))<<4|Vf(r.charCodeAt(e+3))}function Vf(r){return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:-1}function xP(r,e){const t=r.source.body;switch(t.charCodeAt(e+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:` `,size:2};case 114:return{value:"\r",size:2};case 116:return{value:" ",size:2}}throw ci(r.source,e,`Invalid character escape sequence: "${t.slice(e,e+2)}".`)}function SP(r,e){const t=r.source.body,n=t.length;let i=r.lineStart,a=e+3,s=a,o="";const l=[];for(;a<n;){const u=t.charCodeAt(a);if(u===34&&t.charCodeAt(a+1)===34&&t.charCodeAt(a+2)===34){o+=t.slice(s,a),l.push(o);const c=ni(r,Re.BLOCK_STRING,e,a+3,dP(l).join(` `));return r.line+=l.length-1,r.lineStart=i,c}if(u===92&&t.charCodeAt(a+1)===34&&t.charCodeAt(a+2)===34&&t.charCodeAt(a+3)===34){o+=t.slice(s,a),s=a+1,a+=4;continue}if(u===10||u===13){o+=t.slice(s,a),l.push(o),u===13&&t.charCodeAt(a+1)===10?a+=2:++a,o="",s=a,i=a;continue}if(pc(u))++a;else if(Dg(t,a))a+=2;else throw ci(r.source,a,`Invalid character within String: ${Fl(r,a)}.`)}throw ci(r.source,a,"Unterminated string.")}function EP(r,e){const t=r.source.body,n=t.length;let i=e+1;for(;i<n;){const a=t.charCodeAt(i);if(fP(a))++i;else break}return ni(r,Re.NAME,e,i,t.slice(e,i))}const kP=10,O2=2;function SA(r){return Pg(r,[])}function Pg(r,e){switch(typeof r){case"string":return JSON.stringify(r);case"function":return r.name?`[function ${r.name}]`:"[function]";case"object":return FP(r,e);default:return String(r)}}function FP(r,e){if(r===null)return"null";if(e.includes(r))return"[Circular]";const t=[...e,r];if(TP(r)){const n=r.toJSON();if(n!==r)return typeof n=="string"?n:Pg(n,t)}else if(Array.isArray(r))return DP(r,t);return IP(r,t)}function TP(r){return typeof r.toJSON=="function"}function IP(r,e){const t=Object.entries(r);return t.length===0?"{}":e.length>O2?"["+PP(r)+"]":"{ "+t.map(([i,a])=>i+": "+Pg(a,e)).join(", ")+" }"}function DP(r,e){if(r.length===0)return"[]";if(e.length>O2)return"[Array]";const t=Math.min(kP,r.length),n=r.length-t,i=[];for(let a=0;a<t;++a)i.push(Pg(r[a],e));return n===1?i.push("... 1 more item"):n>1&&i.push(`... ${n} more items`),"["+i.join(", ")+"]"}function PP(r){const e=Object.prototype.toString.call(r).replace(/^\[object /,"").replace(/]$/,"");if(e==="Object"&&typeof r.constructor=="function"){const t=r.constructor.name;if(typeof t=="string"&&t!=="")return t}return e}const RP=globalThis.process&&process.env.NODE_ENV==="production",OP=RP?function(e,t){return e instanceof t}:function(e,t){if(e instanceof t)return!0;if(typeof e=="object"&&e!==null){var n;const i=t.prototype[Symbol.toStringTag],a=Symbol.toStringTag in e?e[Symbol.toStringTag]:(n=e.constructor)===null||n===void 0?void 0:n.name;if(i===a){const s=SA(e);throw new Error(`Cannot use ${i} "${s}" from another module or realm. Ensure that there is only one instance of "graphql" in the node_modules directory. If different versions of "graphql" are the dependencies of other relied on modules, use "resolutions" to ensure only one version is installed. https://yarnpkg.com/en/docs/selective-version-resolutions Duplicate "graphql" modules cannot be used at the same time since different versions may have different capabilities and behavior. The data from one version used in the function from another could produce confusing and spurious results.`)}}return!1};class B2{constructor(e,t="GraphQL request",n={line:1,column:1}){typeof e=="string"||Vp(!1,`Body must be a string. Received: ${SA(e)}.`),this.body=e,this.name=t,this.locationOffset=n,this.locationOffset.line>0||Vp(!1,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||Vp(!1,"column in locationOffset is 1-indexed and must be positive.")}get[Symbol.toStringTag](){return"Source"}}function BP(r){return OP(r,B2)}function MP(r,e){const t=new _P(r,e),n=t.parseDocument();return Object.defineProperty(n,"tokenCount",{enumerable:!1,value:t.tokenCount}),n}let _P=class{constructor(e,t={}){const{lexer:n,...i}=t;if(n)this._lexer=n;else{const a=BP(e)?e:new B2(e);this._lexer=new gP(a)}this._options=i,this._tokenCounter=0}get tokenCount(){return this._tokenCounter}parseName(){const e=this.expectToken(Re.NAME);return this.node(e,{kind:et.NAME,value:e.value})}parseDocument(){return this.node(this._lexer.token,{kind:et.DOCUMENT,definitions:this.many(Re.SOF,this.parseDefinition,Re.EOF)})}parseDefinition(){if(this.peek(Re.BRACE_L))return this.parseOperationDefinition();const e=this.peekDescription(),t=e?this._lexer.lookahead():this._lexer.token;if(e&&t.kind===Re.BRACE_L)throw ci(this._lexer.source,this._lexer.token.start,"Unexpected description, descriptions are not supported on shorthand queries.");if(t.kind===Re.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()}switch(t.value){case"query":case"mutation":case"subscription":return this.parseOperationDefinition();case"fragment":return this.parseFragmentDefinition()}if(e)throw ci(this._lexer.source,this._lexer.token.start,"Unexpected description, only GraphQL definitions support descriptions.");if(t.value==="extend")return this.parseTypeSystemExtension()}throw this.unexpected(t)}parseOperationDefinition(){const e=this._lexer.token;if(this.peek(Re.BRACE_L))return this.node(e,{kind:et.OPERATION_DEFINITION,operation:Bu.QUERY,description:void 0,name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet()});const t=this.parseDescription(),n=this.parseOperationType();let i;return this.peek(Re.NAME)&&(i=this.parseName()),this.node(e,{kind:et.OPERATION_DEFINITION,operation:n,description:t,name:i,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseOperationType(){const e=this.expectToken(Re.NAME);switch(e.value){case"query":return Bu.QUERY;case"mutation":return Bu.MUTATION;case"subscription":return Bu.SUBSCRIPTION}throw this.unexpected(e)}parseVariableDefinitions(){return this.optionalMany(Re.PAREN_L,this.parseVariableDefinition,Re.PAREN_R)}parseVariableDefinition(){return this.node(this._lexer.token,{kind:et.VARIABLE_DEFINITION,description:this.parseDescription(),variable:this.parseVariable(),type:(this.expectToken(Re.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(Re.EQUALS)?this.parseConstValueLiteral():void 0,directives:this.parseConstDirectives()})}parseVariable(){const e=this._lexer.token;return this.expectToken(Re.DOLLAR),this.node(e,{kind:et.VARIABLE,name:this.parseName()})}parseSelectionSet(){return this.node(this._lexer.token,{kind:et.SELECTION_SET,selections:this.many(Re.BRACE_L,this.parseSelection,Re.BRACE_R)})}parseSelection(){return this.peek(Re.SPREAD)?this.parseFragment():this.parseField()}parseField(){const e=this._lexer.token,t=this.parseName();let n,i;return this.expectOptionalToken(Re.COLON)?(n=t,i=this.parseName()):i=t,this.node(e,{kind:et.FIELD,alias:n,name:i,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(Re.BRACE_L)?this.parseSelectionSet():void 0})}parseArguments(e){const t=e?this.parseConstArgument:this.parseArgument;return this.optionalMany(Re.PAREN_L,t,Re.PAREN_R)}parseArgument(e=!1){const t=this._lexer.token,n=this.parseName();return this.expectToken(Re.COLON),this.node(t,{kind:et.ARGUMENT,name:n,value:this.parseValueLiteral(e)})}parseConstArgument(){return this.parseArgument(!0)}parseFragment(){const e=this._lexer.token;this.expectToken(Re.SPREAD);const t=this.expectOptionalKeyword("on");return!t&&this.peek(Re.NAME)?this.node(e,{kind:et.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1)}):this.node(e,{kind:et.INLINE_FRAGMENT,typeCondition:t?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentDefinition(){const e=this._lexer.token,t=this.parseDescription();return this.expectKeyword("fragment"),this._options.allowLegacyFragmentVariables===!0?this.node(e,{kind:et.FRAGMENT_DEFINITION,description:t,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()}):this.node(e,{kind:et.FRAGMENT_DEFINITION,description:t,name:this.parseFragmentName(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentName(){if(this._lexer.token.value==="on")throw this.unexpected();return this.parseName()}parseValueLiteral(e){const t=this._lexer.token;switch(t.kind){case Re.BRACKET_L:return this.parseList(e);case Re.BRACE_L:return this.parseObject(e);case Re.INT:return this.advanceLexer(),this.node(t,{kind:et.INT,value:t.value});case Re.FLOAT:return this.advanceLexer(),this.node(t,{kind:et.FLOAT,value:t.value});case Re.STRING:case Re.BLOCK_STRING:return this.parseStringLiteral();case Re.NAME:switch(this.advanceLexer(),t.value){case"true":return this.node(t,{kind:et.BOOLEAN,value:!0});case"false":return this.node(t,{kind:et.BOOLEAN,value:!1});case"null":return this.node(t,{kind:et.NULL});default:return this.node(t,{kind:et.ENUM,value:t.value})}case Re.DOLLAR:if(e)if(this.expectToken(Re.DOLLAR),this._lexer.token.kind===Re.NAME){const n=this._lexer.token.value;throw ci(this._lexer.source,t.start,`Unexpected variable "$${n}" in constant value.`)}else 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:et.STRING,value:e.value,block:e.kind===Re.BLOCK_STRING})}parseList(e){const t=()=>this.parseValueLiteral(e);return this.node(this._lexer.token,{kind:et.LIST,values:this.any(Re.BRACKET_L,t,Re.BRACKET_R)})}parseObject(e){const t=()=>this.parseObjectField(e);return this.node(this._lexer.token,{kind:et.OBJECT,fields:this.any(Re.BRACE_L,t,Re.BRACE_R)})}parseObjectField(e){const t=this._lexer.token,n=this.parseName();return this.expectToken(Re.COLON),this.node(t,{kind:et.OBJECT_FIELD,name:n,value:this.parseValueLiteral(e)})}parseDirectives(e){const t=[];for(;this.peek(Re.AT);)t.push(this.parseDirective(e));return t}parseConstDirectives(){return this.parseDirectives(!0)}parseDirective(e){const t=this._lexer.token;return this.expectToken(Re.AT),this.node(t,{kind:et.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(e)})}parseTypeReference(){const e=this._lexer.token;let t;if(this.expectOptionalToken(Re.BRACKET_L)){const n=this.parseTypeReference();this.expectToken(Re.BRACKET_R),t=this.node(e,{kind:et.LIST_TYPE,type:n})}else t=this.parseNamedType();return this.expectOptionalToken(Re.BANG)?this.node(e,{kind:et.NON_NULL_TYPE,type:t}):t}parseNamedType(){return this.node(this._lexer.token,{kind:et.NAMED_TYPE,name:this.parseName()})}peekDescription(){return this.peek(Re.STRING)||this.peek(Re.BLOCK_STRING)}parseDescription(){if(this.peekDescription())return this.parseStringLiteral()}parseSchemaDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("schema");const n=this.parseConstDirectives(),i=this.many(Re.BRACE_L,this.parseOperationTypeDefinition,Re.BRACE_R);return this.node(e,{kind:et.SCHEMA_DEFINITION,description:t,directives:n,operationTypes:i})}parseOperationTypeDefinition(){const e=this._lexer.token,t=this.parseOperationType();this.expectToken(Re.COLON);const n=this.parseNamedType();return this.node(e,{kind:et.OPERATION_TYPE_DEFINITION,operation:t,type:n})}parseScalarTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("scalar");const n=this.parseName(),i=this.parseConstDirectives();return this.node(e,{kind:et.SCALAR_TYPE_DEFINITION,description:t,name:n,directives:i})}parseObjectTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("type");const n=this.parseName(),i=this.parseImplementsInterfaces(),a=this.parseConstDirectives(),s=this.parseFieldsDefinition();return this.node(e,{kind:et.OBJECT_TYPE_DEFINITION,description:t,name:n,interfaces:i,directives:a,fields:s})}parseImplementsInterfaces(){return this.expectOptionalKeyword("implements")?this.delimitedMany(Re.AMP,this.parseNamedType):[]}parseFieldsDefinition(){return this.optionalMany(Re.BRACE_L,this.parseFieldDefinition,Re.BRACE_R)}parseFieldDefinition(){const e=this._lexer.token,t=this.parseDescription(),n=this.parseName(),i=this.parseArgumentDefs();this.expectToken(Re.COLON);const a=this.parseTypeReference(),s=this.parseConstDirectives();return this.node(e,{kind:et.FIELD_DEFINITION,description:t,name:n,arguments:i,type:a,directives:s})}parseArgumentDefs(){return this.optionalMany(Re.PAREN_L,this.parseInputValueDef,Re.PAREN_R)}parseInputValueDef(){const e=this._lexer.token,t=this.parseDescription(),n=this.parseName();this.expectToken(Re.COLON);const i=this.parseTypeReference();let a;this.expectOptionalToken(Re.EQUALS)&&(a=this.parseConstValueLiteral());const s=this.parseConstDirectives();return this.node(e,{kind:et.INPUT_VALUE_DEFINITION,description:t,name:n,type:i,defaultValue:a,directives:s})}parseInterfaceTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("interface");const n=this.parseName(),i=this.parseImplementsInterfaces(),a=this.parseConstDirectives(),s=this.parseFieldsDefinition();return this.node(e,{kind:et.INTERFACE_TYPE_DEFINITION,description:t,name:n,interfaces:i,directives:a,fields:s})}parseUnionTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("union");const n=this.parseName(),i=this.parseConstDirectives(),a=this.parseUnionMemberTypes();return this.node(e,{kind:et.UNION_TYPE_DEFINITION,description:t,name:n,directives:i,types:a})}parseUnionMemberTypes(){return this.expectOptionalToken(Re.EQUALS)?this.delimitedMany(Re.PIPE,this.parseNamedType):[]}parseEnumTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("enum");const n=this.parseName(),i=this.parseConstDirectives(),a=this.parseEnumValuesDefinition();return this.node(e,{kind:et.ENUM_TYPE_DEFINITION,description:t,name:n,directives:i,values:a})}parseEnumValuesDefinition(){return this.optionalMany(Re.BRACE_L,this.parseEnumValueDefinition,Re.BRACE_R)}parseEnumValueDefinition(){const e=this._lexer.token,t=this.parseDescription(),n=this.parseEnumValueName(),i=this.parseConstDirectives();return this.node(e,{kind:et.ENUM_VALUE_DEFINITION,description:t,name:n,directives:i})}parseEnumValueName(){if(this._lexer.token.value==="true"||this._lexer.token.value==="false"||this._lexer.token.value==="null")throw ci(this._lexer.source,this._lexer.token.start,`${Qh(this._lexer.token)} is reserved and cannot be used for an enum value.`);return this.parseName()}parseInputObjectTypeDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("input");const n=this.parseName(),i=this.parseConstDirectives(),a=this.parseInputFieldsDefinition();return this.node(e,{kind:et.INPUT_OBJECT_TYPE_DEFINITION,description:t,name:n,directives:i,fields:a})}parseInputFieldsDefinition(){return this.optionalMany(Re.BRACE_L,this.parseInputValueDef,Re.BRACE_R)}parseTypeSystemExtension(){const e=this._lexer.lookahead();if(e.kind===Re.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(Re.BRACE_L,this.parseOperationTypeDefinition,Re.BRACE_R);if(t.length===0&&n.length===0)throw this.unexpected();return this.node(e,{kind:et.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(n.length===0)throw this.unexpected();return this.node(e,{kind:et.SCALAR_TYPE_EXTENSION,name:t,directives:n})}parseObjectTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");const t=this.parseName(),n=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),a=this.parseFieldsDefinition();if(n.length===0&&i.length===0&&a.length===0)throw this.unexpected();return this.node(e,{kind:et.OBJECT_TYPE_EXTENSION,name:t,interfaces:n,directives:i,fields:a})}parseInterfaceTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");const t=this.parseName(),n=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),a=this.parseFieldsDefinition();if(n.length===0&&i.length===0&&a.length===0)throw this.unexpected();return this.node(e,{kind:et.INTERFACE_TYPE_EXTENSION,name:t,interfaces:n,directives:i,fields:a})}parseUnionTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");const t=this.parseName(),n=this.parseConstDirectives(),i=this.parseUnionMemberTypes();if(n.length===0&&i.length===0)throw this.unexpected();return this.node(e,{kind:et.UNION_TYPE_EXTENSION,name:t,directives:n,types:i})}parseEnumTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");const t=this.parseName(),n=this.parseConstDirectives(),i=this.parseEnumValuesDefinition();if(n.length===0&&i.length===0)throw this.unexpected();return this.node(e,{kind:et.ENUM_TYPE_EXTENSION,name:t,directives:n,values:i})}parseInputObjectTypeExtension(){const e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");const t=this.parseName(),n=this.parseConstDirectives(),i=this.parseInputFieldsDefinition();if(n.length===0&&i.length===0)throw this.unexpected();return this.node(e,{kind:et.INPUT_OBJECT_TYPE_EXTENSION,name:t,directives:n,fields:i})}parseDirectiveDefinition(){const e=this._lexer.token,t=this.parseDescription();this.expectKeyword("directive"),this.expectToken(Re.AT);const n=this.parseName(),i=this.parseArgumentDefs(),a=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");const s=this.parseDirectiveLocations();return this.node(e,{kind:et.DIRECTIVE_DEFINITION,description:t,name:n,arguments:i,repeatable:a,locations:s})}parseDirectiveLocations(){return this.delimitedMany(Re.PIPE,this.parseDirectiveLocation)}parseDirectiveLocation(){const e=this._lexer.token,t=this.parseName();if(Object.prototype.hasOwnProperty.call(sy,t.value))return t;throw this.unexpected(e)}parseSchemaCoordinate(){const e=this._lexer.token,t=this.expectOptionalToken(Re.AT),n=this.parseName();let i;!t&&this.expectOptionalToken(Re.DOT)&&(i=this.parseName());let a;return(t||i)&&this.expectOptionalToken(Re.PAREN_L)&&(a=this.parseName(),this.expectToken(Re.COLON),this.expectToken(Re.PAREN_R)),t?a?this.node(e,{kind:et.DIRECTIVE_ARGUMENT_COORDINATE,name:n,argumentName:a}):this.node(e,{kind:et.DIRECTIVE_COORDINATE,name:n}):i?a?this.node(e,{kind:et.ARGUMENT_COORDINATE,name:n,fieldName:i,argumentName:a}):this.node(e,{kind:et.MEMBER_COORDINATE,name:n,memberName:i}):this.node(e,{kind:et.TYPE_COORDINATE,name:n})}node(e,t){return this._options.noLocation!==!0&&(t.loc=new uP(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 ci(this._lexer.source,t.start,`Expected ${M2(e)}, found ${Qh(t)}.`)}expectOptionalToken(e){return this._lexer.token.kind===e?(this.advanceLexer(),!0):!1}expectKeyword(e){const t=this._lexer.token;if(t.kind===Re.NAME&&t.value===e)this.advanceLexer();else throw ci(this._lexer.source,t.start,`Expected "${e}", found ${Qh(t)}.`)}expectOptionalKeyword(e){const t=this._lexer.token;return t.kind===Re.NAME&&t.value===e?(this.advanceLexer(),!0):!1}unexpected(e){const t=e??this._lexer.token;return ci(this._lexer.source,t.start,`Unexpected ${Qh(t)}.`)}any(e,t,n){this.expectToken(e);const i=[];for(;!this.expectOptionalToken(n);)i.push(t.call(this));return i}optionalMany(e,t,n){if(this.expectOptionalToken(e)){const i=[];do i.push(t.call(this));while(!this.expectOptionalToken(n));return i}return[]}many(e,t,n){this.expectToken(e);const i=[];do i.push(t.call(this));while(!this.expectOptionalToken(n));return i}delimitedMany(e,t){this.expectOptionalToken(e);const n=[];do n.push(t.call(this));while(this.expectOptionalToken(e));return n}advanceLexer(){const{maxTokens:e}=this._options,t=this._lexer.advance();if(t.kind!==Re.EOF&&(++this._tokenCounter,e!==void 0&&this._tokenCounter>e))throw ci(this._lexer.source,t.start,`Document contains more that ${e} tokens. Parsing aborted.`)}};function Qh(r){const e=r.value;return M2(r.kind)+(e!=null?` "${e}"`:"")}function M2(r){return mP(r)?`"${r}"`:r}function NP(r){return`"${r.replace(LP,UP)}"`}const LP=/[\x00-\x1f\x22\x5c\x7f-\x9f]/g;function UP(r){return VP[r.charCodeAt(0)]}const VP=["\\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"],EA=Object.freeze({});function Oa(r,e,t=T2){const n=new Map;for(const A of Object.values(et))n.set(A,zP(e,A));let i,a=Array.isArray(r),s=[r],o=-1,l=[],u=r,c,h;const f=[],d=[];do{o++;const A=o===s.length,C=A&&l.length!==0;if(A){if(c=d.length===0?void 0:f[f.length-1],u=h,h=d.pop(),C)if(a){u=u.slice();let T=0;for(const[S,R]of l){const B=S-T;R===null?(u.splice(B,1),T++):u[B]=R}}else{u={...u};for(const[T,S]of l)u[T]=S}o=i.index,s=i.keys,l=i.edits,a=i.inArray,i=i.prev}else if(h){if(c=a?o:s[o],u=h[c],u==null)continue;f.push(c)}let k;if(!Array.isArray(u)){var g,v;nw(u)||Vp(!1,`Invalid AST Node: ${SA(u)}.`);const T=A?(g=n.get(u.kind))===null||g===void 0?void 0:g.leave:(v=n.get(u.kind))===null||v===void 0?void 0:v.enter;if(k=T?.call(e,u,c,h,f,d),k===EA)break;if(k===!1){if(!A){f.pop();continue}}else if(k!==void 0&&(l.push([c,k]),!A))if(nw(k))u=k;else{f.pop();continue}}if(k===void 0&&C&&l.push([c,u]),A)f.pop();else{var y;i={inArray:a,index:o,keys:s,edits:l,prev:i},a=Array.isArray(u),s=a?u:(y=t[u.kind])!==null&&y!==void 0?y:[],o=-1,l=[],h&&d.push(h),h=u}}while(i!==void 0);return l.length!==0?l[l.length-1][1]:r}function zP(r,e){const t=r[e];return typeof t=="object"?t:typeof t=="function"?{enter:t,leave:void 0}:{enter:r.enter,leave:r.leave}}function HP(r){return Oa(r,GP)}const jP=80,GP={Name:{leave:r=>r.value},Variable:{leave:r=>"$"+r.name},Document:{leave:r=>ut(r.definitions,` `)},OperationDefinition:{leave(r){const e=r0(r.variableDefinitions)?tr(`( `,ut(r.variableDefinitions,` `),` )`):tr("(",ut(r.variableDefinitions,", "),")"),t=tr("",r.description,` `)+ut([r.operation,ut([r.name,e]),ut(r.directives," ")]," ");return(t==="query"?"":t+" ")+r.selectionSet}},VariableDefinition:{leave:({variable:r,type:e,defaultValue:t,directives:n,description:i})=>tr("",i,` `)+r+": "+e+tr(" = ",t)+tr(" ",ut(n," "))},SelectionSet:{leave:({selections:r})=>ka(r)},Field:{leave({alias:r,name:e,arguments:t,directives:n,selectionSet:i}){const a=tr("",r,": ")+e;let s=a+tr("(",ut(t,", "),")");return s.length>jP&&(s=a+tr(`( `,zp(ut(t,` `)),` )`)),ut([s,ut(n," "),i]," ")}},Argument:{leave:({name:r,value:e})=>r+": "+e},FragmentSpread:{leave:({name:r,directives:e})=>"..."+r+tr(" ",ut(e," "))},InlineFragment:{leave:({typeCondition:r,directives:e,selectionSet:t})=>ut(["...",tr("on ",r),ut(e," "),t]," ")},FragmentDefinition:{leave:({name:r,typeCondition:e,variableDefinitions:t,directives:n,selectionSet:i,description:a})=>tr("",a,` `)+`fragment ${r}${tr("(",ut(t,", "),")")} on ${e} ${tr("",ut(n," ")," ")}`+i},IntValue:{leave:({value:r})=>r},FloatValue:{leave:({value:r})=>r},StringValue:{leave:({value:r,block:e})=>e?pP(r):NP(r)},BooleanValue:{leave:({value:r})=>r?"true":"false"},NullValue:{leave:()=>"null"},EnumValue:{leave:({value:r})=>r},ListValue:{leave:({values:r})=>"["+ut(r,", ")+"]"},ObjectValue:{leave:({fields:r})=>"{"+ut(r,", ")+"}"},ObjectField:{leave:({name:r,value:e})=>r+": "+e},Directive:{leave:({name:r,arguments:e})=>"@"+r+tr("(",ut(e,", "),")")},NamedType:{leave:({name:r})=>r},ListType:{leave:({type:r})=>"["+r+"]"},NonNullType:{leave:({type:r})=>r+"!"},SchemaDefinition:{leave:({description:r,directives:e,operationTypes:t})=>tr("",r,` `)+ut(["schema",ut(e," "),ka(t)]," ")},OperationTypeDefinition:{leave:({operation:r,type:e})=>r+": "+e},ScalarTypeDefinition:{leave:({description:r,name:e,directives:t})=>tr("",r,` `)+ut(["scalar",e,ut(t," ")]," ")},ObjectTypeDefinition:{leave:({description:r,name:e,interfaces:t,directives:n,fields:i})=>tr("",r,` `)+ut(["type",e,tr("implements ",ut(t," & ")),ut(n," "),ka(i)]," ")},FieldDefinition:{leave:({description:r,name:e,arguments:t,type:n,directives:i})=>tr("",r,` `)+e+(r0(t)?tr(`( `,zp(ut(t,` `)),` )`):tr("(",ut(t,", "),")"))+": "+n+tr(" ",ut(i," "))},InputValueDefinition:{leave:({description:r,name:e,type:t,defaultValue:n,directives:i})=>tr("",r,` `)+ut([e+": "+t,tr("= ",n),ut(i," ")]," ")},InterfaceTypeDefinition:{leave:({description:r,name:e,interfaces:t,directives:n,fields:i})=>tr("",r,` `)+ut(["interface",e,tr("implements ",ut(t," & ")),ut(n," "),ka(i)]," ")},UnionTypeDefinition:{leave:({description:r,name:e,directives:t,types:n})=>tr("",r,` `)+ut(["union",e,ut(t," "),tr("= ",ut(n," | "))]," ")},EnumTypeDefinition:{leave:({description:r,name:e,directives:t,values:n})=>tr("",r,` `)+ut(["enum",e,ut(t," "),ka(n)]," ")},EnumValueDefinition:{leave:({description:r,name:e,directives:t})=>tr("",r,` `)+ut([e,ut(t," ")]," ")},InputObjectTypeDefinition:{leave:({description:r,name:e,directives:t,fields:n})=>tr("",r,` `)+ut(["input",e,ut(t," "),ka(n)]," ")},DirectiveDefinition:{leave:({description:r,name:e,arguments:t,repeatable:n,locations:i})=>tr("",r,` `)+"directive @"+e+(r0(t)?tr(`( `,zp(ut(t,` `)),` )`):tr("(",ut(t,", "),")"))+(n?" repeatable":"")+" on "+ut(i," | ")},SchemaExtension:{leave:({directives:r,operationTypes:e})=>ut(["extend schema",ut(r," "),ka(e)]," ")},ScalarTypeExtension:{leave:({name:r,directives:e})=>ut(["extend scalar",r,ut(e," ")]," ")},ObjectTypeExtension:{leave:({name:r,interfaces:e,directives:t,fields:n})=>ut(["extend type",r,tr("implements ",ut(e," & ")),ut(t," "),ka(n)]," ")},InterfaceTypeExtension:{leave:({name:r,interfaces:e,directives:t,fields:n})=>ut(["extend interface",r,tr("implements ",ut(e," & ")),ut(t," "),ka(n)]," ")},UnionTypeExtension:{leave:({name:r,directives:e,types:t})=>ut(["extend union",r,ut(e," "),tr("= ",ut(t," | "))]," ")},EnumTypeExtension:{leave:({name:r,directives:e,values:t})=>ut(["extend enum",r,ut(e," "),ka(t)]," ")},InputObjectTypeExtension:{leave:({name:r,directives:e,fields:t})=>ut(["extend input",r,ut(e," "),ka(t)]," ")},TypeCoordinate:{leave:({name:r})=>r},MemberCoordinate:{leave:({name:r,memberName:e})=>ut([r,tr(".",e)])},ArgumentCoordinate:{leave:({name:r,fieldName:e,argumentName:t})=>ut([r,tr(".",e),tr("(",t,":)")])},DirectiveCoordinate:{leave:({name:r})=>ut(["@",r])},DirectiveArgumentCoordinate:{leave:({name:r,argumentName:e})=>ut(["@",r,tr("(",e,":)")])}};function ut(r,e=""){var t;return(t=r?.filter(n=>n).join(e))!==null&&t!==void 0?t:""}function ka(r){return tr(`{ `,zp(ut(r,` `)),` }`)}function tr(r,e,t=""){return e!=null&&e!==""?r+e+t:""}function zp(r){return tr(" ",r.replace(/\n/g,` `))}function r0(r){var e;return(e=r?.some(t=>t.includes(` `)))!==null&&e!==void 0?e:!1}function aw(r){return r.kind===et.FIELD||r.kind===et.FRAGMENT_SPREAD||r.kind===et.INLINE_FRAGMENT}function zd(r,e){var t=r.directives;return!t||!t.length?!0:WP(t).every(function(n){var i=n.directive,a=n.ifArgument,s=!1;return a.value.kind==="Variable"?(s=e&&e[a.value.name.value],Mr(s!==void 0,105,i.name.value)):s=a.value.value,i.name.value==="skip"?!s:s})}function md(r,e,t){var n=new Set(r),i=n.size;return Oa(e,{Directive:function(a){if(n.delete(a.name.value)&&(!t||!n.size))return EA}}),t?!n.size:n.size<i}function $P(r){return r&&md(["client","export"],r,!0)}function qP(r){var e=r.name.value;return e==="skip"||e==="include"}function WP(r){var e=[];return r&&r.length&&r.forEach(function(t){if(qP(t)){var n=t.arguments,i=t.name.value;Mr(n&&n.length===1,106,i);var a=n[0];Mr(a.name&&a.name.value==="if",107,i);var s=a.value;Mr(s&&(s.kind==="Variable"||s.kind==="BooleanValue"),108,i),e.push({directive:t,ifArgument:a})}}),e}function QP(r){var e,t,n=(e=r.directives)===null||e===void 0?void 0:e.find(function(a){var s=a.name;return s.value==="unmask"});if(!n)return"mask";var i=(t=n.arguments)===null||t===void 0?void 0:t.find(function(a){var s=a.name;return s.value==="mode"});return i&&"value"in i.value&&i.value.value==="migrate"?"migrate":"unmask"}const YP=()=>Object.create(null),{forEach:XP,slice:sw}=Array.prototype,{hasOwnProperty:JP}=Object.prototype;class Vs{constructor(e=!0,t=YP){this.weakness=e,this.makeData=t}lookup(){return this.lookupArray(arguments)}lookupArray(e){let t=this;return XP.call(e,n=>t=t.getChildTrie(n)),JP.call(t,"data")?t.data:t.data=this.makeData(sw.call(e))}peek(){return this.peekArray(arguments)}peekArray(e){let t=this;for(let n=0,i=e.length;t&&n<i;++n){const a=t.mapFor(e[n],!1);t=a&&a.get(e[n])}return t&&t.data}remove(){return this.removeArray(arguments)}removeArray(e){let t;if(e.length){const n=e[0],i=this.mapFor(n,!1),a=i&&i.get(n);a&&(t=a.removeArray(sw.call(e,1)),!a.data&&!a.weak&&!(a.strong&&a.strong.size)&&i.delete(n))}else t=this.data,delete this.