prettier 3.10.0 → 3.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs +1 -1
- package/index.mjs +1 -1
- package/internal/experimental-cli.mjs +1 -1
- package/package.json +1 -1
- package/plugins/graphql.js +8 -8
- package/plugins/graphql.mjs +8 -8
- package/standalone.js +1 -1
- package/standalone.mjs +1 -1
package/index.cjs
CHANGED
package/index.mjs
CHANGED
|
@@ -20036,7 +20036,7 @@ var get_file_info_default = getFileInfo;
|
|
|
20036
20036
|
import * as doc from "./doc.mjs";
|
|
20037
20037
|
|
|
20038
20038
|
// src/main/version.evaluate.js
|
|
20039
|
-
var version_evaluate_default = "3.10.
|
|
20039
|
+
var version_evaluate_default = "3.10.1";
|
|
20040
20040
|
|
|
20041
20041
|
// src/utilities/public.js
|
|
20042
20042
|
var public_exports = {};
|
package/package.json
CHANGED
package/plugins/graphql.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
(function(f){function e(){var i=f();return i.default||i}if(typeof exports=="object"&&typeof module=="object")module.exports=e();else if(typeof define=="function"&&define.amd)define(e);else{var t=typeof globalThis<"u"?globalThis:typeof global<"u"?global:typeof self<"u"?self:this||{};t.prettierPlugins=t.prettierPlugins||{},t.prettierPlugins.graphql=e()}})(function(){"use strict";var
|
|
1
|
+
(function(f){function e(){var i=f();return i.default||i}if(typeof exports=="object"&&typeof module=="object")module.exports=e();else if(typeof define=="function"&&define.amd)define(e);else{var t=typeof globalThis<"u"?globalThis:typeof global<"u"?global:typeof self<"u"?self:this||{};t.prettierPlugins=t.prettierPlugins||{},t.prettierPlugins.graphql=e()}})(function(){"use strict";var de=Object.defineProperty;var At=Object.getOwnPropertyDescriptor;var St=Object.getOwnPropertyNames;var gt=Object.prototype.hasOwnProperty;var fe=(e,t)=>{for(var n in t)de(e,n,{get:t[n],enumerable:!0})},It=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of St(t))!gt.call(e,i)&&i!==n&&de(e,i,{get:()=>t[i],enumerable:!(r=At(t,i))||r.enumerable});return e};var Ot=e=>It(de({},"__esModule",{value:!0}),e);var yi={};fe(yi,{languages:()=>et,options:()=>nt,parsers:()=>Oe,printers:()=>xi});var Ce=(e,t)=>(n,r,...i)=>n|1&&r==null?void 0:(t.call(r)??r[e]).apply(r,i);var Ct=String.prototype.replaceAll??function(e,t){return e.global?this.replace(e,t):this.split(e).join(t)},vt=Ce("replaceAll",function(){if(typeof this=="string")return Ct}),Y=vt;var kt=()=>{},me=kt;var ve="indent";var ke="group";var Re="if-break";var J="line";var Le="break-parent";function be(e,t,n){if(!e.has(t)){let r=n(t);e.set(t,r)}return e.get(t)}var k=me,z=me;function E(e){return k(e),{type:ve,contents:e}}var he={type:Le};function S(e,t={}){return k(e),z(t.expandedStates,!0),{type:ke,id:t.id,contents:e,break:!!t.shouldBreak,expandedStates:t.expandedStates}}function O(e,t="",n={}){return k(e),t!==""&&k(t),{type:Re,breakContents:e,flatContents:t,groupId:n.groupId}}function m(e,t){k(e),z(t);let n=[];for(let r=0;r<t.length;r++)r!==0&&n.push(e),n.push(t[r]);return n}var C={type:J},y={type:J,soft:!0},Rt={type:J,hard:!0},u=[Rt,he];function Z(e){return(t,n,r)=>{if(n===!1)return!1;let i=!!r?.backwards,{length:s}=t,a=n;for(;a>=0&&a<s;){let p=t.charAt(a);if(e instanceof RegExp){if(!e.test(p))return a}else if(!e.includes(p))return a;i?a--:a++}return a===-1||a===s?a:!1}}var qi=Z(/\s/),b=Z(" "),Fe=Z(",; "),Pe=Z(/[^\n\r]/);var we=e=>e===`
|
|
2
2
|
`||e==="\r"||e==="\u2028"||e==="\u2029";function Lt(e,t,n){if(t===!1)return!1;let r=!!n?.backwards,i=e.charAt(t);if(r){if(e.charAt(t-1)==="\r"&&i===`
|
|
3
3
|
`)return t-2;if(we(i))return t-1}else{if(i==="\r"&&e.charAt(t+1)===`
|
|
4
|
-
`)return t+2;if(we(i))return t+1}return t}var F=Lt;function bt(e,t,n={}){let r=b(e,n.backwards?t-1:t,n),i=F(e,r,n);return r!==i}var Ve=bt;function Ft(e,t){let n=t-1;n=b(e,n,{backwards:!0}),n=F(e,n,{backwards:!0}),n=b(e,n,{backwards:!0});let r=F(e,n,{backwards:!0});return n!==r}var Me=Ft;var Pt=()=>!0;function wt(e,t){let n=e.node;return n.printed=!0,t.printer.printComment(e,t)}function
|
|
4
|
+
`)return t+2;if(we(i))return t+1}return t}var F=Lt;function bt(e,t,n={}){let r=b(e,n.backwards?t-1:t,n),i=F(e,r,n);return r!==i}var Ve=bt;function Ft(e,t){let n=t-1;n=b(e,n,{backwards:!0}),n=F(e,n,{backwards:!0}),n=b(e,n,{backwards:!0});let r=F(e,n,{backwards:!0});return n!==r}var Me=Ft;var Pt=()=>!0;function wt(e,t){let n=e.node;return n.printed=!0,t.printer.printComment(e,t)}function q(e,t,n={}){let{originalText:r,locStart:i}=t,{indent:s=!1,marker:a,filter:p=Pt,separator:d=({comment:f})=>Me(r,i(f))?[u,u]:u}=n,x=new Set(e.node?.comments?.filter(f=>!(f.leading||f.trailing||f.marker!==a||!p(f))));if(x.size===0)return"";let D=[],I;return e.each(({node:f})=>{x.has(f)&&(I&&D.push(typeof d=="function"?d({previous:I,comment:f}):d),D.push(wt(e,t)),I=f)},"comments"),s?E([u,D]):D}function Vt(e){return Array.isArray(e)&&e.length>0}var N=Vt;var Ee=class extends Error{name="UnexpectedNodeError";constructor(t,n,r="type"){super(`Unexpected ${n} node ${r}: ${JSON.stringify(t[r])}.`),this.node=t}},Be=Ee;var $=null;function Q(e){if($!==null&&typeof $.property){let t=$;return $=Q.prototype=null,t}return $=Q.prototype=e??Object.create(null),new Q}var Mt=10;for(let e=0;e<=Mt;e++)Q();function Te(e){return Q(e)}function Bt(e,t="type"){Te(e);function n(r){let i=r[t],s=e[i];if(!Array.isArray(s))throw Object.assign(new Error(`Missing visitor keys for '${i}'.`),{node:r});return s}return n}var Ue=Bt;var _=[["name"],["name","value"],["type"],["description","name","directives"],["description","name","interfaces","directives","fields"],["name","directives"],["name","interfaces","directives","fields"]],Ge={Name:[],Document:["definitions"],OperationDefinition:["description","name","variableDefinitions","directives","selectionSet"],VariableDefinition:["description","variable","type","defaultValue","directives"],Variable:_[0],SelectionSet:["selections"],Field:["alias","name","arguments","directives","selectionSet"],Argument:_[1],FragmentArgument:_[1],FragmentSpread:["name","arguments","directives"],InlineFragment:["typeCondition","directives","selectionSet"],FragmentDefinition:["description","name","variableDefinitions","typeCondition","directives","selectionSet"],IntValue:[],FloatValue:[],StringValue:[],BooleanValue:[],NullValue:[],EnumValue:[],ListValue:["values"],ObjectValue:["fields"],ObjectField:_[1],Directive:["name","arguments"],NamedType:_[0],ListType:_[2],NonNullType:_[2],SchemaDefinition:["description","directives","operationTypes"],OperationTypeDefinition:_[2],ScalarTypeDefinition:_[3],ObjectTypeDefinition:_[4],FieldDefinition:["description","name","arguments","type","directives"],InputValueDefinition:["description","name","type","defaultValue","directives"],InterfaceTypeDefinition:_[4],UnionTypeDefinition:["description","name","directives","types"],EnumTypeDefinition:["description","name","directives","values"],EnumValueDefinition:_[3],InputObjectTypeDefinition:["description","name","directives","fields"],DirectiveDefinition:["description","name","arguments","directives","locations"],SchemaExtension:["directives","operationTypes"],DirectiveExtension:_[5],ScalarTypeExtension:_[5],ObjectTypeExtension:_[6],InterfaceTypeExtension:_[6],UnionTypeExtension:["name","directives","types"],EnumTypeExtension:["name","directives","values"],InputObjectTypeExtension:["name","directives","fields"]};var Ut=Ue(Ge,"kind"),Ke=Ut;function xe(e,t){e.kind==="StringValue"&&e.block&&!e.value.includes(`
|
|
5
5
|
`)&&(t.value=e.value.trim())}xe.ignoredProperties=new Set(["loc","comments"]);var je="format",Ye=/^\s*#[^\S\n]*@(?:noformat|noprettier)\s*(?:\n|$)/,qe=/^\s*#[^\S\n]*@(?:format|prettier)\s*(?:\n|$)/;var $e=e=>qe.test(e),Qe=e=>Ye.test(e),Xe=e=>`# @${je}
|
|
6
6
|
|
|
7
|
-
${e}`;function Gt(e,t){if(t===!1)return!1;if(e.charAt(t)==="/"&&e.charAt(t+1)==="*"){for(let n=t+2;n<e.length;++n)if(e.charAt(n)==="*"&&e.charAt(n+1)==="/")return n+2}return t}var He=Gt;function Kt(e,t){return t===!1?!1:e.charAt(t)==="/"&&e.charAt(t+1)==="/"?Pe(e,t):t}var We=Kt;function jt(e,t){let n=null,r=t;for(;r!==n;)n=r,r=Fe(e,r),r=He(e,r),r=b(e,r);return r=We(e,r),r=F(e,r),r!==!1&&Ve(e,r)}var Je=jt;var
|
|
7
|
+
${e}`;function Gt(e,t){if(t===!1)return!1;if(e.charAt(t)==="/"&&e.charAt(t+1)==="*"){for(let n=t+2;n<e.length;++n)if(e.charAt(n)==="*"&&e.charAt(n+1)==="/")return n+2}return t}var He=Gt;function Kt(e,t){return t===!1?!1:e.charAt(t)==="/"&&e.charAt(t+1)==="/"?Pe(e,t):t}var We=Kt;function jt(e,t){let n=null,r=t;for(;r!==n;)n=r,r=Fe(e,r),r=He(e,r),r=b(e,r);return r=We(e,r),r=F(e,r),r!==!1&&Ve(e,r)}var Je=jt;var ee=e=>e.loc.start,te=e=>e.loc.end;function v(e,t,n,r){return e.map(({isLast:i,node:s})=>{let a=n();return!i&&Je(t.originalText,te(s))?[a,u]:a},r)}function M(e,t,n){let{node:r}=e;return N(r.arguments)?S(["(",E([y,m([O("",", "),y],v(e,t,n,"arguments"))]),y,")"]):""}function g(e,t,n){let{node:r}=e;if(!r.description)return"";let i=[n("description")];return r.kind==="InputValueDefinition"&&!r.description.block?i.push(C):i.push(u),i}function T(e,t){let{node:n}=e;if(!N(n.directives))return"";let r=m(C,e.map(t,"directives"));return n.kind==="FragmentDefinition"||n.kind==="OperationDefinition"?S([C,r]):[" ",S(E([y,r]))]}var Yt=new WeakMap,ne=(e,t)=>be(Yt,e,n=>t.originalText[ee(n)]!=="{");function ze(e,t,n){let{node:r}=e,i=["{"];if(r.selections.length>0)i.push(E([u,m(u,v(e,t,n,"selections"))]),u);else{let s=q(e,t,{indent:!0});s&&i.push(s,u)}return i.push("}"),i}function ie(e,t,n){let{node:r}=e,{selectionSet:i}=r;if(!i)return"";let s=n("selectionSet");return r.type==="OperationDefinition"&&r.name&&ne(r,t)?s:[" ",s]}function ye(e,t){let{node:n}=e;return N(n.variableDefinitions)?S(["(",E([y,m([O("",", "),y],e.map(t,"variableDefinitions"))]),y,")"]):""}function qt(e,t,n){let{node:r}=e;switch(r.kind){case"Document":return[...m(u,v(e,t,n,"definitions")),u];case"OperationDefinition":{let i=ne(r,t),s=!!r.name;return[g(e,t,n),i?r.operation:"",i&&s?[" ",n("name")]:"",i&&!s&&N(r.variableDefinitions)?" ":"",ye(e,n),T(e,n),!i&&!s?"":" ",n("selectionSet")]}case"FragmentDefinition":return[g(e,t,n),"fragment ",n("name"),ye(e,n)," on ",n("typeCondition"),T(e,n),ie(e,t,n)];case"SelectionSet":return ze(e,t,n);case"Field":return S([r.alias?[n("alias"),": "]:"",n("name"),M(e,t,n),T(e,n),ie(e,t,n)]);case"Name":return r.value;case"StringValue":if(r.block){let i=Y(0,r.value,'"""','\\"""').split(`
|
|
8
8
|
`);return i.length===1&&(i[0]=i[0].trim()),i.every(s=>s==="")&&(i.length=0),m(u,['"""',...i,'"""'])}return['"',Y(0,Y(0,Y(0,r.value,/["\\]/g,"\\$&"),"\r","\\r"),`
|
|
9
|
-
`,"\\n"),'"'];case"IntValue":case"FloatValue":case"EnumValue":return r.value;case"BooleanValue":return r.value?"true":"false";case"NullValue":return"null";case"Variable":return["$",n("name")];case"ListValue":{let i=!N(r.values);return S(["[",
|
|
10
|
-
`,D=r.split(/\r\n|[\n\r]/g),I=D[i];if(I.length>120){let f=[];for(let A=0;A<I.length;A+=80)f.push(I.slice(A,A+80));let j=d-1,R=Math.min(Math.floor(j/80),f.length-1),
|
|
11
|
-
`)}var L=class e extends Error{constructor(t,n={}){let{nodes:r,source:i,positions:s,path:a,originalError:p,cause:d,extensions:x}=n,D="cause"in n,I=D?d:p,f=D||p!=null?{cause:I}:void 0;super(t,f),this.name="GraphQLError",this.path=a??void 0;let j=p??(d instanceof Error?d:void 0);this.originalError=j,this.nodes=at(Array.isArray(r)?r:r?[r]:void 0);let R=at(this.nodes?.map(A=>A.loc).filter(A=>A!=null));this.source=i??R?.[0]?.source,this.positions=s??R?.map(A=>A.start),this.locations=s&&i?Ne(s.map(A=>({source:i,start:A}))):R&&Ne(R);let
|
|
9
|
+
`,"\\n"),'"'];case"IntValue":case"FloatValue":case"EnumValue":return r.value;case"BooleanValue":return r.value?"true":"false";case"NullValue":return"null";case"Variable":return["$",n("name")];case"ListValue":{let i=!N(r.values);return S(["[",q(e,t,{indent:!0}),i?"":E([y,m([O("",", "),y],e.map(n,"values"))]),y,"]"])}case"ObjectValue":{let i=!N(r.fields),s=t.bracketSpacing&&!i?" ":"";return S(["{",s,q(e,t,{indent:!0}),i?"":E([y,m([O("",", "),y],e.map(n,"fields"))]),y,O("",s),"}"])}case"ObjectField":case"Argument":case"FragmentArgument":return[n("name"),": ",n("value")];case"Directive":return["@",n("name"),M(e,t,n)];case"NamedType":return n("name");case"VariableDefinition":return[g(e,t,n),n("variable"),": ",n("type"),r.defaultValue?[" = ",n("defaultValue")]:"",T(e,n)];case"ObjectTypeExtension":case"ObjectTypeDefinition":case"InputObjectTypeExtension":case"InputObjectTypeDefinition":case"InterfaceTypeExtension":case"InterfaceTypeDefinition":{let{kind:i}=r,s=[];return i.endsWith("TypeDefinition")?s.push(g(e,t,n)):s.push("extend "),i.startsWith("ObjectType")?s.push("type"):i.startsWith("InputObjectType")?s.push("input"):s.push("interface"),s.push(" ",n("name")),!i.startsWith("InputObjectType")&&N(r.interfaces)&&s.push(" implements ",E([S([m([" &",C],e.map(n,"interfaces"))])])),s.push(T(e,n)),N(r.fields)&&s.push([" {",E([u,m(u,v(e,t,n,"fields"))]),u,"}"]),s}case"FieldDefinition":return[g(e,t,n),n("name"),M(e,t,n),": ",n("type"),T(e,n)];case"DirectiveDefinition":return[g(e,t,n),"directive ","@",n("name"),M(e,t,n),T(e,n),r.repeatable?" repeatable":""," on ",...m(" | ",e.map(n,"locations"))];case"DirectiveExtension":return["extend directive @",n("name"),T(e,n)];case"EnumTypeExtension":case"EnumTypeDefinition":return[g(e,t,n),r.kind==="EnumTypeExtension"?"extend ":"","enum ",n("name"),T(e,n),N(r.values)?[" {",E([u,m(u,v(e,t,n,"values"))]),u,"}"]:""];case"EnumValueDefinition":return[g(e,t,n),n("name"),T(e,n)];case"InputValueDefinition":return[g(e,t,n),n("name"),": ",n("type"),r.defaultValue?[" = ",n("defaultValue")]:"",T(e,n)];case"SchemaExtension":return["extend schema",T(e,n),...N(r.operationTypes)?[" {",E([u,m(u,v(e,t,n,"operationTypes"))]),u,"}"]:[]];case"SchemaDefinition":return[g(e,t,n),"schema",T(e,n)," {",N(r.operationTypes)?E([u,m(u,v(e,t,n,"operationTypes"))]):"",u,"}"];case"OperationTypeDefinition":return[r.operation,": ",n("type")];case"FragmentSpread":return["...",n("name"),M(e,t,n),T(e,n)];case"InlineFragment":return["...",r.typeCondition?[" on ",n("typeCondition")]:"",T(e,n),ie(e,t,n)];case"UnionTypeExtension":case"UnionTypeDefinition":return S([g(e,t,n),S([r.kind==="UnionTypeExtension"?"extend ":"","union ",n("name"),T(e,n),N(r.types)?[" =",O(""," "),E([O([C,"| "]),m([C,"| "],e.map(n,"types"))])]:""])]);case"ScalarTypeExtension":case"ScalarTypeDefinition":return[g(e,t,n),r.kind==="ScalarTypeExtension"?"extend ":"","scalar ",n("name"),T(e,n)];case"NonNullType":return[n("type"),"!"];case"ListType":return["[",n("type"),"]"];default:throw new Be(r,"Graphql","kind")}}function $t(e){return e.kind!=="Comment"}function Qt({node:e}){if(e.kind==="Comment")return"#"+e.value.trimEnd();throw new Error("Not a comment: "+JSON.stringify(e))}function Xt(e){let{node:t}=e;return t?.comments?.some(n=>n.value.trim()==="prettier-ignore")}var Ht={print:qt,massageAstNode:xe,hasPrettierIgnore:Xt,insertPragma:Xe,printComment:Qt,canAttachComment:$t,getVisitorKeys:Ke},Ze=Ht;var et=[{name:"GraphQL",type:"data",aceMode:"graphqlschema",extensions:[".graphql",".gql",".graphqls"],tmScope:"source.graphql",parsers:["graphql"],vscodeLanguageIds:["graphql"],linguistLanguageId:139}];var tt={bracketSpacing:{category:"Common",type:"boolean",default:!0,description:"Print spaces between brackets.",oppositeDescription:"Do not print spaces between brackets."},objectWrap:{category:"Common",type:"choice",default:"preserve",description:"How to wrap object literals.",choices:[{value:"preserve",description:"Keep as multi-line, if there is a newline between the opening brace and first property."},{value:"collapse",description:"Fit to a single line when possible."}]},singleQuote:{category:"Common",type:"boolean",default:!1,description:"Use single quotes instead of double quotes."},proseWrap:{category:"Common",type:"choice",default:"preserve",description:"How to wrap prose.",choices:[{value:"always",description:"Wrap prose if it exceeds the print width."},{value:"never",description:"Do not wrap prose."},{value:"preserve",description:"Wrap prose as-is."}]},bracketSameLine:{category:"Common",type:"boolean",default:!1,description:"Put > of opening tags on the last line instead of on a new line."},singleAttributePerLine:{category:"Common",type:"boolean",default:!1,description:"Enforce single attribute per line in HTML, Vue and JSX."}};var Wt={bracketSpacing:tt.bracketSpacing},nt=Wt;var Oe={};fe(Oe,{graphql:()=>Ti});function Jt(e,t){return e?.__kind===t}var it=Jt;function rt(e){return typeof e=="object"&&e!==null}var re=class extends Map{get[Symbol.toStringTag](){return"AccumulatorMap"}add(t,n){let r=this.get(t);r===void 0?this.set(t,[n]):r.push(n)}};var st=/\r\n|[\n\r]/g;function se(e,t){let n=e.body.matchAll(st),r=n.next().value,i=1,s=0;for(;r!==void 0&&r.index<t;)s=r.index+r[0].length,i++,r=n.next().value;return{line:i,column:t+1-s}}function Ne(e){if(e.length<2)return e.map(({source:r,start:i})=>se(r,i));let t=new re;e.forEach(({source:r,start:i},s)=>{t.add(r,{position:i,index:s})});let n=new Array(e.length);for(let[r,i]of t){let s=r.body.matchAll(st),a=s.next().value,p=1,d=0;for(let{position:x,index:D}of i.toSorted((I,f)=>I.position-f.position)){for(;a!==void 0&&a.index<x;)d=a.index+a[0].length,p++,a=s.next().value;n[D]={line:p,column:x+1-d}}}return n}function _e(e){return oe(e.source,se(e.source,e.start))}function oe(e,t){let n=e.locationOffset.column-1,r="".padStart(n)+e.body,i=t.line-1,s=e.locationOffset.line-1,a=t.line+s,p=t.line===1?n:0,d=t.column+p,x=`${e.name}:${a}:${d}
|
|
10
|
+
`,D=r.split(/\r\n|[\n\r]/g),I=D[i];if(I.length>120){let f=[];for(let A=0;A<I.length;A+=80)f.push(I.slice(A,A+80));let j=d-1,R=Math.min(Math.floor(j/80),f.length-1),le=d-R*80;return x+ot([[`${a} |`,f[0]],...f.slice(1,R+1).map(A=>["|",A]),["|","^".padStart(le)],["|",f[R+1]]])}return x+ot([[`${a-1} |`,D[i-1]],[`${a} |`,I],["|","^".padStart(d)],[`${a+1} |`,D[i+1]]])}function ot(e){let t=e.filter(([r,i])=>i!==void 0),n=Math.max(...t.map(([r])=>r.length));return t.map(([r,i])=>r.padStart(n)+(i?" "+i:"")).join(`
|
|
11
|
+
`)}var L=class e extends Error{constructor(t,n={}){let{nodes:r,source:i,positions:s,path:a,originalError:p,cause:d,extensions:x}=n,D="cause"in n,I=D?d:p,f=D||p!=null?{cause:I}:void 0;super(t,f),this.name="GraphQLError",this.path=a??void 0;let j=p??(d instanceof Error?d:void 0);this.originalError=j,this.nodes=at(Array.isArray(r)?r:r?[r]:void 0);let R=at(this.nodes?.map(A=>A.loc).filter(A=>A!=null));this.source=i??R?.[0]?.source,this.positions=s??R?.map(A=>A.start),this.locations=s&&i?Ne(s.map(A=>({source:i,start:A}))):R&&Ne(R);let le=rt(j?.extensions)?j.extensions:void 0;this.extensions=x??le??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}}),p?.stack!=null?Object.defineProperty(this,"stack",{value:p.stack,writable:!0,configurable:!0}):Error.captureStackTrace!=null?Error.captureStackTrace(this,e):Object.defineProperty(this,"stack",{value:Error().stack,writable:!0,configurable:!0})}get[Symbol.toStringTag](){return"GraphQLError"}toString(){let t=this.message;if(this.nodes)for(let n of this.nodes)n.loc&&(t+=`
|
|
12
12
|
|
|
13
13
|
`+_e(n.loc));else if(this.source&&this.locations)for(let n of this.locations)t+=`
|
|
14
14
|
|
|
15
|
-
`+se(this.source,n);return t}toJSON(){let t={message:this.message};return this.locations!=null&&(t.locations=this.locations),this.path!=null&&(t.path=this.path),this.extensions!=null&&Object.keys(this.extensions).length>0&&(t.extensions=this.extensions),t}};function at(e){return e===void 0||e.length===0?void 0:e}var zt=Object.hasOwn??Function.prototype.call.bind(Object.prototype.hasOwnProperty),ct=zt;var Q=class{constructor(t,n,r){this.start=t.start,this.end=n.end,this.startToken=t,this.endToken=n,this.source=r}get[Symbol.toStringTag](){return"Location"}toJSON(){return{start:this.start,end:this.end}}},B=class{constructor(t,n,r,i,s,a){this.kind=t,this.start=n,this.end=r,this.line=i,this.column=s,this.value=a,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}}};var U={QUERY:"query",MUTATION:"mutation",SUBSCRIPTION:"subscription"};var c={};de(c,{ARGUMENT:()=>on,ARGUMENT_COORDINATE:()=>Qn,BOOLEAN:()=>hn,DIRECTIVE:()=>_n,DIRECTIVE_ARGUMENT_COORDINATE:()=>Hn,DIRECTIVE_COORDINATE:()=>Xn,DIRECTIVE_DEFINITION:()=>wn,DIRECTIVE_EXTENSION:()=>Mn,DOCUMENT:()=>en,ENUM:()=>Tn,ENUM_TYPE_DEFINITION:()=>bn,ENUM_TYPE_EXTENSION:()=>jn,ENUM_VALUE_DEFINITION:()=>Fn,FIELD:()=>sn,FIELD_DEFINITION:()=>vn,FLOAT:()=>fn,FRAGMENT_ARGUMENT:()=>an,FRAGMENT_DEFINITION:()=>un,FRAGMENT_SPREAD:()=>cn,INLINE_FRAGMENT:()=>pn,INPUT_OBJECT_TYPE_DEFINITION:()=>Pn,INPUT_OBJECT_TYPE_EXTENSION:()=>Yn,INPUT_VALUE_DEFINITION:()=>kn,INT:()=>dn,INTERFACE_TYPE_DEFINITION:()=>Rn,INTERFACE_TYPE_EXTENSION:()=>Gn,LIST:()=>xn,LIST_TYPE:()=>An,MEMBER_COORDINATE:()=>$n,NAME:()=>Zt,NAMED_TYPE:()=>Dn,NON_NULL_TYPE:()=>Sn,NULL:()=>En,OBJECT:()=>yn,OBJECT_FIELD:()=>Nn,OBJECT_TYPE_DEFINITION:()=>Cn,OBJECT_TYPE_EXTENSION:()=>Un,OPERATION_DEFINITION:()=>tn,OPERATION_TYPE_DEFINITION:()=>In,SCALAR_TYPE_DEFINITION:()=>On,SCALAR_TYPE_EXTENSION:()=>Bn,SCHEMA_DEFINITION:()=>gn,SCHEMA_EXTENSION:()=>Vn,SELECTION_SET:()=>rn,STRING:()=>mn,TYPE_COORDINATE:()=>qn,UNION_TYPE_DEFINITION:()=>Ln,UNION_TYPE_EXTENSION:()=>Kn,VARIABLE:()=>ln,VARIABLE_DEFINITION:()=>nn});var Zt="Name",en="Document",tn="OperationDefinition",nn="VariableDefinition",rn="SelectionSet",sn="Field",on="Argument",an="FragmentArgument",cn="FragmentSpread",pn="InlineFragment",un="FragmentDefinition",ln="Variable",dn="IntValue",fn="FloatValue",mn="StringValue",hn="BooleanValue",En="NullValue",Tn="EnumValue",xn="ListValue",yn="ObjectValue",Nn="ObjectField",_n="Directive",Dn="NamedType",An="ListType",Sn="NonNullType",gn="SchemaDefinition",In="OperationTypeDefinition",On="ScalarTypeDefinition",Cn="ObjectTypeDefinition",vn="FieldDefinition",kn="InputValueDefinition",Rn="InterfaceTypeDefinition",Ln="UnionTypeDefinition",bn="EnumTypeDefinition",Fn="EnumValueDefinition",Pn="InputObjectTypeDefinition",wn="DirectiveDefinition",Vn="SchemaExtension",Mn="DirectiveExtension",Bn="ScalarTypeExtension",Un="ObjectTypeExtension",Gn="InterfaceTypeExtension",Kn="UnionTypeExtension",jn="EnumTypeExtension",Yn="InputObjectTypeExtension",qn="TypeCoordinate",$n="MemberCoordinate",Qn="ArgumentCoordinate",Xn="DirectiveCoordinate",Hn="DirectiveArgumentCoordinate";function De(e,t){if(!e)throw new Error(t)}function pt(e){return e===9||e===32}function P(e){return e>=48&&e<=57}function ut(e){return e>=97&&e<=122||e>=65&&e<=90}function Ae(e){return ut(e)||e===95}function lt(e){return ut(e)||P(e)||e===95}function dt(e){let t=Number.MAX_SAFE_INTEGER,n=null,r=-1;for(let i=0;i<e.length;++i){let s=e[i],a=Wn(s);a!==s.length&&(n??(n=i),r=i,i!==0&&a<t&&(t=a))}return e.map((i,s)=>s===0?i:i.slice(t)).slice(n??0,r+1)}function Wn(e){let t=0;for(;t<e.length&&pt(e.charCodeAt(t));)++t;return t}var Se={QUERY:"QUERY",MUTATION:"MUTATION",SUBSCRIPTION:"SUBSCRIPTION",FIELD:"FIELD",FRAGMENT_DEFINITION:"FRAGMENT_DEFINITION",FRAGMENT_SPREAD:"FRAGMENT_SPREAD",INLINE_FRAGMENT:"INLINE_FRAGMENT",VARIABLE_DEFINITION:"VARIABLE_DEFINITION",FRAGMENT_VARIABLE_DEFINITION:"FRAGMENT_VARIABLE_DEFINITION",SCHEMA:"SCHEMA",SCALAR:"SCALAR",OBJECT:"OBJECT",FIELD_DEFINITION:"FIELD_DEFINITION",ARGUMENT_DEFINITION:"ARGUMENT_DEFINITION",INTERFACE:"INTERFACE",UNION:"UNION",ENUM:"ENUM",ENUM_VALUE:"ENUM_VALUE",INPUT_OBJECT:"INPUT_OBJECT",INPUT_FIELD_DEFINITION:"INPUT_FIELD_DEFINITION",DIRECTIVE_DEFINITION:"DIRECTIVE_DEFINITION"};function l(e,t,n){return new L(`Syntax Error: ${n}`,{source:e,positions:[t]})}function Jn(){let e;try{let t=globalThis.process;typeof t?.getBuiltinModule=="function"&&(e=t.getBuiltinModule("node:diagnostics_channel"))}catch{}return e}var w=Jn(),ge=w?.tracingChannel("graphql:parse"),Ms=w?.tracingChannel("graphql:validate"),Bs=w?.tracingChannel("graphql:execute"),Us=w?.tracingChannel("graphql:execute:variableCoercion"),Gs=w?.tracingChannel("graphql:execute:rootSelectionSet"),Ks=w?.tracingChannel("graphql:subscribe"),js=w?.tracingChannel("graphql:resolve"),zn=["start","end","asyncStart","asyncEnd","error"];function ft(e){if(e==null)return!1;let t=e.hasSubscribers;if(t!==void 0)return t;for(let n of zn)if(e[n].hasSubscribers)return!0;return!1}var o={SOF:"<SOF>",EOF:"<EOF>",BANG:"!",DOLLAR:"$",AMP:"&",PAREN_L:"(",PAREN_R:")",DOT:".",SPREAD:"...",COLON:":",EQUALS:"=",AT:"@",BRACKET_L:"[",BRACKET_R:"]",BRACE_L:"{",PIPE:"|",BRACE_R:"}",NAME:"Name",INT:"Int",FLOAT:"Float",STRING:"String",BLOCK_STRING:"BlockString",COMMENT:"Comment"};var H=class{constructor(t){let n=new B(o.SOF,0,0,0,0);this.source=t,this.lastToken=n,this.token=n,this.line=1,this.lineStart=0,this._maxComments=void 0,this._commentCount=0}get[Symbol.toStringTag](){return"Lexer"}advance(){return this.lastToken=this.token,this.token=this.lookahead()}lookahead(){let t=this.token;if(t.kind!==o.EOF)do if(t.next)t=t.next;else{let n=Zn(this,t.end);t.next=n,n.prev=t,t=n}while(t.kind===o.COMMENT);return t}};function ht(e){return e===o.BANG||e===o.DOLLAR||e===o.AMP||e===o.PAREN_L||e===o.PAREN_R||e===o.DOT||e===o.SPREAD||e===o.COLON||e===o.EQUALS||e===o.AT||e===o.BRACKET_L||e===o.BRACKET_R||e===o.BRACE_L||e===o.PIPE||e===o.BRACE_R}function G(e){return e>=0&&e<=55295||e>=57344&&e<=1114111}function ae(e,t){return Et(e.charCodeAt(t))&&Tt(e.charCodeAt(t+1))}function Et(e){return e>=55296&&e<=56319}function Tt(e){return e>=56320&&e<=57343}function V(e,t){let n=e.source.body.codePointAt(t);if(n===void 0)return o.EOF;if(n>=32&&n<=126){let r=String.fromCodePoint(n);return r==='"'?`'"'`:`"${r}"`}return"U+"+n.toString(16).toUpperCase().padStart(4,"0")}function h(e,t,n,r,i){let s=e.line,a=1+n-e.lineStart;return new B(t,n,r,s,a,i)}function Zn(e,t){let n=e.source.body,r=n.length,i=t;for(;i<r;){let s=n.charCodeAt(i);switch(s){case 65279:case 9:case 32:case 44:++i;continue;case 10:++i,++e.line,e.lineStart=i;continue;case 13:n.charCodeAt(i+1)===10?i+=2:++i,++e.line,e.lineStart=i;continue;case 35:return ei(e,i);case 33:return h(e,o.BANG,i,i+1);case 36:return h(e,o.DOLLAR,i,i+1);case 38:return h(e,o.AMP,i,i+1);case 40:return h(e,o.PAREN_L,i,i+1);case 41:return h(e,o.PAREN_R,i,i+1);case 46:{let a=n.charCodeAt(i+1);if(a===46&&n.charCodeAt(i+2)===46)return h(e,o.SPREAD,i,i+3);if(a===46)throw l(e.source,i,'Unexpected "..", did you mean "..."?');if(P(a)){let p=e.source.body.slice(i+1,oe(e,i+1,a));throw l(e.source,i,`Invalid number, expected digit before ".", did you mean "0.${p}"?`)}break}case 58:return h(e,o.COLON,i,i+1);case 61:return h(e,o.EQUALS,i,i+1);case 64:return h(e,o.AT,i,i+1);case 91:return h(e,o.BRACKET_L,i,i+1);case 93:return h(e,o.BRACKET_R,i,i+1);case 123:return h(e,o.BRACE_L,i,i+1);case 124:return h(e,o.PIPE,i,i+1);case 125:return h(e,o.BRACE_R,i,i+1);case 34:return n.charCodeAt(i+1)===34&&n.charCodeAt(i+2)===34?oi(e,i):ni(e,i)}if(P(s)||s===45)return ti(e,i,s);if(Ae(s))return ai(e,i);throw l(e.source,i,s===39?`Unexpected single quote character ('), did you mean to use a double quote (")?`:G(s)||ae(n,i)?`Unexpected character: ${V(e,i)}.`:`Invalid character: ${V(e,i)}.`)}return h(e,o.EOF,r,r)}function ei(e,t){let n=e._maxComments;if(n!==void 0){let a=e._commentCount+1;if(a>n)throw l(e.source,t,`Document contains more than ${n} comments. Parsing aborted.`);e._commentCount=a}let r=e.source.body,i=r.length,s=t+1;for(;s<i;){let a=r.charCodeAt(s);if(a===10||a===13)break;if(G(a))++s;else if(ae(r,s))s+=2;else break}return h(e,o.COMMENT,t,s,r.slice(t+1,s))}function ti(e,t,n){let r=e.source.body,i=t,s=n,a=!1;if(s===45&&(s=r.charCodeAt(++i)),s===48){if(s=r.charCodeAt(++i),P(s))throw l(e.source,i,`Invalid number, unexpected digit after 0: ${V(e,i)}.`)}else i=oe(e,i,s),s=r.charCodeAt(i);if(s===46&&(a=!0,s=r.charCodeAt(++i),i=oe(e,i,s),s=r.charCodeAt(i)),(s===69||s===101)&&(a=!0,s=r.charCodeAt(++i),(s===43||s===45)&&(s=r.charCodeAt(++i)),i=oe(e,i,s),s=r.charCodeAt(i)),s===46||Ae(s))throw l(e.source,i,`Invalid number, expected digit but got: ${V(e,i)}.`);return h(e,a?o.FLOAT:o.INT,t,i,r.slice(t,i))}function oe(e,t,n){if(!P(n))throw l(e.source,t,`Invalid number, expected digit but got: ${V(e,t)}.`);let r=e.source.body,i=t+1;for(;P(r.charCodeAt(i));)++i;return i}function ni(e,t){let n=e.source.body,r=n.length,i=t+1,s=i,a="";for(;i<r;){let p=n.charCodeAt(i);if(p===34)return a+=n.slice(s,i),h(e,o.STRING,t,i+1,a);if(p===92){a+=n.slice(s,i);let d=n.charCodeAt(i+1)===117?n.charCodeAt(i+2)===123?ii(e,i):ri(e,i):si(e,i);a+=d.value,i+=d.size,s=i;continue}if(p===10||p===13)break;if(G(p))++i;else if(ae(n,i))i+=2;else throw l(e.source,i,`Invalid character within String: ${V(e,i)}.`)}throw l(e.source,i,"Unterminated string.")}function ii(e,t){let n=e.source.body,r=0,i=3;for(;i<12;){let s=n.charCodeAt(t+i++);if(s===125){if(i<5||!G(r))break;return{value:String.fromCodePoint(r),size:i}}if(r=r<<4|X(s),r<0)break}throw l(e.source,t,`Invalid Unicode escape sequence: "${n.slice(t,t+i)}".`)}function ri(e,t){let n=e.source.body,r=mt(n,t+2);if(G(r))return{value:String.fromCodePoint(r),size:6};if(Et(r)&&n.charCodeAt(t+6)===92&&n.charCodeAt(t+7)===117){let i=mt(n,t+8);if(Tt(i))return{value:String.fromCodePoint(r,i),size:12}}throw l(e.source,t,`Invalid Unicode escape sequence: "${n.slice(t,t+6)}".`)}function mt(e,t){return X(e.charCodeAt(t))<<12|X(e.charCodeAt(t+1))<<8|X(e.charCodeAt(t+2))<<4|X(e.charCodeAt(t+3))}function X(e){return e>=48&&e<=57?e-48:e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:-1}function si(e,t){let 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:`
|
|
15
|
+
`+oe(this.source,n);return t}toJSON(){let t={message:this.message};return this.locations!=null&&(t.locations=this.locations),this.path!=null&&(t.path=this.path),this.extensions!=null&&Object.keys(this.extensions).length>0&&(t.extensions=this.extensions),t}};function at(e){return e===void 0||e.length===0?void 0:e}var zt=Object.hasOwn??Function.prototype.call.bind(Object.prototype.hasOwnProperty),ct=zt;var X=class{constructor(t,n,r){this.start=t.start,this.end=n.end,this.startToken=t,this.endToken=n,this.source=r}get[Symbol.toStringTag](){return"Location"}toJSON(){return{start:this.start,end:this.end}}},B=class{constructor(t,n,r,i,s,a){this.kind=t,this.start=n,this.end=r,this.line=i,this.column=s,this.value=a,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}}};var U={QUERY:"query",MUTATION:"mutation",SUBSCRIPTION:"subscription"};var c={};fe(c,{ARGUMENT:()=>on,ARGUMENT_COORDINATE:()=>Qn,BOOLEAN:()=>hn,DIRECTIVE:()=>_n,DIRECTIVE_ARGUMENT_COORDINATE:()=>Hn,DIRECTIVE_COORDINATE:()=>Xn,DIRECTIVE_DEFINITION:()=>wn,DIRECTIVE_EXTENSION:()=>Mn,DOCUMENT:()=>en,ENUM:()=>Tn,ENUM_TYPE_DEFINITION:()=>bn,ENUM_TYPE_EXTENSION:()=>jn,ENUM_VALUE_DEFINITION:()=>Fn,FIELD:()=>sn,FIELD_DEFINITION:()=>vn,FLOAT:()=>fn,FRAGMENT_ARGUMENT:()=>an,FRAGMENT_DEFINITION:()=>un,FRAGMENT_SPREAD:()=>cn,INLINE_FRAGMENT:()=>pn,INPUT_OBJECT_TYPE_DEFINITION:()=>Pn,INPUT_OBJECT_TYPE_EXTENSION:()=>Yn,INPUT_VALUE_DEFINITION:()=>kn,INT:()=>dn,INTERFACE_TYPE_DEFINITION:()=>Rn,INTERFACE_TYPE_EXTENSION:()=>Gn,LIST:()=>xn,LIST_TYPE:()=>An,MEMBER_COORDINATE:()=>$n,NAME:()=>Zt,NAMED_TYPE:()=>Dn,NON_NULL_TYPE:()=>Sn,NULL:()=>En,OBJECT:()=>yn,OBJECT_FIELD:()=>Nn,OBJECT_TYPE_DEFINITION:()=>Cn,OBJECT_TYPE_EXTENSION:()=>Un,OPERATION_DEFINITION:()=>tn,OPERATION_TYPE_DEFINITION:()=>In,SCALAR_TYPE_DEFINITION:()=>On,SCALAR_TYPE_EXTENSION:()=>Bn,SCHEMA_DEFINITION:()=>gn,SCHEMA_EXTENSION:()=>Vn,SELECTION_SET:()=>rn,STRING:()=>mn,TYPE_COORDINATE:()=>qn,UNION_TYPE_DEFINITION:()=>Ln,UNION_TYPE_EXTENSION:()=>Kn,VARIABLE:()=>ln,VARIABLE_DEFINITION:()=>nn});var Zt="Name",en="Document",tn="OperationDefinition",nn="VariableDefinition",rn="SelectionSet",sn="Field",on="Argument",an="FragmentArgument",cn="FragmentSpread",pn="InlineFragment",un="FragmentDefinition",ln="Variable",dn="IntValue",fn="FloatValue",mn="StringValue",hn="BooleanValue",En="NullValue",Tn="EnumValue",xn="ListValue",yn="ObjectValue",Nn="ObjectField",_n="Directive",Dn="NamedType",An="ListType",Sn="NonNullType",gn="SchemaDefinition",In="OperationTypeDefinition",On="ScalarTypeDefinition",Cn="ObjectTypeDefinition",vn="FieldDefinition",kn="InputValueDefinition",Rn="InterfaceTypeDefinition",Ln="UnionTypeDefinition",bn="EnumTypeDefinition",Fn="EnumValueDefinition",Pn="InputObjectTypeDefinition",wn="DirectiveDefinition",Vn="SchemaExtension",Mn="DirectiveExtension",Bn="ScalarTypeExtension",Un="ObjectTypeExtension",Gn="InterfaceTypeExtension",Kn="UnionTypeExtension",jn="EnumTypeExtension",Yn="InputObjectTypeExtension",qn="TypeCoordinate",$n="MemberCoordinate",Qn="ArgumentCoordinate",Xn="DirectiveCoordinate",Hn="DirectiveArgumentCoordinate";function De(e,t){if(!e)throw new Error(t)}function pt(e){return e===9||e===32}function P(e){return e>=48&&e<=57}function ut(e){return e>=97&&e<=122||e>=65&&e<=90}function Ae(e){return ut(e)||e===95}function lt(e){return ut(e)||P(e)||e===95}function dt(e){let t=Number.MAX_SAFE_INTEGER,n=null,r=-1;for(let i=0;i<e.length;++i){let s=e[i],a=Wn(s);a!==s.length&&(n??(n=i),r=i,i!==0&&a<t&&(t=a))}return e.map((i,s)=>s===0?i:i.slice(t)).slice(n??0,r+1)}function Wn(e){let t=0;for(;t<e.length&&pt(e.charCodeAt(t));)++t;return t}var Se={QUERY:"QUERY",MUTATION:"MUTATION",SUBSCRIPTION:"SUBSCRIPTION",FIELD:"FIELD",FRAGMENT_DEFINITION:"FRAGMENT_DEFINITION",FRAGMENT_SPREAD:"FRAGMENT_SPREAD",INLINE_FRAGMENT:"INLINE_FRAGMENT",VARIABLE_DEFINITION:"VARIABLE_DEFINITION",FRAGMENT_VARIABLE_DEFINITION:"FRAGMENT_VARIABLE_DEFINITION",SCHEMA:"SCHEMA",SCALAR:"SCALAR",OBJECT:"OBJECT",FIELD_DEFINITION:"FIELD_DEFINITION",ARGUMENT_DEFINITION:"ARGUMENT_DEFINITION",INTERFACE:"INTERFACE",UNION:"UNION",ENUM:"ENUM",ENUM_VALUE:"ENUM_VALUE",INPUT_OBJECT:"INPUT_OBJECT",INPUT_FIELD_DEFINITION:"INPUT_FIELD_DEFINITION",DIRECTIVE_DEFINITION:"DIRECTIVE_DEFINITION"};function l(e,t,n){return new L(`Syntax Error: ${n}`,{source:e,positions:[t]})}function Jn(){let e;try{let t=globalThis.process;typeof t?.getBuiltinModule=="function"&&(e=t.getBuiltinModule("node:diagnostics_channel"))}catch{}return e}var w=Jn(),ge=w?.tracingChannel("graphql:parse"),Bs=w?.tracingChannel("graphql:validate"),Us=w?.tracingChannel("graphql:execute"),Gs=w?.tracingChannel("graphql:execute:variableCoercion"),Ks=w?.tracingChannel("graphql:execute:rootSelectionSet"),js=w?.tracingChannel("graphql:subscribe"),Ys=w?.tracingChannel("graphql:resolve"),zn=["start","end","asyncStart","asyncEnd","error"];function ft(e){if(e==null)return!1;let t=e.hasSubscribers;if(t!==void 0)return t;for(let n of zn)if(e[n].hasSubscribers)return!0;return!1}var o={SOF:"<SOF>",EOF:"<EOF>",BANG:"!",DOLLAR:"$",AMP:"&",PAREN_L:"(",PAREN_R:")",DOT:".",SPREAD:"...",COLON:":",EQUALS:"=",AT:"@",BRACKET_L:"[",BRACKET_R:"]",BRACE_L:"{",PIPE:"|",BRACE_R:"}",NAME:"Name",INT:"Int",FLOAT:"Float",STRING:"String",BLOCK_STRING:"BlockString",COMMENT:"Comment"};var W=class{constructor(t){let n=new B(o.SOF,0,0,0,0);this.source=t,this.lastToken=n,this.token=n,this.line=1,this.lineStart=0,this._maxComments=void 0,this._commentCount=0}get[Symbol.toStringTag](){return"Lexer"}advance(){return this.lastToken=this.token,this.token=this.lookahead()}lookahead(){let t=this.token;if(t.kind!==o.EOF)do if(t.next)t=t.next;else{let n=Zn(this,t.end);t.next=n,n.prev=t,t=n}while(t.kind===o.COMMENT);return t}};function ht(e){return e===o.BANG||e===o.DOLLAR||e===o.AMP||e===o.PAREN_L||e===o.PAREN_R||e===o.DOT||e===o.SPREAD||e===o.COLON||e===o.EQUALS||e===o.AT||e===o.BRACKET_L||e===o.BRACKET_R||e===o.BRACE_L||e===o.PIPE||e===o.BRACE_R}function G(e){return e>=0&&e<=55295||e>=57344&&e<=1114111}function ce(e,t){return Et(e.charCodeAt(t))&&Tt(e.charCodeAt(t+1))}function Et(e){return e>=55296&&e<=56319}function Tt(e){return e>=56320&&e<=57343}function V(e,t){let n=e.source.body.codePointAt(t);if(n===void 0)return o.EOF;if(n>=32&&n<=126){let r=String.fromCodePoint(n);return r==='"'?`'"'`:`"${r}"`}return"U+"+n.toString(16).toUpperCase().padStart(4,"0")}function h(e,t,n,r,i){let s=e.line,a=1+n-e.lineStart;return new B(t,n,r,s,a,i)}function Zn(e,t){let n=e.source.body,r=n.length,i=t;for(;i<r;){let s=n.charCodeAt(i);switch(s){case 65279:case 9:case 32:case 44:++i;continue;case 10:++i,++e.line,e.lineStart=i;continue;case 13:n.charCodeAt(i+1)===10?i+=2:++i,++e.line,e.lineStart=i;continue;case 35:return ei(e,i);case 33:return h(e,o.BANG,i,i+1);case 36:return h(e,o.DOLLAR,i,i+1);case 38:return h(e,o.AMP,i,i+1);case 40:return h(e,o.PAREN_L,i,i+1);case 41:return h(e,o.PAREN_R,i,i+1);case 46:{let a=n.charCodeAt(i+1);if(a===46&&n.charCodeAt(i+2)===46)return h(e,o.SPREAD,i,i+3);if(a===46)throw l(e.source,i,'Unexpected "..", did you mean "..."?');if(P(a)){let p=e.source.body.slice(i+1,ae(e,i+1,a));throw l(e.source,i,`Invalid number, expected digit before ".", did you mean "0.${p}"?`)}break}case 58:return h(e,o.COLON,i,i+1);case 61:return h(e,o.EQUALS,i,i+1);case 64:return h(e,o.AT,i,i+1);case 91:return h(e,o.BRACKET_L,i,i+1);case 93:return h(e,o.BRACKET_R,i,i+1);case 123:return h(e,o.BRACE_L,i,i+1);case 124:return h(e,o.PIPE,i,i+1);case 125:return h(e,o.BRACE_R,i,i+1);case 34:return n.charCodeAt(i+1)===34&&n.charCodeAt(i+2)===34?oi(e,i):ni(e,i)}if(P(s)||s===45)return ti(e,i,s);if(Ae(s))return ai(e,i);throw l(e.source,i,s===39?`Unexpected single quote character ('), did you mean to use a double quote (")?`:G(s)||ce(n,i)?`Unexpected character: ${V(e,i)}.`:`Invalid character: ${V(e,i)}.`)}return h(e,o.EOF,r,r)}function ei(e,t){let n=e._maxComments;if(n!==void 0){let a=e._commentCount+1;if(a>n)throw l(e.source,t,`Document contains more than ${n} comments. Parsing aborted.`);e._commentCount=a}let r=e.source.body,i=r.length,s=t+1;for(;s<i;){let a=r.charCodeAt(s);if(a===10||a===13)break;if(G(a))++s;else if(ce(r,s))s+=2;else break}return h(e,o.COMMENT,t,s,r.slice(t+1,s))}function ti(e,t,n){let r=e.source.body,i=t,s=n,a=!1;if(s===45&&(s=r.charCodeAt(++i)),s===48){if(s=r.charCodeAt(++i),P(s))throw l(e.source,i,`Invalid number, unexpected digit after 0: ${V(e,i)}.`)}else i=ae(e,i,s),s=r.charCodeAt(i);if(s===46&&(a=!0,s=r.charCodeAt(++i),i=ae(e,i,s),s=r.charCodeAt(i)),(s===69||s===101)&&(a=!0,s=r.charCodeAt(++i),(s===43||s===45)&&(s=r.charCodeAt(++i)),i=ae(e,i,s),s=r.charCodeAt(i)),s===46||Ae(s))throw l(e.source,i,`Invalid number, expected digit but got: ${V(e,i)}.`);return h(e,a?o.FLOAT:o.INT,t,i,r.slice(t,i))}function ae(e,t,n){if(!P(n))throw l(e.source,t,`Invalid number, expected digit but got: ${V(e,t)}.`);let r=e.source.body,i=t+1;for(;P(r.charCodeAt(i));)++i;return i}function ni(e,t){let n=e.source.body,r=n.length,i=t+1,s=i,a="";for(;i<r;){let p=n.charCodeAt(i);if(p===34)return a+=n.slice(s,i),h(e,o.STRING,t,i+1,a);if(p===92){a+=n.slice(s,i);let d=n.charCodeAt(i+1)===117?n.charCodeAt(i+2)===123?ii(e,i):ri(e,i):si(e,i);a+=d.value,i+=d.size,s=i;continue}if(p===10||p===13)break;if(G(p))++i;else if(ce(n,i))i+=2;else throw l(e.source,i,`Invalid character within String: ${V(e,i)}.`)}throw l(e.source,i,"Unterminated string.")}function ii(e,t){let n=e.source.body,r=0,i=3;for(;i<12;){let s=n.charCodeAt(t+i++);if(s===125){if(i<5||!G(r))break;return{value:String.fromCodePoint(r),size:i}}if(r=r<<4|H(s),r<0)break}throw l(e.source,t,`Invalid Unicode escape sequence: "${n.slice(t,t+i)}".`)}function ri(e,t){let n=e.source.body,r=mt(n,t+2);if(G(r))return{value:String.fromCodePoint(r),size:6};if(Et(r)&&n.charCodeAt(t+6)===92&&n.charCodeAt(t+7)===117){let i=mt(n,t+8);if(Tt(i))return{value:String.fromCodePoint(r,i),size:12}}throw l(e.source,t,`Invalid Unicode escape sequence: "${n.slice(t,t+6)}".`)}function mt(e,t){return H(e.charCodeAt(t))<<12|H(e.charCodeAt(t+1))<<8|H(e.charCodeAt(t+2))<<4|H(e.charCodeAt(t+3))}function H(e){return e>=48&&e<=57?e-48:e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:-1}function si(e,t){let 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:`
|
|
16
16
|
`,size:2};case 114:return{value:"\r",size:2};case 116:return{value:" ",size:2}}throw l(e.source,t,`Invalid character escape sequence: "${n.slice(t,t+2)}".`)}function oi(e,t){let n=e.source.body,r=n.length,i=e.lineStart,s=t+3,a=s,p="",d=[];for(;s<r;){let x=n.charCodeAt(s);if(x===34&&n.charCodeAt(s+1)===34&&n.charCodeAt(s+2)===34){p+=n.slice(a,s),d.push(p);let D=h(e,o.BLOCK_STRING,t,s+3,dt(d).join(`
|
|
17
|
-
`));return e.line+=d.length-1,e.lineStart=i,D}if(x===92&&n.charCodeAt(s+1)===34&&n.charCodeAt(s+2)===34&&n.charCodeAt(s+3)===34){p+=n.slice(a,s),a=s+1,s+=4;continue}if(x===10||x===13){p+=n.slice(a,s),d.push(p),x===13&&n.charCodeAt(s+1)===10?s+=2:++s,p="",a=s,i=s;continue}if(G(x))++s;else if(ae(n,s))s+=2;else throw l(e.source,s,`Invalid character within String: ${V(e,s)}.`)}throw l(e.source,s,"Unterminated string.")}function ai(e,t){let n=e.source.body,r=n.length,i=t+1;for(;i<r;){let s=n.charCodeAt(i);if(lt(s))++i;else break}return h(e,o.NAME,t,i,n.slice(t,i))}var xt=Symbol("Source"),K=class{constructor(t,n="GraphQL request",r={line:1,column:1}){this.__kind=xt,this.body=t,this.name=n,this.locationOffset=r,this.locationOffset.line>0||De(!1,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||De(!1,"column in locationOffset is 1-indexed and must be positive.")}get[Symbol.toStringTag](){return"Source"}};function yt(e){return it(e,xt,K)}function pe(e,t){return ft(ge)?ge.traceSync(()=>Nt(e,t),{source:e}):Nt(e,t)}function Nt(e,t){let n=new Ie(e,t),r=n.parseDocument();return Object.defineProperty(r,"tokenCount",{enumerable:!1,value:n.tokenCount}),r}var Ie=class{constructor(t,n={}){let{lexer:r,...i}=n;if(r)this._lexer=r;else{let a=yt(t)?t:new K(t);this._lexer=new H(a)}this._options=i,this._tokenCounter=0,this._lexer._maxComments=i.maxComments,this._lexer._commentCount=0;let s=i.maxSourceLength;if(s!==void 0&&this._lexer.source.body.length>s)throw l(this._lexer.source,s,`Source contains more than ${s} UTF-16 code units. Parsing aborted.`)}get tokenCount(){return this._tokenCounter}parseName(){let t=this.expectToken(o.NAME);return this.node(t,{kind:c.NAME,value:t.value})}parseDocument(){return this.node(this._lexer.token,{kind:c.DOCUMENT,definitions:this.many(o.SOF,this.parseDefinition,o.EOF)})}parseDefinition(){if(this.peek(o.BRACE_L))return this.parseOperationDefinition();let t=this.peekDescription(),n=t?this._lexer.lookahead():this._lexer.token;if(t&&n.kind===o.BRACE_L)throw l(this._lexer.source,this._lexer.token.start,"Unexpected description, descriptions are not supported on shorthand queries.");if(n.kind===o.NAME){switch(n.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(n.value){case"query":case"mutation":case"subscription":return this.parseOperationDefinition();case"fragment":return this.parseFragmentDefinition()}if(t)throw l(this._lexer.source,this._lexer.token.start,"Unexpected description, only GraphQL definitions support descriptions.");if(n.value==="extend")return this.parseTypeSystemExtension()}throw this.unexpected(n)}parseOperationDefinition(){let t=this._lexer.token;if(this.peek(o.BRACE_L))return this.node(t,{kind:c.OPERATION_DEFINITION,operation:U.QUERY,description:void 0,name:void 0,variableDefinitions:void 0,directives:void 0,selectionSet:this.parseSelectionSet()});let n=this.parseDescription(),r=this.parseOperationType(),i;return this.peek(o.NAME)&&(i=this.parseName()),this.node(t,{kind:c.OPERATION_DEFINITION,operation:r,description:n,name:i,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseOperationType(){let t=this.expectToken(o.NAME);switch(t.value){case"query":return U.QUERY;case"mutation":return U.MUTATION;case"subscription":return U.SUBSCRIPTION}throw this.unexpected(t)}parseVariableDefinitions(){return this.optionalMany(o.PAREN_L,this.parseVariableDefinition,o.PAREN_R)}parseVariableDefinition(){return this.node(this._lexer.token,{kind:c.VARIABLE_DEFINITION,description:this.parseDescription(),variable:this.parseVariable(),type:(this.expectToken(o.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(o.EQUALS)?this.parseConstValueLiteral():void 0,directives:this.parseConstDirectives()})}parseVariable(){let t=this._lexer.token;return this.expectToken(o.DOLLAR),this.node(t,{kind:c.VARIABLE,name:this.parseName()})}parseSelectionSet(){return this.node(this._lexer.token,{kind:c.SELECTION_SET,selections:this._options.allowEmptySelectionSets===!1?this.many(o.BRACE_L,this.parseSelection,o.BRACE_R):this.any(o.BRACE_L,this.parseSelection,o.BRACE_R)})}parseSelection(){return this.peek(o.SPREAD)?this.parseFragment():this.parseField()}parseField(){let t=this._lexer.token,n=this.parseName(),r,i;return this.expectOptionalToken(o.COLON)?(r=n,i=this.parseName()):i=n,this.node(t,{kind:c.FIELD,alias:r,name:i,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(o.BRACE_L)?this.parseSelectionSet():void 0})}parseArguments(t){let n=t?this.parseConstArgument:this.parseArgument;return this.optionalMany(o.PAREN_L,n,o.PAREN_R)}parseFragmentArguments(){let t=this.parseFragmentArgument;return this.optionalMany(o.PAREN_L,t,o.PAREN_R)}parseArgument(t=!1){let n=this._lexer.token,r=this.parseName();return this.expectToken(o.COLON),this.node(n,{kind:c.ARGUMENT,name:r,value:this.parseValueLiteral(t)})}parseConstArgument(){return this.parseArgument(!0)}parseFragmentArgument(){let t=this._lexer.token,n=this.parseName();return this.expectToken(o.COLON),this.node(t,{kind:c.FRAGMENT_ARGUMENT,name:n,value:this.parseValueLiteral(!1)})}parseFragment(){let t=this._lexer.token;this.expectToken(o.SPREAD);let n=this.expectOptionalKeyword("on");if(!n&&this.peek(o.NAME)){let r=this.parseFragmentName();return this.peek(o.PAREN_L)&&this._options.experimentalFragmentArguments?this.node(t,{kind:c.FRAGMENT_SPREAD,name:r,arguments:this.parseFragmentArguments(),directives:this.parseDirectives(!1)}):this.node(t,{kind:c.FRAGMENT_SPREAD,name:r,directives:this.parseDirectives(!1)})}return this.node(t,{kind:c.INLINE_FRAGMENT,typeCondition:n?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentDefinition(){let t=this._lexer.token,n=this.parseDescription();return this.expectKeyword("fragment"),this._options.experimentalFragmentArguments===!0?this.node(t,{kind:c.FRAGMENT_DEFINITION,description:n,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()}):this.node(t,{kind:c.FRAGMENT_DEFINITION,description:n,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(t){let n=this._lexer.token;switch(n.kind){case o.BRACKET_L:return this.parseList(t);case o.BRACE_L:return this.parseObject(t);case o.INT:return this.advanceLexer(),this.node(n,{kind:c.INT,value:n.value});case o.FLOAT:return this.advanceLexer(),this.node(n,{kind:c.FLOAT,value:n.value});case o.STRING:case o.BLOCK_STRING:return this.parseStringLiteral();case o.NAME:switch(this.advanceLexer(),n.value){case"true":return this.node(n,{kind:c.BOOLEAN,value:!0});case"false":return this.node(n,{kind:c.BOOLEAN,value:!1});case"null":return this.node(n,{kind:c.NULL});default:return this.node(n,{kind:c.ENUM,value:n.value})}case o.DOLLAR:if(t)if(this.expectToken(o.DOLLAR),this._lexer.token.kind===o.NAME){let r=this._lexer.token.value;throw l(this._lexer.source,n.start,`Unexpected variable "$${r}" in constant value.`)}else throw this.unexpected(n);return this.parseVariable();default:throw this.unexpected()}}parseConstValueLiteral(){return this.parseValueLiteral(!0)}parseStringLiteral(){let t=this._lexer.token;return this.advanceLexer(),this.node(t,{kind:c.STRING,value:t.value,block:t.kind===o.BLOCK_STRING})}parseList(t){let n=()=>this.parseValueLiteral(t);return this.node(this._lexer.token,{kind:c.LIST,values:this.any(o.BRACKET_L,n,o.BRACKET_R)})}parseObject(t){let n=()=>this.parseObjectField(t);return this.node(this._lexer.token,{kind:c.OBJECT,fields:this.any(o.BRACE_L,n,o.BRACE_R)})}parseObjectField(t){let n=this._lexer.token,r=this.parseName();return this.expectToken(o.COLON),this.node(n,{kind:c.OBJECT_FIELD,name:r,value:this.parseValueLiteral(t)})}parseDirectives(t){let n=[];for(;this.peek(o.AT);)n.push(this.parseDirective(t));if(n.length)return n}parseConstDirectives(){return this.parseDirectives(!0)}parseDirective(t){let n=this._lexer.token;return this.expectToken(o.AT),this.node(n,{kind:c.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(t)})}parseTypeReference(){let t=this._lexer.token,n;if(this.expectOptionalToken(o.BRACKET_L)){let r=this.parseTypeReference();this.expectToken(o.BRACKET_R),n=this.node(t,{kind:c.LIST_TYPE,type:r})}else n=this.parseNamedType();return this.expectOptionalToken(o.BANG)?this.node(t,{kind:c.NON_NULL_TYPE,type:n}):n}parseNamedType(){return this.node(this._lexer.token,{kind:c.NAMED_TYPE,name:this.parseName()})}peekDescription(){return this.peek(o.STRING)||this.peek(o.BLOCK_STRING)}parseDescription(){if(this.peekDescription())return this.parseStringLiteral()}parseSchemaDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("schema");let r=this.parseConstDirectives(),i=this.many(o.BRACE_L,this.parseOperationTypeDefinition,o.BRACE_R);return this.node(t,{kind:c.SCHEMA_DEFINITION,description:n,directives:r,operationTypes:i})}parseOperationTypeDefinition(){let t=this._lexer.token,n=this.parseOperationType();this.expectToken(o.COLON);let r=this.parseNamedType();return this.node(t,{kind:c.OPERATION_TYPE_DEFINITION,operation:n,type:r})}parseScalarTypeDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("scalar");let r=this.parseName(),i=this.parseConstDirectives();return this.node(t,{kind:c.SCALAR_TYPE_DEFINITION,description:n,name:r,directives:i})}parseObjectTypeDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("type");let r=this.parseName(),i=this.parseImplementsInterfaces(),s=this.parseConstDirectives(),a=this.parseFieldsDefinition();return this.node(t,{kind:c.OBJECT_TYPE_DEFINITION,description:n,name:r,interfaces:i,directives:s,fields:a})}parseImplementsInterfaces(){return this.expectOptionalKeyword("implements")?this.delimitedMany(o.AMP,this.parseNamedType):void 0}parseFieldsDefinition(){return this.optionalMany(o.BRACE_L,this.parseFieldDefinition,o.BRACE_R)}parseFieldDefinition(){let t=this._lexer.token,n=this.parseDescription(),r=this.parseName(),i=this.parseArgumentDefs();this.expectToken(o.COLON);let s=this.parseTypeReference(),a=this.parseConstDirectives();return this.node(t,{kind:c.FIELD_DEFINITION,description:n,name:r,arguments:i,type:s,directives:a})}parseArgumentDefs(){return this.optionalMany(o.PAREN_L,this.parseInputValueDef,o.PAREN_R)}parseInputValueDef(){let t=this._lexer.token,n=this.parseDescription(),r=this.parseName();this.expectToken(o.COLON);let i=this.parseTypeReference(),s;this.expectOptionalToken(o.EQUALS)&&(s=this.parseConstValueLiteral());let a=this.parseConstDirectives();return this.node(t,{kind:c.INPUT_VALUE_DEFINITION,description:n,name:r,type:i,defaultValue:s,directives:a})}parseInterfaceTypeDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("interface");let r=this.parseName(),i=this.parseImplementsInterfaces(),s=this.parseConstDirectives(),a=this.parseFieldsDefinition();return this.node(t,{kind:c.INTERFACE_TYPE_DEFINITION,description:n,name:r,interfaces:i,directives:s,fields:a})}parseUnionTypeDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("union");let r=this.parseName(),i=this.parseConstDirectives(),s=this.parseUnionMemberTypes();return this.node(t,{kind:c.UNION_TYPE_DEFINITION,description:n,name:r,directives:i,types:s})}parseUnionMemberTypes(){return this.expectOptionalToken(o.EQUALS)?this.delimitedMany(o.PIPE,this.parseNamedType):void 0}parseEnumTypeDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("enum");let r=this.parseName(),i=this.parseConstDirectives(),s=this.parseEnumValuesDefinition();return this.node(t,{kind:c.ENUM_TYPE_DEFINITION,description:n,name:r,directives:i,values:s})}parseEnumValuesDefinition(){return this.optionalMany(o.BRACE_L,this.parseEnumValueDefinition,o.BRACE_R)}parseEnumValueDefinition(){let t=this._lexer.token,n=this.parseDescription(),r=this.parseEnumValueName(),i=this.parseConstDirectives();return this.node(t,{kind:c.ENUM_VALUE_DEFINITION,description:n,name:r,directives:i})}parseEnumValueName(){if(this._lexer.token.value==="true"||this._lexer.token.value==="false"||this._lexer.token.value==="null")throw l(this._lexer.source,this._lexer.token.start,`${ce(this._lexer.token)} is reserved and cannot be used for an enum value.`);return this.parseName()}parseInputObjectTypeDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("input");let r=this.parseName(),i=this.parseConstDirectives(),s=this.parseInputFieldsDefinition();return this.node(t,{kind:c.INPUT_OBJECT_TYPE_DEFINITION,description:n,name:r,directives:i,fields:s})}parseInputFieldsDefinition(){return this.optionalMany(o.BRACE_L,this.parseInputValueDef,o.BRACE_R)}parseTypeSystemExtension(){let t=this._lexer.lookahead();if(t.kind===o.NAME)switch(t.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();case"directive":return this.parseDirectiveExtension()}throw this.unexpected(t)}parseSchemaExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");let n=this.parseConstDirectives(),r=this.optionalMany(o.BRACE_L,this.parseOperationTypeDefinition,o.BRACE_R);if(n===void 0&&r===void 0)throw this.unexpected();return this.node(t,{kind:c.SCHEMA_EXTENSION,directives:n,operationTypes:r})}parseScalarTypeExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("scalar");let n=this.parseName(),r=this.parseConstDirectives();if(r===void 0)throw this.unexpected();return this.node(t,{kind:c.SCALAR_TYPE_EXTENSION,name:n,directives:r})}parseObjectTypeExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");let n=this.parseName(),r=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),s=this.parseFieldsDefinition();if(r===void 0&&i===void 0&&s===void 0)throw this.unexpected();return this.node(t,{kind:c.OBJECT_TYPE_EXTENSION,name:n,interfaces:r,directives:i,fields:s})}parseInterfaceTypeExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");let n=this.parseName(),r=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),s=this.parseFieldsDefinition();if(r===void 0&&i===void 0&&s===void 0)throw this.unexpected();return this.node(t,{kind:c.INTERFACE_TYPE_EXTENSION,name:n,interfaces:r,directives:i,fields:s})}parseUnionTypeExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");let n=this.parseName(),r=this.parseConstDirectives(),i=this.parseUnionMemberTypes();if(r===void 0&&i===void 0)throw this.unexpected();return this.node(t,{kind:c.UNION_TYPE_EXTENSION,name:n,directives:r,types:i})}parseEnumTypeExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");let n=this.parseName(),r=this.parseConstDirectives(),i=this.parseEnumValuesDefinition();if(r===void 0&&i===void 0)throw this.unexpected();return this.node(t,{kind:c.ENUM_TYPE_EXTENSION,name:n,directives:r,values:i})}parseInputObjectTypeExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");let n=this.parseName(),r=this.parseConstDirectives(),i=this.parseInputFieldsDefinition();if(r===void 0&&i===void 0)throw this.unexpected();return this.node(t,{kind:c.INPUT_OBJECT_TYPE_EXTENSION,name:n,directives:r,fields:i})}parseDirectiveExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("directive"),this.expectToken(o.AT);let n=this.parseName(),r=this.parseConstDirectives();if(r===void 0)throw this.unexpected();return this.node(t,{kind:c.DIRECTIVE_EXTENSION,name:n,directives:r})}parseDirectiveDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("directive"),this.expectToken(o.AT);let r=this.parseName(),i=this.parseArgumentDefs(),s=this.parseConstDirectives(),a=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");let p=this.parseDirectiveLocations();return this.node(t,{kind:c.DIRECTIVE_DEFINITION,description:n,name:r,arguments:i,directives:s,repeatable:a,locations:p})}parseDirectiveLocations(){return this.delimitedMany(o.PIPE,this.parseDirectiveLocation)}parseDirectiveLocation(){let t=this._lexer.token,n=this.parseName();if(ct(Se,n.value))return n;throw this.unexpected(t)}parseSchemaCoordinate(){let t=this._lexer.token,n=this.expectOptionalToken(o.AT),r=this.parseName(),i;!n&&this.expectOptionalToken(o.DOT)&&(i=this.parseName());let s;return(n||i)&&this.expectOptionalToken(o.PAREN_L)&&(s=this.parseName(),this.expectToken(o.COLON),this.expectToken(o.PAREN_R)),n?s?this.node(t,{kind:c.DIRECTIVE_ARGUMENT_COORDINATE,name:r,argumentName:s}):this.node(t,{kind:c.DIRECTIVE_COORDINATE,name:r}):i?s?this.node(t,{kind:c.ARGUMENT_COORDINATE,name:r,fieldName:i,argumentName:s}):this.node(t,{kind:c.MEMBER_COORDINATE,name:r,memberName:i}):this.node(t,{kind:c.TYPE_COORDINATE,name:r})}node(t,n){return this._options.noLocation!==!0&&(n.loc=new Q(t,this._lexer.lastToken,this._lexer.source)),n}peek(t){return this._lexer.token.kind===t}expectToken(t){let n=this._lexer.token;if(n.kind===t)return this.advanceLexer(),n;throw l(this._lexer.source,n.start,`Expected ${_t(t)}, found ${ce(n)}.`)}expectOptionalToken(t){return this._lexer.token.kind===t?(this.advanceLexer(),!0):!1}expectKeyword(t){let n=this._lexer.token;if(n.kind===o.NAME&&n.value===t)this.advanceLexer();else throw l(this._lexer.source,n.start,`Expected "${t}", found ${ce(n)}.`)}expectOptionalKeyword(t){let n=this._lexer.token;return n.kind===o.NAME&&n.value===t?(this.advanceLexer(),!0):!1}unexpected(t){let n=t??this._lexer.token;return l(this._lexer.source,n.start,`Unexpected ${ce(n)}.`)}any(t,n,r){this.expectToken(t);let i=[];for(;!this.expectOptionalToken(r);)i.push(n.call(this));return i}optionalMany(t,n,r){if(this.expectOptionalToken(t)){let i=[];do i.push(n.call(this));while(!this.expectOptionalToken(r));return i}}many(t,n,r){this.expectToken(t);let i=[];do i.push(n.call(this));while(!this.expectOptionalToken(r));return i}delimitedMany(t,n){this.expectOptionalToken(t);let r=[];do r.push(n.call(this));while(this.expectOptionalToken(t));return r}advanceLexer(){let{maxLexicalTokens:t=this._options.maxTokens}=this._options,n=this._lexer.advance();if(n.kind!==o.EOF&&(++this._tokenCounter,t!==void 0&&this._tokenCounter>t))throw l(this._lexer.source,n.start,`Document contains more than ${t} tokens. Parsing aborted.`)}};function ce(e){let t=e.value;return _t(e.kind)+(t!=null?` "${t}"`:"")}function _t(e){return ht(e)?`"${e}"`:e}function di(e,t){let n=new SyntaxError(e+" ("+t.loc.start.line+":"+t.loc.start.column+")");return Object.assign(n,t)}var Dt=di;function fi(e){let t=[],{startToken:n,endToken:r}=e.loc;for(let i=n;i!==r;i=i.next)i.kind==="Comment"&&t.push({...i,loc:{start:i.start,end:i.end}});return t}var mi={experimentalFragmentArguments:!0};function hi(e){if(!(e instanceof L))return e;let{message:t,locations:[n]}=e;return Dt(t,{loc:{start:n},cause:e})}function Ei(e){let t;try{t=pe(e,mi)}catch(n){throw hi(n)}return t.comments=fi(t),t}var Ti={parse:Ei,astFormat:"graphql",hasPragma:$e,hasIgnorePragma:Qe,locStart:Z,locEnd:ee};var xi={graphql:Ze};return Ot(yi);});
|
|
17
|
+
`));return e.line+=d.length-1,e.lineStart=i,D}if(x===92&&n.charCodeAt(s+1)===34&&n.charCodeAt(s+2)===34&&n.charCodeAt(s+3)===34){p+=n.slice(a,s),a=s+1,s+=4;continue}if(x===10||x===13){p+=n.slice(a,s),d.push(p),x===13&&n.charCodeAt(s+1)===10?s+=2:++s,p="",a=s,i=s;continue}if(G(x))++s;else if(ce(n,s))s+=2;else throw l(e.source,s,`Invalid character within String: ${V(e,s)}.`)}throw l(e.source,s,"Unterminated string.")}function ai(e,t){let n=e.source.body,r=n.length,i=t+1;for(;i<r;){let s=n.charCodeAt(i);if(lt(s))++i;else break}return h(e,o.NAME,t,i,n.slice(t,i))}var xt=Symbol("Source"),K=class{constructor(t,n="GraphQL request",r={line:1,column:1}){this.__kind=xt,this.body=t,this.name=n,this.locationOffset=r,this.locationOffset.line>0||De(!1,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||De(!1,"column in locationOffset is 1-indexed and must be positive.")}get[Symbol.toStringTag](){return"Source"}};function yt(e){return it(e,xt,K)}function ue(e,t){return ft(ge)?ge.traceSync(()=>Nt(e,t),{source:e}):Nt(e,t)}function Nt(e,t){let n=new Ie(e,t),r=n.parseDocument();return Object.defineProperty(r,"tokenCount",{enumerable:!1,value:n.tokenCount}),r}var Ie=class{constructor(t,n={}){let{lexer:r,...i}=n;if(r)this._lexer=r;else{let a=yt(t)?t:new K(t);this._lexer=new W(a)}this._options=i,this._tokenCounter=0,this._lexer._maxComments=i.maxComments,this._lexer._commentCount=0;let s=i.maxSourceLength;if(s!==void 0&&this._lexer.source.body.length>s)throw l(this._lexer.source,s,`Source contains more than ${s} UTF-16 code units. Parsing aborted.`)}get tokenCount(){return this._tokenCounter}parseName(){let t=this.expectToken(o.NAME);return this.node(t,{kind:c.NAME,value:t.value})}parseDocument(){return this.node(this._lexer.token,{kind:c.DOCUMENT,definitions:this.many(o.SOF,this.parseDefinition,o.EOF)})}parseDefinition(){if(this.peek(o.BRACE_L))return this.parseOperationDefinition();let t=this.peekDescription(),n=t?this._lexer.lookahead():this._lexer.token;if(t&&n.kind===o.BRACE_L)throw l(this._lexer.source,this._lexer.token.start,"Unexpected description, descriptions are not supported on shorthand queries.");if(n.kind===o.NAME){switch(n.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(n.value){case"query":case"mutation":case"subscription":return this.parseOperationDefinition();case"fragment":return this.parseFragmentDefinition()}if(t)throw l(this._lexer.source,this._lexer.token.start,"Unexpected description, only GraphQL definitions support descriptions.");if(n.value==="extend")return this.parseTypeSystemExtension()}throw this.unexpected(n)}parseOperationDefinition(){let t=this._lexer.token;if(this.peek(o.BRACE_L))return this.node(t,{kind:c.OPERATION_DEFINITION,operation:U.QUERY,description:void 0,name:void 0,variableDefinitions:void 0,directives:void 0,selectionSet:this.parseSelectionSet()});let n=this.parseDescription(),r=this.parseOperationType(),i;return this.peek(o.NAME)&&(i=this.parseName()),this.node(t,{kind:c.OPERATION_DEFINITION,operation:r,description:n,name:i,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseOperationType(){let t=this.expectToken(o.NAME);switch(t.value){case"query":return U.QUERY;case"mutation":return U.MUTATION;case"subscription":return U.SUBSCRIPTION}throw this.unexpected(t)}parseVariableDefinitions(){return this.optionalMany(o.PAREN_L,this.parseVariableDefinition,o.PAREN_R)}parseVariableDefinition(){return this.node(this._lexer.token,{kind:c.VARIABLE_DEFINITION,description:this.parseDescription(),variable:this.parseVariable(),type:(this.expectToken(o.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(o.EQUALS)?this.parseConstValueLiteral():void 0,directives:this.parseConstDirectives()})}parseVariable(){let t=this._lexer.token;return this.expectToken(o.DOLLAR),this.node(t,{kind:c.VARIABLE,name:this.parseName()})}parseSelectionSet(){return this.node(this._lexer.token,{kind:c.SELECTION_SET,selections:this._options.allowEmptySelectionSets===!1?this.many(o.BRACE_L,this.parseSelection,o.BRACE_R):this.any(o.BRACE_L,this.parseSelection,o.BRACE_R)})}parseSelection(){return this.peek(o.SPREAD)?this.parseFragment():this.parseField()}parseField(){let t=this._lexer.token,n=this.parseName(),r,i;return this.expectOptionalToken(o.COLON)?(r=n,i=this.parseName()):i=n,this.node(t,{kind:c.FIELD,alias:r,name:i,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(o.BRACE_L)?this.parseSelectionSet():void 0})}parseArguments(t){let n=t?this.parseConstArgument:this.parseArgument;return this.optionalMany(o.PAREN_L,n,o.PAREN_R)}parseFragmentArguments(){let t=this.parseFragmentArgument;return this.optionalMany(o.PAREN_L,t,o.PAREN_R)}parseArgument(t=!1){let n=this._lexer.token,r=this.parseName();return this.expectToken(o.COLON),this.node(n,{kind:c.ARGUMENT,name:r,value:this.parseValueLiteral(t)})}parseConstArgument(){return this.parseArgument(!0)}parseFragmentArgument(){let t=this._lexer.token,n=this.parseName();return this.expectToken(o.COLON),this.node(t,{kind:c.FRAGMENT_ARGUMENT,name:n,value:this.parseValueLiteral(!1)})}parseFragment(){let t=this._lexer.token;this.expectToken(o.SPREAD);let n=this.expectOptionalKeyword("on");if(!n&&this.peek(o.NAME)){let r=this.parseFragmentName();return this.peek(o.PAREN_L)&&this._options.experimentalFragmentArguments?this.node(t,{kind:c.FRAGMENT_SPREAD,name:r,arguments:this.parseFragmentArguments(),directives:this.parseDirectives(!1)}):this.node(t,{kind:c.FRAGMENT_SPREAD,name:r,directives:this.parseDirectives(!1)})}return this.node(t,{kind:c.INLINE_FRAGMENT,typeCondition:n?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentDefinition(){let t=this._lexer.token,n=this.parseDescription();return this.expectKeyword("fragment"),this._options.experimentalFragmentArguments===!0?this.node(t,{kind:c.FRAGMENT_DEFINITION,description:n,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()}):this.node(t,{kind:c.FRAGMENT_DEFINITION,description:n,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(t){let n=this._lexer.token;switch(n.kind){case o.BRACKET_L:return this.parseList(t);case o.BRACE_L:return this.parseObject(t);case o.INT:return this.advanceLexer(),this.node(n,{kind:c.INT,value:n.value});case o.FLOAT:return this.advanceLexer(),this.node(n,{kind:c.FLOAT,value:n.value});case o.STRING:case o.BLOCK_STRING:return this.parseStringLiteral();case o.NAME:switch(this.advanceLexer(),n.value){case"true":return this.node(n,{kind:c.BOOLEAN,value:!0});case"false":return this.node(n,{kind:c.BOOLEAN,value:!1});case"null":return this.node(n,{kind:c.NULL});default:return this.node(n,{kind:c.ENUM,value:n.value})}case o.DOLLAR:if(t)if(this.expectToken(o.DOLLAR),this._lexer.token.kind===o.NAME){let r=this._lexer.token.value;throw l(this._lexer.source,n.start,`Unexpected variable "$${r}" in constant value.`)}else throw this.unexpected(n);return this.parseVariable();default:throw this.unexpected()}}parseConstValueLiteral(){return this.parseValueLiteral(!0)}parseStringLiteral(){let t=this._lexer.token;return this.advanceLexer(),this.node(t,{kind:c.STRING,value:t.value,block:t.kind===o.BLOCK_STRING})}parseList(t){let n=()=>this.parseValueLiteral(t);return this.node(this._lexer.token,{kind:c.LIST,values:this.any(o.BRACKET_L,n,o.BRACKET_R)})}parseObject(t){let n=()=>this.parseObjectField(t);return this.node(this._lexer.token,{kind:c.OBJECT,fields:this.any(o.BRACE_L,n,o.BRACE_R)})}parseObjectField(t){let n=this._lexer.token,r=this.parseName();return this.expectToken(o.COLON),this.node(n,{kind:c.OBJECT_FIELD,name:r,value:this.parseValueLiteral(t)})}parseDirectives(t){let n=[];for(;this.peek(o.AT);)n.push(this.parseDirective(t));if(n.length)return n}parseConstDirectives(){return this.parseDirectives(!0)}parseDirective(t){let n=this._lexer.token;return this.expectToken(o.AT),this.node(n,{kind:c.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(t)})}parseTypeReference(){let t=this._lexer.token,n;if(this.expectOptionalToken(o.BRACKET_L)){let r=this.parseTypeReference();this.expectToken(o.BRACKET_R),n=this.node(t,{kind:c.LIST_TYPE,type:r})}else n=this.parseNamedType();return this.expectOptionalToken(o.BANG)?this.node(t,{kind:c.NON_NULL_TYPE,type:n}):n}parseNamedType(){return this.node(this._lexer.token,{kind:c.NAMED_TYPE,name:this.parseName()})}peekDescription(){return this.peek(o.STRING)||this.peek(o.BLOCK_STRING)}parseDescription(){if(this.peekDescription())return this.parseStringLiteral()}parseSchemaDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("schema");let r=this.parseConstDirectives(),i=this.many(o.BRACE_L,this.parseOperationTypeDefinition,o.BRACE_R);return this.node(t,{kind:c.SCHEMA_DEFINITION,description:n,directives:r,operationTypes:i})}parseOperationTypeDefinition(){let t=this._lexer.token,n=this.parseOperationType();this.expectToken(o.COLON);let r=this.parseNamedType();return this.node(t,{kind:c.OPERATION_TYPE_DEFINITION,operation:n,type:r})}parseScalarTypeDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("scalar");let r=this.parseName(),i=this.parseConstDirectives();return this.node(t,{kind:c.SCALAR_TYPE_DEFINITION,description:n,name:r,directives:i})}parseObjectTypeDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("type");let r=this.parseName(),i=this.parseImplementsInterfaces(),s=this.parseConstDirectives(),a=this.parseFieldsDefinition();return this.node(t,{kind:c.OBJECT_TYPE_DEFINITION,description:n,name:r,interfaces:i,directives:s,fields:a})}parseImplementsInterfaces(){return this.expectOptionalKeyword("implements")?this.delimitedMany(o.AMP,this.parseNamedType):void 0}parseFieldsDefinition(){return this.optionalMany(o.BRACE_L,this.parseFieldDefinition,o.BRACE_R)}parseFieldDefinition(){let t=this._lexer.token,n=this.parseDescription(),r=this.parseName(),i=this.parseArgumentDefs();this.expectToken(o.COLON);let s=this.parseTypeReference(),a=this.parseConstDirectives();return this.node(t,{kind:c.FIELD_DEFINITION,description:n,name:r,arguments:i,type:s,directives:a})}parseArgumentDefs(){return this.optionalMany(o.PAREN_L,this.parseInputValueDef,o.PAREN_R)}parseInputValueDef(){let t=this._lexer.token,n=this.parseDescription(),r=this.parseName();this.expectToken(o.COLON);let i=this.parseTypeReference(),s;this.expectOptionalToken(o.EQUALS)&&(s=this.parseConstValueLiteral());let a=this.parseConstDirectives();return this.node(t,{kind:c.INPUT_VALUE_DEFINITION,description:n,name:r,type:i,defaultValue:s,directives:a})}parseInterfaceTypeDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("interface");let r=this.parseName(),i=this.parseImplementsInterfaces(),s=this.parseConstDirectives(),a=this.parseFieldsDefinition();return this.node(t,{kind:c.INTERFACE_TYPE_DEFINITION,description:n,name:r,interfaces:i,directives:s,fields:a})}parseUnionTypeDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("union");let r=this.parseName(),i=this.parseConstDirectives(),s=this.parseUnionMemberTypes();return this.node(t,{kind:c.UNION_TYPE_DEFINITION,description:n,name:r,directives:i,types:s})}parseUnionMemberTypes(){return this.expectOptionalToken(o.EQUALS)?this.delimitedMany(o.PIPE,this.parseNamedType):void 0}parseEnumTypeDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("enum");let r=this.parseName(),i=this.parseConstDirectives(),s=this.parseEnumValuesDefinition();return this.node(t,{kind:c.ENUM_TYPE_DEFINITION,description:n,name:r,directives:i,values:s})}parseEnumValuesDefinition(){return this.optionalMany(o.BRACE_L,this.parseEnumValueDefinition,o.BRACE_R)}parseEnumValueDefinition(){let t=this._lexer.token,n=this.parseDescription(),r=this.parseEnumValueName(),i=this.parseConstDirectives();return this.node(t,{kind:c.ENUM_VALUE_DEFINITION,description:n,name:r,directives:i})}parseEnumValueName(){if(this._lexer.token.value==="true"||this._lexer.token.value==="false"||this._lexer.token.value==="null")throw l(this._lexer.source,this._lexer.token.start,`${pe(this._lexer.token)} is reserved and cannot be used for an enum value.`);return this.parseName()}parseInputObjectTypeDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("input");let r=this.parseName(),i=this.parseConstDirectives(),s=this.parseInputFieldsDefinition();return this.node(t,{kind:c.INPUT_OBJECT_TYPE_DEFINITION,description:n,name:r,directives:i,fields:s})}parseInputFieldsDefinition(){return this.optionalMany(o.BRACE_L,this.parseInputValueDef,o.BRACE_R)}parseTypeSystemExtension(){let t=this._lexer.lookahead();if(t.kind===o.NAME)switch(t.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();case"directive":return this.parseDirectiveExtension()}throw this.unexpected(t)}parseSchemaExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");let n=this.parseConstDirectives(),r=this.optionalMany(o.BRACE_L,this.parseOperationTypeDefinition,o.BRACE_R);if(n===void 0&&r===void 0)throw this.unexpected();return this.node(t,{kind:c.SCHEMA_EXTENSION,directives:n,operationTypes:r})}parseScalarTypeExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("scalar");let n=this.parseName(),r=this.parseConstDirectives();if(r===void 0)throw this.unexpected();return this.node(t,{kind:c.SCALAR_TYPE_EXTENSION,name:n,directives:r})}parseObjectTypeExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");let n=this.parseName(),r=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),s=this.parseFieldsDefinition();if(r===void 0&&i===void 0&&s===void 0)throw this.unexpected();return this.node(t,{kind:c.OBJECT_TYPE_EXTENSION,name:n,interfaces:r,directives:i,fields:s})}parseInterfaceTypeExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");let n=this.parseName(),r=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),s=this.parseFieldsDefinition();if(r===void 0&&i===void 0&&s===void 0)throw this.unexpected();return this.node(t,{kind:c.INTERFACE_TYPE_EXTENSION,name:n,interfaces:r,directives:i,fields:s})}parseUnionTypeExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");let n=this.parseName(),r=this.parseConstDirectives(),i=this.parseUnionMemberTypes();if(r===void 0&&i===void 0)throw this.unexpected();return this.node(t,{kind:c.UNION_TYPE_EXTENSION,name:n,directives:r,types:i})}parseEnumTypeExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");let n=this.parseName(),r=this.parseConstDirectives(),i=this.parseEnumValuesDefinition();if(r===void 0&&i===void 0)throw this.unexpected();return this.node(t,{kind:c.ENUM_TYPE_EXTENSION,name:n,directives:r,values:i})}parseInputObjectTypeExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");let n=this.parseName(),r=this.parseConstDirectives(),i=this.parseInputFieldsDefinition();if(r===void 0&&i===void 0)throw this.unexpected();return this.node(t,{kind:c.INPUT_OBJECT_TYPE_EXTENSION,name:n,directives:r,fields:i})}parseDirectiveExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("directive"),this.expectToken(o.AT);let n=this.parseName(),r=this.parseConstDirectives();if(r===void 0)throw this.unexpected();return this.node(t,{kind:c.DIRECTIVE_EXTENSION,name:n,directives:r})}parseDirectiveDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("directive"),this.expectToken(o.AT);let r=this.parseName(),i=this.parseArgumentDefs(),s=this.parseConstDirectives(),a=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");let p=this.parseDirectiveLocations();return this.node(t,{kind:c.DIRECTIVE_DEFINITION,description:n,name:r,arguments:i,directives:s,repeatable:a,locations:p})}parseDirectiveLocations(){return this.delimitedMany(o.PIPE,this.parseDirectiveLocation)}parseDirectiveLocation(){let t=this._lexer.token,n=this.parseName();if(ct(Se,n.value))return n;throw this.unexpected(t)}parseSchemaCoordinate(){let t=this._lexer.token,n=this.expectOptionalToken(o.AT),r=this.parseName(),i;!n&&this.expectOptionalToken(o.DOT)&&(i=this.parseName());let s;return(n||i)&&this.expectOptionalToken(o.PAREN_L)&&(s=this.parseName(),this.expectToken(o.COLON),this.expectToken(o.PAREN_R)),n?s?this.node(t,{kind:c.DIRECTIVE_ARGUMENT_COORDINATE,name:r,argumentName:s}):this.node(t,{kind:c.DIRECTIVE_COORDINATE,name:r}):i?s?this.node(t,{kind:c.ARGUMENT_COORDINATE,name:r,fieldName:i,argumentName:s}):this.node(t,{kind:c.MEMBER_COORDINATE,name:r,memberName:i}):this.node(t,{kind:c.TYPE_COORDINATE,name:r})}node(t,n){return this._options.noLocation!==!0&&(n.loc=new X(t,this._lexer.lastToken,this._lexer.source)),n}peek(t){return this._lexer.token.kind===t}expectToken(t){let n=this._lexer.token;if(n.kind===t)return this.advanceLexer(),n;throw l(this._lexer.source,n.start,`Expected ${_t(t)}, found ${pe(n)}.`)}expectOptionalToken(t){return this._lexer.token.kind===t?(this.advanceLexer(),!0):!1}expectKeyword(t){let n=this._lexer.token;if(n.kind===o.NAME&&n.value===t)this.advanceLexer();else throw l(this._lexer.source,n.start,`Expected "${t}", found ${pe(n)}.`)}expectOptionalKeyword(t){let n=this._lexer.token;return n.kind===o.NAME&&n.value===t?(this.advanceLexer(),!0):!1}unexpected(t){let n=t??this._lexer.token;return l(this._lexer.source,n.start,`Unexpected ${pe(n)}.`)}any(t,n,r){this.expectToken(t);let i=[];for(;!this.expectOptionalToken(r);)i.push(n.call(this));return i}optionalMany(t,n,r){if(this.expectOptionalToken(t)){let i=[];do i.push(n.call(this));while(!this.expectOptionalToken(r));return i}}many(t,n,r){this.expectToken(t);let i=[];do i.push(n.call(this));while(!this.expectOptionalToken(r));return i}delimitedMany(t,n){this.expectOptionalToken(t);let r=[];do r.push(n.call(this));while(this.expectOptionalToken(t));return r}advanceLexer(){let{maxLexicalTokens:t=this._options.maxTokens}=this._options,n=this._lexer.advance();if(n.kind!==o.EOF&&(++this._tokenCounter,t!==void 0&&this._tokenCounter>t))throw l(this._lexer.source,n.start,`Document contains more than ${t} tokens. Parsing aborted.`)}};function pe(e){let t=e.value;return _t(e.kind)+(t!=null?` "${t}"`:"")}function _t(e){return ht(e)?`"${e}"`:e}function di(e,t){let n=new SyntaxError(e+" ("+t.loc.start.line+":"+t.loc.start.column+")");return Object.assign(n,t)}var Dt=di;function fi(e){let t=[],{startToken:n,endToken:r}=e.loc;for(let i=n;i!==r;i=i.next)i.kind==="Comment"&&t.push({...i,loc:{start:i.start,end:i.end}});return t}var mi={experimentalFragmentArguments:!0};function hi(e){if(!(e instanceof L))return e;let{message:t,locations:[n]}=e;return Dt(t,{loc:{start:n},cause:e})}function Ei(e){let t;try{t=ue(e,mi)}catch(n){throw hi(n)}return t.comments=fi(t),t}var Ti={parse:Ei,astFormat:"graphql",hasPragma:$e,hasIgnorePragma:Qe,locStart:ee,locEnd:te};var xi={graphql:Ze};return Ot(yi);});
|
package/plugins/graphql.mjs
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
var At=Object.defineProperty;var
|
|
1
|
+
var At=Object.defineProperty;var de=(e,t)=>{for(var n in t)At(e,n,{get:t[n],enumerable:!0})};var Dt={};de(Dt,{languages:()=>Ze,options:()=>tt,parsers:()=>Ie,printers:()=>mi});var Oe=(e,t)=>(n,r,...i)=>n|1&&r==null?void 0:(t.call(r)??r[e]).apply(r,i);var St=String.prototype.replaceAll??function(e,t){return e.global?this.replace(e,t):this.split(e).join(t)},gt=Oe("replaceAll",function(){if(typeof this=="string")return St}),Y=gt;var It=()=>{},fe=It;var Ce="indent";var ve="group";var ke="if-break";var J="line";var Re="break-parent";function Le(e,t,n){if(!e.has(t)){let r=n(t);e.set(t,r)}return e.get(t)}var k=fe,z=fe;function E(e){return k(e),{type:Ce,contents:e}}var me={type:Re};function S(e,t={}){return k(e),z(t.expandedStates,!0),{type:ve,id:t.id,contents:e,break:!!t.shouldBreak,expandedStates:t.expandedStates}}function O(e,t="",n={}){return k(e),t!==""&&k(t),{type:ke,breakContents:e,flatContents:t,groupId:n.groupId}}function m(e,t){k(e),z(t);let n=[];for(let r=0;r<t.length;r++)r!==0&&n.push(e),n.push(t[r]);return n}var C={type:J},y={type:J,soft:!0},Ot={type:J,hard:!0},u=[Ot,me];function Z(e){return(t,n,r)=>{if(n===!1)return!1;let i=!!r?.backwards,{length:s}=t,a=n;for(;a>=0&&a<s;){let p=t.charAt(a);if(e instanceof RegExp){if(!e.test(p))return a}else if(!e.includes(p))return a;i?a--:a++}return a===-1||a===s?a:!1}}var Ui=Z(/\s/),b=Z(" "),be=Z(",; "),Fe=Z(/[^\n\r]/);var Pe=e=>e===`
|
|
2
2
|
`||e==="\r"||e==="\u2028"||e==="\u2029";function Ct(e,t,n){if(t===!1)return!1;let r=!!n?.backwards,i=e.charAt(t);if(r){if(e.charAt(t-1)==="\r"&&i===`
|
|
3
3
|
`)return t-2;if(Pe(i))return t-1}else{if(i==="\r"&&e.charAt(t+1)===`
|
|
4
|
-
`)return t+2;if(Pe(i))return t+1}return t}var F=Ct;function vt(e,t,n={}){let r=b(e,n.backwards?t-1:t,n),i=F(e,r,n);return r!==i}var we=vt;function kt(e,t){let n=t-1;n=b(e,n,{backwards:!0}),n=F(e,n,{backwards:!0}),n=b(e,n,{backwards:!0});let r=F(e,n,{backwards:!0});return n!==r}var Ve=kt;var Rt=()=>!0;function Lt(e,t){let n=e.node;return n.printed=!0,t.printer.printComment(e,t)}function
|
|
4
|
+
`)return t+2;if(Pe(i))return t+1}return t}var F=Ct;function vt(e,t,n={}){let r=b(e,n.backwards?t-1:t,n),i=F(e,r,n);return r!==i}var we=vt;function kt(e,t){let n=t-1;n=b(e,n,{backwards:!0}),n=F(e,n,{backwards:!0}),n=b(e,n,{backwards:!0});let r=F(e,n,{backwards:!0});return n!==r}var Ve=kt;var Rt=()=>!0;function Lt(e,t){let n=e.node;return n.printed=!0,t.printer.printComment(e,t)}function q(e,t,n={}){let{originalText:r,locStart:i}=t,{indent:s=!1,marker:a,filter:p=Rt,separator:d=({comment:f})=>Ve(r,i(f))?[u,u]:u}=n,x=new Set(e.node?.comments?.filter(f=>!(f.leading||f.trailing||f.marker!==a||!p(f))));if(x.size===0)return"";let D=[],I;return e.each(({node:f})=>{x.has(f)&&(I&&D.push(typeof d=="function"?d({previous:I,comment:f}):d),D.push(Lt(e,t)),I=f)},"comments"),s?E([u,D]):D}function bt(e){return Array.isArray(e)&&e.length>0}var N=bt;var he=class extends Error{name="UnexpectedNodeError";constructor(t,n,r="type"){super(`Unexpected ${n} node ${r}: ${JSON.stringify(t[r])}.`),this.node=t}},Me=he;var $=null;function Q(e){if($!==null&&typeof $.property){let t=$;return $=Q.prototype=null,t}return $=Q.prototype=e??Object.create(null),new Q}var Ft=10;for(let e=0;e<=Ft;e++)Q();function Ee(e){return Q(e)}function Pt(e,t="type"){Ee(e);function n(r){let i=r[t],s=e[i];if(!Array.isArray(s))throw Object.assign(new Error(`Missing visitor keys for '${i}'.`),{node:r});return s}return n}var Be=Pt;var _=[["name"],["name","value"],["type"],["description","name","directives"],["description","name","interfaces","directives","fields"],["name","directives"],["name","interfaces","directives","fields"]],Ue={Name:[],Document:["definitions"],OperationDefinition:["description","name","variableDefinitions","directives","selectionSet"],VariableDefinition:["description","variable","type","defaultValue","directives"],Variable:_[0],SelectionSet:["selections"],Field:["alias","name","arguments","directives","selectionSet"],Argument:_[1],FragmentArgument:_[1],FragmentSpread:["name","arguments","directives"],InlineFragment:["typeCondition","directives","selectionSet"],FragmentDefinition:["description","name","variableDefinitions","typeCondition","directives","selectionSet"],IntValue:[],FloatValue:[],StringValue:[],BooleanValue:[],NullValue:[],EnumValue:[],ListValue:["values"],ObjectValue:["fields"],ObjectField:_[1],Directive:["name","arguments"],NamedType:_[0],ListType:_[2],NonNullType:_[2],SchemaDefinition:["description","directives","operationTypes"],OperationTypeDefinition:_[2],ScalarTypeDefinition:_[3],ObjectTypeDefinition:_[4],FieldDefinition:["description","name","arguments","type","directives"],InputValueDefinition:["description","name","type","defaultValue","directives"],InterfaceTypeDefinition:_[4],UnionTypeDefinition:["description","name","directives","types"],EnumTypeDefinition:["description","name","directives","values"],EnumValueDefinition:_[3],InputObjectTypeDefinition:["description","name","directives","fields"],DirectiveDefinition:["description","name","arguments","directives","locations"],SchemaExtension:["directives","operationTypes"],DirectiveExtension:_[5],ScalarTypeExtension:_[5],ObjectTypeExtension:_[6],InterfaceTypeExtension:_[6],UnionTypeExtension:["name","directives","types"],EnumTypeExtension:["name","directives","values"],InputObjectTypeExtension:["name","directives","fields"]};var wt=Be(Ue,"kind"),Ge=wt;function Te(e,t){e.kind==="StringValue"&&e.block&&!e.value.includes(`
|
|
5
5
|
`)&&(t.value=e.value.trim())}Te.ignoredProperties=new Set(["loc","comments"]);var Ke="format",je=/^\s*#[^\S\n]*@(?:noformat|noprettier)\s*(?:\n|$)/,Ye=/^\s*#[^\S\n]*@(?:format|prettier)\s*(?:\n|$)/;var qe=e=>Ye.test(e),$e=e=>je.test(e),Qe=e=>`# @${Ke}
|
|
6
6
|
|
|
7
|
-
${e}`;function Vt(e,t){if(t===!1)return!1;if(e.charAt(t)==="/"&&e.charAt(t+1)==="*"){for(let n=t+2;n<e.length;++n)if(e.charAt(n)==="*"&&e.charAt(n+1)==="/")return n+2}return t}var Xe=Vt;function Mt(e,t){return t===!1?!1:e.charAt(t)==="/"&&e.charAt(t+1)==="/"?Fe(e,t):t}var He=Mt;function Bt(e,t){let n=null,r=t;for(;r!==n;)n=r,r=be(e,r),r=Xe(e,r),r=b(e,r);return r=He(e,r),r=F(e,r),r!==!1&&we(e,r)}var We=Bt;var
|
|
7
|
+
${e}`;function Vt(e,t){if(t===!1)return!1;if(e.charAt(t)==="/"&&e.charAt(t+1)==="*"){for(let n=t+2;n<e.length;++n)if(e.charAt(n)==="*"&&e.charAt(n+1)==="/")return n+2}return t}var Xe=Vt;function Mt(e,t){return t===!1?!1:e.charAt(t)==="/"&&e.charAt(t+1)==="/"?Fe(e,t):t}var He=Mt;function Bt(e,t){let n=null,r=t;for(;r!==n;)n=r,r=be(e,r),r=Xe(e,r),r=b(e,r);return r=He(e,r),r=F(e,r),r!==!1&&we(e,r)}var We=Bt;var ee=e=>e.loc.start,te=e=>e.loc.end;function v(e,t,n,r){return e.map(({isLast:i,node:s})=>{let a=n();return!i&&We(t.originalText,te(s))?[a,u]:a},r)}function M(e,t,n){let{node:r}=e;return N(r.arguments)?S(["(",E([y,m([O("",", "),y],v(e,t,n,"arguments"))]),y,")"]):""}function g(e,t,n){let{node:r}=e;if(!r.description)return"";let i=[n("description")];return r.kind==="InputValueDefinition"&&!r.description.block?i.push(C):i.push(u),i}function T(e,t){let{node:n}=e;if(!N(n.directives))return"";let r=m(C,e.map(t,"directives"));return n.kind==="FragmentDefinition"||n.kind==="OperationDefinition"?S([C,r]):[" ",S(E([y,r]))]}var Ut=new WeakMap,ne=(e,t)=>Le(Ut,e,n=>t.originalText[ee(n)]!=="{");function Je(e,t,n){let{node:r}=e,i=["{"];if(r.selections.length>0)i.push(E([u,m(u,v(e,t,n,"selections"))]),u);else{let s=q(e,t,{indent:!0});s&&i.push(s,u)}return i.push("}"),i}function ie(e,t,n){let{node:r}=e,{selectionSet:i}=r;if(!i)return"";let s=n("selectionSet");return r.type==="OperationDefinition"&&r.name&&ne(r,t)?s:[" ",s]}function xe(e,t){let{node:n}=e;return N(n.variableDefinitions)?S(["(",E([y,m([O("",", "),y],e.map(t,"variableDefinitions"))]),y,")"]):""}function Gt(e,t,n){let{node:r}=e;switch(r.kind){case"Document":return[...m(u,v(e,t,n,"definitions")),u];case"OperationDefinition":{let i=ne(r,t),s=!!r.name;return[g(e,t,n),i?r.operation:"",i&&s?[" ",n("name")]:"",i&&!s&&N(r.variableDefinitions)?" ":"",xe(e,n),T(e,n),!i&&!s?"":" ",n("selectionSet")]}case"FragmentDefinition":return[g(e,t,n),"fragment ",n("name"),xe(e,n)," on ",n("typeCondition"),T(e,n),ie(e,t,n)];case"SelectionSet":return Je(e,t,n);case"Field":return S([r.alias?[n("alias"),": "]:"",n("name"),M(e,t,n),T(e,n),ie(e,t,n)]);case"Name":return r.value;case"StringValue":if(r.block){let i=Y(0,r.value,'"""','\\"""').split(`
|
|
8
8
|
`);return i.length===1&&(i[0]=i[0].trim()),i.every(s=>s==="")&&(i.length=0),m(u,['"""',...i,'"""'])}return['"',Y(0,Y(0,Y(0,r.value,/["\\]/g,"\\$&"),"\r","\\r"),`
|
|
9
|
-
`,"\\n"),'"'];case"IntValue":case"FloatValue":case"EnumValue":return r.value;case"BooleanValue":return r.value?"true":"false";case"NullValue":return"null";case"Variable":return["$",n("name")];case"ListValue":{let i=!N(r.values);return S(["[",
|
|
10
|
-
`,D=r.split(/\r\n|[\n\r]/g),I=D[i];if(I.length>120){let f=[];for(let A=0;A<I.length;A+=80)f.push(I.slice(A,A+80));let j=d-1,R=Math.min(Math.floor(j/80),f.length-1),
|
|
11
|
-
`)}var L=class e extends Error{constructor(t,n={}){let{nodes:r,source:i,positions:s,path:a,originalError:p,cause:d,extensions:x}=n,D="cause"in n,I=D?d:p,f=D||p!=null?{cause:I}:void 0;super(t,f),this.name="GraphQLError",this.path=a??void 0;let j=p??(d instanceof Error?d:void 0);this.originalError=j,this.nodes=ot(Array.isArray(r)?r:r?[r]:void 0);let R=ot(this.nodes?.map(A=>A.loc).filter(A=>A!=null));this.source=i??R?.[0]?.source,this.positions=s??R?.map(A=>A.start),this.locations=s&&i?ye(s.map(A=>({source:i,start:A}))):R&&ye(R);let
|
|
9
|
+
`,"\\n"),'"'];case"IntValue":case"FloatValue":case"EnumValue":return r.value;case"BooleanValue":return r.value?"true":"false";case"NullValue":return"null";case"Variable":return["$",n("name")];case"ListValue":{let i=!N(r.values);return S(["[",q(e,t,{indent:!0}),i?"":E([y,m([O("",", "),y],e.map(n,"values"))]),y,"]"])}case"ObjectValue":{let i=!N(r.fields),s=t.bracketSpacing&&!i?" ":"";return S(["{",s,q(e,t,{indent:!0}),i?"":E([y,m([O("",", "),y],e.map(n,"fields"))]),y,O("",s),"}"])}case"ObjectField":case"Argument":case"FragmentArgument":return[n("name"),": ",n("value")];case"Directive":return["@",n("name"),M(e,t,n)];case"NamedType":return n("name");case"VariableDefinition":return[g(e,t,n),n("variable"),": ",n("type"),r.defaultValue?[" = ",n("defaultValue")]:"",T(e,n)];case"ObjectTypeExtension":case"ObjectTypeDefinition":case"InputObjectTypeExtension":case"InputObjectTypeDefinition":case"InterfaceTypeExtension":case"InterfaceTypeDefinition":{let{kind:i}=r,s=[];return i.endsWith("TypeDefinition")?s.push(g(e,t,n)):s.push("extend "),i.startsWith("ObjectType")?s.push("type"):i.startsWith("InputObjectType")?s.push("input"):s.push("interface"),s.push(" ",n("name")),!i.startsWith("InputObjectType")&&N(r.interfaces)&&s.push(" implements ",E([S([m([" &",C],e.map(n,"interfaces"))])])),s.push(T(e,n)),N(r.fields)&&s.push([" {",E([u,m(u,v(e,t,n,"fields"))]),u,"}"]),s}case"FieldDefinition":return[g(e,t,n),n("name"),M(e,t,n),": ",n("type"),T(e,n)];case"DirectiveDefinition":return[g(e,t,n),"directive ","@",n("name"),M(e,t,n),T(e,n),r.repeatable?" repeatable":""," on ",...m(" | ",e.map(n,"locations"))];case"DirectiveExtension":return["extend directive @",n("name"),T(e,n)];case"EnumTypeExtension":case"EnumTypeDefinition":return[g(e,t,n),r.kind==="EnumTypeExtension"?"extend ":"","enum ",n("name"),T(e,n),N(r.values)?[" {",E([u,m(u,v(e,t,n,"values"))]),u,"}"]:""];case"EnumValueDefinition":return[g(e,t,n),n("name"),T(e,n)];case"InputValueDefinition":return[g(e,t,n),n("name"),": ",n("type"),r.defaultValue?[" = ",n("defaultValue")]:"",T(e,n)];case"SchemaExtension":return["extend schema",T(e,n),...N(r.operationTypes)?[" {",E([u,m(u,v(e,t,n,"operationTypes"))]),u,"}"]:[]];case"SchemaDefinition":return[g(e,t,n),"schema",T(e,n)," {",N(r.operationTypes)?E([u,m(u,v(e,t,n,"operationTypes"))]):"",u,"}"];case"OperationTypeDefinition":return[r.operation,": ",n("type")];case"FragmentSpread":return["...",n("name"),M(e,t,n),T(e,n)];case"InlineFragment":return["...",r.typeCondition?[" on ",n("typeCondition")]:"",T(e,n),ie(e,t,n)];case"UnionTypeExtension":case"UnionTypeDefinition":return S([g(e,t,n),S([r.kind==="UnionTypeExtension"?"extend ":"","union ",n("name"),T(e,n),N(r.types)?[" =",O(""," "),E([O([C,"| "]),m([C,"| "],e.map(n,"types"))])]:""])]);case"ScalarTypeExtension":case"ScalarTypeDefinition":return[g(e,t,n),r.kind==="ScalarTypeExtension"?"extend ":"","scalar ",n("name"),T(e,n)];case"NonNullType":return[n("type"),"!"];case"ListType":return["[",n("type"),"]"];default:throw new Me(r,"Graphql","kind")}}function Kt(e){return e.kind!=="Comment"}function jt({node:e}){if(e.kind==="Comment")return"#"+e.value.trimEnd();throw new Error("Not a comment: "+JSON.stringify(e))}function Yt(e){let{node:t}=e;return t?.comments?.some(n=>n.value.trim()==="prettier-ignore")}var qt={print:Gt,massageAstNode:Te,hasPrettierIgnore:Yt,insertPragma:Qe,printComment:jt,canAttachComment:Kt,getVisitorKeys:Ge},ze=qt;var Ze=[{name:"GraphQL",type:"data",aceMode:"graphqlschema",extensions:[".graphql",".gql",".graphqls"],tmScope:"source.graphql",parsers:["graphql"],vscodeLanguageIds:["graphql"],linguistLanguageId:139}];var et={bracketSpacing:{category:"Common",type:"boolean",default:!0,description:"Print spaces between brackets.",oppositeDescription:"Do not print spaces between brackets."},objectWrap:{category:"Common",type:"choice",default:"preserve",description:"How to wrap object literals.",choices:[{value:"preserve",description:"Keep as multi-line, if there is a newline between the opening brace and first property."},{value:"collapse",description:"Fit to a single line when possible."}]},singleQuote:{category:"Common",type:"boolean",default:!1,description:"Use single quotes instead of double quotes."},proseWrap:{category:"Common",type:"choice",default:"preserve",description:"How to wrap prose.",choices:[{value:"always",description:"Wrap prose if it exceeds the print width."},{value:"never",description:"Do not wrap prose."},{value:"preserve",description:"Wrap prose as-is."}]},bracketSameLine:{category:"Common",type:"boolean",default:!1,description:"Put > of opening tags on the last line instead of on a new line."},singleAttributePerLine:{category:"Common",type:"boolean",default:!1,description:"Enforce single attribute per line in HTML, Vue and JSX."}};var $t={bracketSpacing:et.bracketSpacing},tt=$t;var Ie={};de(Ie,{graphql:()=>fi});function Qt(e,t){return e?.__kind===t}var nt=Qt;function it(e){return typeof e=="object"&&e!==null}var re=class extends Map{get[Symbol.toStringTag](){return"AccumulatorMap"}add(t,n){let r=this.get(t);r===void 0?this.set(t,[n]):r.push(n)}};var rt=/\r\n|[\n\r]/g;function se(e,t){let n=e.body.matchAll(rt),r=n.next().value,i=1,s=0;for(;r!==void 0&&r.index<t;)s=r.index+r[0].length,i++,r=n.next().value;return{line:i,column:t+1-s}}function ye(e){if(e.length<2)return e.map(({source:r,start:i})=>se(r,i));let t=new re;e.forEach(({source:r,start:i},s)=>{t.add(r,{position:i,index:s})});let n=new Array(e.length);for(let[r,i]of t){let s=r.body.matchAll(rt),a=s.next().value,p=1,d=0;for(let{position:x,index:D}of i.toSorted((I,f)=>I.position-f.position)){for(;a!==void 0&&a.index<x;)d=a.index+a[0].length,p++,a=s.next().value;n[D]={line:p,column:x+1-d}}}return n}function Ne(e){return oe(e.source,se(e.source,e.start))}function oe(e,t){let n=e.locationOffset.column-1,r="".padStart(n)+e.body,i=t.line-1,s=e.locationOffset.line-1,a=t.line+s,p=t.line===1?n:0,d=t.column+p,x=`${e.name}:${a}:${d}
|
|
10
|
+
`,D=r.split(/\r\n|[\n\r]/g),I=D[i];if(I.length>120){let f=[];for(let A=0;A<I.length;A+=80)f.push(I.slice(A,A+80));let j=d-1,R=Math.min(Math.floor(j/80),f.length-1),le=d-R*80;return x+st([[`${a} |`,f[0]],...f.slice(1,R+1).map(A=>["|",A]),["|","^".padStart(le)],["|",f[R+1]]])}return x+st([[`${a-1} |`,D[i-1]],[`${a} |`,I],["|","^".padStart(d)],[`${a+1} |`,D[i+1]]])}function st(e){let t=e.filter(([r,i])=>i!==void 0),n=Math.max(...t.map(([r])=>r.length));return t.map(([r,i])=>r.padStart(n)+(i?" "+i:"")).join(`
|
|
11
|
+
`)}var L=class e extends Error{constructor(t,n={}){let{nodes:r,source:i,positions:s,path:a,originalError:p,cause:d,extensions:x}=n,D="cause"in n,I=D?d:p,f=D||p!=null?{cause:I}:void 0;super(t,f),this.name="GraphQLError",this.path=a??void 0;let j=p??(d instanceof Error?d:void 0);this.originalError=j,this.nodes=ot(Array.isArray(r)?r:r?[r]:void 0);let R=ot(this.nodes?.map(A=>A.loc).filter(A=>A!=null));this.source=i??R?.[0]?.source,this.positions=s??R?.map(A=>A.start),this.locations=s&&i?ye(s.map(A=>({source:i,start:A}))):R&&ye(R);let le=it(j?.extensions)?j.extensions:void 0;this.extensions=x??le??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}}),p?.stack!=null?Object.defineProperty(this,"stack",{value:p.stack,writable:!0,configurable:!0}):Error.captureStackTrace!=null?Error.captureStackTrace(this,e):Object.defineProperty(this,"stack",{value:Error().stack,writable:!0,configurable:!0})}get[Symbol.toStringTag](){return"GraphQLError"}toString(){let t=this.message;if(this.nodes)for(let n of this.nodes)n.loc&&(t+=`
|
|
12
12
|
|
|
13
13
|
`+Ne(n.loc));else if(this.source&&this.locations)for(let n of this.locations)t+=`
|
|
14
14
|
|
|
15
|
-
`+se(this.source,n);return t}toJSON(){let t={message:this.message};return this.locations!=null&&(t.locations=this.locations),this.path!=null&&(t.path=this.path),this.extensions!=null&&Object.keys(this.extensions).length>0&&(t.extensions=this.extensions),t}};function ot(e){return e===void 0||e.length===0?void 0:e}var Xt=Object.hasOwn??Function.prototype.call.bind(Object.prototype.hasOwnProperty),at=Xt;var Q=class{constructor(t,n,r){this.start=t.start,this.end=n.end,this.startToken=t,this.endToken=n,this.source=r}get[Symbol.toStringTag](){return"Location"}toJSON(){return{start:this.start,end:this.end}}},B=class{constructor(t,n,r,i,s,a){this.kind=t,this.start=n,this.end=r,this.line=i,this.column=s,this.value=a,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}}};var U={QUERY:"query",MUTATION:"mutation",SUBSCRIPTION:"subscription"};var c={};le(c,{ARGUMENT:()=>tn,ARGUMENT_COORDINATE:()=>jn,BOOLEAN:()=>ln,DIRECTIVE:()=>Tn,DIRECTIVE_ARGUMENT_COORDINATE:()=>qn,DIRECTIVE_COORDINATE:()=>Yn,DIRECTIVE_DEFINITION:()=>Ln,DIRECTIVE_EXTENSION:()=>Fn,DOCUMENT:()=>Wt,ENUM:()=>fn,ENUM_TYPE_DEFINITION:()=>vn,ENUM_TYPE_EXTENSION:()=>Bn,ENUM_VALUE_DEFINITION:()=>kn,FIELD:()=>en,FIELD_DEFINITION:()=>gn,FLOAT:()=>pn,FRAGMENT_ARGUMENT:()=>nn,FRAGMENT_DEFINITION:()=>on,FRAGMENT_SPREAD:()=>rn,INLINE_FRAGMENT:()=>sn,INPUT_OBJECT_TYPE_DEFINITION:()=>Rn,INPUT_OBJECT_TYPE_EXTENSION:()=>Un,INPUT_VALUE_DEFINITION:()=>In,INT:()=>cn,INTERFACE_TYPE_DEFINITION:()=>On,INTERFACE_TYPE_EXTENSION:()=>Vn,LIST:()=>mn,LIST_TYPE:()=>yn,MEMBER_COORDINATE:()=>Kn,NAME:()=>Ht,NAMED_TYPE:()=>xn,NON_NULL_TYPE:()=>Nn,NULL:()=>dn,OBJECT:()=>hn,OBJECT_FIELD:()=>En,OBJECT_TYPE_DEFINITION:()=>Sn,OBJECT_TYPE_EXTENSION:()=>wn,OPERATION_DEFINITION:()=>Jt,OPERATION_TYPE_DEFINITION:()=>Dn,SCALAR_TYPE_DEFINITION:()=>An,SCALAR_TYPE_EXTENSION:()=>Pn,SCHEMA_DEFINITION:()=>_n,SCHEMA_EXTENSION:()=>bn,SELECTION_SET:()=>Zt,STRING:()=>un,TYPE_COORDINATE:()=>Gn,UNION_TYPE_DEFINITION:()=>Cn,UNION_TYPE_EXTENSION:()=>Mn,VARIABLE:()=>an,VARIABLE_DEFINITION:()=>zt});var Ht="Name",Wt="Document",Jt="OperationDefinition",zt="VariableDefinition",Zt="SelectionSet",en="Field",tn="Argument",nn="FragmentArgument",rn="FragmentSpread",sn="InlineFragment",on="FragmentDefinition",an="Variable",cn="IntValue",pn="FloatValue",un="StringValue",ln="BooleanValue",dn="NullValue",fn="EnumValue",mn="ListValue",hn="ObjectValue",En="ObjectField",Tn="Directive",xn="NamedType",yn="ListType",Nn="NonNullType",_n="SchemaDefinition",Dn="OperationTypeDefinition",An="ScalarTypeDefinition",Sn="ObjectTypeDefinition",gn="FieldDefinition",In="InputValueDefinition",On="InterfaceTypeDefinition",Cn="UnionTypeDefinition",vn="EnumTypeDefinition",kn="EnumValueDefinition",Rn="InputObjectTypeDefinition",Ln="DirectiveDefinition",bn="SchemaExtension",Fn="DirectiveExtension",Pn="ScalarTypeExtension",wn="ObjectTypeExtension",Vn="InterfaceTypeExtension",Mn="UnionTypeExtension",Bn="EnumTypeExtension",Un="InputObjectTypeExtension",Gn="TypeCoordinate",Kn="MemberCoordinate",jn="ArgumentCoordinate",Yn="DirectiveCoordinate",qn="DirectiveArgumentCoordinate";function _e(e,t){if(!e)throw new Error(t)}function ct(e){return e===9||e===32}function P(e){return e>=48&&e<=57}function pt(e){return e>=97&&e<=122||e>=65&&e<=90}function De(e){return pt(e)||e===95}function ut(e){return pt(e)||P(e)||e===95}function lt(e){let t=Number.MAX_SAFE_INTEGER,n=null,r=-1;for(let i=0;i<e.length;++i){let s=e[i],a=$n(s);a!==s.length&&(n??(n=i),r=i,i!==0&&a<t&&(t=a))}return e.map((i,s)=>s===0?i:i.slice(t)).slice(n??0,r+1)}function $n(e){let t=0;for(;t<e.length&&ct(e.charCodeAt(t));)++t;return t}var Ae={QUERY:"QUERY",MUTATION:"MUTATION",SUBSCRIPTION:"SUBSCRIPTION",FIELD:"FIELD",FRAGMENT_DEFINITION:"FRAGMENT_DEFINITION",FRAGMENT_SPREAD:"FRAGMENT_SPREAD",INLINE_FRAGMENT:"INLINE_FRAGMENT",VARIABLE_DEFINITION:"VARIABLE_DEFINITION",FRAGMENT_VARIABLE_DEFINITION:"FRAGMENT_VARIABLE_DEFINITION",SCHEMA:"SCHEMA",SCALAR:"SCALAR",OBJECT:"OBJECT",FIELD_DEFINITION:"FIELD_DEFINITION",ARGUMENT_DEFINITION:"ARGUMENT_DEFINITION",INTERFACE:"INTERFACE",UNION:"UNION",ENUM:"ENUM",ENUM_VALUE:"ENUM_VALUE",INPUT_OBJECT:"INPUT_OBJECT",INPUT_FIELD_DEFINITION:"INPUT_FIELD_DEFINITION",DIRECTIVE_DEFINITION:"DIRECTIVE_DEFINITION"};function l(e,t,n){return new L(`Syntax Error: ${n}`,{source:e,positions:[t]})}function Qn(){let e;try{let t=globalThis.process;typeof t?.getBuiltinModule=="function"&&(e=t.getBuiltinModule("node:diagnostics_channel"))}catch{}return e}var w=Qn(),Se=w?.tracingChannel("graphql:parse"),bs=w?.tracingChannel("graphql:validate"),Fs=w?.tracingChannel("graphql:execute"),Ps=w?.tracingChannel("graphql:execute:variableCoercion"),ws=w?.tracingChannel("graphql:execute:rootSelectionSet"),Vs=w?.tracingChannel("graphql:subscribe"),Ms=w?.tracingChannel("graphql:resolve"),Xn=["start","end","asyncStart","asyncEnd","error"];function dt(e){if(e==null)return!1;let t=e.hasSubscribers;if(t!==void 0)return t;for(let n of Xn)if(e[n].hasSubscribers)return!0;return!1}var o={SOF:"<SOF>",EOF:"<EOF>",BANG:"!",DOLLAR:"$",AMP:"&",PAREN_L:"(",PAREN_R:")",DOT:".",SPREAD:"...",COLON:":",EQUALS:"=",AT:"@",BRACKET_L:"[",BRACKET_R:"]",BRACE_L:"{",PIPE:"|",BRACE_R:"}",NAME:"Name",INT:"Int",FLOAT:"Float",STRING:"String",BLOCK_STRING:"BlockString",COMMENT:"Comment"};var H=class{constructor(t){let n=new B(o.SOF,0,0,0,0);this.source=t,this.lastToken=n,this.token=n,this.line=1,this.lineStart=0,this._maxComments=void 0,this._commentCount=0}get[Symbol.toStringTag](){return"Lexer"}advance(){return this.lastToken=this.token,this.token=this.lookahead()}lookahead(){let t=this.token;if(t.kind!==o.EOF)do if(t.next)t=t.next;else{let n=Hn(this,t.end);t.next=n,n.prev=t,t=n}while(t.kind===o.COMMENT);return t}};function mt(e){return e===o.BANG||e===o.DOLLAR||e===o.AMP||e===o.PAREN_L||e===o.PAREN_R||e===o.DOT||e===o.SPREAD||e===o.COLON||e===o.EQUALS||e===o.AT||e===o.BRACKET_L||e===o.BRACKET_R||e===o.BRACE_L||e===o.PIPE||e===o.BRACE_R}function G(e){return e>=0&&e<=55295||e>=57344&&e<=1114111}function ae(e,t){return ht(e.charCodeAt(t))&&Et(e.charCodeAt(t+1))}function ht(e){return e>=55296&&e<=56319}function Et(e){return e>=56320&&e<=57343}function V(e,t){let n=e.source.body.codePointAt(t);if(n===void 0)return o.EOF;if(n>=32&&n<=126){let r=String.fromCodePoint(n);return r==='"'?`'"'`:`"${r}"`}return"U+"+n.toString(16).toUpperCase().padStart(4,"0")}function h(e,t,n,r,i){let s=e.line,a=1+n-e.lineStart;return new B(t,n,r,s,a,i)}function Hn(e,t){let n=e.source.body,r=n.length,i=t;for(;i<r;){let s=n.charCodeAt(i);switch(s){case 65279:case 9:case 32:case 44:++i;continue;case 10:++i,++e.line,e.lineStart=i;continue;case 13:n.charCodeAt(i+1)===10?i+=2:++i,++e.line,e.lineStart=i;continue;case 35:return Wn(e,i);case 33:return h(e,o.BANG,i,i+1);case 36:return h(e,o.DOLLAR,i,i+1);case 38:return h(e,o.AMP,i,i+1);case 40:return h(e,o.PAREN_L,i,i+1);case 41:return h(e,o.PAREN_R,i,i+1);case 46:{let a=n.charCodeAt(i+1);if(a===46&&n.charCodeAt(i+2)===46)return h(e,o.SPREAD,i,i+3);if(a===46)throw l(e.source,i,'Unexpected "..", did you mean "..."?');if(P(a)){let p=e.source.body.slice(i+1,oe(e,i+1,a));throw l(e.source,i,`Invalid number, expected digit before ".", did you mean "0.${p}"?`)}break}case 58:return h(e,o.COLON,i,i+1);case 61:return h(e,o.EQUALS,i,i+1);case 64:return h(e,o.AT,i,i+1);case 91:return h(e,o.BRACKET_L,i,i+1);case 93:return h(e,o.BRACKET_R,i,i+1);case 123:return h(e,o.BRACE_L,i,i+1);case 124:return h(e,o.PIPE,i,i+1);case 125:return h(e,o.BRACE_R,i,i+1);case 34:return n.charCodeAt(i+1)===34&&n.charCodeAt(i+2)===34?ni(e,i):zn(e,i)}if(P(s)||s===45)return Jn(e,i,s);if(De(s))return ii(e,i);throw l(e.source,i,s===39?`Unexpected single quote character ('), did you mean to use a double quote (")?`:G(s)||ae(n,i)?`Unexpected character: ${V(e,i)}.`:`Invalid character: ${V(e,i)}.`)}return h(e,o.EOF,r,r)}function Wn(e,t){let n=e._maxComments;if(n!==void 0){let a=e._commentCount+1;if(a>n)throw l(e.source,t,`Document contains more than ${n} comments. Parsing aborted.`);e._commentCount=a}let r=e.source.body,i=r.length,s=t+1;for(;s<i;){let a=r.charCodeAt(s);if(a===10||a===13)break;if(G(a))++s;else if(ae(r,s))s+=2;else break}return h(e,o.COMMENT,t,s,r.slice(t+1,s))}function Jn(e,t,n){let r=e.source.body,i=t,s=n,a=!1;if(s===45&&(s=r.charCodeAt(++i)),s===48){if(s=r.charCodeAt(++i),P(s))throw l(e.source,i,`Invalid number, unexpected digit after 0: ${V(e,i)}.`)}else i=oe(e,i,s),s=r.charCodeAt(i);if(s===46&&(a=!0,s=r.charCodeAt(++i),i=oe(e,i,s),s=r.charCodeAt(i)),(s===69||s===101)&&(a=!0,s=r.charCodeAt(++i),(s===43||s===45)&&(s=r.charCodeAt(++i)),i=oe(e,i,s),s=r.charCodeAt(i)),s===46||De(s))throw l(e.source,i,`Invalid number, expected digit but got: ${V(e,i)}.`);return h(e,a?o.FLOAT:o.INT,t,i,r.slice(t,i))}function oe(e,t,n){if(!P(n))throw l(e.source,t,`Invalid number, expected digit but got: ${V(e,t)}.`);let r=e.source.body,i=t+1;for(;P(r.charCodeAt(i));)++i;return i}function zn(e,t){let n=e.source.body,r=n.length,i=t+1,s=i,a="";for(;i<r;){let p=n.charCodeAt(i);if(p===34)return a+=n.slice(s,i),h(e,o.STRING,t,i+1,a);if(p===92){a+=n.slice(s,i);let d=n.charCodeAt(i+1)===117?n.charCodeAt(i+2)===123?Zn(e,i):ei(e,i):ti(e,i);a+=d.value,i+=d.size,s=i;continue}if(p===10||p===13)break;if(G(p))++i;else if(ae(n,i))i+=2;else throw l(e.source,i,`Invalid character within String: ${V(e,i)}.`)}throw l(e.source,i,"Unterminated string.")}function Zn(e,t){let n=e.source.body,r=0,i=3;for(;i<12;){let s=n.charCodeAt(t+i++);if(s===125){if(i<5||!G(r))break;return{value:String.fromCodePoint(r),size:i}}if(r=r<<4|X(s),r<0)break}throw l(e.source,t,`Invalid Unicode escape sequence: "${n.slice(t,t+i)}".`)}function ei(e,t){let n=e.source.body,r=ft(n,t+2);if(G(r))return{value:String.fromCodePoint(r),size:6};if(ht(r)&&n.charCodeAt(t+6)===92&&n.charCodeAt(t+7)===117){let i=ft(n,t+8);if(Et(i))return{value:String.fromCodePoint(r,i),size:12}}throw l(e.source,t,`Invalid Unicode escape sequence: "${n.slice(t,t+6)}".`)}function ft(e,t){return X(e.charCodeAt(t))<<12|X(e.charCodeAt(t+1))<<8|X(e.charCodeAt(t+2))<<4|X(e.charCodeAt(t+3))}function X(e){return e>=48&&e<=57?e-48:e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:-1}function ti(e,t){let 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:`
|
|
15
|
+
`+oe(this.source,n);return t}toJSON(){let t={message:this.message};return this.locations!=null&&(t.locations=this.locations),this.path!=null&&(t.path=this.path),this.extensions!=null&&Object.keys(this.extensions).length>0&&(t.extensions=this.extensions),t}};function ot(e){return e===void 0||e.length===0?void 0:e}var Xt=Object.hasOwn??Function.prototype.call.bind(Object.prototype.hasOwnProperty),at=Xt;var X=class{constructor(t,n,r){this.start=t.start,this.end=n.end,this.startToken=t,this.endToken=n,this.source=r}get[Symbol.toStringTag](){return"Location"}toJSON(){return{start:this.start,end:this.end}}},B=class{constructor(t,n,r,i,s,a){this.kind=t,this.start=n,this.end=r,this.line=i,this.column=s,this.value=a,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}}};var U={QUERY:"query",MUTATION:"mutation",SUBSCRIPTION:"subscription"};var c={};de(c,{ARGUMENT:()=>tn,ARGUMENT_COORDINATE:()=>jn,BOOLEAN:()=>ln,DIRECTIVE:()=>Tn,DIRECTIVE_ARGUMENT_COORDINATE:()=>qn,DIRECTIVE_COORDINATE:()=>Yn,DIRECTIVE_DEFINITION:()=>Ln,DIRECTIVE_EXTENSION:()=>Fn,DOCUMENT:()=>Wt,ENUM:()=>fn,ENUM_TYPE_DEFINITION:()=>vn,ENUM_TYPE_EXTENSION:()=>Bn,ENUM_VALUE_DEFINITION:()=>kn,FIELD:()=>en,FIELD_DEFINITION:()=>gn,FLOAT:()=>pn,FRAGMENT_ARGUMENT:()=>nn,FRAGMENT_DEFINITION:()=>on,FRAGMENT_SPREAD:()=>rn,INLINE_FRAGMENT:()=>sn,INPUT_OBJECT_TYPE_DEFINITION:()=>Rn,INPUT_OBJECT_TYPE_EXTENSION:()=>Un,INPUT_VALUE_DEFINITION:()=>In,INT:()=>cn,INTERFACE_TYPE_DEFINITION:()=>On,INTERFACE_TYPE_EXTENSION:()=>Vn,LIST:()=>mn,LIST_TYPE:()=>yn,MEMBER_COORDINATE:()=>Kn,NAME:()=>Ht,NAMED_TYPE:()=>xn,NON_NULL_TYPE:()=>Nn,NULL:()=>dn,OBJECT:()=>hn,OBJECT_FIELD:()=>En,OBJECT_TYPE_DEFINITION:()=>Sn,OBJECT_TYPE_EXTENSION:()=>wn,OPERATION_DEFINITION:()=>Jt,OPERATION_TYPE_DEFINITION:()=>Dn,SCALAR_TYPE_DEFINITION:()=>An,SCALAR_TYPE_EXTENSION:()=>Pn,SCHEMA_DEFINITION:()=>_n,SCHEMA_EXTENSION:()=>bn,SELECTION_SET:()=>Zt,STRING:()=>un,TYPE_COORDINATE:()=>Gn,UNION_TYPE_DEFINITION:()=>Cn,UNION_TYPE_EXTENSION:()=>Mn,VARIABLE:()=>an,VARIABLE_DEFINITION:()=>zt});var Ht="Name",Wt="Document",Jt="OperationDefinition",zt="VariableDefinition",Zt="SelectionSet",en="Field",tn="Argument",nn="FragmentArgument",rn="FragmentSpread",sn="InlineFragment",on="FragmentDefinition",an="Variable",cn="IntValue",pn="FloatValue",un="StringValue",ln="BooleanValue",dn="NullValue",fn="EnumValue",mn="ListValue",hn="ObjectValue",En="ObjectField",Tn="Directive",xn="NamedType",yn="ListType",Nn="NonNullType",_n="SchemaDefinition",Dn="OperationTypeDefinition",An="ScalarTypeDefinition",Sn="ObjectTypeDefinition",gn="FieldDefinition",In="InputValueDefinition",On="InterfaceTypeDefinition",Cn="UnionTypeDefinition",vn="EnumTypeDefinition",kn="EnumValueDefinition",Rn="InputObjectTypeDefinition",Ln="DirectiveDefinition",bn="SchemaExtension",Fn="DirectiveExtension",Pn="ScalarTypeExtension",wn="ObjectTypeExtension",Vn="InterfaceTypeExtension",Mn="UnionTypeExtension",Bn="EnumTypeExtension",Un="InputObjectTypeExtension",Gn="TypeCoordinate",Kn="MemberCoordinate",jn="ArgumentCoordinate",Yn="DirectiveCoordinate",qn="DirectiveArgumentCoordinate";function _e(e,t){if(!e)throw new Error(t)}function ct(e){return e===9||e===32}function P(e){return e>=48&&e<=57}function pt(e){return e>=97&&e<=122||e>=65&&e<=90}function De(e){return pt(e)||e===95}function ut(e){return pt(e)||P(e)||e===95}function lt(e){let t=Number.MAX_SAFE_INTEGER,n=null,r=-1;for(let i=0;i<e.length;++i){let s=e[i],a=$n(s);a!==s.length&&(n??(n=i),r=i,i!==0&&a<t&&(t=a))}return e.map((i,s)=>s===0?i:i.slice(t)).slice(n??0,r+1)}function $n(e){let t=0;for(;t<e.length&&ct(e.charCodeAt(t));)++t;return t}var Ae={QUERY:"QUERY",MUTATION:"MUTATION",SUBSCRIPTION:"SUBSCRIPTION",FIELD:"FIELD",FRAGMENT_DEFINITION:"FRAGMENT_DEFINITION",FRAGMENT_SPREAD:"FRAGMENT_SPREAD",INLINE_FRAGMENT:"INLINE_FRAGMENT",VARIABLE_DEFINITION:"VARIABLE_DEFINITION",FRAGMENT_VARIABLE_DEFINITION:"FRAGMENT_VARIABLE_DEFINITION",SCHEMA:"SCHEMA",SCALAR:"SCALAR",OBJECT:"OBJECT",FIELD_DEFINITION:"FIELD_DEFINITION",ARGUMENT_DEFINITION:"ARGUMENT_DEFINITION",INTERFACE:"INTERFACE",UNION:"UNION",ENUM:"ENUM",ENUM_VALUE:"ENUM_VALUE",INPUT_OBJECT:"INPUT_OBJECT",INPUT_FIELD_DEFINITION:"INPUT_FIELD_DEFINITION",DIRECTIVE_DEFINITION:"DIRECTIVE_DEFINITION"};function l(e,t,n){return new L(`Syntax Error: ${n}`,{source:e,positions:[t]})}function Qn(){let e;try{let t=globalThis.process;typeof t?.getBuiltinModule=="function"&&(e=t.getBuiltinModule("node:diagnostics_channel"))}catch{}return e}var w=Qn(),Se=w?.tracingChannel("graphql:parse"),Fs=w?.tracingChannel("graphql:validate"),Ps=w?.tracingChannel("graphql:execute"),ws=w?.tracingChannel("graphql:execute:variableCoercion"),Vs=w?.tracingChannel("graphql:execute:rootSelectionSet"),Ms=w?.tracingChannel("graphql:subscribe"),Bs=w?.tracingChannel("graphql:resolve"),Xn=["start","end","asyncStart","asyncEnd","error"];function dt(e){if(e==null)return!1;let t=e.hasSubscribers;if(t!==void 0)return t;for(let n of Xn)if(e[n].hasSubscribers)return!0;return!1}var o={SOF:"<SOF>",EOF:"<EOF>",BANG:"!",DOLLAR:"$",AMP:"&",PAREN_L:"(",PAREN_R:")",DOT:".",SPREAD:"...",COLON:":",EQUALS:"=",AT:"@",BRACKET_L:"[",BRACKET_R:"]",BRACE_L:"{",PIPE:"|",BRACE_R:"}",NAME:"Name",INT:"Int",FLOAT:"Float",STRING:"String",BLOCK_STRING:"BlockString",COMMENT:"Comment"};var W=class{constructor(t){let n=new B(o.SOF,0,0,0,0);this.source=t,this.lastToken=n,this.token=n,this.line=1,this.lineStart=0,this._maxComments=void 0,this._commentCount=0}get[Symbol.toStringTag](){return"Lexer"}advance(){return this.lastToken=this.token,this.token=this.lookahead()}lookahead(){let t=this.token;if(t.kind!==o.EOF)do if(t.next)t=t.next;else{let n=Hn(this,t.end);t.next=n,n.prev=t,t=n}while(t.kind===o.COMMENT);return t}};function mt(e){return e===o.BANG||e===o.DOLLAR||e===o.AMP||e===o.PAREN_L||e===o.PAREN_R||e===o.DOT||e===o.SPREAD||e===o.COLON||e===o.EQUALS||e===o.AT||e===o.BRACKET_L||e===o.BRACKET_R||e===o.BRACE_L||e===o.PIPE||e===o.BRACE_R}function G(e){return e>=0&&e<=55295||e>=57344&&e<=1114111}function ce(e,t){return ht(e.charCodeAt(t))&&Et(e.charCodeAt(t+1))}function ht(e){return e>=55296&&e<=56319}function Et(e){return e>=56320&&e<=57343}function V(e,t){let n=e.source.body.codePointAt(t);if(n===void 0)return o.EOF;if(n>=32&&n<=126){let r=String.fromCodePoint(n);return r==='"'?`'"'`:`"${r}"`}return"U+"+n.toString(16).toUpperCase().padStart(4,"0")}function h(e,t,n,r,i){let s=e.line,a=1+n-e.lineStart;return new B(t,n,r,s,a,i)}function Hn(e,t){let n=e.source.body,r=n.length,i=t;for(;i<r;){let s=n.charCodeAt(i);switch(s){case 65279:case 9:case 32:case 44:++i;continue;case 10:++i,++e.line,e.lineStart=i;continue;case 13:n.charCodeAt(i+1)===10?i+=2:++i,++e.line,e.lineStart=i;continue;case 35:return Wn(e,i);case 33:return h(e,o.BANG,i,i+1);case 36:return h(e,o.DOLLAR,i,i+1);case 38:return h(e,o.AMP,i,i+1);case 40:return h(e,o.PAREN_L,i,i+1);case 41:return h(e,o.PAREN_R,i,i+1);case 46:{let a=n.charCodeAt(i+1);if(a===46&&n.charCodeAt(i+2)===46)return h(e,o.SPREAD,i,i+3);if(a===46)throw l(e.source,i,'Unexpected "..", did you mean "..."?');if(P(a)){let p=e.source.body.slice(i+1,ae(e,i+1,a));throw l(e.source,i,`Invalid number, expected digit before ".", did you mean "0.${p}"?`)}break}case 58:return h(e,o.COLON,i,i+1);case 61:return h(e,o.EQUALS,i,i+1);case 64:return h(e,o.AT,i,i+1);case 91:return h(e,o.BRACKET_L,i,i+1);case 93:return h(e,o.BRACKET_R,i,i+1);case 123:return h(e,o.BRACE_L,i,i+1);case 124:return h(e,o.PIPE,i,i+1);case 125:return h(e,o.BRACE_R,i,i+1);case 34:return n.charCodeAt(i+1)===34&&n.charCodeAt(i+2)===34?ni(e,i):zn(e,i)}if(P(s)||s===45)return Jn(e,i,s);if(De(s))return ii(e,i);throw l(e.source,i,s===39?`Unexpected single quote character ('), did you mean to use a double quote (")?`:G(s)||ce(n,i)?`Unexpected character: ${V(e,i)}.`:`Invalid character: ${V(e,i)}.`)}return h(e,o.EOF,r,r)}function Wn(e,t){let n=e._maxComments;if(n!==void 0){let a=e._commentCount+1;if(a>n)throw l(e.source,t,`Document contains more than ${n} comments. Parsing aborted.`);e._commentCount=a}let r=e.source.body,i=r.length,s=t+1;for(;s<i;){let a=r.charCodeAt(s);if(a===10||a===13)break;if(G(a))++s;else if(ce(r,s))s+=2;else break}return h(e,o.COMMENT,t,s,r.slice(t+1,s))}function Jn(e,t,n){let r=e.source.body,i=t,s=n,a=!1;if(s===45&&(s=r.charCodeAt(++i)),s===48){if(s=r.charCodeAt(++i),P(s))throw l(e.source,i,`Invalid number, unexpected digit after 0: ${V(e,i)}.`)}else i=ae(e,i,s),s=r.charCodeAt(i);if(s===46&&(a=!0,s=r.charCodeAt(++i),i=ae(e,i,s),s=r.charCodeAt(i)),(s===69||s===101)&&(a=!0,s=r.charCodeAt(++i),(s===43||s===45)&&(s=r.charCodeAt(++i)),i=ae(e,i,s),s=r.charCodeAt(i)),s===46||De(s))throw l(e.source,i,`Invalid number, expected digit but got: ${V(e,i)}.`);return h(e,a?o.FLOAT:o.INT,t,i,r.slice(t,i))}function ae(e,t,n){if(!P(n))throw l(e.source,t,`Invalid number, expected digit but got: ${V(e,t)}.`);let r=e.source.body,i=t+1;for(;P(r.charCodeAt(i));)++i;return i}function zn(e,t){let n=e.source.body,r=n.length,i=t+1,s=i,a="";for(;i<r;){let p=n.charCodeAt(i);if(p===34)return a+=n.slice(s,i),h(e,o.STRING,t,i+1,a);if(p===92){a+=n.slice(s,i);let d=n.charCodeAt(i+1)===117?n.charCodeAt(i+2)===123?Zn(e,i):ei(e,i):ti(e,i);a+=d.value,i+=d.size,s=i;continue}if(p===10||p===13)break;if(G(p))++i;else if(ce(n,i))i+=2;else throw l(e.source,i,`Invalid character within String: ${V(e,i)}.`)}throw l(e.source,i,"Unterminated string.")}function Zn(e,t){let n=e.source.body,r=0,i=3;for(;i<12;){let s=n.charCodeAt(t+i++);if(s===125){if(i<5||!G(r))break;return{value:String.fromCodePoint(r),size:i}}if(r=r<<4|H(s),r<0)break}throw l(e.source,t,`Invalid Unicode escape sequence: "${n.slice(t,t+i)}".`)}function ei(e,t){let n=e.source.body,r=ft(n,t+2);if(G(r))return{value:String.fromCodePoint(r),size:6};if(ht(r)&&n.charCodeAt(t+6)===92&&n.charCodeAt(t+7)===117){let i=ft(n,t+8);if(Et(i))return{value:String.fromCodePoint(r,i),size:12}}throw l(e.source,t,`Invalid Unicode escape sequence: "${n.slice(t,t+6)}".`)}function ft(e,t){return H(e.charCodeAt(t))<<12|H(e.charCodeAt(t+1))<<8|H(e.charCodeAt(t+2))<<4|H(e.charCodeAt(t+3))}function H(e){return e>=48&&e<=57?e-48:e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:-1}function ti(e,t){let 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:`
|
|
16
16
|
`,size:2};case 114:return{value:"\r",size:2};case 116:return{value:" ",size:2}}throw l(e.source,t,`Invalid character escape sequence: "${n.slice(t,t+2)}".`)}function ni(e,t){let n=e.source.body,r=n.length,i=e.lineStart,s=t+3,a=s,p="",d=[];for(;s<r;){let x=n.charCodeAt(s);if(x===34&&n.charCodeAt(s+1)===34&&n.charCodeAt(s+2)===34){p+=n.slice(a,s),d.push(p);let D=h(e,o.BLOCK_STRING,t,s+3,lt(d).join(`
|
|
17
|
-
`));return e.line+=d.length-1,e.lineStart=i,D}if(x===92&&n.charCodeAt(s+1)===34&&n.charCodeAt(s+2)===34&&n.charCodeAt(s+3)===34){p+=n.slice(a,s),a=s+1,s+=4;continue}if(x===10||x===13){p+=n.slice(a,s),d.push(p),x===13&&n.charCodeAt(s+1)===10?s+=2:++s,p="",a=s,i=s;continue}if(G(x))++s;else if(ae(n,s))s+=2;else throw l(e.source,s,`Invalid character within String: ${V(e,s)}.`)}throw l(e.source,s,"Unterminated string.")}function ii(e,t){let n=e.source.body,r=n.length,i=t+1;for(;i<r;){let s=n.charCodeAt(i);if(ut(s))++i;else break}return h(e,o.NAME,t,i,n.slice(t,i))}var Tt=Symbol("Source"),K=class{constructor(t,n="GraphQL request",r={line:1,column:1}){this.__kind=Tt,this.body=t,this.name=n,this.locationOffset=r,this.locationOffset.line>0||_e(!1,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||_e(!1,"column in locationOffset is 1-indexed and must be positive.")}get[Symbol.toStringTag](){return"Source"}};function xt(e){return nt(e,Tt,K)}function pe(e,t){return dt(Se)?Se.traceSync(()=>yt(e,t),{source:e}):yt(e,t)}function yt(e,t){let n=new ge(e,t),r=n.parseDocument();return Object.defineProperty(r,"tokenCount",{enumerable:!1,value:n.tokenCount}),r}var ge=class{constructor(t,n={}){let{lexer:r,...i}=n;if(r)this._lexer=r;else{let a=xt(t)?t:new K(t);this._lexer=new H(a)}this._options=i,this._tokenCounter=0,this._lexer._maxComments=i.maxComments,this._lexer._commentCount=0;let s=i.maxSourceLength;if(s!==void 0&&this._lexer.source.body.length>s)throw l(this._lexer.source,s,`Source contains more than ${s} UTF-16 code units. Parsing aborted.`)}get tokenCount(){return this._tokenCounter}parseName(){let t=this.expectToken(o.NAME);return this.node(t,{kind:c.NAME,value:t.value})}parseDocument(){return this.node(this._lexer.token,{kind:c.DOCUMENT,definitions:this.many(o.SOF,this.parseDefinition,o.EOF)})}parseDefinition(){if(this.peek(o.BRACE_L))return this.parseOperationDefinition();let t=this.peekDescription(),n=t?this._lexer.lookahead():this._lexer.token;if(t&&n.kind===o.BRACE_L)throw l(this._lexer.source,this._lexer.token.start,"Unexpected description, descriptions are not supported on shorthand queries.");if(n.kind===o.NAME){switch(n.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(n.value){case"query":case"mutation":case"subscription":return this.parseOperationDefinition();case"fragment":return this.parseFragmentDefinition()}if(t)throw l(this._lexer.source,this._lexer.token.start,"Unexpected description, only GraphQL definitions support descriptions.");if(n.value==="extend")return this.parseTypeSystemExtension()}throw this.unexpected(n)}parseOperationDefinition(){let t=this._lexer.token;if(this.peek(o.BRACE_L))return this.node(t,{kind:c.OPERATION_DEFINITION,operation:U.QUERY,description:void 0,name:void 0,variableDefinitions:void 0,directives:void 0,selectionSet:this.parseSelectionSet()});let n=this.parseDescription(),r=this.parseOperationType(),i;return this.peek(o.NAME)&&(i=this.parseName()),this.node(t,{kind:c.OPERATION_DEFINITION,operation:r,description:n,name:i,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseOperationType(){let t=this.expectToken(o.NAME);switch(t.value){case"query":return U.QUERY;case"mutation":return U.MUTATION;case"subscription":return U.SUBSCRIPTION}throw this.unexpected(t)}parseVariableDefinitions(){return this.optionalMany(o.PAREN_L,this.parseVariableDefinition,o.PAREN_R)}parseVariableDefinition(){return this.node(this._lexer.token,{kind:c.VARIABLE_DEFINITION,description:this.parseDescription(),variable:this.parseVariable(),type:(this.expectToken(o.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(o.EQUALS)?this.parseConstValueLiteral():void 0,directives:this.parseConstDirectives()})}parseVariable(){let t=this._lexer.token;return this.expectToken(o.DOLLAR),this.node(t,{kind:c.VARIABLE,name:this.parseName()})}parseSelectionSet(){return this.node(this._lexer.token,{kind:c.SELECTION_SET,selections:this._options.allowEmptySelectionSets===!1?this.many(o.BRACE_L,this.parseSelection,o.BRACE_R):this.any(o.BRACE_L,this.parseSelection,o.BRACE_R)})}parseSelection(){return this.peek(o.SPREAD)?this.parseFragment():this.parseField()}parseField(){let t=this._lexer.token,n=this.parseName(),r,i;return this.expectOptionalToken(o.COLON)?(r=n,i=this.parseName()):i=n,this.node(t,{kind:c.FIELD,alias:r,name:i,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(o.BRACE_L)?this.parseSelectionSet():void 0})}parseArguments(t){let n=t?this.parseConstArgument:this.parseArgument;return this.optionalMany(o.PAREN_L,n,o.PAREN_R)}parseFragmentArguments(){let t=this.parseFragmentArgument;return this.optionalMany(o.PAREN_L,t,o.PAREN_R)}parseArgument(t=!1){let n=this._lexer.token,r=this.parseName();return this.expectToken(o.COLON),this.node(n,{kind:c.ARGUMENT,name:r,value:this.parseValueLiteral(t)})}parseConstArgument(){return this.parseArgument(!0)}parseFragmentArgument(){let t=this._lexer.token,n=this.parseName();return this.expectToken(o.COLON),this.node(t,{kind:c.FRAGMENT_ARGUMENT,name:n,value:this.parseValueLiteral(!1)})}parseFragment(){let t=this._lexer.token;this.expectToken(o.SPREAD);let n=this.expectOptionalKeyword("on");if(!n&&this.peek(o.NAME)){let r=this.parseFragmentName();return this.peek(o.PAREN_L)&&this._options.experimentalFragmentArguments?this.node(t,{kind:c.FRAGMENT_SPREAD,name:r,arguments:this.parseFragmentArguments(),directives:this.parseDirectives(!1)}):this.node(t,{kind:c.FRAGMENT_SPREAD,name:r,directives:this.parseDirectives(!1)})}return this.node(t,{kind:c.INLINE_FRAGMENT,typeCondition:n?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentDefinition(){let t=this._lexer.token,n=this.parseDescription();return this.expectKeyword("fragment"),this._options.experimentalFragmentArguments===!0?this.node(t,{kind:c.FRAGMENT_DEFINITION,description:n,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()}):this.node(t,{kind:c.FRAGMENT_DEFINITION,description:n,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(t){let n=this._lexer.token;switch(n.kind){case o.BRACKET_L:return this.parseList(t);case o.BRACE_L:return this.parseObject(t);case o.INT:return this.advanceLexer(),this.node(n,{kind:c.INT,value:n.value});case o.FLOAT:return this.advanceLexer(),this.node(n,{kind:c.FLOAT,value:n.value});case o.STRING:case o.BLOCK_STRING:return this.parseStringLiteral();case o.NAME:switch(this.advanceLexer(),n.value){case"true":return this.node(n,{kind:c.BOOLEAN,value:!0});case"false":return this.node(n,{kind:c.BOOLEAN,value:!1});case"null":return this.node(n,{kind:c.NULL});default:return this.node(n,{kind:c.ENUM,value:n.value})}case o.DOLLAR:if(t)if(this.expectToken(o.DOLLAR),this._lexer.token.kind===o.NAME){let r=this._lexer.token.value;throw l(this._lexer.source,n.start,`Unexpected variable "$${r}" in constant value.`)}else throw this.unexpected(n);return this.parseVariable();default:throw this.unexpected()}}parseConstValueLiteral(){return this.parseValueLiteral(!0)}parseStringLiteral(){let t=this._lexer.token;return this.advanceLexer(),this.node(t,{kind:c.STRING,value:t.value,block:t.kind===o.BLOCK_STRING})}parseList(t){let n=()=>this.parseValueLiteral(t);return this.node(this._lexer.token,{kind:c.LIST,values:this.any(o.BRACKET_L,n,o.BRACKET_R)})}parseObject(t){let n=()=>this.parseObjectField(t);return this.node(this._lexer.token,{kind:c.OBJECT,fields:this.any(o.BRACE_L,n,o.BRACE_R)})}parseObjectField(t){let n=this._lexer.token,r=this.parseName();return this.expectToken(o.COLON),this.node(n,{kind:c.OBJECT_FIELD,name:r,value:this.parseValueLiteral(t)})}parseDirectives(t){let n=[];for(;this.peek(o.AT);)n.push(this.parseDirective(t));if(n.length)return n}parseConstDirectives(){return this.parseDirectives(!0)}parseDirective(t){let n=this._lexer.token;return this.expectToken(o.AT),this.node(n,{kind:c.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(t)})}parseTypeReference(){let t=this._lexer.token,n;if(this.expectOptionalToken(o.BRACKET_L)){let r=this.parseTypeReference();this.expectToken(o.BRACKET_R),n=this.node(t,{kind:c.LIST_TYPE,type:r})}else n=this.parseNamedType();return this.expectOptionalToken(o.BANG)?this.node(t,{kind:c.NON_NULL_TYPE,type:n}):n}parseNamedType(){return this.node(this._lexer.token,{kind:c.NAMED_TYPE,name:this.parseName()})}peekDescription(){return this.peek(o.STRING)||this.peek(o.BLOCK_STRING)}parseDescription(){if(this.peekDescription())return this.parseStringLiteral()}parseSchemaDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("schema");let r=this.parseConstDirectives(),i=this.many(o.BRACE_L,this.parseOperationTypeDefinition,o.BRACE_R);return this.node(t,{kind:c.SCHEMA_DEFINITION,description:n,directives:r,operationTypes:i})}parseOperationTypeDefinition(){let t=this._lexer.token,n=this.parseOperationType();this.expectToken(o.COLON);let r=this.parseNamedType();return this.node(t,{kind:c.OPERATION_TYPE_DEFINITION,operation:n,type:r})}parseScalarTypeDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("scalar");let r=this.parseName(),i=this.parseConstDirectives();return this.node(t,{kind:c.SCALAR_TYPE_DEFINITION,description:n,name:r,directives:i})}parseObjectTypeDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("type");let r=this.parseName(),i=this.parseImplementsInterfaces(),s=this.parseConstDirectives(),a=this.parseFieldsDefinition();return this.node(t,{kind:c.OBJECT_TYPE_DEFINITION,description:n,name:r,interfaces:i,directives:s,fields:a})}parseImplementsInterfaces(){return this.expectOptionalKeyword("implements")?this.delimitedMany(o.AMP,this.parseNamedType):void 0}parseFieldsDefinition(){return this.optionalMany(o.BRACE_L,this.parseFieldDefinition,o.BRACE_R)}parseFieldDefinition(){let t=this._lexer.token,n=this.parseDescription(),r=this.parseName(),i=this.parseArgumentDefs();this.expectToken(o.COLON);let s=this.parseTypeReference(),a=this.parseConstDirectives();return this.node(t,{kind:c.FIELD_DEFINITION,description:n,name:r,arguments:i,type:s,directives:a})}parseArgumentDefs(){return this.optionalMany(o.PAREN_L,this.parseInputValueDef,o.PAREN_R)}parseInputValueDef(){let t=this._lexer.token,n=this.parseDescription(),r=this.parseName();this.expectToken(o.COLON);let i=this.parseTypeReference(),s;this.expectOptionalToken(o.EQUALS)&&(s=this.parseConstValueLiteral());let a=this.parseConstDirectives();return this.node(t,{kind:c.INPUT_VALUE_DEFINITION,description:n,name:r,type:i,defaultValue:s,directives:a})}parseInterfaceTypeDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("interface");let r=this.parseName(),i=this.parseImplementsInterfaces(),s=this.parseConstDirectives(),a=this.parseFieldsDefinition();return this.node(t,{kind:c.INTERFACE_TYPE_DEFINITION,description:n,name:r,interfaces:i,directives:s,fields:a})}parseUnionTypeDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("union");let r=this.parseName(),i=this.parseConstDirectives(),s=this.parseUnionMemberTypes();return this.node(t,{kind:c.UNION_TYPE_DEFINITION,description:n,name:r,directives:i,types:s})}parseUnionMemberTypes(){return this.expectOptionalToken(o.EQUALS)?this.delimitedMany(o.PIPE,this.parseNamedType):void 0}parseEnumTypeDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("enum");let r=this.parseName(),i=this.parseConstDirectives(),s=this.parseEnumValuesDefinition();return this.node(t,{kind:c.ENUM_TYPE_DEFINITION,description:n,name:r,directives:i,values:s})}parseEnumValuesDefinition(){return this.optionalMany(o.BRACE_L,this.parseEnumValueDefinition,o.BRACE_R)}parseEnumValueDefinition(){let t=this._lexer.token,n=this.parseDescription(),r=this.parseEnumValueName(),i=this.parseConstDirectives();return this.node(t,{kind:c.ENUM_VALUE_DEFINITION,description:n,name:r,directives:i})}parseEnumValueName(){if(this._lexer.token.value==="true"||this._lexer.token.value==="false"||this._lexer.token.value==="null")throw l(this._lexer.source,this._lexer.token.start,`${ce(this._lexer.token)} is reserved and cannot be used for an enum value.`);return this.parseName()}parseInputObjectTypeDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("input");let r=this.parseName(),i=this.parseConstDirectives(),s=this.parseInputFieldsDefinition();return this.node(t,{kind:c.INPUT_OBJECT_TYPE_DEFINITION,description:n,name:r,directives:i,fields:s})}parseInputFieldsDefinition(){return this.optionalMany(o.BRACE_L,this.parseInputValueDef,o.BRACE_R)}parseTypeSystemExtension(){let t=this._lexer.lookahead();if(t.kind===o.NAME)switch(t.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();case"directive":return this.parseDirectiveExtension()}throw this.unexpected(t)}parseSchemaExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");let n=this.parseConstDirectives(),r=this.optionalMany(o.BRACE_L,this.parseOperationTypeDefinition,o.BRACE_R);if(n===void 0&&r===void 0)throw this.unexpected();return this.node(t,{kind:c.SCHEMA_EXTENSION,directives:n,operationTypes:r})}parseScalarTypeExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("scalar");let n=this.parseName(),r=this.parseConstDirectives();if(r===void 0)throw this.unexpected();return this.node(t,{kind:c.SCALAR_TYPE_EXTENSION,name:n,directives:r})}parseObjectTypeExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");let n=this.parseName(),r=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),s=this.parseFieldsDefinition();if(r===void 0&&i===void 0&&s===void 0)throw this.unexpected();return this.node(t,{kind:c.OBJECT_TYPE_EXTENSION,name:n,interfaces:r,directives:i,fields:s})}parseInterfaceTypeExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");let n=this.parseName(),r=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),s=this.parseFieldsDefinition();if(r===void 0&&i===void 0&&s===void 0)throw this.unexpected();return this.node(t,{kind:c.INTERFACE_TYPE_EXTENSION,name:n,interfaces:r,directives:i,fields:s})}parseUnionTypeExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");let n=this.parseName(),r=this.parseConstDirectives(),i=this.parseUnionMemberTypes();if(r===void 0&&i===void 0)throw this.unexpected();return this.node(t,{kind:c.UNION_TYPE_EXTENSION,name:n,directives:r,types:i})}parseEnumTypeExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");let n=this.parseName(),r=this.parseConstDirectives(),i=this.parseEnumValuesDefinition();if(r===void 0&&i===void 0)throw this.unexpected();return this.node(t,{kind:c.ENUM_TYPE_EXTENSION,name:n,directives:r,values:i})}parseInputObjectTypeExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");let n=this.parseName(),r=this.parseConstDirectives(),i=this.parseInputFieldsDefinition();if(r===void 0&&i===void 0)throw this.unexpected();return this.node(t,{kind:c.INPUT_OBJECT_TYPE_EXTENSION,name:n,directives:r,fields:i})}parseDirectiveExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("directive"),this.expectToken(o.AT);let n=this.parseName(),r=this.parseConstDirectives();if(r===void 0)throw this.unexpected();return this.node(t,{kind:c.DIRECTIVE_EXTENSION,name:n,directives:r})}parseDirectiveDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("directive"),this.expectToken(o.AT);let r=this.parseName(),i=this.parseArgumentDefs(),s=this.parseConstDirectives(),a=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");let p=this.parseDirectiveLocations();return this.node(t,{kind:c.DIRECTIVE_DEFINITION,description:n,name:r,arguments:i,directives:s,repeatable:a,locations:p})}parseDirectiveLocations(){return this.delimitedMany(o.PIPE,this.parseDirectiveLocation)}parseDirectiveLocation(){let t=this._lexer.token,n=this.parseName();if(at(Ae,n.value))return n;throw this.unexpected(t)}parseSchemaCoordinate(){let t=this._lexer.token,n=this.expectOptionalToken(o.AT),r=this.parseName(),i;!n&&this.expectOptionalToken(o.DOT)&&(i=this.parseName());let s;return(n||i)&&this.expectOptionalToken(o.PAREN_L)&&(s=this.parseName(),this.expectToken(o.COLON),this.expectToken(o.PAREN_R)),n?s?this.node(t,{kind:c.DIRECTIVE_ARGUMENT_COORDINATE,name:r,argumentName:s}):this.node(t,{kind:c.DIRECTIVE_COORDINATE,name:r}):i?s?this.node(t,{kind:c.ARGUMENT_COORDINATE,name:r,fieldName:i,argumentName:s}):this.node(t,{kind:c.MEMBER_COORDINATE,name:r,memberName:i}):this.node(t,{kind:c.TYPE_COORDINATE,name:r})}node(t,n){return this._options.noLocation!==!0&&(n.loc=new Q(t,this._lexer.lastToken,this._lexer.source)),n}peek(t){return this._lexer.token.kind===t}expectToken(t){let n=this._lexer.token;if(n.kind===t)return this.advanceLexer(),n;throw l(this._lexer.source,n.start,`Expected ${Nt(t)}, found ${ce(n)}.`)}expectOptionalToken(t){return this._lexer.token.kind===t?(this.advanceLexer(),!0):!1}expectKeyword(t){let n=this._lexer.token;if(n.kind===o.NAME&&n.value===t)this.advanceLexer();else throw l(this._lexer.source,n.start,`Expected "${t}", found ${ce(n)}.`)}expectOptionalKeyword(t){let n=this._lexer.token;return n.kind===o.NAME&&n.value===t?(this.advanceLexer(),!0):!1}unexpected(t){let n=t??this._lexer.token;return l(this._lexer.source,n.start,`Unexpected ${ce(n)}.`)}any(t,n,r){this.expectToken(t);let i=[];for(;!this.expectOptionalToken(r);)i.push(n.call(this));return i}optionalMany(t,n,r){if(this.expectOptionalToken(t)){let i=[];do i.push(n.call(this));while(!this.expectOptionalToken(r));return i}}many(t,n,r){this.expectToken(t);let i=[];do i.push(n.call(this));while(!this.expectOptionalToken(r));return i}delimitedMany(t,n){this.expectOptionalToken(t);let r=[];do r.push(n.call(this));while(this.expectOptionalToken(t));return r}advanceLexer(){let{maxLexicalTokens:t=this._options.maxTokens}=this._options,n=this._lexer.advance();if(n.kind!==o.EOF&&(++this._tokenCounter,t!==void 0&&this._tokenCounter>t))throw l(this._lexer.source,n.start,`Document contains more than ${t} tokens. Parsing aborted.`)}};function ce(e){let t=e.value;return Nt(e.kind)+(t!=null?` "${t}"`:"")}function Nt(e){return mt(e)?`"${e}"`:e}function ci(e,t){let n=new SyntaxError(e+" ("+t.loc.start.line+":"+t.loc.start.column+")");return Object.assign(n,t)}var _t=ci;function pi(e){let t=[],{startToken:n,endToken:r}=e.loc;for(let i=n;i!==r;i=i.next)i.kind==="Comment"&&t.push({...i,loc:{start:i.start,end:i.end}});return t}var ui={experimentalFragmentArguments:!0};function li(e){if(!(e instanceof L))return e;let{message:t,locations:[n]}=e;return _t(t,{loc:{start:n},cause:e})}function di(e){let t;try{t=pe(e,ui)}catch(n){throw li(n)}return t.comments=pi(t),t}var fi={parse:di,astFormat:"graphql",hasPragma:qe,hasIgnorePragma:$e,locStart:Z,locEnd:ee};var mi={graphql:ze};export{Dt as default,Ze as languages,tt as options,Ie as parsers,mi as printers};
|
|
17
|
+
`));return e.line+=d.length-1,e.lineStart=i,D}if(x===92&&n.charCodeAt(s+1)===34&&n.charCodeAt(s+2)===34&&n.charCodeAt(s+3)===34){p+=n.slice(a,s),a=s+1,s+=4;continue}if(x===10||x===13){p+=n.slice(a,s),d.push(p),x===13&&n.charCodeAt(s+1)===10?s+=2:++s,p="",a=s,i=s;continue}if(G(x))++s;else if(ce(n,s))s+=2;else throw l(e.source,s,`Invalid character within String: ${V(e,s)}.`)}throw l(e.source,s,"Unterminated string.")}function ii(e,t){let n=e.source.body,r=n.length,i=t+1;for(;i<r;){let s=n.charCodeAt(i);if(ut(s))++i;else break}return h(e,o.NAME,t,i,n.slice(t,i))}var Tt=Symbol("Source"),K=class{constructor(t,n="GraphQL request",r={line:1,column:1}){this.__kind=Tt,this.body=t,this.name=n,this.locationOffset=r,this.locationOffset.line>0||_e(!1,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||_e(!1,"column in locationOffset is 1-indexed and must be positive.")}get[Symbol.toStringTag](){return"Source"}};function xt(e){return nt(e,Tt,K)}function ue(e,t){return dt(Se)?Se.traceSync(()=>yt(e,t),{source:e}):yt(e,t)}function yt(e,t){let n=new ge(e,t),r=n.parseDocument();return Object.defineProperty(r,"tokenCount",{enumerable:!1,value:n.tokenCount}),r}var ge=class{constructor(t,n={}){let{lexer:r,...i}=n;if(r)this._lexer=r;else{let a=xt(t)?t:new K(t);this._lexer=new W(a)}this._options=i,this._tokenCounter=0,this._lexer._maxComments=i.maxComments,this._lexer._commentCount=0;let s=i.maxSourceLength;if(s!==void 0&&this._lexer.source.body.length>s)throw l(this._lexer.source,s,`Source contains more than ${s} UTF-16 code units. Parsing aborted.`)}get tokenCount(){return this._tokenCounter}parseName(){let t=this.expectToken(o.NAME);return this.node(t,{kind:c.NAME,value:t.value})}parseDocument(){return this.node(this._lexer.token,{kind:c.DOCUMENT,definitions:this.many(o.SOF,this.parseDefinition,o.EOF)})}parseDefinition(){if(this.peek(o.BRACE_L))return this.parseOperationDefinition();let t=this.peekDescription(),n=t?this._lexer.lookahead():this._lexer.token;if(t&&n.kind===o.BRACE_L)throw l(this._lexer.source,this._lexer.token.start,"Unexpected description, descriptions are not supported on shorthand queries.");if(n.kind===o.NAME){switch(n.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(n.value){case"query":case"mutation":case"subscription":return this.parseOperationDefinition();case"fragment":return this.parseFragmentDefinition()}if(t)throw l(this._lexer.source,this._lexer.token.start,"Unexpected description, only GraphQL definitions support descriptions.");if(n.value==="extend")return this.parseTypeSystemExtension()}throw this.unexpected(n)}parseOperationDefinition(){let t=this._lexer.token;if(this.peek(o.BRACE_L))return this.node(t,{kind:c.OPERATION_DEFINITION,operation:U.QUERY,description:void 0,name:void 0,variableDefinitions:void 0,directives:void 0,selectionSet:this.parseSelectionSet()});let n=this.parseDescription(),r=this.parseOperationType(),i;return this.peek(o.NAME)&&(i=this.parseName()),this.node(t,{kind:c.OPERATION_DEFINITION,operation:r,description:n,name:i,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseOperationType(){let t=this.expectToken(o.NAME);switch(t.value){case"query":return U.QUERY;case"mutation":return U.MUTATION;case"subscription":return U.SUBSCRIPTION}throw this.unexpected(t)}parseVariableDefinitions(){return this.optionalMany(o.PAREN_L,this.parseVariableDefinition,o.PAREN_R)}parseVariableDefinition(){return this.node(this._lexer.token,{kind:c.VARIABLE_DEFINITION,description:this.parseDescription(),variable:this.parseVariable(),type:(this.expectToken(o.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(o.EQUALS)?this.parseConstValueLiteral():void 0,directives:this.parseConstDirectives()})}parseVariable(){let t=this._lexer.token;return this.expectToken(o.DOLLAR),this.node(t,{kind:c.VARIABLE,name:this.parseName()})}parseSelectionSet(){return this.node(this._lexer.token,{kind:c.SELECTION_SET,selections:this._options.allowEmptySelectionSets===!1?this.many(o.BRACE_L,this.parseSelection,o.BRACE_R):this.any(o.BRACE_L,this.parseSelection,o.BRACE_R)})}parseSelection(){return this.peek(o.SPREAD)?this.parseFragment():this.parseField()}parseField(){let t=this._lexer.token,n=this.parseName(),r,i;return this.expectOptionalToken(o.COLON)?(r=n,i=this.parseName()):i=n,this.node(t,{kind:c.FIELD,alias:r,name:i,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(o.BRACE_L)?this.parseSelectionSet():void 0})}parseArguments(t){let n=t?this.parseConstArgument:this.parseArgument;return this.optionalMany(o.PAREN_L,n,o.PAREN_R)}parseFragmentArguments(){let t=this.parseFragmentArgument;return this.optionalMany(o.PAREN_L,t,o.PAREN_R)}parseArgument(t=!1){let n=this._lexer.token,r=this.parseName();return this.expectToken(o.COLON),this.node(n,{kind:c.ARGUMENT,name:r,value:this.parseValueLiteral(t)})}parseConstArgument(){return this.parseArgument(!0)}parseFragmentArgument(){let t=this._lexer.token,n=this.parseName();return this.expectToken(o.COLON),this.node(t,{kind:c.FRAGMENT_ARGUMENT,name:n,value:this.parseValueLiteral(!1)})}parseFragment(){let t=this._lexer.token;this.expectToken(o.SPREAD);let n=this.expectOptionalKeyword("on");if(!n&&this.peek(o.NAME)){let r=this.parseFragmentName();return this.peek(o.PAREN_L)&&this._options.experimentalFragmentArguments?this.node(t,{kind:c.FRAGMENT_SPREAD,name:r,arguments:this.parseFragmentArguments(),directives:this.parseDirectives(!1)}):this.node(t,{kind:c.FRAGMENT_SPREAD,name:r,directives:this.parseDirectives(!1)})}return this.node(t,{kind:c.INLINE_FRAGMENT,typeCondition:n?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentDefinition(){let t=this._lexer.token,n=this.parseDescription();return this.expectKeyword("fragment"),this._options.experimentalFragmentArguments===!0?this.node(t,{kind:c.FRAGMENT_DEFINITION,description:n,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()}):this.node(t,{kind:c.FRAGMENT_DEFINITION,description:n,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(t){let n=this._lexer.token;switch(n.kind){case o.BRACKET_L:return this.parseList(t);case o.BRACE_L:return this.parseObject(t);case o.INT:return this.advanceLexer(),this.node(n,{kind:c.INT,value:n.value});case o.FLOAT:return this.advanceLexer(),this.node(n,{kind:c.FLOAT,value:n.value});case o.STRING:case o.BLOCK_STRING:return this.parseStringLiteral();case o.NAME:switch(this.advanceLexer(),n.value){case"true":return this.node(n,{kind:c.BOOLEAN,value:!0});case"false":return this.node(n,{kind:c.BOOLEAN,value:!1});case"null":return this.node(n,{kind:c.NULL});default:return this.node(n,{kind:c.ENUM,value:n.value})}case o.DOLLAR:if(t)if(this.expectToken(o.DOLLAR),this._lexer.token.kind===o.NAME){let r=this._lexer.token.value;throw l(this._lexer.source,n.start,`Unexpected variable "$${r}" in constant value.`)}else throw this.unexpected(n);return this.parseVariable();default:throw this.unexpected()}}parseConstValueLiteral(){return this.parseValueLiteral(!0)}parseStringLiteral(){let t=this._lexer.token;return this.advanceLexer(),this.node(t,{kind:c.STRING,value:t.value,block:t.kind===o.BLOCK_STRING})}parseList(t){let n=()=>this.parseValueLiteral(t);return this.node(this._lexer.token,{kind:c.LIST,values:this.any(o.BRACKET_L,n,o.BRACKET_R)})}parseObject(t){let n=()=>this.parseObjectField(t);return this.node(this._lexer.token,{kind:c.OBJECT,fields:this.any(o.BRACE_L,n,o.BRACE_R)})}parseObjectField(t){let n=this._lexer.token,r=this.parseName();return this.expectToken(o.COLON),this.node(n,{kind:c.OBJECT_FIELD,name:r,value:this.parseValueLiteral(t)})}parseDirectives(t){let n=[];for(;this.peek(o.AT);)n.push(this.parseDirective(t));if(n.length)return n}parseConstDirectives(){return this.parseDirectives(!0)}parseDirective(t){let n=this._lexer.token;return this.expectToken(o.AT),this.node(n,{kind:c.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(t)})}parseTypeReference(){let t=this._lexer.token,n;if(this.expectOptionalToken(o.BRACKET_L)){let r=this.parseTypeReference();this.expectToken(o.BRACKET_R),n=this.node(t,{kind:c.LIST_TYPE,type:r})}else n=this.parseNamedType();return this.expectOptionalToken(o.BANG)?this.node(t,{kind:c.NON_NULL_TYPE,type:n}):n}parseNamedType(){return this.node(this._lexer.token,{kind:c.NAMED_TYPE,name:this.parseName()})}peekDescription(){return this.peek(o.STRING)||this.peek(o.BLOCK_STRING)}parseDescription(){if(this.peekDescription())return this.parseStringLiteral()}parseSchemaDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("schema");let r=this.parseConstDirectives(),i=this.many(o.BRACE_L,this.parseOperationTypeDefinition,o.BRACE_R);return this.node(t,{kind:c.SCHEMA_DEFINITION,description:n,directives:r,operationTypes:i})}parseOperationTypeDefinition(){let t=this._lexer.token,n=this.parseOperationType();this.expectToken(o.COLON);let r=this.parseNamedType();return this.node(t,{kind:c.OPERATION_TYPE_DEFINITION,operation:n,type:r})}parseScalarTypeDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("scalar");let r=this.parseName(),i=this.parseConstDirectives();return this.node(t,{kind:c.SCALAR_TYPE_DEFINITION,description:n,name:r,directives:i})}parseObjectTypeDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("type");let r=this.parseName(),i=this.parseImplementsInterfaces(),s=this.parseConstDirectives(),a=this.parseFieldsDefinition();return this.node(t,{kind:c.OBJECT_TYPE_DEFINITION,description:n,name:r,interfaces:i,directives:s,fields:a})}parseImplementsInterfaces(){return this.expectOptionalKeyword("implements")?this.delimitedMany(o.AMP,this.parseNamedType):void 0}parseFieldsDefinition(){return this.optionalMany(o.BRACE_L,this.parseFieldDefinition,o.BRACE_R)}parseFieldDefinition(){let t=this._lexer.token,n=this.parseDescription(),r=this.parseName(),i=this.parseArgumentDefs();this.expectToken(o.COLON);let s=this.parseTypeReference(),a=this.parseConstDirectives();return this.node(t,{kind:c.FIELD_DEFINITION,description:n,name:r,arguments:i,type:s,directives:a})}parseArgumentDefs(){return this.optionalMany(o.PAREN_L,this.parseInputValueDef,o.PAREN_R)}parseInputValueDef(){let t=this._lexer.token,n=this.parseDescription(),r=this.parseName();this.expectToken(o.COLON);let i=this.parseTypeReference(),s;this.expectOptionalToken(o.EQUALS)&&(s=this.parseConstValueLiteral());let a=this.parseConstDirectives();return this.node(t,{kind:c.INPUT_VALUE_DEFINITION,description:n,name:r,type:i,defaultValue:s,directives:a})}parseInterfaceTypeDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("interface");let r=this.parseName(),i=this.parseImplementsInterfaces(),s=this.parseConstDirectives(),a=this.parseFieldsDefinition();return this.node(t,{kind:c.INTERFACE_TYPE_DEFINITION,description:n,name:r,interfaces:i,directives:s,fields:a})}parseUnionTypeDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("union");let r=this.parseName(),i=this.parseConstDirectives(),s=this.parseUnionMemberTypes();return this.node(t,{kind:c.UNION_TYPE_DEFINITION,description:n,name:r,directives:i,types:s})}parseUnionMemberTypes(){return this.expectOptionalToken(o.EQUALS)?this.delimitedMany(o.PIPE,this.parseNamedType):void 0}parseEnumTypeDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("enum");let r=this.parseName(),i=this.parseConstDirectives(),s=this.parseEnumValuesDefinition();return this.node(t,{kind:c.ENUM_TYPE_DEFINITION,description:n,name:r,directives:i,values:s})}parseEnumValuesDefinition(){return this.optionalMany(o.BRACE_L,this.parseEnumValueDefinition,o.BRACE_R)}parseEnumValueDefinition(){let t=this._lexer.token,n=this.parseDescription(),r=this.parseEnumValueName(),i=this.parseConstDirectives();return this.node(t,{kind:c.ENUM_VALUE_DEFINITION,description:n,name:r,directives:i})}parseEnumValueName(){if(this._lexer.token.value==="true"||this._lexer.token.value==="false"||this._lexer.token.value==="null")throw l(this._lexer.source,this._lexer.token.start,`${pe(this._lexer.token)} is reserved and cannot be used for an enum value.`);return this.parseName()}parseInputObjectTypeDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("input");let r=this.parseName(),i=this.parseConstDirectives(),s=this.parseInputFieldsDefinition();return this.node(t,{kind:c.INPUT_OBJECT_TYPE_DEFINITION,description:n,name:r,directives:i,fields:s})}parseInputFieldsDefinition(){return this.optionalMany(o.BRACE_L,this.parseInputValueDef,o.BRACE_R)}parseTypeSystemExtension(){let t=this._lexer.lookahead();if(t.kind===o.NAME)switch(t.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();case"directive":return this.parseDirectiveExtension()}throw this.unexpected(t)}parseSchemaExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");let n=this.parseConstDirectives(),r=this.optionalMany(o.BRACE_L,this.parseOperationTypeDefinition,o.BRACE_R);if(n===void 0&&r===void 0)throw this.unexpected();return this.node(t,{kind:c.SCHEMA_EXTENSION,directives:n,operationTypes:r})}parseScalarTypeExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("scalar");let n=this.parseName(),r=this.parseConstDirectives();if(r===void 0)throw this.unexpected();return this.node(t,{kind:c.SCALAR_TYPE_EXTENSION,name:n,directives:r})}parseObjectTypeExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");let n=this.parseName(),r=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),s=this.parseFieldsDefinition();if(r===void 0&&i===void 0&&s===void 0)throw this.unexpected();return this.node(t,{kind:c.OBJECT_TYPE_EXTENSION,name:n,interfaces:r,directives:i,fields:s})}parseInterfaceTypeExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");let n=this.parseName(),r=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),s=this.parseFieldsDefinition();if(r===void 0&&i===void 0&&s===void 0)throw this.unexpected();return this.node(t,{kind:c.INTERFACE_TYPE_EXTENSION,name:n,interfaces:r,directives:i,fields:s})}parseUnionTypeExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");let n=this.parseName(),r=this.parseConstDirectives(),i=this.parseUnionMemberTypes();if(r===void 0&&i===void 0)throw this.unexpected();return this.node(t,{kind:c.UNION_TYPE_EXTENSION,name:n,directives:r,types:i})}parseEnumTypeExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");let n=this.parseName(),r=this.parseConstDirectives(),i=this.parseEnumValuesDefinition();if(r===void 0&&i===void 0)throw this.unexpected();return this.node(t,{kind:c.ENUM_TYPE_EXTENSION,name:n,directives:r,values:i})}parseInputObjectTypeExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");let n=this.parseName(),r=this.parseConstDirectives(),i=this.parseInputFieldsDefinition();if(r===void 0&&i===void 0)throw this.unexpected();return this.node(t,{kind:c.INPUT_OBJECT_TYPE_EXTENSION,name:n,directives:r,fields:i})}parseDirectiveExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("directive"),this.expectToken(o.AT);let n=this.parseName(),r=this.parseConstDirectives();if(r===void 0)throw this.unexpected();return this.node(t,{kind:c.DIRECTIVE_EXTENSION,name:n,directives:r})}parseDirectiveDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("directive"),this.expectToken(o.AT);let r=this.parseName(),i=this.parseArgumentDefs(),s=this.parseConstDirectives(),a=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");let p=this.parseDirectiveLocations();return this.node(t,{kind:c.DIRECTIVE_DEFINITION,description:n,name:r,arguments:i,directives:s,repeatable:a,locations:p})}parseDirectiveLocations(){return this.delimitedMany(o.PIPE,this.parseDirectiveLocation)}parseDirectiveLocation(){let t=this._lexer.token,n=this.parseName();if(at(Ae,n.value))return n;throw this.unexpected(t)}parseSchemaCoordinate(){let t=this._lexer.token,n=this.expectOptionalToken(o.AT),r=this.parseName(),i;!n&&this.expectOptionalToken(o.DOT)&&(i=this.parseName());let s;return(n||i)&&this.expectOptionalToken(o.PAREN_L)&&(s=this.parseName(),this.expectToken(o.COLON),this.expectToken(o.PAREN_R)),n?s?this.node(t,{kind:c.DIRECTIVE_ARGUMENT_COORDINATE,name:r,argumentName:s}):this.node(t,{kind:c.DIRECTIVE_COORDINATE,name:r}):i?s?this.node(t,{kind:c.ARGUMENT_COORDINATE,name:r,fieldName:i,argumentName:s}):this.node(t,{kind:c.MEMBER_COORDINATE,name:r,memberName:i}):this.node(t,{kind:c.TYPE_COORDINATE,name:r})}node(t,n){return this._options.noLocation!==!0&&(n.loc=new X(t,this._lexer.lastToken,this._lexer.source)),n}peek(t){return this._lexer.token.kind===t}expectToken(t){let n=this._lexer.token;if(n.kind===t)return this.advanceLexer(),n;throw l(this._lexer.source,n.start,`Expected ${Nt(t)}, found ${pe(n)}.`)}expectOptionalToken(t){return this._lexer.token.kind===t?(this.advanceLexer(),!0):!1}expectKeyword(t){let n=this._lexer.token;if(n.kind===o.NAME&&n.value===t)this.advanceLexer();else throw l(this._lexer.source,n.start,`Expected "${t}", found ${pe(n)}.`)}expectOptionalKeyword(t){let n=this._lexer.token;return n.kind===o.NAME&&n.value===t?(this.advanceLexer(),!0):!1}unexpected(t){let n=t??this._lexer.token;return l(this._lexer.source,n.start,`Unexpected ${pe(n)}.`)}any(t,n,r){this.expectToken(t);let i=[];for(;!this.expectOptionalToken(r);)i.push(n.call(this));return i}optionalMany(t,n,r){if(this.expectOptionalToken(t)){let i=[];do i.push(n.call(this));while(!this.expectOptionalToken(r));return i}}many(t,n,r){this.expectToken(t);let i=[];do i.push(n.call(this));while(!this.expectOptionalToken(r));return i}delimitedMany(t,n){this.expectOptionalToken(t);let r=[];do r.push(n.call(this));while(this.expectOptionalToken(t));return r}advanceLexer(){let{maxLexicalTokens:t=this._options.maxTokens}=this._options,n=this._lexer.advance();if(n.kind!==o.EOF&&(++this._tokenCounter,t!==void 0&&this._tokenCounter>t))throw l(this._lexer.source,n.start,`Document contains more than ${t} tokens. Parsing aborted.`)}};function pe(e){let t=e.value;return Nt(e.kind)+(t!=null?` "${t}"`:"")}function Nt(e){return mt(e)?`"${e}"`:e}function ci(e,t){let n=new SyntaxError(e+" ("+t.loc.start.line+":"+t.loc.start.column+")");return Object.assign(n,t)}var _t=ci;function pi(e){let t=[],{startToken:n,endToken:r}=e.loc;for(let i=n;i!==r;i=i.next)i.kind==="Comment"&&t.push({...i,loc:{start:i.start,end:i.end}});return t}var ui={experimentalFragmentArguments:!0};function li(e){if(!(e instanceof L))return e;let{message:t,locations:[n]}=e;return _t(t,{loc:{start:n},cause:e})}function di(e){let t;try{t=ue(e,ui)}catch(n){throw li(n)}return t.comments=pi(t),t}var fi={parse:di,astFormat:"graphql",hasPragma:qe,hasIgnorePragma:$e,locStart:ee,locEnd:te};var mi={graphql:ze};export{Dt as default,Ze as languages,tt as options,Ie as parsers,mi as printers};
|
package/standalone.js
CHANGED
|
@@ -24,6 +24,6 @@ ${l}`),u.reset(l)}function uu(t,e,r={}){return nu(t,e,r)}async function mi(t,e){
|
|
|
24
24
|
`&&(f+=St(m.slice(0,f),`
|
|
25
25
|
`)),m=ue(0,m,`
|
|
26
26
|
`,l)}return{formatted:m,cursorOffset:f,comments:c.comments}}function cr(t,e,r){return typeof e!="number"||Number.isNaN(e)||e<0||e>t.length?r:e}function du(t,e){let{cursorOffset:r,rangeStart:n,rangeEnd:u}=e;return r=cr(t,r,-1),n=cr(t,n,0),u=cr(t,u,t.length),{...e,cursorOffset:r,rangeStart:n,rangeEnd:u}}function Cu(t,e){let{cursorOffset:r,rangeStart:n,rangeEnd:u,endOfLine:o}=du(t,e),i=nn(t);if(i&&(t=t.slice(1),r--,n--,u--),o==="auto"&&(o=yr(t)),t.includes("\r")){let a=s=>St(t.slice(0,Math.max(s,0)),`\r
|
|
27
|
-
`);r-=a(r),n-=a(n),u-=a(u),t=_r(t)}return{hasBom:i,text:t,options:du(t,{...e,cursorOffset:r,rangeStart:n,rangeEnd:u,endOfLine:o})}}async function Fu(t,e){let r=await Ue(e);return!r.hasPragma||r.hasPragma(t)}async function wi(t,e){return(await Ue(e)).hasIgnorePragma?.(t)}async function lr(t,e){let{hasBom:r,text:n,options:u}=Cu(t,await ae(e));if(u.rangeStart>=u.rangeEnd&&n!==""||u.requirePragma&&!await Fu(n,u)||u.checkIgnorePragma&&await wi(n,u))return{formatted:t,cursorOffset:e.cursorOffset,comments:[]};let o;return u.rangeStart>0||u.rangeEnd<n.length?o=await Bi(n,u):(!u.requirePragma&&u.insertPragma&&u.printer.insertPragma&&!await Fu(n,u)&&(n=u.printer.insertPragma(n)),o=await Eu(n,u)),r&&(o.formatted=un(o.formatted),o.cursorOffset>=0&&o.cursorOffset++),o}async function hu(t,e,r){let{text:n,options:u}=Cu(t,await ae(e)),o=await de(n,u);return r&&(r.preprocessForPrint&&(o.ast=await ir(o.ast,u)),r.massage&&(o.ast=au(o.ast,u))),o}async function gu(t,e){e=await ae(e);let r=await Ve(t,e);return he(r,e)}async function yu(t,e){let r=$r(t),{formatted:n}=await lr(r,{...e,parser:"__js_expression"});return n}async function _u(t,e){e=await ae(e);let{ast:r}=await de(t,e);return e.cursorOffset>=0&&(e={...e,...sr(r,e)}),Ve(r,e)}async function Au(t,e){return he(t,await ae(e))}var fr={};Tt(fr,{builders:()=>Oi,printer:()=>Pi,utils:()=>bi});var Oi={join:Je,line:et,softline:Ur,hardline:$,literalline:qe,group:Pt,conditionalGroup:vr,fill:Lr,lineSuffix:Ie,lineSuffixBoundary:Vr,cursor:te,breakParent:ce,ifBreak:Mr,trim:Wr,indent:ie,indentIfBreak:Yr,align:De,addAlignmentToDoc:Ze,markAsRoot:Qe,dedentToRoot:Ir,dedent:Rr,hardlineWithoutBreakParent:ke,literallineWithoutBreakParent:bt,label:jr,concat:t=>t},Pi={printDocToString:he},bi={willBreak:Br,traverseDoc:Oe,findInDoc:Ke,mapDoc:be,removeLines:Sr,stripTrailingHardline:He,replaceEndOfLine:Or,canBreak:Pr};var xu="3.10.
|
|
27
|
+
`);r-=a(r),n-=a(n),u-=a(u),t=_r(t)}return{hasBom:i,text:t,options:du(t,{...e,cursorOffset:r,rangeStart:n,rangeEnd:u,endOfLine:o})}}async function Fu(t,e){let r=await Ue(e);return!r.hasPragma||r.hasPragma(t)}async function wi(t,e){return(await Ue(e)).hasIgnorePragma?.(t)}async function lr(t,e){let{hasBom:r,text:n,options:u}=Cu(t,await ae(e));if(u.rangeStart>=u.rangeEnd&&n!==""||u.requirePragma&&!await Fu(n,u)||u.checkIgnorePragma&&await wi(n,u))return{formatted:t,cursorOffset:e.cursorOffset,comments:[]};let o;return u.rangeStart>0||u.rangeEnd<n.length?o=await Bi(n,u):(!u.requirePragma&&u.insertPragma&&u.printer.insertPragma&&!await Fu(n,u)&&(n=u.printer.insertPragma(n)),o=await Eu(n,u)),r&&(o.formatted=un(o.formatted),o.cursorOffset>=0&&o.cursorOffset++),o}async function hu(t,e,r){let{text:n,options:u}=Cu(t,await ae(e)),o=await de(n,u);return r&&(r.preprocessForPrint&&(o.ast=await ir(o.ast,u)),r.massage&&(o.ast=au(o.ast,u))),o}async function gu(t,e){e=await ae(e);let r=await Ve(t,e);return he(r,e)}async function yu(t,e){let r=$r(t),{formatted:n}=await lr(r,{...e,parser:"__js_expression"});return n}async function _u(t,e){e=await ae(e);let{ast:r}=await de(t,e);return e.cursorOffset>=0&&(e={...e,...sr(r,e)}),Ve(r,e)}async function Au(t,e){return he(t,await ae(e))}var fr={};Tt(fr,{builders:()=>Oi,printer:()=>Pi,utils:()=>bi});var Oi={join:Je,line:et,softline:Ur,hardline:$,literalline:qe,group:Pt,conditionalGroup:vr,fill:Lr,lineSuffix:Ie,lineSuffixBoundary:Vr,cursor:te,breakParent:ce,ifBreak:Mr,trim:Wr,indent:ie,indentIfBreak:Yr,align:De,addAlignmentToDoc:Ze,markAsRoot:Qe,dedentToRoot:Ir,dedent:Rr,hardlineWithoutBreakParent:ke,literallineWithoutBreakParent:bt,label:jr,concat:t=>t},Pi={printDocToString:he},bi={willBreak:Br,traverseDoc:Oe,findInDoc:Ke,mapDoc:be,removeLines:Sr,stripTrailingHardline:He,replaceEndOfLine:Or,canBreak:Pr};var xu="3.10.1";var mr={};Tt(mr,{addDanglingComment:()=>ne,addLeadingComment:()=>le,addTrailingComment:()=>fe,getAlignmentSize:()=>ge,getIndentSize:()=>Tu,getMaxContinuousCount:()=>Nu,getNextNonSpaceNonCommentCharacter:()=>Bu,getNextNonSpaceNonCommentCharacterIndex:()=>zi,getPreferredQuote:()=>Ou,getStringWidth:()=>Re,hasNewline:()=>J,hasNewlineInRange:()=>Pu,hasSpaces:()=>bu,isNextLineEmpty:()=>qi,isNextLineEmptyAfterIndex:()=>_t,isPreviousLineEmpty:()=>Ki,makeString:()=>Ji,skip:()=>_e,skipEverythingButNewLine:()=>it,skipInlineComment:()=>Ne,skipNewline:()=>z,skipSpaces:()=>U,skipToLineEnd:()=>ot,skipTrailingComment:()=>Be,skipWhitespace:()=>sn});function ki(t,e){if(e===!1)return!1;if(t.charAt(e)==="/"&&t.charAt(e+1)==="*"){for(let r=e+2;r<t.length;++r)if(t.charAt(r)==="*"&&t.charAt(r+1)==="/")return r+2}return e}var Ne=ki;function Ii(t,e){return e===!1?!1:t.charAt(e)==="/"&&t.charAt(e+1)==="/"?it(t,e):e}var Be=Ii;function Ri(t,e){let r=null,n=e;for(;n!==r;)r=n,n=U(t,n),n=Ne(t,n),n=Be(t,n),n=z(t,n);return n}var We=Ri;function Li(t,e){let r=null,n=e;for(;n!==r;)r=n,n=ot(t,n),n=Ne(t,n),n=U(t,n);return n=Be(t,n),n=z(t,n),n!==!1&&J(t,n)}var _t=Li;function vi(t,e){let r=t.lastIndexOf(`
|
|
28
28
|
`);return r===-1?0:ge(t.slice(r+1).match(/^[\t ]*/)[0],e)}var Tu=vi;function pr(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function Mi(t,e){let r=t.matchAll(new RegExp(`(?:${pr(e)})+`,"g"));return r.reduce||(r=[...r]),r.reduce((n,[u])=>Math.max(n,u.length),0)/e.length}var Nu=Mi;function Yi(t,e){let r=We(t,e);return r===!1?"":t.charAt(r)}var Bu=Yi;var wu=Object.freeze({character:"'",codePoint:39}),Su=Object.freeze({character:'"',codePoint:34}),ji=Object.freeze({preferred:wu,alternate:Su}),Ui=Object.freeze({preferred:Su,alternate:wu});function Ou(t,e){let{preferred:r,alternate:n}=e===!0||e==="'"?ji:Ui,{length:u}=t,o=0,i=0;for(let a=0;a<u;a++){let s=t.charCodeAt(a);s===r.codePoint?o++:s===n.codePoint&&i++}return(o>i?n:r).character}function Vi(t,e,r){for(let n=e;n<r;++n)if(t.charAt(n)===`
|
|
29
29
|
`)return!0;return!1}var Pu=Vi;function Wi(t,e,r={}){return U(t,r.backwards?e-1:e,r)!==e}var bu=Wi;function $i(t,e,r){return We(t,r(e))}function zi(t,e){return arguments.length===2||typeof e=="number"?We(t,e):$i(...arguments)}function Gi(t,e,r){return Le(t,r(e))}function Ki(t,e){return arguments.length===2||typeof e=="number"?Le(t,e):Gi(...arguments)}function Hi(t,e,r){return _t(t,r(e))}function Ji(t,e,r){let n=e==='"'?"'":'"',o=ue(0,t,/\\(.)|(["'])/gs,(i,a,s)=>a===n?a:s===e?"\\"+s:s||(r&&/^[^\n\r"'0-7\\bfnrt-vx\u2028\u2029]$/.test(a)?a:"\\"+a));return e+o+e}function qi(t,e){return arguments.length===2||typeof e=="number"?_t(t,e):Hi(...arguments)}function Fe(t,e=1){return async(...r)=>{let n=r[e]??{},u=n.plugins??[];return r[e]={...n,plugins:Array.isArray(u)?u:Object.values(u)},await t(...r)}}var ku=Fe(lr);async function Iu(t,e){let{formatted:r}=await ku(t,{...e,cursorOffset:-1});return r}async function Xi(t,e){return await Iu(t,e)===t}var Qi=Fe(at,0),Zi={parse:Fe(hu),formatAST:Fe(gu),formatDoc:Fe(yu),printToDoc:Fe(_u),printDocToString:Fe(Au)};return Vu(es);});
|
package/standalone.mjs
CHANGED
|
@@ -24,6 +24,6 @@ ${l}`),o.reset(l)}function nu(t,e,r={}){return ru(t,e,r)}async function ci(t,e){
|
|
|
24
24
|
`&&(f+=wt(m.slice(0,f),`
|
|
25
25
|
`)),m=ue(0,m,`
|
|
26
26
|
`,l)}return{formatted:m,cursorOffset:f,comments:c.comments}}function Dr(t,e,r){return typeof e!="number"||Number.isNaN(e)||e<0||e>t.length?r:e}function mu(t,e){let{cursorOffset:r,rangeStart:n,rangeEnd:o}=e;return r=Dr(t,r,-1),n=Dr(t,n,0),o=Dr(t,o,t.length),{...e,cursorOffset:r,rangeStart:n,rangeEnd:o}}function Eu(t,e){let{cursorOffset:r,rangeStart:n,rangeEnd:o,endOfLine:u}=mu(t,e),i=rn(t);if(i&&(t=t.slice(1),r--,n--,o--),u==="auto"&&(u=gr(t)),t.includes("\r")){let a=s=>wt(t.slice(0,Math.max(s,0)),`\r
|
|
27
|
-
`);r-=a(r),n-=a(n),o-=a(o),t=yr(t)}return{hasBom:i,text:t,options:mu(t,{...e,cursorOffset:r,rangeStart:n,rangeEnd:o,endOfLine:u})}}async function du(t,e){let r=await Ue(e);return!r.hasPragma||r.hasPragma(t)}async function xi(t,e){return(await Ue(e)).hasIgnorePragma?.(t)}async function cr(t,e){let{hasBom:r,text:n,options:o}=Eu(t,await ae(e));if(o.rangeStart>=o.rangeEnd&&n!==""||o.requirePragma&&!await du(n,o)||o.checkIgnorePragma&&await xi(n,o))return{formatted:t,cursorOffset:e.cursorOffset,comments:[]};let u;return o.rangeStart>0||o.rangeEnd<n.length?u=await Ai(n,o):(!o.requirePragma&&o.insertPragma&&o.printer.insertPragma&&!await du(n,o)&&(n=o.printer.insertPragma(n)),u=await Fu(n,o)),r&&(u.formatted=nn(u.formatted),u.cursorOffset>=0&&u.cursorOffset++),u}async function Cu(t,e,r){let{text:n,options:o}=Eu(t,await ae(e)),u=await de(n,o);return r&&(r.preprocessForPrint&&(u.ast=await or(u.ast,o)),r.massage&&(u.ast=su(u.ast,o))),u}async function hu(t,e){e=await ae(e);let r=await Ve(t,e);return he(r,e)}async function gu(t,e){let r=Wr(t),{formatted:n}=await cr(r,{...e,parser:"__js_expression"});return n}async function yu(t,e){e=await ae(e);let{ast:r}=await de(t,e);return e.cursorOffset>=0&&(e={...e,...ir(r,e)}),Ve(r,e)}async function _u(t,e){return he(t,await ae(e))}var lr={};xt(lr,{builders:()=>Ni,printer:()=>Bi,utils:()=>wi});var Ni={join:Je,line:et,softline:jr,hardline:$,literalline:qe,group:Ot,conditionalGroup:Lr,fill:Rr,lineSuffix:Ie,lineSuffixBoundary:Ur,cursor:te,breakParent:ce,ifBreak:vr,trim:Vr,indent:ie,indentIfBreak:Mr,align:De,addAlignmentToDoc:Ze,markAsRoot:Qe,dedentToRoot:kr,dedent:Ir,hardlineWithoutBreakParent:ke,literallineWithoutBreakParent:Pt,label:Yr,concat:t=>t},Bi={printDocToString:he},wi={willBreak:Nr,traverseDoc:Oe,findInDoc:Ke,mapDoc:be,removeLines:wr,stripTrailingHardline:He,replaceEndOfLine:Sr,canBreak:Or};var Au="3.10.
|
|
27
|
+
`);r-=a(r),n-=a(n),o-=a(o),t=yr(t)}return{hasBom:i,text:t,options:mu(t,{...e,cursorOffset:r,rangeStart:n,rangeEnd:o,endOfLine:u})}}async function du(t,e){let r=await Ue(e);return!r.hasPragma||r.hasPragma(t)}async function xi(t,e){return(await Ue(e)).hasIgnorePragma?.(t)}async function cr(t,e){let{hasBom:r,text:n,options:o}=Eu(t,await ae(e));if(o.rangeStart>=o.rangeEnd&&n!==""||o.requirePragma&&!await du(n,o)||o.checkIgnorePragma&&await xi(n,o))return{formatted:t,cursorOffset:e.cursorOffset,comments:[]};let u;return o.rangeStart>0||o.rangeEnd<n.length?u=await Ai(n,o):(!o.requirePragma&&o.insertPragma&&o.printer.insertPragma&&!await du(n,o)&&(n=o.printer.insertPragma(n)),u=await Fu(n,o)),r&&(u.formatted=nn(u.formatted),u.cursorOffset>=0&&u.cursorOffset++),u}async function Cu(t,e,r){let{text:n,options:o}=Eu(t,await ae(e)),u=await de(n,o);return r&&(r.preprocessForPrint&&(u.ast=await or(u.ast,o)),r.massage&&(u.ast=su(u.ast,o))),u}async function hu(t,e){e=await ae(e);let r=await Ve(t,e);return he(r,e)}async function gu(t,e){let r=Wr(t),{formatted:n}=await cr(r,{...e,parser:"__js_expression"});return n}async function yu(t,e){e=await ae(e);let{ast:r}=await de(t,e);return e.cursorOffset>=0&&(e={...e,...ir(r,e)}),Ve(r,e)}async function _u(t,e){return he(t,await ae(e))}var lr={};xt(lr,{builders:()=>Ni,printer:()=>Bi,utils:()=>wi});var Ni={join:Je,line:et,softline:jr,hardline:$,literalline:qe,group:Ot,conditionalGroup:Lr,fill:Rr,lineSuffix:Ie,lineSuffixBoundary:Ur,cursor:te,breakParent:ce,ifBreak:vr,trim:Vr,indent:ie,indentIfBreak:Mr,align:De,addAlignmentToDoc:Ze,markAsRoot:Qe,dedentToRoot:kr,dedent:Ir,hardlineWithoutBreakParent:ke,literallineWithoutBreakParent:Pt,label:Yr,concat:t=>t},Bi={printDocToString:he},wi={willBreak:Nr,traverseDoc:Oe,findInDoc:Ke,mapDoc:be,removeLines:wr,stripTrailingHardline:He,replaceEndOfLine:Sr,canBreak:Or};var Au="3.10.1";var pr={};xt(pr,{addDanglingComment:()=>ne,addLeadingComment:()=>le,addTrailingComment:()=>fe,getAlignmentSize:()=>ge,getIndentSize:()=>xu,getMaxContinuousCount:()=>Tu,getNextNonSpaceNonCommentCharacter:()=>Nu,getNextNonSpaceNonCommentCharacterIndex:()=>Ui,getPreferredQuote:()=>Su,getStringWidth:()=>Re,hasNewline:()=>J,hasNewlineInRange:()=>Ou,hasSpaces:()=>Pu,isNextLineEmpty:()=>Gi,isNextLineEmptyAfterIndex:()=>_t,isPreviousLineEmpty:()=>Wi,makeString:()=>zi,skip:()=>_e,skipEverythingButNewLine:()=>it,skipInlineComment:()=>Ne,skipNewline:()=>z,skipSpaces:()=>U,skipToLineEnd:()=>ot,skipTrailingComment:()=>Be,skipWhitespace:()=>on});function Si(t,e){if(e===!1)return!1;if(t.charAt(e)==="/"&&t.charAt(e+1)==="*"){for(let r=e+2;r<t.length;++r)if(t.charAt(r)==="*"&&t.charAt(r+1)==="/")return r+2}return e}var Ne=Si;function Oi(t,e){return e===!1?!1:t.charAt(e)==="/"&&t.charAt(e+1)==="/"?it(t,e):e}var Be=Oi;function Pi(t,e){let r=null,n=e;for(;n!==r;)r=n,n=U(t,n),n=Ne(t,n),n=Be(t,n),n=z(t,n);return n}var We=Pi;function bi(t,e){let r=null,n=e;for(;n!==r;)r=n,n=ot(t,n),n=Ne(t,n),n=U(t,n);return n=Be(t,n),n=z(t,n),n!==!1&&J(t,n)}var _t=bi;function ki(t,e){let r=t.lastIndexOf(`
|
|
28
28
|
`);return r===-1?0:ge(t.slice(r+1).match(/^[\t ]*/)[0],e)}var xu=ki;function fr(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function Ii(t,e){let r=t.matchAll(new RegExp(`(?:${fr(e)})+`,"g"));return r.reduce||(r=[...r]),r.reduce((n,[o])=>Math.max(n,o.length),0)/e.length}var Tu=Ii;function Ri(t,e){let r=We(t,e);return r===!1?"":t.charAt(r)}var Nu=Ri;var Bu=Object.freeze({character:"'",codePoint:39}),wu=Object.freeze({character:'"',codePoint:34}),Li=Object.freeze({preferred:Bu,alternate:wu}),vi=Object.freeze({preferred:wu,alternate:Bu});function Su(t,e){let{preferred:r,alternate:n}=e===!0||e==="'"?Li:vi,{length:o}=t,u=0,i=0;for(let a=0;a<o;a++){let s=t.charCodeAt(a);s===r.codePoint?u++:s===n.codePoint&&i++}return(u>i?n:r).character}function Mi(t,e,r){for(let n=e;n<r;++n)if(t.charAt(n)===`
|
|
29
29
|
`)return!0;return!1}var Ou=Mi;function Yi(t,e,r={}){return U(t,r.backwards?e-1:e,r)!==e}var Pu=Yi;function ji(t,e,r){return We(t,r(e))}function Ui(t,e){return arguments.length===2||typeof e=="number"?We(t,e):ji(...arguments)}function Vi(t,e,r){return Le(t,r(e))}function Wi(t,e){return arguments.length===2||typeof e=="number"?Le(t,e):Vi(...arguments)}function $i(t,e,r){return _t(t,r(e))}function zi(t,e,r){let n=e==='"'?"'":'"',u=ue(0,t,/\\(.)|(["'])/gs,(i,a,s)=>a===n?a:s===e?"\\"+s:s||(r&&/^[^\n\r"'0-7\\bfnrt-vx\u2028\u2029]$/.test(a)?a:"\\"+a));return e+u+e}function Gi(t,e){return arguments.length===2||typeof e=="number"?_t(t,e):$i(...arguments)}function Fe(t,e=1){return async(...r)=>{let n=r[e]??{},o=n.plugins??[];return r[e]={...n,plugins:Array.isArray(o)?o:Object.values(o)},await t(...r)}}var bu=Fe(cr);async function ku(t,e){let{formatted:r}=await bu(t,{...e,cursorOffset:-1});return r}async function Ki(t,e){return await ku(t,e)===t}var Hi=Fe(at,0),Ji={parse:Fe(Cu),formatAST:Fe(hu),formatDoc:Fe(gu),printToDoc:Fe(yu),printDocToString:Fe(_u)};export{Ji as __debug,Ki as check,Iu as default,lr as doc,ku as format,bu as formatWithCursor,Hi as getSupportInfo,pr as util,Au as version};
|