@stonecrop/graphql-client 0.8.12 → 0.9.0

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.
@@ -1,199 +0,0 @@
1
- (function(Y,j){typeof exports=="object"&&typeof module<"u"?j(exports):typeof define=="function"&&define.amd?define(["exports"],j):(Y=typeof globalThis<"u"?globalThis:Y||self,j(Y["@stonecrop/graphql-client"]={}))})(this,(function(Y){"use strict";var j=9e15,J=1e9,De="0123456789abcdef",le="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",fe="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",_e={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-j,maxE:j,crypto:!1},Qe,H,y=!0,he="[DecimalError] ",Q=he+"Invalid argument: ",ze=he+"Precision limit exceeded",Ze=he+"crypto unavailable",Xe="[object Decimal]",L=Math.floor,C=Math.pow,Mt=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,Ft=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,Pt=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,We=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,B=1e7,v=7,qt=9007199254740991,Bt=le.length-1,xe=fe.length-1,p={toStringTag:Xe};p.absoluteValue=p.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),T(e)},p.ceil=function(){return T(new this.constructor(this),this.e+1,2)},p.clampedTo=p.clamp=function(e,t){var n,i=this,r=i.constructor;if(e=new r(e),t=new r(t),!e.s||!t.s)return new r(NaN);if(e.gt(t))throw Error(Q+t);return n=i.cmp(e),n<0?e:i.cmp(t)>0?t:new r(i)},p.comparedTo=p.cmp=function(e){var t,n,i,r,s=this,o=s.d,a=(e=new s.constructor(e)).d,u=s.s,c=e.s;if(!o||!a)return!u||!c?NaN:u!==c?u:o===a?0:!o^u<0?1:-1;if(!o[0]||!a[0])return o[0]?u:a[0]?-c:0;if(u!==c)return u;if(s.e!==e.e)return s.e>e.e^u<0?1:-1;for(i=o.length,r=a.length,t=0,n=i<r?i:r;t<n;++t)if(o[t]!==a[t])return o[t]>a[t]^u<0?1:-1;return i===r?0:i>r^u<0?1:-1},p.cosine=p.cos=function(){var e,t,n=this,i=n.constructor;return n.d?n.d[0]?(e=i.precision,t=i.rounding,i.precision=e+Math.max(n.e,n.sd())+v,i.rounding=1,n=Ut(i,rt(i,n)),i.precision=e,i.rounding=t,T(H==2||H==3?n.neg():n,e,t,!0)):new i(1):new i(NaN)},p.cubeRoot=p.cbrt=function(){var e,t,n,i,r,s,o,a,u,c,l=this,f=l.constructor;if(!l.isFinite()||l.isZero())return new f(l);for(y=!1,s=l.s*C(l.s*l,1/3),!s||Math.abs(s)==1/0?(n=b(l.d),e=l.e,(s=(e-n.length+1)%3)&&(n+=s==1||s==-2?"0":"00"),s=C(n,1/3),e=L((e+1)/3)-(e%3==(e<0?-1:2)),s==1/0?n="5e"+e:(n=s.toExponential(),n=n.slice(0,n.indexOf("e")+1)+e),i=new f(n),i.s=l.s):i=new f(s.toString()),o=(e=f.precision)+3;;)if(a=i,u=a.times(a).times(a),c=u.plus(l),i=S(c.plus(l).times(a),c.plus(u),o+2,1),b(a.d).slice(0,o)===(n=b(i.d)).slice(0,o))if(n=n.slice(o-3,o+1),n=="9999"||!r&&n=="4999"){if(!r&&(T(a,e+1,0),a.times(a).times(a).eq(l))){i=a;break}o+=4,r=1}else{(!+n||!+n.slice(1)&&n.charAt(0)=="5")&&(T(i,e+1,1),t=!i.times(i).times(i).eq(l));break}return y=!0,T(i,e,f.rounding,t)},p.decimalPlaces=p.dp=function(){var e,t=this.d,n=NaN;if(t){if(e=t.length-1,n=(e-L(this.e/v))*v,e=t[e],e)for(;e%10==0;e/=10)n--;n<0&&(n=0)}return n},p.dividedBy=p.div=function(e){return S(this,new this.constructor(e))},p.dividedToIntegerBy=p.divToInt=function(e){var t=this,n=t.constructor;return T(S(t,new n(e),0,1,1),n.precision,n.rounding)},p.equals=p.eq=function(e){return this.cmp(e)===0},p.floor=function(){return T(new this.constructor(this),this.e+1,3)},p.greaterThan=p.gt=function(e){return this.cmp(e)>0},p.greaterThanOrEqualTo=p.gte=function(e){var t=this.cmp(e);return t==1||t===0},p.hyperbolicCosine=p.cosh=function(){var e,t,n,i,r,s=this,o=s.constructor,a=new o(1);if(!s.isFinite())return new o(s.s?1/0:NaN);if(s.isZero())return a;n=o.precision,i=o.rounding,o.precision=n+Math.max(s.e,s.sd())+4,o.rounding=1,r=s.d.length,r<32?(e=Math.ceil(r/3),t=(1/Ee(4,e)).toString()):(e=16,t="2.3283064365386962890625e-10"),s=ee(o,1,s.times(t),new o(1),!0);for(var u,c=e,l=new o(8);c--;)u=s.times(s),s=a.minus(u.times(l.minus(u.times(l))));return T(s,o.precision=n,o.rounding=i,!0)},p.hyperbolicSine=p.sinh=function(){var e,t,n,i,r=this,s=r.constructor;if(!r.isFinite()||r.isZero())return new s(r);if(t=s.precision,n=s.rounding,s.precision=t+Math.max(r.e,r.sd())+4,s.rounding=1,i=r.d.length,i<3)r=ee(s,2,r,r,!0);else{e=1.4*Math.sqrt(i),e=e>16?16:e|0,r=r.times(1/Ee(5,e)),r=ee(s,2,r,r,!0);for(var o,a=new s(5),u=new s(16),c=new s(20);e--;)o=r.times(r),r=r.times(a.plus(o.times(u.times(o).plus(c))))}return s.precision=t,s.rounding=n,T(r,t,n,!0)},p.hyperbolicTangent=p.tanh=function(){var e,t,n=this,i=n.constructor;return n.isFinite()?n.isZero()?new i(n):(e=i.precision,t=i.rounding,i.precision=e+7,i.rounding=1,S(n.sinh(),n.cosh(),i.precision=e,i.rounding=t)):new i(n.s)},p.inverseCosine=p.acos=function(){var e=this,t=e.constructor,n=e.abs().cmp(1),i=t.precision,r=t.rounding;return n!==-1?n===0?e.isNeg()?G(t,i,r):new t(0):new t(NaN):e.isZero()?G(t,i+4,r).times(.5):(t.precision=i+6,t.rounding=1,e=new t(1).minus(e).div(e.plus(1)).sqrt().atan(),t.precision=i,t.rounding=r,e.times(2))},p.inverseHyperbolicCosine=p.acosh=function(){var e,t,n=this,i=n.constructor;return n.lte(1)?new i(n.eq(1)?0:NaN):n.isFinite()?(e=i.precision,t=i.rounding,i.precision=e+Math.max(Math.abs(n.e),n.sd())+4,i.rounding=1,y=!1,n=n.times(n).minus(1).sqrt().plus(n),y=!0,i.precision=e,i.rounding=t,n.ln()):new i(n)},p.inverseHyperbolicSine=p.asinh=function(){var e,t,n=this,i=n.constructor;return!n.isFinite()||n.isZero()?new i(n):(e=i.precision,t=i.rounding,i.precision=e+2*Math.max(Math.abs(n.e),n.sd())+6,i.rounding=1,y=!1,n=n.times(n).plus(1).sqrt().plus(n),y=!0,i.precision=e,i.rounding=t,n.ln())},p.inverseHyperbolicTangent=p.atanh=function(){var e,t,n,i,r=this,s=r.constructor;return r.isFinite()?r.e>=0?new s(r.abs().eq(1)?r.s/0:r.isZero()?r:NaN):(e=s.precision,t=s.rounding,i=r.sd(),Math.max(i,e)<2*-r.e-1?T(new s(r),e,t,!0):(s.precision=n=i-r.e,r=S(r.plus(1),new s(1).minus(r),n+e,1),s.precision=e+4,s.rounding=1,r=r.ln(),s.precision=e,s.rounding=t,r.times(.5))):new s(NaN)},p.inverseSine=p.asin=function(){var e,t,n,i,r=this,s=r.constructor;return r.isZero()?new s(r):(t=r.abs().cmp(1),n=s.precision,i=s.rounding,t!==-1?t===0?(e=G(s,n+4,i).times(.5),e.s=r.s,e):new s(NaN):(s.precision=n+6,s.rounding=1,r=r.div(new s(1).minus(r.times(r)).sqrt().plus(1)).atan(),s.precision=n,s.rounding=i,r.times(2)))},p.inverseTangent=p.atan=function(){var e,t,n,i,r,s,o,a,u,c=this,l=c.constructor,f=l.precision,h=l.rounding;if(c.isFinite()){if(c.isZero())return new l(c);if(c.abs().eq(1)&&f+4<=xe)return o=G(l,f+4,h).times(.25),o.s=c.s,o}else{if(!c.s)return new l(NaN);if(f+4<=xe)return o=G(l,f+4,h).times(.5),o.s=c.s,o}for(l.precision=a=f+10,l.rounding=1,n=Math.min(28,a/v+2|0),e=n;e;--e)c=c.div(c.times(c).plus(1).sqrt().plus(1));for(y=!1,t=Math.ceil(a/v),i=1,u=c.times(c),o=new l(c),r=c;e!==-1;)if(r=r.times(u),s=o.minus(r.div(i+=2)),r=r.times(u),o=s.plus(r.div(i+=2)),o.d[t]!==void 0)for(e=t;o.d[e]===s.d[e]&&e--;);return n&&(o=o.times(2<<n-1)),y=!0,T(o,l.precision=f,l.rounding=h,!0)},p.isFinite=function(){return!!this.d},p.isInteger=p.isInt=function(){return!!this.d&&L(this.e/v)>this.d.length-2},p.isNaN=function(){return!this.s},p.isNegative=p.isNeg=function(){return this.s<0},p.isPositive=p.isPos=function(){return this.s>0},p.isZero=function(){return!!this.d&&this.d[0]===0},p.lessThan=p.lt=function(e){return this.cmp(e)<0},p.lessThanOrEqualTo=p.lte=function(e){return this.cmp(e)<1},p.logarithm=p.log=function(e){var t,n,i,r,s,o,a,u,c=this,l=c.constructor,f=l.precision,h=l.rounding,m=5;if(e==null)e=new l(10),t=!0;else{if(e=new l(e),n=e.d,e.s<0||!n||!n[0]||e.eq(1))return new l(NaN);t=e.eq(10)}if(n=c.d,c.s<0||!n||!n[0]||c.eq(1))return new l(n&&!n[0]?-1/0:c.s!=1?NaN:n?0:1/0);if(t)if(n.length>1)s=!0;else{for(r=n[0];r%10===0;)r/=10;s=r!==1}if(y=!1,a=f+m,o=Z(c,a),i=t?me(l,a+10):Z(e,a),u=S(o,i,a,1),oe(u.d,r=f,h))do if(a+=10,o=Z(c,a),i=t?me(l,a+10):Z(e,a),u=S(o,i,a,1),!s){+b(u.d).slice(r+1,r+15)+1==1e14&&(u=T(u,f+1,0));break}while(oe(u.d,r+=10,h));return y=!0,T(u,f,h)},p.minus=p.sub=function(e){var t,n,i,r,s,o,a,u,c,l,f,h,m=this,N=m.constructor;if(e=new N(e),!m.d||!e.d)return!m.s||!e.s?e=new N(NaN):m.d?e.s=-e.s:e=new N(e.d||m.s!==e.s?m:NaN),e;if(m.s!=e.s)return e.s=-e.s,m.plus(e);if(c=m.d,h=e.d,a=N.precision,u=N.rounding,!c[0]||!h[0]){if(h[0])e.s=-e.s;else if(c[0])e=new N(m);else return new N(u===3?-0:0);return y?T(e,a,u):e}if(n=L(e.e/v),l=L(m.e/v),c=c.slice(),s=l-n,s){for(f=s<0,f?(t=c,s=-s,o=h.length):(t=h,n=l,o=c.length),i=Math.max(Math.ceil(a/v),o)+2,s>i&&(s=i,t.length=1),t.reverse(),i=s;i--;)t.push(0);t.reverse()}else{for(i=c.length,o=h.length,f=i<o,f&&(o=i),i=0;i<o;i++)if(c[i]!=h[i]){f=c[i]<h[i];break}s=0}for(f&&(t=c,c=h,h=t,e.s=-e.s),o=c.length,i=h.length-o;i>0;--i)c[o++]=0;for(i=h.length;i>s;){if(c[--i]<h[i]){for(r=i;r&&c[--r]===0;)c[r]=B-1;--c[r],c[i]+=B}c[i]-=h[i]}for(;c[--o]===0;)c.pop();for(;c[0]===0;c.shift())--n;return c[0]?(e.d=c,e.e=pe(c,n),y?T(e,a,u):e):new N(u===3?-0:0)},p.modulo=p.mod=function(e){var t,n=this,i=n.constructor;return e=new i(e),!n.d||!e.s||e.d&&!e.d[0]?new i(NaN):!e.d||n.d&&!n.d[0]?T(new i(n),i.precision,i.rounding):(y=!1,i.modulo==9?(t=S(n,e.abs(),0,3,1),t.s*=e.s):t=S(n,e,0,i.modulo,1),t=t.times(e),y=!0,n.minus(t))},p.naturalExponential=p.exp=function(){return Ce(this)},p.naturalLogarithm=p.ln=function(){return Z(this)},p.negated=p.neg=function(){var e=new this.constructor(this);return e.s=-e.s,T(e)},p.plus=p.add=function(e){var t,n,i,r,s,o,a,u,c,l,f=this,h=f.constructor;if(e=new h(e),!f.d||!e.d)return!f.s||!e.s?e=new h(NaN):f.d||(e=new h(e.d||f.s===e.s?f:NaN)),e;if(f.s!=e.s)return e.s=-e.s,f.minus(e);if(c=f.d,l=e.d,a=h.precision,u=h.rounding,!c[0]||!l[0])return l[0]||(e=new h(f)),y?T(e,a,u):e;if(s=L(f.e/v),i=L(e.e/v),c=c.slice(),r=s-i,r){for(r<0?(n=c,r=-r,o=l.length):(n=l,i=s,o=c.length),s=Math.ceil(a/v),o=s>o?s+1:o+1,r>o&&(r=o,n.length=1),n.reverse();r--;)n.push(0);n.reverse()}for(o=c.length,r=l.length,o-r<0&&(r=o,n=l,l=c,c=n),t=0;r;)t=(c[--r]=c[r]+l[r]+t)/B|0,c[r]%=B;for(t&&(c.unshift(t),++i),o=c.length;c[--o]==0;)c.pop();return e.d=c,e.e=pe(c,i),y?T(e,a,u):e},p.precision=p.sd=function(e){var t,n=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(Q+e);return n.d?(t=Ke(n.d),e&&n.e+1>t&&(t=n.e+1)):t=NaN,t},p.round=function(){var e=this,t=e.constructor;return T(new t(e),e.e+1,t.rounding)},p.sine=p.sin=function(){var e,t,n=this,i=n.constructor;return n.isFinite()?n.isZero()?new i(n):(e=i.precision,t=i.rounding,i.precision=e+Math.max(n.e,n.sd())+v,i.rounding=1,n=jt(i,rt(i,n)),i.precision=e,i.rounding=t,T(H>2?n.neg():n,e,t,!0)):new i(NaN)},p.squareRoot=p.sqrt=function(){var e,t,n,i,r,s,o=this,a=o.d,u=o.e,c=o.s,l=o.constructor;if(c!==1||!a||!a[0])return new l(!c||c<0&&(!a||a[0])?NaN:a?o:1/0);for(y=!1,c=Math.sqrt(+o),c==0||c==1/0?(t=b(a),(t.length+u)%2==0&&(t+="0"),c=Math.sqrt(t),u=L((u+1)/2)-(u<0||u%2),c==1/0?t="5e"+u:(t=c.toExponential(),t=t.slice(0,t.indexOf("e")+1)+u),i=new l(t)):i=new l(c.toString()),n=(u=l.precision)+3;;)if(s=i,i=s.plus(S(o,s,n+2,1)).times(.5),b(s.d).slice(0,n)===(t=b(i.d)).slice(0,n))if(t=t.slice(n-3,n+1),t=="9999"||!r&&t=="4999"){if(!r&&(T(s,u+1,0),s.times(s).eq(o))){i=s;break}n+=4,r=1}else{(!+t||!+t.slice(1)&&t.charAt(0)=="5")&&(T(i,u+1,1),e=!i.times(i).eq(o));break}return y=!0,T(i,u,l.rounding,e)},p.tangent=p.tan=function(){var e,t,n=this,i=n.constructor;return n.isFinite()?n.isZero()?new i(n):(e=i.precision,t=i.rounding,i.precision=e+10,i.rounding=1,n=n.sin(),n.s=1,n=S(n,new i(1).minus(n.times(n)).sqrt(),e+10,0),i.precision=e,i.rounding=t,T(H==2||H==4?n.neg():n,e,t,!0)):new i(NaN)},p.times=p.mul=function(e){var t,n,i,r,s,o,a,u,c,l=this,f=l.constructor,h=l.d,m=(e=new f(e)).d;if(e.s*=l.s,!h||!h[0]||!m||!m[0])return new f(!e.s||h&&!h[0]&&!m||m&&!m[0]&&!h?NaN:!h||!m?e.s/0:e.s*0);for(n=L(l.e/v)+L(e.e/v),u=h.length,c=m.length,u<c&&(s=h,h=m,m=s,o=u,u=c,c=o),s=[],o=u+c,i=o;i--;)s.push(0);for(i=c;--i>=0;){for(t=0,r=u+i;r>i;)a=s[r]+m[i]*h[r-i-1]+t,s[r--]=a%B|0,t=a/B|0;s[r]=(s[r]+t)%B|0}for(;!s[--o];)s.pop();return t?++n:s.shift(),e.d=s,e.e=pe(s,n),y?T(e,f.precision,f.rounding):e},p.toBinary=function(e,t){return ke(this,2,e,t)},p.toDecimalPlaces=p.toDP=function(e,t){var n=this,i=n.constructor;return n=new i(n),e===void 0?n:(F(e,0,J),t===void 0?t=i.rounding:F(t,0,8),T(n,e+n.e+1,t))},p.toExponential=function(e,t){var n,i=this,r=i.constructor;return e===void 0?n=$(i,!0):(F(e,0,J),t===void 0?t=r.rounding:F(t,0,8),i=T(new r(i),e+1,t),n=$(i,!0,e+1)),i.isNeg()&&!i.isZero()?"-"+n:n},p.toFixed=function(e,t){var n,i,r=this,s=r.constructor;return e===void 0?n=$(r):(F(e,0,J),t===void 0?t=s.rounding:F(t,0,8),i=T(new s(r),e+r.e+1,t),n=$(i,!1,e+i.e+1)),r.isNeg()&&!r.isZero()?"-"+n:n},p.toFraction=function(e){var t,n,i,r,s,o,a,u,c,l,f,h,m=this,N=m.d,E=m.constructor;if(!N)return new E(m);if(c=n=new E(1),i=u=new E(0),t=new E(i),s=t.e=Ke(N)-m.e-1,o=s%v,t.d[0]=C(10,o<0?v+o:o),e==null)e=s>0?t:c;else{if(a=new E(e),!a.isInt()||a.lt(c))throw Error(Q+a);e=a.gt(t)?s>0?t:c:a}for(y=!1,a=new E(b(N)),l=E.precision,E.precision=s=N.length*v*2;f=S(a,t,0,1,1),r=n.plus(f.times(i)),r.cmp(e)!=1;)n=i,i=r,r=c,c=u.plus(f.times(r)),u=r,r=t,t=a.minus(f.times(r)),a=r;return r=S(e.minus(n),i,0,1,1),u=u.plus(r.times(c)),n=n.plus(r.times(i)),u.s=c.s=m.s,h=S(c,i,s,1).minus(m).abs().cmp(S(u,n,s,1).minus(m).abs())<1?[c,i]:[u,n],E.precision=l,y=!0,h},p.toHexadecimal=p.toHex=function(e,t){return ke(this,16,e,t)},p.toNearest=function(e,t){var n=this,i=n.constructor;if(n=new i(n),e==null){if(!n.d)return n;e=new i(1),t=i.rounding}else{if(e=new i(e),t===void 0?t=i.rounding:F(t,0,8),!n.d)return e.s?n:e;if(!e.d)return e.s&&(e.s=n.s),e}return e.d[0]?(y=!1,n=S(n,e,0,t,1).times(e),y=!0,T(n)):(e.s=n.s,n=e),n},p.toNumber=function(){return+this},p.toOctal=function(e,t){return ke(this,8,e,t)},p.toPower=p.pow=function(e){var t,n,i,r,s,o,a=this,u=a.constructor,c=+(e=new u(e));if(!a.d||!e.d||!a.d[0]||!e.d[0])return new u(C(+a,c));if(a=new u(a),a.eq(1))return a;if(i=u.precision,s=u.rounding,e.eq(1))return T(a,i,s);if(t=L(e.e/v),t>=e.d.length-1&&(n=c<0?-c:c)<=qt)return r=et(u,a,n,i),e.s<0?new u(1).div(r):T(r,i,s);if(o=a.s,o<0){if(t<e.d.length-1)return new u(NaN);if((e.d[t]&1)==0&&(o=1),a.e==0&&a.d[0]==1&&a.d.length==1)return a.s=o,a}return n=C(+a,c),t=n==0||!isFinite(n)?L(c*(Math.log("0."+b(a.d))/Math.LN10+a.e+1)):new u(n+"").e,t>u.maxE+1||t<u.minE-1?new u(t>0?o/0:0):(y=!1,u.rounding=a.s=1,n=Math.min(12,(t+"").length),r=Ce(e.times(Z(a,i+n)),i),r.d&&(r=T(r,i+5,1),oe(r.d,i,s)&&(t=i+10,r=T(Ce(e.times(Z(a,t+n)),t),t+5,1),+b(r.d).slice(i+1,i+15)+1==1e14&&(r=T(r,i+1,0)))),r.s=o,y=!0,u.rounding=s,T(r,i,s))},p.toPrecision=function(e,t){var n,i=this,r=i.constructor;return e===void 0?n=$(i,i.e<=r.toExpNeg||i.e>=r.toExpPos):(F(e,1,J),t===void 0?t=r.rounding:F(t,0,8),i=T(new r(i),e,t),n=$(i,e<=i.e||i.e<=r.toExpNeg,e)),i.isNeg()&&!i.isZero()?"-"+n:n},p.toSignificantDigits=p.toSD=function(e,t){var n=this,i=n.constructor;return e===void 0?(e=i.precision,t=i.rounding):(F(e,1,J),t===void 0?t=i.rounding:F(t,0,8)),T(new i(n),e,t)},p.toString=function(){var e=this,t=e.constructor,n=$(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()&&!e.isZero()?"-"+n:n},p.truncated=p.trunc=function(){return T(new this.constructor(this),this.e+1,1)},p.valueOf=p.toJSON=function(){var e=this,t=e.constructor,n=$(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()?"-"+n:n};function b(e){var t,n,i,r=e.length-1,s="",o=e[0];if(r>0){for(s+=o,t=1;t<r;t++)i=e[t]+"",n=v-i.length,n&&(s+=z(n)),s+=i;o=e[t],i=o+"",n=v-i.length,n&&(s+=z(n))}else if(o===0)return"0";for(;o%10===0;)o/=10;return s+o}function F(e,t,n){if(e!==~~e||e<t||e>n)throw Error(Q+e)}function oe(e,t,n,i){var r,s,o,a;for(s=e[0];s>=10;s/=10)--t;return--t<0?(t+=v,r=0):(r=Math.ceil((t+1)/v),t%=v),s=C(10,v-t),a=e[r]%s|0,i==null?t<3?(t==0?a=a/100|0:t==1&&(a=a/10|0),o=n<4&&a==99999||n>3&&a==49999||a==5e4||a==0):o=(n<4&&a+1==s||n>3&&a+1==s/2)&&(e[r+1]/s/100|0)==C(10,t-2)-1||(a==s/2||a==0)&&(e[r+1]/s/100|0)==0:t<4?(t==0?a=a/1e3|0:t==1?a=a/100|0:t==2&&(a=a/10|0),o=(i||n<4)&&a==9999||!i&&n>3&&a==4999):o=((i||n<4)&&a+1==s||!i&&n>3&&a+1==s/2)&&(e[r+1]/s/1e3|0)==C(10,t-3)-1,o}function de(e,t,n){for(var i,r=[0],s,o=0,a=e.length;o<a;){for(s=r.length;s--;)r[s]*=t;for(r[0]+=De.indexOf(e.charAt(o++)),i=0;i<r.length;i++)r[i]>n-1&&(r[i+1]===void 0&&(r[i+1]=0),r[i+1]+=r[i]/n|0,r[i]%=n)}return r.reverse()}function Ut(e,t){var n,i,r;if(t.isZero())return t;i=t.d.length,i<32?(n=Math.ceil(i/3),r=(1/Ee(4,n)).toString()):(n=16,r="2.3283064365386962890625e-10"),e.precision+=n,t=ee(e,1,t.times(r),new e(1));for(var s=n;s--;){var o=t.times(t);t=o.times(o).minus(o).times(8).plus(1)}return e.precision-=n,t}var S=(function(){function e(i,r,s){var o,a=0,u=i.length;for(i=i.slice();u--;)o=i[u]*r+a,i[u]=o%s|0,a=o/s|0;return a&&i.unshift(a),i}function t(i,r,s,o){var a,u;if(s!=o)u=s>o?1:-1;else for(a=u=0;a<s;a++)if(i[a]!=r[a]){u=i[a]>r[a]?1:-1;break}return u}function n(i,r,s,o){for(var a=0;s--;)i[s]-=a,a=i[s]<r[s]?1:0,i[s]=a*o+i[s]-r[s];for(;!i[0]&&i.length>1;)i.shift()}return function(i,r,s,o,a,u){var c,l,f,h,m,N,E,R,A,P,O,_,X,q,se,Oe,ue,He,V,Ae,Se=i.constructor,Je=i.s==r.s?1:-1,M=i.d,D=r.d;if(!M||!M[0]||!D||!D[0])return new Se(!i.s||!r.s||(M?D&&M[0]==D[0]:!D)?NaN:M&&M[0]==0||!D?Je*0:Je/0);for(u?(m=1,l=i.e-r.e):(u=B,m=v,l=L(i.e/m)-L(r.e/m)),V=D.length,ue=M.length,A=new Se(Je),P=A.d=[],f=0;D[f]==(M[f]||0);f++);if(D[f]>(M[f]||0)&&l--,s==null?(q=s=Se.precision,o=Se.rounding):a?q=s+(i.e-r.e)+1:q=s,q<0)P.push(1),N=!0;else{if(q=q/m+2|0,f=0,V==1){for(h=0,D=D[0],q++;(f<ue||h)&&q--;f++)se=h*u+(M[f]||0),P[f]=se/D|0,h=se%D|0;N=h||f<ue}else{for(h=u/(D[0]+1)|0,h>1&&(D=e(D,h,u),M=e(M,h,u),V=D.length,ue=M.length),Oe=V,O=M.slice(0,V),_=O.length;_<V;)O[_++]=0;Ae=D.slice(),Ae.unshift(0),He=D[0],D[1]>=u/2&&++He;do h=0,c=t(D,O,V,_),c<0?(X=O[0],V!=_&&(X=X*u+(O[1]||0)),h=X/He|0,h>1?(h>=u&&(h=u-1),E=e(D,h,u),R=E.length,_=O.length,c=t(E,O,R,_),c==1&&(h--,n(E,V<R?Ae:D,R,u))):(h==0&&(c=h=1),E=D.slice()),R=E.length,R<_&&E.unshift(0),n(O,E,_,u),c==-1&&(_=O.length,c=t(D,O,V,_),c<1&&(h++,n(O,V<_?Ae:D,_,u))),_=O.length):c===0&&(h++,O=[0]),P[f++]=h,c&&O[0]?O[_++]=M[Oe]||0:(O=[M[Oe]],_=1);while((Oe++<ue||O[0]!==void 0)&&q--);N=O[0]!==void 0}P[0]||P.shift()}if(m==1)A.e=l,Qe=N;else{for(f=1,h=P[0];h>=10;h/=10)f++;A.e=f+l*m-1,T(A,a?s+A.e+1:s,o,N)}return A}})();function T(e,t,n,i){var r,s,o,a,u,c,l,f,h,m=e.constructor;e:if(t!=null){if(f=e.d,!f)return e;for(r=1,a=f[0];a>=10;a/=10)r++;if(s=t-r,s<0)s+=v,o=t,l=f[h=0],u=l/C(10,r-o-1)%10|0;else if(h=Math.ceil((s+1)/v),a=f.length,h>=a)if(i){for(;a++<=h;)f.push(0);l=u=0,r=1,s%=v,o=s-v+1}else break e;else{for(l=a=f[h],r=1;a>=10;a/=10)r++;s%=v,o=s-v+r,u=o<0?0:l/C(10,r-o-1)%10|0}if(i=i||t<0||f[h+1]!==void 0||(o<0?l:l%C(10,r-o-1)),c=n<4?(u||i)&&(n==0||n==(e.s<0?3:2)):u>5||u==5&&(n==4||i||n==6&&(s>0?o>0?l/C(10,r-o):0:f[h-1])%10&1||n==(e.s<0?8:7)),t<1||!f[0])return f.length=0,c?(t-=e.e+1,f[0]=C(10,(v-t%v)%v),e.e=-t||0):f[0]=e.e=0,e;if(s==0?(f.length=h,a=1,h--):(f.length=h+1,a=C(10,v-s),f[h]=o>0?(l/C(10,r-o)%C(10,o)|0)*a:0),c)for(;;)if(h==0){for(s=1,o=f[0];o>=10;o/=10)s++;for(o=f[0]+=a,a=1;o>=10;o/=10)a++;s!=a&&(e.e++,f[0]==B&&(f[0]=1));break}else{if(f[h]+=a,f[h]!=B)break;f[h--]=0,a=1}for(s=f.length;f[--s]===0;)f.pop()}return y&&(e.e>m.maxE?(e.d=null,e.e=NaN):e.e<m.minE&&(e.e=0,e.d=[0])),e}function $(e,t,n){if(!e.isFinite())return it(e);var i,r=e.e,s=b(e.d),o=s.length;return t?(n&&(i=n-o)>0?s=s.charAt(0)+"."+s.slice(1)+z(i):o>1&&(s=s.charAt(0)+"."+s.slice(1)),s=s+(e.e<0?"e":"e+")+e.e):r<0?(s="0."+z(-r-1)+s,n&&(i=n-o)>0&&(s+=z(i))):r>=o?(s+=z(r+1-o),n&&(i=n-r-1)>0&&(s=s+"."+z(i))):((i=r+1)<o&&(s=s.slice(0,i)+"."+s.slice(i)),n&&(i=n-o)>0&&(r+1===o&&(s+="."),s+=z(i))),s}function pe(e,t){var n=e[0];for(t*=v;n>=10;n/=10)t++;return t}function me(e,t,n){if(t>Bt)throw y=!0,n&&(e.precision=n),Error(ze);return T(new e(le),t,1,!0)}function G(e,t,n){if(t>xe)throw Error(ze);return T(new e(fe),t,n,!0)}function Ke(e){var t=e.length-1,n=t*v+1;if(t=e[t],t){for(;t%10==0;t/=10)n--;for(t=e[0];t>=10;t/=10)n++}return n}function z(e){for(var t="";e--;)t+="0";return t}function et(e,t,n,i){var r,s=new e(1),o=Math.ceil(i/v+4);for(y=!1;;){if(n%2&&(s=s.times(t),st(s.d,o)&&(r=!0)),n=L(n/2),n===0){n=s.d.length-1,r&&s.d[n]===0&&++s.d[n];break}t=t.times(t),st(t.d,o)}return y=!0,s}function tt(e){return e.d[e.d.length-1]&1}function nt(e,t,n){for(var i,r,s=new e(t[0]),o=0;++o<t.length;){if(r=new e(t[o]),!r.s){s=r;break}i=s.cmp(r),(i===n||i===0&&s.s===n)&&(s=r)}return s}function Ce(e,t){var n,i,r,s,o,a,u,c=0,l=0,f=0,h=e.constructor,m=h.rounding,N=h.precision;if(!e.d||!e.d[0]||e.e>17)return new h(e.d?e.d[0]?e.s<0?0:1/0:1:e.s?e.s<0?0:e:NaN);for(t==null?(y=!1,u=N):u=t,a=new h(.03125);e.e>-2;)e=e.times(a),f+=5;for(i=Math.log(C(2,f))/Math.LN10*2+5|0,u+=i,n=s=o=new h(1),h.precision=u;;){if(s=T(s.times(e),u,1),n=n.times(++l),a=o.plus(S(s,n,u,1)),b(a.d).slice(0,u)===b(o.d).slice(0,u)){for(r=f;r--;)o=T(o.times(o),u,1);if(t==null)if(c<3&&oe(o.d,u-i,m,c))h.precision=u+=10,n=s=a=new h(1),l=0,c++;else return T(o,h.precision=N,m,y=!0);else return h.precision=N,o}o=a}}function Z(e,t){var n,i,r,s,o,a,u,c,l,f,h,m=1,N=10,E=e,R=E.d,A=E.constructor,P=A.rounding,O=A.precision;if(E.s<0||!R||!R[0]||!E.e&&R[0]==1&&R.length==1)return new A(R&&!R[0]?-1/0:E.s!=1?NaN:R?0:E);if(t==null?(y=!1,l=O):l=t,A.precision=l+=N,n=b(R),i=n.charAt(0),Math.abs(s=E.e)<15e14){for(;i<7&&i!=1||i==1&&n.charAt(1)>3;)E=E.times(e),n=b(E.d),i=n.charAt(0),m++;s=E.e,i>1?(E=new A("0."+n),s++):E=new A(i+"."+n.slice(1))}else return c=me(A,l+2,O).times(s+""),E=Z(new A(i+"."+n.slice(1)),l-N).plus(c),A.precision=O,t==null?T(E,O,P,y=!0):E;for(f=E,u=o=E=S(E.minus(1),E.plus(1),l,1),h=T(E.times(E),l,1),r=3;;){if(o=T(o.times(h),l,1),c=u.plus(S(o,new A(r),l,1)),b(c.d).slice(0,l)===b(u.d).slice(0,l))if(u=u.times(2),s!==0&&(u=u.plus(me(A,l+2,O).times(s+""))),u=S(u,new A(m),l,1),t==null)if(oe(u.d,l-N,P,a))A.precision=l+=N,c=o=E=S(f.minus(1),f.plus(1),l,1),h=T(E.times(E),l,1),r=a=1;else return T(u,A.precision=O,P,y=!0);else return A.precision=O,u;u=c,r+=2}}function it(e){return String(e.s*e.s/0)}function ge(e,t){var n,i,r;for((n=t.indexOf("."))>-1&&(t=t.replace(".","")),(i=t.search(/e/i))>0?(n<0&&(n=i),n+=+t.slice(i+1),t=t.substring(0,i)):n<0&&(n=t.length),i=0;t.charCodeAt(i)===48;i++);for(r=t.length;t.charCodeAt(r-1)===48;--r);if(t=t.slice(i,r),t){if(r-=i,e.e=n=n-i-1,e.d=[],i=(n+1)%v,n<0&&(i+=v),i<r){for(i&&e.d.push(+t.slice(0,i)),r-=v;i<r;)e.d.push(+t.slice(i,i+=v));t=t.slice(i),i=v-t.length}else i-=r;for(;i--;)t+="0";e.d.push(+t),y&&(e.e>e.constructor.maxE?(e.d=null,e.e=NaN):e.e<e.constructor.minE&&(e.e=0,e.d=[0]))}else e.e=0,e.d=[0];return e}function Vt(e,t){var n,i,r,s,o,a,u,c,l;if(t.indexOf("_")>-1){if(t=t.replace(/(\d)_(?=\d)/g,"$1"),We.test(t))return ge(e,t)}else if(t==="Infinity"||t==="NaN")return+t||(e.s=NaN),e.e=NaN,e.d=null,e;if(Ft.test(t))n=16,t=t.toLowerCase();else if(Mt.test(t))n=2;else if(Pt.test(t))n=8;else throw Error(Q+t);for(s=t.search(/p/i),s>0?(u=+t.slice(s+1),t=t.substring(2,s)):t=t.slice(2),s=t.indexOf("."),o=s>=0,i=e.constructor,o&&(t=t.replace(".",""),a=t.length,s=a-s,r=et(i,new i(n),s,s*2)),c=de(t,n,B),l=c.length-1,s=l;c[s]===0;--s)c.pop();return s<0?new i(e.s*0):(e.e=pe(c,l),e.d=c,y=!1,o&&(e=S(e,r,a*4)),u&&(e=e.times(Math.abs(u)<54?C(2,u):te.pow(2,u))),y=!0,e)}function jt(e,t){var n,i=t.d.length;if(i<3)return t.isZero()?t:ee(e,2,t,t);n=1.4*Math.sqrt(i),n=n>16?16:n|0,t=t.times(1/Ee(5,n)),t=ee(e,2,t,t);for(var r,s=new e(5),o=new e(16),a=new e(20);n--;)r=t.times(t),t=t.times(s.plus(r.times(o.times(r).minus(a))));return t}function ee(e,t,n,i,r){var s,o,a,u,c=e.precision,l=Math.ceil(c/v);for(y=!1,u=n.times(n),a=new e(i);;){if(o=S(a.times(u),new e(t++*t++),c,1),a=r?i.plus(o):i.minus(o),i=S(o.times(u),new e(t++*t++),c,1),o=a.plus(i),o.d[l]!==void 0){for(s=l;o.d[s]===a.d[s]&&s--;);if(s==-1)break}s=a,a=i,i=o,o=s}return y=!0,o.d.length=l+1,o}function Ee(e,t){for(var n=e;--t;)n*=e;return n}function rt(e,t){var n,i=t.s<0,r=G(e,e.precision,1),s=r.times(.5);if(t=t.abs(),t.lte(s))return H=i?4:1,t;if(n=t.divToInt(r),n.isZero())H=i?3:2;else{if(t=t.minus(n.times(r)),t.lte(s))return H=tt(n)?i?2:3:i?4:1,t;H=tt(n)?i?1:4:i?3:2}return t.minus(r).abs()}function ke(e,t,n,i){var r,s,o,a,u,c,l,f,h,m=e.constructor,N=n!==void 0;if(N?(F(n,1,J),i===void 0?i=m.rounding:F(i,0,8)):(n=m.precision,i=m.rounding),!e.isFinite())l=it(e);else{for(l=$(e),o=l.indexOf("."),N?(r=2,t==16?n=n*4-3:t==8&&(n=n*3-2)):r=t,o>=0&&(l=l.replace(".",""),h=new m(1),h.e=l.length-o,h.d=de($(h),10,r),h.e=h.d.length),f=de(l,10,r),s=u=f.length;f[--u]==0;)f.pop();if(!f[0])l=N?"0p+0":"0";else{if(o<0?s--:(e=new m(e),e.d=f,e.e=s,e=S(e,h,n,i,0,r),f=e.d,s=e.e,c=Qe),o=f[n],a=r/2,c=c||f[n+1]!==void 0,c=i<4?(o!==void 0||c)&&(i===0||i===(e.s<0?3:2)):o>a||o===a&&(i===4||c||i===6&&f[n-1]&1||i===(e.s<0?8:7)),f.length=n,c)for(;++f[--n]>r-1;)f[n]=0,n||(++s,f.unshift(1));for(u=f.length;!f[u-1];--u);for(o=0,l="";o<u;o++)l+=De.charAt(f[o]);if(N){if(u>1)if(t==16||t==8){for(o=t==16?4:3,--u;u%o;u++)l+="0";for(f=de(l,r,t),u=f.length;!f[u-1];--u);for(o=1,l="1.";o<u;o++)l+=De.charAt(f[o])}else l=l.charAt(0)+"."+l.slice(1);l=l+(s<0?"p":"p+")+s}else if(s<0){for(;++s;)l="0"+l;l="0."+l}else if(++s>u)for(s-=u;s--;)l+="0";else s<u&&(l=l.slice(0,s)+"."+l.slice(s))}l=(t==16?"0x":t==2?"0b":t==8?"0o":"")+l}return e.s<0?"-"+l:l}function st(e,t){if(e.length>t)return e.length=t,!0}function $t(e){return new this(e).abs()}function Gt(e){return new this(e).acos()}function Yt(e){return new this(e).acosh()}function Ht(e,t){return new this(e).plus(t)}function Jt(e){return new this(e).asin()}function Qt(e){return new this(e).asinh()}function zt(e){return new this(e).atan()}function Zt(e){return new this(e).atanh()}function Xt(e,t){e=new this(e),t=new this(t);var n,i=this.precision,r=this.rounding,s=i+4;return!e.s||!t.s?n=new this(NaN):!e.d&&!t.d?(n=G(this,s,1).times(t.s>0?.25:.75),n.s=e.s):!t.d||e.isZero()?(n=t.s<0?G(this,i,r):new this(0),n.s=e.s):!e.d||t.isZero()?(n=G(this,s,1).times(.5),n.s=e.s):t.s<0?(this.precision=s,this.rounding=1,n=this.atan(S(e,t,s,1)),t=G(this,s,1),this.precision=i,this.rounding=r,n=e.s<0?n.minus(t):n.plus(t)):n=this.atan(S(e,t,s,1)),n}function Wt(e){return new this(e).cbrt()}function Kt(e){return T(e=new this(e),e.e+1,2)}function en(e,t,n){return new this(e).clamp(t,n)}function tn(e){if(!e||typeof e!="object")throw Error(he+"Object expected");var t,n,i,r=e.defaults===!0,s=["precision",1,J,"rounding",0,8,"toExpNeg",-j,0,"toExpPos",0,j,"maxE",0,j,"minE",-j,0,"modulo",0,9];for(t=0;t<s.length;t+=3)if(n=s[t],r&&(this[n]=_e[n]),(i=e[n])!==void 0)if(L(i)===i&&i>=s[t+1]&&i<=s[t+2])this[n]=i;else throw Error(Q+n+": "+i);if(n="crypto",r&&(this[n]=_e[n]),(i=e[n])!==void 0)if(i===!0||i===!1||i===0||i===1)if(i)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))this[n]=!0;else throw Error(Ze);else this[n]=!1;else throw Error(Q+n+": "+i);return this}function nn(e){return new this(e).cos()}function rn(e){return new this(e).cosh()}function ot(e){var t,n,i;function r(s){var o,a,u,c=this;if(!(c instanceof r))return new r(s);if(c.constructor=r,at(s)){c.s=s.s,y?!s.d||s.e>r.maxE?(c.e=NaN,c.d=null):s.e<r.minE?(c.e=0,c.d=[0]):(c.e=s.e,c.d=s.d.slice()):(c.e=s.e,c.d=s.d?s.d.slice():s.d);return}if(u=typeof s,u==="number"){if(s===0){c.s=1/s<0?-1:1,c.e=0,c.d=[0];return}if(s<0?(s=-s,c.s=-1):c.s=1,s===~~s&&s<1e7){for(o=0,a=s;a>=10;a/=10)o++;y?o>r.maxE?(c.e=NaN,c.d=null):o<r.minE?(c.e=0,c.d=[0]):(c.e=o,c.d=[s]):(c.e=o,c.d=[s]);return}if(s*0!==0){s||(c.s=NaN),c.e=NaN,c.d=null;return}return ge(c,s.toString())}if(u==="string")return(a=s.charCodeAt(0))===45?(s=s.slice(1),c.s=-1):(a===43&&(s=s.slice(1)),c.s=1),We.test(s)?ge(c,s):Vt(c,s);if(u==="bigint")return s<0?(s=-s,c.s=-1):c.s=1,ge(c,s.toString());throw Error(Q+s)}if(r.prototype=p,r.ROUND_UP=0,r.ROUND_DOWN=1,r.ROUND_CEIL=2,r.ROUND_FLOOR=3,r.ROUND_HALF_UP=4,r.ROUND_HALF_DOWN=5,r.ROUND_HALF_EVEN=6,r.ROUND_HALF_CEIL=7,r.ROUND_HALF_FLOOR=8,r.EUCLID=9,r.config=r.set=tn,r.clone=ot,r.isDecimal=at,r.abs=$t,r.acos=Gt,r.acosh=Yt,r.add=Ht,r.asin=Jt,r.asinh=Qt,r.atan=zt,r.atanh=Zt,r.atan2=Xt,r.cbrt=Wt,r.ceil=Kt,r.clamp=en,r.cos=nn,r.cosh=rn,r.div=sn,r.exp=on,r.floor=an,r.hypot=cn,r.ln=un,r.log=ln,r.log10=hn,r.log2=fn,r.max=dn,r.min=pn,r.mod=mn,r.mul=gn,r.pow=En,r.random=Nn,r.round=Tn,r.sign=wn,r.sin=vn,r.sinh=yn,r.sqrt=In,r.sub=On,r.sum=An,r.tan=Sn,r.tanh=Dn,r.trunc=_n,e===void 0&&(e={}),e&&e.defaults!==!0)for(i=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],t=0;t<i.length;)e.hasOwnProperty(n=i[t++])||(e[n]=this[n]);return r.config(e),r}function sn(e,t){return new this(e).div(t)}function on(e){return new this(e).exp()}function an(e){return T(e=new this(e),e.e+1,3)}function cn(){var e,t,n=new this(0);for(y=!1,e=0;e<arguments.length;)if(t=new this(arguments[e++]),t.d)n.d&&(n=n.plus(t.times(t)));else{if(t.s)return y=!0,new this(1/0);n=t}return y=!0,n.sqrt()}function at(e){return e instanceof te||e&&e.toStringTag===Xe||!1}function un(e){return new this(e).ln()}function ln(e,t){return new this(e).log(t)}function fn(e){return new this(e).log(2)}function hn(e){return new this(e).log(10)}function dn(){return nt(this,arguments,-1)}function pn(){return nt(this,arguments,1)}function mn(e,t){return new this(e).mod(t)}function gn(e,t){return new this(e).mul(t)}function En(e,t){return new this(e).pow(t)}function Nn(e){var t,n,i,r,s=0,o=new this(1),a=[];if(e===void 0?e=this.precision:F(e,1,J),i=Math.ceil(e/v),this.crypto)if(crypto.getRandomValues)for(t=crypto.getRandomValues(new Uint32Array(i));s<i;)r=t[s],r>=429e7?t[s]=crypto.getRandomValues(new Uint32Array(1))[0]:a[s++]=r%1e7;else if(crypto.randomBytes){for(t=crypto.randomBytes(i*=4);s<i;)r=t[s]+(t[s+1]<<8)+(t[s+2]<<16)+((t[s+3]&127)<<24),r>=214e7?crypto.randomBytes(4).copy(t,s):(a.push(r%1e7),s+=4);s=i/4}else throw Error(Ze);else for(;s<i;)a[s++]=Math.random()*1e7|0;for(i=a[--s],e%=v,i&&e&&(r=C(10,v-e),a[s]=(i/r|0)*r);a[s]===0;s--)a.pop();if(s<0)n=0,a=[0];else{for(n=-1;a[0]===0;n-=v)a.shift();for(i=1,r=a[0];r>=10;r/=10)i++;i<v&&(n-=v-i)}return o.e=n,o.d=a,o}function Tn(e){return T(e=new this(e),e.e+1,this.rounding)}function wn(e){return e=new this(e),e.d?e.d[0]?e.s:0*e.s:e.s||NaN}function vn(e){return new this(e).sin()}function yn(e){return new this(e).sinh()}function In(e){return new this(e).sqrt()}function On(e,t){return new this(e).sub(t)}function An(){var e=0,t=arguments,n=new this(t[e]);for(y=!1;n.s&&++e<t.length;)n=n.plus(t[e]);return y=!0,T(n,this.precision,this.rounding)}function Sn(e){return new this(e).tan()}function Dn(e){return new this(e).tanh()}function _n(e){return T(e=new this(e),e.e+1,1)}p[Symbol.for("nodejs.util.inspect.custom")]=p.toString,p[Symbol.toStringTag]="Decimal";var te=p.constructor=ot(_e);le=new te(le),fe=new te(fe);class W extends Error{response;request;constructor(t,n){const i=`${W.extractMessage(t)}: ${JSON.stringify({response:t,request:n})}`;super(i),Object.setPrototypeOf(this,W.prototype),this.response=t,this.request=n,typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,W)}static extractMessage(t){return t.errors?.[0]?.message??`GraphQL Error (Code: ${String(t.status)})`}}const ct=e=>e.toUpperCase(),Re=e=>typeof e=="function"?e():e,ut=(e,t)=>e.map((n,i)=>[n,t[i]]),ne=e=>{let t={};return e instanceof Headers?t=xn(e):Array.isArray(e)?e.forEach(([n,i])=>{n&&i!==void 0&&(t[n]=i)}):e&&(t=e),t},xn=e=>{const t={};return e.forEach((n,i)=>{t[i]=n}),t},Cn=e=>{try{const t=e();return kn(t)?t.catch(n=>lt(n)):t}catch(t){return lt(t)}},lt=e=>e instanceof Error?e:new Error(String(e)),kn=e=>typeof e=="object"&&e!==null&&"then"in e&&typeof e.then=="function"&&"catch"in e&&typeof e.catch=="function"&&"finally"in e&&typeof e.finally=="function",be=e=>{throw new Error(`Unhandled case: ${String(e)}`)},Ne=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Rn=(e,t)=>e.documents?e:{documents:e,requestHeaders:t,signal:void 0},bn=(e,t,n)=>e.query?e:{query:e,variables:t,requestHeaders:n,signal:void 0};function Te(e,t){if(!!!e)throw new Error(t)}function Ln(e){return typeof e=="object"&&e!==null}function Mn(e,t){if(!!!e)throw new Error("Unexpected invariant triggered.")}const Fn=/\r\n|[\n\r]/g;function Le(e,t){let n=0,i=1;for(const r of e.body.matchAll(Fn)){if(typeof r.index=="number"||Mn(!1),r.index>=t)break;n=r.index+r[0].length,i+=1}return{line:i,column:t+1-n}}function Pn(e){return ft(e.source,Le(e.source,e.start))}function ft(e,t){const n=e.locationOffset.column-1,i="".padStart(n)+e.body,r=t.line-1,s=e.locationOffset.line-1,o=t.line+s,a=t.line===1?n:0,u=t.column+a,c=`${e.name}:${o}:${u}
2
- `,l=i.split(/\r\n|[\n\r]/g),f=l[r];if(f.length>120){const h=Math.floor(u/80),m=u%80,N=[];for(let E=0;E<f.length;E+=80)N.push(f.slice(E,E+80));return c+ht([[`${o} |`,N[0]],...N.slice(1,h+1).map(E=>["|",E]),["|","^".padStart(m)],["|",N[h+1]]])}return c+ht([[`${o-1} |`,l[r-1]],[`${o} |`,f],["|","^".padStart(u)],[`${o+1} |`,l[r+1]]])}function ht(e){const t=e.filter(([i,r])=>r!==void 0),n=Math.max(...t.map(([i])=>i.length));return t.map(([i,r])=>i.padStart(n)+(r?" "+r:"")).join(`
3
- `)}function qn(e){const t=e[0];return t==null||"kind"in t||"length"in t?{nodes:t,source:e[1],positions:e[2],path:e[3],originalError:e[4],extensions:e[5]}:t}class Me extends Error{constructor(t,...n){var i,r,s;const{nodes:o,source:a,positions:u,path:c,originalError:l,extensions:f}=qn(n);super(t),this.name="GraphQLError",this.path=c??void 0,this.originalError=l??void 0,this.nodes=dt(Array.isArray(o)?o:o?[o]:void 0);const h=dt((i=this.nodes)===null||i===void 0?void 0:i.map(N=>N.loc).filter(N=>N!=null));this.source=a??(h==null||(r=h[0])===null||r===void 0?void 0:r.source),this.positions=u??h?.map(N=>N.start),this.locations=u&&a?u.map(N=>Le(a,N)):h?.map(N=>Le(N.source,N.start));const m=Ln(l?.extensions)?l?.extensions:void 0;this.extensions=(s=f??m)!==null&&s!==void 0?s: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}}),l!=null&&l.stack?Object.defineProperty(this,"stack",{value:l.stack,writable:!0,configurable:!0}):Error.captureStackTrace?Error.captureStackTrace(this,Me):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(const n of this.nodes)n.loc&&(t+=`
4
-
5
- `+Pn(n.loc));else if(this.source&&this.locations)for(const n of this.locations)t+=`
6
-
7
- `+ft(this.source,n);return t}toJSON(){const 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 dt(e){return e===void 0||e.length===0?void 0:e}function k(e,t,n){return new Me(`Syntax Error: ${n}`,{source:e,positions:[t]})}class Bn{constructor(t,n,i){this.start=t.start,this.end=n.end,this.startToken=t,this.endToken=n,this.source=i}get[Symbol.toStringTag](){return"Location"}toJSON(){return{start:this.start,end:this.end}}}class pt{constructor(t,n,i,r,s,o){this.kind=t,this.start=n,this.end=i,this.line=r,this.column=s,this.value=o,this.prev=null,this.next=null}get[Symbol.toStringTag](){return"Token"}toJSON(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}}}const mt={Name:[],Document:["definitions"],OperationDefinition:["description","name","variableDefinitions","directives","selectionSet"],VariableDefinition:["description","variable","type","defaultValue","directives"],Variable:["name"],SelectionSet:["selections"],Field:["alias","name","arguments","directives","selectionSet"],Argument:["name","value"],FragmentSpread:["name","directives"],InlineFragment:["typeCondition","directives","selectionSet"],FragmentDefinition:["description","name","variableDefinitions","typeCondition","directives","selectionSet"],IntValue:[],FloatValue:[],StringValue:[],BooleanValue:[],NullValue:[],EnumValue:[],ListValue:["values"],ObjectValue:["fields"],ObjectField:["name","value"],Directive:["name","arguments"],NamedType:["name"],ListType:["type"],NonNullType:["type"],SchemaDefinition:["description","directives","operationTypes"],OperationTypeDefinition:["type"],ScalarTypeDefinition:["description","name","directives"],ObjectTypeDefinition:["description","name","interfaces","directives","fields"],FieldDefinition:["description","name","arguments","type","directives"],InputValueDefinition:["description","name","type","defaultValue","directives"],InterfaceTypeDefinition:["description","name","interfaces","directives","fields"],UnionTypeDefinition:["description","name","directives","types"],EnumTypeDefinition:["description","name","directives","values"],EnumValueDefinition:["description","name","directives"],InputObjectTypeDefinition:["description","name","directives","fields"],DirectiveDefinition:["description","name","arguments","locations"],SchemaExtension:["directives","operationTypes"],ScalarTypeExtension:["name","directives"],ObjectTypeExtension:["name","interfaces","directives","fields"],InterfaceTypeExtension:["name","interfaces","directives","fields"],UnionTypeExtension:["name","directives","types"],EnumTypeExtension:["name","directives","values"],InputObjectTypeExtension:["name","directives","fields"],TypeCoordinate:["name"],MemberCoordinate:["name","memberName"],ArgumentCoordinate:["name","fieldName","argumentName"],DirectiveCoordinate:["name"],DirectiveArgumentCoordinate:["name","argumentName"]},Un=new Set(Object.keys(mt));function gt(e){const t=e?.kind;return typeof t=="string"&&Un.has(t)}var ie;(function(e){e.QUERY="query",e.MUTATION="mutation",e.SUBSCRIPTION="subscription"})(ie||(ie={}));var Fe;(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"})(Fe||(Fe={}));var w;(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",e.TYPE_COORDINATE="TypeCoordinate",e.MEMBER_COORDINATE="MemberCoordinate",e.ARGUMENT_COORDINATE="ArgumentCoordinate",e.DIRECTIVE_COORDINATE="DirectiveCoordinate",e.DIRECTIVE_ARGUMENT_COORDINATE="DirectiveArgumentCoordinate"})(w||(w={}));function Pe(e){return e===9||e===32}function ae(e){return e>=48&&e<=57}function Et(e){return e>=97&&e<=122||e>=65&&e<=90}function Nt(e){return Et(e)||e===95}function Vn(e){return Et(e)||ae(e)||e===95}function jn(e){var t;let n=Number.MAX_SAFE_INTEGER,i=null,r=-1;for(let o=0;o<e.length;++o){var s;const a=e[o],u=$n(a);u!==a.length&&(i=(s=i)!==null&&s!==void 0?s:o,r=o,o!==0&&u<n&&(n=u))}return e.map((o,a)=>a===0?o:o.slice(n)).slice((t=i)!==null&&t!==void 0?t:0,r+1)}function $n(e){let t=0;for(;t<e.length&&Pe(e.charCodeAt(t));)++t;return t}function Gn(e,t){const n=e.replace(/"""/g,'\\"""'),i=n.split(/\r\n|[\n\r]/g),r=i.length===1,s=i.length>1&&i.slice(1).every(m=>m.length===0||Pe(m.charCodeAt(0))),o=n.endsWith('\\"""'),a=e.endsWith('"')&&!o,u=e.endsWith("\\"),c=a||u,l=!r||e.length>70||c||s||o;let f="";const h=r&&Pe(e.charCodeAt(0));return(l&&!h||s)&&(f+=`
8
- `),f+=n,(l||c)&&(f+=`
9
- `),'"""'+f+'"""'}var d;(function(e){e.SOF="<SOF>",e.EOF="<EOF>",e.BANG="!",e.DOLLAR="$",e.AMP="&",e.PAREN_L="(",e.PAREN_R=")",e.DOT=".",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"})(d||(d={}));class Yn{constructor(t){const n=new pt(d.SOF,0,0,0,0);this.source=t,this.lastToken=n,this.token=n,this.line=1,this.lineStart=0}get[Symbol.toStringTag](){return"Lexer"}advance(){return this.lastToken=this.token,this.token=this.lookahead()}lookahead(){let t=this.token;if(t.kind!==d.EOF)do if(t.next)t=t.next;else{const n=Jn(this,t.end);t.next=n,n.prev=t,t=n}while(t.kind===d.COMMENT);return t}}function Hn(e){return e===d.BANG||e===d.DOLLAR||e===d.AMP||e===d.PAREN_L||e===d.PAREN_R||e===d.DOT||e===d.SPREAD||e===d.COLON||e===d.EQUALS||e===d.AT||e===d.BRACKET_L||e===d.BRACKET_R||e===d.BRACE_L||e===d.PIPE||e===d.BRACE_R}function re(e){return e>=0&&e<=55295||e>=57344&&e<=1114111}function we(e,t){return Tt(e.charCodeAt(t))&&wt(e.charCodeAt(t+1))}function Tt(e){return e>=55296&&e<=56319}function wt(e){return e>=56320&&e<=57343}function K(e,t){const n=e.source.body.codePointAt(t);if(n===void 0)return d.EOF;if(n>=32&&n<=126){const i=String.fromCodePoint(n);return i==='"'?`'"'`:`"${i}"`}return"U+"+n.toString(16).toUpperCase().padStart(4,"0")}function x(e,t,n,i,r){const s=e.line,o=1+n-e.lineStart;return new pt(t,n,i,s,o,r)}function Jn(e,t){const n=e.source.body,i=n.length;let r=t;for(;r<i;){const s=n.charCodeAt(r);switch(s){case 65279:case 9:case 32:case 44:++r;continue;case 10:++r,++e.line,e.lineStart=r;continue;case 13:n.charCodeAt(r+1)===10?r+=2:++r,++e.line,e.lineStart=r;continue;case 35:return Qn(e,r);case 33:return x(e,d.BANG,r,r+1);case 36:return x(e,d.DOLLAR,r,r+1);case 38:return x(e,d.AMP,r,r+1);case 40:return x(e,d.PAREN_L,r,r+1);case 41:return x(e,d.PAREN_R,r,r+1);case 46:if(n.charCodeAt(r+1)===46&&n.charCodeAt(r+2)===46)return x(e,d.SPREAD,r,r+3);break;case 58:return x(e,d.COLON,r,r+1);case 61:return x(e,d.EQUALS,r,r+1);case 64:return x(e,d.AT,r,r+1);case 91:return x(e,d.BRACKET_L,r,r+1);case 93:return x(e,d.BRACKET_R,r,r+1);case 123:return x(e,d.BRACE_L,r,r+1);case 124:return x(e,d.PIPE,r,r+1);case 125:return x(e,d.BRACE_R,r,r+1);case 34:return n.charCodeAt(r+1)===34&&n.charCodeAt(r+2)===34?ei(e,r):Zn(e,r)}if(ae(s)||s===45)return zn(e,r,s);if(Nt(s))return ti(e,r);throw k(e.source,r,s===39?`Unexpected single quote character ('), did you mean to use a double quote (")?`:re(s)||we(n,r)?`Unexpected character: ${K(e,r)}.`:`Invalid character: ${K(e,r)}.`)}return x(e,d.EOF,i,i)}function Qn(e,t){const n=e.source.body,i=n.length;let r=t+1;for(;r<i;){const s=n.charCodeAt(r);if(s===10||s===13)break;if(re(s))++r;else if(we(n,r))r+=2;else break}return x(e,d.COMMENT,t,r,n.slice(t+1,r))}function zn(e,t,n){const i=e.source.body;let r=t,s=n,o=!1;if(s===45&&(s=i.charCodeAt(++r)),s===48){if(s=i.charCodeAt(++r),ae(s))throw k(e.source,r,`Invalid number, unexpected digit after 0: ${K(e,r)}.`)}else r=qe(e,r,s),s=i.charCodeAt(r);if(s===46&&(o=!0,s=i.charCodeAt(++r),r=qe(e,r,s),s=i.charCodeAt(r)),(s===69||s===101)&&(o=!0,s=i.charCodeAt(++r),(s===43||s===45)&&(s=i.charCodeAt(++r)),r=qe(e,r,s),s=i.charCodeAt(r)),s===46||Nt(s))throw k(e.source,r,`Invalid number, expected digit but got: ${K(e,r)}.`);return x(e,o?d.FLOAT:d.INT,t,r,i.slice(t,r))}function qe(e,t,n){if(!ae(n))throw k(e.source,t,`Invalid number, expected digit but got: ${K(e,t)}.`);const i=e.source.body;let r=t+1;for(;ae(i.charCodeAt(r));)++r;return r}function Zn(e,t){const n=e.source.body,i=n.length;let r=t+1,s=r,o="";for(;r<i;){const a=n.charCodeAt(r);if(a===34)return o+=n.slice(s,r),x(e,d.STRING,t,r+1,o);if(a===92){o+=n.slice(s,r);const u=n.charCodeAt(r+1)===117?n.charCodeAt(r+2)===123?Xn(e,r):Wn(e,r):Kn(e,r);o+=u.value,r+=u.size,s=r;continue}if(a===10||a===13)break;if(re(a))++r;else if(we(n,r))r+=2;else throw k(e.source,r,`Invalid character within String: ${K(e,r)}.`)}throw k(e.source,r,"Unterminated string.")}function Xn(e,t){const n=e.source.body;let i=0,r=3;for(;r<12;){const s=n.charCodeAt(t+r++);if(s===125){if(r<5||!re(i))break;return{value:String.fromCodePoint(i),size:r}}if(i=i<<4|ce(s),i<0)break}throw k(e.source,t,`Invalid Unicode escape sequence: "${n.slice(t,t+r)}".`)}function Wn(e,t){const n=e.source.body,i=vt(n,t+2);if(re(i))return{value:String.fromCodePoint(i),size:6};if(Tt(i)&&n.charCodeAt(t+6)===92&&n.charCodeAt(t+7)===117){const r=vt(n,t+8);if(wt(r))return{value:String.fromCodePoint(i,r),size:12}}throw k(e.source,t,`Invalid Unicode escape sequence: "${n.slice(t,t+6)}".`)}function vt(e,t){return ce(e.charCodeAt(t))<<12|ce(e.charCodeAt(t+1))<<8|ce(e.charCodeAt(t+2))<<4|ce(e.charCodeAt(t+3))}function ce(e){return e>=48&&e<=57?e-48:e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:-1}function Kn(e,t){const n=e.source.body;switch(n.charCodeAt(t+1)){case 34:return{value:'"',size:2};case 92:return{value:"\\",size:2};case 47:return{value:"/",size:2};case 98:return{value:"\b",size:2};case 102:return{value:"\f",size:2};case 110:return{value:`
10
- `,size:2};case 114:return{value:"\r",size:2};case 116:return{value:" ",size:2}}throw k(e.source,t,`Invalid character escape sequence: "${n.slice(t,t+2)}".`)}function ei(e,t){const n=e.source.body,i=n.length;let r=e.lineStart,s=t+3,o=s,a="";const u=[];for(;s<i;){const c=n.charCodeAt(s);if(c===34&&n.charCodeAt(s+1)===34&&n.charCodeAt(s+2)===34){a+=n.slice(o,s),u.push(a);const l=x(e,d.BLOCK_STRING,t,s+3,jn(u).join(`
11
- `));return e.line+=u.length-1,e.lineStart=r,l}if(c===92&&n.charCodeAt(s+1)===34&&n.charCodeAt(s+2)===34&&n.charCodeAt(s+3)===34){a+=n.slice(o,s),o=s+1,s+=4;continue}if(c===10||c===13){a+=n.slice(o,s),u.push(a),c===13&&n.charCodeAt(s+1)===10?s+=2:++s,a="",o=s,r=s;continue}if(re(c))++s;else if(we(n,s))s+=2;else throw k(e.source,s,`Invalid character within String: ${K(e,s)}.`)}throw k(e.source,s,"Unterminated string.")}function ti(e,t){const n=e.source.body,i=n.length;let r=t+1;for(;r<i;){const s=n.charCodeAt(r);if(Vn(s))++r;else break}return x(e,d.NAME,t,r,n.slice(t,r))}const ni=10,yt=2;function Be(e){return ve(e,[])}function ve(e,t){switch(typeof e){case"string":return JSON.stringify(e);case"function":return e.name?`[function ${e.name}]`:"[function]";case"object":return ii(e,t);default:return String(e)}}function ii(e,t){if(e===null)return"null";if(t.includes(e))return"[Circular]";const n=[...t,e];if(ri(e)){const i=e.toJSON();if(i!==e)return typeof i=="string"?i:ve(i,n)}else if(Array.isArray(e))return oi(e,n);return si(e,n)}function ri(e){return typeof e.toJSON=="function"}function si(e,t){const n=Object.entries(e);return n.length===0?"{}":t.length>yt?"["+ai(e)+"]":"{ "+n.map(([r,s])=>r+": "+ve(s,t)).join(", ")+" }"}function oi(e,t){if(e.length===0)return"[]";if(t.length>yt)return"[Array]";const n=Math.min(ni,e.length),i=e.length-n,r=[];for(let s=0;s<n;++s)r.push(ve(e[s],t));return i===1?r.push("... 1 more item"):i>1&&r.push(`... ${i} more items`),"["+r.join(", ")+"]"}function ai(e){const t=Object.prototype.toString.call(e).replace(/^\[object /,"").replace(/]$/,"");if(t==="Object"&&typeof e.constructor=="function"){const n=e.constructor.name;if(typeof n=="string"&&n!=="")return n}return t}const ci=globalThis.process&&process.env.NODE_ENV==="production"?function(t,n){return t instanceof n}:function(t,n){if(t instanceof n)return!0;if(typeof t=="object"&&t!==null){var i;const r=n.prototype[Symbol.toStringTag],s=Symbol.toStringTag in t?t[Symbol.toStringTag]:(i=t.constructor)===null||i===void 0?void 0:i.name;if(r===s){const o=Be(t);throw new Error(`Cannot use ${r} "${o}" from another module or realm.
12
-
13
- Ensure that there is only one instance of "graphql" in the node_modules
14
- directory. If different versions of "graphql" are the dependencies of other
15
- relied on modules, use "resolutions" to ensure only one version is installed.
16
-
17
- https://yarnpkg.com/en/docs/selective-version-resolutions
18
-
19
- Duplicate "graphql" modules cannot be used at the same time since different
20
- versions may have different capabilities and behavior. The data from one
21
- version used in the function from another could produce confusing and
22
- spurious results.`)}}return!1};class It{constructor(t,n="GraphQL request",i={line:1,column:1}){typeof t=="string"||Te(!1,`Body must be a string. Received: ${Be(t)}.`),this.body=t,this.name=n,this.locationOffset=i,this.locationOffset.line>0||Te(!1,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||Te(!1,"column in locationOffset is 1-indexed and must be positive.")}get[Symbol.toStringTag](){return"Source"}}function ui(e){return ci(e,It)}function li(e,t){const n=new fi(e,t),i=n.parseDocument();return Object.defineProperty(i,"tokenCount",{enumerable:!1,value:n.tokenCount}),i}class fi{constructor(t,n={}){const{lexer:i,...r}=n;if(i)this._lexer=i;else{const s=ui(t)?t:new It(t);this._lexer=new Yn(s)}this._options=r,this._tokenCounter=0}get tokenCount(){return this._tokenCounter}parseName(){const t=this.expectToken(d.NAME);return this.node(t,{kind:w.NAME,value:t.value})}parseDocument(){return this.node(this._lexer.token,{kind:w.DOCUMENT,definitions:this.many(d.SOF,this.parseDefinition,d.EOF)})}parseDefinition(){if(this.peek(d.BRACE_L))return this.parseOperationDefinition();const t=this.peekDescription(),n=t?this._lexer.lookahead():this._lexer.token;if(t&&n.kind===d.BRACE_L)throw k(this._lexer.source,this._lexer.token.start,"Unexpected description, descriptions are not supported on shorthand queries.");if(n.kind===d.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 k(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(){const t=this._lexer.token;if(this.peek(d.BRACE_L))return this.node(t,{kind:w.OPERATION_DEFINITION,operation:ie.QUERY,description:void 0,name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet()});const n=this.parseDescription(),i=this.parseOperationType();let r;return this.peek(d.NAME)&&(r=this.parseName()),this.node(t,{kind:w.OPERATION_DEFINITION,operation:i,description:n,name:r,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseOperationType(){const t=this.expectToken(d.NAME);switch(t.value){case"query":return ie.QUERY;case"mutation":return ie.MUTATION;case"subscription":return ie.SUBSCRIPTION}throw this.unexpected(t)}parseVariableDefinitions(){return this.optionalMany(d.PAREN_L,this.parseVariableDefinition,d.PAREN_R)}parseVariableDefinition(){return this.node(this._lexer.token,{kind:w.VARIABLE_DEFINITION,description:this.parseDescription(),variable:this.parseVariable(),type:(this.expectToken(d.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(d.EQUALS)?this.parseConstValueLiteral():void 0,directives:this.parseConstDirectives()})}parseVariable(){const t=this._lexer.token;return this.expectToken(d.DOLLAR),this.node(t,{kind:w.VARIABLE,name:this.parseName()})}parseSelectionSet(){return this.node(this._lexer.token,{kind:w.SELECTION_SET,selections:this.many(d.BRACE_L,this.parseSelection,d.BRACE_R)})}parseSelection(){return this.peek(d.SPREAD)?this.parseFragment():this.parseField()}parseField(){const t=this._lexer.token,n=this.parseName();let i,r;return this.expectOptionalToken(d.COLON)?(i=n,r=this.parseName()):r=n,this.node(t,{kind:w.FIELD,alias:i,name:r,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(d.BRACE_L)?this.parseSelectionSet():void 0})}parseArguments(t){const n=t?this.parseConstArgument:this.parseArgument;return this.optionalMany(d.PAREN_L,n,d.PAREN_R)}parseArgument(t=!1){const n=this._lexer.token,i=this.parseName();return this.expectToken(d.COLON),this.node(n,{kind:w.ARGUMENT,name:i,value:this.parseValueLiteral(t)})}parseConstArgument(){return this.parseArgument(!0)}parseFragment(){const t=this._lexer.token;this.expectToken(d.SPREAD);const n=this.expectOptionalKeyword("on");return!n&&this.peek(d.NAME)?this.node(t,{kind:w.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1)}):this.node(t,{kind:w.INLINE_FRAGMENT,typeCondition:n?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentDefinition(){const t=this._lexer.token,n=this.parseDescription();return this.expectKeyword("fragment"),this._options.allowLegacyFragmentVariables===!0?this.node(t,{kind:w.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:w.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){const n=this._lexer.token;switch(n.kind){case d.BRACKET_L:return this.parseList(t);case d.BRACE_L:return this.parseObject(t);case d.INT:return this.advanceLexer(),this.node(n,{kind:w.INT,value:n.value});case d.FLOAT:return this.advanceLexer(),this.node(n,{kind:w.FLOAT,value:n.value});case d.STRING:case d.BLOCK_STRING:return this.parseStringLiteral();case d.NAME:switch(this.advanceLexer(),n.value){case"true":return this.node(n,{kind:w.BOOLEAN,value:!0});case"false":return this.node(n,{kind:w.BOOLEAN,value:!1});case"null":return this.node(n,{kind:w.NULL});default:return this.node(n,{kind:w.ENUM,value:n.value})}case d.DOLLAR:if(t)if(this.expectToken(d.DOLLAR),this._lexer.token.kind===d.NAME){const i=this._lexer.token.value;throw k(this._lexer.source,n.start,`Unexpected variable "$${i}" in constant value.`)}else throw this.unexpected(n);return this.parseVariable();default:throw this.unexpected()}}parseConstValueLiteral(){return this.parseValueLiteral(!0)}parseStringLiteral(){const t=this._lexer.token;return this.advanceLexer(),this.node(t,{kind:w.STRING,value:t.value,block:t.kind===d.BLOCK_STRING})}parseList(t){const n=()=>this.parseValueLiteral(t);return this.node(this._lexer.token,{kind:w.LIST,values:this.any(d.BRACKET_L,n,d.BRACKET_R)})}parseObject(t){const n=()=>this.parseObjectField(t);return this.node(this._lexer.token,{kind:w.OBJECT,fields:this.any(d.BRACE_L,n,d.BRACE_R)})}parseObjectField(t){const n=this._lexer.token,i=this.parseName();return this.expectToken(d.COLON),this.node(n,{kind:w.OBJECT_FIELD,name:i,value:this.parseValueLiteral(t)})}parseDirectives(t){const n=[];for(;this.peek(d.AT);)n.push(this.parseDirective(t));return n}parseConstDirectives(){return this.parseDirectives(!0)}parseDirective(t){const n=this._lexer.token;return this.expectToken(d.AT),this.node(n,{kind:w.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(t)})}parseTypeReference(){const t=this._lexer.token;let n;if(this.expectOptionalToken(d.BRACKET_L)){const i=this.parseTypeReference();this.expectToken(d.BRACKET_R),n=this.node(t,{kind:w.LIST_TYPE,type:i})}else n=this.parseNamedType();return this.expectOptionalToken(d.BANG)?this.node(t,{kind:w.NON_NULL_TYPE,type:n}):n}parseNamedType(){return this.node(this._lexer.token,{kind:w.NAMED_TYPE,name:this.parseName()})}peekDescription(){return this.peek(d.STRING)||this.peek(d.BLOCK_STRING)}parseDescription(){if(this.peekDescription())return this.parseStringLiteral()}parseSchemaDefinition(){const t=this._lexer.token,n=this.parseDescription();this.expectKeyword("schema");const i=this.parseConstDirectives(),r=this.many(d.BRACE_L,this.parseOperationTypeDefinition,d.BRACE_R);return this.node(t,{kind:w.SCHEMA_DEFINITION,description:n,directives:i,operationTypes:r})}parseOperationTypeDefinition(){const t=this._lexer.token,n=this.parseOperationType();this.expectToken(d.COLON);const i=this.parseNamedType();return this.node(t,{kind:w.OPERATION_TYPE_DEFINITION,operation:n,type:i})}parseScalarTypeDefinition(){const t=this._lexer.token,n=this.parseDescription();this.expectKeyword("scalar");const i=this.parseName(),r=this.parseConstDirectives();return this.node(t,{kind:w.SCALAR_TYPE_DEFINITION,description:n,name:i,directives:r})}parseObjectTypeDefinition(){const t=this._lexer.token,n=this.parseDescription();this.expectKeyword("type");const i=this.parseName(),r=this.parseImplementsInterfaces(),s=this.parseConstDirectives(),o=this.parseFieldsDefinition();return this.node(t,{kind:w.OBJECT_TYPE_DEFINITION,description:n,name:i,interfaces:r,directives:s,fields:o})}parseImplementsInterfaces(){return this.expectOptionalKeyword("implements")?this.delimitedMany(d.AMP,this.parseNamedType):[]}parseFieldsDefinition(){return this.optionalMany(d.BRACE_L,this.parseFieldDefinition,d.BRACE_R)}parseFieldDefinition(){const t=this._lexer.token,n=this.parseDescription(),i=this.parseName(),r=this.parseArgumentDefs();this.expectToken(d.COLON);const s=this.parseTypeReference(),o=this.parseConstDirectives();return this.node(t,{kind:w.FIELD_DEFINITION,description:n,name:i,arguments:r,type:s,directives:o})}parseArgumentDefs(){return this.optionalMany(d.PAREN_L,this.parseInputValueDef,d.PAREN_R)}parseInputValueDef(){const t=this._lexer.token,n=this.parseDescription(),i=this.parseName();this.expectToken(d.COLON);const r=this.parseTypeReference();let s;this.expectOptionalToken(d.EQUALS)&&(s=this.parseConstValueLiteral());const o=this.parseConstDirectives();return this.node(t,{kind:w.INPUT_VALUE_DEFINITION,description:n,name:i,type:r,defaultValue:s,directives:o})}parseInterfaceTypeDefinition(){const t=this._lexer.token,n=this.parseDescription();this.expectKeyword("interface");const i=this.parseName(),r=this.parseImplementsInterfaces(),s=this.parseConstDirectives(),o=this.parseFieldsDefinition();return this.node(t,{kind:w.INTERFACE_TYPE_DEFINITION,description:n,name:i,interfaces:r,directives:s,fields:o})}parseUnionTypeDefinition(){const t=this._lexer.token,n=this.parseDescription();this.expectKeyword("union");const i=this.parseName(),r=this.parseConstDirectives(),s=this.parseUnionMemberTypes();return this.node(t,{kind:w.UNION_TYPE_DEFINITION,description:n,name:i,directives:r,types:s})}parseUnionMemberTypes(){return this.expectOptionalToken(d.EQUALS)?this.delimitedMany(d.PIPE,this.parseNamedType):[]}parseEnumTypeDefinition(){const t=this._lexer.token,n=this.parseDescription();this.expectKeyword("enum");const i=this.parseName(),r=this.parseConstDirectives(),s=this.parseEnumValuesDefinition();return this.node(t,{kind:w.ENUM_TYPE_DEFINITION,description:n,name:i,directives:r,values:s})}parseEnumValuesDefinition(){return this.optionalMany(d.BRACE_L,this.parseEnumValueDefinition,d.BRACE_R)}parseEnumValueDefinition(){const t=this._lexer.token,n=this.parseDescription(),i=this.parseEnumValueName(),r=this.parseConstDirectives();return this.node(t,{kind:w.ENUM_VALUE_DEFINITION,description:n,name:i,directives:r})}parseEnumValueName(){if(this._lexer.token.value==="true"||this._lexer.token.value==="false"||this._lexer.token.value==="null")throw k(this._lexer.source,this._lexer.token.start,`${ye(this._lexer.token)} is reserved and cannot be used for an enum value.`);return this.parseName()}parseInputObjectTypeDefinition(){const t=this._lexer.token,n=this.parseDescription();this.expectKeyword("input");const i=this.parseName(),r=this.parseConstDirectives(),s=this.parseInputFieldsDefinition();return this.node(t,{kind:w.INPUT_OBJECT_TYPE_DEFINITION,description:n,name:i,directives:r,fields:s})}parseInputFieldsDefinition(){return this.optionalMany(d.BRACE_L,this.parseInputValueDef,d.BRACE_R)}parseTypeSystemExtension(){const t=this._lexer.lookahead();if(t.kind===d.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()}throw this.unexpected(t)}parseSchemaExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");const n=this.parseConstDirectives(),i=this.optionalMany(d.BRACE_L,this.parseOperationTypeDefinition,d.BRACE_R);if(n.length===0&&i.length===0)throw this.unexpected();return this.node(t,{kind:w.SCHEMA_EXTENSION,directives:n,operationTypes:i})}parseScalarTypeExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("scalar");const n=this.parseName(),i=this.parseConstDirectives();if(i.length===0)throw this.unexpected();return this.node(t,{kind:w.SCALAR_TYPE_EXTENSION,name:n,directives:i})}parseObjectTypeExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");const n=this.parseName(),i=this.parseImplementsInterfaces(),r=this.parseConstDirectives(),s=this.parseFieldsDefinition();if(i.length===0&&r.length===0&&s.length===0)throw this.unexpected();return this.node(t,{kind:w.OBJECT_TYPE_EXTENSION,name:n,interfaces:i,directives:r,fields:s})}parseInterfaceTypeExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");const n=this.parseName(),i=this.parseImplementsInterfaces(),r=this.parseConstDirectives(),s=this.parseFieldsDefinition();if(i.length===0&&r.length===0&&s.length===0)throw this.unexpected();return this.node(t,{kind:w.INTERFACE_TYPE_EXTENSION,name:n,interfaces:i,directives:r,fields:s})}parseUnionTypeExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");const n=this.parseName(),i=this.parseConstDirectives(),r=this.parseUnionMemberTypes();if(i.length===0&&r.length===0)throw this.unexpected();return this.node(t,{kind:w.UNION_TYPE_EXTENSION,name:n,directives:i,types:r})}parseEnumTypeExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");const n=this.parseName(),i=this.parseConstDirectives(),r=this.parseEnumValuesDefinition();if(i.length===0&&r.length===0)throw this.unexpected();return this.node(t,{kind:w.ENUM_TYPE_EXTENSION,name:n,directives:i,values:r})}parseInputObjectTypeExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");const n=this.parseName(),i=this.parseConstDirectives(),r=this.parseInputFieldsDefinition();if(i.length===0&&r.length===0)throw this.unexpected();return this.node(t,{kind:w.INPUT_OBJECT_TYPE_EXTENSION,name:n,directives:i,fields:r})}parseDirectiveDefinition(){const t=this._lexer.token,n=this.parseDescription();this.expectKeyword("directive"),this.expectToken(d.AT);const i=this.parseName(),r=this.parseArgumentDefs(),s=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");const o=this.parseDirectiveLocations();return this.node(t,{kind:w.DIRECTIVE_DEFINITION,description:n,name:i,arguments:r,repeatable:s,locations:o})}parseDirectiveLocations(){return this.delimitedMany(d.PIPE,this.parseDirectiveLocation)}parseDirectiveLocation(){const t=this._lexer.token,n=this.parseName();if(Object.prototype.hasOwnProperty.call(Fe,n.value))return n;throw this.unexpected(t)}parseSchemaCoordinate(){const t=this._lexer.token,n=this.expectOptionalToken(d.AT),i=this.parseName();let r;!n&&this.expectOptionalToken(d.DOT)&&(r=this.parseName());let s;return(n||r)&&this.expectOptionalToken(d.PAREN_L)&&(s=this.parseName(),this.expectToken(d.COLON),this.expectToken(d.PAREN_R)),n?s?this.node(t,{kind:w.DIRECTIVE_ARGUMENT_COORDINATE,name:i,argumentName:s}):this.node(t,{kind:w.DIRECTIVE_COORDINATE,name:i}):r?s?this.node(t,{kind:w.ARGUMENT_COORDINATE,name:i,fieldName:r,argumentName:s}):this.node(t,{kind:w.MEMBER_COORDINATE,name:i,memberName:r}):this.node(t,{kind:w.TYPE_COORDINATE,name:i})}node(t,n){return this._options.noLocation!==!0&&(n.loc=new Bn(t,this._lexer.lastToken,this._lexer.source)),n}peek(t){return this._lexer.token.kind===t}expectToken(t){const n=this._lexer.token;if(n.kind===t)return this.advanceLexer(),n;throw k(this._lexer.source,n.start,`Expected ${Ot(t)}, found ${ye(n)}.`)}expectOptionalToken(t){return this._lexer.token.kind===t?(this.advanceLexer(),!0):!1}expectKeyword(t){const n=this._lexer.token;if(n.kind===d.NAME&&n.value===t)this.advanceLexer();else throw k(this._lexer.source,n.start,`Expected "${t}", found ${ye(n)}.`)}expectOptionalKeyword(t){const n=this._lexer.token;return n.kind===d.NAME&&n.value===t?(this.advanceLexer(),!0):!1}unexpected(t){const n=t??this._lexer.token;return k(this._lexer.source,n.start,`Unexpected ${ye(n)}.`)}any(t,n,i){this.expectToken(t);const r=[];for(;!this.expectOptionalToken(i);)r.push(n.call(this));return r}optionalMany(t,n,i){if(this.expectOptionalToken(t)){const r=[];do r.push(n.call(this));while(!this.expectOptionalToken(i));return r}return[]}many(t,n,i){this.expectToken(t);const r=[];do r.push(n.call(this));while(!this.expectOptionalToken(i));return r}delimitedMany(t,n){this.expectOptionalToken(t);const i=[];do i.push(n.call(this));while(this.expectOptionalToken(t));return i}advanceLexer(){const{maxTokens:t}=this._options,n=this._lexer.advance();if(n.kind!==d.EOF&&(++this._tokenCounter,t!==void 0&&this._tokenCounter>t))throw k(this._lexer.source,n.start,`Document contains more that ${t} tokens. Parsing aborted.`)}}function ye(e){const t=e.value;return Ot(e.kind)+(t!=null?` "${t}"`:"")}function Ot(e){return Hn(e)?`"${e}"`:e}function hi(e){return`"${e.replace(di,pi)}"`}const di=/[\x00-\x1f\x22\x5c\x7f-\x9f]/g;function pi(e){return mi[e.charCodeAt(0)]}const mi=["\\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"],gi=Object.freeze({});function Ei(e,t,n=mt){const i=new Map;for(const A of Object.values(w))i.set(A,Ni(t,A));let r,s=Array.isArray(e),o=[e],a=-1,u=[],c=e,l,f;const h=[],m=[];do{a++;const A=a===o.length,P=A&&u.length!==0;if(A){if(l=m.length===0?void 0:h[h.length-1],c=f,f=m.pop(),P)if(s){c=c.slice();let _=0;for(const[X,q]of u){const se=X-_;q===null?(c.splice(se,1),_++):c[se]=q}}else{c={...c};for(const[_,X]of u)c[_]=X}a=r.index,o=r.keys,u=r.edits,s=r.inArray,r=r.prev}else if(f){if(l=s?a:o[a],c=f[l],c==null)continue;h.push(l)}let O;if(!Array.isArray(c)){var N,E;gt(c)||Te(!1,`Invalid AST Node: ${Be(c)}.`);const _=A?(N=i.get(c.kind))===null||N===void 0?void 0:N.leave:(E=i.get(c.kind))===null||E===void 0?void 0:E.enter;if(O=_?.call(t,c,l,f,h,m),O===gi)break;if(O===!1){if(!A){h.pop();continue}}else if(O!==void 0&&(u.push([l,O]),!A))if(gt(O))c=O;else{h.pop();continue}}if(O===void 0&&P&&u.push([l,c]),A)h.pop();else{var R;r={inArray:s,index:a,keys:o,edits:u,prev:r},s=Array.isArray(c),o=s?c:(R=n[c.kind])!==null&&R!==void 0?R:[],a=-1,u=[],f&&m.push(f),f=c}}while(r!==void 0);return u.length!==0?u[u.length-1][1]:e}function Ni(e,t){const n=e[t];return typeof n=="object"?n:typeof n=="function"?{enter:n,leave:void 0}:{enter:e.enter,leave:e.leave}}function Ti(e){return Ei(e,vi)}const wi=80,vi={Name:{leave:e=>e.value},Variable:{leave:e=>"$"+e.name},Document:{leave:e=>g(e.definitions,`
23
-
24
- `)},OperationDefinition:{leave(e){const t=Ue(e.variableDefinitions)?I(`(
25
- `,g(e.variableDefinitions,`
26
- `),`
27
- )`):I("(",g(e.variableDefinitions,", "),")"),n=I("",e.description,`
28
- `)+g([e.operation,g([e.name,t]),g(e.directives," ")]," ");return(n==="query"?"":n+" ")+e.selectionSet}},VariableDefinition:{leave:({variable:e,type:t,defaultValue:n,directives:i,description:r})=>I("",r,`
29
- `)+e+": "+t+I(" = ",n)+I(" ",g(i," "))},SelectionSet:{leave:({selections:e})=>U(e)},Field:{leave({alias:e,name:t,arguments:n,directives:i,selectionSet:r}){const s=I("",e,": ")+t;let o=s+I("(",g(n,", "),")");return o.length>wi&&(o=s+I(`(
30
- `,Ie(g(n,`
31
- `)),`
32
- )`)),g([o,g(i," "),r]," ")}},Argument:{leave:({name:e,value:t})=>e+": "+t},FragmentSpread:{leave:({name:e,directives:t})=>"..."+e+I(" ",g(t," "))},InlineFragment:{leave:({typeCondition:e,directives:t,selectionSet:n})=>g(["...",I("on ",e),g(t," "),n]," ")},FragmentDefinition:{leave:({name:e,typeCondition:t,variableDefinitions:n,directives:i,selectionSet:r,description:s})=>I("",s,`
33
- `)+`fragment ${e}${I("(",g(n,", "),")")} on ${t} ${I("",g(i," ")," ")}`+r},IntValue:{leave:({value:e})=>e},FloatValue:{leave:({value:e})=>e},StringValue:{leave:({value:e,block:t})=>t?Gn(e):hi(e)},BooleanValue:{leave:({value:e})=>e?"true":"false"},NullValue:{leave:()=>"null"},EnumValue:{leave:({value:e})=>e},ListValue:{leave:({values:e})=>"["+g(e,", ")+"]"},ObjectValue:{leave:({fields:e})=>"{"+g(e,", ")+"}"},ObjectField:{leave:({name:e,value:t})=>e+": "+t},Directive:{leave:({name:e,arguments:t})=>"@"+e+I("(",g(t,", "),")")},NamedType:{leave:({name:e})=>e},ListType:{leave:({type:e})=>"["+e+"]"},NonNullType:{leave:({type:e})=>e+"!"},SchemaDefinition:{leave:({description:e,directives:t,operationTypes:n})=>I("",e,`
34
- `)+g(["schema",g(t," "),U(n)]," ")},OperationTypeDefinition:{leave:({operation:e,type:t})=>e+": "+t},ScalarTypeDefinition:{leave:({description:e,name:t,directives:n})=>I("",e,`
35
- `)+g(["scalar",t,g(n," ")]," ")},ObjectTypeDefinition:{leave:({description:e,name:t,interfaces:n,directives:i,fields:r})=>I("",e,`
36
- `)+g(["type",t,I("implements ",g(n," & ")),g(i," "),U(r)]," ")},FieldDefinition:{leave:({description:e,name:t,arguments:n,type:i,directives:r})=>I("",e,`
37
- `)+t+(Ue(n)?I(`(
38
- `,Ie(g(n,`
39
- `)),`
40
- )`):I("(",g(n,", "),")"))+": "+i+I(" ",g(r," "))},InputValueDefinition:{leave:({description:e,name:t,type:n,defaultValue:i,directives:r})=>I("",e,`
41
- `)+g([t+": "+n,I("= ",i),g(r," ")]," ")},InterfaceTypeDefinition:{leave:({description:e,name:t,interfaces:n,directives:i,fields:r})=>I("",e,`
42
- `)+g(["interface",t,I("implements ",g(n," & ")),g(i," "),U(r)]," ")},UnionTypeDefinition:{leave:({description:e,name:t,directives:n,types:i})=>I("",e,`
43
- `)+g(["union",t,g(n," "),I("= ",g(i," | "))]," ")},EnumTypeDefinition:{leave:({description:e,name:t,directives:n,values:i})=>I("",e,`
44
- `)+g(["enum",t,g(n," "),U(i)]," ")},EnumValueDefinition:{leave:({description:e,name:t,directives:n})=>I("",e,`
45
- `)+g([t,g(n," ")]," ")},InputObjectTypeDefinition:{leave:({description:e,name:t,directives:n,fields:i})=>I("",e,`
46
- `)+g(["input",t,g(n," "),U(i)]," ")},DirectiveDefinition:{leave:({description:e,name:t,arguments:n,repeatable:i,locations:r})=>I("",e,`
47
- `)+"directive @"+t+(Ue(n)?I(`(
48
- `,Ie(g(n,`
49
- `)),`
50
- )`):I("(",g(n,", "),")"))+(i?" repeatable":"")+" on "+g(r," | ")},SchemaExtension:{leave:({directives:e,operationTypes:t})=>g(["extend schema",g(e," "),U(t)]," ")},ScalarTypeExtension:{leave:({name:e,directives:t})=>g(["extend scalar",e,g(t," ")]," ")},ObjectTypeExtension:{leave:({name:e,interfaces:t,directives:n,fields:i})=>g(["extend type",e,I("implements ",g(t," & ")),g(n," "),U(i)]," ")},InterfaceTypeExtension:{leave:({name:e,interfaces:t,directives:n,fields:i})=>g(["extend interface",e,I("implements ",g(t," & ")),g(n," "),U(i)]," ")},UnionTypeExtension:{leave:({name:e,directives:t,types:n})=>g(["extend union",e,g(t," "),I("= ",g(n," | "))]," ")},EnumTypeExtension:{leave:({name:e,directives:t,values:n})=>g(["extend enum",e,g(t," "),U(n)]," ")},InputObjectTypeExtension:{leave:({name:e,directives:t,fields:n})=>g(["extend input",e,g(t," "),U(n)]," ")},TypeCoordinate:{leave:({name:e})=>e},MemberCoordinate:{leave:({name:e,memberName:t})=>g([e,I(".",t)])},ArgumentCoordinate:{leave:({name:e,fieldName:t,argumentName:n})=>g([e,I(".",t),I("(",n,":)")])},DirectiveCoordinate:{leave:({name:e})=>g(["@",e])},DirectiveArgumentCoordinate:{leave:({name:e,argumentName:t})=>g(["@",e,I("(",t,":)")])}};function g(e,t=""){var n;return(n=e?.filter(i=>i).join(t))!==null&&n!==void 0?n:""}function U(e){return I(`{
51
- `,Ie(g(e,`
52
- `)),`
53
- }`)}function I(e,t,n=""){return t!=null&&t!==""?e+t+n:""}function Ie(e){return I(" ",e.replace(/\n/g,`
54
- `))}function Ue(e){var t;return(t=e?.some(n=>n.includes(`
55
- `)))!==null&&t!==void 0?t:!1}const At="Accept",Ve="Content-Type",je="application/json",St="application/graphql-response+json",Dt=e=>e.replace(/([\s,]|#[^\n\r]+)+/g," ").trim(),yi=e=>{const t=e.toLowerCase();return t.includes(St)||t.includes(je)},_t=e=>{try{if(Array.isArray(e))return{_tag:"Batch",executionResults:e.map(xt)};if(Ne(e))return{_tag:"Single",executionResult:xt(e)};throw new Error(`Invalid execution result: result is not object or array.
56
- Got:
57
- ${String(e)}`)}catch(t){return t}},xt=e=>{if(typeof e!="object"||e===null)throw new Error("Invalid execution result: result is not object");let t,n,i;if("errors"in e){if(!Ne(e.errors)&&!Array.isArray(e.errors))throw new Error("Invalid execution result: errors is not plain object OR array");t=e.errors}if("data"in e){if(!Ne(e.data)&&e.data!==null)throw new Error("Invalid execution result: data is not plain object");n=e.data}if("extensions"in e){if(!Ne(e.extensions))throw new Error("Invalid execution result: extensions is not plain object");i=e.extensions}return{data:n,errors:t,extensions:i}},Ii=e=>e._tag==="Batch"?e.executionResults.some(Ct):Ct(e.executionResult),Ct=e=>Array.isArray(e.errors)?e.errors.length>0:!!e.errors,kt=e=>typeof e=="object"&&e!==null&&"kind"in e&&e.kind===w.OPERATION_DEFINITION,Oi=e=>{let t;const n=e.definitions.filter(kt);return n.length===1&&(t=n[0].name?.value),t},Ai=e=>{let t=!1;const n=e.definitions.filter(kt);return n.length===1&&(t=n[0].operation==="mutation"),t},$e=(e,t)=>{const n=typeof e=="string"||"kind"in e?e:String(e),i=typeof n=="string"?n:Ti(n);let r=!1,s;if(t)return{expression:i,isMutation:r,operationName:s};const o=Cn(()=>typeof n=="string"?li(n):n);return o instanceof Error?{expression:i,isMutation:r,operationName:s}:(s=Oi(o),r=Ai(o),{expression:i,operationName:s,isMutation:r})},Ge=JSON,Ye=async e=>{const t={...e,method:e.request._tag==="Single"?e.request.document.isMutation?"POST":ct(e.method??"post"):e.request.hasMutations?"POST":ct(e.method??"post"),fetchOptions:{...e.fetchOptions,errorPolicy:e.fetchOptions.errorPolicy??"none"}},i=await Di(t.method)(t),r=await i.text();let s;try{s=Si(r,i.headers.get(Ve),e.fetchOptions.jsonSerializer??Ge)}catch(a){s=a}const o={status:i.status,headers:i.headers,body:r};if(!i.ok){if(s instanceof Error)return new W({...o},{query:e.request._tag==="Single"?e.request.document.expression:e.request.query,variables:e.request.variables});const a=s._tag==="Batch"?{...s.executionResults,...o}:{...s.executionResult,...o};return new W(a,{query:e.request._tag==="Single"?e.request.document.expression:e.request.query,variables:e.request.variables})}if(s instanceof Error)throw s;if(Ii(s)&&t.fetchOptions.errorPolicy==="none"){const a=s._tag==="Batch"?{...s.executionResults,...o}:{...s.executionResult,...o};return new W(a,{query:e.request._tag==="Single"?e.request.document.expression:e.request.query,variables:e.request.variables})}switch(s._tag){case"Single":return{...o,...Rt(t)(s.executionResult)};case"Batch":return{...o,data:s.executionResults.map(Rt(t))};default:be(s)}},Rt=e=>t=>({extensions:t.extensions,data:t.data,errors:e.fetchOptions.errorPolicy==="all"?t.errors:void 0}),Si=(e,t,n)=>t&&yi(t)?_t(n.parse(e)):_t(e),Di=e=>async t=>{const n=new Headers(t.headers);let i=null,r;n.has(At)||n.set(At,[St,je].join(", ")),e==="POST"?(r=(t.fetchOptions.jsonSerializer??Ge).stringify(_i(t)),typeof r=="string"&&!n.has(Ve)&&n.set(Ve,je)):i=xi(t);const s={method:e,headers:n,body:r,...t.fetchOptions};let o=new URL(t.url),a=s;if(t.middleware){const c=await Promise.resolve(t.middleware({...s,url:t.url,operationName:t.request._tag==="Single"?t.request.document.operationName:void 0,variables:t.request.variables})),{url:l,...f}=c;o=new URL(l),a=f}return i&&i.forEach((c,l)=>{o.searchParams.append(l,c)}),await(t.fetch??fetch)(o,a)},_i=e=>{switch(e.request._tag){case"Single":return{query:e.request.document.expression,variables:e.request.variables,operationName:e.request.document.operationName};case"Batch":return ut(e.request.query,e.request.variables??[]).map(([t,n])=>({query:t,variables:n}));default:throw be(e.request)}},xi=e=>{const t=e.fetchOptions.jsonSerializer??Ge,n=new URLSearchParams;switch(e.request._tag){case"Single":return n.append("query",Dt(e.request.document.expression)),e.request.variables&&n.append("variables",t.stringify(e.request.variables)),e.request.document.operationName&&n.append("operationName",e.request.document.operationName),n;case"Batch":{const i=e.request.variables?.map(o=>t.stringify(o))??[],r=e.request.query.map(Dt),s=ut(r,i).map(([o,a])=>({query:o,variables:a}));return n.append("query",t.stringify(s)),n}default:throw be(e.request)}};class Ci{url;requestConfig;constructor(t,n={}){this.url=t,this.requestConfig=n}rawRequest=async(...t)=>{const[n,i,r]=t,s=bn(n,i,r),{headers:o,fetch:a=globalThis.fetch,method:u="POST",requestMiddleware:c,responseMiddleware:l,excludeOperationName:f,...h}=this.requestConfig,{url:m}=this;s.signal!==void 0&&(h.signal=s.signal);const N=$e(s.query,f),E=await Ye({url:m,request:{_tag:"Single",document:N,variables:s.variables},headers:{...ne(Re(o)),...ne(s.requestHeaders)},fetch:a,method:u,fetchOptions:h,middleware:c});if(l&&await l(E,{operationName:N.operationName,variables:i,url:this.url}),E instanceof Error)throw E;return E};async request(t,...n){const[i,r]=n,s=ki(t,i,r),{headers:o,fetch:a=globalThis.fetch,method:u="POST",requestMiddleware:c,responseMiddleware:l,excludeOperationName:f,...h}=this.requestConfig,{url:m}=this;s.signal!==void 0&&(h.signal=s.signal);const N=$e(s.document,f),E=await Ye({url:m,request:{_tag:"Single",document:N,variables:s.variables},headers:{...ne(Re(o)),...ne(s.requestHeaders)},fetch:a,method:u,fetchOptions:h,middleware:c});if(l&&await l(E,{operationName:N.operationName,variables:s.variables,url:this.url}),E instanceof Error)throw E;return E.data}async batchRequests(t,n){const i=Rn(t,n),{headers:r,excludeOperationName:s,...o}=this.requestConfig;i.signal!==void 0&&(o.signal=i.signal);const a=i.documents.map(({document:h})=>$e(h,s)),u=a.map(({expression:h})=>h),c=a.some(({isMutation:h})=>h),l=i.documents.map(({variables:h})=>h),f=await Ye({url:this.url,request:{_tag:"Batch",operationName:void 0,query:u,hasMutations:c,variables:l},headers:{...ne(Re(r)),...ne(i.requestHeaders)},fetch:this.requestConfig.fetch??globalThis.fetch,method:this.requestConfig.method||"POST",fetchOptions:o,middleware:this.requestConfig.requestMiddleware});if(this.requestConfig.responseMiddleware&&await this.requestConfig.responseMiddleware(f,{operationName:void 0,variables:l,url:this.url}),f instanceof Error)throw f;return f.data}setHeaders(t){return this.requestConfig.headers=t,this}setHeader(t,n){const{headers:i}=this.requestConfig;return i?i[t]=n:this.requestConfig.headers={[t]:n},this}setEndpoint(t){return this.url=t,this}}const ki=(e,t,n)=>e.document?e:{document:e,variables:t,requestHeaders:n,signal:void 0},bt=(e,...t)=>e.reduce((n,i,r)=>`${n}${i}${r in t?String(t[r]):""}`,""),Lt={getMeta:bt`
58
- query getDoctype($doctype: String!) {
59
- getMeta(doctype: $doctype) {
60
- id
61
- name
62
- workflow
63
- schema
64
- actions
65
- }
66
- }
67
- `},Ri=bt`
68
- type Doctype {
69
- id: ID!
70
- name: String!
71
- workflow: String!
72
- schema: String!
73
- actions: String!
74
- }
75
-
76
- type DoctypeField {
77
- id: ID!
78
- label: String!
79
- fieldtype: String
80
- component: String
81
- required: Boolean
82
- readonly: Boolean
83
- }
84
-
85
- type DoctypeWorkflow {
86
- name: String!
87
- machine: StateMachine!
88
- }
89
-
90
- type StateMachine {
91
- id: ID!
92
- }
93
-
94
- type DoctypeAction {
95
- eventName: String!
96
- callback: String
97
- }
98
-
99
- type Query {
100
- getMeta(doctype: String!): Doctype # ∪ error
101
- getRecords(doctype: String!, filters: [String]): [String] # ∪ error
102
- getRecord(doctype: String!, id: ID!): String # ∪ error
103
- }
104
-
105
- type Mutation {
106
- runAction(doctype: String!, id: [ID!]!, functionName: String!): [String!]! # ∪ error
107
- }
108
-
109
- schema {
110
- query: Query
111
- mutation: Mutation
112
- }
113
- `;class bi{endpoint;headers;metaCache=new Map;constructor(t){this.endpoint=t.endpoint,this.headers={"Content-Type":"application/json",...t.headers}}async query(t,n){const r=await(await fetch(this.endpoint,{method:"POST",headers:this.headers,body:JSON.stringify({query:t,variables:n})})).json();if(r.errors?.length)throw new Error(r.errors[0].message);return r.data}async mutate(t,n){return this.query(t,n)}async getMeta(t){const n=this.metaCache.get(t.doctype);if(n)return n;const i=await this.query(`
114
- query GetMeta($doctype: String!) {
115
- stonecropMeta(doctype: $doctype) {
116
- name
117
- slug
118
- tableName
119
- fields {
120
- fieldname
121
- fieldtype
122
- component
123
- label
124
- required
125
- readOnly
126
- options
127
- precision
128
- scale
129
- }
130
- workflow {
131
- states
132
- actions
133
- }
134
- inherits
135
- listDoctype
136
- parentDoctype
137
- }
138
- }
139
- `,{doctype:t.doctype});return i.stonecropMeta&&this.metaCache.set(t.doctype,i.stonecropMeta),i.stonecropMeta}async getAllMeta(){const t=await this.query(`
140
- query GetAllMeta {
141
- stonecropAllMeta {
142
- name
143
- slug
144
- tableName
145
- fields {
146
- fieldname
147
- fieldtype
148
- component
149
- label
150
- required
151
- readOnly
152
- options
153
- precision
154
- scale
155
- }
156
- workflow {
157
- states
158
- actions
159
- }
160
- inherits
161
- listDoctype
162
- parentDoctype
163
- }
164
- }
165
- `);for(const n of t.stonecropAllMeta)this.metaCache.set(n.name,n);return t.stonecropAllMeta}async getRecord(t,n){return(await this.query(`
166
- query GetRecord($doctype: String!, $id: String!) {
167
- stonecropRecord(doctype: $doctype, id: $id) {
168
- data
169
- }
170
- }
171
- `,{doctype:t.name,id:n})).stonecropRecord.data}async getRecords(t,n){return(await this.query(`
172
- query GetRecords(
173
- $doctype: String!
174
- $filters: JSON
175
- $orderBy: String
176
- $limit: Int
177
- $offset: Int
178
- ) {
179
- stonecropRecords(
180
- doctype: $doctype
181
- filters: $filters
182
- orderBy: $orderBy
183
- limit: $limit
184
- offset: $offset
185
- ) {
186
- data
187
- count
188
- }
189
- }
190
- `,{doctype:t.name,...n})).stonecropRecords.data}async runAction(t,n,i){return(await this.query(`
191
- mutation RunAction($doctype: String!, $action: String!, $args: JSON) {
192
- stonecropAction(doctype: $doctype, action: $action, args: $args) {
193
- success
194
- data
195
- error
196
- }
197
- }
198
- `,{doctype:t.name,action:n,args:i})).stonecropAction}clearMetaCache(){this.metaCache.clear()}}const Li=e=>JSON.parse(e,(t,n)=>{if(typeof n=="string")try{return JSON.parse(n,(i,r)=>typeof r=="string"&&!isNaN(Number(r))?new te(r):r)}catch{return n}else if(!isNaN(Number(n)))return new te(n);return n}),Mi={getMeta:async(e,t)=>{const n=new Ci(t||"/graphql",{fetch:window.fetch,jsonSerializer:{stringify:r=>JSON.stringify(r),parse:Li}}),{getMeta:i}=await n.request({document:Lt.getMeta,variables:{doctype:e}});return i}};Y.StonecropClient=bi,Y.methods=Mi,Y.queries=Lt,Y.typeDefs=Ri,Object.defineProperty(Y,Symbol.toStringTag,{value:"Module"})}));
199
- //# sourceMappingURL=graphql-client.umd.cjs.map