UNPKG

@nacelle/compatibility-connector

Version:

Connect @nacelle/client-js-sdk to Nacelle's v2 back end with minimal code changes

38 lines (35 loc) 156 kB
(function(Q,H){typeof exports=="object"&&typeof module!="undefined"?H(exports,require("@nacelle/client-js-sdk")):typeof define=="function"&&define.amd?define(["exports","@nacelle/client-js-sdk"],H):(Q=typeof globalThis!="undefined"?globalThis:Q||self,H(Q.NacelleCompatibilityConnector={},Q.NacelleClientJsSdk))})(this,function(Q,H){"use strict";var Is=Object.defineProperty,Ts=Object.defineProperties;var ks=Object.getOwnPropertyDescriptors;var dt=Object.getOwnPropertySymbols;var fr=Object.prototype.hasOwnProperty,pr=Object.prototype.propertyIsEnumerable;var Qt=(Q,H,U)=>H in Q?Is(Q,H,{enumerable:!0,configurable:!0,writable:!0,value:U}):Q[H]=U,xe=(Q,H)=>{for(var U in H||(H={}))fr.call(H,U)&&Qt(Q,U,H[U]);if(dt)for(var U of dt(H))pr.call(H,U)&&Qt(Q,U,H[U]);return Q},ft=(Q,H)=>Ts(Q,ks(H));var hr=(Q,H)=>{var U={};for(var se in Q)fr.call(Q,se)&&H.indexOf(se)<0&&(U[se]=Q[se]);if(Q!=null&&dt)for(var se of dt(Q))H.indexOf(se)<0&&pr.call(Q,se)&&(U[se]=Q[se]);return U};var pt=(Q,H,U)=>(Qt(Q,typeof H!="symbol"?H+"":H,U),U);var Y=(Q,H,U)=>new Promise((se,Pe)=>{var _e=pe=>{try{De(U.next(pe))}catch(Ee){Pe(Ee)}},Te=pe=>{try{De(U.throw(pe))}catch(Ee){Pe(Ee)}},De=pe=>pe.done?se(pe.value):Promise.resolve(pe.value).then(_e,Te);De((U=U.apply(Q,H)).next())});var U=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function se(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Pe={},_e={},Te=U&&U.__assign||function(){return Te=Object.assign||function(e){for(var n,t=1,r=arguments.length;t<r;t++){n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},Te.apply(this,arguments)};Object.defineProperty(_e,"__esModule",{value:!0});var De={delayFirstAttempt:!1,jitter:"none",maxDelay:1/0,numOfAttempts:10,retry:function(){return!0},startingDelay:100,timeMultiple:2};function pe(e){var n=Te(Te({},De),e);return n.numOfAttempts<1&&(n.numOfAttempts=1),n}_e.getSanitizedOptions=pe;var Ee={},ht={},Ye={},yt={},vt={};Object.defineProperty(vt,"__esModule",{value:!0});function yr(e){var n=Math.random()*e;return Math.round(n)}vt.fullJitter=yr;var mt={};Object.defineProperty(mt,"__esModule",{value:!0});function vr(e){return e}mt.noJitter=vr,Object.defineProperty(yt,"__esModule",{value:!0});var mr=vt,gr=mt;function Er(e){switch(e.jitter){case"full":return mr.fullJitter;case"none":default:return gr.noJitter}}yt.JitterFactory=Er,Object.defineProperty(Ye,"__esModule",{value:!0});var br=yt,wr=function(){function e(n){this.options=n,this.attempt=0}return e.prototype.apply=function(){var n=this;return new Promise(function(t){return setTimeout(t,n.jitteredDelay)})},e.prototype.setAttemptNumber=function(n){this.attempt=n},Object.defineProperty(e.prototype,"jitteredDelay",{get:function(){var n=br.JitterFactory(this.options);return n(this.delay)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"delay",{get:function(){var n=this.options.startingDelay,t=this.options.timeMultiple,r=this.numOfDelayedAttempts,i=n*Math.pow(t,r);return Math.min(i,this.options.maxDelay)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"numOfDelayedAttempts",{get:function(){return this.attempt},enumerable:!0,configurable:!0}),e}();Ye.Delay=wr;var Ir=U&&U.__extends||function(){var e=function(n,t){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var o in i)i.hasOwnProperty(o)&&(r[o]=i[o])},e(n,t)};return function(n,t){e(n,t);function r(){this.constructor=n}n.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}(),Tr=U&&U.__awaiter||function(e,n,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(p){try{u(r.next(p))}catch(l){s(l)}}function d(p){try{u(r.throw(p))}catch(l){s(l)}}function u(p){p.done?o(p.value):i(p.value).then(a,d)}u((r=r.apply(e,n||[])).next())})},kr=U&&U.__generator||function(e,n){var t={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(u){return function(p){return d([u,p])}}function d(u){if(r)throw new TypeError("Generator is already executing.");for(;t;)try{if(r=1,i&&(o=u[0]&2?i.return:u[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,u[1])).done)return o;switch(i=0,o&&(u=[u[0]&2,o.value]),u[0]){case 0:case 1:o=u;break;case 4:return t.label++,{value:u[1],done:!1};case 5:t.label++,i=u[1],u=[0];continue;case 7:u=t.ops.pop(),t.trys.pop();continue;default:if(o=t.trys,!(o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){t=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]<o[3])){t.label=u[1];break}if(u[0]===6&&t.label<o[1]){t.label=o[1],o=u;break}if(o&&t.label<o[2]){t.label=o[2],t.ops.push(u);break}o[2]&&t.ops.pop(),t.trys.pop();continue}u=n.call(e,t)}catch(p){u=[6,p],i=0}finally{r=o=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}};Object.defineProperty(ht,"__esModule",{value:!0});var Nr=Ye,Ar=function(e){Ir(n,e);function n(){return e!==null&&e.apply(this,arguments)||this}return n.prototype.apply=function(){return Tr(this,void 0,void 0,function(){return kr(this,function(t){return[2,this.isFirstAttempt?!0:e.prototype.apply.call(this)]})})},Object.defineProperty(n.prototype,"isFirstAttempt",{get:function(){return this.attempt===0},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"numOfDelayedAttempts",{get:function(){return this.attempt-1},enumerable:!0,configurable:!0}),n}(Nr.Delay);ht.SkipFirstDelay=Ar;var gt={},Cr=U&&U.__extends||function(){var e=function(n,t){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var o in i)i.hasOwnProperty(o)&&(r[o]=i[o])},e(n,t)};return function(n,t){e(n,t);function r(){this.constructor=n}n.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(gt,"__esModule",{value:!0});var Or=Ye,Sr=function(e){Cr(n,e);function n(){return e!==null&&e.apply(this,arguments)||this}return n}(Or.Delay);gt.AlwaysDelay=Sr,Object.defineProperty(Ee,"__esModule",{value:!0});var xr=ht,Pr=gt;function _r(e,n){var t=Dr(e);return t.setAttemptNumber(n),t}Ee.DelayFactory=_r;function Dr(e){return e.delayFirstAttempt?new Pr.AlwaysDelay(e):new xr.SkipFirstDelay(e)}var Et=U&&U.__awaiter||function(e,n,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(p){try{u(r.next(p))}catch(l){s(l)}}function d(p){try{u(r.throw(p))}catch(l){s(l)}}function u(p){p.done?o(p.value):i(p.value).then(a,d)}u((r=r.apply(e,n||[])).next())})},bt=U&&U.__generator||function(e,n){var t={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(u){return function(p){return d([u,p])}}function d(u){if(r)throw new TypeError("Generator is already executing.");for(;t;)try{if(r=1,i&&(o=u[0]&2?i.return:u[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,u[1])).done)return o;switch(i=0,o&&(u=[u[0]&2,o.value]),u[0]){case 0:case 1:o=u;break;case 4:return t.label++,{value:u[1],done:!1};case 5:t.label++,i=u[1],u=[0];continue;case 7:u=t.ops.pop(),t.trys.pop();continue;default:if(o=t.trys,!(o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){t=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]<o[3])){t.label=u[1];break}if(u[0]===6&&t.label<o[1]){t.label=o[1],o=u;break}if(o&&t.label<o[2]){t.label=o[2],t.ops.push(u);break}o[2]&&t.ops.pop(),t.trys.pop();continue}u=n.call(e,t)}catch(p){u=[6,p],i=0}finally{r=o=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}};Object.defineProperty(Pe,"__esModule",{value:!0});var Rr=_e,Lr=Ee;function Fr(e,n){return n===void 0&&(n={}),Et(this,void 0,void 0,function(){var t,r;return bt(this,function(i){switch(i.label){case 0:return t=Rr.getSanitizedOptions(n),r=new Mr(e,t),[4,r.execute()];case 1:return[2,i.sent()]}})})}var qr=Pe.backOff=Fr,Mr=function(){function e(n,t){this.request=n,this.options=t,this.attemptNumber=0}return e.prototype.execute=function(){return Et(this,void 0,void 0,function(){var n,t;return bt(this,function(r){switch(r.label){case 0:if(this.attemptLimitReached)return[3,7];r.label=1;case 1:return r.trys.push([1,4,,6]),[4,this.applyDelay()];case 2:return r.sent(),[4,this.request()];case 3:return[2,r.sent()];case 4:return n=r.sent(),this.attemptNumber++,[4,this.options.retry(n,this.attemptNumber)];case 5:if(t=r.sent(),!t||this.attemptLimitReached)throw n;return[3,6];case 6:return[3,0];case 7:throw new Error("Something went wrong.")}})})},Object.defineProperty(e.prototype,"attemptLimitReached",{get:function(){return this.attemptNumber>=this.options.numOfAttempts},enumerable:!0,configurable:!0}),e.prototype.applyDelay=function(){return Et(this,void 0,void 0,function(){var n;return bt(this,function(t){switch(t.label){case 0:return n=Lr.DelayFactory(this.options,this.attemptNumber),[4,n.apply()];case 1:return t.sent(),[2]}})})},e}(),wt={exports:{}};(function(e,n){var t=typeof self!="undefined"?self:U,r=function(){function o(){this.fetch=!1,this.DOMException=t.DOMException}return o.prototype=t,new o}();(function(o){(function(s){var a={searchParams:"URLSearchParams"in o,iterable:"Symbol"in o&&"iterator"in Symbol,blob:"FileReader"in o&&"Blob"in o&&function(){try{return new Blob,!0}catch(f){return!1}}(),formData:"FormData"in o,arrayBuffer:"ArrayBuffer"in o};function d(f){return f&&DataView.prototype.isPrototypeOf(f)}if(a.arrayBuffer)var u=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],p=ArrayBuffer.isView||function(f){return f&&u.indexOf(Object.prototype.toString.call(f))>-1};function l(f){if(typeof f!="string"&&(f=String(f)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(f))throw new TypeError("Invalid character in header field name");return f.toLowerCase()}function h(f){return typeof f!="string"&&(f=String(f)),f}function y(f){var g={next:function(){var N=f.shift();return{done:N===void 0,value:N}}};return a.iterable&&(g[Symbol.iterator]=function(){return g}),g}function v(f){this.map={},f instanceof v?f.forEach(function(g,N){this.append(N,g)},this):Array.isArray(f)?f.forEach(function(g){this.append(g[0],g[1])},this):f&&Object.getOwnPropertyNames(f).forEach(function(g){this.append(g,f[g])},this)}v.prototype.append=function(f,g){f=l(f),g=h(g);var N=this.map[f];this.map[f]=N?N+", "+g:g},v.prototype.delete=function(f){delete this.map[l(f)]},v.prototype.get=function(f){return f=l(f),this.has(f)?this.map[f]:null},v.prototype.has=function(f){return this.map.hasOwnProperty(l(f))},v.prototype.set=function(f,g){this.map[l(f)]=h(g)},v.prototype.forEach=function(f,g){for(var N in this.map)this.map.hasOwnProperty(N)&&f.call(g,this.map[N],N,this)},v.prototype.keys=function(){var f=[];return this.forEach(function(g,N){f.push(N)}),y(f)},v.prototype.values=function(){var f=[];return this.forEach(function(g){f.push(g)}),y(f)},v.prototype.entries=function(){var f=[];return this.forEach(function(g,N){f.push([N,g])}),y(f)},a.iterable&&(v.prototype[Symbol.iterator]=v.prototype.entries);function w(f){if(f.bodyUsed)return Promise.reject(new TypeError("Already read"));f.bodyUsed=!0}function m(f){return new Promise(function(g,N){f.onload=function(){g(f.result)},f.onerror=function(){N(f.error)}})}function c(f){var g=new FileReader,N=m(g);return g.readAsArrayBuffer(f),N}function b(f){var g=new FileReader,N=m(g);return g.readAsText(f),N}function A(f){for(var g=new Uint8Array(f),N=new Array(g.length),x=0;x<g.length;x++)N[x]=String.fromCharCode(g[x]);return N.join("")}function k(f){if(f.slice)return f.slice(0);var g=new Uint8Array(f.byteLength);return g.set(new Uint8Array(f)),g.buffer}function q(){return this.bodyUsed=!1,this._initBody=function(f){this._bodyInit=f,f?typeof f=="string"?this._bodyText=f:a.blob&&Blob.prototype.isPrototypeOf(f)?this._bodyBlob=f:a.formData&&FormData.prototype.isPrototypeOf(f)?this._bodyFormData=f:a.searchParams&&URLSearchParams.prototype.isPrototypeOf(f)?this._bodyText=f.toString():a.arrayBuffer&&a.blob&&d(f)?(this._bodyArrayBuffer=k(f.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):a.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(f)||p(f))?this._bodyArrayBuffer=k(f):this._bodyText=f=Object.prototype.toString.call(f):this._bodyText="",this.headers.get("content-type")||(typeof f=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):a.searchParams&&URLSearchParams.prototype.isPrototypeOf(f)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},a.blob&&(this.blob=function(){var f=w(this);if(f)return f;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?w(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(c)}),this.text=function(){var f=w(this);if(f)return f;if(this._bodyBlob)return b(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(A(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},a.formData&&(this.formData=function(){return this.text().then(B)}),this.json=function(){return this.text().then(JSON.parse)},this}var M=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function L(f){var g=f.toUpperCase();return M.indexOf(g)>-1?g:f}function $(f,g){g=g||{};var N=g.body;if(f instanceof $){if(f.bodyUsed)throw new TypeError("Already read");this.url=f.url,this.credentials=f.credentials,g.headers||(this.headers=new v(f.headers)),this.method=f.method,this.mode=f.mode,this.signal=f.signal,!N&&f._bodyInit!=null&&(N=f._bodyInit,f.bodyUsed=!0)}else this.url=String(f);if(this.credentials=g.credentials||this.credentials||"same-origin",(g.headers||!this.headers)&&(this.headers=new v(g.headers)),this.method=L(g.method||this.method||"GET"),this.mode=g.mode||this.mode||null,this.signal=g.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&N)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(N)}$.prototype.clone=function(){return new $(this,{body:this._bodyInit})};function B(f){var g=new FormData;return f.trim().split("&").forEach(function(N){if(N){var x=N.split("="),O=x.shift().replace(/\+/g," "),C=x.join("=").replace(/\+/g," ");g.append(decodeURIComponent(O),decodeURIComponent(C))}}),g}function I(f){var g=new v,N=f.replace(/\r?\n[\t ]+/g," ");return N.split(/\r?\n/).forEach(function(x){var O=x.split(":"),C=O.shift().trim();if(C){var j=O.join(":").trim();g.append(C,j)}}),g}q.call($.prototype);function E(f,g){g||(g={}),this.type="default",this.status=g.status===void 0?200:g.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in g?g.statusText:"OK",this.headers=new v(g.headers),this.url=g.url||"",this._initBody(f)}q.call(E.prototype),E.prototype.clone=function(){return new E(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new v(this.headers),url:this.url})},E.error=function(){var f=new E(null,{status:0,statusText:""});return f.type="error",f};var S=[301,302,303,307,308];E.redirect=function(f,g){if(S.indexOf(g)===-1)throw new RangeError("Invalid status code");return new E(null,{status:g,headers:{location:f}})},s.DOMException=o.DOMException;try{new s.DOMException}catch(f){s.DOMException=function(g,N){this.message=g,this.name=N;var x=Error(g);this.stack=x.stack},s.DOMException.prototype=Object.create(Error.prototype),s.DOMException.prototype.constructor=s.DOMException}function D(f,g){return new Promise(function(N,x){var O=new $(f,g);if(O.signal&&O.signal.aborted)return x(new s.DOMException("Aborted","AbortError"));var C=new XMLHttpRequest;function j(){C.abort()}C.onload=function(){var F={status:C.status,statusText:C.statusText,headers:I(C.getAllResponseHeaders()||"")};F.url="responseURL"in C?C.responseURL:F.headers.get("X-Request-URL");var ie="response"in C?C.response:C.responseText;N(new E(ie,F))},C.onerror=function(){x(new TypeError("Network request failed"))},C.ontimeout=function(){x(new TypeError("Network request failed"))},C.onabort=function(){x(new s.DOMException("Aborted","AbortError"))},C.open(O.method,O.url,!0),O.credentials==="include"?C.withCredentials=!0:O.credentials==="omit"&&(C.withCredentials=!1),"responseType"in C&&a.blob&&(C.responseType="blob"),O.headers.forEach(function(F,ie){C.setRequestHeader(ie,F)}),O.signal&&(O.signal.addEventListener("abort",j),C.onreadystatechange=function(){C.readyState===4&&O.signal.removeEventListener("abort",j)}),C.send(typeof O._bodyInit=="undefined"?null:O._bodyInit)})}return D.polyfill=!0,o.fetch||(o.fetch=D,o.Headers=v,o.Request=$,o.Response=E),s.Headers=v,s.Request=$,s.Response=E,s.fetch=D,Object.defineProperty(s,"__esModule",{value:!0}),s})({})})(r),r.fetch.ponyfill=!0,delete r.fetch.polyfill;var i=r;n=i.fetch,n.default=i.fetch,n.fetch=i.fetch,n.Headers=i.Headers,n.Request=i.Request,n.Response=i.Response,e.exports=n})(wt,wt.exports);var Ht=se(wt.exports);function Je(e,n){if(!Boolean(e))throw new Error(n)}const $r=10,Yt=2;function Jt(e){return ze(e,[])}function ze(e,n){switch(typeof e){case"string":return JSON.stringify(e);case"function":return e.name?`[function ${e.name}]`:"[function]";case"object":return jr(e,n);default:return String(e)}}function jr(e,n){if(e===null)return"null";if(n.includes(e))return"[Circular]";const t=[...n,e];if(Ur(e)){const r=e.toJSON();if(r!==e)return typeof r=="string"?r:ze(r,t)}else if(Array.isArray(e))return Vr(e,t);return Br(e,t)}function Ur(e){return typeof e.toJSON=="function"}function Br(e,n){const t=Object.entries(e);if(t.length===0)return"{}";if(n.length>Yt)return"["+Gr(e)+"]";const r=t.map(([i,o])=>i+": "+ze(o,n));return"{ "+r.join(", ")+" }"}function Vr(e,n){if(e.length===0)return"[]";if(n.length>Yt)return"[Array]";const t=Math.min($r,e.length),r=e.length-t,i=[];for(let o=0;o<t;++o)i.push(ze(e[o],n));return r===1?i.push("... 1 more item"):r>1&&i.push(`... ${r} more items`),"["+i.join(", ")+"]"}function Gr(e){const n=Object.prototype.toString.call(e).replace(/^\[object /,"").replace(/]$/,"");if(n==="Object"&&typeof e.constructor=="function"){const t=e.constructor.name;if(typeof t=="string"&&t!=="")return t}return n}class Qr{constructor(n,t,r){this.start=n.start,this.end=t.end,this.startToken=n,this.endToken=t,this.source=r}get[Symbol.toStringTag](){return"Location"}toJSON(){return{start:this.start,end:this.end}}}class zt{constructor(n,t,r,i,o,s){this.kind=n,this.start=t,this.end=r,this.line=i,this.column=o,this.value=s,this.prev=null,this.next=null}get[Symbol.toStringTag](){return"Token"}toJSON(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}}}const Wt={Name:[],Document:["definitions"],OperationDefinition:["name","variableDefinitions","directives","selectionSet"],VariableDefinition:["variable","type","defaultValue","directives"],Variable:["name"],SelectionSet:["selections"],Field:["alias","name","arguments","directives","selectionSet"],Argument:["name","value"],FragmentSpread:["name","directives"],InlineFragment:["typeCondition","directives","selectionSet"],FragmentDefinition:["name","variableDefinitions","typeCondition","directives","selectionSet"],IntValue:[],FloatValue:[],StringValue:[],BooleanValue:[],NullValue:[],EnumValue:[],ListValue:["values"],ObjectValue:["fields"],ObjectField:["name","value"],Directive:["name","arguments"],NamedType:["name"],ListType:["type"],NonNullType:["type"],SchemaDefinition:["description","directives","operationTypes"],OperationTypeDefinition:["type"],ScalarTypeDefinition:["description","name","directives"],ObjectTypeDefinition:["description","name","interfaces","directives","fields"],FieldDefinition:["description","name","arguments","type","directives"],InputValueDefinition:["description","name","type","defaultValue","directives"],InterfaceTypeDefinition:["description","name","interfaces","directives","fields"],UnionTypeDefinition:["description","name","directives","types"],EnumTypeDefinition:["description","name","directives","values"],EnumValueDefinition:["description","name","directives"],InputObjectTypeDefinition:["description","name","directives","fields"],DirectiveDefinition:["description","name","arguments","locations"],SchemaExtension:["directives","operationTypes"],ScalarTypeExtension:["name","directives"],ObjectTypeExtension:["name","interfaces","directives","fields"],InterfaceTypeExtension:["name","interfaces","directives","fields"],UnionTypeExtension:["name","directives","types"],EnumTypeExtension:["name","directives","values"],InputObjectTypeExtension:["name","directives","fields"]},Hr=new Set(Object.keys(Wt));function Xt(e){const n=e==null?void 0:e.kind;return typeof n=="string"&&Hr.has(n)}var ke;(function(e){e.QUERY="query",e.MUTATION="mutation",e.SUBSCRIPTION="subscription"})(ke||(ke={}));var R;(function(e){e.NAME="Name",e.DOCUMENT="Document",e.OPERATION_DEFINITION="OperationDefinition",e.VARIABLE_DEFINITION="VariableDefinition",e.SELECTION_SET="SelectionSet",e.FIELD="Field",e.ARGUMENT="Argument",e.FRAGMENT_SPREAD="FragmentSpread",e.INLINE_FRAGMENT="InlineFragment",e.FRAGMENT_DEFINITION="FragmentDefinition",e.VARIABLE="Variable",e.INT="IntValue",e.FLOAT="FloatValue",e.STRING="StringValue",e.BOOLEAN="BooleanValue",e.NULL="NullValue",e.ENUM="EnumValue",e.LIST="ListValue",e.OBJECT="ObjectValue",e.OBJECT_FIELD="ObjectField",e.DIRECTIVE="Directive",e.NAMED_TYPE="NamedType",e.LIST_TYPE="ListType",e.NON_NULL_TYPE="NonNullType",e.SCHEMA_DEFINITION="SchemaDefinition",e.OPERATION_TYPE_DEFINITION="OperationTypeDefinition",e.SCALAR_TYPE_DEFINITION="ScalarTypeDefinition",e.OBJECT_TYPE_DEFINITION="ObjectTypeDefinition",e.FIELD_DEFINITION="FieldDefinition",e.INPUT_VALUE_DEFINITION="InputValueDefinition",e.INTERFACE_TYPE_DEFINITION="InterfaceTypeDefinition",e.UNION_TYPE_DEFINITION="UnionTypeDefinition",e.ENUM_TYPE_DEFINITION="EnumTypeDefinition",e.ENUM_VALUE_DEFINITION="EnumValueDefinition",e.INPUT_OBJECT_TYPE_DEFINITION="InputObjectTypeDefinition",e.DIRECTIVE_DEFINITION="DirectiveDefinition",e.SCHEMA_EXTENSION="SchemaExtension",e.SCALAR_TYPE_EXTENSION="ScalarTypeExtension",e.OBJECT_TYPE_EXTENSION="ObjectTypeExtension",e.INTERFACE_TYPE_EXTENSION="InterfaceTypeExtension",e.UNION_TYPE_EXTENSION="UnionTypeExtension",e.ENUM_TYPE_EXTENSION="EnumTypeExtension",e.INPUT_OBJECT_TYPE_EXTENSION="InputObjectTypeExtension"})(R||(R={}));const Yr=Object.freeze({});function Kt(e,n,t=Wt){const r=new Map;for(const c of Object.values(R))r.set(c,Jr(n,c));let i,o=Array.isArray(e),s=[e],a=-1,d=[],u=e,p,l;const h=[],y=[];do{a++;const c=a===s.length,b=c&&d.length!==0;if(c){if(p=y.length===0?void 0:h[h.length-1],u=l,l=y.pop(),b)if(o){u=u.slice();let k=0;for(const[q,M]of d){const L=q-k;M===null?(u.splice(L,1),k++):u[L]=M}}else{u=Object.defineProperties({},Object.getOwnPropertyDescriptors(u));for(const[k,q]of d)u[k]=q}a=i.index,s=i.keys,d=i.edits,o=i.inArray,i=i.prev}else if(l){if(p=o?a:s[a],u=l[p],u==null)continue;h.push(p)}let A;if(!Array.isArray(u)){var v,w;Xt(u)||Je(!1,`Invalid AST Node: ${Jt(u)}.`);const k=c?(v=r.get(u.kind))===null||v===void 0?void 0:v.leave:(w=r.get(u.kind))===null||w===void 0?void 0:w.enter;if(A=k==null?void 0:k.call(n,u,p,l,h,y),A===Yr)break;if(A===!1){if(!c){h.pop();continue}}else if(A!==void 0&&(d.push([p,A]),!c))if(Xt(A))u=A;else{h.pop();continue}}if(A===void 0&&b&&d.push([p,u]),c)h.pop();else{var m;i={inArray:o,index:a,keys:s,edits:d,prev:i},o=Array.isArray(u),s=o?u:(m=t[u.kind])!==null&&m!==void 0?m:[],a=-1,d=[],l&&y.push(l),l=u}}while(i!==void 0);return d.length!==0?d[d.length-1][1]:e}function Jr(e,n){const t=e[n];return typeof t=="object"?t:typeof t=="function"?{enter:t,leave:void 0}:{enter:e.enter,leave:e.leave}}function It(e){return e===9||e===32}function Re(e){return e>=48&&e<=57}function Zt(e){return e>=97&&e<=122||e>=65&&e<=90}function en(e){return Zt(e)||e===95}function zr(e){return Zt(e)||Re(e)||e===95}function Wr(e){var n;let t=Number.MAX_SAFE_INTEGER,r=null,i=-1;for(let s=0;s<e.length;++s){var o;const a=e[s],d=Xr(a);d!==a.length&&(r=(o=r)!==null&&o!==void 0?o:s,i=s,s!==0&&d<t&&(t=d))}return e.map((s,a)=>a===0?s:s.slice(t)).slice((n=r)!==null&&n!==void 0?n:0,i+1)}function Xr(e){let n=0;for(;n<e.length&&It(e.charCodeAt(n));)++n;return n}function Kr(e,n){const t=e.replace(/"""/g,'\\"""'),r=t.split(/\r\n|[\n\r]/g),i=r.length===1,o=r.length>1&&r.slice(1).every(y=>y.length===0||It(y.charCodeAt(0))),s=t.endsWith('\\"""'),a=e.endsWith('"')&&!s,d=e.endsWith("\\"),u=a||d,p=!(n!=null&&n.minimize)&&(!i||e.length>70||u||o||s);let l="";const h=i&&It(e.charCodeAt(0));return(p&&!h||o)&&(l+=` `),l+=t,(p||u)&&(l+=` `),'"""'+l+'"""'}function Zr(e){return`"${e.replace(ei,ti)}"`}const ei=/[\x00-\x1f\x22\x5c\x7f-\x9f]/g;function ti(e){return ni[e.charCodeAt(0)]}const ni=["\\u0000","\\u0001","\\u0002","\\u0003","\\u0004","\\u0005","\\u0006","\\u0007","\\b","\\t","\\n","\\u000B","\\f","\\r","\\u000E","\\u000F","\\u0010","\\u0011","\\u0012","\\u0013","\\u0014","\\u0015","\\u0016","\\u0017","\\u0018","\\u0019","\\u001A","\\u001B","\\u001C","\\u001D","\\u001E","\\u001F","","",'\\"',"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","\\\\","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","\\u007F","\\u0080","\\u0081","\\u0082","\\u0083","\\u0084","\\u0085","\\u0086","\\u0087","\\u0088","\\u0089","\\u008A","\\u008B","\\u008C","\\u008D","\\u008E","\\u008F","\\u0090","\\u0091","\\u0092","\\u0093","\\u0094","\\u0095","\\u0096","\\u0097","\\u0098","\\u0099","\\u009A","\\u009B","\\u009C","\\u009D","\\u009E","\\u009F"];function Tt(e){return Kt(e,ii)}const ri=80,ii={Name:{leave:e=>e.value},Variable:{leave:e=>"$"+e.name},Document:{leave:e=>_(e.definitions,` `)},OperationDefinition:{leave(e){const n=V("(",_(e.variableDefinitions,", "),")"),t=_([e.operation,_([e.name,n]),_(e.directives," ")]," ");return(t==="query"?"":t+" ")+e.selectionSet}},VariableDefinition:{leave:({variable:e,type:n,defaultValue:t,directives:r})=>e+": "+n+V(" = ",t)+V(" ",_(r," "))},SelectionSet:{leave:({selections:e})=>de(e)},Field:{leave({alias:e,name:n,arguments:t,directives:r,selectionSet:i}){const o=V("",e,": ")+n;let s=o+V("(",_(t,", "),")");return s.length>ri&&(s=o+V(`( `,We(_(t,` `)),` )`)),_([s,_(r," "),i]," ")}},Argument:{leave:({name:e,value:n})=>e+": "+n},FragmentSpread:{leave:({name:e,directives:n})=>"..."+e+V(" ",_(n," "))},InlineFragment:{leave:({typeCondition:e,directives:n,selectionSet:t})=>_(["...",V("on ",e),_(n," "),t]," ")},FragmentDefinition:{leave:({name:e,typeCondition:n,variableDefinitions:t,directives:r,selectionSet:i})=>`fragment ${e}${V("(",_(t,", "),")")} on ${n} ${V("",_(r," ")," ")}`+i},IntValue:{leave:({value:e})=>e},FloatValue:{leave:({value:e})=>e},StringValue:{leave:({value:e,block:n})=>n?Kr(e):Zr(e)},BooleanValue:{leave:({value:e})=>e?"true":"false"},NullValue:{leave:()=>"null"},EnumValue:{leave:({value:e})=>e},ListValue:{leave:({values:e})=>"["+_(e,", ")+"]"},ObjectValue:{leave:({fields:e})=>"{"+_(e,", ")+"}"},ObjectField:{leave:({name:e,value:n})=>e+": "+n},Directive:{leave:({name:e,arguments:n})=>"@"+e+V("(",_(n,", "),")")},NamedType:{leave:({name:e})=>e},ListType:{leave:({type:e})=>"["+e+"]"},NonNullType:{leave:({type:e})=>e+"!"},SchemaDefinition:{leave:({description:e,directives:n,operationTypes:t})=>V("",e,` `)+_(["schema",_(n," "),de(t)]," ")},OperationTypeDefinition:{leave:({operation:e,type:n})=>e+": "+n},ScalarTypeDefinition:{leave:({description:e,name:n,directives:t})=>V("",e,` `)+_(["scalar",n,_(t," ")]," ")},ObjectTypeDefinition:{leave:({description:e,name:n,interfaces:t,directives:r,fields:i})=>V("",e,` `)+_(["type",n,V("implements ",_(t," & ")),_(r," "),de(i)]," ")},FieldDefinition:{leave:({description:e,name:n,arguments:t,type:r,directives:i})=>V("",e,` `)+n+(tn(t)?V(`( `,We(_(t,` `)),` )`):V("(",_(t,", "),")"))+": "+r+V(" ",_(i," "))},InputValueDefinition:{leave:({description:e,name:n,type:t,defaultValue:r,directives:i})=>V("",e,` `)+_([n+": "+t,V("= ",r),_(i," ")]," ")},InterfaceTypeDefinition:{leave:({description:e,name:n,interfaces:t,directives:r,fields:i})=>V("",e,` `)+_(["interface",n,V("implements ",_(t," & ")),_(r," "),de(i)]," ")},UnionTypeDefinition:{leave:({description:e,name:n,directives:t,types:r})=>V("",e,` `)+_(["union",n,_(t," "),V("= ",_(r," | "))]," ")},EnumTypeDefinition:{leave:({description:e,name:n,directives:t,values:r})=>V("",e,` `)+_(["enum",n,_(t," "),de(r)]," ")},EnumValueDefinition:{leave:({description:e,name:n,directives:t})=>V("",e,` `)+_([n,_(t," ")]," ")},InputObjectTypeDefinition:{leave:({description:e,name:n,directives:t,fields:r})=>V("",e,` `)+_(["input",n,_(t," "),de(r)]," ")},DirectiveDefinition:{leave:({description:e,name:n,arguments:t,repeatable:r,locations:i})=>V("",e,` `)+"directive @"+n+(tn(t)?V(`( `,We(_(t,` `)),` )`):V("(",_(t,", "),")"))+(r?" repeatable":"")+" on "+_(i," | ")},SchemaExtension:{leave:({directives:e,operationTypes:n})=>_(["extend schema",_(e," "),de(n)]," ")},ScalarTypeExtension:{leave:({name:e,directives:n})=>_(["extend scalar",e,_(n," ")]," ")},ObjectTypeExtension:{leave:({name:e,interfaces:n,directives:t,fields:r})=>_(["extend type",e,V("implements ",_(n," & ")),_(t," "),de(r)]," ")},InterfaceTypeExtension:{leave:({name:e,interfaces:n,directives:t,fields:r})=>_(["extend interface",e,V("implements ",_(n," & ")),_(t," "),de(r)]," ")},UnionTypeExtension:{leave:({name:e,directives:n,types:t})=>_(["extend union",e,_(n," "),V("= ",_(t," | "))]," ")},EnumTypeExtension:{leave:({name:e,directives:n,values:t})=>_(["extend enum",e,_(n," "),de(t)]," ")},InputObjectTypeExtension:{leave:({name:e,directives:n,fields:t})=>_(["extend input",e,_(n," "),de(t)]," ")}};function _(e,n=""){var t;return(t=e==null?void 0:e.filter(r=>r).join(n))!==null&&t!==void 0?t:""}function de(e){return V(`{ `,We(_(e,` `)),` }`)}function V(e,n,t=""){return n!=null&&n!==""?e+n+t:""}function We(e){return V(" ",e.replace(/\n/g,` `))}function tn(e){var n;return(n=e==null?void 0:e.some(t=>t.includes(` `)))!==null&&n!==void 0?n:!1}function oi(e){return typeof e=="object"&&e!==null}function si(e,n){if(!Boolean(e))throw new Error(n!=null?n:"Unexpected invariant triggered.")}const ai=/\r\n|[\n\r]/g;function kt(e,n){let t=0,r=1;for(const i of e.body.matchAll(ai)){if(typeof i.index=="number"||si(!1),i.index>=n)break;t=i.index+i[0].length,r+=1}return{line:r,column:n+1-t}}function ui(e){return nn(e.source,kt(e.source,e.start))}function nn(e,n){const t=e.locationOffset.column-1,r="".padStart(t)+e.body,i=n.line-1,o=e.locationOffset.line-1,s=n.line+o,a=n.line===1?t:0,d=n.column+a,u=`${e.name}:${s}:${d} `,p=r.split(/\r\n|[\n\r]/g),l=p[i];if(l.length>120){const h=Math.floor(d/80),y=d%80,v=[];for(let w=0;w<l.length;w+=80)v.push(l.slice(w,w+80));return u+rn([[`${s} |`,v[0]],...v.slice(1,h+1).map(w=>["|",w]),["|","^".padStart(y)],["|",v[h+1]]])}return u+rn([[`${s-1} |`,p[i-1]],[`${s} |`,l],["|","^".padStart(d)],[`${s+1} |`,p[i+1]]])}function rn(e){const n=e.filter(([r,i])=>i!==void 0),t=Math.max(...n.map(([r])=>r.length));return n.map(([r,i])=>r.padStart(t)+(i?" "+i:"")).join(` `)}function ci(e){const n=e[0];return n==null||"kind"in n||"length"in n?{nodes:n,source:e[1],positions:e[2],path:e[3],originalError:e[4],extensions:e[5]}:n}class Le extends Error{constructor(n,...t){var r,i,o;const{nodes:s,source:a,positions:d,path:u,originalError:p,extensions:l}=ci(t);super(n),this.name="GraphQLError",this.path=u!=null?u:void 0,this.originalError=p!=null?p:void 0,this.nodes=on(Array.isArray(s)?s:s?[s]:void 0);const h=on((r=this.nodes)===null||r===void 0?void 0:r.map(v=>v.loc).filter(v=>v!=null));this.source=a!=null?a:h==null||(i=h[0])===null||i===void 0?void 0:i.source,this.positions=d!=null?d:h==null?void 0:h.map(v=>v.start),this.locations=d&&a?d.map(v=>kt(a,v)):h==null?void 0:h.map(v=>kt(v.source,v.start));const y=oi(p==null?void 0:p.extensions)?p==null?void 0:p.extensions:void 0;this.extensions=(o=l!=null?l:y)!==null&&o!==void 0?o: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!=null&&p.stack?Object.defineProperty(this,"stack",{value:p.stack,writable:!0,configurable:!0}):Error.captureStackTrace?Error.captureStackTrace(this,Le):Object.defineProperty(this,"stack",{value:Error().stack,writable:!0,configurable:!0})}get[Symbol.toStringTag](){return"GraphQLError"}toString(){let n=this.message;if(this.nodes)for(const t of this.nodes)t.loc&&(n+=` `+ui(t.loc));else if(this.source&&this.locations)for(const t of this.locations)n+=` `+nn(this.source,t);return n}toJSON(){const n={message:this.message};return this.locations!=null&&(n.locations=this.locations),this.path!=null&&(n.path=this.path),this.extensions!=null&&Object.keys(this.extensions).length>0&&(n.extensions=this.extensions),n}}function on(e){return e===void 0||e.length===0?void 0:e}function X(e,n,t){return new Le(`Syntax Error: ${t}`,{source:e,positions:[n]})}var Nt;(function(e){e.QUERY="QUERY",e.MUTATION="MUTATION",e.SUBSCRIPTION="SUBSCRIPTION",e.FIELD="FIELD",e.FRAGMENT_DEFINITION="FRAGMENT_DEFINITION",e.FRAGMENT_SPREAD="FRAGMENT_SPREAD",e.INLINE_FRAGMENT="INLINE_FRAGMENT",e.VARIABLE_DEFINITION="VARIABLE_DEFINITION",e.SCHEMA="SCHEMA",e.SCALAR="SCALAR",e.OBJECT="OBJECT",e.FIELD_DEFINITION="FIELD_DEFINITION",e.ARGUMENT_DEFINITION="ARGUMENT_DEFINITION",e.INTERFACE="INTERFACE",e.UNION="UNION",e.ENUM="ENUM",e.ENUM_VALUE="ENUM_VALUE",e.INPUT_OBJECT="INPUT_OBJECT",e.INPUT_FIELD_DEFINITION="INPUT_FIELD_DEFINITION"})(Nt||(Nt={}));var T;(function(e){e.SOF="<SOF>",e.EOF="<EOF>",e.BANG="!",e.DOLLAR="$",e.AMP="&",e.PAREN_L="(",e.PAREN_R=")",e.SPREAD="...",e.COLON=":",e.EQUALS="=",e.AT="@",e.BRACKET_L="[",e.BRACKET_R="]",e.BRACE_L="{",e.PIPE="|",e.BRACE_R="}",e.NAME="Name",e.INT="Int",e.FLOAT="Float",e.STRING="String",e.BLOCK_STRING="BlockString",e.COMMENT="Comment"})(T||(T={}));class li{constructor(n){const t=new zt(T.SOF,0,0,0,0);this.source=n,this.lastToken=t,this.token=t,this.line=1,this.lineStart=0}get[Symbol.toStringTag](){return"Lexer"}advance(){return this.lastToken=this.token,this.token=this.lookahead()}lookahead(){let n=this.token;if(n.kind!==T.EOF)do if(n.next)n=n.next;else{const t=fi(this,n.end);n.next=t,t.prev=n,n=t}while(n.kind===T.COMMENT);return n}}function di(e){return e===T.BANG||e===T.DOLLAR||e===T.AMP||e===T.PAREN_L||e===T.PAREN_R||e===T.SPREAD||e===T.COLON||e===T.EQUALS||e===T.AT||e===T.BRACKET_L||e===T.BRACKET_R||e===T.BRACE_L||e===T.PIPE||e===T.BRACE_R}function Ne(e){return e>=0&&e<=55295||e>=57344&&e<=1114111}function Xe(e,n){return sn(e.charCodeAt(n))&&an(e.charCodeAt(n+1))}function sn(e){return e>=55296&&e<=56319}function an(e){return e>=56320&&e<=57343}function be(e,n){const t=e.source.body.codePointAt(n);if(t===void 0)return T.EOF;if(t>=32&&t<=126){const r=String.fromCodePoint(t);return r==='"'?`'"'`:`"${r}"`}return"U+"+t.toString(16).toUpperCase().padStart(4,"0")}function z(e,n,t,r,i){const o=e.line,s=1+t-e.lineStart;return new zt(n,t,r,o,s,i)}function fi(e,n){const t=e.source.body,r=t.length;let i=n;for(;i<r;){const o=t.charCodeAt(i);switch(o){case 65279:case 9:case 32:case 44:++i;continue;case 10:++i,++e.line,e.lineStart=i;continue;case 13:t.charCodeAt(i+1)===10?i+=2:++i,++e.line,e.lineStart=i;continue;case 35:return pi(e,i);case 33:return z(e,T.BANG,i,i+1);case 36:return z(e,T.DOLLAR,i,i+1);case 38:return z(e,T.AMP,i,i+1);case 40:return z(e,T.PAREN_L,i,i+1);case 41:return z(e,T.PAREN_R,i,i+1);case 46:if(t.charCodeAt(i+1)===46&&t.charCodeAt(i+2)===46)return z(e,T.SPREAD,i,i+3);break;case 58:return z(e,T.COLON,i,i+1);case 61:return z(e,T.EQUALS,i,i+1);case 64:return z(e,T.AT,i,i+1);case 91:return z(e,T.BRACKET_L,i,i+1);case 93:return z(e,T.BRACKET_R,i,i+1);case 123:return z(e,T.BRACE_L,i,i+1);case 124:return z(e,T.PIPE,i,i+1);case 125:return z(e,T.BRACE_R,i,i+1);case 34:return t.charCodeAt(i+1)===34&&t.charCodeAt(i+2)===34?Ei(e,i):yi(e,i)}if(Re(o)||o===45)return hi(e,i,o);if(en(o))return bi(e,i);throw X(e.source,i,o===39?`Unexpected single quote character ('), did you mean to use a double quote (")?`:Ne(o)||Xe(t,i)?`Unexpected character: ${be(e,i)}.`:`Invalid character: ${be(e,i)}.`)}return z(e,T.EOF,r,r)}function pi(e,n){const t=e.source.body,r=t.length;let i=n+1;for(;i<r;){const o=t.charCodeAt(i);if(o===10||o===13)break;if(Ne(o))++i;else if(Xe(t,i))i+=2;else break}return z(e,T.COMMENT,n,i,t.slice(n+1,i))}function hi(e,n,t){const r=e.source.body;let i=n,o=t,s=!1;if(o===45&&(o=r.charCodeAt(++i)),o===48){if(o=r.charCodeAt(++i),Re(o))throw X(e.source,i,`Invalid number, unexpected digit after 0: ${be(e,i)}.`)}else i=At(e,i,o),o=r.charCodeAt(i);if(o===46&&(s=!0,o=r.charCodeAt(++i),i=At(e,i,o),o=r.charCodeAt(i)),(o===69||o===101)&&(s=!0,o=r.charCodeAt(++i),(o===43||o===45)&&(o=r.charCodeAt(++i)),i=At(e,i,o),o=r.charCodeAt(i)),o===46||en(o))throw X(e.source,i,`Invalid number, expected digit but got: ${be(e,i)}.`);return z(e,s?T.FLOAT:T.INT,n,i,r.slice(n,i))}function At(e,n,t){if(!Re(t))throw X(e.source,n,`Invalid number, expected digit but got: ${be(e,n)}.`);const r=e.source.body;let i=n+1;for(;Re(r.charCodeAt(i));)++i;return i}function yi(e,n){const t=e.source.body,r=t.length;let i=n+1,o=i,s="";for(;i<r;){const a=t.charCodeAt(i);if(a===34)return s+=t.slice(o,i),z(e,T.STRING,n,i+1,s);if(a===92){s+=t.slice(o,i);const d=t.charCodeAt(i+1)===117?t.charCodeAt(i+2)===123?vi(e,i):mi(e,i):gi(e,i);s+=d.value,i+=d.size,o=i;continue}if(a===10||a===13)break;if(Ne(a))++i;else if(Xe(t,i))i+=2;else throw X(e.source,i,`Invalid character within String: ${be(e,i)}.`)}throw X(e.source,i,"Unterminated string.")}function vi(e,n){const t=e.source.body;let r=0,i=3;for(;i<12;){const o=t.charCodeAt(n+i++);if(o===125){if(i<5||!Ne(r))break;return{value:String.fromCodePoint(r),size:i}}if(r=r<<4|Fe(o),r<0)break}throw X(e.source,n,`Invalid Unicode escape sequence: "${t.slice(n,n+i)}".`)}function mi(e,n){const t=e.source.body,r=un(t,n+2);if(Ne(r))return{value:String.fromCodePoint(r),size:6};if(sn(r)&&t.charCodeAt(n+6)===92&&t.charCodeAt(n+7)===117){const i=un(t,n+8);if(an(i))return{value:String.fromCodePoint(r,i),size:12}}throw X(e.source,n,`Invalid Unicode escape sequence: "${t.slice(n,n+6)}".`)}function un(e,n){return Fe(e.charCodeAt(n))<<12|Fe(e.charCodeAt(n+1))<<8|Fe(e.charCodeAt(n+2))<<4|Fe(e.charCodeAt(n+3))}function Fe(e){return e>=48&&e<=57?e-48:e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:-1}function gi(e,n){const t=e.source.body;switch(t.charCodeAt(n+1)){case 34:return{value:'"',size:2};case 92:return{value:"\\",size:2};case 47:return{value:"/",size:2};case 98:return{value:"\b",size:2};case 102:return{value:"\f",size:2};case 110:return{value:` `,size:2};case 114:return{value:"\r",size:2};case 116:return{value:" ",size:2}}throw X(e.source,n,`Invalid character escape sequence: "${t.slice(n,n+2)}".`)}function Ei(e,n){const t=e.source.body,r=t.length;let i=e.lineStart,o=n+3,s=o,a="";const d=[];for(;o<r;){const u=t.charCodeAt(o);if(u===34&&t.charCodeAt(o+1)===34&&t.charCodeAt(o+2)===34){a+=t.slice(s,o),d.push(a);const p=z(e,T.BLOCK_STRING,n,o+3,Wr(d).join(` `));return e.line+=d.length-1,e.lineStart=i,p}if(u===92&&t.charCodeAt(o+1)===34&&t.charCodeAt(o+2)===34&&t.charCodeAt(o+3)===34){a+=t.slice(s,o),s=o+1,o+=4;continue}if(u===10||u===13){a+=t.slice(s,o),d.push(a),u===13&&t.charCodeAt(o+1)===10?o+=2:++o,a="",s=o,i=o;continue}if(Ne(u))++o;else if(Xe(t,o))o+=2;else throw X(e.source,o,`Invalid character within String: ${be(e,o)}.`)}throw X(e.source,o,"Unterminated string.")}function bi(e,n){const t=e.source.body,r=t.length;let i=n+1;for(;i<r;){const o=t.charCodeAt(i);if(zr(o))++i;else break}return z(e,T.NAME,n,i,t.slice(n,i))}const wi=function(n,t){return n instanceof t};class cn{constructor(n,t="GraphQL request",r={line:1,column:1}){typeof n=="string"||Je(!1,`Body must be a string. Received: ${Jt(n)}.`),this.body=n,this.name=t,this.locationOffset=r,this.locationOffset.line>0||Je(!1,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||Je(!1,"column in locationOffset is 1-indexed and must be positive.")}get[Symbol.toStringTag](){return"Source"}}function Ii(e){return wi(e,cn)}function Ti(e,n){return new ki(e,n).parseDocument()}class ki{constructor(n,t={}){const r=Ii(n)?n:new cn(n);this._lexer=new li(r),this._options=t,this._tokenCounter=0}parseName(){const n=this.expectToken(T.NAME);return this.node(n,{kind:R.NAME,value:n.value})}parseDocument(){return this.node(this._lexer.token,{kind:R.DOCUMENT,definitions:this.many(T.SOF,this.parseDefinition,T.EOF)})}parseDefinition(){if(this.peek(T.BRACE_L))return this.parseOperationDefinition();const n=this.peekDescription(),t=n?this._lexer.lookahead():this._lexer.token;if(t.kind===T.NAME){switch(t.value){case"schema":return this.parseSchemaDefinition();case"scalar":return this.parseScalarTypeDefinition();case"type":return this.parseObjectTypeDefinition();case"interface":return this.parseInterfaceTypeDefinition();case"union":return this.parseUnionTypeDefinition();case"enum":return this.parseEnumTypeDefinition();case"input":return this.parseInputObjectTypeDefinition();case"directive":return this.parseDirectiveDefinition()}if(n)throw X(this._lexer.source,this._lexer.token.start,"Unexpected description, descriptions are supported only on type definitions.");switch(t.value){case"query":case"mutation":case"subscription":return this.parseOperationDefinition();case"fragment":return this.parseFragmentDefinition();case"extend":return this.parseTypeSystemExtension()}}throw this.unexpected(t)}parseOperationDefinition(){const n=this._lexer.token;if(this.peek(T.BRACE_L))return this.node(n,{kind:R.OPERATION_DEFINITION,operation:ke.QUERY,name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet()});const t=this.parseOperationType();let r;return this.peek(T.NAME)&&(r=this.parseName()),this.node(n,{kind:R.OPERATION_DEFINITION,operation:t,name:r,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseOperationType(){const n=this.expectToken(T.NAME);switch(n.value){case"query":return ke.QUERY;case"mutation":return ke.MUTATION;case"subscription":return ke.SUBSCRIPTION}throw this.unexpected(n)}parseVariableDefinitions(){return this.optionalMany(T.PAREN_L,this.parseVariableDefinition,T.PAREN_R)}parseVariableDefinition(){return this.node(this._lexer.token,{kind:R.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(T.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(T.EQUALS)?this.parseConstValueLiteral():void 0,directives:this.parseConstDirectives()})}parseVariable(){const n=this._lexer.token;return this.expectToken(T.DOLLAR),this.node(n,{kind:R.VARIABLE,name:this.parseName()})}parseSelectionSet(){return this.node(this._lexer.token,{kind:R.SELECTION_SET,selections:this.many(T.BRACE_L,this.parseSelection,T.BRACE_R)})}parseSelection(){return this.peek(T.SPREAD)?this.parseFragment():this.parseField()}parseField(){const n=this._lexer.token,t=this.parseName();let r,i;return this.expectOptionalToken(T.COLON)?(r=t,i=this.parseName()):i=t,this.node(n,{kind:R.FIELD,alias:r,name:i,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(T.BRACE_L)?this.parseSelectionSet():void 0})}parseArguments(n){const t=n?this.parseConstArgument:this.parseArgument;return this.optionalMany(T.PAREN_L,t,T.PAREN_R)}parseArgument(n=!1){const t=this._lexer.token,r=this.parseName();return this.expectToken(T.COLON),this.node(t,{kind:R.ARGUMENT,name:r,value:this.parseValueLiteral(n)})}parseConstArgument(){return this.parseArgument(!0)}parseFragment(){const n=this._lexer.token;this.expectToken(T.SPREAD);const t=this.expectOptionalKeyword("on");return!t&&this.peek(T.NAME)?this.node(n,{kind:R.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1)}):this.node(n,{kind:R.INLINE_FRAGMENT,typeCondition:t?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentDefinition(){const n=this._lexer.token;return this.expectKeyword("fragment"),this._options.allowLegacyFragmentVariables===!0?this.node(n,{kind:R.FRAGMENT_DEFINITION,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()}):this.node(n,{kind:R.FRAGMENT_DEFINITION,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(n){const t=this._lexer.token;switch(t.kind){case T.BRACKET_L:return this.parseList(n);case T.BRACE_L:return this.parseObject(n);case T.INT:return this.advanceLexer(),this.node(t,{kind:R.INT,value:t.value});case T.FLOAT:return this.advanceLexer(),this.node(t,{kind:R.FLOAT,value:t.value});case T.STRING:case T.BLOCK_STRING:return this.parseStringLiteral();case T.NAME:switch(this.advanceLexer(),t.value){case"true":return this.node(t,{kind:R.BOOLEAN,value:!0});case"false":return this.node(t,{kind:R.BOOLEAN,value:!1});case"null":return this.node(t,{kind:R.NULL});default:return this.node(t,{kind:R.ENUM,value:t.value})}case T.DOLLAR:if(n)if(this.expectToken(T.DOLLAR),this._lexer.token.kind===T.NAME){const r=this._lexer.token.value;throw X(this._lexer.source,t.start,`Unexpected variable "$${r}" in constant value.`)}else throw this.unexpected(t);return this.parseVariable();default:throw this.unexpected()}}parseConstValueLiteral(){return this.parseValueLiteral(!0)}parseStringLiteral(){const n=this._lexer.token;return this.advanceLexer(),this.node(n,{kind:R.STRING,value:n.value,block:n.kind===T.BLOCK_STRING})}parseList(n){const t=()=>this.parseValueLiteral(n);return this.node(this._lexer.token,{kind:R.LIST,values:this.any(T.BRACKET_L,t,T.BRACKET_R)})}parseObject(n){const t=()=>this.parseObjectField(n);return this.node(this._lexer.token,{kind:R.OBJECT,fields:this.any(T.BRACE_L,t,T.BRACE_R)})}parseObjectField(n){const t=this._lexer.token,r=this.parseName();return this.expectToken(T.COLON),this.node(t,{kind:R.OBJECT_FIELD,name:r,value:this.parseValueLiteral(n)})}parseDirectives(n){const t=[];for(;this.peek(T.AT);)t.push(this.parseDirective(n));return t}parseConstDirectives(){return this.parseDirectives(!0)}parseDirective(n){const t=this._lexer.token;return this.expectToken(T.AT),this.node(t,{kind:R.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(n)})}parseTypeReference(){const n=this._lexer.token;let t;if(this.expectOptionalToken(T.BRACKET_L)){const r=this.parseTypeReference();this.expectToken(T.BRACKET_R),t=this.node(n,{kind:R.LIST_TYPE,type:r})}else t=this.parseNamedType();return this.expectOptionalToken(T.BANG)?this.node(n,{kind:R.NON_NULL_TYPE,type:t}):t}parseNamedType(){return this.node(this._lexer.token,{kind:R.NAMED_TYPE,name:this.parseName()})}peekDescription(){return this.peek(T.STRING)||this.peek(T.BLOCK_STRING)}parseDescription(){if(this.peekDescription())return this.parseStringLiteral()}parseSchemaDefinition(){const n=this._lexer.token,t=this.parseDescription();this.expectKeyword("schema");const r=this.parseConstDirectives(),i=this.many(T.BRACE_L,this.parseOperationTypeDefinition,T.BRACE_R);return this.node(n,{kind:R.SCHEMA_DEFINITION,description:t,directives:r,operationTypes:i})}parseOperationTypeDefinition(){const n=this._lexer.token,t=this.parseOperationType();this.expectToken(T.COLON);const r=this.parseNamedType();return this.node(n,{kind:R.OPERATION_TYPE_DEFINITION,operation:t,type:r})}parseScalarTypeDefinition(){const n=this._lexer.token,t=this.parseDescription();this.expectKeyword("scalar");const r=this.parseName(),i=this.parseConstDirectives();return this.node(n,{kind:R.SCALAR_TYPE_DEFINITION,description:t,name:r,directives:i})}parseObjectTypeDefinition(){const n=this._lexer.token,t=this.parseDescription();this.expectKeyword("type");const r=this.parseName(),i=this.parseImplementsInterfaces(),o=this.parseConstDirectives(),s=this.parseFieldsDefinition();return this.node(n,{kind:R.OBJECT_TYPE_DEFINITION,description:t,name:r,interfaces:i,directives:o,fields:s})}parseImplementsInterfaces(){return this.expectOptionalKeyword("implements")?this.delimitedMany(T.AMP,this.parseNamedType):[]}parseFieldsDefinition(){return this.optionalMany(T.BRACE_L,this.parseFieldDefinition,T.BRACE_R)}parseFieldDefinition(){const n=this._lexer.token,t=this.parseDescription(),r=this.parseName(),i=this.parseArgumentDefs();this.expectToken(T.COLON);const o=this.parseTypeReference(),s=this.parseConstDirectives();return this.node(n,{kind:R.FIELD_DEFINITION,description:t,name:r,arguments:i,type:o,directives:s})}parseArgumentDefs(){return this.optionalMany(T.PAREN_L,this.parseInputValueDef,T.PAREN_R)}parseInputValueDef(){const n=this._lexer.token,t=this.parseDescription(),r=this.parseName();this.expectToken(T.COLON);const i=this.parseTypeReference();let o;this.expectOptionalToken(T.EQUALS)&&(o=this.parseConstValueLiteral());const s=this.parseConstDirectives();return this.node(n,{kind:R.INPUT_VALUE_DEFINITION,description:t,name:r,type:i,defaultValue:o,directives