altair-static
Version:
Static package for altair graphql client
15 lines (12 loc) • 23.3 kB
JavaScript
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="9acb8dc3-f893-5f7b-b160-260d2212b328")}catch(e){}}();
import{Ja as V,d as $}from"./chunk-K6UUAPPR.js";import{a as K,v as Z}from"./chunk-ZYOLZTH5.js";import{c as Q,q as H}from"./chunk-472WPQLO.js";import{c as J,f as it,h as ot,j as U,k as L,l as B}from"./chunk-B7YGBANW.js";var tt=it((q,M)=>{"use strict";(function(d){if(typeof q=="object"&&typeof M<"u")M.exports=d();else if(typeof define=="function"&&define.amd)define([],d);else{var n;typeof window<"u"?n=window:typeof global<"u"?n=global:typeof self<"u"?n=self:n=this,n.GraphQLQueryCompress=d()}})(function(){var d,n,o;return(function(){function _(l,c,u){function m(r,w){if(!c[r]){if(!l[r]){var O=typeof J=="function"&&J;if(!w&&O)return O(r,!0);if(v)return v(r,!0);var b=new Error("Cannot find module '"+r+"'");throw b.code="MODULE_NOT_FOUND",b}var h=c[r]={exports:{}};l[r][0].call(h.exports,function(s){var k=l[r][1][s];return m(k||s)},h,h.exports,_,l,c,u)}return c[r].exports}for(var v=typeof J=="function"&&J,x=0;x<u.length;x++)m(u[x]);return m}return _})()({1:[function(_,l,c){(function(u){(function(m){typeof c=="object"&&typeof l<"u"?l.exports=m():typeof d=="function"&&d.amd?d([],m):(typeof window<"u"?window:typeof u<"u"?u:typeof self<"u"?self:this).Tokenizr=m()})(function(){return(function(){return function m(v,x,r){function w(h,s){if(!x[h]){if(!v[h]){var k=typeof _=="function"&&_;if(!s&&k)return k(h,!0);if(O)return O(h,!0);var N=new Error("Cannot find module '"+h+"'");throw N.code="MODULE_NOT_FOUND",N}var A=x[h]={exports:{}};v[h][0].call(A.exports,function(z){return w(v[h][1][z]||z)},A,A.exports,m,v,x,r)}return x[h].exports}for(var O=typeof _=="function"&&_,b=0;b<r.length;b++)w(r[b]);return w}})()({1:[function(m,v,x){"use strict";function r(f){return(r=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(f)}function w(f,t){return!t||r(t)!=="object"&&typeof t!="function"?(function(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e})(f):t}function O(f){var t=typeof Map=="function"?new Map:void 0;return(O=function(e){if(e===null||!(function(g){return Function.toString.call(g).indexOf("[native code]")!==-1})(e))return e;if(typeof e!="function")throw new TypeError("Super expression must either be null or a function");if(t!==void 0){if(t.has(e))return t.get(e);t.set(e,i)}function i(){return(function(g,p,a){return((function(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}})()?Reflect.construct:function(y,T,j){var E=[null];E.push.apply(E,T);var D=new(Function.bind.apply(y,E));return j&&b(D,j.prototype),D}).apply(null,arguments)})(e,arguments,h(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),b(i,e)})(f)}function b(f,t){return(b=Object.setPrototypeOf||function(e,i){return e.__proto__=i,e})(f,t)}function h(f){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(f)}function s(f,t){if(!(f instanceof t))throw new TypeError("Cannot call a class as a function")}function k(f,t){for(var e=0;e<t.length;e++){var i=t[e];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(f,i.key,i)}}function N(f,t,e){return t&&k(f.prototype,t),e&&k(f,e),f}var A=function(f,t){var e=f.length,i=t-20;i<0&&(i=0);var g=t+20;g>e&&(g=e);var p=function(y){return y.charCodeAt(0).toString(16).toUpperCase()},a=function(y,T,j){return y.substr(T,j).replace(/\\/g,"\\\\").replace(/\x08/g,"\\b").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\f/g,"\\f").replace(/\r/g,"\\r").replace(/[\x00-\x07\x0B\x0E\x0F]/g,function(E){return"\\x0"+p(E)}).replace(/[\x10-\x1F\x80-\xFF]/g,function(E){return"\\x"+p(E)}).replace(/[\u0100-\u0FFF]/g,function(E){return"\\u0"+p(E)}).replace(/[\u1000-\uFFFF]/g,function(E){return"\\u"+p(E)})};return{prologTrunc:i>0,prologText:a(f,i,t-i),tokenText:a(f,t,1),epilogText:a(f,t+1,g-(t+1)),epilogTrunc:g<e}},z=(function(){function f(t,e,i){var g=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,p=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:0;s(this,f),this.type=t,this.value=e,this.text=i,this.pos=g,this.line=p,this.column=a}return N(f,[{key:"toString",value:function(){return"<type: ".concat(this.type,", ")+"value: ".concat(JSON.stringify(this.value),", ")+"text: ".concat(JSON.stringify(this.text),", ")+"pos: ".concat(this.pos,", ")+"line: ".concat(this.line,", ")+"column: ".concat(this.column,">")}},{key:"isA",value:function(t,e){return t===this.type&&(arguments.length!==2||e===this.value)}}]),f})(),P=(function(f){function t(e,i,g,p,a){var y;return s(this,t),(y=w(this,h(t).call(this,e))).name="ParsingError",y.message=e,y.pos=i,y.line=g,y.column=p,y.input=a,y}return(function(e,i){if(typeof i!="function"&&i!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(i&&i.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),i&&b(e,i)})(t,O(Error)),N(t,[{key:"toString",value:function(){for(var e=A(this.input,this.pos),i="line ".concat(this.line," (column ").concat(this.column,"): "),g="",p=0;p<i.length+e.prologText.length;p++)g+=" ";return"Parsing Error: "+this.message+`
`+i+e.prologText+e.tokenText+e.epilogText+`
`+g+"^"}}]),t})(),F=(function(){function f(t){s(this,f),this._tokenizr=t,this._data={},this._repeat=!1,this._reject=!1,this._ignore=!1,this._match=null}return N(f,[{key:"data",value:function(t,e){var i=this._data[t];return arguments.length===2&&(this._data[t]=e),i}},{key:"info",value:function(){return{line:this._tokenizr._line,column:this._tokenizr._column,pos:this._tokenizr._pos,len:this._match[0].length}}},{key:"push",value:function(){var t;return(t=this._tokenizr).push.apply(t,arguments),this}},{key:"pop",value:function(){var t;return(t=this._tokenizr).pop.apply(t,arguments)}},{key:"state",value:function(){var t,e;return arguments.length>0?((e=this._tokenizr).state.apply(e,arguments),this):(t=this._tokenizr).state.apply(t,arguments)}},{key:"tag",value:function(){var t;return(t=this._tokenizr).tag.apply(t,arguments),this}},{key:"tagged",value:function(){var t;return(t=this._tokenizr).tagged.apply(t,arguments)}},{key:"untag",value:function(){var t;return(t=this._tokenizr).untag.apply(t,arguments),this}},{key:"repeat",value:function(){return this._tokenizr._log(" REPEAT"),this._repeat=!0,this}},{key:"reject",value:function(){return this._tokenizr._log(" REJECT"),this._reject=!0,this}},{key:"ignore",value:function(){return this._tokenizr._log(" IGNORE"),this._ignore=!0,this}},{key:"accept",value:function(t,e){return arguments.length<2&&(e=this._match[0]),this._tokenizr._log(" ACCEPT: type: ".concat(t,", value: ")+"".concat(JSON.stringify(e)," (").concat(r(e),'), text: "').concat(this._match[0],'"')),this._tokenizr._pending.push(new z(t,e,this._match[0],this._tokenizr._pos,this._tokenizr._line,this._tokenizr._column)),this}},{key:"stop",value:function(){return this._tokenizr._stopped=!0,this}}]),f})(),C=(function(){function f(){s(this,f),this._before=null,this._after=null,this._finish=null,this._rules=[],this._debug=!1,this.reset()}return N(f,[{key:"reset",value:function(){return this._input="",this._len=0,this._eof=!1,this._pos=0,this._line=1,this._column=1,this._state=["default"],this._tag={},this._transaction=[],this._pending=[],this._stopped=!1,this._ctx=new F(this),this}},{key:"error",value:function(t){return new P(t,this._pos,this._line,this._column,this._input)}},{key:"debug",value:function(t){return this._debug=t,this}},{key:"_log",value:function(t){this._debug&&console.log("tokenizr: ".concat(t))}},{key:"input",value:function(t){if(typeof t!="string")throw new Error('parameter "input" not a String');return this.reset(),this._input=t,this._len=t.length,this}},{key:"push",value:function(t){if(arguments.length!==1)throw new Error("invalid number of arguments");if(typeof t!="string")throw new Error('parameter "state" not a String');return this._log(" STATE (PUSH): "+"old: <".concat(this._state[this._state.length-1],">, ")+"new: <".concat(t,">")),this._state.push(t),this}},{key:"pop",value:function(){if(arguments.length!==0)throw new Error("invalid number of arguments");if(this._state.length<2)throw new Error("no more custom states to pop");return this._log(" STATE (POP): "+"old: <".concat(this._state[this._state.length-1],">, ")+"new: <".concat(this._state[this._state.length-2],">")),this._state.pop()}},{key:"state",value:function(t){if(arguments.length===1){if(typeof t!="string")throw new Error('parameter "state" not a String');return this._log(" STATE (SET): "+"old: <".concat(this._state[this._state.length-1],">, ")+"new: <".concat(t,">")),this._state[this._state.length-1]=t,this}if(arguments.length===0)return this._state[this._state.length-1];throw new Error("invalid number of arguments")}},{key:"tag",value:function(t){if(arguments.length!==1)throw new Error("invalid number of arguments");if(typeof t!="string")throw new Error('parameter "tag" not a String');return this._log(" TAG (ADD): ".concat(t)),this._tag[t]=!0,this}},{key:"tagged",value:function(t){if(arguments.length!==1)throw new Error("invalid number of arguments");if(typeof t!="string")throw new Error('parameter "tag" not a String');return this._tag[t]===!0}},{key:"untag",value:function(t){if(arguments.length!==1)throw new Error("invalid number of arguments");if(typeof t!="string")throw new Error('parameter "tag" not a String');return this._log(" TAG (DEL): ".concat(t)),delete this._tag[t],this}},{key:"before",value:function(t){return this._before=t,this}},{key:"after",value:function(t){return this._after=t,this}},{key:"finish",value:function(t){return this._finish=t,this}},{key:"rule",value:function(t,e,i){var g=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"unknown";if(arguments.length===2&&typeof e=="function"){var p=[t,e];e=p[0],i=p[1],t="*"}else if(arguments.length===3&&typeof e=="function"){var a=[t,e,i];e=a[0],i=a[1],g=a[2],t="*"}if(typeof t!="string")throw new Error('parameter "state" not a String');if(!(r(e)==="object"&&e instanceof RegExp))throw new Error('parameter "pattern" not a RegExp');if(typeof i!="function")throw new Error('parameter "action" not a Function');if(typeof g!="string")throw new Error('parameter "name" not a String');t=t.split(/\s*,\s*/g).map(function(T){var j=T.split(/\s+/g),E=j.filter(function(S){return S.match(/^#/)===null}),D=j.filter(function(S){return S.match(/^#/)!==null}).map(function(S){return S.replace(/^#/,"")});if(E.length!==1)throw new Error("exactly one state required");return{state:E[0],tags:D}});var y="g";try{typeof new RegExp("","y").sticky=="boolean"&&(y="y")}catch{}return typeof e.multiline=="boolean"&&e.multiline&&(y+="m"),typeof e.dotAll=="boolean"&&e.dotAll&&(y+="s"),typeof e.ignoreCase=="boolean"&&e.ignoreCase&&(y+="i"),typeof e.unicode=="boolean"&&e.unicode&&(y+="u"),e=new RegExp(e.source,y),this._log("rule: configure rule (state: ".concat(t,", pattern: ").concat(e.source,")")),this._rules.push({state:t,pattern:e,action:i,name:g}),this}},{key:"_progress",value:function(t,e){for(var i=this._line,g=this._column,p=this._input,a=t;a<e;a++){var y=p.charAt(a);y==="\r"?this._column=1:y===`
`?(this._line++,this._column=1):y===" "?this._column+=8-this._column%8:this._column++}this._log(" PROGRESS: characters: ".concat(e-t,", ")+"from: <line ".concat(i,", column ").concat(g,">, ")+"to: <line ".concat(this._line,", column ").concat(this._column,">"))}},{key:"_tokenize",value:function(){var t=this,e=function(){t._eof||(t._finish!==null&&t._finish.call(t._ctx,t._ctx),t._eof=!0,t._pending.push(new z("EOF","","",t._pos,t._line,t._column)))};if(!(this._stopped||this._pos>=this._len)){for(var i=!0;i;){if(i=!1,this._debug){var g=A(this._input,this._pos),p=Object.keys(this._tag).map(function(R){return"#".concat(R)}).join(" ");this._log("INPUT: state: <".concat(this._state[this._state.length-1],">, tags: <").concat(p,">, text: ")+(g.prologTrunc?"...":'"')+"".concat(g.prologText,"<").concat(g.tokenText,">").concat(g.epilogText)+(g.epilogTrunc?"...":'"')+", at: <line ".concat(this._line,", column ").concat(this._column,">"))}for(var a=0;a<this._rules.length;a++){if(this._debug){var y=this._rules[a].state.map(function(R){var G=R.state;return R.tags.length>0&&(G+=" "+R.tags.map(function(rt){return"#".concat(rt)}).join(" ")),G}).join(", ");this._log(" RULE: state(s): <".concat(y,">, ")+"pattern: ".concat(this._rules[a].pattern.source))}var T=!1,j=this._rules[a].state.map(function(R){return R.state}),E=j.indexOf("*");if(E<0&&(E=j.indexOf(this._state[this._state.length-1])),E>=0){T=!0;var D=this._rules[a].state[E].tags;(D=D.filter(function(R){return!t._tag[R]})).length>0&&(T=!1)}if(T){this._rules[a].pattern.lastIndex=this._pos;var S=this._rules[a].pattern.exec(this._input);if(this._rules[a].pattern.lastIndex=this._pos,(S=this._rules[a].pattern.exec(this._input))!==null&&S.index===this._pos){if(this._debug&&this._log(" MATCHED: "+JSON.stringify(S)),this._ctx._match=S,this._ctx._repeat=!1,this._ctx._reject=!1,this._ctx._ignore=!1,this._before!==null&&this._before.call(this._ctx,this._ctx,S,this._rules[a]),this._rules[a].action.call(this._ctx,this._ctx,S),this._after!==null&&this._after.call(this._ctx,this._ctx,S,this._rules[a]),this._ctx._reject)continue;if(this._ctx._repeat){i=!0;break}if(this._ctx._ignore){if(this._progress(this._pos,this._rules[a].pattern.lastIndex),this._pos=this._rules[a].pattern.lastIndex,this._pos>=this._len)return void e();i=!0;break}if(this._pending.length>0)return this._progress(this._pos,this._rules[a].pattern.lastIndex),this._pos=this._rules[a].pattern.lastIndex,void(this._pos>=this._len&&e());throw new Error('action of pattern "'+this._rules[a].pattern.source+'" neither rejected nor accepted any token(s)')}}}}throw this.error("token not recognized")}e()}},{key:"token",value:function(){if(this._pending.length===0&&this._tokenize(),this._pending.length>0){var t=this._pending.shift();return this._transaction.length>0&&this._transaction[0].push(t),this._log("TOKEN: ".concat(t.toString())),t}return null}},{key:"tokens",value:function(){for(var t,e=[];(t=this.token())!==null;)e.push(t);return e}},{key:"peek",value:function(t){t===void 0&&(t=0);for(var e=0;e<this._pending.length+t;e++)this._tokenize();if(t>=this._pending.length)throw new Error("not enough tokens available for peek operation");return this._log("PEEK: ".concat(this._pending[t].toString())),this._pending[t]}},{key:"skip",value:function(t){t===void 0&&(t=1);for(var e=0;e<this._pending.length+t;e++)this._tokenize();if(t>this._pending.length)throw new Error("not enough tokens available for skip operation");for(;t-- >0;)this.token();return this}},{key:"consume",value:function(t,e){for(var i=this,g=0;g<this._pending.length+1;g++)this._tokenize();if(this._pending.length===0)throw new Error("not enough tokens available for consume operation");var p=this.token();this._log("CONSUME: ".concat(p.toString()));var a=function(){throw new P("expected: <type: ".concat(t,", value: ").concat(JSON.stringify(e)," (").concat(r(e),")>, ")+"found: <type: ".concat(p.type,", value: ").concat(JSON.stringify(p.value)," (").concat(r(p.value),")>"),p.pos,p.line,p.column,i._input)};return arguments.length!==2||p.isA(t,e)?p.isA(t)||a():a(JSON.stringify(e),r(e)),p}},{key:"begin",value:function(){return this._log("BEGIN: level ".concat(this._transaction.length)),this._transaction.unshift([]),this}},{key:"depth",value:function(){if(this._transaction.length===0)throw new Error("cannot determine depth -- no active transaction");return this._transaction[0].length}},{key:"commit",value:function(){if(this._transaction.length===0)throw new Error("cannot commit transaction -- no active transaction");return this._transaction.shift(),this._log("COMMIT: level ".concat(this._transaction.length)),this}},{key:"rollback",value:function(){if(this._transaction.length===0)throw new Error("cannot rollback transaction -- no active transaction");return this._pending=this._transaction[0].concat(this._pending),this._transaction.shift(),this._log("ROLLBACK: level ".concat(this._transaction.length)),this}},{key:"alternatives",value:function(){for(var t=null,e=[],i=arguments.length,g=new Array(i),p=0;p<i;p++)g[p]=arguments[p];for(var a=0;a<g.length;a++)try{this.begin(),t=g[a].call(this),this.commit();break}catch(y){this._log("EXCEPTION: ".concat(y.toString())),e.push({ex:y,depth:this.depth()}),this.rollback();continue}if(t===null&&e.length>0)throw(e=e.sort(function(y,T){return y.depth-T.depth}))[0].ex;return t}}]),f})();C.Token=z,C.ParsingError=P,C.ActionContext=F,v.exports=C},{}]},{},[1])(1)})}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{}],2:[function(_,l,c){"use strict";var u=m(_("tokenizr"));function m(x){return x&&x.__esModule?x:{default:x}}function v(x){var r=new u.default;r.rule(/#[^\r\n]*(?=\r?\n)/,function(s,k){s.accept("comment")}),r.rule(/"(?:\\"|[^"])*"/,function(s,k){s.accept("string")}),r.rule(/$[a-zA-Z_][a-zA-Z0-9_]*/,function(s,k){s.accept("var")}),r.rule(/[a-zA-Z_][a-zA-Z0-9_]*/,function(s,k){s.accept("id")}),r.rule(/[+-]?[0-9]*\.?[0-9]+(?:[eE][+-]?[0-9]+)?/,function(s,k){s.accept("number")}),r.rule(/[ \t\r\n]+/,function(s,k){s.accept("ws"," ")}),r.rule(/[{}]/,function(s,k){s.accept("brace")}),r.rule(/[[\]]/,function(s,k){s.accept("bracket")}),r.rule(/[()]/,function(s,k){s.accept("parenthesis")}),r.rule(/,/,function(s,k){s.accept("comma")}),r.rule(/!/,function(s,k){s.accept("not")}),r.rule(/\.\.\./,function(s,k){s.accept("ellipsis")}),r.rule(/@/,function(s,k){s.accept("at")}),r.rule(/:/,function(s,k){s.accept("colon")}),r.rule(/./,function(s,k){s.accept("any")}),r.input(x),r.debug(!1);for(var w=r.tokens(),O="",b=/^(?:brace|bracket|parenthesis|comma|colon)$/,h=0;h<w.length;h++)(w[h].type==="comment"||w[h].type==="ws"&&(h<w.length-1&&w[h+1].type.match(b)||h>0&&w[h-1].type.match(b)))&&(w.splice(h,1),h--);return w.forEach(function(s){O+=s.value}),O}l.exports=v},{tokenizr:1}]},{},[2])(2)})});function st(d){let n=parseInt(d,10);return n.toString()===d?n:d}function I(d,n,o,_=!1){if(typeof n=="number"&&(n=[n]),!n||n.length===0)return;if(typeof n=="string"){let u=n.split(".").map(st);return u.some(m=>m==="__proto__"||m==="constructor"||m==="prototype")?void 0:I(d,u,o,_)}if(Array.isArray(n)&&n.some(u=>u==="__proto__"||u==="constructor"||u==="prototype"))return;let l=n[0];if(typeof l>"u")return;let c=d[l];return n.length===1?_&&c&&typeof c=="object"&&typeof o=="object"?(Object.assign(c,o),c):(d[l]=o,c):(c===void 0&&(typeof n[1]=="number"?d[l]=[]:d[l]={}),I(d[l],n.slice(1),o,_))}V();V();var X=()=>({definitions:[],kind:K.DOCUMENT}),at=d=>{if(!d)return X();try{return $(d)}catch(n){return console.error("Error parsing query, returning empty instead",n),X()}},W=d=>{let n=at(d);return n.definitions?n.definitions.filter(o=>!!(o.kind==="OperationDefinition"&&o.name?.value)):[]};var ut=new TextDecoder;function Y(d,n){return U(this,null,function*(){if(!d.ok||!d.body||d.bodyUsed)return d;let o=d.headers.get("content-type");if(!o||!~o.indexOf("multipart/"))return d;let _=o.indexOf("boundary="),l="-";if(~_){let c=_+9,u=o.indexOf(";",c);l=o.slice(c,u>-1?u:void 0).trim().replace(/"/g,"")}return(function(c,u,m){return B(this,null,function*(){let v,x,r,w=c.getReader(),O=!m||!m.multiple,b=u.length,h="",s=[];try{let k;t:for(;!(k=yield new L(w.read())).done;){let N=ut.decode(k.value);v=h.length,h+=N;let A=N.indexOf(u);for(~A?v+=A:v=h.indexOf(u),s=[];~v;){let z=h.slice(0,v),P=h.slice(v+b);if(x){let F=z.indexOf(`\r
\r
`)+4,C=z.lastIndexOf(`\r
`,F),f=!1,t=z.slice(F,C>-1?void 0:C),e=String(z.slice(0,F)).trim().split(`\r
`),i={},g=e.length;for(;r=e[--g];r=r.split(": "),i[r.shift().toLowerCase()]=r.join(": "));if(r=i["content-type"],r&&~r.indexOf("application/json"))try{t=JSON.parse(t),f=!0}catch{}if(r={headers:i,body:t,json:f},O?yield r:s.push(r),P.slice(0,2)==="--")break t}else u=`\r
`+u,x=b+=2;h=P,v=h.indexOf(u)}s.length&&(yield s)}}finally{s.length&&(yield s),yield new L(w.cancel())}})})(d.body,`--${l}`,n)})}var nt=ot(tt());var et=class{handle(n){return new Q(o=>{let _=new AbortController,l=this.getData(n),c=this.isGETRequest(n.method)?this.getParamsFromData(l):void 0,u=Date.now();return fetch(this.getUrl(n.url,c),{method:n.method,headers:this.getHeaders(n),body:this.getBody(n,l),credentials:n.withCredentials?"include":"same-origin",signal:_.signal}).then(m=>U(this,null,function*(){return{response:m,merosResponse:yield Y(m)}})).then(m=>U(this,null,function*(){let v=Date.now(),{response:x,merosResponse:r}=m;if(r instanceof Response){if(!r.ok||!r.body){let O=yield r.arrayBuffer();return this.emitChunk(r,new Uint8Array(O),!0,o,u,v)}let w=r.body.getReader();for(;;){let{done:O,value:b}=yield w.read();if(this.emitChunk(r,b,O,o,u,v),O)return!0}}return H(r).subscribe({next:w=>{this.emitChunk(x,w.json?JSON.stringify(w.body):w.body,!1,o,u,v)},error:w=>{o.error(w)},complete:()=>{this.emitChunk(x,void 0,!0,o,u,v)}})})).catch(m=>{if(m?.name==="AbortError"){o.complete();return}o.error(m)}),()=>{_.abort()}})}destroy(){}emitChunk(n,o,_,l,c,u){if(o){let m=typeof o=="string"?o:new TextDecoder().decode(o),v={ok:n.ok,data:m,headers:n.headers,status:n.status,statusText:n.statusText,url:n.url,requestStartTimestamp:c,requestEndTimestamp:u,responseTimeMs:u-c};l.next(v)}return _&&l.complete(),!0}isGETRequest(n){return n.toLowerCase()==="get"}getParamsFromData(n){return Object.entries(n).reduce((o,[_,l])=>{if(l){let c=typeof l=="object"?JSON.stringify(l):l.toString();o.set(_,c)}return o},new URLSearchParams)}getHeaders(n){let o=new Headers,_={"Content-Type":"application/json",Accept:"application/json"};return!this.isGETRequest(n.method)&&!n.files?.length&&Object.entries(_).forEach(([c,u])=>{o.set(c,u)}),n.headers?.forEach(c=>{o.set(c.key,c.value)}),o}getUrl(n,o){let _=new URL(n);return o&&(_.search=o.toString()),_.href}getData(n){let o={query:n.query,variables:n.variables??{},extensions:n.extensions,operationName:null};return n.selectedOperation&&(o.operationName=n.selectedOperation),o}getBody(n,o){if(!this.isGETRequest(n.method)){if(n.files?.length){let _={};n.files.forEach((c,u)=>{I(o.variables,c.name,null),_[u]=[`variables.${c.name}`]});let l=new FormData;return l.append("operations",JSON.stringify(o)),l.append("map",JSON.stringify(_)),n.files.forEach((c,u)=>{l.append(`${u}`,c.data??"")}),l}if(n.batchedRequest){let _=W(o.query);if(_.length>1){let l=_.map(c=>{let u=c.name?.value,m=(0,nt.default)(Z(c)),v=o.variables,x=o.extensions;return{operationName:u,query:m,variables:v,extensions:x}});return JSON.stringify(l)}}return JSON.stringify(o)}}};export{I as a,et as b};
//# sourceMappingURL=chunk-LHIJLPHC.js.map
//# debugId=9acb8dc3-f893-5f7b-b160-260d2212b328